@capillarytech/creatives-library 7.10.58 → 7.10.59
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/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +0 -2
- package/containers/Email/index.js +2 -3
- package/index.js +0 -6
- package/package.json +1 -1
- package/routes.js +0 -5
- package/services/api.js +1 -6
- package/utils/v2common.js +0 -13
- package/v2Components/TemplatePreview/_templatePreview.scss +2 -24
- package/v2Components/TemplatePreview/index.js +8 -89
- package/v2Components/TemplatePreview/messages.js +0 -12
- package/v2Containers/App/constants.js +1 -4
- package/v2Containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +0 -2
- package/v2Containers/Cap/messages.js +1 -12
- package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -42
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +14 -55
- package/v2Containers/CreativesContainer/constants.js +0 -1
- package/v2Containers/CreativesContainer/index.js +4 -93
- package/v2Containers/CreativesContainer/messages.js +0 -8
- package/v2Containers/Email/index.js +1 -3
- package/v2Containers/Line/Container/index.js +1 -1
- package/v2Containers/Templates/_templates.scss +0 -64
- package/v2Containers/Templates/actions.js +10 -12
- package/v2Containers/Templates/constants.js +1 -3
- package/v2Containers/Templates/index.js +72 -419
- package/v2Containers/Templates/messages.js +2 -58
- package/v2Containers/Templates/reducer.js +1 -3
- package/v2Containers/TemplatesV2/index.js +0 -17
- package/v2Containers/TemplatesV2/messages.js +0 -4
|
@@ -22,31 +22,7 @@ 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 {
|
|
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';
|
|
25
|
+
import {CapMenu, CapDropdown, CapButton, CapInput, CapIcon, CapRadioCard, CapPopover, CapSpin, CapCustomCard, CapRow, CapSlideBox, CapLink, CapHeading, CapNotification, CapIllustration, CapHeader, CapLabel, CapRadio} from '@capillarytech/cap-ui-library';
|
|
50
26
|
import { makeSelectTemplates, makeSelectTemplatesResponse } from './selectors';
|
|
51
27
|
import { makeSelectCreate as makeSelectCreateSms} from '../Sms/Create/selectors';
|
|
52
28
|
import { makeSelectCreate as makeSelectCreateMobilePush } from '../MobilePush/Create/selectors';
|
|
@@ -56,7 +32,6 @@ import { makeSelectEdit } from '../Sms/Edit/selectors';
|
|
|
56
32
|
import { makeSelectLine } from '../Line/Container/selectors';
|
|
57
33
|
import { makeSelectViber } from '../Viber/selectors';
|
|
58
34
|
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
59
|
-
import { getObjFromQueryParams } from '../../utils/v2common';
|
|
60
35
|
import messages from './messages';
|
|
61
36
|
import {checkUnicode} from '../../utils/smsCharCountV2';
|
|
62
37
|
import * as actions from './actions';
|
|
@@ -68,7 +43,7 @@ import * as emailActions from '../Email/actions';
|
|
|
68
43
|
import * as lineActions from '../Line/Container/actions';
|
|
69
44
|
import * as viberActions from '../Viber/actions';
|
|
70
45
|
import * as facebookActions from '../Facebook/actions';
|
|
71
|
-
|
|
46
|
+
|
|
72
47
|
import CardGrid from '../../v2Components/CardGrid';
|
|
73
48
|
import config from '../../config/app';
|
|
74
49
|
import './_templates.scss';
|
|
@@ -78,33 +53,21 @@ import * as commonUtil from '../../utils/common';
|
|
|
78
53
|
import Pagination from '../../v2Components/Pagination';
|
|
79
54
|
import EmailPreview from '../../v2Components/EmailPreview';
|
|
80
55
|
import CreativesContainer from '../CreativesContainer';
|
|
81
|
-
import WhatsappStatusContainer from '../../v2Components/WhatsappStatusContainer';
|
|
82
56
|
import WechatRichmediaTemplatePreview from '../../v2Components/TemplatePreview/WechatRichmediaTemplatePreview';
|
|
83
57
|
import {
|
|
84
58
|
CHANNEL_CREATE_TRACK_MAPPING,
|
|
85
59
|
CHANNEL_EDIT_TRACK_MAPPING,
|
|
86
60
|
VIBER as VIBER_CHANNEL,
|
|
87
61
|
FACEBOOK as FACEBOOK_CHANNEL,
|
|
88
|
-
CREATE,
|
|
89
62
|
} from '../App/constants';
|
|
90
|
-
import {
|
|
91
|
-
import {
|
|
92
|
-
CATEGORY_OPTIONS,
|
|
93
|
-
STATUS_OPTIONS,
|
|
94
|
-
CATEGORY as WHATSAPP_CATEGORY,
|
|
95
|
-
STATUS as WHATSAPP_STATUS,
|
|
96
|
-
WHATSAPP_STATUSES,
|
|
97
|
-
} from '../Whatsapp/constants';
|
|
98
|
-
import { getWhatsappContent, getWhatsappStatus, getWhatsappCategory } from '../Whatsapp/utils';
|
|
99
|
-
import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER, FACEBOOK, WHATSAPP } from '../CreativesContainer/constants';
|
|
63
|
+
import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER, FACEBOOK } from '../CreativesContainer/constants';
|
|
100
64
|
|
|
101
65
|
import {CREATIVE} from '../Facebook/constants';
|
|
102
66
|
|
|
103
67
|
import emailIllustration from '../Assets/images/emailIllustration.svg';
|
|
104
68
|
import smsIllustration from '../Assets/images/smsIllustration.svg';
|
|
105
69
|
import pushIllustration from '../Assets/images/pushIllustration.svg';
|
|
106
|
-
import
|
|
107
|
-
import { CAP_SPACE_16, CAP_SPACE_44 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
70
|
+
import { CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
108
71
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
109
72
|
const { timeTracker } = GA;
|
|
110
73
|
const {CapCustomCardList} = CapCustomCard;
|
|
@@ -142,11 +105,6 @@ const SMS_FILTERS = {
|
|
|
142
105
|
SERVICE_IMPLICIT: 'implicit',
|
|
143
106
|
};
|
|
144
107
|
|
|
145
|
-
const WHATSAPP_LOWERCASE = WHATSAPP.toLowerCase();
|
|
146
|
-
const SMS_LOWERCASE = SMS.toLowerCase();
|
|
147
|
-
const MOBILE_PUSH_LOWERCASE = MOBILE_PUSH.toLowerCase();
|
|
148
|
-
const EBILL_LOWERCASE = EBILL.toLowerCase();
|
|
149
|
-
const LINE_LOWERCASE = LINE.toLowerCase();
|
|
150
108
|
export class Templates extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
151
109
|
constructor(props) {
|
|
152
110
|
super(props);
|
|
@@ -175,8 +133,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
175
133
|
wechatFilter: WECHAT_FILTERS.ALL,
|
|
176
134
|
lineFilter: LINE_FILTERS.ALL,
|
|
177
135
|
smsFilter: SMS_FILTERS.ALL,
|
|
178
|
-
selectedWhatsappStatus: '',
|
|
179
|
-
selectedWhatsappCategory: ''
|
|
180
136
|
};
|
|
181
137
|
|
|
182
138
|
this.handleOnHoverItem = this.handleOnHoverItem.bind(this);
|
|
@@ -242,11 +198,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
242
198
|
activeMode = ACCOUNT_SELECTION_MODE;
|
|
243
199
|
this.props.actions.getAccountsSettings();
|
|
244
200
|
break;
|
|
245
|
-
case WHATSAPP:
|
|
246
|
-
channel = 'Whatsapp';
|
|
247
|
-
activeMode = ACCOUNT_SELECTION_MODE;
|
|
248
|
-
this.props.actions.getWeCrmAccounts(channel);
|
|
249
|
-
break;
|
|
250
201
|
default:
|
|
251
202
|
channel = '';
|
|
252
203
|
}
|
|
@@ -267,13 +218,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
267
218
|
if (this.props.location.query.type === 'embedded' && this.isEnabledInLibraryModule("setLocale")) {
|
|
268
219
|
this.setLocale();
|
|
269
220
|
}
|
|
270
|
-
|
|
271
|
-
// opening the create slidebox based on query params
|
|
272
|
-
const queryItems = getObjFromQueryParams(location.search);
|
|
273
|
-
if (queryItems.channel === WHATSAPP_LOWERCASE && queryItems.mode === CREATE) {
|
|
274
|
-
this.createTemplate();
|
|
275
|
-
}
|
|
276
|
-
|
|
277
221
|
if (this.props.location.query.type === 'embedded') {
|
|
278
222
|
this.props.actions.resetAccount();
|
|
279
223
|
}
|
|
@@ -301,8 +245,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
301
245
|
};
|
|
302
246
|
const { totalCount: nextPropsTotalTemplatesCount } = nextProps?.TemplatesList?.[0] || {};
|
|
303
247
|
const { totalCount: propsTotalTemplatesCount } = this.props?.TemplatesList?.[0] || {};
|
|
248
|
+
const { templatesCount } = this.state || {};
|
|
304
249
|
|
|
305
|
-
if (nextPropsTotalTemplatesCount && nextPropsTotalTemplatesCount !== propsTotalTemplatesCount) {
|
|
250
|
+
if (nextPropsTotalTemplatesCount && nextPropsTotalTemplatesCount !== propsTotalTemplatesCount && templatesCount === 0) {
|
|
306
251
|
this.setState({ templatesCount: nextPropsTotalTemplatesCount });
|
|
307
252
|
}
|
|
308
253
|
if (!isEqual(nextProps.route.name, this.props.route.name)) {
|
|
@@ -464,31 +409,20 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
464
409
|
if ((this.state.channel || '').toLowerCase() !== "sms") {
|
|
465
410
|
CapNotification.error({key: 'somethingWrong', message});
|
|
466
411
|
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
case VIBER_CHANNEL:
|
|
482
|
-
viberActions.clearCreateResponse();
|
|
483
|
-
break;
|
|
484
|
-
case FACEBOOK_CHANNEL:
|
|
485
|
-
facebookActions.clearCreateResponse();
|
|
486
|
-
break;
|
|
487
|
-
case WHATSAPP_LOWERCASE:
|
|
488
|
-
whatsappActions.clearCreateResponse();
|
|
489
|
-
break;
|
|
490
|
-
default:
|
|
491
|
-
break;
|
|
412
|
+
if ( this.state.channel) {
|
|
413
|
+
if (this.state.channel.toLowerCase() === "sms") {
|
|
414
|
+
this.props.smsActions.clearCreateResponse();
|
|
415
|
+
} else if (this.state.channel.toLowerCase() === "mobilepush") {
|
|
416
|
+
this.props.mobilepushActions.clearCreateResponse();
|
|
417
|
+
} else if (this.state.channel.toLowerCase() === "ebill") {
|
|
418
|
+
this.props.ebillActions.clearCreateResponse();
|
|
419
|
+
} else if (this.state.channel.toLowerCase() === "line") {
|
|
420
|
+
this.props.lineActions.clearCreateResponse();
|
|
421
|
+
} else if (this.state.channel.toLowerCase() === VIBER_CHANNEL) {
|
|
422
|
+
this.props.viberActions.clearCreateResponse();
|
|
423
|
+
} else if (this.state.channel.toLowerCase() === FACEBOOK_CHANNEL) {
|
|
424
|
+
this.props.facebookActions.clearCreateResponse();
|
|
425
|
+
}
|
|
492
426
|
}
|
|
493
427
|
}
|
|
494
428
|
|
|
@@ -529,25 +463,16 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
529
463
|
this.setState({previewTemplate: nextProps.Templates.templateDetails});
|
|
530
464
|
}
|
|
531
465
|
|
|
532
|
-
if (nextProps.Templates.weCrmAccounts !== undefined && nextProps.Templates.weCrmAccounts.length === 1 && this.state.defaultAccount && (['wechat'
|
|
466
|
+
if (nextProps.Templates.weCrmAccounts !== undefined && nextProps.Templates.weCrmAccounts.length === 1 && this.state.defaultAccount && (['wechat'].indexOf(this.state.channel.toLowerCase()) > -1)) {
|
|
533
467
|
const paramsDefault = {
|
|
534
468
|
name: this.state.searchText,
|
|
535
469
|
sortBy: this.state.sortBy,
|
|
536
470
|
};
|
|
537
|
-
if (
|
|
471
|
+
if (this.state.channel.toLowerCase() === 'wechat') {
|
|
538
472
|
paramsDefault.wecrmId = nextProps.Templates.weCrmAccounts[0].configs.wecrm_app_id;
|
|
539
473
|
paramsDefault.wecrmToken = nextProps.Templates.weCrmAccounts[0].configs.wecrm_token;
|
|
540
474
|
paramsDefault.originalId = nextProps.Templates.weCrmAccounts[0].sourceAccountIdentifier;
|
|
541
|
-
|
|
542
|
-
nextProps.actions.setChannelAccount(
|
|
543
|
-
WHATSAPP,
|
|
544
|
-
nextProps.Templates.weCrmAccounts[0],
|
|
545
|
-
);
|
|
546
|
-
} else {
|
|
547
|
-
nextProps.actions.setWeChatAccount(
|
|
548
|
-
nextProps.Templates.weCrmAccounts[0],
|
|
549
|
-
);
|
|
550
|
-
}
|
|
475
|
+
nextProps.actions.setWeChatAccount(nextProps.Templates.weCrmAccounts[0]);
|
|
551
476
|
}
|
|
552
477
|
this.setState({defaultAccount: false, activeMode: TEMPLATES_MODE, selectedAccount: nextProps.Templates.weCrmAccounts[0].name });
|
|
553
478
|
this.getAllTemplates({params: paramsDefault}, true);
|
|
@@ -587,10 +512,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
587
512
|
} else {
|
|
588
513
|
this.setState({selectedAccountError: false});
|
|
589
514
|
}
|
|
590
|
-
} else if (this.state.channel.toLowerCase() ===
|
|
591
|
-
this.props.actions.
|
|
592
|
-
} else if (this.state.channel.toLowerCase() === WHATSAPP_LOWERCASE) {
|
|
593
|
-
this.props.actions.setChannelAccount(WHATSAPP, this.props.Templates.weCrmAccounts.find((item) => item.name === this.state.selectedAccount));
|
|
515
|
+
} else if (this.state.channel.toLowerCase() === 'line') {
|
|
516
|
+
this.props.actions.setLineAccount(this.props.Templates.weCrmAccounts.find((item) => item.name === this.state.selectedAccount));
|
|
594
517
|
}
|
|
595
518
|
|
|
596
519
|
this.setState({activeMode: TEMPLATES_MODE});
|
|
@@ -603,7 +526,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
603
526
|
}
|
|
604
527
|
onCreateComplete = (isReloadTemplates) => {
|
|
605
528
|
this.setState({routeParams: null, previewOpen: false}, () => {
|
|
606
|
-
if (this.isFullMode() &&
|
|
529
|
+
if (this.isFullMode() && isReloadTemplates) {
|
|
607
530
|
this.getAllTemplates({params: {}}, true);
|
|
608
531
|
}
|
|
609
532
|
});
|
|
@@ -623,7 +546,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
623
546
|
const { pathname } = routeParams;
|
|
624
547
|
if (pathname.includes('create')) {
|
|
625
548
|
creativesParams.mode = 'create';
|
|
626
|
-
} else if (pathname.includes('edit')
|
|
549
|
+
} else if (pathname.includes('edit')) {
|
|
627
550
|
creativesParams.mode = 'edit';
|
|
628
551
|
if (pathname.includes('richmedia')) {
|
|
629
552
|
creativesParams._id = pathname.split('/')[4];
|
|
@@ -634,12 +557,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
634
557
|
creativesParams._id = pathname.split('/')[3];
|
|
635
558
|
creativesParams.modeType = pathname.split('/')[4];
|
|
636
559
|
creativesParams.account = pathname.split('/')[5];
|
|
637
|
-
if (this.state.channel.toLowerCase() === WHATSAPP_LOWERCASE) {
|
|
638
|
-
const whatsappSelectedTemplateData = this.selectTemplate(creativesParams._id) || {};
|
|
639
|
-
const { name = '', versions = {} } = whatsappSelectedTemplateData;
|
|
640
|
-
creativesParams.whatsappTemplateName = name;
|
|
641
|
-
creativesParams.whatsappTemplateCategory = get(versions, `base.content.whatsapp.category`, '');
|
|
642
|
-
}
|
|
643
560
|
}
|
|
644
561
|
creativesParams.type = this.state.channel.toUpperCase();
|
|
645
562
|
}
|
|
@@ -737,36 +654,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
737
654
|
return templates;
|
|
738
655
|
}
|
|
739
656
|
}
|
|
740
|
-
|
|
741
|
-
isStatusMatching = (status, selectedWhatsappStatus) => {
|
|
742
|
-
if(this.props.isFullMode && selectedWhatsappStatus) {
|
|
743
|
-
if ( [WHATSAPP_STATUSES.unsubmitted, WHATSAPP_STATUSES.pending].includes(status) ) {
|
|
744
|
-
return selectedWhatsappStatus === WHATSAPP_STATUSES.awaitingApproval;
|
|
745
|
-
}
|
|
746
|
-
return selectedWhatsappStatus === status;
|
|
747
|
-
}
|
|
748
|
-
else if (!this.props.isFullMode){
|
|
749
|
-
return status === WHATSAPP_STATUSES.approved;
|
|
750
|
-
}
|
|
751
|
-
return true;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
filterWhatsappTemplates = (templates) => {
|
|
755
|
-
const { selectedWhatsappStatus, selectedWhatsappCategory } = this.state;
|
|
756
|
-
return templates.filter((template) => {
|
|
757
|
-
const { [WHATSAPP_CATEGORY]: category, [WHATSAPP_STATUS]: status } = template?.versions?.base?.content?.[WHATSAPP_LOWERCASE] || {};
|
|
758
|
-
|
|
759
|
-
// if status or category filter is applied, filter templates which match these filters
|
|
760
|
-
return (
|
|
761
|
-
this.isStatusMatching(status, selectedWhatsappStatus)
|
|
762
|
-
) && (
|
|
763
|
-
selectedWhatsappCategory
|
|
764
|
-
? category === selectedWhatsappCategory
|
|
765
|
-
: true
|
|
766
|
-
);
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
|
|
770
657
|
filterSMSTemplates = (templates) => {
|
|
771
658
|
const { smsFilter } = this.state;
|
|
772
659
|
if (SMS_FILTERS.ALL === smsFilter) {
|
|
@@ -775,44 +662,22 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
775
662
|
return templates.filter((template) => template.versions.base.type?.toLowerCase()?.includes(smsFilter));
|
|
776
663
|
}
|
|
777
664
|
|
|
778
|
-
getCreativesEditText = (channel) => {
|
|
779
|
-
if (channel === WHATSAPP_LOWERCASE) {
|
|
780
|
-
return messages.whatsappOverview;
|
|
781
|
-
}
|
|
782
|
-
return messages.creativesTemplatesEdit;
|
|
783
|
-
}
|
|
784
|
-
|
|
785
665
|
getTemplateDataForGrid = ({templates, handlers, filterContent, channel, isLoading, loadingTip}) => {
|
|
786
666
|
const currentChannel = channel.toUpperCase();
|
|
787
667
|
const {channel: stateChannel} = this.state;
|
|
788
668
|
const channelLowerCase = stateChannel.toLowerCase();
|
|
789
669
|
let filteredTemplates = templates;
|
|
790
670
|
let isTraiDltFeature = false;
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
break;
|
|
801
|
-
case SMS:
|
|
802
|
-
filteredTemplates = this.filterSMSTemplates(templates);
|
|
803
|
-
isTraiDltFeature = this.checkDLTfeatureEnable();
|
|
804
|
-
break;
|
|
805
|
-
default:
|
|
806
|
-
break;
|
|
671
|
+
if (currentChannel === WECHAT) {
|
|
672
|
+
filteredTemplates = this.filterWechatTemplates(templates);
|
|
673
|
+
}
|
|
674
|
+
if (currentChannel === LINE) {
|
|
675
|
+
filteredTemplates = this.filterLineTemplates(templates);
|
|
676
|
+
}
|
|
677
|
+
if (currentChannel === SMS) {
|
|
678
|
+
filteredTemplates = this.filterSMSTemplates(templates);
|
|
679
|
+
isTraiDltFeature = this.checkDLTfeatureEnable();
|
|
807
680
|
}
|
|
808
|
-
|
|
809
|
-
const hoverButtonText =
|
|
810
|
-
this.props.intl.formatMessage(
|
|
811
|
-
this.props.isFullMode
|
|
812
|
-
? this.getCreativesEditText(channelLowerCase)
|
|
813
|
-
: messages.selectButton
|
|
814
|
-
);
|
|
815
|
-
|
|
816
681
|
const cardDataList = filteredTemplates && filteredTemplates.length ? map(filteredTemplates, (template) => {
|
|
817
682
|
const templateData =
|
|
818
683
|
{
|
|
@@ -826,18 +691,18 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
826
691
|
onClick={() => { if (this.props.isFullMode) { handlers.handlePreviewClick(template); } else { this.props.handlePeviewTemplate(template); } }}
|
|
827
692
|
/>,
|
|
828
693
|
],
|
|
829
|
-
hoverOption: <CapButton className={this.props.isFullMode ? `edit-${channelLowerCase}` : `select-${channelLowerCase}`} onClick={(e) => handlers.handleEditClick(e, template, undefined, undefined, {account: this.state.selectedAccount})}>{
|
|
694
|
+
hoverOption: <CapButton className={this.props.isFullMode ? `edit-${channelLowerCase}` : `select-${channelLowerCase}`} onClick={(e) => handlers.handleEditClick(e, template, undefined, undefined, {account: this.state.selectedAccount})}>{this.props.intl.formatMessage(this.props.isFullMode ? messages.creativesTemplatesEdit : messages.selectButton)}</CapButton>,
|
|
830
695
|
};
|
|
831
696
|
if (this.props.isFullMode) {
|
|
832
697
|
templateData.extra.push(<CapDropdown
|
|
833
698
|
overlay={
|
|
834
699
|
<CapMenu>
|
|
835
|
-
{
|
|
700
|
+
{this.state.channel.toUpperCase() !== WECHAT && !isTraiDltFeature && <CapMenu.Item className={`duplicate-${channelLowerCase}`} onClick={() => this.duplicateTemplate(template)}>
|
|
836
701
|
<FormattedMessage {...messages.duplicateButton} />
|
|
837
702
|
</CapMenu.Item>}
|
|
838
703
|
<CapMenu.Item
|
|
839
704
|
className={this.state.channel.toUpperCase() === WECHAT && !template.definition ? `unmap-${channelLowerCase}` : `delete-${channelLowerCase}`}
|
|
840
|
-
onClick={() => this.
|
|
705
|
+
onClick={() => this.deleteTemplate(template)}
|
|
841
706
|
>
|
|
842
707
|
{this.state.channel.toUpperCase() === WECHAT && !template.definition ? <FormattedMessage {...messages.unMapButton} /> : <FormattedMessage {...messages.deleteButton} />}
|
|
843
708
|
</CapMenu.Item>
|
|
@@ -969,16 +834,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
969
834
|
}
|
|
970
835
|
break;
|
|
971
836
|
}
|
|
972
|
-
case WHATSAPP:
|
|
973
|
-
templateData.title = (
|
|
974
|
-
<CapRow className="whatsapp-card-title">
|
|
975
|
-
<CapLabel>{template.name}</CapLabel>
|
|
976
|
-
<WhatsappStatusContainer template={template} />
|
|
977
|
-
</CapRow>
|
|
978
|
-
);
|
|
979
|
-
|
|
980
|
-
templateData.content = getWhatsappContent(template);
|
|
981
|
-
break;
|
|
982
837
|
default:
|
|
983
838
|
templateData.content = "";
|
|
984
839
|
}
|
|
@@ -987,9 +842,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
987
842
|
const accountId = get(this.props, 'Templates.selectedWeChatAccount.uuid');
|
|
988
843
|
const accounts = get(this.props, 'Templates.weCrmAccounts');
|
|
989
844
|
return (<div>
|
|
990
|
-
{[WECHAT, MOBILE_PUSH].includes(currentChannel) && this.showAccountName()}
|
|
845
|
+
{ [WECHAT, MOBILE_PUSH].includes(currentChannel) && this.showAccountName() }
|
|
991
846
|
{filterContent}
|
|
992
|
-
{[WHATSAPP].includes(currentChannel) && this.selectedFilters()}
|
|
993
847
|
<CapSpin spinning={isLoading} tip={loadingTip} style={{width: '100%'}}>
|
|
994
848
|
{<div>
|
|
995
849
|
{!isEmpty(filteredTemplates) || !isEmpty(this.state.searchText) || !isEmpty(this.props.Templates.templateError) ? (
|
|
@@ -1011,7 +865,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1011
865
|
</div>
|
|
1012
866
|
}
|
|
1013
867
|
|
|
1014
|
-
{ !isEmpty(this.props.Templates.selectedWeChatAccount) &&
|
|
868
|
+
{ !isEmpty(this.props.Templates.selectedWeChatAccount) && this.state.channel.toLowerCase() === "mobilepush" && this.state.selectedAccountError ?
|
|
1015
869
|
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
1016
870
|
<CapHeading type="h6" >
|
|
1017
871
|
{this.props.intl.formatMessage(messages.accountConfigError)}
|
|
@@ -1028,35 +882,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1028
882
|
</div>
|
|
1029
883
|
)
|
|
1030
884
|
}
|
|
1031
|
-
{ !isEmpty(this.props.Templates.selectedWhatsappAccount) && [WHATSAPP_LOWERCASE].includes(this.state.channel.toLowerCase()) && this.state.selectedAccountError ?
|
|
1032
|
-
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
1033
|
-
<CapHeading type="h6" >
|
|
1034
|
-
{this.props.intl.formatMessage(messages.accountConfigError)}
|
|
1035
|
-
<InlineDiv>
|
|
1036
|
-
<CapLink title="here" style={{display: 'inline'}} onClick={() => { window.open(config.production.accountConfig`${accountId}`); }}/>
|
|
1037
|
-
</InlineDiv>
|
|
1038
|
-
</CapHeading>
|
|
1039
|
-
</div> : (
|
|
1040
|
-
[WHATSAPP_LOWERCASE].includes(this.state.channel.toLowerCase()) &&
|
|
1041
|
-
isEmpty(this.state.searchText) &&
|
|
1042
|
-
!isLoading &&
|
|
1043
|
-
<div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto' } : {}}>
|
|
1044
|
-
{isEmpty(templates) && <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />}
|
|
1045
|
-
{!isEmpty(templates) && isEmpty(filteredTemplates) && <CapHeader
|
|
1046
|
-
title={
|
|
1047
|
-
<CapHeading type="h3" style={{ textAlign: "center", marginTop: CAP_SPACE_44 }}>
|
|
1048
|
-
{this.props.intl.formatMessage(messages.noFilteredWhatsappTemplatesTitle)}
|
|
1049
|
-
</CapHeading>
|
|
1050
|
-
}
|
|
1051
|
-
description={
|
|
1052
|
-
<CapLabel style={{ textAlign: "center" }}>
|
|
1053
|
-
{this.props.intl.formatMessage(messages.noFilteredWhatsappTemplatesDesc)}
|
|
1054
|
-
</CapLabel>
|
|
1055
|
-
}
|
|
1056
|
-
/>}
|
|
1057
|
-
</div>
|
|
1058
|
-
)
|
|
1059
|
-
}
|
|
1060
885
|
</div>
|
|
1061
886
|
}
|
|
1062
887
|
|
|
@@ -1363,7 +1188,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1363
1188
|
} else {
|
|
1364
1189
|
this.props.createNew();
|
|
1365
1190
|
}
|
|
1366
|
-
} else if (ev
|
|
1191
|
+
} else if (ev.key && (ev.key.toLowerCase() === "text" || ev.key.toLowerCase() === "image")) {
|
|
1367
1192
|
routeParams = {
|
|
1368
1193
|
pathname: `/${channel === 'line' ? 'line' : 'mobilepush'}/create/${ev.key.toLowerCase()}`,
|
|
1369
1194
|
query: type === 'embedded' ? {type: 'embedded', module} : {module},
|
|
@@ -1631,9 +1456,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1631
1456
|
pathName = `/wechat/edit/${id}`;
|
|
1632
1457
|
}
|
|
1633
1458
|
}
|
|
1634
|
-
if (this.state.channel.toUpperCase() === WHATSAPP) {
|
|
1635
|
-
pathName = `/whatsapp/edit/${id}/`;
|
|
1636
|
-
}
|
|
1637
1459
|
if (this.isEnabledInLibraryModule("callSelectFromProps")) {
|
|
1638
1460
|
let data = id;
|
|
1639
1461
|
if (this.props.fbAdManager) {
|
|
@@ -1894,7 +1716,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1894
1716
|
if (this.props.location.query.type === "embedded" && this.props.location.query.module === "library") {
|
|
1895
1717
|
switch (property) {
|
|
1896
1718
|
case "showAccountSelection":
|
|
1897
|
-
return (this.props.route && (
|
|
1719
|
+
return (this.props.route && (this.props.route.name.toLowerCase() === "wechat" || this.props.route.name.toLowerCase() === "mobilepush"));
|
|
1898
1720
|
case "setLocale":
|
|
1899
1721
|
return true;
|
|
1900
1722
|
case "callCreateFromProps":
|
|
@@ -1912,13 +1734,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1912
1734
|
isCreateDisabled = () => {
|
|
1913
1735
|
let isDisabled = this.isLoading();
|
|
1914
1736
|
const channel = this.state.channel.toUpperCase();
|
|
1915
|
-
if (channel === MOBILE_PUSH || channel === WECHAT
|
|
1737
|
+
if (channel === MOBILE_PUSH || channel === WECHAT) {
|
|
1916
1738
|
isDisabled = isDisabled || isEmpty(this.props.Templates.selectedWeChatAccount);
|
|
1917
1739
|
}
|
|
1918
|
-
if (channel === WHATSAPP) {
|
|
1919
|
-
// limit on max number of templates allowed for whatsapp
|
|
1920
|
-
isDisabled = this.state.templatesCount >= MAX_WHATSAPP_TEMPLATES;
|
|
1921
|
-
}
|
|
1922
1740
|
if (channel === MOBILE_PUSH) {
|
|
1923
1741
|
isDisabled = this.checkSearchDisabled();
|
|
1924
1742
|
}
|
|
@@ -1940,7 +1758,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1940
1758
|
const facebookLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === FACEBOOK_CHANNEL);
|
|
1941
1759
|
|
|
1942
1760
|
const wechatLoader = (((this.state.selectedAccount !== '' && getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'wechat');
|
|
1943
|
-
const whatsappLoader = (((this.state.selectedAccount !== '' && getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === WHATSAPP_LOWERCASE);
|
|
1944
1761
|
const mobilePushLoader = (((getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'mobilepush');
|
|
1945
1762
|
const emailLoader = (
|
|
1946
1763
|
(getAllTemplatesInProgress ||
|
|
@@ -1949,7 +1766,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1949
1766
|
EmailCreate.duplicateTemplateInProgress) && this.state.channel.toLowerCase() === 'email');
|
|
1950
1767
|
const ebillLoader = ((getAllTemplatesInProgress || sendingFile) && this.state.channel.toLowerCase() === 'ebill');
|
|
1951
1768
|
const isLoading = ((wechatLoader !== undefined) ? wechatLoader : false) ||
|
|
1952
|
-
(whatsappLoader !== undefined ? whatsappLoader : false) ||
|
|
1953
1769
|
(smsLoader !== undefined ? smsLoader : false) ||
|
|
1954
1770
|
(emailLoader !== undefined ? emailLoader : false) ||
|
|
1955
1771
|
(ebillLoader !== undefined ? ebillLoader : false) ||
|
|
@@ -1985,16 +1801,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1985
1801
|
illustrationImage: pushIllustration,
|
|
1986
1802
|
title: <FormattedMessage {...messages.pushTitleIllustartion} values={{ template: templateText }} />,
|
|
1987
1803
|
};
|
|
1988
|
-
case WHATSAPP:
|
|
1989
|
-
return {
|
|
1990
|
-
buttonLabel: <FormattedMessage {...messages.newWhatsappTemplate} values={{ template: templateText }} />,
|
|
1991
|
-
onClick: this.createTemplate,
|
|
1992
|
-
illustrationImage: whatsappIllustration,
|
|
1993
|
-
title: <FormattedMessage {...messages.whatsappTitleIllustration} values={{ template: templateText }} />,
|
|
1994
|
-
description: <FormattedMessage {...messages.whatsappDescIllustration} />,
|
|
1995
|
-
descriptionPosition: 'bottom',
|
|
1996
|
-
descriptionClassName: 'whatsapp-illustration-desc',
|
|
1997
|
-
};
|
|
1998
1804
|
default:
|
|
1999
1805
|
return {};
|
|
2000
1806
|
}
|
|
@@ -2018,25 +1824,21 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2018
1824
|
);
|
|
2019
1825
|
}
|
|
2020
1826
|
renderDeleteConfirmationModal = () => {
|
|
2021
|
-
const
|
|
2022
|
-
|
|
2023
|
-
formatMessage,
|
|
2024
|
-
} = {},
|
|
2025
|
-
} = this.props;
|
|
2026
|
-
|
|
2027
|
-
const modal = ( <CapModal
|
|
2028
|
-
className="delete-template-confirm"
|
|
2029
|
-
title={formatMessage(messages.areYouSureText)}
|
|
1827
|
+
const modal =
|
|
1828
|
+
(<Modal
|
|
2030
1829
|
visible={this.state.showModal}
|
|
1830
|
+
title={"Alert"}
|
|
2031
1831
|
onOk={this.handleOk}
|
|
2032
1832
|
onCancel={this.handleCancel}
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
1833
|
+
footer={[
|
|
1834
|
+
<CapButton key="back" onClick={this.handleCancel}>{this.props.intl.formatMessage(messages.cancelText)}</CapButton>,
|
|
1835
|
+
<CapButton key="submit" type="primary" id="delete-version" onClick={this.handleOk}>
|
|
1836
|
+
{this.props.intl.formatMessage(messages.yesText)}
|
|
1837
|
+
</CapButton>,
|
|
1838
|
+
]}
|
|
2036
1839
|
>
|
|
2037
|
-
{formatMessage(messages.templateDeleteConfirm)}
|
|
2038
|
-
</
|
|
2039
|
-
);
|
|
1840
|
+
{this.props.intl.formatMessage(messages.templateDeleteConfirm)}
|
|
1841
|
+
</Modal>);
|
|
2040
1842
|
return modal;
|
|
2041
1843
|
};
|
|
2042
1844
|
|
|
@@ -2050,11 +1852,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2050
1852
|
const { weCrmAccounts = [], fetchingWeCrmAccounts = false, campaignSettings = {} } = templates;
|
|
2051
1853
|
const isWechatChannel = channel === WECHAT;
|
|
2052
1854
|
const isMobilePushChannel = channel === MOBILE_PUSH;
|
|
2053
|
-
const
|
|
1855
|
+
const isLineChannel = channel === LINE;
|
|
1856
|
+
const isFacebookChannel = channel === FACEBOOK;
|
|
1857
|
+
|
|
2054
1858
|
|
|
2055
|
-
if (
|
|
1859
|
+
if ((isWechatChannel || isMobilePushChannel || isLineChannel) && !isEmpty(weCrmAccounts) && !isFacebookChannel ) {
|
|
2056
1860
|
forEach(weCrmAccounts, (account) => {
|
|
2057
|
-
if ((isWechatChannel && account.configs && account.configs.is_wecrm_enabled) ||
|
|
1861
|
+
if ((isWechatChannel && account.configs && account.configs.is_wecrm_enabled) || isMobilePushChannel || isLineChannel) {
|
|
2058
1862
|
if (query.type === 'embedded' && (!query.module || (query.module && query.module !== 'library'))) {
|
|
2059
1863
|
if (query.source_account_id && account.sourceAccountIdentifier === query.source_account_id) {
|
|
2060
1864
|
accountOptions.push(
|
|
@@ -2118,11 +1922,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2118
1922
|
noAccountHeader = messages.noAccountsPresentFacebook;
|
|
2119
1923
|
break;
|
|
2120
1924
|
}
|
|
2121
|
-
case WHATSAPP: {
|
|
2122
|
-
accountHeader = formatMessage(messages.whatsappAccount);
|
|
2123
|
-
noAccountHeader = messages.noAccountsPresentWhatsapp;
|
|
2124
|
-
break;
|
|
2125
|
-
}
|
|
2126
1925
|
default:
|
|
2127
1926
|
break;
|
|
2128
1927
|
}
|
|
@@ -2178,102 +1977,27 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2178
1977
|
this.setState({activeMode: TEMPLATES_MODE});
|
|
2179
1978
|
}
|
|
2180
1979
|
|
|
2181
|
-
accountNameMessage = (channel) => {
|
|
2182
|
-
const {
|
|
2183
|
-
intl: {
|
|
2184
|
-
formatMessage,
|
|
2185
|
-
},
|
|
2186
|
-
} = this.props;
|
|
2187
|
-
|
|
2188
|
-
const channelObj = {
|
|
2189
|
-
[MOBILE_PUSH]: 'mobilepushAccount',
|
|
2190
|
-
[WECHAT]: 'wechatAccount',
|
|
2191
|
-
[WHATSAPP]: 'whatsappAccount',
|
|
2192
|
-
}
|
|
2193
|
-
return formatMessage(messages[channelObj[channel?.toUpperCase()]]);
|
|
2194
|
-
}
|
|
2195
|
-
|
|
2196
1980
|
showAccountName = () => {
|
|
2197
1981
|
const { activeMode, selectedAccount, channel } = this.state;
|
|
2198
1982
|
const { Templates: templates = {}} = this.props;
|
|
2199
|
-
const { weCrmAccounts = []
|
|
1983
|
+
const { weCrmAccounts = []} = templates;
|
|
1984
|
+
const isMobilePushChannel = channel === MOBILE_PUSH;
|
|
2200
1985
|
return (activeMode !== ACCOUNT_CHANGE_MODE &&
|
|
2201
1986
|
<CapHeader
|
|
2202
|
-
title={<CapHeading type="h4">{this.
|
|
1987
|
+
title={<CapHeading type="h4">{isMobilePushChannel ? this.props.intl.formatMessage(messages.mobilepushAccount) : this.props.intl.formatMessage(messages.wechatAccount)}</CapHeading>}
|
|
2203
1988
|
description={<><CapHeading type="h3">{selectedAccount} {weCrmAccounts.length > 1 && <CapLink onClick={this.setAccountChangeMode} style={{display: 'inline-block', position: 'relative', top: '3px'}} fontWeight="regular" fontSize="14px" title="change"/>} </CapHeading></>}
|
|
2204
1989
|
size="regular"
|
|
2205
1990
|
/>);
|
|
2206
1991
|
}
|
|
2207
1992
|
|
|
2208
|
-
removeWhatsappFilter = (filter) => {
|
|
2209
|
-
switch (filter) {
|
|
2210
|
-
case WHATSAPP_STATUS:
|
|
2211
|
-
this.setState({ selectedWhatsappStatus: null });
|
|
2212
|
-
break;
|
|
2213
|
-
case WHATSAPP_CATEGORY:
|
|
2214
|
-
this.setState({ selectedWhatsappCategory: null });
|
|
2215
|
-
break;
|
|
2216
|
-
default:
|
|
2217
|
-
break;
|
|
2218
|
-
}
|
|
2219
|
-
}
|
|
2220
|
-
|
|
2221
|
-
selectedFilters = () => {
|
|
2222
|
-
const { selectedWhatsappStatus, selectedWhatsappCategory } = this.state;
|
|
2223
|
-
const {
|
|
2224
|
-
intl: {
|
|
2225
|
-
formatMessage,
|
|
2226
|
-
},
|
|
2227
|
-
} = this.props;
|
|
2228
|
-
return (
|
|
2229
|
-
<CapRow type="flex" align="middle" className="selected-whatsapp-filters">
|
|
2230
|
-
{
|
|
2231
|
-
selectedWhatsappStatus ? (
|
|
2232
|
-
<CapTag closable onClose={() => this.removeWhatsappFilter(WHATSAPP_STATUS)}>
|
|
2233
|
-
{formatMessage(messages.status)}: {getWhatsappStatus(selectedWhatsappStatus)?.label || selectedWhatsappStatus}
|
|
2234
|
-
</CapTag>
|
|
2235
|
-
) : null
|
|
2236
|
-
}
|
|
2237
|
-
{
|
|
2238
|
-
selectedWhatsappCategory ? (
|
|
2239
|
-
<CapTag closable onClose={() => this.removeWhatsappFilter(WHATSAPP_CATEGORY)}>
|
|
2240
|
-
{formatMessage(messages.category)}: {getWhatsappCategory(selectedWhatsappCategory)?.label || selectedWhatsappCategory}
|
|
2241
|
-
</CapTag>
|
|
2242
|
-
) : null
|
|
2243
|
-
}
|
|
2244
|
-
{
|
|
2245
|
-
(selectedWhatsappStatus || selectedWhatsappCategory) ? (
|
|
2246
|
-
<CapLink
|
|
2247
|
-
onClick={() => {
|
|
2248
|
-
this.removeWhatsappFilter(WHATSAPP_STATUS);
|
|
2249
|
-
this.removeWhatsappFilter(WHATSAPP_CATEGORY);
|
|
2250
|
-
}}
|
|
2251
|
-
title={this.props.intl.formatMessage(messages.clearAll)}
|
|
2252
|
-
/>
|
|
2253
|
-
) : null
|
|
2254
|
-
}
|
|
2255
|
-
</CapRow>
|
|
2256
|
-
);
|
|
2257
|
-
}
|
|
2258
|
-
|
|
2259
1993
|
setWechatFilter = (e) => this.setState({wechatFilter: e.target.value});
|
|
2260
|
-
setWhatsappStatus = (value) => this.setState({selectedWhatsappStatus: value?.item?.props?.value});
|
|
2261
|
-
setWhatsappCategory = (value) => this.setState({selectedWhatsappCategory: value?.item?.props?.value});
|
|
2262
1994
|
setLineFilter = (e) => this.setState({lineFilter: e.target.value});
|
|
2263
1995
|
setSMSFilter = (e) => this.setState({smsFilter: e.target.value});
|
|
2264
1996
|
|
|
2265
|
-
openCreativesFullMode = () => {
|
|
2266
|
-
window.open(`/creatives/ui/v2?channel=${WHATSAPP_LOWERCASE}&mode=${CREATE}`, "_blank");
|
|
2267
|
-
}
|
|
2268
1997
|
|
|
2269
1998
|
render() {
|
|
2270
1999
|
const isFullMode = this.isFullMode();
|
|
2271
|
-
const { activeMode, channel, wechatFilter, lineFilter, smsFilter
|
|
2272
|
-
const {
|
|
2273
|
-
intl: {
|
|
2274
|
-
formatMessage,
|
|
2275
|
-
} = {},
|
|
2276
|
-
} = this.props || {};
|
|
2000
|
+
const { activeMode, channel, wechatFilter, lineFilter, smsFilter } = this.state;
|
|
2277
2001
|
let showFbAds = false;
|
|
2278
2002
|
if (channel.toLowerCase() === FACEBOOK_CHANNEL) {
|
|
2279
2003
|
const {campaignSettings, fetchedOrgLevelCampaignSettings} = this?.props?.Templates || {};
|
|
@@ -2337,33 +2061,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2337
2061
|
const isWechatEmbedded = !this.props.isFullMode && channel.toUpperCase() === WECHAT;
|
|
2338
2062
|
const channelLowerCase = (channel || '').toLowerCase();
|
|
2339
2063
|
const isTraiDltFeature = this.checkDLTfeatureEnable();
|
|
2340
|
-
|
|
2341
|
-
const createButton =
|
|
2342
|
-
( channelLowerCase === WHATSAPP_LOWERCASE && !this.props.isFullMode )
|
|
2343
|
-
? (
|
|
2344
|
-
<CapLink
|
|
2345
|
-
onClick={this.openCreativesFullMode}
|
|
2346
|
-
title={formatMessage(messages.createNewTemplateLink)}
|
|
2347
|
-
suffix={<CapIcon type="open-in-new" size="s" />}
|
|
2348
|
-
className="create-new-link"
|
|
2349
|
-
/>
|
|
2350
|
-
)
|
|
2351
|
-
: (
|
|
2352
|
-
<CapButton
|
|
2353
|
-
className={`create-new-${channelLowerCase}`}
|
|
2354
|
-
type={"primary"}
|
|
2355
|
-
disabled={this.isCreateDisabled()}
|
|
2356
|
-
style={{marginLeft: '8px', marginBottom: '12px'}}
|
|
2357
|
-
onClick={this.createTemplate}
|
|
2358
|
-
>
|
|
2359
|
-
{ this.props.intl.formatMessage((isTraiDltFeature && channel.toUpperCase() === SMS ) ? messages.uploadTemplate : messages.createNewActionButton) }
|
|
2360
|
-
</CapButton>
|
|
2361
|
-
);
|
|
2362
|
-
|
|
2363
|
-
const isWhatsappCountExeeded = templatesCount >= MAX_WHATSAPP_TEMPLATES;
|
|
2364
|
-
const showWhatsappCountWarning = templatesCount >= WARNING_WHATSAPP_TEMPLATES;
|
|
2365
|
-
const whatsappCountExceedText = <FormattedMessage {...messages.whatsappMaxTemplates} values={{ maxCount: MAX_WHATSAPP_TEMPLATES }}/>;
|
|
2366
|
-
|
|
2367
2064
|
const filterContent = (( isfilterContentVisisble || [WECHAT, MOBILE_PUSH].includes(this.state.channel.toUpperCase())) && <div className="action-container">
|
|
2368
2065
|
{isfilterContentVisisble && <CapInput.Search
|
|
2369
2066
|
className="search-text"
|
|
@@ -2388,36 +2085,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2388
2085
|
</CapLabel></CapRadio.Button>
|
|
2389
2086
|
</CapRadio.CapRadioGroup>
|
|
2390
2087
|
}
|
|
2391
|
-
{
|
|
2392
|
-
channel.toUpperCase() === WHATSAPP && (
|
|
2393
|
-
<div className="whatsapp-filters">
|
|
2394
|
-
{
|
|
2395
|
-
this.props.isFullMode ? (
|
|
2396
|
-
<CapSelectFilter
|
|
2397
|
-
placement="bottomLeft"
|
|
2398
|
-
data={STATUS_OPTIONS}
|
|
2399
|
-
onSelect={this.setWhatsappStatus}
|
|
2400
|
-
selectedValue={this.state.selectedWhatsappStatus}
|
|
2401
|
-
placeholder="Status"
|
|
2402
|
-
showBadge={true}
|
|
2403
|
-
width="90px"
|
|
2404
|
-
/>
|
|
2405
|
-
) : null
|
|
2406
|
-
}
|
|
2407
|
-
<CapSelectFilter
|
|
2408
|
-
placement="bottomLeft"
|
|
2409
|
-
data={CATEGORY_OPTIONS}
|
|
2410
|
-
onSelect={this.setWhatsappCategory}
|
|
2411
|
-
selectedValue={this.state.selectedWhatsappCategory}
|
|
2412
|
-
placeholder="Category"
|
|
2413
|
-
showBadge={true}
|
|
2414
|
-
width="105px"
|
|
2415
|
-
overlayStyle={{ overflowY: "hidden" }}
|
|
2416
|
-
/>
|
|
2417
|
-
</div>
|
|
2418
|
-
|
|
2419
|
-
)
|
|
2420
|
-
}
|
|
2421
2088
|
{
|
|
2422
2089
|
channel.toUpperCase() === LINE &&
|
|
2423
2090
|
isFullMode
|
|
@@ -2485,16 +2152,14 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2485
2152
|
: () => null
|
|
2486
2153
|
}
|
|
2487
2154
|
<div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
|
|
2488
|
-
{
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
: isfilterContentVisisble && !isWechatEmbedded && createButton
|
|
2497
|
-
}
|
|
2155
|
+
{isfilterContentVisisble && !isWechatEmbedded && <CapButton
|
|
2156
|
+
className={`create-new-${channelLowerCase}`}
|
|
2157
|
+
type={"primary"}
|
|
2158
|
+
disabled={this.isCreateDisabled()}
|
|
2159
|
+
style={{marginLeft: '8px', marginBottom: '12px'}}
|
|
2160
|
+
onClick={this.createTemplate} >
|
|
2161
|
+
{ this.props.intl.formatMessage((isTraiDltFeature && channel.toUpperCase() === SMS ) ? messages.uploadTemplate : messages.createNewActionButton) }
|
|
2162
|
+
</CapButton>}
|
|
2498
2163
|
</div>
|
|
2499
2164
|
|
|
2500
2165
|
</div>);
|
|
@@ -2528,11 +2193,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2528
2193
|
<div className={`creatives-templates-list ${this.props.isFullMode ? 'full-mode' : 'library-mode'}`}>
|
|
2529
2194
|
<input type="file" id="filename" style={{ display: 'none'}} accept=".zip, .html, .htm" onChange={(event) => this.handleFileUpload(event, {files: event.target.files})} />
|
|
2530
2195
|
|
|
2531
|
-
{
|
|
2532
|
-
channel.toLowerCase() === WHATSAPP_LOWERCASE && showWhatsappCountWarning ? (
|
|
2533
|
-
<CapAlert message={whatsappCountExceedText} type="info" />
|
|
2534
|
-
) : null
|
|
2535
|
-
}
|
|
2536
2196
|
|
|
2537
2197
|
<CapRow>
|
|
2538
2198
|
<Pagination onPageChange={templates.length ? this.onPaginationChange : () => {}} paginationSelector="pagination-container">
|
|
@@ -2540,11 +2200,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2540
2200
|
</Pagination>
|
|
2541
2201
|
{(((this.state.selectedAccount !== '' && !isEmpty(this.props.Templates.selectedWeChatAccount) && this.state.channel.toLowerCase() === 'wechat') || this.state.channel.toLowerCase() !== 'wechat') && isEmpty(this.props.TemplatesList)) && !this.props.Templates.getAllTemplatesInProgress && !isEmpty(this.state.searchText) &&
|
|
2542
2202
|
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
2543
|
-
{
|
|
2544
|
-
channel.toLowerCase() === WHATSAPP_LOWERCASE ? (
|
|
2545
|
-
<CapAlert message={whatsappCountExceedText} type="info" />
|
|
2546
|
-
) : null
|
|
2547
|
-
}
|
|
2548
2203
|
<CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesFound)}</CapHeading>
|
|
2549
2204
|
</div>}
|
|
2550
2205
|
</CapRow>
|
|
@@ -2622,7 +2277,6 @@ Templates.propTypes = {
|
|
|
2622
2277
|
router: PropTypes.object,
|
|
2623
2278
|
viberActions: PropTypes.object,
|
|
2624
2279
|
facebookActions: PropTypes.object,
|
|
2625
|
-
whatsappActions: PropTypes.object,
|
|
2626
2280
|
smsRegister: PropTypes.any,
|
|
2627
2281
|
};
|
|
2628
2282
|
|
|
@@ -2651,7 +2305,6 @@ function mapDispatchToProps(dispatch) {
|
|
|
2651
2305
|
lineActions: bindActionCreators(lineActions, dispatch),
|
|
2652
2306
|
viberActions: bindActionCreators(viberActions, dispatch),
|
|
2653
2307
|
facebookActions: bindActionCreators(facebookActions, dispatch),
|
|
2654
|
-
whatsappActions: bindActionCreators(whatsappActions, dispatch),
|
|
2655
2308
|
};
|
|
2656
2309
|
}
|
|
2657
2310
|
|