@capillarytech/creatives-library 7.10.49 → 7.10.50
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 +13 -0
- package/v2Components/TemplatePreview/assets/images/whatsapp_mobile_android.svg +2041 -1
- package/v2Components/TemplatePreview/index.js +27 -38
- package/v2Components/TemplatePreview/messages.js +0 -4
- package/v2Containers/CreativesContainer/SlideBoxContent.js +3 -2
- package/v2Containers/CreativesContainer/index.js +46 -7
- package/v2Containers/Templates/_templates.scss +14 -0
- package/v2Containers/Templates/index.js +74 -42
- package/v2Containers/Templates/messages.js +4 -8
- package/v2Containers/TemplatesV2/index.js +11 -4
- package/v2Containers/Whatsapp/index.js +84 -16
- package/v2Containers/Whatsapp/messages.js +9 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +5932 -33286
- package/v2Containers/Whatsapp/tests/index.test.js +9 -49
- package/v2Containers/Whatsapp/tests/mockData.js +1 -120
|
@@ -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,
|
|
140
|
+
const { channel, showTestAndPreviewIcon, module, viberBrandName, viberAccountName, whatsappAccountName, intl, templateData } = this.props;
|
|
141
141
|
const { formatMessage } = intl;
|
|
142
142
|
const { buttonText, imageURL, messageContent: viberMessageContent } = content || {};
|
|
143
143
|
let smsDetails = {};
|
|
@@ -663,46 +663,35 @@ 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
|
-
|
|
666
|
+
<div className="shell-v2 align-center" id="sms-preview">
|
|
667
|
+
<CapImage
|
|
668
|
+
className="preview-image"
|
|
669
|
+
src={whatsappMobileAndroid}
|
|
670
|
+
alt={formatMessage(messages.previewGenerated)}
|
|
671
|
+
/>
|
|
672
|
+
<div className='whatsapp-brand-name'>{whatsappAccountName || ""}</div>
|
|
673
|
+
<div
|
|
674
|
+
className="msgContainer"
|
|
675
|
+
style={{
|
|
676
|
+
maxHeight: 292,
|
|
677
|
+
marginLeft: 28,
|
|
678
|
+
}}
|
|
679
|
+
>
|
|
676
680
|
<div
|
|
677
|
-
className="
|
|
678
|
-
style={
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
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>
|
|
681
|
+
className="message-pop align-left"
|
|
682
|
+
style={whatsappSectionStyle}>
|
|
683
|
+
<p
|
|
684
|
+
style={{
|
|
685
|
+
"color": CAP_G16,
|
|
686
|
+
"margin": '1.5px 6px 1px 7px',
|
|
687
|
+
}}>{content?.templateMsg || ''}
|
|
688
|
+
</p>
|
|
689
|
+
<div style={{ paddingBottom: CAP_SPACE_08 }}></div>
|
|
697
690
|
</div>
|
|
698
691
|
</div>
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
</>
|
|
703
|
-
) : (
|
|
704
|
-
''
|
|
705
|
-
)}
|
|
692
|
+
</div>
|
|
693
|
+
) : ('')
|
|
694
|
+
}
|
|
706
695
|
{channel && channel.toLowerCase() === FACEBOOK && (
|
|
707
696
|
<div style={{position: 'absolute', left: '80%'}} id="facebook-preview">
|
|
708
697
|
<CapFacebookPreview
|
|
@@ -34,10 +34,6 @@ 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
|
-
},
|
|
41
37
|
smsFormatType: {
|
|
42
38
|
id: 'creatives.componentsV2.TemplatePreview.smsFormatType',
|
|
43
39
|
defaultMessage: 'Message has unicode characters',
|
|
@@ -145,7 +145,6 @@ function SlideBoxContent(props) {
|
|
|
145
145
|
showDisabledFBInfo,
|
|
146
146
|
orgUnitId,
|
|
147
147
|
smsRegister,
|
|
148
|
-
enableNewChannels,
|
|
149
148
|
} = props;
|
|
150
149
|
const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
151
150
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
|
|
@@ -365,7 +364,6 @@ function SlideBoxContent(props) {
|
|
|
365
364
|
showDisabledFBInfo={showDisabledFBInfo}
|
|
366
365
|
orgUnitId={orgUnitId}
|
|
367
366
|
smsRegister={smsRegister}
|
|
368
|
-
enableNewChannels={enableNewChannels}
|
|
369
367
|
/>
|
|
370
368
|
)}
|
|
371
369
|
{isPreview && (
|
|
@@ -699,6 +697,9 @@ function SlideBoxContent(props) {
|
|
|
699
697
|
{isEditWhatsapp && (<Whatsapp
|
|
700
698
|
isFullMode={isFullMode}
|
|
701
699
|
templateData={templateData}
|
|
700
|
+
getFormData={getFormData}
|
|
701
|
+
getDefaultTags={type}
|
|
702
|
+
forwardedTags={forwardedTags}
|
|
702
703
|
params={{
|
|
703
704
|
id: templateData._id,
|
|
704
705
|
}}
|
|
@@ -364,6 +364,28 @@ 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
|
+
}
|
|
367
389
|
default:
|
|
368
390
|
break;
|
|
369
391
|
}
|
|
@@ -420,8 +442,8 @@ class Creatives extends React.Component {
|
|
|
420
442
|
if (get(template, "value.versions.base")) {
|
|
421
443
|
const mobilpushTemplate = template.value;
|
|
422
444
|
templateData.accountId = get(mobilpushTemplate, 'definition.accountId');
|
|
423
|
-
const type = (get(this.props,
|
|
424
|
-
if
|
|
445
|
+
const type = (get(this.props,"messageDetails.type") || '').toLowerCase();
|
|
446
|
+
if(type === LOYALTY){
|
|
425
447
|
templateData.licenseCode = get(mobilpushTemplate, 'definition.licenseCode');
|
|
426
448
|
}
|
|
427
449
|
const androidContent = get(mobilpushTemplate, 'versions.base.ANDROID');
|
|
@@ -495,6 +517,26 @@ class Creatives extends React.Component {
|
|
|
495
517
|
};
|
|
496
518
|
}
|
|
497
519
|
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;
|
|
498
540
|
case constants.FACEBOOK: {
|
|
499
541
|
if (template.value) {
|
|
500
542
|
const FacebookAd = template?.value?.versions?.base?.content?.FacebookAd;
|
|
@@ -660,13 +702,11 @@ class Creatives extends React.Component {
|
|
|
660
702
|
});
|
|
661
703
|
}
|
|
662
704
|
handleCloseSlideBox = () => {
|
|
663
|
-
const { currentChannel = '', slidBoxContent = '' } = this.state;
|
|
664
|
-
const reloadTemplates = currentChannel === constants.WHATSAPP && slidBoxContent === 'editTemplate';
|
|
665
705
|
this.setState((prevState) => ({
|
|
666
706
|
...prevState,
|
|
667
707
|
templateData: undefined,
|
|
668
708
|
showSlideBox: false,
|
|
669
|
-
}),
|
|
709
|
+
}), this.props.handleCloseCreatives);
|
|
670
710
|
};
|
|
671
711
|
saveMessage = () => {
|
|
672
712
|
this.setState({ isGetFormData: true });
|
|
@@ -821,7 +861,7 @@ class Creatives extends React.Component {
|
|
|
821
861
|
}
|
|
822
862
|
render() {
|
|
823
863
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
824
|
-
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor, smsRegister
|
|
864
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor, smsRegister} = this.props;
|
|
825
865
|
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
826
866
|
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
827
867
|
return (
|
|
@@ -902,7 +942,6 @@ class Creatives extends React.Component {
|
|
|
902
942
|
smsRegister={smsRegister}
|
|
903
943
|
messageStrategy={this.props.strategy}
|
|
904
944
|
orgUnitId={this.props.orgUnitId}
|
|
905
|
-
enableNewChannels={enableNewChannels}
|
|
906
945
|
/>
|
|
907
946
|
}
|
|
908
947
|
footer={this.shouldShowFooter() &&
|
|
@@ -132,6 +132,20 @@
|
|
|
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
|
+
}
|
|
135
149
|
}
|
|
136
150
|
|
|
137
151
|
.card-title {
|
|
@@ -32,6 +32,7 @@ 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';
|
|
35
36
|
import messages from './messages';
|
|
36
37
|
import {checkUnicode} from '../../utils/smsCharCountV2';
|
|
37
38
|
import * as actions from './actions';
|
|
@@ -77,7 +78,7 @@ import emailIllustration from '../Assets/images/emailIllustration.svg';
|
|
|
77
78
|
import smsIllustration from '../Assets/images/smsIllustration.svg';
|
|
78
79
|
import pushIllustration from '../Assets/images/pushIllustration.svg';
|
|
79
80
|
import whatsappIllustration from '../Assets/images/whatsappIllustration.png';
|
|
80
|
-
import { CAP_SPACE_16
|
|
81
|
+
import { CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
81
82
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
82
83
|
const { timeTracker } = GA;
|
|
83
84
|
const {CapCustomCardList} = CapCustomCard;
|
|
@@ -240,6 +241,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
240
241
|
if (this.props.location.query.type === 'embedded' && this.isEnabledInLibraryModule("setLocale")) {
|
|
241
242
|
this.setLocale();
|
|
242
243
|
}
|
|
244
|
+
|
|
245
|
+
const queryItems = getObjFromQueryParams(location.search);
|
|
246
|
+
|
|
247
|
+
if(queryItems.channel === WHATSAPP_LOWERCASE && queryItems.mode === 'create') {
|
|
248
|
+
this.createTemplate();
|
|
249
|
+
}
|
|
250
|
+
|
|
243
251
|
if (this.props.location.query.type === 'embedded') {
|
|
244
252
|
this.props.actions.resetAccount();
|
|
245
253
|
}
|
|
@@ -568,8 +576,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
568
576
|
this.getAllTemplates({getNextPage: true});
|
|
569
577
|
}
|
|
570
578
|
onCreateComplete = (isReloadTemplates) => {
|
|
579
|
+
const isWhatsappEdit = this.state.routeParams?.pathname?.includes(`${WHATSAPP_LOWERCASE}/edit`);
|
|
571
580
|
this.setState({routeParams: null, previewOpen: false}, () => {
|
|
572
|
-
if (this.isFullMode() && isReloadTemplates) {
|
|
581
|
+
if (this.isFullMode() && (isReloadTemplates || isWhatsappEdit)) {
|
|
573
582
|
this.getAllTemplates({params: {}}, true);
|
|
574
583
|
}
|
|
575
584
|
});
|
|
@@ -705,10 +714,16 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
705
714
|
}
|
|
706
715
|
|
|
707
716
|
isStatusMatching = (status, selectedWhatsappStatus) => {
|
|
708
|
-
if
|
|
709
|
-
|
|
717
|
+
if(this.props.isFullMode && selectedWhatsappStatus) {
|
|
718
|
+
if ( [WHATSAPP_STATUSES.unsubmitted, WHATSAPP_STATUSES.pending].includes(status) ) {
|
|
719
|
+
return selectedWhatsappStatus === WHATSAPP_STATUSES.awaitingApproval;
|
|
720
|
+
}
|
|
721
|
+
return selectedWhatsappStatus === status;
|
|
722
|
+
}
|
|
723
|
+
else if (!this.props.isFullMode){
|
|
724
|
+
return status === WHATSAPP_STATUSES.approved;
|
|
710
725
|
}
|
|
711
|
-
|
|
726
|
+
return true;
|
|
712
727
|
}
|
|
713
728
|
|
|
714
729
|
filterWhatsappTemplates = (templates) => {
|
|
@@ -718,9 +733,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
718
733
|
|
|
719
734
|
// if status or category filter is applied, filter templates which match these filters
|
|
720
735
|
return (
|
|
721
|
-
selectedWhatsappStatus
|
|
722
|
-
? this.isStatusMatching(status, selectedWhatsappStatus)
|
|
723
|
-
: true
|
|
736
|
+
this.isStatusMatching(status, selectedWhatsappStatus)
|
|
724
737
|
) && (
|
|
725
738
|
selectedWhatsappCategory
|
|
726
739
|
? category === selectedWhatsappCategory
|
|
@@ -750,6 +763,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
750
763
|
const channelLowerCase = stateChannel.toLowerCase();
|
|
751
764
|
let filteredTemplates = templates;
|
|
752
765
|
let isTraiDltFeature = false;
|
|
766
|
+
console.log("getTemplateDataForGrid", currentChannel);
|
|
753
767
|
switch (currentChannel) {
|
|
754
768
|
case WECHAT:
|
|
755
769
|
filteredTemplates = this.filterWechatTemplates(templates);
|
|
@@ -1000,22 +1014,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1000
1014
|
</CapHeading>
|
|
1001
1015
|
</div> : (
|
|
1002
1016
|
[WHATSAPP_LOWERCASE].includes(this.state.channel.toLowerCase()) &&
|
|
1017
|
+
isEmpty(filteredTemplates) &&
|
|
1003
1018
|
isEmpty(this.state.searchText) &&
|
|
1004
1019
|
!isLoading &&
|
|
1005
|
-
<div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto'
|
|
1006
|
-
|
|
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
|
-
/>}
|
|
1020
|
+
<div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto'} : {}}>
|
|
1021
|
+
<CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />
|
|
1019
1022
|
</div>
|
|
1020
1023
|
)
|
|
1021
1024
|
}
|
|
@@ -1325,7 +1328,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1325
1328
|
} else {
|
|
1326
1329
|
this.props.createNew();
|
|
1327
1330
|
}
|
|
1328
|
-
} else if (ev
|
|
1331
|
+
} else if (ev?.key && (ev.key.toLowerCase() === "text" || ev.key.toLowerCase() === "image")) {
|
|
1329
1332
|
routeParams = {
|
|
1330
1333
|
pathname: `/${channel === 'line' ? 'line' : 'mobilepush'}/create/${ev.key.toLowerCase()}`,
|
|
1331
1334
|
query: type === 'embedded' ? {type: 'embedded', module} : {module},
|
|
@@ -2227,6 +2230,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2227
2230
|
setLineFilter = (e) => this.setState({lineFilter: e.target.value});
|
|
2228
2231
|
setSMSFilter = (e) => this.setState({smsFilter: e.target.value});
|
|
2229
2232
|
|
|
2233
|
+
openCreativesFullMode = () => {
|
|
2234
|
+
window.open("/creatives/ui/v2?channel=WHATSAPP&&mode=create", "_blank");
|
|
2235
|
+
}
|
|
2230
2236
|
|
|
2231
2237
|
render() {
|
|
2232
2238
|
const isFullMode = this.isFullMode();
|
|
@@ -2300,14 +2306,27 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2300
2306
|
const channelLowerCase = (channel || '').toLowerCase();
|
|
2301
2307
|
const isTraiDltFeature = this.checkDLTfeatureEnable();
|
|
2302
2308
|
|
|
2303
|
-
const createButton =
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2309
|
+
const createButton =
|
|
2310
|
+
( channelLowerCase === WHATSAPP_LOWERCASE && !this.props.isFullMode )
|
|
2311
|
+
? (
|
|
2312
|
+
<CapLink
|
|
2313
|
+
onClick={this.openCreativesFullMode}
|
|
2314
|
+
title={formatMessage(messages.createNewTemplateLink)}
|
|
2315
|
+
suffix={<CapIcon type="open-in-new" size="s" />}
|
|
2316
|
+
className="create-new-link"
|
|
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
|
+
);
|
|
2311
2330
|
|
|
2312
2331
|
const isWhatsappCountExeeded = templatesCount >= MAX_WHATSAPP_TEMPLATES;
|
|
2313
2332
|
const whatsappCountExceedText = <FormattedMessage {...messages.whatsappMaxTemplates} values={{ maxCount: MAX_WHATSAPP_TEMPLATES }}/>;
|
|
@@ -2339,16 +2358,19 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2339
2358
|
{
|
|
2340
2359
|
channel.toUpperCase() === WHATSAPP && (
|
|
2341
2360
|
<div className="whatsapp-filters">
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2361
|
+
{
|
|
2362
|
+
this.props.isFullMode ? (
|
|
2363
|
+
<CapSelectFilter
|
|
2364
|
+
placement="bottomLeft"
|
|
2365
|
+
data={STATUS_OPTIONS}
|
|
2366
|
+
onSelect={this.setWhatsappStatus}
|
|
2367
|
+
selectedValue={this.state.selectedWhatsappStatus}
|
|
2368
|
+
placeholder="Status"
|
|
2369
|
+
showBadge={true}
|
|
2370
|
+
width="90px"
|
|
2371
|
+
/>
|
|
2372
|
+
) : null
|
|
2373
|
+
}
|
|
2352
2374
|
<CapSelectFilter
|
|
2353
2375
|
placement="bottomLeft"
|
|
2354
2376
|
data={CATEGORY_OPTIONS}
|
|
@@ -2357,7 +2379,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2357
2379
|
placeholder="Category"
|
|
2358
2380
|
showBadge={true}
|
|
2359
2381
|
width="105px"
|
|
2360
|
-
overlayStyle={{ overflowY: "hidden" }}
|
|
2361
2382
|
/>
|
|
2362
2383
|
</div>
|
|
2363
2384
|
|
|
@@ -2481,10 +2502,21 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2481
2502
|
|
|
2482
2503
|
<CapRow>
|
|
2483
2504
|
<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
|
+
}
|
|
2484
2511
|
{this.getTemplateDataForGrid({isLoading, loadingTip, channel: this.state.channel, templates: this.props.TemplatesList, filterContent, handlers: {handlePreviewClick: this.handlePreviewClick, handleEditClick: this.handleEditClick}})}
|
|
2485
2512
|
</Pagination>
|
|
2486
2513
|
{(((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) &&
|
|
2487
2514
|
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
2515
|
+
{
|
|
2516
|
+
channel.toLowerCase() === WHATSAPP_LOWERCASE ? (
|
|
2517
|
+
<CapAlert message={whatsappCountExceedText} type="info" />
|
|
2518
|
+
) : null
|
|
2519
|
+
}
|
|
2488
2520
|
<CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesFound)}</CapHeading>
|
|
2489
2521
|
</div>}
|
|
2490
2522
|
</CapRow>
|
|
@@ -274,6 +274,10 @@ 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
|
+
},
|
|
277
281
|
"creativeTemplates": {
|
|
278
282
|
id: `${scope}.creativeTemplates`,
|
|
279
283
|
defaultMessage: `Creative templates`,
|
|
@@ -342,14 +346,6 @@ export default defineMessages({
|
|
|
342
346
|
id: `${scope}.whatsappDescIllustration`,
|
|
343
347
|
defaultMessage: 'These templates can be reused when creating a\nnew message content.',
|
|
344
348
|
},
|
|
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
|
-
},
|
|
353
349
|
"smsTitleIllustartion": {
|
|
354
350
|
id: `${scope}.smsTitleIllustartion`,
|
|
355
351
|
defaultMessage: 'Create an SMS {template}',
|
|
@@ -31,6 +31,7 @@ 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';
|
|
34
35
|
|
|
35
36
|
const {CapCustomCardList} = CapCustomCard;
|
|
36
37
|
|
|
@@ -50,7 +51,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
50
51
|
isFullMode,
|
|
51
52
|
onChannelChange,
|
|
52
53
|
showDisabledFBInfo,
|
|
53
|
-
enableNewChannels,
|
|
54
54
|
} = props;
|
|
55
55
|
|
|
56
56
|
const defaultPanes = {
|
|
@@ -80,9 +80,6 @@ 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
|
-
}
|
|
86
83
|
}
|
|
87
84
|
|
|
88
85
|
|
|
@@ -124,6 +121,16 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
124
121
|
onChannelChange(defaultChannel);
|
|
125
122
|
}
|
|
126
123
|
}
|
|
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
|
+
|
|
127
134
|
componentWillReceiveProps(nextProps) {
|
|
128
135
|
if (this.props.channel !== nextProps.channel) {
|
|
129
136
|
const panes = this.setChannelContent(nextProps.channel, this.state.panes);
|