@capillarytech/creatives-library 7.10.48 → 7.10.49
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/v2Components/TemplatePreview/assets/images/whatsapp_mobile_android.svg +1 -2041
- package/v2Components/TemplatePreview/index.js +38 -27
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +2 -1
- package/v2Containers/CreativesContainer/index.js +7 -47
- package/v2Containers/Templates/index.js +34 -44
- package/v2Containers/Templates/messages.js +8 -0
- package/v2Containers/TemplatesV2/index.js +4 -0
- package/v2Containers/Whatsapp/index.js +16 -40
- package/v2Containers/Whatsapp/messages.js +0 -4
- 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
|
@@ -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={{ margin: '24px 0px 0px 36px' }}>
|
|
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,7 +699,6 @@ function SlideBoxContent(props) {
|
|
|
697
699
|
{isEditWhatsapp && (<Whatsapp
|
|
698
700
|
isFullMode={isFullMode}
|
|
699
701
|
templateData={templateData}
|
|
700
|
-
getFormData={getFormData}
|
|
701
702
|
params={{
|
|
702
703
|
id: templateData._id,
|
|
703
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,27 +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
|
-
console.log("accountDetailsaccountDetails", accountDetails, accountDetails.name)
|
|
530
|
-
templateData = {
|
|
531
|
-
channel,
|
|
532
|
-
accountId,
|
|
533
|
-
accountName: accountDetails.name,
|
|
534
|
-
messageBody: JSON.stringify(whatsappContent.languages[0].content),
|
|
535
|
-
category: whatsappContent.category,
|
|
536
|
-
language: whatsappContent.languages[0].language,
|
|
537
|
-
mediaType: whatsappContent.mediaType,
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
break;
|
|
541
498
|
case constants.FACEBOOK: {
|
|
542
499
|
if (template.value) {
|
|
543
500
|
const FacebookAd = template?.value?.versions?.base?.content?.FacebookAd;
|
|
@@ -703,11 +660,13 @@ class Creatives extends React.Component {
|
|
|
703
660
|
});
|
|
704
661
|
}
|
|
705
662
|
handleCloseSlideBox = () => {
|
|
663
|
+
const { currentChannel = '', slidBoxContent = '' } = this.state;
|
|
664
|
+
const reloadTemplates = currentChannel === constants.WHATSAPP && slidBoxContent === 'editTemplate';
|
|
706
665
|
this.setState((prevState) => ({
|
|
707
666
|
...prevState,
|
|
708
667
|
templateData: undefined,
|
|
709
668
|
showSlideBox: false,
|
|
710
|
-
}), this.props.handleCloseCreatives);
|
|
669
|
+
}), () => this.props.handleCloseCreatives(reloadTemplates));
|
|
711
670
|
};
|
|
712
671
|
saveMessage = () => {
|
|
713
672
|
this.setState({ isGetFormData: true });
|
|
@@ -862,7 +821,7 @@ class Creatives extends React.Component {
|
|
|
862
821
|
}
|
|
863
822
|
render() {
|
|
864
823
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
865
|
-
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;
|
|
866
825
|
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
867
826
|
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
868
827
|
return (
|
|
@@ -943,6 +902,7 @@ class Creatives extends React.Component {
|
|
|
943
902
|
smsRegister={smsRegister}
|
|
944
903
|
messageStrategy={this.props.strategy}
|
|
945
904
|
orgUnitId={this.props.orgUnitId}
|
|
905
|
+
enableNewChannels={enableNewChannels}
|
|
946
906
|
/>
|
|
947
907
|
}
|
|
948
908
|
footer={this.shouldShowFooter() &&
|
|
@@ -77,7 +77,7 @@ import emailIllustration from '../Assets/images/emailIllustration.svg';
|
|
|
77
77
|
import smsIllustration from '../Assets/images/smsIllustration.svg';
|
|
78
78
|
import pushIllustration from '../Assets/images/pushIllustration.svg';
|
|
79
79
|
import whatsappIllustration from '../Assets/images/whatsappIllustration.png';
|
|
80
|
-
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';
|
|
81
81
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
82
82
|
const { timeTracker } = GA;
|
|
83
83
|
const {CapCustomCardList} = CapCustomCard;
|
|
@@ -568,9 +568,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
568
568
|
this.getAllTemplates({getNextPage: true});
|
|
569
569
|
}
|
|
570
570
|
onCreateComplete = (isReloadTemplates) => {
|
|
571
|
-
const isWhatsappEdit = this.state.routeParams?.pathname?.includes(`${WHATSAPP_LOWERCASE}/edit`);
|
|
572
571
|
this.setState({routeParams: null, previewOpen: false}, () => {
|
|
573
|
-
if (this.isFullMode() &&
|
|
572
|
+
if (this.isFullMode() && isReloadTemplates) {
|
|
574
573
|
this.getAllTemplates({params: {}}, true);
|
|
575
574
|
}
|
|
576
575
|
});
|
|
@@ -706,16 +705,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
706
705
|
}
|
|
707
706
|
|
|
708
707
|
isStatusMatching = (status, selectedWhatsappStatus) => {
|
|
709
|
-
if(
|
|
710
|
-
|
|
711
|
-
return selectedWhatsappStatus === WHATSAPP_STATUSES.awaitingApproval;
|
|
712
|
-
}
|
|
713
|
-
return selectedWhatsappStatus === status;
|
|
714
|
-
}
|
|
715
|
-
else if (!this.props.isFullMode){
|
|
716
|
-
return status === WHATSAPP_STATUSES.approved;
|
|
708
|
+
if ( [WHATSAPP_STATUSES.unsubmitted, WHATSAPP_STATUSES.pending].includes(status) ) {
|
|
709
|
+
return selectedWhatsappStatus === WHATSAPP_STATUSES.awaitingApproval;
|
|
717
710
|
}
|
|
718
|
-
|
|
711
|
+
return selectedWhatsappStatus === status;
|
|
719
712
|
}
|
|
720
713
|
|
|
721
714
|
filterWhatsappTemplates = (templates) => {
|
|
@@ -725,7 +718,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
725
718
|
|
|
726
719
|
// if status or category filter is applied, filter templates which match these filters
|
|
727
720
|
return (
|
|
728
|
-
|
|
721
|
+
selectedWhatsappStatus
|
|
722
|
+
? this.isStatusMatching(status, selectedWhatsappStatus)
|
|
723
|
+
: true
|
|
729
724
|
) && (
|
|
730
725
|
selectedWhatsappCategory
|
|
731
726
|
? category === selectedWhatsappCategory
|
|
@@ -755,7 +750,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
755
750
|
const channelLowerCase = stateChannel.toLowerCase();
|
|
756
751
|
let filteredTemplates = templates;
|
|
757
752
|
let isTraiDltFeature = false;
|
|
758
|
-
console.log("getTemplateDataForGrid", currentChannel);
|
|
759
753
|
switch (currentChannel) {
|
|
760
754
|
case WECHAT:
|
|
761
755
|
filteredTemplates = this.filterWechatTemplates(templates);
|
|
@@ -1006,11 +1000,22 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1006
1000
|
</CapHeading>
|
|
1007
1001
|
</div> : (
|
|
1008
1002
|
[WHATSAPP_LOWERCASE].includes(this.state.channel.toLowerCase()) &&
|
|
1009
|
-
isEmpty(filteredTemplates) &&
|
|
1010
1003
|
isEmpty(this.state.searchText) &&
|
|
1011
1004
|
!isLoading &&
|
|
1012
|
-
<div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto'} : {}}>
|
|
1013
|
-
<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
|
+
/>}
|
|
1014
1019
|
</div>
|
|
1015
1020
|
)
|
|
1016
1021
|
}
|
|
@@ -2300,9 +2305,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2300
2305
|
type={"primary"}
|
|
2301
2306
|
disabled={this.isCreateDisabled()}
|
|
2302
2307
|
style={{marginLeft: '8px', marginBottom: '12px'}}
|
|
2303
|
-
onClick={this.createTemplate}
|
|
2304
|
-
target={channelLowerCase === WHATSAPP_LOWERCASE && !this.props.isFullMode ? "_blank" : null}
|
|
2305
|
-
>
|
|
2308
|
+
onClick={this.createTemplate} >
|
|
2306
2309
|
{ this.props.intl.formatMessage((isTraiDltFeature && channel.toUpperCase() === SMS ) ? messages.uploadTemplate : messages.createNewActionButton) }
|
|
2307
2310
|
</CapButton>);
|
|
2308
2311
|
|
|
@@ -2336,19 +2339,16 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2336
2339
|
{
|
|
2337
2340
|
channel.toUpperCase() === WHATSAPP && (
|
|
2338
2341
|
<div className="whatsapp-filters">
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
/>
|
|
2350
|
-
) : null
|
|
2351
|
-
}
|
|
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
|
+
/>
|
|
2352
2352
|
<CapSelectFilter
|
|
2353
2353
|
placement="bottomLeft"
|
|
2354
2354
|
data={CATEGORY_OPTIONS}
|
|
@@ -2357,6 +2357,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2357
2357
|
placeholder="Category"
|
|
2358
2358
|
showBadge={true}
|
|
2359
2359
|
width="105px"
|
|
2360
|
+
overlayStyle={{ overflowY: "hidden" }}
|
|
2360
2361
|
/>
|
|
2361
2362
|
</div>
|
|
2362
2363
|
|
|
@@ -2480,21 +2481,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2480
2481
|
|
|
2481
2482
|
<CapRow>
|
|
2482
2483
|
<Pagination onPageChange={templates.length ? this.onPaginationChange : () => {}} paginationSelector="pagination-container">
|
|
2483
|
-
|
|
2484
|
-
{
|
|
2485
|
-
channel.toLowerCase() === WHATSAPP_LOWERCASE ? (
|
|
2486
|
-
<CapAlert message={whatsappCountExceedText} type="info" />
|
|
2487
|
-
) : null
|
|
2488
|
-
}
|
|
2489
2484
|
{this.getTemplateDataForGrid({isLoading, loadingTip, channel: this.state.channel, templates: this.props.TemplatesList, filterContent, handlers: {handlePreviewClick: this.handlePreviewClick, handleEditClick: this.handleEditClick}})}
|
|
2490
2485
|
</Pagination>
|
|
2491
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) &&
|
|
2492
2487
|
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
2493
|
-
{
|
|
2494
|
-
channel.toLowerCase() === WHATSAPP_LOWERCASE ? (
|
|
2495
|
-
<CapAlert message={whatsappCountExceedText} type="info" />
|
|
2496
|
-
) : null
|
|
2497
|
-
}
|
|
2498
2488
|
<CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesFound)}</CapHeading>
|
|
2499
2489
|
</div>}
|
|
2500
2490
|
</CapRow>
|
|
@@ -342,6 +342,14 @@ export default defineMessages({
|
|
|
342
342
|
id: `${scope}.whatsappDescIllustration`,
|
|
343
343
|
defaultMessage: 'These templates can be reused when creating a\nnew message content.',
|
|
344
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
|
+
},
|
|
345
353
|
"smsTitleIllustartion": {
|
|
346
354
|
id: `${scope}.smsTitleIllustartion`,
|
|
347
355
|
defaultMessage: 'Create an SMS {template}',
|
|
@@ -50,6 +50,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
50
50
|
isFullMode,
|
|
51
51
|
onChannelChange,
|
|
52
52
|
showDisabledFBInfo,
|
|
53
|
+
enableNewChannels,
|
|
53
54
|
} = props;
|
|
54
55
|
|
|
55
56
|
const defaultPanes = {
|
|
@@ -79,6 +80,9 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
79
80
|
filteredPanes.push({content: <></>, tab: intl.formatMessage(messages.FTP), key: 'ftp'});
|
|
80
81
|
defaultChannel = 'FTP';
|
|
81
82
|
}
|
|
83
|
+
if (!enableNewChannels.includes('WHATSAPP')) {
|
|
84
|
+
filteredPanes.splice(7, 1);
|
|
85
|
+
}
|
|
82
86
|
}
|
|
83
87
|
|
|
84
88
|
|
|
@@ -73,7 +73,6 @@ export const Whatsapp = (props) => {
|
|
|
73
73
|
metaEntities,
|
|
74
74
|
injectedTags,
|
|
75
75
|
loadingTags,
|
|
76
|
-
getFormData
|
|
77
76
|
} = props || {};
|
|
78
77
|
const { formatMessage } = intl;
|
|
79
78
|
const { TextArea } = CapInput;
|
|
@@ -92,9 +91,7 @@ export const Whatsapp = (props) => {
|
|
|
92
91
|
//for edit only
|
|
93
92
|
const [isEditFlow, setEditFlow] = useState(false);
|
|
94
93
|
const [templateDate, setTemplateDate] = useState('');
|
|
95
|
-
const [templateStatus, setTemplateStatus] = useState(
|
|
96
|
-
WHATSAPP_STATUSES.unsubmitted,
|
|
97
|
-
);
|
|
94
|
+
const [templateStatus, setTemplateStatus] = useState();
|
|
98
95
|
const [templateRejectionReason, setTemplateRejectionReason] = useState(null);
|
|
99
96
|
const [tempMsgArray, updateTempMsgArray] = useState([]);
|
|
100
97
|
const [updatedSmsEditor, setUpdatedSmsEditor] = useState([]);
|
|
@@ -111,8 +108,7 @@ export const Whatsapp = (props) => {
|
|
|
111
108
|
width: 100%;
|
|
112
109
|
margin-left: -32px;
|
|
113
110
|
padding: ${CAP_SPACE_32} ${CAP_SPACE_24};
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
|
|
116
112
|
.ant-btn {
|
|
117
113
|
margin-right: ${CAP_SPACE_16};
|
|
118
114
|
}
|
|
@@ -144,6 +140,7 @@ export const Whatsapp = (props) => {
|
|
|
144
140
|
setSpin(true);
|
|
145
141
|
actions.getTemplateDetails(id);
|
|
146
142
|
}
|
|
143
|
+
setEditFlow(true);
|
|
147
144
|
}
|
|
148
145
|
//cleanup code
|
|
149
146
|
return () => {
|
|
@@ -157,10 +154,9 @@ export const Whatsapp = (props) => {
|
|
|
157
154
|
name = '',
|
|
158
155
|
versions = {},
|
|
159
156
|
createdAt = '',
|
|
160
|
-
} =
|
|
157
|
+
} = editData.templateDetails || templateData || {};
|
|
161
158
|
editContent = get(versions, `base.content.whatsapp`, {});
|
|
162
159
|
if (editContent && !isEmpty(editContent)) {
|
|
163
|
-
setEditFlow(true);
|
|
164
160
|
setTemplateName(name);
|
|
165
161
|
setTemplateDate(createdAt);
|
|
166
162
|
const {
|
|
@@ -471,16 +467,13 @@ export const Whatsapp = (props) => {
|
|
|
471
467
|
languages: [
|
|
472
468
|
{
|
|
473
469
|
language: 'en',
|
|
474
|
-
content:
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
: `$'${templateMessage}\nClick {{${
|
|
478
|
-
addedVarCount + 1 }}} to unsubscribe'`,
|
|
470
|
+
content: `$'${templateMessage}\nClick {{${
|
|
471
|
+
addedVarCount + 1
|
|
472
|
+
}}} to unsubscribe'`,
|
|
479
473
|
},
|
|
480
474
|
],
|
|
481
|
-
mediaType: '
|
|
482
|
-
varMapped:
|
|
483
|
-
templateEditor: templateMessage,
|
|
475
|
+
mediaType: 'text',
|
|
476
|
+
varMapped: {},
|
|
484
477
|
accountId,
|
|
485
478
|
accessToken,
|
|
486
479
|
accountName,
|
|
@@ -525,15 +518,6 @@ export const Whatsapp = (props) => {
|
|
|
525
518
|
}
|
|
526
519
|
};
|
|
527
520
|
|
|
528
|
-
const saveToMessage = () => {
|
|
529
|
-
getFormData({
|
|
530
|
-
value: createPayload(),
|
|
531
|
-
_id: params?.paramObj?.id,
|
|
532
|
-
validity: true,
|
|
533
|
-
type: 'WHATSAPP',
|
|
534
|
-
});
|
|
535
|
-
}
|
|
536
|
-
|
|
537
521
|
const isDisableDone = () => {
|
|
538
522
|
//if template name is not entered
|
|
539
523
|
if (templateName.trim() === '' || templateNameError) {
|
|
@@ -791,10 +775,12 @@ export const Whatsapp = (props) => {
|
|
|
791
775
|
|
|
792
776
|
const editModeContent = (
|
|
793
777
|
<>
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
778
|
+
{templateStatus && (
|
|
779
|
+
<CapAlert
|
|
780
|
+
message={getTemplateStatusMessage()}
|
|
781
|
+
type={getTemplateStatusType()}
|
|
782
|
+
/>
|
|
783
|
+
)}
|
|
798
784
|
<CapRow className="whatsapp-render-heading">
|
|
799
785
|
<CapHeader
|
|
800
786
|
title={
|
|
@@ -848,6 +834,7 @@ export const Whatsapp = (props) => {
|
|
|
848
834
|
<TemplatePreview
|
|
849
835
|
channel={WHATSAPP}
|
|
850
836
|
content={{ templateMsg }}
|
|
837
|
+
whatsappContentLen={isEditFlow ? updatedSmsEditor.join('').length : templateMessage.length}
|
|
851
838
|
whatsappAccountName={accountName}
|
|
852
839
|
/>
|
|
853
840
|
);
|
|
@@ -887,17 +874,6 @@ export const Whatsapp = (props) => {
|
|
|
887
874
|
</CapButton>
|
|
888
875
|
</>
|
|
889
876
|
)}
|
|
890
|
-
{!isFullMode && isEditFlow && (
|
|
891
|
-
<>
|
|
892
|
-
<CapButton
|
|
893
|
-
onClick={saveToMessage}
|
|
894
|
-
//disabled={isDisableDone()}
|
|
895
|
-
className="whatsapp-create-btn"
|
|
896
|
-
>
|
|
897
|
-
<FormattedMessage {...messages.done} />
|
|
898
|
-
</CapButton>
|
|
899
|
-
</>
|
|
900
|
-
)}
|
|
901
877
|
</WhatsappFooter>
|
|
902
878
|
</CapSpin>
|
|
903
879
|
);
|