@capillarytech/creatives-library 7.17.97-alpha.0 → 7.17.97

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.97-alpha.0",
4
+ "version": "7.17.97",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -65,6 +65,7 @@ const CapDeviceContent = (props) => {
65
65
  tags,
66
66
  onTagSelect,
67
67
  handleOnTagsContextChange,
68
+ templateDescErrorHandler,
68
69
  } = props || {};
69
70
  const { TextArea } = CapInput;
70
71
  const { formatMessage } = intl;
@@ -73,7 +74,7 @@ const CapDeviceContent = (props) => {
73
74
  const isMediaTypeImage = INAPP_MEDIA_TYPES.IMAGE === templateMediaType;
74
75
  const isBtnTypeCta = buttonType === INAPP_BUTTON_TYPES.CTA;
75
76
  const onTemplateMessageChange = ({ target: { value } }) => {
76
- let error = '';
77
+ let error = templateDescErrorHandler(value);
77
78
  if (value === '') {
78
79
  error = formatMessage(messages.emptyTemplateMessageErrorMessage);
79
80
  }
@@ -929,7 +929,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
929
929
  }
930
930
  // Check if template subject present in form data from Loyalty, DVS, Timeline
931
931
  if (index === 'template-subject' && type.toLowerCase() === 'embedded' && (currentModule.toLowerCase() === 'loyalty' || currentModule.toLowerCase() === 'dvs' || currentModule.toLowerCase() === 'timeline' || currentModule.toLowerCase() === 'library')) {
932
- if ((data && data.trim() === '') || !data) {
932
+ if (data && data.trim() === '') {
933
933
  errorData[index] = true;
934
934
  isValid = false;
935
935
  } else {
@@ -47,15 +47,14 @@ class MobilePushPreviewV2 extends React.Component { // eslint-disable-line react
47
47
  templateTitle: androidContent?.title,
48
48
  templateMsg: androidContent?.message,
49
49
  mediaPreview: { inAppImageSrcAndroid: androidContent?.expandableDetails?.image },
50
- ctaData: androidContent?.expandableDetails?.buttons?.map((cta) => {
51
- const { index, type, text, url = "", label } = cta;
50
+ ctaData: androidContent?.expandableDetails?.ctas?.map((cta, index) => {
51
+ const { type = '', actionText = '', actionLink = "" } = cta;
52
52
  const ctaObject = {
53
53
  index,
54
- text,
55
- url,
54
+ text: actionText,
55
+ url: actionLink,
56
56
  urlType: type,
57
57
  isSaved: true,
58
- label,
59
58
  };
60
59
  return ctaObject;
61
60
  }),
@@ -64,15 +63,14 @@ class MobilePushPreviewV2 extends React.Component { // eslint-disable-line react
64
63
  templateTitle: iosContent?.title,
65
64
  templateMsg: iosContent?.message,
66
65
  mediaPreview: { inAppImageSrcIos: iosContent?.expandableDetails?.image },
67
- ctaData: iosContent?.expandableDetails?.buttons?.map((cta) => {
68
- const { index, type, text, url = "", label } = cta;
66
+ ctaData: iosContent?.expandableDetails?.ctas?.map((cta, index) => {
67
+ const { type = '', actionText = '', actionLink = "" } = cta;
69
68
  const ctaObject = {
70
69
  index,
71
- text,
72
- url,
70
+ text: actionText,
71
+ url: actionLink,
73
72
  urlType: type,
74
73
  isSaved: true,
75
- label,
76
74
  };
77
75
  return ctaObject;
78
76
  }),
@@ -38,7 +38,7 @@
38
38
  }
39
39
 
40
40
  .inapp-content-POPUP-ANDROID {
41
- margin-top: $CAP_SPACE_12;
41
+ margin-top: $CAP_SPACE_08;
42
42
  margin-right: $CAP_SPACE_08;
43
43
  margin-left: $CAP_SPACE_08;
44
44
  width: 178px;
@@ -81,7 +81,7 @@
81
81
  left: 26%;
82
82
  bottom: -21px;
83
83
  text-align: center;
84
- top: 22%;
84
+ top: 22px;
85
85
  }
86
86
 
87
87
  .inapp-image-HEADER-ANDROID {
@@ -221,7 +221,7 @@
221
221
 
222
222
  .inapp-content-FULLSCREEN-ANDROID {
223
223
  width: 186px;
224
- height: 144px;
224
+ max-height: 144px;
225
225
  text-align: left;
226
226
  margin-top: $CAP_SPACE_04;
227
227
  text-overflow: ellipsis;
@@ -440,7 +440,7 @@
440
440
 
441
441
  .inapp-content-FULLSCREEN-iOS {
442
442
  width: 186px;
443
- height: 144px;
443
+ max-height: 144px;
444
444
  text-align: left;
445
445
  margin-top: $CAP_SPACE_04;
446
446
  text-overflow: ellipsis;
@@ -808,6 +808,9 @@ export function SlideBoxContent(props) {
808
808
  query,
809
809
  search: '',
810
810
  }}
811
+ getFormData={getFormData}
812
+ isGetFormData={isGetFormData}
813
+ templateData={templateData}
811
814
  />
812
815
  )}
813
816
 
@@ -291,12 +291,14 @@ export class Creatives extends React.Component {
291
291
  type: channel,
292
292
  name: templateData.messageSubject,
293
293
  versions: {
294
- content: {
295
- ANDROID: templateData.androidContent,
296
- IOS: templateData.iosContent,
294
+ base: {
295
+ content: {
296
+ ANDROID: templateData?.androidContent,
297
+ IOS: templateData?.iosContent,
298
+ },
297
299
  },
298
300
  },
299
- definition: {accountId: templateData.accountId, mode: mode.toLowerCase()},
301
+ definition: {accountId: templateData?.accountId, mode: mode?.toLowerCase()},
300
302
  };
301
303
  break;
302
304
  }
@@ -2069,13 +2069,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2069
2069
  formData[0].selectedLanguages = [];
2070
2070
  let tabKey;
2071
2071
  if ((this.props.location.query.isLanguageSupport === undefined || this.props.location.query.isLanguageSupport === 'false')) {
2072
- const templateSubject = formData?.['template-subject'];
2073
- const baseSubject = data?.base?.subject;
2074
- if (templateSubject === '') {
2075
- formData['template-subject'] = '';
2076
- } else if (!templateSubject && baseSubject) {
2077
- formData['template-subject'] = baseSubject;
2078
- }
2072
+ formData['template-subject'] = data.base.subject ? data.base.subject : '';
2079
2073
  const baseLanguage = this.props.currentOrgDetails.basic_details.base_language;
2080
2074
  let languageIndex = _.findIndex(this.supportedLanguages, {iso_code: baseLanguage});
2081
2075
 
@@ -1,5 +1,15 @@
1
1
  import React from "react";
2
2
  import { FormattedMessage } from "react-intl";
3
+ import {
4
+ CAP_ORANGE,
5
+ CAP_PURPLE02,
6
+ CAP_PURPLE03,
7
+ CAP_ORANGE01,
8
+ CAP_GREEN01,
9
+ CAP_GREEN02,
10
+ CAP_PALE_GREY,
11
+ FONT_COLOR_05,
12
+ } from '@capillarytech/cap-ui-library/styled/variables';
3
13
  import CapHeading from "@capillarytech/cap-ui-library/CapHeading";
4
14
  import CapLabel from "@capillarytech/cap-ui-library/CapLabel";
5
15
  import { WEBSITE } from "../../v2Components/CapInAppCTA/constants";
@@ -123,3 +133,10 @@ export const BUTTON_RADIO_OPTIONS = [
123
133
  ),
124
134
  },
125
135
  ];
136
+
137
+ export const INAPP_LAYOUT_DETAILS = {
138
+ POPUP: { tagColor: CAP_ORANGE01, tagTextColor: CAP_ORANGE, text: 'Pop-up'},
139
+ HEADER: { tagColor: CAP_PURPLE03, tagTextColor: CAP_PURPLE02, text: 'Header'},
140
+ FOOTER: { tagColor: CAP_PALE_GREY, tagTextColor: FONT_COLOR_05, text: 'Footer'},
141
+ FULLSCREEN: { tagColor: CAP_GREEN02, tagTextColor: CAP_GREEN01, text: 'Full screen'},
142
+ };
@@ -116,9 +116,11 @@ export const InApp = (props) => {
116
116
  configs = {},
117
117
  name = "",
118
118
  } = accountObj;
119
+ const isAndroidSupported = configs.android === '1';
119
120
  //get deep link keys in an array
120
121
  const deepLinkKeys = Object.values(JSON.parse(deepLinkObj));
121
122
  const keys = deepLinkKeys.map((link) => ({label: link.name, value: link.link, title: link.link }));
123
+ setPanes(isAndroidSupported ? ANDROID : IOS);
122
124
  setDeepLink(keys);
123
125
  setAccountId(sourceAccountIdentifier);
124
126
  setAccessToken(configs.accessToken || "");
@@ -147,7 +149,7 @@ export const InApp = (props) => {
147
149
  name = "",
148
150
  versions = {},
149
151
  createdAt = "",
150
- } = isFullMode ? editData.templateDetails || {} : templateData || {};
152
+ } = isFullMode ? editData?.templateDetails || {} : templateData || {};
151
153
  editContent = get(versions, `base.content`, {});
152
154
  if (editContent && !isEmpty(editContent)) {
153
155
  setEditFlow(true);
@@ -155,68 +157,72 @@ export const InApp = (props) => {
155
157
  setTemplateDate(createdAt);
156
158
  setTemplateLayoutType(editContent?.ANDROID?.bodyType);
157
159
  const androidContent = editContent?.ANDROID;
158
- const {
159
- title: androidTitle,
160
- message: androidMessage,
161
- cta: androidCta,
162
- expandableDetails: androidExpandableDetails,
163
- } = androidContent;
164
- setTitleAndroid(androidTitle);
165
- setTemplateMessageAndroid(androidMessage);
166
- setTemplateMediaType(
167
- androidExpandableDetails?.style === BIG_TEXT
168
- ? INAPP_MEDIA_TYPES.TEXT
169
- : INAPP_MEDIA_TYPES.IMAGE
170
- );
171
- setInAppImageSrcAndroid(androidExpandableDetails?.image);
172
- setDeepLinkValueAndroid(androidCta?.actionLink);
173
- setAddActionLinkAndroid(!isEmpty(androidCta) && true);
174
- setButtonTypeAndroid(
175
- androidExpandableDetails?.ctas?.length ? INAPP_BUTTON_TYPES.CTA : INAPP_BUTTON_TYPES.NONE
176
- );
177
- if (androidExpandableDetails?.ctas?.length > 0) {
178
- setCtaDataAndroid(
179
- androidExpandableDetails?.ctas?.map((cta, index) => {
180
- const { type, actionText, actionLink = "" } = cta;
181
- const obj = {
182
- index,
183
- text: actionText,
184
- url: actionLink,
185
- urlType: type,
186
- isSaved: true,
187
- };
188
- return obj;
189
- })
160
+ if (!isEmpty(androidContent)) {
161
+ const {
162
+ title: androidTitle = '',
163
+ message: androidMessage = '',
164
+ cta: androidCta = {},
165
+ expandableDetails: androidExpandableDetails = {},
166
+ } = androidContent || {};
167
+ setTitleAndroid(androidTitle);
168
+ setTemplateMessageAndroid(androidMessage);
169
+ setTemplateMediaType(
170
+ androidExpandableDetails?.style === BIG_TEXT
171
+ ? INAPP_MEDIA_TYPES.TEXT
172
+ : INAPP_MEDIA_TYPES.IMAGE
190
173
  );
174
+ setInAppImageSrcAndroid(androidExpandableDetails?.image);
175
+ setDeepLinkValueAndroid(androidCta?.actionLink);
176
+ setAddActionLinkAndroid(!isEmpty(androidCta) && true);
177
+ setButtonTypeAndroid(
178
+ androidExpandableDetails?.ctas?.length ? INAPP_BUTTON_TYPES.CTA : INAPP_BUTTON_TYPES.NONE
179
+ );
180
+ if (androidExpandableDetails?.ctas?.length > 0) {
181
+ setCtaDataAndroid(
182
+ androidExpandableDetails?.ctas?.map((cta, index) => {
183
+ const { type = '', actionText = '', actionLink = "" } = cta;
184
+ const obj = {
185
+ index,
186
+ text: actionText,
187
+ url: actionLink,
188
+ urlType: type,
189
+ isSaved: true,
190
+ };
191
+ return obj;
192
+ })
193
+ );
194
+ }
191
195
  }
192
196
  const iosContent = editContent?.IOS;
193
- const {
194
- title: iosTitle,
195
- message: iosMessage,
196
- cta: iosCta,
197
- expandableDetails: iosExpandableDetails,
198
- } = iosContent;
199
- setTitleIos(iosTitle);
200
- setTemplateMessageIos(iosMessage);
201
- setTemplateMediaType(iosExpandableDetails?.style === BIG_TEXT ? INAPP_MEDIA_TYPES.TEXT : INAPP_MEDIA_TYPES.IMAGE);
202
- setInAppImageSrcIos(iosExpandableDetails?.image);
203
- setButtonTypeIos(iosExpandableDetails?.ctas?.length ? INAPP_BUTTON_TYPES.CTA : INAPP_BUTTON_TYPES.NONE);
204
- setAddActionLinkIos(!isEmpty(iosCta) && true);
205
- setDeepLinkValueIos(iosCta?.actionLink);
206
- if (iosExpandableDetails?.ctas?.length > 0) {
207
- setCtaDataIos(
208
- iosExpandableDetails?.ctas?.map((cta, index) => {
209
- const { type, actionText, actionLink = "" } = cta;
210
- const obj = {
211
- index,
212
- text: actionText,
213
- url: actionLink,
214
- urlType: type,
215
- isSaved: true,
216
- };
217
- return obj;
218
- })
219
- );
197
+ if (!isEmpty(iosContent)) {
198
+ const {
199
+ title: iosTitle = '',
200
+ message: iosMessage = '',
201
+ cta: iosCta = {},
202
+ expandableDetails: iosExpandableDetails = {},
203
+ } = iosContent || {};
204
+ setTitleIos(iosTitle);
205
+ setTemplateMessageIos(iosMessage);
206
+ setTemplateMediaType(iosExpandableDetails?.style === BIG_TEXT ? INAPP_MEDIA_TYPES.TEXT : INAPP_MEDIA_TYPES.IMAGE);
207
+ setInAppImageSrcIos(iosExpandableDetails?.image);
208
+ setButtonTypeIos(iosExpandableDetails?.ctas?.length ? INAPP_BUTTON_TYPES.CTA : INAPP_BUTTON_TYPES.NONE);
209
+ setAddActionLinkIos(!isEmpty(iosCta) && true);
210
+ setDeepLinkValueIos(iosCta?.actionLink);
211
+ if (iosExpandableDetails?.ctas?.length > 0) {
212
+ setCtaDataIos(
213
+ iosExpandableDetails?.ctas?.map((cta, index) => {
214
+ const { type = '', actionText = '', actionLink = "" } = cta;
215
+ const obj = {
216
+ index,
217
+ text: actionText,
218
+ url: actionLink,
219
+ urlType: type,
220
+ isSaved: true,
221
+ };
222
+ return obj;
223
+ })
224
+ );
225
+ }
220
226
  }
221
227
  }
222
228
  }, [editData.templateDetails || templateData]);
@@ -373,6 +379,7 @@ export const InApp = (props) => {
373
379
  ),
374
380
  tab: <FormattedMessage {...messages.Android} />,
375
381
  key: ANDROID,
382
+ isSupported: accountData?.selectedWeChatAccount?.configs?.android === '1',
376
383
  },
377
384
  {
378
385
  content: (
@@ -415,6 +422,7 @@ export const InApp = (props) => {
415
422
  ),
416
423
  tab: <FormattedMessage {...messages.Ios} />,
417
424
  key: IOS,
425
+ isSupported: accountData?.selectedWeChatAccount?.configs?.android === '1',
418
426
  },
419
427
  ];
420
428
 
@@ -499,24 +507,24 @@ export const InApp = (props) => {
499
507
  );
500
508
  };
501
509
 
502
- const isDisableDone = () => {
510
+ const isDisableDone = (device) => {
503
511
  //if template name is not entered
504
- if (templateName.trim() === '') {
512
+ if (isFullMode && templateName.trim() === '') {
505
513
  return true;
506
514
  }
507
515
  //if template message is not entered
508
516
  //for android
509
- if (panes === ANDROID && (templateMessageAndroid.trim() === '' || templateMessageErrorAndroid)) {
517
+ if (device === ANDROID && (templateMessageAndroid.trim() === '' || templateMessageErrorAndroid)) {
510
518
  return true;
511
519
  }
512
- if (panes === IOS && (templateMessageIos.trim() === '' || templateMessageErrorIos)) {
520
+ if (device === IOS && (templateMessageIos.trim() === '' || templateMessageErrorIos)) {
513
521
  return true;
514
522
  }//for ios
515
523
  //if media type is image and the mediaType file is not uploaded
516
- if (panes === ANDROID && !(templateMediaType === INAPP_MEDIA_TYPES.TEXT) && inAppImageSrcAndroid === '') {
524
+ if (device === ANDROID && !(templateMediaType === INAPP_MEDIA_TYPES.TEXT) && inAppImageSrcAndroid === '') {
517
525
  return true;
518
526
  }
519
- if (panes === IOS && !(templateMediaType === INAPP_MEDIA_TYPES.TEXT) && inAppImageSrcIos === '') {
527
+ if (device === IOS && !(templateMediaType === INAPP_MEDIA_TYPES.TEXT) && inAppImageSrcIos === '') {
520
528
  return true;
521
529
  }
522
530
  //cta
@@ -581,7 +589,7 @@ export const InApp = (props) => {
581
589
  versions: {
582
590
  base: {
583
591
  content: {
584
- ANDROID: {
592
+ ANDROID: !isDisableDone(ANDROID) ? {
585
593
  ...commonDevicePayload,
586
594
  title: titleAndroid,
587
595
  message: templateMessageAndroid,
@@ -595,9 +603,11 @@ export const InApp = (props) => {
595
603
  }),
596
604
  },
597
605
  custom: [],
598
- cta: deepLinkValueAndroid ? {type: DEEP_LINK, actionLink: deepLinkValueAndroid} : {},
599
- },
600
- IOS: {
606
+ ...(deepLinkValueAndroid && {
607
+ ctas: [{type: DEEP_LINK, actionLink: deepLinkValueAndroid}],
608
+ }),
609
+ } : {},
610
+ IOS: !isDisableDone(IOS) ? {
601
611
  ...commonDevicePayload,
602
612
  title: titleIos,
603
613
  message: templateMessageIos,
@@ -611,8 +621,10 @@ export const InApp = (props) => {
611
621
  }),
612
622
  },
613
623
  custom: [],
614
- cta: deepLinkValueIos ? {type: DEEP_LINK, actionLink: deepLinkValueIos} : {},
615
- },
624
+ ...(deepLinkValueIos && {
625
+ ctas: [{type: DEEP_LINK, actionLink: deepLinkValueIos}],
626
+ }),
627
+ } : {},
616
628
  },
617
629
  },
618
630
  },
@@ -696,7 +708,7 @@ export const InApp = (props) => {
696
708
  {isFullMode && createModeContent}
697
709
  {/* device tab */}
698
710
  <CapTab
699
- panes={PANES}
711
+ panes={PANES.filter((devicePane) => devicePane?.isSupported === true)}
700
712
  onChange={(value) => {
701
713
  setPanes(value);
702
714
  }}
@@ -710,12 +722,12 @@ export const InApp = (props) => {
710
722
  {getPreviewSection()}
711
723
  </CapColumn>
712
724
  </CapRow>
713
- <div className="inapp-footer">
725
+ <div className={`inapp-footer ${!isFullMode && `inapp-footer-lib`}`}>
714
726
  {
715
727
  <>
716
728
  <CapButton
717
729
  onClick={onDoneCallback()}
718
- disabled={isDisableDone()}
730
+ disabled={isDisableDone(panes)}
719
731
  className="inapp-create-btn"
720
732
  >
721
733
  {isEditFlow ? (
@@ -725,7 +737,11 @@ export const InApp = (props) => {
725
737
  <FormattedMessage {...globalMessages.done} />
726
738
  )
727
739
  ) : (
728
- <FormattedMessage {...messages.create} />
740
+ isFullMode ? (
741
+ <FormattedMessage {...messages.create} />
742
+ ) : (
743
+ <FormattedMessage {...globalMessages.done} />
744
+ )
729
745
  )}
730
746
  </CapButton>
731
747
  </>
@@ -37,7 +37,6 @@
37
37
  .inapp-footer {
38
38
  background-color: $CAP_WHITE;
39
39
  bottom: 0;
40
- // position: fixed;
41
40
  width: 100%;
42
41
  padding: $CAP_SPACE_20 0;
43
42
  z-index: 1;
@@ -45,4 +44,7 @@
45
44
  .ant-btn {
46
45
  margin-right: $CAP_SPACE_16;
47
46
  }
47
+ }
48
+ .inapp-footer-lib {
49
+ position: fixed;
48
50
  }
@@ -11,7 +11,6 @@
11
11
  .creatives-templates-list.full-mode{
12
12
  .pagination-container {
13
13
  .cap-custom-card-list-row {
14
- padding-bottom: 10rem;
15
14
  .cap-custom-card-list-col{
16
15
  &:nth-child(3n+3) { //every 4th child
17
16
  margin-right: unset;
@@ -26,7 +25,6 @@
26
25
  .creatives-templates-list.full-mode{
27
26
  .pagination-container {
28
27
  .cap-custom-card-list-row {
29
- padding-bottom: 10rem;
30
28
  .cap-custom-card-list-col{
31
29
  &:nth-child(4n+4) { //every 4th child
32
30
  margin-right: unset;
@@ -58,9 +56,6 @@
58
56
  }
59
57
 
60
58
  .pagination-container {
61
- .cap-custom-card-list-row {
62
- padding-bottom: 10rem;
63
- }
64
59
  .FACEBOOK {
65
60
  .ant-card-body {
66
61
  background-color: $CAP_G09;
@@ -529,10 +524,6 @@
529
524
  border-bottom: solid 0.5px #D6D6D6;
530
525
  }
531
526
 
532
- .main-content{
533
- overflow: hidden;
534
- }
535
-
536
527
  .wechat-filters,
537
528
  .line-filters {
538
529
  width: 100%;
@@ -49,6 +49,7 @@ import {
49
49
  CapInfoNote,
50
50
  CapImage,
51
51
  CapStatus,
52
+ CapColoredTag,
52
53
  } from '@capillarytech/cap-ui-library';
53
54
  import { makeSelectTemplates, makeSelectTemplatesResponse } from './selectors';
54
55
  import { makeSelectCreate as makeSelectCreateSms} from '../Sms/Create/selectors';
@@ -108,6 +109,7 @@ import {
108
109
  HOST_TWILIO,
109
110
  HOST_GUPSHUP,
110
111
  } from '../Whatsapp/constants';
112
+ import { INAPP_LAYOUT_DETAILS } from '../InApp/constants';
111
113
  import { ZALO_STATUS_OPTIONS, ZALO_STATUSES } from '../Zalo/constants';
112
114
  import { getWhatsappContent, getWhatsappStatus, getWhatsappCategory, getWhatsappCta, getWhatsappQuickReply } from '../Whatsapp/utils';
113
115
  import { getRCSContent } from '../Rcs/utils';
@@ -823,7 +825,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
823
825
  queryParams.wecrmToken = this.props.Templates.selectedWeChatAccount.configs.wecrm_token;
824
826
  queryParams.originalId = this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier;
825
827
  }
826
- if (([MOBILE_PUSH_LOWERCASE, INAPP_LOWERCASE.includes](this.state.channel.toLowerCase())) && !isEmpty(this.props.Templates.selectedWeChatAccount)) {
828
+ if (([MOBILE_PUSH_LOWERCASE, INAPP_LOWERCASE].includes(this.state.channel.toLowerCase())) && !isEmpty(this.props.Templates.selectedWeChatAccount)) {
827
829
  queryParams.accountId = this.props.Templates.selectedWeChatAccount.id;
828
830
  if (this.state.mode) {
829
831
  queryParams.mode = this.state.mode.toLowerCase();
@@ -1004,22 +1006,40 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1004
1006
  );
1005
1007
 
1006
1008
  const cardDataList = filteredTemplates && filteredTemplates.length ? map(filteredTemplates, (template) => {
1007
- const templateData =
1008
- {
1009
- key: `${currentChannel}-card-${template?.name}`,
1010
- title: <span title={template?.name} >{template?.name}</span>,
1011
- extra: [
1012
- <CapTooltip title={this.state.channel.toLowerCase() === ZALO_LOWERCASE ? <div className='zalo-view-tooltip'>{this.props.intl.formatMessage(messages.zaloPreview)}</div> : ''}>
1013
- <CapIcon
1014
- className={`view-${channelLowerCase}`}
1015
- style={{ marginRight: '16px' }}
1016
- type="eye"
1017
- onClick={() => { if (!this.props.isFullMode || this.props.isDltFromRcs) { this.props.handlePeviewTemplate(template); } else { handlers.handlePreviewClick(template); } }}
1018
- />
1019
- </CapTooltip>,
1020
- ],
1021
- hoverOption: <CapButton className={this.props.isFullMode ? `edit-${channelLowerCase}` : `select-${channelLowerCase}`} onClick={(e) => handlers.handleEditClick(e, template, undefined, undefined, {account: this.state.selectedAccount})}>{hoverButtonText}</CapButton>,
1022
- };
1009
+ const inappBodyType = template?.versions?.base?.content?.ANDROID?.bodyType;
1010
+ const templateData = {
1011
+ key: `${currentChannel}-card-${template?.name}`,
1012
+ title: (
1013
+ <span title={template?.name}>
1014
+ {template?.name}
1015
+ {currentChannel === INAPP && (
1016
+ <CapRow>
1017
+ <CapColoredTag
1018
+ tagColor={INAPP_LAYOUT_DETAILS[inappBodyType].tagColor}
1019
+ tagTextColor={
1020
+ INAPP_LAYOUT_DETAILS[inappBodyType].tagTextColor
1021
+ }
1022
+ tagHeight="20px"
1023
+ tagFontSize="12px"
1024
+ >
1025
+ {INAPP_LAYOUT_DETAILS[inappBodyType].text}
1026
+ </CapColoredTag>
1027
+ </CapRow>
1028
+ )}
1029
+ </span>
1030
+ ),
1031
+ extra: [
1032
+ <CapTooltip title={this.state.channel.toLowerCase() === ZALO_LOWERCASE ? <div className='zalo-view-tooltip'>{this.props.intl.formatMessage(messages.zaloPreview)}</div> : ''}>
1033
+ <CapIcon
1034
+ className={`view-${channelLowerCase}`}
1035
+ style={{ marginRight: '16px' }}
1036
+ type="eye"
1037
+ onClick={() => { if (!this.props.isFullMode || this.props.isDltFromRcs) { this.props.handlePeviewTemplate(template); } else { handlers.handlePreviewClick(template); } }}
1038
+ />
1039
+ </CapTooltip>,
1040
+ ],
1041
+ hoverOption: <CapButton className={this.props.isFullMode ? `edit-${channelLowerCase}` : `select-${channelLowerCase}`} onClick={(e) => handlers.handleEditClick(e, template, undefined, undefined, {account: this.state.selectedAccount})}>{hoverButtonText}</CapButton>,
1042
+ };
1023
1043
  const {
1024
1044
  versions: {
1025
1045
  base: {