@capillarytech/creatives-library 7.10.51 → 7.10.52

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.
@@ -1,3 +1,5 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
1
3
  exports[`galleryReducer Initial State should match snapshot returns the initial state 1`] = `
2
4
  Object {
3
5
  "assetList": Array [],
@@ -2733,11 +2733,12 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2733
2733
  } else {
2734
2734
  this.setState({injectedTags: data.tags});
2735
2735
  }
2736
- this.props.globalActions.setInjectedTags(data.tags);
2736
+ if (data.tags) {
2737
+ this.props.globalActions.setInjectedTags(data.tags);
2738
+ }
2737
2739
  }
2738
2740
 
2739
2741
  startLoading = (ifEdit) => {
2740
-
2741
2742
  if (ifEdit) {
2742
2743
  this.setState({loading: true});
2743
2744
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.10.51",
4
+ "version": "7.10.52",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -15,7 +15,7 @@
15
15
  }
16
16
  }
17
17
 
18
- .msgContainer {
18
+ .msg-container {
19
19
  position: absolute;
20
20
  top: 20%;
21
21
  left: 23%;
@@ -238,6 +238,21 @@
238
238
  }
239
239
  }
240
240
  }
241
+
242
+ .whatsapp-brand-name {
243
+ position: absolute;
244
+ top: 11%;
245
+ left: 38%;
246
+ color: white;
247
+ font-size: small;
248
+ }
249
+ .whatsapp-message-container{
250
+ max-height: 292px;
251
+ margin-left: 28px;
252
+ }
253
+ .whatsapp-content{
254
+ margin: 2px 6px 1px 7px;
255
+ }
241
256
  }
242
257
 
243
258
  .align-center {
@@ -291,7 +306,7 @@
291
306
  }
292
307
 
293
308
 
294
- .msgContainer {
309
+ .msg-container {
295
310
  position: absolute;
296
311
  top: 14%;
297
312
  left: 29%;
@@ -399,11 +414,4 @@
399
414
  span {
400
415
  font-size: $FONT_SIZE_VS;
401
416
  }
402
- }
403
- .whatsapp-brand-name{
404
- position: absolute;
405
- top: 11%;
406
- left: 38%;
407
- color: white;
408
- font-size: small;
409
417
  }
@@ -10,7 +10,7 @@ import React from 'react';
10
10
  import _ from 'lodash';
11
11
  import { injectIntl, FormattedMessage, intlShape } from 'react-intl';
12
12
  // import styled from 'styled-components';
13
- import {CapColumn, CapRow, CapHeading, CapIcon, CapButton, CapImage} from '@capillarytech/cap-ui-library';
13
+ import { CapColumn, CapRow, CapHeading, CapIcon, CapButton, CapImage, CapLabel } from '@capillarytech/cap-ui-library';
14
14
  import './_templatePreview.scss';
15
15
  import {updateCharCount} from '../../utils/smsCharCountV2';
16
16
  import messages from './messages';
@@ -20,11 +20,11 @@ import {
20
20
  } from '../../v2Containers/CreativesContainer/constants';
21
21
  import Carousel from '../Carousel';
22
22
  import { VIBER, FACEBOOK } from '../../v2Containers/App/constants';
23
+ import whatsappMobileAndroid from './assets/images/whatsapp_mobile_android.svg'
23
24
  const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
24
25
  const smsMobileAndroid = require('./assets/images/sms_mobile_android.svg');
25
26
  const lineMobileAndroid = require('../../assets/line.png');
26
27
  const viberMobileAndroid = require('./assets/images/viberMobile.svg');
27
- const whatsappMobileAndroid = require('./assets/images/whatsapp_mobile_android.svg');
28
28
 
29
29
  const lineImgPlaceholder = require('../../assets/line-image-placeholder.svg');
30
30
  const lineStickerPlaceholder = require('../../assets/smiley-placeholder.svg');
@@ -32,10 +32,20 @@ const lineVideoPlaceholder = require('../../assets/rich-video-placeholder.svg');
32
32
  const androidPushMessagePhone = require('./assets/images/androidPushMessage.svg');
33
33
  const iPhonePushMessagePhone = require('./assets/images/iPhonePushMessage.svg');
34
34
 
35
- import { CAP_COLOR_03, CAP_WHITE, FONT_COLOR_01, CAP_G08, CAP_G06, CAP_G15, CAP_PURPLE01, CAP_G16, CAP_SPACE_08, CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
35
+ import {
36
+ CAP_COLOR_03,
37
+ CAP_WHITE,
38
+ FONT_COLOR_01,
39
+ CAP_G06,
40
+ CAP_G15,
41
+ CAP_PURPLE01,
42
+ CAP_G16,
43
+ CAP_SPACE_08,
44
+ CAP_SPACE_16,
45
+ } from '@capillarytech/cap-ui-library/styled/variables';
36
46
  import { TEMPLATE, IMAGE_CAROUSEL, IMAGE, STICKER, TEXT, IMAGE_MAP, VIDEO } from '../../v2Containers/Line/Container/constants';
37
47
  import CapFacebookPreview from '../../v2Containers/CapFacebookPreview';
38
- import { getWhatsappStatusContainer } from '../../v2Containers/Whatsapp/utils';
48
+ import WhatsappStatusContainer from '../WhatsappStatusContainer';
39
49
 
40
50
  class TemplatePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
41
51
  onPreviewContentClicked = (channel) => {
@@ -137,7 +147,17 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
137
147
 
138
148
  render() {
139
149
  let content = channel && channel.toLowerCase() === 'sms' ? [this.props.content] : this.props.content;
140
- const { channel, showTestAndPreviewIcon, module, viberBrandName, viberAccountName, whatsappAccountName, whatsappContentLen = 0, intl, templateData } = this.props;
150
+ const {
151
+ channel,
152
+ showTestAndPreviewIcon,
153
+ module,
154
+ viberBrandName,
155
+ viberAccountName,
156
+ whatsappAccountName,
157
+ whatsappContentLen = 0,
158
+ intl,
159
+ templateData,
160
+ } = this.props;
141
161
  const { formatMessage } = intl;
142
162
  const { buttonText, imageURL, messageContent: viberMessageContent } = content || {};
143
163
  let smsDetails = {};
@@ -194,7 +214,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
194
214
  'width': '81%',
195
215
  };
196
216
  const whatsappSectionStyle = {
197
- "padding": '3.5px 0 0',
217
+ 'padding': `4px 0 ${CAP_SPACE_08}`,
198
218
  'border-radius': '6px',
199
219
  'background-color': CAP_G15,
200
220
  'width': '88%',
@@ -284,10 +304,10 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
284
304
  {smsDetails.optoutUrlPresent && <CapHeading type="h6">
285
305
  <FormattedMessage {...messages.optoutCharactersTotal} values={{optoutUrlLength: smsDetails.optouturlLength}} />
286
306
  </CapHeading>}
287
- {channel && channel.toLowerCase() === WHATSAPP.toLowerCase() ? (
307
+ {channel?.toLowerCase() === WHATSAPP.toLowerCase() ? (
288
308
  <>
289
- {getWhatsappStatusContainer(templateData)}
290
- <CapHeading type="h3" style={{ marginTop: '12px' }}>
309
+ <WhatsappStatusContainer template={templateData} />
310
+ <CapHeading type="h3" className='margin-t-12'>
291
311
  <FormattedMessage {...messages.whatsappCharactersTotal} values={{charCount: content?.templateMsg?.length}} />
292
312
  </CapHeading>
293
313
  <CapHeading type="h6">
@@ -332,7 +352,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
332
352
  <div>
333
353
  <div className="shell-v2 align-center" id="sms-preview">
334
354
  <CapImage className="preview-image sms" src={smsMobileAndroid} alt="Preview is being generated"/>
335
- <div className="msgContainer sms">
355
+ <div className="msg-container sms">
336
356
  <div className={"message-pop sms"}>
337
357
  {content && content.length && content.map((msg, index) =>
338
358
  <CapColumn key={`"message-pop-content-${index}`} className="message-pop-item align-left" style={{ background: '#FFFFFF', color: '#091e42'}}>
