@capillarytech/creatives-library 7.17.35-alpha.2 → 7.17.36
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/containers/Templates/actions.js +0 -5
- package/index.js +6 -0
- package/package.json +1 -1
- package/routes.js +5 -0
- package/services/api.js +6 -1
- package/utils/common.js +0 -5
- package/v2Components/CapTagList/index.js +4 -0
- package/v2Components/WhatsappStatusContainer/_whatsappStatusContainer.scss +2 -1
- package/v2Containers/App/constants.js +1 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +13 -0
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +9 -6
- package/v2Containers/CreativesContainer/constants.js +1 -0
- package/v2Containers/CreativesContainer/index.scss +3 -0
- package/v2Containers/CreativesContainer/messages.js +8 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +6 -1
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +58 -0
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +18114 -88
- package/v2Containers/Templates/_templates.scss +20 -2
- package/v2Containers/Templates/actions.js +4 -3
- package/v2Containers/Templates/constants.js +2 -1
- package/v2Containers/Templates/index.js +319 -120
- package/v2Containers/Templates/messages.js +28 -8
- package/v2Containers/Templates/reducer.js +3 -1
- package/v2Containers/Templates/sagas.js +2 -2
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +724 -43
- package/v2Containers/Templates/tests/actions.test.js +18 -0
- package/v2Containers/Templates/tests/index.test.js +52 -1
- package/v2Containers/Templates/tests/mockData.js +41 -1
- package/v2Containers/Templates/tests/reducer.test.js +50 -0
- package/v2Containers/Templates/tests/sagas.test.js +40 -2
- package/v2Containers/Templates/tests/selector.test.js +17 -0
- package/v2Containers/TemplatesV2/index.js +2 -2
- package/v2Containers/TemplatesV2/messages.js +4 -0
- package/v2Containers/Zalo/actions.js +17 -0
- package/v2Containers/Zalo/constants.js +57 -0
- package/v2Containers/Zalo/index.js +391 -0
- package/v2Containers/Zalo/index.scss +76 -0
- package/v2Containers/Zalo/messages.js +74 -0
- package/v2Containers/Zalo/reducer.js +57 -0
- package/v2Containers/Zalo/saga.js +35 -0
- package/v2Containers/Zalo/selectors.js +14 -0
- package/v2Containers/Zalo/tests/actions.test.js +20 -0
- package/v2Containers/Zalo/tests/index.test.js +127 -0
- package/v2Containers/Zalo/tests/mockData.js +11470 -0
- package/v2Containers/Zalo/tests/reducer.test.js +85 -0
- package/v2Containers/Zalo/tests/saga.test.js +115 -0
- package/v2Containers/Zalo/tests/selectors.test.js +52 -0
- package/v2Containers/mockdata.js +817 -680
|
@@ -48,6 +48,7 @@ import {
|
|
|
48
48
|
CapModal,
|
|
49
49
|
CapInfoNote,
|
|
50
50
|
CapImage,
|
|
51
|
+
CapStatus,
|
|
51
52
|
} from '@capillarytech/cap-ui-library';
|
|
52
53
|
import { makeSelectTemplates, makeSelectTemplatesResponse } from './selectors';
|
|
53
54
|
import { makeSelectCreate as makeSelectCreateSms} from '../Sms/Create/selectors';
|
|
@@ -57,6 +58,7 @@ import { makeSelectEmail as makeSelectCreateEmail } from '../Email/selectors';
|
|
|
57
58
|
import { makeSelectEdit } from '../Sms/Edit/selectors';
|
|
58
59
|
import { makeSelectLine } from '../Line/Container/selectors';
|
|
59
60
|
import { makeSelectViber } from '../Viber/selectors';
|
|
61
|
+
import { makeSelectZalo } from '../Zalo/selectors';
|
|
60
62
|
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
61
63
|
import { getObjFromQueryParams } from '../../utils/v2common';
|
|
62
64
|
import messages from './messages';
|
|
@@ -72,6 +74,7 @@ import * as viberActions from '../Viber/actions';
|
|
|
72
74
|
import * as facebookActions from '../Facebook/actions';
|
|
73
75
|
import * as whatsappActions from '../Whatsapp/actions';
|
|
74
76
|
import * as rcsActions from '../Rcs/actions';
|
|
77
|
+
import * as zaloActions from '../Zalo/actions';
|
|
75
78
|
import CardGrid from '../../v2Components/CardGrid';
|
|
76
79
|
import config from '../../config/app';
|
|
77
80
|
import './_templates.scss';
|
|
@@ -102,10 +105,12 @@ import {
|
|
|
102
105
|
HOST_TWILIO,
|
|
103
106
|
HOST_GUPSHUP,
|
|
104
107
|
} from '../Whatsapp/constants';
|
|
108
|
+
import { ZALO_STATUS_OPTIONS, ZALO_STATUSES } from '../Zalo/constants';
|
|
105
109
|
import { getWhatsappContent, getWhatsappStatus, getWhatsappCategory, getWhatsappCta } from '../Whatsapp/utils';
|
|
106
110
|
import { getRCSContent } from '../Rcs/utils';
|
|
111
|
+
import zaloMessages from '../Zalo/messages'
|
|
107
112
|
|
|
108
|
-
import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER, FACEBOOK, WHATSAPP, RCS } from '../CreativesContainer/constants';
|
|
113
|
+
import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER, FACEBOOK, WHATSAPP, RCS, ZALO } from '../CreativesContainer/constants';
|
|
109
114
|
|
|
110
115
|
import {CREATIVE} from '../Facebook/constants';
|
|
111
116
|
import videoPlay from '../../assets/videoPlay.svg';
|
|
@@ -114,6 +119,7 @@ import smsIllustration from '../Assets/images/smsIllustration.svg';
|
|
|
114
119
|
import pushIllustration from '../Assets/images/pushIllustration.svg';
|
|
115
120
|
import whatsappIllustration from '../Assets/images/whatsappIllustration.png';
|
|
116
121
|
import rcsIllustration from '../Assets/images/rcsIllustration.png';
|
|
122
|
+
import zaloillustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
|
|
117
123
|
|
|
118
124
|
import { CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
119
125
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
@@ -159,6 +165,8 @@ const SMS_LOWERCASE = SMS.toLowerCase();
|
|
|
159
165
|
const MOBILE_PUSH_LOWERCASE = MOBILE_PUSH.toLowerCase();
|
|
160
166
|
const EBILL_LOWERCASE = EBILL.toLowerCase();
|
|
161
167
|
const LINE_LOWERCASE = LINE.toLowerCase();
|
|
168
|
+
const ZALO_LOWERCASE = ZALO.toLowerCase();
|
|
169
|
+
const WECHAT_LOWERCASE = WECHAT.toLowerCase();
|
|
162
170
|
const duplicateEnum = {
|
|
163
171
|
sms: "smsActions",
|
|
164
172
|
line: "lineActions",
|
|
@@ -196,7 +204,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
196
204
|
smsFilter: SMS_FILTERS.ALL,
|
|
197
205
|
selectedWhatsappStatus: '',
|
|
198
206
|
selectedWhatsappCategory: '',
|
|
207
|
+
selectedZaloStatus: '',
|
|
199
208
|
hostName: '',
|
|
209
|
+
searchedZaloTemplates: [],
|
|
210
|
+
searchingZaloTemplate: false,
|
|
200
211
|
};
|
|
201
212
|
|
|
202
213
|
this.handleOnHoverItem = this.handleOnHoverItem.bind(this);
|
|
@@ -274,6 +285,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
274
285
|
case RCS:
|
|
275
286
|
channel = 'Rcs';
|
|
276
287
|
break;
|
|
288
|
+
case ZALO:
|
|
289
|
+
channel = 'Zalo';
|
|
290
|
+
activeMode = ACCOUNT_SELECTION_MODE;
|
|
291
|
+
this.props.actions.getWeCrmAccounts(channel);
|
|
292
|
+
break;
|
|
277
293
|
default:
|
|
278
294
|
channel = '';
|
|
279
295
|
}
|
|
@@ -544,9 +560,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
544
560
|
return;
|
|
545
561
|
}
|
|
546
562
|
this.setState({routeParams: {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
563
|
+
pathname: `/${(nextProps.route.name || '').toLowerCase()}/create`,
|
|
564
|
+
query: type === 'embedded' ? { type: 'embedded', module, isLanguageSupport, isEdmSupport } : { module },
|
|
565
|
+
}});
|
|
550
566
|
}
|
|
551
567
|
|
|
552
568
|
if (!nextProps.Templates.sendingFile && !isEqual(this.props.Templates.sendingFile, nextProps.Templates.sendingFile) && nextProps.Templates.errorSendingFile) {
|
|
@@ -558,35 +574,56 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
558
574
|
}
|
|
559
575
|
|
|
560
576
|
if (!isEmpty(nextProps.Templates.templateDetails) && !isEqual(nextProps.Templates.templateDetails, this.props.Templates.templateDetails)) {
|
|
561
|
-
this.setState({previewTemplate: nextProps.Templates.templateDetails});
|
|
577
|
+
this.setState({ previewTemplate: nextProps.Templates.templateDetails });
|
|
562
578
|
}
|
|
563
579
|
const { weCrmAccounts: weCrmAccountsList = [], senderDetails: { hostName = '' } = {} } = get(nextProps, 'Templates', {});
|
|
564
|
-
const weCrmChannels = ['wechat', WHATSAPP_LOWERCASE];
|
|
580
|
+
const weCrmChannels = ['wechat', WHATSAPP_LOWERCASE, ZALO_LOWERCASE];
|
|
565
581
|
|
|
566
582
|
if (weCrmAccountsList.length === 1 && this.state.defaultAccount && (weCrmChannels.indexOf(selectedChannel) > -1)) {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
583
|
+
let paramsDefault = {};
|
|
584
|
+
if (this.state.channel.toLowerCase() !== ZALO_LOWERCASE) {
|
|
585
|
+
paramsDefault = {
|
|
586
|
+
name: this.state.searchText,
|
|
587
|
+
sortBy: this.state.sortBy,
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
const {name, sourceAccountIdentifier, configs: {
|
|
592
|
+
token,
|
|
593
|
+
wecrm_app_id,
|
|
594
|
+
wecrm_token
|
|
595
|
+
} } = weCrmAccountsList?.[0];
|
|
571
596
|
if (weCrmChannels.includes(selectedChannel)) {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
597
|
+
if ([WHATSAPP_LOWERCASE].includes(selectedChannel)) {
|
|
598
|
+
if (hostName === '') {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
weCrmAccountsList[0].hostName = hostName;
|
|
603
|
+
nextProps.actions.setChannelAccount(selectedChannel.toUpperCase(), weCrmAccountsList[0]);
|
|
604
|
+
} else if ([ZALO_LOWERCASE].includes(selectedChannel)) {
|
|
605
|
+
nextProps.actions.setChannelAccount(selectedChannel.toUpperCase(), weCrmAccountsList[0]);
|
|
606
|
+
paramsDefault.username = name;
|
|
607
|
+
paramsDefault.oa_id = sourceAccountIdentifier;
|
|
608
|
+
paramsDefault.token = token;
|
|
609
|
+
} else {
|
|
610
|
+
paramsDefault.wecrmId = wecrm_app_id;
|
|
611
|
+
paramsDefault.wecrmToken = wecrm_token;
|
|
612
|
+
paramsDefault.originalId = sourceAccountIdentifier;
|
|
613
|
+
nextProps.actions.setWeChatAccount(
|
|
614
|
+
weCrmAccountsList[0],
|
|
615
|
+
);
|
|
575
616
|
}
|
|
576
|
-
|
|
577
|
-
nextProps.actions.setChannelAccount(selectedChannel.toUpperCase(), weCrmAccountsList[0]);
|
|
578
|
-
} else {
|
|
579
|
-
paramsDefault.wecrmId = weCrmAccountsList[0].configs.wecrm_app_id;
|
|
580
|
-
paramsDefault.wecrmToken = weCrmAccountsList[0].configs.wecrm_token;
|
|
581
|
-
paramsDefault.originalId = weCrmAccountsList[0].sourceAccountIdentifier;
|
|
582
|
-
nextProps.actions.setWeChatAccount(
|
|
583
|
-
weCrmAccountsList[0],
|
|
584
|
-
);
|
|
585
|
-
}
|
|
617
|
+
|
|
586
618
|
}
|
|
587
619
|
this.setState({ defaultAccount: false, activeMode: TEMPLATES_MODE, selectedAccount: weCrmAccountsList[0].name, hostName });
|
|
588
620
|
this.getAllTemplates({params: paramsDefault}, true);
|
|
589
621
|
}
|
|
622
|
+
const zaloPreviewUrl = get(nextProps, 'Zalo.zaloTemplatePreviewData.versions.base.content.zalo.previewUrl', '');
|
|
623
|
+
if (zaloPreviewUrl && this.state.channel.toLowerCase() === ZALO_LOWERCASE) {
|
|
624
|
+
window.open(zaloPreviewUrl, '_blank');
|
|
625
|
+
this.props.zaloActions.resetTemplateInfoData();
|
|
626
|
+
}
|
|
590
627
|
}
|
|
591
628
|
|
|
592
629
|
componentWillUnmount() {
|
|
@@ -621,7 +658,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
621
658
|
this.props.actions.resetTemplate();
|
|
622
659
|
return;
|
|
623
660
|
} else {
|
|
624
|
-
this.setState({selectedAccountError: false});
|
|
661
|
+
this.setState({ selectedAccountError: false });
|
|
625
662
|
}
|
|
626
663
|
} else if ([LINE.toLowerCase(), RCS_LOWERCASE].includes(selectedChannel)) {
|
|
627
664
|
this.props.actions.setChannelAccount(selectedChannel?.toUpperCase(), this.props.Templates.weCrmAccounts.find((item) => item.name === this.state.selectedAccount));
|
|
@@ -674,6 +711,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
674
711
|
creativesParams.whatsappTemplateName = name;
|
|
675
712
|
creativesParams.whatsappTemplateCategory = get(versions, `base.content.whatsapp.category`, '');
|
|
676
713
|
creativesParams.whatsappTemplateLanguageCode = get(versions, `base.content.whatsapp.languages[0].language`, '');
|
|
714
|
+
} else if (this.state.channel.toLocaleLowerCase() === ZALO_LOWERCASE) {
|
|
715
|
+
const zaloSelectedTemplateData = this.selectTemplate(parseInt(creativesParams._id, 10)) || {};
|
|
716
|
+
const { name = '' } = zaloSelectedTemplateData;
|
|
717
|
+
creativesParams.name = name
|
|
677
718
|
}
|
|
678
719
|
}
|
|
679
720
|
creativesParams.type = this.state.channel.toUpperCase();
|
|
@@ -715,8 +756,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
715
756
|
queryParams.traiEnable = true;
|
|
716
757
|
}
|
|
717
758
|
if (resetTemplates) {
|
|
718
|
-
|
|
719
|
-
|
|
759
|
+
if(this.state.channel.toLowerCase() !== ZALO_LOWERCASE) {
|
|
760
|
+
queryParams.name = this.state.searchText;
|
|
761
|
+
queryParams.sortBy = this.state.sortBy;
|
|
762
|
+
}
|
|
720
763
|
queryParams.page = this.state.page;
|
|
721
764
|
queryParams.perPage = this.state.perPageLimit;
|
|
722
765
|
if (this.state.channel.toLowerCase() === 'wechat' && !isEmpty(this.props.Templates.selectedWeChatAccount)) {
|
|
@@ -736,27 +779,34 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
736
779
|
templatesCount = 0;
|
|
737
780
|
}
|
|
738
781
|
if (!params || isEmpty(params)) {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
782
|
+
if (this.state.channel.toLowerCase() !== ZALO_LOWERCASE) {
|
|
783
|
+
queryParams = {
|
|
784
|
+
name: this.state.searchText,
|
|
785
|
+
sortBy: this.state.sortBy,
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
if (this.state.channel.toLowerCase() === WECHAT_LOWERCASE && !isEmpty(this.props.Templates.selectedWeChatAccount)) {
|
|
744
790
|
queryParams.wecrmId = this.props.Templates.selectedWeChatAccount.configs.wecrm_app_id;
|
|
745
791
|
queryParams.wecrmToken = this.props.Templates.selectedWeChatAccount.configs.wecrm_token;
|
|
746
792
|
queryParams.originalId = this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier;
|
|
747
793
|
}
|
|
748
|
-
if (this.state.channel.toLowerCase() ===
|
|
794
|
+
if (this.state.channel.toLowerCase() === MOBILE_PUSH_LOWERCASE && !isEmpty(this.props.Templates.selectedWeChatAccount)) {
|
|
749
795
|
queryParams.accountId = this.props.Templates.selectedWeChatAccount.id;
|
|
750
796
|
if (this.state.mode) {
|
|
751
797
|
queryParams.mode = this.state.mode.toLowerCase();
|
|
752
798
|
}
|
|
753
799
|
}
|
|
754
800
|
}
|
|
755
|
-
if ((this.state.channel || '').toLowerCase() ===
|
|
801
|
+
if ((this.state.channel || '').toLowerCase() === SMS_LOWERCASE && isTraiDltFeature) {
|
|
756
802
|
queryParams.traiEnable = true;
|
|
757
803
|
}
|
|
758
|
-
|
|
759
|
-
|
|
804
|
+
if (this.state.channel.toLowerCase() === ZALO_LOWERCASE) {
|
|
805
|
+
queryParams.username = this.props.Templates?.weCrmAccounts[0]?.name;
|
|
806
|
+
queryParams.oa_id = this.props.Templates?.weCrmAccounts[0]?.sourceAccountIdentifier;
|
|
807
|
+
queryParams.token = this.props.Templates?.weCrmAccounts[0]?.configs?.token;
|
|
808
|
+
}
|
|
809
|
+
this.setState({ page, templatesCount }, () => {
|
|
760
810
|
queryParams.page = page;
|
|
761
811
|
queryParams.perPage = this.state.perPageLimit;
|
|
762
812
|
const channel = this.state.channel;
|
|
@@ -818,6 +868,14 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
818
868
|
});
|
|
819
869
|
}
|
|
820
870
|
|
|
871
|
+
filterZaloTemplates = (templates) => {
|
|
872
|
+
const { selectedZaloStatus } = this.state;
|
|
873
|
+
if (selectedZaloStatus) {
|
|
874
|
+
return templates?.filter((template) => template?.versions?.base?.content?.zalo.status === selectedZaloStatus);
|
|
875
|
+
}
|
|
876
|
+
return templates;
|
|
877
|
+
}
|
|
878
|
+
|
|
821
879
|
filterSMSTemplates = (templates) => {
|
|
822
880
|
const { smsFilter } = this.state;
|
|
823
881
|
if (SMS_FILTERS.ALL === smsFilter) {
|
|
@@ -827,13 +885,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
827
885
|
}
|
|
828
886
|
|
|
829
887
|
getCreativesEditText = (channel) => {
|
|
830
|
-
if (channel
|
|
831
|
-
return messages.
|
|
888
|
+
if ([WHATSAPP_LOWERCASE, ZALO_LOWERCASE].includes(channel)) {
|
|
889
|
+
return messages.overview;
|
|
832
890
|
}
|
|
833
891
|
return messages.creativesTemplatesEdit;
|
|
834
892
|
}
|
|
835
893
|
|
|
836
|
-
|
|
894
|
+
whatsappZaloIllustrationText = (title, desc) =>
|
|
837
895
|
<CapHeader
|
|
838
896
|
title={
|
|
839
897
|
<CapHeading type="h3" className="channel-specific-illustration-text">
|
|
@@ -890,6 +948,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
890
948
|
filteredTemplates = this.filterSMSTemplates(templates);
|
|
891
949
|
isTraiDltFeature = this.checkDLTfeatureEnable();
|
|
892
950
|
break;
|
|
951
|
+
case ZALO:
|
|
952
|
+
filteredTemplates = this.filterZaloTemplates(templates);
|
|
953
|
+
break;
|
|
893
954
|
default:
|
|
894
955
|
break;
|
|
895
956
|
}
|
|
@@ -906,16 +967,17 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
906
967
|
key: `${currentChannel}-card-${template?.name}`,
|
|
907
968
|
title: <span title={template?.name} >{template?.name}</span>,
|
|
908
969
|
extra: [
|
|
909
|
-
<
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
970
|
+
<CapTooltip title={this.state.channel.toLowerCase() === ZALO_LOWERCASE ? this.props.intl.formatMessage(messages.zaloPreview) : ''}>
|
|
971
|
+
<CapIcon
|
|
972
|
+
className={`view-${channelLowerCase}`}
|
|
973
|
+
style={{ marginRight: '16px' }}
|
|
974
|
+
type="eye"
|
|
975
|
+
onClick={() => { if (!this.props.isFullMode || this.props.isDltFromRcs) { this.props.handlePeviewTemplate(template); } else { handlers.handlePreviewClick(template); } }}
|
|
976
|
+
/>
|
|
977
|
+
</CapTooltip>,
|
|
915
978
|
],
|
|
916
979
|
hoverOption: <CapButton className={this.props.isFullMode ? `edit-${channelLowerCase}` : `select-${channelLowerCase}`} onClick={(e) => handlers.handleEditClick(e, template, undefined, undefined, {account: this.state.selectedAccount})}>{hoverButtonText}</CapButton>,
|
|
917
980
|
};
|
|
918
|
-
|
|
919
981
|
const {
|
|
920
982
|
versions: {
|
|
921
983
|
base: {
|
|
@@ -943,7 +1005,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
943
1005
|
</CapMenu>
|
|
944
1006
|
}
|
|
945
1007
|
>
|
|
946
|
-
<CapIcon type="more" />
|
|
1008
|
+
{this.state.channel.toLowerCase() === ZALO_LOWERCASE ? <></> : <CapIcon type="more" />}
|
|
947
1009
|
</CapDropdown>);
|
|
948
1010
|
}
|
|
949
1011
|
switch (currentChannel) {
|
|
@@ -1070,9 +1132,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1070
1132
|
imageURL = '',
|
|
1071
1133
|
buttonURL = '',
|
|
1072
1134
|
buttonText = '',
|
|
1073
|
-
} = {},
|
|
1074
1135
|
} = {},
|
|
1075
|
-
} =
|
|
1136
|
+
} = {},
|
|
1137
|
+
} = template.versions.base;
|
|
1076
1138
|
templateData.content = text;
|
|
1077
1139
|
if (imageURL) {
|
|
1078
1140
|
templateData.url = imageURL;
|
|
@@ -1126,6 +1188,43 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1126
1188
|
templateData.content = getRCSContent(template);
|
|
1127
1189
|
break;
|
|
1128
1190
|
}
|
|
1191
|
+
case ZALO: {
|
|
1192
|
+
const {
|
|
1193
|
+
versions: {
|
|
1194
|
+
base: {
|
|
1195
|
+
content: {
|
|
1196
|
+
zalo: { templateId = "", status = "" } = {},
|
|
1197
|
+
} = {},
|
|
1198
|
+
} = {},
|
|
1199
|
+
} = {},
|
|
1200
|
+
} = template;
|
|
1201
|
+
templateData.title = (
|
|
1202
|
+
<CapRow>
|
|
1203
|
+
<CapLabel className="zalo-template-name">
|
|
1204
|
+
{templateId}
|
|
1205
|
+
</CapLabel>
|
|
1206
|
+
<CapRow
|
|
1207
|
+
type="flex"
|
|
1208
|
+
align="middle"
|
|
1209
|
+
className="zalo-status-container"
|
|
1210
|
+
>
|
|
1211
|
+
<CapStatus
|
|
1212
|
+
type={
|
|
1213
|
+
status === ZALO_STATUSES.ENABLE
|
|
1214
|
+
? WHATSAPP_STATUSES.approved
|
|
1215
|
+
: status === ZALO_STATUSES.REJECT
|
|
1216
|
+
? WHATSAPP_STATUSES.rejected
|
|
1217
|
+
: WHATSAPP_STATUSES.pending
|
|
1218
|
+
}
|
|
1219
|
+
text={status && this.props.intl.formatMessage(zaloMessages?.[`${status}_STATUS`])}
|
|
1220
|
+
labelType="label3"
|
|
1221
|
+
/>
|
|
1222
|
+
</CapRow>
|
|
1223
|
+
</CapRow>
|
|
1224
|
+
);
|
|
1225
|
+
templateData.content = <CapLabel type="label19" className="zalo-listing-content desc">{template.name}</CapLabel>;
|
|
1226
|
+
break;
|
|
1227
|
+
}
|
|
1129
1228
|
default:
|
|
1130
1229
|
templateData.content = "";
|
|
1131
1230
|
}
|
|
@@ -1134,16 +1233,17 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1134
1233
|
|
|
1135
1234
|
const accountId = get(this.props, 'Templates.selectedWeChatAccount.uuid');
|
|
1136
1235
|
const accounts = get(this.props, 'Templates.weCrmAccounts');
|
|
1137
|
-
const
|
|
1138
|
-
const
|
|
1139
|
-
const
|
|
1236
|
+
const noWhatsappZaloTemplates = this.isFullMode() && isEmpty(templates);
|
|
1237
|
+
const noFilteredWhatsappZaloTemplates = this.isFullMode() && !isEmpty(templates) && isEmpty(filteredTemplates);
|
|
1238
|
+
const noApprovedWhatsappZaloTemplates = !this.isFullMode() && isEmpty(filteredTemplates);
|
|
1140
1239
|
const showWhatsappIllustration = !isEmpty(this.props.Templates.selectedWhatsappAccount) && [WHATSAPP_LOWERCASE].includes(channelLowerCase);
|
|
1240
|
+
const showZaloIllustration = !isEmpty(this.props.Templates.selectedZaloAccount) && [ZALO_LOWERCASE].includes(channelLowerCase);
|
|
1141
1241
|
const showRcsIllustration = channelLowerCase === RCS_LOWERCASE && isEmpty(templates);
|
|
1142
1242
|
const noLoaderAndSearchText = isEmpty(this.state.searchText) && !isLoading;
|
|
1143
1243
|
return (<div>
|
|
1144
1244
|
{[WECHAT, MOBILE_PUSH].includes(currentChannel) && this.showAccountName()}
|
|
1145
1245
|
{filterContent}
|
|
1146
|
-
{[WHATSAPP].includes(currentChannel) && this.selectedFilters()}
|
|
1246
|
+
{[WHATSAPP, ZALO].includes(currentChannel) && this.selectedFilters()}
|
|
1147
1247
|
<CapSpin spinning={isLoading} tip={loadingTip} style={{width: '100%'}}>
|
|
1148
1248
|
{<div>
|
|
1149
1249
|
{!isEmpty(filteredTemplates) || !isEmpty(this.state.searchText) || !isEmpty(this.props.Templates.templateError) ? (
|
|
@@ -1160,7 +1260,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1160
1260
|
}
|
|
1161
1261
|
|
|
1162
1262
|
{(this.state.selectedAccount === '' && isEmpty(this.props.Templates.selectedWeChatAccount)) && (this.state.channel.toLowerCase() === 'wechat' || this.state.channel.toLowerCase() === "mobilepush") &&
|
|
1163
|
-
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
1263
|
+
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh' }}>
|
|
1164
1264
|
<CapHeading type="h6">{accounts ? this.props.intl.formatMessage(messages.noAccountMessage) : this.props.intl.formatMessage(messages.noAccountsPresent)}</CapHeading>
|
|
1165
1265
|
</div>
|
|
1166
1266
|
}
|
|
@@ -1182,13 +1282,12 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1182
1282
|
</div>
|
|
1183
1283
|
)
|
|
1184
1284
|
}
|
|
1185
|
-
{showWhatsappIllustration &&
|
|
1186
|
-
(
|
|
1285
|
+
{(showWhatsappIllustration || showZaloIllustration) && (
|
|
1187
1286
|
noLoaderAndSearchText &&
|
|
1188
1287
|
<div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto' } : {}}>
|
|
1189
|
-
{
|
|
1190
|
-
{
|
|
1191
|
-
{
|
|
1288
|
+
{noWhatsappZaloTemplates && <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />}
|
|
1289
|
+
{noFilteredWhatsappZaloTemplates && this.whatsappZaloIllustrationText('noFilteredWhatsappZaloTemplatesTitle', 'noFilteredWhatsappZaloTemplatesDesc')}
|
|
1290
|
+
{noApprovedWhatsappZaloTemplates && this.whatsappZaloIllustrationText('noApprovedWhatsappZaloTemplatesTitle', showWhatsappIllustration ? 'noApprovedWhatsappTemplatesDesc' : 'zaloDescIllustration')}
|
|
1192
1291
|
</div>
|
|
1193
1292
|
)
|
|
1194
1293
|
}
|
|
@@ -1230,7 +1329,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1230
1329
|
} else if (this.state.channel.toLowerCase() === 'mobilepush') {
|
|
1231
1330
|
routeParams = {
|
|
1232
1331
|
pathname: `/mobilepush/edit/${e.template_id}`,
|
|
1233
|
-
query: type === 'embedded' ? {type: 'embedded', module, account_id: e.account_id} : {},
|
|
1332
|
+
query: type === 'embedded' ? {type: 'embedded', module, account_id: e.account_id } : {},
|
|
1234
1333
|
};
|
|
1235
1334
|
} else if (this.state.channel.toLowerCase() === 'wechat') {
|
|
1236
1335
|
if (e.template_type && e.template_type === 'RICHMEDIA_WECHAT_TEMPLATE') {
|
|
@@ -1247,7 +1346,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1247
1346
|
} else if (this.state.channel.toLowerCase() === 'line') {
|
|
1248
1347
|
routeParams = {
|
|
1249
1348
|
pathname: `/line/view/${e.msg_type}/`,
|
|
1250
|
-
query: type === 'embedded' ? {type: 'embedded', module, account_id: e.account_id
|
|
1349
|
+
query: type === 'embedded' ? {type: 'embedded', module, account_id: e.account_id} : {},
|
|
1251
1350
|
};
|
|
1252
1351
|
}
|
|
1253
1352
|
this.setState({loading: true, routeParams});
|
|
@@ -1551,22 +1650,38 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1551
1650
|
}
|
|
1552
1651
|
}
|
|
1553
1652
|
|
|
1554
|
-
searchTemplate(data) {
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1653
|
+
searchTemplate(data, channel) {
|
|
1654
|
+
if (channel.toLowerCase() === ZALO_LOWERCASE) {
|
|
1655
|
+
if (data) {
|
|
1656
|
+
this.setState({
|
|
1657
|
+
searchingZaloTemplate: true,
|
|
1658
|
+
searchedZaloTemplates: this.props.TemplatesList.filter((zalo) => zalo?.name?.toLowerCase().includes(data?.toLowerCase())),
|
|
1659
|
+
searchText: data,
|
|
1660
|
+
});
|
|
1661
|
+
} else {
|
|
1662
|
+
this.setState({
|
|
1663
|
+
searchingZaloTemplate: false,
|
|
1664
|
+
searchedZaloTemplates: [],
|
|
1665
|
+
searchText: data,
|
|
1666
|
+
});
|
|
1567
1667
|
}
|
|
1568
|
-
|
|
1569
|
-
|
|
1668
|
+
} else {
|
|
1669
|
+
this.setState({ searchText: data }, () => {
|
|
1670
|
+
const params = {
|
|
1671
|
+
name: this.state.searchText,
|
|
1672
|
+
sortBy: this.state.sortBy,
|
|
1673
|
+
};
|
|
1674
|
+
if (this.state.channel.toLowerCase() === WECHAT_LOWERCASE) {
|
|
1675
|
+
params.wecrmId = this.props.Templates.selectedWeChatAccount.configs.wecrm_app_id;
|
|
1676
|
+
params.wecrmToken = this.props.Templates.selectedWeChatAccount.configs.wecrm_token;
|
|
1677
|
+
params.originalId = this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier;
|
|
1678
|
+
}
|
|
1679
|
+
if (this.state.channel.toLowerCase() === MOBILE_PUSH_LOWERCASE) {
|
|
1680
|
+
params.accountId = this.props.Templates.selectedWeChatAccount.id;
|
|
1681
|
+
}
|
|
1682
|
+
this.getAllTemplates({params, resetPage: true});
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1570
1685
|
}
|
|
1571
1686
|
|
|
1572
1687
|
handleSortBy(data) {
|
|
@@ -1767,6 +1882,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1767
1882
|
pathName = `/rcs/edit/${id}/`;
|
|
1768
1883
|
break;
|
|
1769
1884
|
}
|
|
1885
|
+
case ZALO: {
|
|
1886
|
+
pathName = `/zalo/edit/${id}/`;
|
|
1887
|
+
break;
|
|
1888
|
+
}
|
|
1770
1889
|
default:
|
|
1771
1890
|
break;
|
|
1772
1891
|
}
|
|
@@ -1791,24 +1910,48 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1791
1910
|
selectTemplate = (id) => find(this.props.TemplatesList, {_id: id})
|
|
1792
1911
|
|
|
1793
1912
|
handlePreviewClick(template, modeType) {
|
|
1794
|
-
this.
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
this.
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
this.
|
|
1913
|
+
if (this.state.channel.toLowerCase() !== ZALO_LOWERCASE) {
|
|
1914
|
+
this.togglePreview();
|
|
1915
|
+
const templateInfo = cloneDeep(template);
|
|
1916
|
+
if (this.state.channel.toLowerCase() === "line") {
|
|
1917
|
+
templateInfo.modeType = modeType;
|
|
1918
|
+
}
|
|
1919
|
+
templateInfo.updatedByName = commonUtil.getUserNameById(
|
|
1920
|
+
parseInt(template.updatedBy, 10),
|
|
1921
|
+
commonUtil.getMergedUserList(this.props.Templates.userList)
|
|
1922
|
+
);
|
|
1923
|
+
if (this.state.channel === "wechat") {
|
|
1924
|
+
templateInfo.content = this.prepareWeChatPreviewData(template);
|
|
1925
|
+
} else if (this.state.channel.toLowerCase() === "mobilepush") {
|
|
1926
|
+
templateInfo.content = template.versions.base;
|
|
1927
|
+
templateInfo.appName = this.props.Templates.selectedWeChatAccount.name;
|
|
1928
|
+
} else if (this.state.channel.toLowerCase() === "email") {
|
|
1929
|
+
this.props.actions.getTemplateDetails(template._id);
|
|
1930
|
+
} else if (this.state.channel.toLowerCase() === "ebill") {
|
|
1931
|
+
this.props.actions.getTemplateDetails(template._id);
|
|
1932
|
+
}
|
|
1933
|
+
if (this.state.channel.toLowerCase() !== "ebill") {
|
|
1934
|
+
this.setState({ previewTemplate: templateInfo });
|
|
1935
|
+
}
|
|
1936
|
+
} else {
|
|
1937
|
+
const {
|
|
1938
|
+
Templates: {
|
|
1939
|
+
weCrmAccounts: [
|
|
1940
|
+
{
|
|
1941
|
+
name,
|
|
1942
|
+
sourceAccountIdentifier,
|
|
1943
|
+
configs: { token },
|
|
1944
|
+
},
|
|
1945
|
+
],
|
|
1946
|
+
},
|
|
1947
|
+
} = this.props;
|
|
1948
|
+
this.props.zaloActions.getTemplateInfoById({
|
|
1949
|
+
username: name,
|
|
1950
|
+
oa_id: sourceAccountIdentifier,
|
|
1951
|
+
token: token,
|
|
1952
|
+
id: template?._id,
|
|
1953
|
+
preview: true,
|
|
1954
|
+
});
|
|
1812
1955
|
}
|
|
1813
1956
|
}
|
|
1814
1957
|
|
|
@@ -2090,6 +2233,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2090
2233
|
this.props.Templates?.senderDetails?.status === "REQUEST"
|
|
2091
2234
|
) &&
|
|
2092
2235
|
this.state.channel.toLowerCase() === WHATSAPP_LOWERCASE;
|
|
2236
|
+
const zaloLoader =
|
|
2237
|
+
(
|
|
2238
|
+
(this.state.selectedAccount !== "" && getAllTemplatesInProgress) ||
|
|
2239
|
+
fetchingWeCrmAccounts ) &&
|
|
2240
|
+
this.state.channel.toLowerCase() === ZALO_LOWERCASE;
|
|
2093
2241
|
const mobilePushLoader = (((getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'mobilepush');
|
|
2094
2242
|
const emailLoader = (
|
|
2095
2243
|
(getAllTemplatesInProgress ||
|
|
@@ -2099,6 +2247,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2099
2247
|
const ebillLoader = ((getAllTemplatesInProgress || sendingFile) && this.state.channel.toLowerCase() === 'ebill');
|
|
2100
2248
|
const isLoading = ((wechatLoader !== undefined) ? wechatLoader : false) ||
|
|
2101
2249
|
(whatsappLoader !== undefined ? whatsappLoader : false) ||
|
|
2250
|
+
(zaloLoader !== undefined ? zaloLoader : false) ||
|
|
2102
2251
|
(smsLoader !== undefined ? smsLoader : false) ||
|
|
2103
2252
|
(emailLoader !== undefined ? emailLoader : false) ||
|
|
2104
2253
|
(ebillLoader !== undefined ? ebillLoader : false) ||
|
|
@@ -2155,6 +2304,15 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2155
2304
|
descriptionPosition: 'bottom',
|
|
2156
2305
|
descriptionClassName: 'illustration-desc rcs-illustration',
|
|
2157
2306
|
};
|
|
2307
|
+
case ZALO:
|
|
2308
|
+
return {
|
|
2309
|
+
illustrationImage: zaloillustration,
|
|
2310
|
+
title: <FormattedMessage {...messages.zaloTitleIllustration} />,
|
|
2311
|
+
description: <FormattedMessage {...messages.zaloDescIllustration} />,
|
|
2312
|
+
descriptionPosition: 'bottom',
|
|
2313
|
+
descriptionClassName: 'illustration-desc zalo-illustration',
|
|
2314
|
+
buttonClassName: "zalo-illustration-button",
|
|
2315
|
+
};
|
|
2158
2316
|
default:
|
|
2159
2317
|
return {};
|
|
2160
2318
|
}
|
|
@@ -2283,6 +2441,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2283
2441
|
noAccountHeader = messages.noAccountsPresentWhatsapp;
|
|
2284
2442
|
break;
|
|
2285
2443
|
}
|
|
2444
|
+
case ZALO: {
|
|
2445
|
+
accountHeader = formatMessage(messages.zaloAccount);
|
|
2446
|
+
noAccountHeader = messages.noAccountsPresentZalo;
|
|
2447
|
+
break;
|
|
2448
|
+
}
|
|
2286
2449
|
default:
|
|
2287
2450
|
break;
|
|
2288
2451
|
}
|
|
@@ -2325,7 +2488,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2325
2488
|
selected={selectedAccount}
|
|
2326
2489
|
/>
|
|
2327
2490
|
</div>
|
|
2328
|
-
|
|
2491
|
+
}
|
|
2329
2492
|
</CapSpin>);
|
|
2330
2493
|
};
|
|
2331
2494
|
|
|
@@ -2352,6 +2515,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2352
2515
|
[MOBILE_PUSH]: 'mobilepushAccount',
|
|
2353
2516
|
[WECHAT]: 'wechatAccount',
|
|
2354
2517
|
[WHATSAPP]: 'whatsappAccount',
|
|
2518
|
+
[ZALO]: 'zaloAccount',
|
|
2355
2519
|
};
|
|
2356
2520
|
return formatMessage(messages[channelObj[channel?.toUpperCase()]]);
|
|
2357
2521
|
}
|
|
@@ -2381,8 +2545,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2381
2545
|
}
|
|
2382
2546
|
}
|
|
2383
2547
|
|
|
2548
|
+
removeZaloFilter = () => this.setState({ selectedZaloStatus: null });
|
|
2549
|
+
|
|
2384
2550
|
selectedFilters = () => {
|
|
2385
|
-
const { selectedWhatsappStatus, selectedWhatsappCategory } = this.state;
|
|
2551
|
+
const { selectedWhatsappStatus, selectedWhatsappCategory, selectedZaloStatus } = this.state;
|
|
2386
2552
|
const {
|
|
2387
2553
|
intl: {
|
|
2388
2554
|
formatMessage,
|
|
@@ -2415,6 +2581,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2415
2581
|
/>
|
|
2416
2582
|
) : null
|
|
2417
2583
|
}
|
|
2584
|
+
{
|
|
2585
|
+
selectedZaloStatus ? (
|
|
2586
|
+
<CapTag closable onClose={() => this.removeZaloFilter(WHATSAPP_STATUS)}>
|
|
2587
|
+
{formatMessage(messages.status)}: {formatMessage(zaloMessages[`${selectedZaloStatus}_STATUS`])}
|
|
2588
|
+
</CapTag>
|
|
2589
|
+
) : null
|
|
2590
|
+
}
|
|
2418
2591
|
</CapRow>
|
|
2419
2592
|
);
|
|
2420
2593
|
}
|
|
@@ -2424,6 +2597,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2424
2597
|
setWhatsappCategory = (value) => this.setState({selectedWhatsappCategory: value?.item?.props?.value});
|
|
2425
2598
|
setLineFilter = (e) => this.setState({lineFilter: e.target.value});
|
|
2426
2599
|
setSMSFilter = (e) => this.setState({smsFilter: e.target.value});
|
|
2600
|
+
setZaloStatus = (value) => this.setState({selectedZaloStatus: value?.item?.props?.value});
|
|
2427
2601
|
|
|
2428
2602
|
openCreativesFullMode = () => {
|
|
2429
2603
|
window.open(`/creatives/ui/v2?channel=${WHATSAPP_LOWERCASE}&mode=${CREATE}`, "_blank");
|
|
@@ -2511,7 +2685,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2511
2685
|
className="create-new-link"
|
|
2512
2686
|
/>
|
|
2513
2687
|
)
|
|
2514
|
-
|
|
2688
|
+
: this.state.channel.toLowerCase() === ZALO_LOWERCASE ? <></> : (
|
|
2515
2689
|
<CapButton
|
|
2516
2690
|
className={`create-new-${channelLowerCase} margin-l-8 margin-b-12`}
|
|
2517
2691
|
type={"primary"}
|
|
@@ -2532,11 +2706,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2532
2706
|
style={{width: '210px'}}
|
|
2533
2707
|
placeholder={this.props.intl.formatMessage(messages.searchText)}
|
|
2534
2708
|
value={this.state.searchText}
|
|
2535
|
-
onChange={(e) => this.searchTemplate(e.target.value)}
|
|
2709
|
+
onChange={(e) => this.searchTemplate(e.target.value, this.state.channel)}
|
|
2536
2710
|
disabled={this.checkSearchDisabled()}
|
|
2537
|
-
onClear={() => this.searchTemplate('')}
|
|
2711
|
+
onClear={() => this.searchTemplate('', this.state.channel)}
|
|
2538
2712
|
onScroll={(e) => e.stopPropagation()}
|
|
2539
|
-
|
|
2713
|
+
/>}
|
|
2540
2714
|
{
|
|
2541
2715
|
channel.toUpperCase() === WECHAT && <CapRadio.CapRadioGroup className="wechat-filters" defaultValue={wechatFilter} onChange={this.setWechatFilter}>
|
|
2542
2716
|
<CapRadio.Button value={WECHAT_FILTERS.ALL}><CapLabel type="label2">
|
|
@@ -2551,37 +2725,56 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2551
2725
|
</CapRadio.CapRadioGroup>
|
|
2552
2726
|
}
|
|
2553
2727
|
{
|
|
2554
|
-
channel.toUpperCase() ===
|
|
2555
|
-
<div className="
|
|
2728
|
+
channel.toUpperCase() === ZALO && (
|
|
2729
|
+
<div className="zalo-filters">
|
|
2556
2730
|
{
|
|
2557
2731
|
this.props.isFullMode ? (
|
|
2558
2732
|
<CapSelectFilter
|
|
2559
2733
|
placement="bottomLeft"
|
|
2560
|
-
data={
|
|
2561
|
-
onSelect={this.
|
|
2562
|
-
selectedValue={this.state.
|
|
2734
|
+
data={ZALO_STATUS_OPTIONS}
|
|
2735
|
+
onSelect={this.setZaloStatus}
|
|
2736
|
+
selectedValue={this.state.selectedZaloStatus}
|
|
2563
2737
|
placeholder="Status"
|
|
2564
|
-
showBadge
|
|
2565
2738
|
width="90px"
|
|
2566
2739
|
/>
|
|
2567
2740
|
) : null
|
|
2568
2741
|
}
|
|
2569
|
-
<CapSelectFilter
|
|
2570
|
-
placement="bottomLeft"
|
|
2571
|
-
data={this.state.hostName === HOST_TWILIO
|
|
2572
|
-
? TWILIO_CATEGORY_OPTIONS
|
|
2573
|
-
: KARIX_GUPSHUP_CATEGORY_OPTIONS}
|
|
2574
|
-
onSelect={this.setWhatsappCategory}
|
|
2575
|
-
selectedValue={this.state.selectedWhatsappCategory}
|
|
2576
|
-
placeholder="Category"
|
|
2577
|
-
showBadge
|
|
2578
|
-
width="105px"
|
|
2579
|
-
overlayStyle={{ overflowY: "hidden" }}
|
|
2580
|
-
/>
|
|
2581
2742
|
</div>
|
|
2582
2743
|
|
|
2583
2744
|
)
|
|
2584
2745
|
}
|
|
2746
|
+
{
|
|
2747
|
+
channel.toUpperCase() === WHATSAPP && (
|
|
2748
|
+
<div className="whatsapp-filters">
|
|
2749
|
+
{
|
|
2750
|
+
this.props.isFullMode ? (
|
|
2751
|
+
<CapSelectFilter
|
|
2752
|
+
placement="bottomLeft"
|
|
2753
|
+
data={STATUS_OPTIONS}
|
|
2754
|
+
onSelect={this.setWhatsappStatus}
|
|
2755
|
+
selectedValue={this.state.selectedWhatsappStatus}
|
|
2756
|
+
placeholder="Status"
|
|
2757
|
+
showBadge
|
|
2758
|
+
width="90px"
|
|
2759
|
+
/>
|
|
2760
|
+
) : null
|
|
2761
|
+
}
|
|
2762
|
+
<CapSelectFilter
|
|
2763
|
+
placement="bottomLeft"
|
|
2764
|
+
data={this.state.hostName === HOST_TWILIO
|
|
2765
|
+
? TWILIO_CATEGORY_OPTIONS
|
|
2766
|
+
: KARIX_GUPSHUP_CATEGORY_OPTIONS}
|
|
2767
|
+
onSelect={this.setWhatsappCategory}
|
|
2768
|
+
selectedValue={this.state.selectedWhatsappCategory}
|
|
2769
|
+
placeholder="Category"
|
|
2770
|
+
showBadge
|
|
2771
|
+
width="105px"
|
|
2772
|
+
overlayStyle={{ overflowY: "hidden" }}
|
|
2773
|
+
/>
|
|
2774
|
+
</div>
|
|
2775
|
+
|
|
2776
|
+
)
|
|
2777
|
+
}
|
|
2585
2778
|
{
|
|
2586
2779
|
channel.toUpperCase() === LINE &&
|
|
2587
2780
|
isFullMode
|
|
@@ -2685,6 +2878,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2685
2878
|
(this.props.EmailCreate.duplicateTemplateInProgress && 'duplicatingTemplate');
|
|
2686
2879
|
|
|
2687
2880
|
const loadingTip = messages[loadingTipIntl] ? this.props.intl.formatMessage(messages[loadingTipIntl]) : this.props.intl.formatMessage(messages.gettingAllTemplates);
|
|
2881
|
+
const showNoTemplatesFoundZalo = this.state.channel.toUpperCase() === ZALO && isEmpty(this.state.searchedZaloTemplates) && this.state.searchingZaloTemplate;
|
|
2882
|
+
const showNoTemplatesFoundOther = ![ZALO].includes(this.state.channel.toUpperCase()) && isEmpty(this.props.TemplatesList) && !this.props.Templates.getAllTemplatesInProgress && !isEmpty(this.state.searchText);
|
|
2883
|
+
const showNoTemplatesFound = showNoTemplatesFoundZalo || showNoTemplatesFoundOther;
|
|
2688
2884
|
|
|
2689
2885
|
return (
|
|
2690
2886
|
<>
|
|
@@ -2706,9 +2902,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2706
2902
|
|
|
2707
2903
|
<CapRow>
|
|
2708
2904
|
<Pagination onPageChange={templates.length ? this.onPaginationChange : () => {}} paginationSelector="pagination-container">
|
|
2709
|
-
{this.getTemplateDataForGrid({isLoading, loadingTip, channel: this.state.channel, templates: this.props.TemplatesList, filterContent, handlers: {handlePreviewClick: this.handlePreviewClick, handleEditClick: this.handleEditClick}})}
|
|
2905
|
+
{this.getTemplateDataForGrid({ isLoading, loadingTip, channel: this.state.channel, templates: this.state.searchingZaloTemplate ? this.state.searchedZaloTemplates : this.props.TemplatesList, filterContent, handlers: { handlePreviewClick: this.handlePreviewClick, handleEditClick: this.handleEditClick}})}
|
|
2710
2906
|
</Pagination>
|
|
2711
|
-
{
|
|
2907
|
+
{showNoTemplatesFound &&
|
|
2712
2908
|
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
2713
2909
|
<CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesFound)}</CapHeading>
|
|
2714
2910
|
</div>}
|
|
@@ -2730,7 +2926,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2730
2926
|
selectedWeChatAccount={get(this.props, 'Templates.selectedWeChatAccount', {})}
|
|
2731
2927
|
selectedAccount={this.state.selectedAccount}
|
|
2732
2928
|
/>
|
|
2733
|
-
|
|
2929
|
+
}
|
|
2734
2930
|
</CapRow>
|
|
2735
2931
|
<CapRow>
|
|
2736
2932
|
|
|
@@ -2789,6 +2985,7 @@ Templates.propTypes = {
|
|
|
2789
2985
|
facebookActions: PropTypes.object,
|
|
2790
2986
|
whatsappActions: PropTypes.object,
|
|
2791
2987
|
rcsActions: PropTypes.object,
|
|
2988
|
+
zaloActions: PropTypes.object,
|
|
2792
2989
|
smsRegister: PropTypes.any,
|
|
2793
2990
|
isDltFromRcs: PropTypes.bool,
|
|
2794
2991
|
};
|
|
@@ -2804,6 +3001,7 @@ const mapStateToProps = createStructuredSelector({
|
|
|
2804
3001
|
Global: makeSelectAuthenticated(),
|
|
2805
3002
|
Line: makeSelectLine(),
|
|
2806
3003
|
Viber: makeSelectViber(),
|
|
3004
|
+
Zalo: makeSelectZalo(),
|
|
2807
3005
|
});
|
|
2808
3006
|
|
|
2809
3007
|
function mapDispatchToProps(dispatch) {
|
|
@@ -2820,6 +3018,7 @@ function mapDispatchToProps(dispatch) {
|
|
|
2820
3018
|
facebookActions: bindActionCreators(facebookActions, dispatch),
|
|
2821
3019
|
whatsappActions: bindActionCreators(whatsappActions, dispatch),
|
|
2822
3020
|
rcsActions: bindActionCreators(rcsActions, dispatch),
|
|
3021
|
+
zaloActions: bindActionCreators(zaloActions, dispatch),
|
|
2823
3022
|
};
|
|
2824
3023
|
}
|
|
2825
3024
|
|