@capillarytech/creatives-library 7.17.35 → 7.17.37-alpha.0
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/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 +326 -120
- package/v2Containers/Templates/messages.js +32 -8
- package/v2Containers/Templates/reducer.js +3 -1
- package/v2Containers/Templates/sagas.js +2 -2
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +623 -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 +56 -0
- package/v2Containers/Zalo/index.js +390 -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,15 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
818
868
|
});
|
|
819
869
|
}
|
|
820
870
|
|
|
871
|
+
filterZaloTemplates = (templates) => {
|
|
872
|
+
let { selectedZaloStatus } = this.state;
|
|
873
|
+
selectedZaloStatus = !this.props.isFullMode ? ZALO_STATUSES.ENABLE : selectedZaloStatus;
|
|
874
|
+
if (selectedZaloStatus) {
|
|
875
|
+
return templates?.filter((template) => template?.versions?.base?.content?.zalo?.status === selectedZaloStatus);
|
|
876
|
+
}
|
|
877
|
+
return templates;
|
|
878
|
+
}
|
|
879
|
+
|
|
821
880
|
filterSMSTemplates = (templates) => {
|
|
822
881
|
const { smsFilter } = this.state;
|
|
823
882
|
if (SMS_FILTERS.ALL === smsFilter) {
|
|
@@ -827,13 +886,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
827
886
|
}
|
|
828
887
|
|
|
829
888
|
getCreativesEditText = (channel) => {
|
|
830
|
-
if (channel
|
|
831
|
-
return messages.
|
|
889
|
+
if ([WHATSAPP_LOWERCASE, ZALO_LOWERCASE].includes(channel)) {
|
|
890
|
+
return messages.overview;
|
|
832
891
|
}
|
|
833
892
|
return messages.creativesTemplatesEdit;
|
|
834
893
|
}
|
|
835
894
|
|
|
836
|
-
|
|
895
|
+
whatsappZaloIllustrationText = (title, desc) =>
|
|
837
896
|
<CapHeader
|
|
838
897
|
title={
|
|
839
898
|
<CapHeading type="h3" className="channel-specific-illustration-text">
|
|
@@ -890,6 +949,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
890
949
|
filteredTemplates = this.filterSMSTemplates(templates);
|
|
891
950
|
isTraiDltFeature = this.checkDLTfeatureEnable();
|
|
892
951
|
break;
|
|
952
|
+
case ZALO:
|
|
953
|
+
filteredTemplates = this.filterZaloTemplates(templates);
|
|
954
|
+
break;
|
|
893
955
|
default:
|
|
894
956
|
break;
|
|
895
957
|
}
|
|
@@ -906,16 +968,17 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
906
968
|
key: `${currentChannel}-card-${template?.name}`,
|
|
907
969
|
title: <span title={template?.name} >{template?.name}</span>,
|
|
908
970
|
extra: [
|
|
909
|
-
<
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
971
|
+
<CapTooltip title={this.state.channel.toLowerCase() === ZALO_LOWERCASE ? this.props.intl.formatMessage(messages.zaloPreview) : ''}>
|
|
972
|
+
<CapIcon
|
|
973
|
+
className={`view-${channelLowerCase}`}
|
|
974
|
+
style={{ marginRight: '16px' }}
|
|
975
|
+
type="eye"
|
|
976
|
+
onClick={() => { if (!this.props.isFullMode || this.props.isDltFromRcs) { this.props.handlePeviewTemplate(template); } else { handlers.handlePreviewClick(template); } }}
|
|
977
|
+
/>
|
|
978
|
+
</CapTooltip>,
|
|
915
979
|
],
|
|
916
980
|
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
981
|
};
|
|
918
|
-
|
|
919
982
|
const {
|
|
920
983
|
versions: {
|
|
921
984
|
base: {
|
|
@@ -943,7 +1006,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
943
1006
|
</CapMenu>
|
|
944
1007
|
}
|
|
945
1008
|
>
|
|
946
|
-
<CapIcon type="more" />
|
|
1009
|
+
{this.state.channel.toLowerCase() === ZALO_LOWERCASE ? <></> : <CapIcon type="more" />}
|
|
947
1010
|
</CapDropdown>);
|
|
948
1011
|
}
|
|
949
1012
|
switch (currentChannel) {
|
|
@@ -1070,9 +1133,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1070
1133
|
imageURL = '',
|
|
1071
1134
|
buttonURL = '',
|
|
1072
1135
|
buttonText = '',
|
|
1073
|
-
} = {},
|
|
1074
1136
|
} = {},
|
|
1075
|
-
} =
|
|
1137
|
+
} = {},
|
|
1138
|
+
} = template.versions.base;
|
|
1076
1139
|
templateData.content = text;
|
|
1077
1140
|
if (imageURL) {
|
|
1078
1141
|
templateData.url = imageURL;
|
|
@@ -1126,6 +1189,43 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1126
1189
|
templateData.content = getRCSContent(template);
|
|
1127
1190
|
break;
|
|
1128
1191
|
}
|
|
1192
|
+
case ZALO: {
|
|
1193
|
+
const {
|
|
1194
|
+
versions: {
|
|
1195
|
+
base: {
|
|
1196
|
+
content: {
|
|
1197
|
+
zalo: { templateId = "", status = "" } = {},
|
|
1198
|
+
} = {},
|
|
1199
|
+
} = {},
|
|
1200
|
+
} = {},
|
|
1201
|
+
} = template;
|
|
1202
|
+
templateData.title = (
|
|
1203
|
+
<CapRow>
|
|
1204
|
+
<CapLabel className="zalo-template-name">
|
|
1205
|
+
{templateId}
|
|
1206
|
+
</CapLabel>
|
|
1207
|
+
<CapRow
|
|
1208
|
+
type="flex"
|
|
1209
|
+
align="middle"
|
|
1210
|
+
className="zalo-status-container"
|
|
1211
|
+
>
|
|
1212
|
+
<CapStatus
|
|
1213
|
+
type={
|
|
1214
|
+
status === ZALO_STATUSES.ENABLE
|
|
1215
|
+
? WHATSAPP_STATUSES.approved
|
|
1216
|
+
: status === ZALO_STATUSES.REJECT
|
|
1217
|
+
? WHATSAPP_STATUSES.rejected
|
|
1218
|
+
: WHATSAPP_STATUSES.pending
|
|
1219
|
+
}
|
|
1220
|
+
text={status && this.props.intl.formatMessage(zaloMessages?.[`${status}_STATUS`])}
|
|
1221
|
+
labelType="label3"
|
|
1222
|
+
/>
|
|
1223
|
+
</CapRow>
|
|
1224
|
+
</CapRow>
|
|
1225
|
+
);
|
|
1226
|
+
templateData.content = <CapLabel type="label19" className="zalo-listing-content desc">{template.name}</CapLabel>;
|
|
1227
|
+
break;
|
|
1228
|
+
}
|
|
1129
1229
|
default:
|
|
1130
1230
|
templateData.content = "";
|
|
1131
1231
|
}
|
|
@@ -1134,16 +1234,17 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1134
1234
|
|
|
1135
1235
|
const accountId = get(this.props, 'Templates.selectedWeChatAccount.uuid');
|
|
1136
1236
|
const accounts = get(this.props, 'Templates.weCrmAccounts');
|
|
1137
|
-
const
|
|
1138
|
-
const
|
|
1139
|
-
const
|
|
1237
|
+
const noWhatsappZaloTemplates = this.isFullMode() && isEmpty(templates);
|
|
1238
|
+
const noFilteredWhatsappZaloTemplates = this.isFullMode() && !isEmpty(templates) && isEmpty(filteredTemplates);
|
|
1239
|
+
const noApprovedWhatsappZaloTemplates = !this.isFullMode() && isEmpty(filteredTemplates);
|
|
1140
1240
|
const showWhatsappIllustration = !isEmpty(this.props.Templates.selectedWhatsappAccount) && [WHATSAPP_LOWERCASE].includes(channelLowerCase);
|
|
1241
|
+
const showZaloIllustration = !isEmpty(this.props.Templates.selectedZaloAccount) && [ZALO_LOWERCASE].includes(channelLowerCase);
|
|
1141
1242
|
const showRcsIllustration = channelLowerCase === RCS_LOWERCASE && isEmpty(templates);
|
|
1142
1243
|
const noLoaderAndSearchText = isEmpty(this.state.searchText) && !isLoading;
|
|
1143
1244
|
return (<div>
|
|
1144
1245
|
{[WECHAT, MOBILE_PUSH].includes(currentChannel) && this.showAccountName()}
|
|
1145
1246
|
{filterContent}
|
|
1146
|
-
{[WHATSAPP].includes(currentChannel) && this.selectedFilters()}
|
|
1247
|
+
{[WHATSAPP, ZALO].includes(currentChannel) && this.selectedFilters()}
|
|
1147
1248
|
<CapSpin spinning={isLoading} tip={loadingTip} style={{width: '100%'}}>
|
|
1148
1249
|
{<div>
|
|
1149
1250
|
{!isEmpty(filteredTemplates) || !isEmpty(this.state.searchText) || !isEmpty(this.props.Templates.templateError) ? (
|
|
@@ -1160,7 +1261,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1160
1261
|
}
|
|
1161
1262
|
|
|
1162
1263
|
{(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'}}>
|
|
1264
|
+
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh' }}>
|
|
1164
1265
|
<CapHeading type="h6">{accounts ? this.props.intl.formatMessage(messages.noAccountMessage) : this.props.intl.formatMessage(messages.noAccountsPresent)}</CapHeading>
|
|
1165
1266
|
</div>
|
|
1166
1267
|
}
|
|
@@ -1182,13 +1283,12 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1182
1283
|
</div>
|
|
1183
1284
|
)
|
|
1184
1285
|
}
|
|
1185
|
-
{showWhatsappIllustration &&
|
|
1186
|
-
(
|
|
1286
|
+
{(showWhatsappIllustration || showZaloIllustration) && (
|
|
1187
1287
|
noLoaderAndSearchText &&
|
|
1188
1288
|
<div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto' } : {}}>
|
|
1189
|
-
{
|
|
1190
|
-
{
|
|
1191
|
-
{
|
|
1289
|
+
{noWhatsappZaloTemplates && <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />}
|
|
1290
|
+
{noFilteredWhatsappZaloTemplates && this.whatsappZaloIllustrationText('noFilteredWhatsappZaloTemplatesTitle', 'noFilteredWhatsappZaloTemplatesDesc')}
|
|
1291
|
+
{noApprovedWhatsappZaloTemplates && this.whatsappZaloIllustrationText('noApprovedWhatsappZaloTemplatesTitle', showWhatsappIllustration ? 'noApprovedWhatsappTemplatesDesc' : 'zaloDescIllustration')}
|
|
1192
1292
|
</div>
|
|
1193
1293
|
)
|
|
1194
1294
|
}
|
|
@@ -1230,7 +1330,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1230
1330
|
} else if (this.state.channel.toLowerCase() === 'mobilepush') {
|
|
1231
1331
|
routeParams = {
|
|
1232
1332
|
pathname: `/mobilepush/edit/${e.template_id}`,
|
|
1233
|
-
query: type === 'embedded' ? {type: 'embedded', module, account_id: e.account_id} : {},
|
|
1333
|
+
query: type === 'embedded' ? {type: 'embedded', module, account_id: e.account_id } : {},
|
|
1234
1334
|
};
|
|
1235
1335
|
} else if (this.state.channel.toLowerCase() === 'wechat') {
|
|
1236
1336
|
if (e.template_type && e.template_type === 'RICHMEDIA_WECHAT_TEMPLATE') {
|
|
@@ -1247,7 +1347,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1247
1347
|
} else if (this.state.channel.toLowerCase() === 'line') {
|
|
1248
1348
|
routeParams = {
|
|
1249
1349
|
pathname: `/line/view/${e.msg_type}/`,
|
|
1250
|
-
query: type === 'embedded' ? {type: 'embedded', module, account_id: e.account_id
|
|
1350
|
+
query: type === 'embedded' ? {type: 'embedded', module, account_id: e.account_id} : {},
|
|
1251
1351
|
};
|
|
1252
1352
|
}
|
|
1253
1353
|
this.setState({loading: true, routeParams});
|
|
@@ -1551,22 +1651,38 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1551
1651
|
}
|
|
1552
1652
|
}
|
|
1553
1653
|
|
|
1554
|
-
searchTemplate(data) {
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1654
|
+
searchTemplate(data, channel) {
|
|
1655
|
+
if (channel.toLowerCase() === ZALO_LOWERCASE) {
|
|
1656
|
+
if (data) {
|
|
1657
|
+
this.setState({
|
|
1658
|
+
searchingZaloTemplate: true,
|
|
1659
|
+
searchedZaloTemplates: this.props.TemplatesList.filter((zalo) => zalo?.name?.toLowerCase().includes(data?.toLowerCase())),
|
|
1660
|
+
searchText: data,
|
|
1661
|
+
});
|
|
1662
|
+
} else {
|
|
1663
|
+
this.setState({
|
|
1664
|
+
searchingZaloTemplate: false,
|
|
1665
|
+
searchedZaloTemplates: [],
|
|
1666
|
+
searchText: data,
|
|
1667
|
+
});
|
|
1567
1668
|
}
|
|
1568
|
-
|
|
1569
|
-
|
|
1669
|
+
} else {
|
|
1670
|
+
this.setState({ searchText: data }, () => {
|
|
1671
|
+
const params = {
|
|
1672
|
+
name: this.state.searchText,
|
|
1673
|
+
sortBy: this.state.sortBy,
|
|
1674
|
+
};
|
|
1675
|
+
if (this.state.channel.toLowerCase() === WECHAT_LOWERCASE) {
|
|
1676
|
+
params.wecrmId = this.props.Templates.selectedWeChatAccount.configs.wecrm_app_id;
|
|
1677
|
+
params.wecrmToken = this.props.Templates.selectedWeChatAccount.configs.wecrm_token;
|
|
1678
|
+
params.originalId = this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier;
|
|
1679
|
+
}
|
|
1680
|
+
if (this.state.channel.toLowerCase() === MOBILE_PUSH_LOWERCASE) {
|
|
1681
|
+
params.accountId = this.props.Templates.selectedWeChatAccount.id;
|
|
1682
|
+
}
|
|
1683
|
+
this.getAllTemplates({params, resetPage: true});
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1570
1686
|
}
|
|
1571
1687
|
|
|
1572
1688
|
handleSortBy(data) {
|
|
@@ -1767,6 +1883,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1767
1883
|
pathName = `/rcs/edit/${id}/`;
|
|
1768
1884
|
break;
|
|
1769
1885
|
}
|
|
1886
|
+
case ZALO: {
|
|
1887
|
+
pathName = `/zalo/edit/${id}/`;
|
|
1888
|
+
break;
|
|
1889
|
+
}
|
|
1770
1890
|
default:
|
|
1771
1891
|
break;
|
|
1772
1892
|
}
|
|
@@ -1791,24 +1911,48 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1791
1911
|
selectTemplate = (id) => find(this.props.TemplatesList, {_id: id})
|
|
1792
1912
|
|
|
1793
1913
|
handlePreviewClick(template, modeType) {
|
|
1794
|
-
this.
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
this.
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
this.
|
|
1914
|
+
if (this.state.channel.toLowerCase() !== ZALO_LOWERCASE) {
|
|
1915
|
+
this.togglePreview();
|
|
1916
|
+
const templateInfo = cloneDeep(template);
|
|
1917
|
+
if (this.state.channel.toLowerCase() === "line") {
|
|
1918
|
+
templateInfo.modeType = modeType;
|
|
1919
|
+
}
|
|
1920
|
+
templateInfo.updatedByName = commonUtil.getUserNameById(
|
|
1921
|
+
parseInt(template.updatedBy, 10),
|
|
1922
|
+
commonUtil.getMergedUserList(this.props.Templates.userList)
|
|
1923
|
+
);
|
|
1924
|
+
if (this.state.channel === "wechat") {
|
|
1925
|
+
templateInfo.content = this.prepareWeChatPreviewData(template);
|
|
1926
|
+
} else if (this.state.channel.toLowerCase() === "mobilepush") {
|
|
1927
|
+
templateInfo.content = template.versions.base;
|
|
1928
|
+
templateInfo.appName = this.props.Templates.selectedWeChatAccount.name;
|
|
1929
|
+
} else if (this.state.channel.toLowerCase() === "email") {
|
|
1930
|
+
this.props.actions.getTemplateDetails(template._id);
|
|
1931
|
+
} else if (this.state.channel.toLowerCase() === "ebill") {
|
|
1932
|
+
this.props.actions.getTemplateDetails(template._id);
|
|
1933
|
+
}
|
|
1934
|
+
if (this.state.channel.toLowerCase() !== "ebill") {
|
|
1935
|
+
this.setState({ previewTemplate: templateInfo });
|
|
1936
|
+
}
|
|
1937
|
+
} else {
|
|
1938
|
+
const {
|
|
1939
|
+
Templates: {
|
|
1940
|
+
weCrmAccounts: [
|
|
1941
|
+
{
|
|
1942
|
+
name,
|
|
1943
|
+
sourceAccountIdentifier,
|
|
1944
|
+
configs: { token },
|
|
1945
|
+
},
|
|
1946
|
+
],
|
|
1947
|
+
},
|
|
1948
|
+
} = this.props;
|
|
1949
|
+
this.props.zaloActions.getTemplateInfoById({
|
|
1950
|
+
username: name,
|
|
1951
|
+
oa_id: sourceAccountIdentifier,
|
|
1952
|
+
token: token,
|
|
1953
|
+
id: template?._id,
|
|
1954
|
+
preview: true,
|
|
1955
|
+
});
|
|
1812
1956
|
}
|
|
1813
1957
|
}
|
|
1814
1958
|
|
|
@@ -2090,6 +2234,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2090
2234
|
this.props.Templates?.senderDetails?.status === "REQUEST"
|
|
2091
2235
|
) &&
|
|
2092
2236
|
this.state.channel.toLowerCase() === WHATSAPP_LOWERCASE;
|
|
2237
|
+
const zaloLoader =
|
|
2238
|
+
(
|
|
2239
|
+
(this.state.selectedAccount !== "" && getAllTemplatesInProgress) ||
|
|
2240
|
+
fetchingWeCrmAccounts ) &&
|
|
2241
|
+
this.state.channel.toLowerCase() === ZALO_LOWERCASE;
|
|
2093
2242
|
const mobilePushLoader = (((getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'mobilepush');
|
|
2094
2243
|
const emailLoader = (
|
|
2095
2244
|
(getAllTemplatesInProgress ||
|
|
@@ -2099,6 +2248,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2099
2248
|
const ebillLoader = ((getAllTemplatesInProgress || sendingFile) && this.state.channel.toLowerCase() === 'ebill');
|
|
2100
2249
|
const isLoading = ((wechatLoader !== undefined) ? wechatLoader : false) ||
|
|
2101
2250
|
(whatsappLoader !== undefined ? whatsappLoader : false) ||
|
|
2251
|
+
(zaloLoader !== undefined ? zaloLoader : false) ||
|
|
2102
2252
|
(smsLoader !== undefined ? smsLoader : false) ||
|
|
2103
2253
|
(emailLoader !== undefined ? emailLoader : false) ||
|
|
2104
2254
|
(ebillLoader !== undefined ? ebillLoader : false) ||
|
|
@@ -2155,6 +2305,15 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2155
2305
|
descriptionPosition: 'bottom',
|
|
2156
2306
|
descriptionClassName: 'illustration-desc rcs-illustration',
|
|
2157
2307
|
};
|
|
2308
|
+
case ZALO:
|
|
2309
|
+
return {
|
|
2310
|
+
illustrationImage: zaloillustration,
|
|
2311
|
+
title: <FormattedMessage {...messages.zaloTitleIllustration} />,
|
|
2312
|
+
description: <FormattedMessage {...messages.zaloDescIllustration} />,
|
|
2313
|
+
descriptionPosition: 'bottom',
|
|
2314
|
+
descriptionClassName: 'illustration-desc zalo-illustration',
|
|
2315
|
+
buttonClassName: "zalo-illustration-button",
|
|
2316
|
+
};
|
|
2158
2317
|
default:
|
|
2159
2318
|
return {};
|
|
2160
2319
|
}
|
|
@@ -2283,6 +2442,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2283
2442
|
noAccountHeader = messages.noAccountsPresentWhatsapp;
|
|
2284
2443
|
break;
|
|
2285
2444
|
}
|
|
2445
|
+
case ZALO: {
|
|
2446
|
+
accountHeader = formatMessage(messages.zaloAccount);
|
|
2447
|
+
noAccountHeader = messages.noAccountsPresentZalo;
|
|
2448
|
+
break;
|
|
2449
|
+
}
|
|
2286
2450
|
default:
|
|
2287
2451
|
break;
|
|
2288
2452
|
}
|
|
@@ -2325,7 +2489,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2325
2489
|
selected={selectedAccount}
|
|
2326
2490
|
/>
|
|
2327
2491
|
</div>
|
|
2328
|
-
|
|
2492
|
+
}
|
|
2329
2493
|
</CapSpin>);
|
|
2330
2494
|
};
|
|
2331
2495
|
|
|
@@ -2352,6 +2516,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2352
2516
|
[MOBILE_PUSH]: 'mobilepushAccount',
|
|
2353
2517
|
[WECHAT]: 'wechatAccount',
|
|
2354
2518
|
[WHATSAPP]: 'whatsappAccount',
|
|
2519
|
+
[ZALO]: 'zaloAccount',
|
|
2355
2520
|
};
|
|
2356
2521
|
return formatMessage(messages[channelObj[channel?.toUpperCase()]]);
|
|
2357
2522
|
}
|
|
@@ -2381,8 +2546,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2381
2546
|
}
|
|
2382
2547
|
}
|
|
2383
2548
|
|
|
2549
|
+
removeZaloFilter = () => this.setState({ selectedZaloStatus: null });
|
|
2550
|
+
|
|
2384
2551
|
selectedFilters = () => {
|
|
2385
|
-
const { selectedWhatsappStatus, selectedWhatsappCategory } = this.state;
|
|
2552
|
+
const { selectedWhatsappStatus, selectedWhatsappCategory, selectedZaloStatus } = this.state;
|
|
2386
2553
|
const {
|
|
2387
2554
|
intl: {
|
|
2388
2555
|
formatMessage,
|
|
@@ -2415,6 +2582,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2415
2582
|
/>
|
|
2416
2583
|
) : null
|
|
2417
2584
|
}
|
|
2585
|
+
{
|
|
2586
|
+
selectedZaloStatus ? (
|
|
2587
|
+
<CapTag closable onClose={() => this.removeZaloFilter(WHATSAPP_STATUS)}>
|
|
2588
|
+
{formatMessage(messages.status)}: {formatMessage(zaloMessages[`${selectedZaloStatus}_STATUS`])}
|
|
2589
|
+
</CapTag>
|
|
2590
|
+
) : null
|
|
2591
|
+
}
|
|
2418
2592
|
</CapRow>
|
|
2419
2593
|
);
|
|
2420
2594
|
}
|
|
@@ -2424,6 +2598,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2424
2598
|
setWhatsappCategory = (value) => this.setState({selectedWhatsappCategory: value?.item?.props?.value});
|
|
2425
2599
|
setLineFilter = (e) => this.setState({lineFilter: e.target.value});
|
|
2426
2600
|
setSMSFilter = (e) => this.setState({smsFilter: e.target.value});
|
|
2601
|
+
setZaloStatus = (value) => this.setState({selectedZaloStatus: value?.item?.props?.value});
|
|
2427
2602
|
|
|
2428
2603
|
openCreativesFullMode = () => {
|
|
2429
2604
|
window.open(`/creatives/ui/v2?channel=${WHATSAPP_LOWERCASE}&mode=${CREATE}`, "_blank");
|
|
@@ -2511,7 +2686,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2511
2686
|
className="create-new-link"
|
|
2512
2687
|
/>
|
|
2513
2688
|
)
|
|
2514
|
-
|
|
2689
|
+
: this.state.channel.toLowerCase() === ZALO_LOWERCASE ? <></> : (
|
|
2515
2690
|
<CapButton
|
|
2516
2691
|
className={`create-new-${channelLowerCase} margin-l-8 margin-b-12`}
|
|
2517
2692
|
type={"primary"}
|
|
@@ -2532,11 +2707,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2532
2707
|
style={{width: '210px'}}
|
|
2533
2708
|
placeholder={this.props.intl.formatMessage(messages.searchText)}
|
|
2534
2709
|
value={this.state.searchText}
|
|
2535
|
-
onChange={(e) => this.searchTemplate(e.target.value)}
|
|
2710
|
+
onChange={(e) => this.searchTemplate(e.target.value, this.state.channel)}
|
|
2536
2711
|
disabled={this.checkSearchDisabled()}
|
|
2537
|
-
onClear={() => this.searchTemplate('')}
|
|
2712
|
+
onClear={() => this.searchTemplate('', this.state.channel)}
|
|
2538
2713
|
onScroll={(e) => e.stopPropagation()}
|
|
2539
|
-
|
|
2714
|
+
/>}
|
|
2540
2715
|
{
|
|
2541
2716
|
channel.toUpperCase() === WECHAT && <CapRadio.CapRadioGroup className="wechat-filters" defaultValue={wechatFilter} onChange={this.setWechatFilter}>
|
|
2542
2717
|
<CapRadio.Button value={WECHAT_FILTERS.ALL}><CapLabel type="label2">
|
|
@@ -2551,37 +2726,56 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2551
2726
|
</CapRadio.CapRadioGroup>
|
|
2552
2727
|
}
|
|
2553
2728
|
{
|
|
2554
|
-
channel.toUpperCase() ===
|
|
2555
|
-
<div className="
|
|
2729
|
+
channel.toUpperCase() === ZALO && (
|
|
2730
|
+
<div className="zalo-filters">
|
|
2556
2731
|
{
|
|
2557
2732
|
this.props.isFullMode ? (
|
|
2558
2733
|
<CapSelectFilter
|
|
2559
2734
|
placement="bottomLeft"
|
|
2560
|
-
data={
|
|
2561
|
-
onSelect={this.
|
|
2562
|
-
selectedValue={this.state.
|
|
2735
|
+
data={ZALO_STATUS_OPTIONS}
|
|
2736
|
+
onSelect={this.setZaloStatus}
|
|
2737
|
+
selectedValue={this.state.selectedZaloStatus}
|
|
2563
2738
|
placeholder="Status"
|
|
2564
|
-
showBadge
|
|
2565
2739
|
width="90px"
|
|
2566
2740
|
/>
|
|
2567
2741
|
) : null
|
|
2568
2742
|
}
|
|
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
2743
|
</div>
|
|
2582
2744
|
|
|
2583
2745
|
)
|
|
2584
2746
|
}
|
|
2747
|
+
{
|
|
2748
|
+
channel.toUpperCase() === WHATSAPP && (
|
|
2749
|
+
<div className="whatsapp-filters">
|
|
2750
|
+
{
|
|
2751
|
+
this.props.isFullMode ? (
|
|
2752
|
+
<CapSelectFilter
|
|
2753
|
+
placement="bottomLeft"
|
|
2754
|
+
data={STATUS_OPTIONS}
|
|
2755
|
+
onSelect={this.setWhatsappStatus}
|
|
2756
|
+
selectedValue={this.state.selectedWhatsappStatus}
|
|
2757
|
+
placeholder="Status"
|
|
2758
|
+
showBadge
|
|
2759
|
+
width="90px"
|
|
2760
|
+
/>
|
|
2761
|
+
) : null
|
|
2762
|
+
}
|
|
2763
|
+
<CapSelectFilter
|
|
2764
|
+
placement="bottomLeft"
|
|
2765
|
+
data={this.state.hostName === HOST_TWILIO
|
|
2766
|
+
? TWILIO_CATEGORY_OPTIONS
|
|
2767
|
+
: KARIX_GUPSHUP_CATEGORY_OPTIONS}
|
|
2768
|
+
onSelect={this.setWhatsappCategory}
|
|
2769
|
+
selectedValue={this.state.selectedWhatsappCategory}
|
|
2770
|
+
placeholder="Category"
|
|
2771
|
+
showBadge
|
|
2772
|
+
width="105px"
|
|
2773
|
+
overlayStyle={{ overflowY: "hidden" }}
|
|
2774
|
+
/>
|
|
2775
|
+
</div>
|
|
2776
|
+
|
|
2777
|
+
)
|
|
2778
|
+
}
|
|
2585
2779
|
{
|
|
2586
2780
|
channel.toUpperCase() === LINE &&
|
|
2587
2781
|
isFullMode
|
|
@@ -2685,6 +2879,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2685
2879
|
(this.props.EmailCreate.duplicateTemplateInProgress && 'duplicatingTemplate');
|
|
2686
2880
|
|
|
2687
2881
|
const loadingTip = messages[loadingTipIntl] ? this.props.intl.formatMessage(messages[loadingTipIntl]) : this.props.intl.formatMessage(messages.gettingAllTemplates);
|
|
2882
|
+
const showNoTemplatesFoundZalo = this.state.channel.toUpperCase() === ZALO && isEmpty(this.state.searchedZaloTemplates) && this.state.searchingZaloTemplate;
|
|
2883
|
+
const showNoTemplatesFoundOther = ![ZALO].includes(this.state.channel.toUpperCase()) && isEmpty(this.props.TemplatesList) && !this.props.Templates.getAllTemplatesInProgress && !isEmpty(this.state.searchText);
|
|
2884
|
+
const showNoTemplatesFound = showNoTemplatesFoundZalo || showNoTemplatesFoundOther;
|
|
2688
2885
|
|
|
2689
2886
|
return (
|
|
2690
2887
|
<>
|
|
@@ -2704,11 +2901,17 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2704
2901
|
) : null
|
|
2705
2902
|
}
|
|
2706
2903
|
|
|
2904
|
+
{
|
|
2905
|
+
channel.toLowerCase() === ZALO_LOWERCASE && !isFullMode ? (
|
|
2906
|
+
<CapInfoNote message={formatMessage(messages.zaloOnlyApprovedTemplates)} />
|
|
2907
|
+
) : null
|
|
2908
|
+
}
|
|
2909
|
+
|
|
2707
2910
|
<CapRow>
|
|
2708
2911
|
<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}})}
|
|
2912
|
+
{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
2913
|
</Pagination>
|
|
2711
|
-
{
|
|
2914
|
+
{showNoTemplatesFound &&
|
|
2712
2915
|
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
2713
2916
|
<CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesFound)}</CapHeading>
|
|
2714
2917
|
</div>}
|
|
@@ -2730,7 +2933,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2730
2933
|
selectedWeChatAccount={get(this.props, 'Templates.selectedWeChatAccount', {})}
|
|
2731
2934
|
selectedAccount={this.state.selectedAccount}
|
|
2732
2935
|
/>
|
|
2733
|
-
|
|
2936
|
+
}
|
|
2734
2937
|
</CapRow>
|
|
2735
2938
|
<CapRow>
|
|
2736
2939
|
|
|
@@ -2789,6 +2992,7 @@ Templates.propTypes = {
|
|
|
2789
2992
|
facebookActions: PropTypes.object,
|
|
2790
2993
|
whatsappActions: PropTypes.object,
|
|
2791
2994
|
rcsActions: PropTypes.object,
|
|
2995
|
+
zaloActions: PropTypes.object,
|
|
2792
2996
|
smsRegister: PropTypes.any,
|
|
2793
2997
|
isDltFromRcs: PropTypes.bool,
|
|
2794
2998
|
};
|
|
@@ -2804,6 +3008,7 @@ const mapStateToProps = createStructuredSelector({
|
|
|
2804
3008
|
Global: makeSelectAuthenticated(),
|
|
2805
3009
|
Line: makeSelectLine(),
|
|
2806
3010
|
Viber: makeSelectViber(),
|
|
3011
|
+
Zalo: makeSelectZalo(),
|
|
2807
3012
|
});
|
|
2808
3013
|
|
|
2809
3014
|
function mapDispatchToProps(dispatch) {
|
|
@@ -2820,6 +3025,7 @@ function mapDispatchToProps(dispatch) {
|
|
|
2820
3025
|
facebookActions: bindActionCreators(facebookActions, dispatch),
|
|
2821
3026
|
whatsappActions: bindActionCreators(whatsappActions, dispatch),
|
|
2822
3027
|
rcsActions: bindActionCreators(rcsActions, dispatch),
|
|
3028
|
+
zaloActions: bindActionCreators(zaloActions, dispatch),
|
|
2823
3029
|
};
|
|
2824
3030
|
}
|
|
2825
3031
|
|