@capillarytech/creatives-library 7.10.50 → 7.10.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/utils/v2common.js +0 -13
- package/v2Components/TemplatePreview/assets/images/whatsapp_mobile_android.svg +1 -2041
- package/v2Components/TemplatePreview/index.js +39 -28
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +2 -3
- package/v2Containers/CreativesContainer/index.js +7 -46
- package/v2Containers/Templates/_templates.scss +0 -14
- package/v2Containers/Templates/index.js +42 -74
- package/v2Containers/Templates/messages.js +8 -4
- package/v2Containers/TemplatesV2/index.js +4 -11
- package/v2Containers/Whatsapp/index.js +16 -84
- package/v2Containers/Whatsapp/messages.js +0 -9
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +33270 -5916
- package/v2Containers/Whatsapp/tests/index.test.js +49 -9
- package/v2Containers/Whatsapp/tests/mockData.js +120 -1
|
@@ -32,7 +32,7 @@ const lineVideoPlaceholder = require('../../assets/rich-video-placeholder.svg');
|
|
|
32
32
|
const androidPushMessagePhone = require('./assets/images/androidPushMessage.svg');
|
|
33
33
|
const iPhonePushMessagePhone = require('./assets/images/iPhonePushMessage.svg');
|
|
34
34
|
|
|
35
|
-
import { CAP_COLOR_03, CAP_WHITE, FONT_COLOR_01, CAP_G08, CAP_G06, CAP_G15, CAP_PURPLE01, CAP_G16, CAP_SPACE_08 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
35
|
+
import { CAP_COLOR_03, CAP_WHITE, FONT_COLOR_01, CAP_G08, CAP_G06, CAP_G15, CAP_PURPLE01, CAP_G16, CAP_SPACE_08, CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
36
36
|
import { TEMPLATE, IMAGE_CAROUSEL, IMAGE, STICKER, TEXT, IMAGE_MAP, VIDEO } from '../../v2Containers/Line/Container/constants';
|
|
37
37
|
import CapFacebookPreview from '../../v2Containers/CapFacebookPreview';
|
|
38
38
|
import { getWhatsappStatusContainer } from '../../v2Containers/Whatsapp/utils';
|
|
@@ -137,7 +137,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
137
137
|
|
|
138
138
|
render() {
|
|
139
139
|
let content = channel && channel.toLowerCase() === 'sms' ? [this.props.content] : this.props.content;
|
|
140
|
-
const { channel, showTestAndPreviewIcon, module, viberBrandName, viberAccountName, whatsappAccountName, intl, templateData } = this.props;
|
|
140
|
+
const { channel, showTestAndPreviewIcon, module, viberBrandName, viberAccountName, whatsappAccountName, whatsappContentLen = 0, intl, templateData } = this.props;
|
|
141
141
|
const { formatMessage } = intl;
|
|
142
142
|
const { buttonText, imageURL, messageContent: viberMessageContent } = content || {};
|
|
143
143
|
let smsDetails = {};
|
|
@@ -663,35 +663,46 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
663
663
|
) : ''
|
|
664
664
|
}
|
|
665
665
|
{channel && channel?.toUpperCase() === WHATSAPP ? (
|
|
666
|
-
|
|
667
|
-
<
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
maxHeight: 292,
|
|
677
|
-
marginLeft: 28,
|
|
678
|
-
}}
|
|
679
|
-
>
|
|
666
|
+
<>
|
|
667
|
+
<div className="shell-v2 align-center" id="sms-preview">
|
|
668
|
+
<CapImage
|
|
669
|
+
className="preview-image"
|
|
670
|
+
src={whatsappMobileAndroid}
|
|
671
|
+
alt={formatMessage(messages.previewGenerated)}
|
|
672
|
+
/>
|
|
673
|
+
<div className="whatsapp-brand-name">
|
|
674
|
+
{whatsappAccountName || ''}
|
|
675
|
+
</div>
|
|
680
676
|
<div
|
|
681
|
-
className="
|
|
682
|
-
style={
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
677
|
+
className="msgContainer"
|
|
678
|
+
style={{
|
|
679
|
+
maxHeight: 292,
|
|
680
|
+
marginLeft: 28,
|
|
681
|
+
}}
|
|
682
|
+
>
|
|
683
|
+
<div
|
|
684
|
+
className="message-pop align-left"
|
|
685
|
+
style={whatsappSectionStyle}
|
|
686
|
+
>
|
|
687
|
+
<p
|
|
688
|
+
style={{
|
|
689
|
+
color: CAP_G16,
|
|
690
|
+
margin: '1.5px 6px 1px 7px',
|
|
691
|
+
}}
|
|
692
|
+
>
|
|
693
|
+
{content?.templateMsg || ''}
|
|
694
|
+
</p>
|
|
695
|
+
<div style={{ paddingBottom: CAP_SPACE_08 }}></div>
|
|
696
|
+
</div>
|
|
690
697
|
</div>
|
|
691
698
|
</div>
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
699
|
+
<CapHeading type="h3" style={{ textAlign: "center", marginTop: CAP_SPACE_16 }}>
|
|
700
|
+
<FormattedMessage {...messages.whatsappMessageLength} values={{ length: 36 + whatsappContentLen }} />
|
|
701
|
+
</CapHeading>
|
|
702
|
+
</>
|
|
703
|
+
) : (
|
|
704
|
+
''
|
|
705
|
+
)}
|
|
695
706
|
{channel && channel.toLowerCase() === FACEBOOK && (
|
|
696
707
|
<div style={{position: 'absolute', left: '80%'}} id="facebook-preview">
|
|
697
708
|
<CapFacebookPreview
|
|
@@ -34,6 +34,10 @@ export default defineMessages({
|
|
|
34
34
|
id: 'app.components.TemplatePreview.whatsappUnsubscribeLength',
|
|
35
35
|
defaultMessage: "Includes 36 characters of (Click {{unsubscribe}} to unsubscribe)",
|
|
36
36
|
},
|
|
37
|
+
whatsappMessageLength: {
|
|
38
|
+
id: 'app.components.TemplatePreview.whatsappMessageLength',
|
|
39
|
+
defaultMessage: "1 Message ({length} characters)",
|
|
40
|
+
},
|
|
37
41
|
smsFormatType: {
|
|
38
42
|
id: 'creatives.componentsV2.TemplatePreview.smsFormatType',
|
|
39
43
|
defaultMessage: 'Message has unicode characters',
|
|
@@ -145,6 +145,7 @@ function SlideBoxContent(props) {
|
|
|
145
145
|
showDisabledFBInfo,
|
|
146
146
|
orgUnitId,
|
|
147
147
|
smsRegister,
|
|
148
|
+
enableNewChannels,
|
|
148
149
|
} = props;
|
|
149
150
|
const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
150
151
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
|
|
@@ -364,6 +365,7 @@ function SlideBoxContent(props) {
|
|
|
364
365
|
showDisabledFBInfo={showDisabledFBInfo}
|
|
365
366
|
orgUnitId={orgUnitId}
|
|
366
367
|
smsRegister={smsRegister}
|
|
368
|
+
enableNewChannels={enableNewChannels}
|
|
367
369
|
/>
|
|
368
370
|
)}
|
|
369
371
|
{isPreview && (
|
|
@@ -697,9 +699,6 @@ function SlideBoxContent(props) {
|
|
|
697
699
|
{isEditWhatsapp && (<Whatsapp
|
|
698
700
|
isFullMode={isFullMode}
|
|
699
701
|
templateData={templateData}
|
|
700
|
-
getFormData={getFormData}
|
|
701
|
-
getDefaultTags={type}
|
|
702
|
-
forwardedTags={forwardedTags}
|
|
703
702
|
params={{
|
|
704
703
|
id: templateData._id,
|
|
705
704
|
}}
|
|
@@ -364,28 +364,6 @@ class Creatives extends React.Component {
|
|
|
364
364
|
};
|
|
365
365
|
break;
|
|
366
366
|
}
|
|
367
|
-
case constants.WHATSAPP: {
|
|
368
|
-
const { messageBody } = templateData;
|
|
369
|
-
const body = JSON.parse(messageBody || '{}');
|
|
370
|
-
console.log("getTemplateData body", body);
|
|
371
|
-
creativesTemplateData = {
|
|
372
|
-
type: constants.WHATSAPP,
|
|
373
|
-
edit: true,
|
|
374
|
-
name: "",
|
|
375
|
-
versions: {
|
|
376
|
-
base: {
|
|
377
|
-
content: {
|
|
378
|
-
...body,
|
|
379
|
-
whatsapp: {
|
|
380
|
-
...body.whatsapp,
|
|
381
|
-
status: 'approved'
|
|
382
|
-
}
|
|
383
|
-
},
|
|
384
|
-
},
|
|
385
|
-
},
|
|
386
|
-
};
|
|
387
|
-
break;
|
|
388
|
-
}
|
|
389
367
|
default:
|
|
390
368
|
break;
|
|
391
369
|
}
|
|
@@ -442,8 +420,8 @@ class Creatives extends React.Component {
|
|
|
442
420
|
if (get(template, "value.versions.base")) {
|
|
443
421
|
const mobilpushTemplate = template.value;
|
|
444
422
|
templateData.accountId = get(mobilpushTemplate, 'definition.accountId');
|
|
445
|
-
const type = (get(this.props,"messageDetails.type") || '').toLowerCase();
|
|
446
|
-
if(type === LOYALTY){
|
|
423
|
+
const type = (get(this.props, "messageDetails.type") || '').toLowerCase();
|
|
424
|
+
if (type === LOYALTY) {
|
|
447
425
|
templateData.licenseCode = get(mobilpushTemplate, 'definition.licenseCode');
|
|
448
426
|
}
|
|
449
427
|
const androidContent = get(mobilpushTemplate, 'versions.base.ANDROID');
|
|
@@ -517,26 +495,6 @@ class Creatives extends React.Component {
|
|
|
517
495
|
};
|
|
518
496
|
}
|
|
519
497
|
break;
|
|
520
|
-
case constants.WHATSAPP:
|
|
521
|
-
if (template.value) {
|
|
522
|
-
const { Templates, templateData: templateDataProps } = this.props;
|
|
523
|
-
const { accountDetails: selectedAccountDetails, accountId: selectedAccountId } = templateDataProps || {};
|
|
524
|
-
const selectedWhatsappAccount = Templates?.selectedWhatsappAccount;
|
|
525
|
-
const accountDetails = (selectedWhatsappAccount ? selectedWhatsappAccount : selectedAccountDetails);
|
|
526
|
-
const accountId = selectedAccountId || (selectedWhatsappAccount?.id || '');
|
|
527
|
-
const { versions } = template.value;
|
|
528
|
-
const whatsappContent = cloneDeep(versions.base.content.whatsapp);
|
|
529
|
-
templateData = {
|
|
530
|
-
channel,
|
|
531
|
-
accountId,
|
|
532
|
-
accountName: accountDetails.name,
|
|
533
|
-
messageBody: whatsappContent.languages[0].content,
|
|
534
|
-
category: whatsappContent.category,
|
|
535
|
-
language: whatsappContent.languages[0].language,
|
|
536
|
-
mediaType: whatsappContent.mediaType,
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
|
-
break;
|
|
540
498
|
case constants.FACEBOOK: {
|
|
541
499
|
if (template.value) {
|
|
542
500
|
const FacebookAd = template?.value?.versions?.base?.content?.FacebookAd;
|
|
@@ -702,11 +660,13 @@ class Creatives extends React.Component {
|
|
|
702
660
|
});
|
|
703
661
|
}
|
|
704
662
|
handleCloseSlideBox = () => {
|
|
663
|
+
const { currentChannel = '', slidBoxContent = '' } = this.state;
|
|
664
|
+
const reloadTemplates = currentChannel === constants.WHATSAPP && slidBoxContent === 'editTemplate';
|
|
705
665
|
this.setState((prevState) => ({
|
|
706
666
|
...prevState,
|
|
707
667
|
templateData: undefined,
|
|
708
668
|
showSlideBox: false,
|
|
709
|
-
}), this.props.handleCloseCreatives);
|
|
669
|
+
}), () => this.props.handleCloseCreatives(reloadTemplates));
|
|
710
670
|
};
|
|
711
671
|
saveMessage = () => {
|
|
712
672
|
this.setState({ isGetFormData: true });
|
|
@@ -861,7 +821,7 @@ class Creatives extends React.Component {
|
|
|
861
821
|
}
|
|
862
822
|
render() {
|
|
863
823
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
864
|
-
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor, smsRegister} = this.props;
|
|
824
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor, smsRegister, enableNewChannels} = this.props;
|
|
865
825
|
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
866
826
|
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
867
827
|
return (
|
|
@@ -942,6 +902,7 @@ class Creatives extends React.Component {
|
|
|
942
902
|
smsRegister={smsRegister}
|
|
943
903
|
messageStrategy={this.props.strategy}
|
|
944
904
|
orgUnitId={this.props.orgUnitId}
|
|
905
|
+
enableNewChannels={enableNewChannels}
|
|
945
906
|
/>
|
|
946
907
|
}
|
|
947
908
|
footer={this.shouldShowFooter() &&
|
|
@@ -132,20 +132,6 @@
|
|
|
132
132
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
.create-new-link{
|
|
137
|
-
.ant-anchor-link {
|
|
138
|
-
display: flex;
|
|
139
|
-
|
|
140
|
-
.ant-anchor-link-title {
|
|
141
|
-
margin: 0;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.cap-link-v2-suffix {
|
|
145
|
-
margin-top: -2px;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
135
|
}
|
|
150
136
|
|
|
151
137
|
.card-title {
|
|
@@ -32,7 +32,6 @@ import { makeSelectEdit } from '../Sms/Edit/selectors';
|
|
|
32
32
|
import { makeSelectLine } from '../Line/Container/selectors';
|
|
33
33
|
import { makeSelectViber } from '../Viber/selectors';
|
|
34
34
|
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
35
|
-
import { getObjFromQueryParams } from '../../utils/v2common';
|
|
36
35
|
import messages from './messages';
|
|
37
36
|
import {checkUnicode} from '../../utils/smsCharCountV2';
|
|
38
37
|
import * as actions from './actions';
|
|
@@ -78,7 +77,7 @@ import emailIllustration from '../Assets/images/emailIllustration.svg';
|
|
|
78
77
|
import smsIllustration from '../Assets/images/smsIllustration.svg';
|
|
79
78
|
import pushIllustration from '../Assets/images/pushIllustration.svg';
|
|
80
79
|
import whatsappIllustration from '../Assets/images/whatsappIllustration.png';
|
|
81
|
-
import { CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
80
|
+
import { CAP_SPACE_16, CAP_SPACE_44 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
82
81
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
83
82
|
const { timeTracker } = GA;
|
|
84
83
|
const {CapCustomCardList} = CapCustomCard;
|
|
@@ -241,13 +240,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
241
240
|
if (this.props.location.query.type === 'embedded' && this.isEnabledInLibraryModule("setLocale")) {
|
|
242
241
|
this.setLocale();
|
|
243
242
|
}
|
|
244
|
-
|
|
245
|
-
const queryItems = getObjFromQueryParams(location.search);
|
|
246
|
-
|
|
247
|
-
if(queryItems.channel === WHATSAPP_LOWERCASE && queryItems.mode === 'create') {
|
|
248
|
-
this.createTemplate();
|
|
249
|
-
}
|
|
250
|
-
|
|
251
243
|
if (this.props.location.query.type === 'embedded') {
|
|
252
244
|
this.props.actions.resetAccount();
|
|
253
245
|
}
|
|
@@ -576,9 +568,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
576
568
|
this.getAllTemplates({getNextPage: true});
|
|
577
569
|
}
|
|
578
570
|
onCreateComplete = (isReloadTemplates) => {
|
|
579
|
-
const isWhatsappEdit = this.state.routeParams?.pathname?.includes(`${WHATSAPP_LOWERCASE}/edit`);
|
|
580
571
|
this.setState({routeParams: null, previewOpen: false}, () => {
|
|
581
|
-
if (this.isFullMode() &&
|
|
572
|
+
if (this.isFullMode() && isReloadTemplates) {
|
|
582
573
|
this.getAllTemplates({params: {}}, true);
|
|
583
574
|
}
|
|
584
575
|
});
|
|
@@ -714,16 +705,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
714
705
|
}
|
|
715
706
|
|
|
716
707
|
isStatusMatching = (status, selectedWhatsappStatus) => {
|
|
717
|
-
if(
|
|
718
|
-
|
|
719
|
-
return selectedWhatsappStatus === WHATSAPP_STATUSES.awaitingApproval;
|
|
720
|
-
}
|
|
721
|
-
return selectedWhatsappStatus === status;
|
|
722
|
-
}
|
|
723
|
-
else if (!this.props.isFullMode){
|
|
724
|
-
return status === WHATSAPP_STATUSES.approved;
|
|
708
|
+
if ( [WHATSAPP_STATUSES.unsubmitted, WHATSAPP_STATUSES.pending].includes(status) ) {
|
|
709
|
+
return selectedWhatsappStatus === WHATSAPP_STATUSES.awaitingApproval;
|
|
725
710
|
}
|
|
726
|
-
|
|
711
|
+
return selectedWhatsappStatus === status;
|
|
727
712
|
}
|
|
728
713
|
|
|
729
714
|
filterWhatsappTemplates = (templates) => {
|
|
@@ -733,7 +718,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
733
718
|
|
|
734
719
|
// if status or category filter is applied, filter templates which match these filters
|
|
735
720
|
return (
|
|
736
|
-
|
|
721
|
+
selectedWhatsappStatus
|
|
722
|
+
? this.isStatusMatching(status, selectedWhatsappStatus)
|
|
723
|
+
: true
|
|
737
724
|
) && (
|
|
738
725
|
selectedWhatsappCategory
|
|
739
726
|
? category === selectedWhatsappCategory
|
|
@@ -763,7 +750,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
763
750
|
const channelLowerCase = stateChannel.toLowerCase();
|
|
764
751
|
let filteredTemplates = templates;
|
|
765
752
|
let isTraiDltFeature = false;
|
|
766
|
-
console.log("getTemplateDataForGrid", currentChannel);
|
|
767
753
|
switch (currentChannel) {
|
|
768
754
|
case WECHAT:
|
|
769
755
|
filteredTemplates = this.filterWechatTemplates(templates);
|
|
@@ -1014,11 +1000,22 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1014
1000
|
</CapHeading>
|
|
1015
1001
|
</div> : (
|
|
1016
1002
|
[WHATSAPP_LOWERCASE].includes(this.state.channel.toLowerCase()) &&
|
|
1017
|
-
isEmpty(filteredTemplates) &&
|
|
1018
1003
|
isEmpty(this.state.searchText) &&
|
|
1019
1004
|
!isLoading &&
|
|
1020
|
-
<div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto'} : {}}>
|
|
1021
|
-
<CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />
|
|
1005
|
+
<div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto' } : {}}>
|
|
1006
|
+
{isEmpty(templates) && <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />}
|
|
1007
|
+
{!isEmpty(templates) && isEmpty(filteredTemplates) && <CapHeader
|
|
1008
|
+
title={
|
|
1009
|
+
<CapHeading type="h3" style={{ textAlign: "center", marginTop: CAP_SPACE_44 }}>
|
|
1010
|
+
{this.props.intl.formatMessage(messages.noFilteredWhatsappTemplatesTitle)}
|
|
1011
|
+
</CapHeading>
|
|
1012
|
+
}
|
|
1013
|
+
description={
|
|
1014
|
+
<CapLabel style={{ textAlign: "center" }}>
|
|
1015
|
+
{this.props.intl.formatMessage(messages.noFilteredWhatsappTemplatesDesc)}
|
|
1016
|
+
</CapLabel>
|
|
1017
|
+
}
|
|
1018
|
+
/>}
|
|
1022
1019
|
</div>
|
|
1023
1020
|
)
|
|
1024
1021
|
}
|
|
@@ -1328,7 +1325,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1328
1325
|
} else {
|
|
1329
1326
|
this.props.createNew();
|
|
1330
1327
|
}
|
|
1331
|
-
} else if (ev
|
|
1328
|
+
} else if (ev.key && (ev.key.toLowerCase() === "text" || ev.key.toLowerCase() === "image")) {
|
|
1332
1329
|
routeParams = {
|
|
1333
1330
|
pathname: `/${channel === 'line' ? 'line' : 'mobilepush'}/create/${ev.key.toLowerCase()}`,
|
|
1334
1331
|
query: type === 'embedded' ? {type: 'embedded', module} : {module},
|
|
@@ -2230,9 +2227,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2230
2227
|
setLineFilter = (e) => this.setState({lineFilter: e.target.value});
|
|
2231
2228
|
setSMSFilter = (e) => this.setState({smsFilter: e.target.value});
|
|
2232
2229
|
|
|
2233
|
-
openCreativesFullMode = () => {
|
|
2234
|
-
window.open("/creatives/ui/v2?channel=WHATSAPP&&mode=create", "_blank");
|
|
2235
|
-
}
|
|
2236
2230
|
|
|
2237
2231
|
render() {
|
|
2238
2232
|
const isFullMode = this.isFullMode();
|
|
@@ -2306,27 +2300,14 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2306
2300
|
const channelLowerCase = (channel || '').toLowerCase();
|
|
2307
2301
|
const isTraiDltFeature = this.checkDLTfeatureEnable();
|
|
2308
2302
|
|
|
2309
|
-
const createButton =
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
/>
|
|
2318
|
-
)
|
|
2319
|
-
: (
|
|
2320
|
-
<CapButton
|
|
2321
|
-
className={`create-new-${channelLowerCase}`}
|
|
2322
|
-
type={"primary"}
|
|
2323
|
-
disabled={this.isCreateDisabled()}
|
|
2324
|
-
style={{marginLeft: '8px', marginBottom: '12px'}}
|
|
2325
|
-
onClick={this.createTemplate}
|
|
2326
|
-
>
|
|
2327
|
-
{ this.props.intl.formatMessage((isTraiDltFeature && channel.toUpperCase() === SMS ) ? messages.uploadTemplate : messages.createNewActionButton) }
|
|
2328
|
-
</CapButton>
|
|
2329
|
-
);
|
|
2303
|
+
const createButton = (<CapButton
|
|
2304
|
+
className={`create-new-${channelLowerCase}`}
|
|
2305
|
+
type={"primary"}
|
|
2306
|
+
disabled={this.isCreateDisabled()}
|
|
2307
|
+
style={{marginLeft: '8px', marginBottom: '12px'}}
|
|
2308
|
+
onClick={this.createTemplate} >
|
|
2309
|
+
{ this.props.intl.formatMessage((isTraiDltFeature && channel.toUpperCase() === SMS ) ? messages.uploadTemplate : messages.createNewActionButton) }
|
|
2310
|
+
</CapButton>);
|
|
2330
2311
|
|
|
2331
2312
|
const isWhatsappCountExeeded = templatesCount >= MAX_WHATSAPP_TEMPLATES;
|
|
2332
2313
|
const whatsappCountExceedText = <FormattedMessage {...messages.whatsappMaxTemplates} values={{ maxCount: MAX_WHATSAPP_TEMPLATES }}/>;
|
|
@@ -2358,19 +2339,16 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2358
2339
|
{
|
|
2359
2340
|
channel.toUpperCase() === WHATSAPP && (
|
|
2360
2341
|
<div className="whatsapp-filters">
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
/>
|
|
2372
|
-
) : null
|
|
2373
|
-
}
|
|
2342
|
+
<CapSelectFilter
|
|
2343
|
+
placement="bottomLeft"
|
|
2344
|
+
data={STATUS_OPTIONS}
|
|
2345
|
+
onSelect={this.setWhatsappStatus}
|
|
2346
|
+
selectedValue={this.state.selectedWhatsappStatus}
|
|
2347
|
+
placeholder="Status"
|
|
2348
|
+
showBadge={true}
|
|
2349
|
+
width="90px"
|
|
2350
|
+
overlayStyle={{ overflowY: "hidden" }}
|
|
2351
|
+
/>
|
|
2374
2352
|
<CapSelectFilter
|
|
2375
2353
|
placement="bottomLeft"
|
|
2376
2354
|
data={CATEGORY_OPTIONS}
|
|
@@ -2379,6 +2357,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2379
2357
|
placeholder="Category"
|
|
2380
2358
|
showBadge={true}
|
|
2381
2359
|
width="105px"
|
|
2360
|
+
overlayStyle={{ overflowY: "hidden" }}
|
|
2382
2361
|
/>
|
|
2383
2362
|
</div>
|
|
2384
2363
|
|
|
@@ -2502,21 +2481,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2502
2481
|
|
|
2503
2482
|
<CapRow>
|
|
2504
2483
|
<Pagination onPageChange={templates.length ? this.onPaginationChange : () => {}} paginationSelector="pagination-container">
|
|
2505
|
-
|
|
2506
|
-
{
|
|
2507
|
-
channel.toLowerCase() === WHATSAPP_LOWERCASE ? (
|
|
2508
|
-
<CapAlert message={whatsappCountExceedText} type="info" />
|
|
2509
|
-
) : null
|
|
2510
|
-
}
|
|
2511
2484
|
{this.getTemplateDataForGrid({isLoading, loadingTip, channel: this.state.channel, templates: this.props.TemplatesList, filterContent, handlers: {handlePreviewClick: this.handlePreviewClick, handleEditClick: this.handleEditClick}})}
|
|
2512
2485
|
</Pagination>
|
|
2513
2486
|
{(((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) &&
|
|
2514
2487
|
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
2515
|
-
{
|
|
2516
|
-
channel.toLowerCase() === WHATSAPP_LOWERCASE ? (
|
|
2517
|
-
<CapAlert message={whatsappCountExceedText} type="info" />
|
|
2518
|
-
) : null
|
|
2519
|
-
}
|
|
2520
2488
|
<CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesFound)}</CapHeading>
|
|
2521
2489
|
</div>}
|
|
2522
2490
|
</CapRow>
|
|
@@ -274,10 +274,6 @@ export default defineMessages({
|
|
|
274
274
|
id: `${scope}.createNewActionButton`,
|
|
275
275
|
defaultMessage: `Create new`,
|
|
276
276
|
},
|
|
277
|
-
"createNewTemplateLink": {
|
|
278
|
-
id: `${scope}.createNewTemplateLink`,
|
|
279
|
-
defaultMessage: `Create new template`,
|
|
280
|
-
},
|
|
281
277
|
"creativeTemplates": {
|
|
282
278
|
id: `${scope}.creativeTemplates`,
|
|
283
279
|
defaultMessage: `Creative templates`,
|
|
@@ -346,6 +342,14 @@ export default defineMessages({
|
|
|
346
342
|
id: `${scope}.whatsappDescIllustration`,
|
|
347
343
|
defaultMessage: 'These templates can be reused when creating a\nnew message content.',
|
|
348
344
|
},
|
|
345
|
+
"noFilteredWhatsappTemplatesTitle": {
|
|
346
|
+
id: `${scope}.noFilteredWhatsappTemplatesTitle`,
|
|
347
|
+
defaultMessage: 'Sorry, we couldn’t find any matches',
|
|
348
|
+
},
|
|
349
|
+
"noFilteredWhatsappTemplatesDesc": {
|
|
350
|
+
id: `${scope}.noFilteredWhatsappTemplatesDesc`,
|
|
351
|
+
defaultMessage: 'Please try searching with another term or apply different filter',
|
|
352
|
+
},
|
|
349
353
|
"smsTitleIllustartion": {
|
|
350
354
|
id: `${scope}.smsTitleIllustartion`,
|
|
351
355
|
defaultMessage: 'Create an SMS {template}',
|
|
@@ -31,7 +31,6 @@ import withStyles from '../../hoc/withStyles';
|
|
|
31
31
|
import styles, { CapTabStyle } from './TemplatesV2.style';
|
|
32
32
|
import { CREATIVES_UI_VIEW, LOYALTY} from '../App/constants';
|
|
33
33
|
import AccessForbidden from '../../v2Components/AccessForbidden';
|
|
34
|
-
import { getObjFromQueryParams } from '../../utils/v2common';
|
|
35
34
|
|
|
36
35
|
const {CapCustomCardList} = CapCustomCard;
|
|
37
36
|
|
|
@@ -51,6 +50,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
51
50
|
isFullMode,
|
|
52
51
|
onChannelChange,
|
|
53
52
|
showDisabledFBInfo,
|
|
53
|
+
enableNewChannels,
|
|
54
54
|
} = props;
|
|
55
55
|
|
|
56
56
|
const defaultPanes = {
|
|
@@ -80,6 +80,9 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
80
80
|
filteredPanes.push({content: <></>, tab: intl.formatMessage(messages.FTP), key: 'ftp'});
|
|
81
81
|
defaultChannel = 'FTP';
|
|
82
82
|
}
|
|
83
|
+
if (!enableNewChannels.includes('WHATSAPP')) {
|
|
84
|
+
filteredPanes.splice(7, 1);
|
|
85
|
+
}
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
|
|
@@ -121,16 +124,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
121
124
|
onChannelChange(defaultChannel);
|
|
122
125
|
}
|
|
123
126
|
}
|
|
124
|
-
|
|
125
|
-
componentDidMount() {
|
|
126
|
-
const queryItems = getObjFromQueryParams(location.search);
|
|
127
|
-
|
|
128
|
-
if(queryItems.channel === 'whatsapp') {
|
|
129
|
-
console.log("reached whatsapp content");
|
|
130
|
-
this.channelChange('whatsapp');
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
127
|
componentWillReceiveProps(nextProps) {
|
|
135
128
|
if (this.props.channel !== nextProps.channel) {
|
|
136
129
|
const panes = this.setChannelContent(nextProps.channel, this.state.panes);
|