@@ -360,7 +380,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
360
380
  {channel && channel.toLowerCase() === 'wechat' ?
361
381
  ( <div className="shell-v2 align-center" id="sms-preview">
362
382
  <CapImage className="preview-image" src={(channel || '').toLowerCase() === 'wechat' ? wechatBodyNew : smsMobileAndroid} alt="Preview is being generated"/>
363
- <div className="msgContainer wechat">
383
+ <div className="msg-container wechat">
364
384
  <div className="message-pop align-left" style={{ background: `${this.props.channel.toLowerCase() === 'wechat' ? '#ffffff' : '#3F51B5'}`, color: `${this.props.channel.toLowerCase() === 'wechat' ? '#333333' : '#ffffff'}`}}>{content}
365
385
  </div>
366
386
  </div>
@@ -420,7 +440,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
420
440
  <div className="shell-v2 align-center" id="sms-preview">
421
441
  <CapImage className="preview-image" src={lineMobileAndroid} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
422
442
  <div
423
- className="msgContainer line-preview"
443
+ className="msg-container line-preview"
424
444
  style={{
425
445
  maxHeight: 330,
426
446
  overflow: 'scroll',
@@ -588,7 +608,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
588
608
  <CapImage className="preview-image" src={viberMobileAndroid} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
589
609
  <div style={{ position: 'absolute', top: '12%', left: '36%'}}>{viberBrandName}</div>
590
610
  <div
591
- className="msgContainer viber-preview"
611
+ className="msg-container viber-preview"
592
612
  style={{
593
613
  maxHeight: 292,
594
614
  marginLeft: 28,
@@ -662,47 +682,41 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
662
682
  </div>
663
683
  ) : ''
664
684
  }
665
- {channel && channel?.toUpperCase() === WHATSAPP ? (
666
- <>
667
- <div className="shell-v2 align-center" id="sms-preview">
668
- <CapImage
669
- className="preview-image"
670
- src={whatsappMobileAndroid}
671
- alt={formatMessage(messages.previewGenerated)}
672
- />
673
- <div className="whatsapp-brand-name">
674
- {whatsappAccountName || ''}
675
- </div>
676
- <div
677
- className="msgContainer"
678
- style={{
679
- maxHeight: 292,
680
- marginLeft: 28,
681
- }}
682
- >
683
- <div
684
- className="message-pop align-left"
685
- style={whatsappSectionStyle}
686
- >
687
- <p
688
- style={{
689
- color: CAP_G16,
690
- margin: '1.5px 6px 1px 7px',
691
- }}
692
- >
693
- {content?.templateMsg || ''}
694
- </p>
695
- <div style={{ paddingBottom: CAP_SPACE_08 }}></div>
685
+ {
686
+ channel && channel?.toUpperCase() === WHATSAPP ? (
687
+ <>
688
+ <div className='shell-v2 align-center'>
689
+ <CapImage
690
+ className='preview-image'
691
+ src={whatsappMobileAndroid}
692
+ alt={formatMessage(messages.previewGenerated)}
693
+ />
694
+ <CapLabel className='whatsapp-brand-name'>
695
+ {whatsappAccountName || ''}
696
+ </CapLabel>
697
+ <div className='msg-container whatsapp-message-container'>
698
+ <div className='message-pop align-left' style={whatsappSectionStyle}>
699
+ <CapLabel className='whatsapp-content'>
700
+ {content?.templateMsg || ''}
701
+ </CapLabel>
702
+ </div>
696
703
  </div>
697
704
  </div>
698
- </div>
699
- <CapHeading type="h3" style={{ textAlign: "center", marginTop: CAP_SPACE_16 }}>
700
- <FormattedMessage {...messages.whatsappMessageLength} values={{ length: 36 + whatsappContentLen }} />
701
- </CapHeading>
702
- </>
703
- ) : (
704
- ''
705
- )}
705
+ <CapHeading
706
+ type='h3'
707
+ style={{ textAlign: 'center' }}
708
+ className='margin-t-16'
709
+ >
710
+ <FormattedMessage
711
+ {...messages.whatsappMessageLength}
712
+ values={{ length: 36 + whatsappContentLen }}
713
+ />
714
+ </CapHeading>
715
+ </>
716
+ ) : (
717
+ ''
718
+ )
719
+ }
706
720
  {channel && channel.toLowerCase() === FACEBOOK && (
707
721
  <div style={{position: 'absolute', left: '80%'}} id="facebook-preview">
708
722
  <CapFacebookPreview
@@ -0,0 +1,13 @@
1
+ .whatsapp-status-container {
2
+ margin-top: 12px;
3
+ width: 150%;
4
+ height: 20px;
5
+
6
+ .cap-colored-tag-v2 {
7
+ font-weight: normal;
8
+ }
9
+
10
+ .whatsapp-category-tag {
11
+ margin-left: 8px;
12
+ }
13
+ }
@@ -0,0 +1,58 @@
1
+ import React from 'react';
2
+ import { CapRow, CapStatus, CapColoredTag } from '@capillarytech/cap-ui-library';
3
+ import { WHATSAPP } from '../../v2Containers/CreativesContainer/constants';
4
+ import {
5
+ CATEGORY as WHATSAPP_CATEGORY,
6
+ STATUS as WHATSAPP_STATUS,
7
+ } from '../../v2Containers/Whatsapp/constants';
8
+ import { getWhatsappCategory, getWhatsappStatus } from '../../v2Containers/Whatsapp/utils';
9
+ import './_whatsappStatusContainer.scss';
10
+
11
+ export const WhatsappStatusContainer = (props) => {
12
+
13
+ const { template } = props;
14
+
15
+ const {
16
+ versions: {
17
+ base: {
18
+ content: {
19
+ [WHATSAPP.toLowerCase()]: {
20
+ [WHATSAPP_STATUS]: status,
21
+ [WHATSAPP_CATEGORY]: category,
22
+ } = {},
23
+ } = {},
24
+ } = {},
25
+ } = {},
26
+ } = template;
27
+
28
+ const categoryObj = getWhatsappCategory(category) || {};
29
+ const {
30
+ label: categoryLabel,
31
+ tagColor: categoryTagColor,
32
+ tagTextColor: categoryTextColor,
33
+ } = categoryObj;
34
+ return (
35
+ <CapRow type="flex" align="middle" className="whatsapp-status-container">
36
+ <CapStatus
37
+ type={status}
38
+ text={getWhatsappStatus(status)?.label}
39
+ labelType="label3"
40
+ />
41
+ {
42
+ categoryLabel ? (
43
+ <CapColoredTag
44
+ tagColor={categoryTagColor}
45
+ tagTextColor={categoryTextColor}
46
+ tagHeight="20px"
47
+ tagFontSize="12px"
48
+ className="whatsapp-category-tag"
49
+ >
50
+ {categoryLabel}
51
+ </CapColoredTag>
52
+ ) : null
53
+ }
54
+ </CapRow>
55
+ )
56
+ }
57
+
58
+ export default WhatsappStatusContainer;
@@ -1,3 +1,5 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
1
3
  exports[`galleryReducer Initial State should match snapshot returns the initial state 1`] = `
2
4
  Object {
3
5
  "assetList": Array [],
@@ -80,6 +80,14 @@ export default defineMessages({
80
80
  id: `creatives.containersV2.promotions`,
81
81
  defaultMessage: 'Promotions',
82
82
  },
83
+ "templateNameLabel": {
84
+ id: `creatives.containersV2.templateNameLabel`,
85
+ defaultMessage: 'Template name',
86
+ },
87
+ "templateNamePlaceholder": {
88
+ id: `creatives.containersV2.templateNamePlaceholder`,
89
+ defaultMessage: 'Enter template name',
90
+ },
83
91
 
84
92
  //refresh due to org change messages
85
93
 
@@ -173,11 +173,12 @@ function SlideBoxContent(props) {
173
173
  });
174
174
 
175
175
 
176
- const isCreateSms = slidBoxContent === 'createTemplate' && channel === constants.SMS;
177
- const isCreateFacebook = slidBoxContent === 'createTemplate' && channel === constants.FACEBOOK;
178
- const isCreateWhatsapp = slidBoxContent === 'createTemplate' && channel === constants.WHATSAPP;
179
- const isCreateMPush = slidBoxContent === 'createTemplate' && channel === constants.MOBILE_PUSH;
180
- const isCreateCallTask = slidBoxContent === 'createTemplate' && channel === constants.CALL_TASK;
176
+ const isCreate = slidBoxContent === 'createTemplate';
177
+ const isCreateSms = isCreate && channel === constants.SMS;
178
+ const isCreateFacebook = isCreate && channel === constants.FACEBOOK;
179
+ const isCreateWhatsapp = isCreate && channel === constants.WHATSAPP;
180
+ const isCreateMPush = isCreate && channel === constants.MOBILE_PUSH;
181
+ const isCreateCallTask = isCreate && channel === constants.CALL_TASK;
181
182
  let isEditSms = false;
182
183
  let isEditEmailWithId = false;
183
184
  let isEmailEditWithContent = false;
@@ -189,7 +190,7 @@ function SlideBoxContent(props) {
189
190
  let isEditFacebook = false;
190
191
  let isEditFTP = false;
191
192
  let isEditWhatsapp = false;
192
- const isEmailCreate = slidBoxContent === 'createTemplate' && channel === constants.EMAIL;
193
+ const isEmailCreate = isCreate && channel === constants.EMAIL;
193
194
  if (templateData && channel) {
194
195
  channel = templateData.type;// for edit mode with template data
195
196
  isEditSms = slidBoxContent === 'editTemplate' && channel === constants.SMS;
@@ -7,6 +7,7 @@ import moment from 'moment';
7
7
  import PropTypes from 'prop-types';
8
8
  import messages from './messages';
9
9
  import whatsppMsg from '../Whatsapp/messages';
10
+ import globalMessages from '../Cap/messages'
10
11
  import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
11
12
  import { NO_COMMUNICATION, FTP, WHATSAPP } from '../App/constants';
12
13
  import { isTraiDLTEnable } from '../../utils/common';
@@ -84,7 +85,7 @@ function SlideBoxHeader(props) {
84
85
  description={
85
86
  isWhatsappEdit && (
86
87
  <>
87
- {renderWhatsappData("label1", <FormattedMessage {...whatsppMsg.templateNameLabel} />)}
88
+ {renderWhatsappData("label1", <FormattedMessage {...globalMessages.templateNameLabel} />)}
88
89
  {renderWhatsappData("label2", whatsappName)}
89
90
  {renderWhatsappData("label3", <FormattedMessage {...whatsppMsg.labelSeperator} />)}
90
91
  {renderWhatsappData("label1", <FormattedMessage {...whatsppMsg.templateCategoryLabel} />)}
@@ -821,7 +821,24 @@ class Creatives extends React.Component {
821
821
  }
822
822
  render() {
823
823
  const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
824
- const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor, smsRegister, enableNewChannels} = this.props;
824
+ const {
825
+ isFullMode,
826
+ creativesMode,
827
+ cap,
828
+ isUploading,
829
+ channelsToHide,
830
+ selectedWeChatAccount,
831
+ forwardedTags,
832
+ channelsToDisable,
833
+ selectedOfferDetails,
834
+ onTestContentClicked,
835
+ onPreviewContentClicked,
836
+ getCreativesData,
837
+ fetchingCmsData,
838
+ editor,
839
+ smsRegister,
840
+ enableNewChannels,
841
+ } = this.props;
825
842
  const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
826
843
  /* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
827
844
  return (
@@ -2179,7 +2179,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2179
2179
  } else {
2180
2180
  this.setState({injectedTags: data.tags});
2181
2181
  }
2182
- this.props.globalActions.setInjectedTags(data.tags);
2182
+ if (data.tags) {
2183
+ this.props.globalActions.setInjectedTags(data.tags);
2184
+ }
2183
2185
  }
2184
2186
 
2185
2187
  startLoading = (ifEdit) => {
@@ -19,6 +19,25 @@
19
19
  }
20
20
 
21
21
  .creatives-templates-list {
22
+
23
+ .delete-template-confirm {
24
+ .ant-modal-footer {
25
+ padding: $CAP_SPACE_16 $CAP_SPACE_24 $CAP_SPACE_24 $CAP_SPACE_24;
26
+ }
27
+
28
+ .ant-modal-header {
29
+ padding: $CAP_SPACE_24 $CAP_SPACE_24 $CAP_SPACE_08 $CAP_SPACE_24;
30
+ }
31
+
32
+ .ant-modal-body {
33
+ padding: 0 $CAP_SPACE_24;
34
+ }
35
+
36
+ .ant-modal-close-x {
37
+ padding: $CAP_SPACE_12;
38
+ }
39
+ }
40
+
22
41
  .pagination-container {
23
42
  .FACEBOOK {
24
43
  .ant-card-body {
@@ -524,40 +543,9 @@
524
543
  }
525
544
  }
526
545
 
527
- .whatsapp-card-title {
528
-
529
- .whatsapp-status-container {
530
- margin-top: 12px;
531
- width: 150%;
532
- height: 20px;
533
-
534
- .cap-colored-tag-v2 {
535
- font-weight: normal;
536
- }
537
- }
538
- }
539
-
540
546
  .whatsapp-illustration-desc {
541
547
  font-size: 14px;
542
548
  color: rgba(0, 0, 0, 0.87);
543
549
  margin: 8px 0;
544
550
  white-space: pre-wrap;
545
551
  }
546
-
547
- .delete-template-confirm {
548
- .ant-modal-footer {
549
- padding: $CAP_SPACE_16 $CAP_SPACE_24 $CAP_SPACE_24 $CAP_SPACE_24;
550
- }
551
-
552
- .ant-modal-header {
553
- padding: $CAP_SPACE_24 $CAP_SPACE_24 $CAP_SPACE_08 $CAP_SPACE_24;
554
- }
555
-
556
- .ant-modal-body {
557
- padding: 0 $CAP_SPACE_24;
558
- }
559
-
560
- .ant-modal-close-x {
561
- padding: $CAP_SPACE_12;
562
- }
563
- }
@@ -55,24 +55,18 @@ export function setWeChatAccount(weChatAccount) {
55
55
  weChatAccount,
56
56
  };
57
57
  }
58
-
59
58
  export function setChannelAccount(channel, account) {
60
- switch (channel) {
61
- case LINE: {
62
- return {
63
- type: types.SET_LINE_ACCOUNT,
64
- account,
65
- };
66
- }
67
- case WHATSAPP: {
68
- return {
69
- type: types.SET_WHATSAPP_ACCOUNT,
70
- account,
71
- };
72
- }
73
- default:
74
- return {};
59
+ const channelTypeMapping = {
60
+ LINE: types.SET_LINE_ACCOUNT,
61
+ WHATSAPP: types.SET_WHATSAPP_ACCOUNT,
62
+ };
63
+ if (channelTypeMapping[channel]) {
64
+ return {
65
+ type: channelTypeMapping[channel],
66
+ account,
67
+ };
75
68
  }
69
+ return {};
76
70
  }
77
71
 
78
72
  export function setViberAccount(viberAccount) {
@@ -22,7 +22,31 @@ import find from 'lodash/find';
22
22
  import map from 'lodash/map';
23
23
  import { bindActionCreators } from 'redux';
24
24
  import { Modal, Form} from 'antd';
25
- import {CapMenu, CapDropdown, CapButton, CapInput, CapIcon, CapRadioCard, CapPopover, CapSpin, CapCustomCard, CapRow, CapSlideBox, CapLink, CapHeading, CapNotification, CapIllustration, CapHeader, CapLabel, CapRadio, CapSelectFilter, CapTag, CapTooltip, CapAlert, CapModal } from '@capillarytech/cap-ui-library';
25
+ import {
26
+ CapMenu,
27
+ CapDropdown,
28
+ CapButton,
29
+ CapInput,
30
+ CapIcon,
31
+ CapRadioCard,
32
+ CapPopover,
33
+ CapSpin,
34
+ CapCustomCard,
35
+ CapRow,
36
+ CapSlideBox,
37
+ CapLink,
38
+ CapHeading,
39
+ CapNotification,
40
+ CapIllustration,
41
+ CapHeader,
42
+ CapLabel,
43
+ CapRadio,
44
+ CapSelectFilter,
45
+ CapTag,
46
+ CapTooltip,
47
+ CapAlert,
48
+ CapModal,
49
+ } from '@capillarytech/cap-ui-library';
26
50
  import { makeSelectTemplates, makeSelectTemplatesResponse } from './selectors';
27
51
  import { makeSelectCreate as makeSelectCreateSms} from '../Sms/Create/selectors';
28
52
  import { makeSelectCreate as makeSelectCreateMobilePush } from '../MobilePush/Create/selectors';
@@ -53,6 +77,7 @@ import * as commonUtil from '../../utils/common';
53
77
  import Pagination from '../../v2Components/Pagination';
54
78
  import EmailPreview from '../../v2Components/EmailPreview';
55
79
  import CreativesContainer from '../CreativesContainer';
80
+ import WhatsappStatusContainer from '../../v2Components/WhatsappStatusContainer';
56
81
  import WechatRichmediaTemplatePreview from '../../v2Components/TemplatePreview/WechatRichmediaTemplatePreview';
57
82
  import {
58
83
  CHANNEL_CREATE_TRACK_MAPPING,
@@ -68,7 +93,7 @@ import {
68
93
  STATUS as WHATSAPP_STATUS,
69
94
  WHATSAPP_STATUSES,
70
95
  } from '../Whatsapp/constants';
71
- import { getWhatsappContent, getWhatsappStatusContainer, getWhatsappStatus, getWhatsappCategory } from '../Whatsapp/utils';
96
+ import { getWhatsappContent, getWhatsappStatus, getWhatsappCategory } from '../Whatsapp/utils';
72
97
  import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER, FACEBOOK, WHATSAPP } from '../CreativesContainer/constants';
73
98
 
74
99
  import {CREATIVE} from '../Facebook/constants';
@@ -933,10 +958,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
933
958
  }
934
959
  case WHATSAPP:
935
960
  templateData.title = (
936
- <div className="whatsapp-card-title">
937
- <span title={template.name} >{template.name}</span>
938
- {getWhatsappStatusContainer(template)}
939
- </div>
961
+ <CapRow className="whatsapp-card-title">
962
+ <CapLabel>{template.name}</CapLabel>
963
+ <WhatsappStatusContainer template={template} />
964
+ </CapRow>
940
965
  );
941
966
 
942
967
  templateData.content = getWhatsappContent(template);
@@ -2146,16 +2171,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2146
2171
  formatMessage,
2147
2172
  },
2148
2173
  } = this.props;
2149
- switch (channel?.toUpperCase()) {
2150
- case MOBILE_PUSH:
2151
- return formatMessage(messages.mobilepushAccount);
2152
- case WECHAT:
2153
- return formatMessage(messages.wechatAccount);
2154
- case WHATSAPP:
2155
- return formatMessage(messages.whatsappAccount);
2156
- default:
2157
- return '';
2174
+
2175
+ const channelObj = {
2176
+ [MOBILE_PUSH]: 'mobilepushAccount',
2177
+ [WECHAT]: 'wechatAccount',
2178
+ [WHATSAPP]: 'whatsappAccount',
2158
2179
  }
2180
+ return formatMessage(messages[channelObj[channel?.toUpperCase()]]);
2159
2181
  }
2160
2182
 
2161
2183
  showAccountName = () => {