@capillarytech/creatives-library 7.10.50 → 7.10.52
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 +2 -0
- package/containers/Email/index.js +3 -2
- package/package.json +1 -1
- package/utils/v2common.js +0 -13
- package/v2Components/TemplatePreview/_templatePreview.scss +17 -9
- package/v2Components/TemplatePreview/assets/images/whatsapp_mobile_android.svg +1 -2041
- package/v2Components/TemplatePreview/index.js +66 -41
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Components/WhatsappStatusContainer/_whatsappStatusContainer.scss +13 -0
- package/v2Components/WhatsappStatusContainer/index.js +58 -0
- package/v2Containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +2 -0
- package/v2Containers/Cap/messages.js +8 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +9 -9
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -1
- package/v2Containers/CreativesContainer/index.js +24 -46
- package/v2Containers/Email/index.js +3 -1
- package/v2Containers/Templates/_templates.scss +19 -45
- package/v2Containers/Templates/actions.js +10 -16
- package/v2Containers/Templates/index.js +79 -89
- package/v2Containers/Templates/messages.js +8 -4
- package/v2Containers/TemplatesV2/index.js +4 -11
- package/v2Containers/Whatsapp/index.js +20 -87
- package/v2Containers/Whatsapp/index.scss +53 -54
- package/v2Containers/Whatsapp/messages.js +0 -17
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34190 -6356
- package/v2Containers/Whatsapp/tests/index.test.js +51 -13
- package/v2Containers/Whatsapp/tests/mockData.js +120 -1
- package/v2Containers/Whatsapp/utils.js +0 -47
|
@@ -10,7 +10,7 @@ import React from 'react';
|
|
|
10
10
|
import _ from 'lodash';
|
|
11
11
|
import { injectIntl, FormattedMessage, intlShape } from 'react-intl';
|
|
12
12
|
// import styled from 'styled-components';
|
|
13
|
-
import {CapColumn, CapRow, CapHeading, CapIcon, CapButton, CapImage} from '@capillarytech/cap-ui-library';
|
|
13
|
+
import { CapColumn, CapRow, CapHeading, CapIcon, CapButton, CapImage, CapLabel } from '@capillarytech/cap-ui-library';
|
|
14
14
|
import './_templatePreview.scss';
|
|
15
15
|
import {updateCharCount} from '../../utils/smsCharCountV2';
|
|
16
16
|
import messages from './messages';
|
|
@@ -20,11 +20,11 @@ import {
|
|
|
20
20
|
} from '../../v2Containers/CreativesContainer/constants';
|
|
21
21
|
import Carousel from '../Carousel';
|
|
22
22
|
import { VIBER, FACEBOOK } from '../../v2Containers/App/constants';
|
|
23
|
+
import whatsappMobileAndroid from './assets/images/whatsapp_mobile_android.svg'
|
|
23
24
|
const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
|
|
24
25
|
const smsMobileAndroid = require('./assets/images/sms_mobile_android.svg');
|
|
25
26
|
const lineMobileAndroid = require('../../assets/line.png');
|
|
26
27
|
const viberMobileAndroid = require('./assets/images/viberMobile.svg');
|
|
27
|
-
const whatsappMobileAndroid = require('./assets/images/whatsapp_mobile_android.svg');
|
|
28
28
|
|
|
29
29
|
const lineImgPlaceholder = require('../../assets/line-image-placeholder.svg');
|
|
30
30
|
const lineStickerPlaceholder = require('../../assets/smiley-placeholder.svg');
|
|
@@ -32,10 +32,20 @@ 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 {
|
|
35
|
+
import {
|
|
36
|
+
CAP_COLOR_03,
|
|
37
|
+
CAP_WHITE,
|
|
38
|
+
FONT_COLOR_01,
|
|
39
|
+
CAP_G06,
|
|
40
|
+
CAP_G15,
|
|
41
|
+
CAP_PURPLE01,
|
|
42
|
+
CAP_G16,
|
|
43
|
+
CAP_SPACE_08,
|
|
44
|
+
CAP_SPACE_16,
|
|
45
|
+
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
36
46
|
import { TEMPLATE, IMAGE_CAROUSEL, IMAGE, STICKER, TEXT, IMAGE_MAP, VIDEO } from '../../v2Containers/Line/Container/constants';
|
|
37
47
|
import CapFacebookPreview from '../../v2Containers/CapFacebookPreview';
|
|
38
|
-
import
|
|
48
|
+
import WhatsappStatusContainer from '../WhatsappStatusContainer';
|
|
39
49
|
|
|
40
50
|
class TemplatePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
41
51
|
onPreviewContentClicked = (channel) => {
|
|
@@ -137,7 +147,17 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
137
147
|
|
|
138
148
|
render() {
|
|
139
149
|
let content = channel && channel.toLowerCase() === 'sms' ? [this.props.content] : this.props.content;
|
|
140
|
-
const {
|
|
150
|
+
const {
|
|
151
|
+
channel,
|
|
152
|
+
showTestAndPreviewIcon,
|
|
153
|
+
module,
|
|
154
|
+
viberBrandName,
|
|
155
|
+
viberAccountName,
|
|
156
|
+
whatsappAccountName,
|
|
157
|
+
whatsappContentLen = 0,
|
|
158
|
+
intl,
|
|
159
|
+
templateData,
|
|
160
|
+
} = this.props;
|
|
141
161
|
const { formatMessage } = intl;
|
|
142
162
|
const { buttonText, imageURL, messageContent: viberMessageContent } = content || {};
|
|
143
163
|
let smsDetails = {};
|
|
@@ -194,7 +214,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
194
214
|
'width': '81%',
|
|
195
215
|
};
|
|
196
216
|
const whatsappSectionStyle = {
|
|
197
|
-
|
|
217
|
+
'padding': `4px 0 ${CAP_SPACE_08}`,
|
|
198
218
|
'border-radius': '6px',
|
|
199
219
|
'background-color': CAP_G15,
|
|
200
220
|
'width': '88%',
|
|
@@ -284,10 +304,10 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
284
304
|
{smsDetails.optoutUrlPresent && <CapHeading type="h6">
|
|
285
305
|
<FormattedMessage {...messages.optoutCharactersTotal} values={{optoutUrlLength: smsDetails.optouturlLength}} />
|
|
286
306
|
</CapHeading>}
|
|
287
|
-
{channel
|
|
307
|
+
{channel?.toLowerCase() === WHATSAPP.toLowerCase() ? (
|
|
288
308
|
<>
|
|
289
|
-
{
|
|
290
|
-
<CapHeading type="h3"
|
|
309
|
+
<WhatsappStatusContainer template={templateData} />
|
|
310
|
+
<CapHeading type="h3" className='margin-t-12'>
|
|
291
311
|
<FormattedMessage {...messages.whatsappCharactersTotal} values={{charCount: content?.templateMsg?.length}} />
|
|
292
312
|
</CapHeading>
|
|
293
313
|
<CapHeading type="h6">
|
|
@@ -332,7 +352,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
332
352
|
<div>
|
|
333
353
|
<div className="shell-v2 align-center" id="sms-preview">
|
|
334
354
|
<CapImage className="preview-image sms" src={smsMobileAndroid} alt="Preview is being generated"/>
|
|
335
|
-
<div className="
|
|
355
|
+
<div className="msg-container sms">
|
|
336
356
|
<div className={"message-pop sms"}>
|
|
337
357
|
{content && content.length && content.map((msg, index) =>
|
|
338
358
|
<CapColumn key={`"message-pop-content-${index}`} className="message-pop-item align-left" style={{ background: '#FFFFFF', color: '#091e42'}}>
|
|
@@ -360,7 +380,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
360
380
|
{channel && channel.toLowerCase() === 'wechat' ?
|
|
361
381
|
( <div className="shell-v2 align-center" id="sms-preview">
|
|
362
382
|
<CapImage className="preview-image" src={(channel || '').toLowerCase() === 'wechat' ? wechatBodyNew : smsMobileAndroid} alt="Preview is being generated"/>
|
|
363
|
-
|
|
383
|
+
<div className="msg-container wechat">
|
|
364
384
|
<div className="message-pop align-left" style={{ background: `${this.props.channel.toLowerCase() === 'wechat' ? '#ffffff' : '#3F51B5'}`, color: `${this.props.channel.toLowerCase() === 'wechat' ? '#333333' : '#ffffff'}`}}>{content}
|
|
365
385
|
</div>
|
|
366
386
|
</div>
|
|
@@ -420,7 +440,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
420
440
|
<div className="shell-v2 align-center" id="sms-preview">
|
|
421
441
|
<CapImage className="preview-image" src={lineMobileAndroid} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
|
|
422
442
|
<div
|
|
423
|
-
|
|
443
|
+
className="msg-container line-preview"
|
|
424
444
|
style={{
|
|
425
445
|
maxHeight: 330,
|
|
426
446
|
overflow: 'scroll',
|
|
@@ -588,7 +608,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
588
608
|
<CapImage className="preview-image" src={viberMobileAndroid} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
|
|
589
609
|
<div style={{ position: 'absolute', top: '12%', left: '36%'}}>{viberBrandName}</div>
|
|
590
610
|
<div
|
|
591
|
-
|
|
611
|
+
className="msg-container viber-preview"
|
|
592
612
|
style={{
|
|
593
613
|
maxHeight: 292,
|
|
594
614
|
marginLeft: 28,
|
|
@@ -662,35 +682,40 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
662
682
|
</div>
|
|
663
683
|
) : ''
|
|
664
684
|
}
|
|
665
|
-
{
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
className=
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
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>
|
|
685
|
+
{
|
|
686
|
+
channel && channel?.toUpperCase() === WHATSAPP ? (
|
|
687
|
+
<>
|
|
688
|
+
<div className='shell-v2 align-center'>
|
|
689
|
+
<CapImage
|
|
690
|
+
className='preview-image'
|
|
691
|
+
src={whatsappMobileAndroid}
|
|
692
|
+
alt={formatMessage(messages.previewGenerated)}
|
|
693
|
+
/>
|
|
694
|
+
<CapLabel className='whatsapp-brand-name'>
|
|
695
|
+
{whatsappAccountName || ''}
|
|
696
|
+
</CapLabel>
|
|
697
|
+
<div className='msg-container whatsapp-message-container'>
|
|
698
|
+
<div className='message-pop align-left' style={whatsappSectionStyle}>
|
|
699
|
+
<CapLabel className='whatsapp-content'>
|
|
700
|
+
{content?.templateMsg || ''}
|
|
701
|
+
</CapLabel>
|
|
702
|
+
</div>
|
|
703
|
+
</div>
|
|
690
704
|
</div>
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
705
|
+
<CapHeading
|
|
706
|
+
type='h3'
|
|
707
|
+
style={{ textAlign: 'center' }}
|
|
708
|
+
className='margin-t-16'
|
|
709
|
+
>
|
|
710
|
+
<FormattedMessage
|
|
711
|
+
{...messages.whatsappMessageLength}
|
|
712
|
+
values={{ length: 36 + whatsappContentLen }}
|
|
713
|
+
/>
|
|
714
|
+
</CapHeading>
|
|
715
|
+
</>
|
|
716
|
+
) : (
|
|
717
|
+
''
|
|
718
|
+
)
|
|
694
719
|
}
|
|
695
720
|
{channel && channel.toLowerCase() === FACEBOOK && (
|
|
696
721
|
<div style={{position: 'absolute', left: '80%'}} id="facebook-preview">
|
|
@@ -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',
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CapRow, CapStatus, CapColoredTag } from '@capillarytech/cap-ui-library';
|
|
3
|
+
import { WHATSAPP } from '../../v2Containers/CreativesContainer/constants';
|
|
4
|
+
import {
|
|
5
|
+
CATEGORY as WHATSAPP_CATEGORY,
|
|
6
|
+
STATUS as WHATSAPP_STATUS,
|
|
7
|
+
} from '../../v2Containers/Whatsapp/constants';
|
|
8
|
+
import { getWhatsappCategory, getWhatsappStatus } from '../../v2Containers/Whatsapp/utils';
|
|
9
|
+
import './_whatsappStatusContainer.scss';
|
|
10
|
+
|
|
11
|
+
export const WhatsappStatusContainer = (props) => {
|
|
12
|
+
|
|
13
|
+
const { template } = props;
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
versions: {
|
|
17
|
+
base: {
|
|
18
|
+
content: {
|
|
19
|
+
[WHATSAPP.toLowerCase()]: {
|
|
20
|
+
[WHATSAPP_STATUS]: status,
|
|
21
|
+
[WHATSAPP_CATEGORY]: category,
|
|
22
|
+
} = {},
|
|
23
|
+
} = {},
|
|
24
|
+
} = {},
|
|
25
|
+
} = {},
|
|
26
|
+
} = template;
|
|
27
|
+
|
|
28
|
+
const categoryObj = getWhatsappCategory(category) || {};
|
|
29
|
+
const {
|
|
30
|
+
label: categoryLabel,
|
|
31
|
+
tagColor: categoryTagColor,
|
|
32
|
+
tagTextColor: categoryTextColor,
|
|
33
|
+
} = categoryObj;
|
|
34
|
+
return (
|
|
35
|
+
<CapRow type="flex" align="middle" className="whatsapp-status-container">
|
|
36
|
+
<CapStatus
|
|
37
|
+
type={status}
|
|
38
|
+
text={getWhatsappStatus(status)?.label}
|
|
39
|
+
labelType="label3"
|
|
40
|
+
/>
|
|
41
|
+
{
|
|
42
|
+
categoryLabel ? (
|
|
43
|
+
<CapColoredTag
|
|
44
|
+
tagColor={categoryTagColor}
|
|
45
|
+
tagTextColor={categoryTextColor}
|
|
46
|
+
tagHeight="20px"
|
|
47
|
+
tagFontSize="12px"
|
|
48
|
+
className="whatsapp-category-tag"
|
|
49
|
+
>
|
|
50
|
+
{categoryLabel}
|
|
51
|
+
</CapColoredTag>
|
|
52
|
+
) : null
|
|
53
|
+
}
|
|
54
|
+
</CapRow>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default WhatsappStatusContainer;
|
|
@@ -80,6 +80,14 @@ export default defineMessages({
|
|
|
80
80
|
id: `creatives.containersV2.promotions`,
|
|
81
81
|
defaultMessage: 'Promotions',
|
|
82
82
|
},
|
|
83
|
+
"templateNameLabel": {
|
|
84
|
+
id: `creatives.containersV2.templateNameLabel`,
|
|
85
|
+
defaultMessage: 'Template name',
|
|
86
|
+
},
|
|
87
|
+
"templateNamePlaceholder": {
|
|
88
|
+
id: `creatives.containersV2.templateNamePlaceholder`,
|
|
89
|
+
defaultMessage: 'Enter template name',
|
|
90
|
+
},
|
|
83
91
|
|
|
84
92
|
//refresh due to org change messages
|
|
85
93
|
|
|
@@ -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};
|
|
@@ -172,11 +173,12 @@ function SlideBoxContent(props) {
|
|
|
172
173
|
});
|
|
173
174
|
|
|
174
175
|
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
const
|
|
178
|
-
const
|
|
179
|
-
const
|
|
176
|
+
const isCreate = slidBoxContent === 'createTemplate';
|
|
177
|
+
const isCreateSms = isCreate && channel === constants.SMS;
|
|
178
|
+
const isCreateFacebook = isCreate && channel === constants.FACEBOOK;
|
|
179
|
+
const isCreateWhatsapp = isCreate && channel === constants.WHATSAPP;
|
|
180
|
+
const isCreateMPush = isCreate && channel === constants.MOBILE_PUSH;
|
|
181
|
+
const isCreateCallTask = isCreate && channel === constants.CALL_TASK;
|
|
180
182
|
let isEditSms = false;
|
|
181
183
|
let isEditEmailWithId = false;
|
|
182
184
|
let isEmailEditWithContent = false;
|
|
@@ -188,7 +190,7 @@ function SlideBoxContent(props) {
|
|
|
188
190
|
let isEditFacebook = false;
|
|
189
191
|
let isEditFTP = false;
|
|
190
192
|
let isEditWhatsapp = false;
|
|
191
|
-
const isEmailCreate =
|
|
193
|
+
const isEmailCreate = isCreate && channel === constants.EMAIL;
|
|
192
194
|
if (templateData && channel) {
|
|
193
195
|
channel = templateData.type;// for edit mode with template data
|
|
194
196
|
isEditSms = slidBoxContent === 'editTemplate' && channel === constants.SMS;
|
|
@@ -364,6 +366,7 @@ function SlideBoxContent(props) {
|
|
|
364
366
|
showDisabledFBInfo={showDisabledFBInfo}
|
|
365
367
|
orgUnitId={orgUnitId}
|
|
366
368
|
smsRegister={smsRegister}
|
|
369
|
+
enableNewChannels={enableNewChannels}
|
|
367
370
|
/>
|
|
368
371
|
)}
|
|
369
372
|
{isPreview && (
|
|
@@ -697,9 +700,6 @@ function SlideBoxContent(props) {
|
|
|
697
700
|
{isEditWhatsapp && (<Whatsapp
|
|
698
701
|
isFullMode={isFullMode}
|
|
699
702
|
templateData={templateData}
|
|
700
|
-
getFormData={getFormData}
|
|
701
|
-
getDefaultTags={type}
|
|
702
|
-
forwardedTags={forwardedTags}
|
|
703
703
|
params={{
|
|
704
704
|
id: templateData._id,
|
|
705
705
|
}}
|
|
@@ -7,6 +7,7 @@ import moment from 'moment';
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import messages from './messages';
|
|
9
9
|
import whatsppMsg from '../Whatsapp/messages';
|
|
10
|
+
import globalMessages from '../Cap/messages'
|
|
10
11
|
import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
|
|
11
12
|
import { NO_COMMUNICATION, FTP, WHATSAPP } from '../App/constants';
|
|
12
13
|
import { isTraiDLTEnable } from '../../utils/common';
|
|
@@ -84,7 +85,7 @@ function SlideBoxHeader(props) {
|
|
|
84
85
|
description={
|
|
85
86
|
isWhatsappEdit && (
|
|
86
87
|
<>
|
|
87
|
-
{renderWhatsappData("label1", <FormattedMessage {...
|
|
88
|
+
{renderWhatsappData("label1", <FormattedMessage {...globalMessages.templateNameLabel} />)}
|
|
88
89
|
{renderWhatsappData("label2", whatsappName)}
|
|
89
90
|
{renderWhatsappData("label3", <FormattedMessage {...whatsppMsg.labelSeperator} />)}
|
|
90
91
|
{renderWhatsappData("label1", <FormattedMessage {...whatsppMsg.templateCategoryLabel} />)}
|
|
@@ -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,24 @@ 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 {
|
|
824
|
+
const {
|
|
825
|
+
isFullMode,
|
|
826
|
+
creativesMode,
|
|
827
|
+
cap,
|
|
828
|
+
isUploading,
|
|
829
|
+
channelsToHide,
|
|
830
|
+
selectedWeChatAccount,
|
|
831
|
+
forwardedTags,
|
|
832
|
+
channelsToDisable,
|
|
833
|
+
selectedOfferDetails,
|
|
834
|
+
onTestContentClicked,
|
|
835
|
+
onPreviewContentClicked,
|
|
836
|
+
getCreativesData,
|
|
837
|
+
fetchingCmsData,
|
|
838
|
+
editor,
|
|
839
|
+
smsRegister,
|
|
840
|
+
enableNewChannels,
|
|
841
|
+
} = this.props;
|
|
865
842
|
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
866
843
|
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
867
844
|
return (
|
|
@@ -942,6 +919,7 @@ class Creatives extends React.Component {
|
|
|
942
919
|
smsRegister={smsRegister}
|
|
943
920
|
messageStrategy={this.props.strategy}
|
|
944
921
|
orgUnitId={this.props.orgUnitId}
|
|
922
|
+
enableNewChannels={enableNewChannels}
|
|
945
923
|
/>
|
|
946
924
|
}
|
|
947
925
|
footer={this.shouldShowFooter() &&
|
|
@@ -2179,7 +2179,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2179
2179
|
} else {
|
|
2180
2180
|
this.setState({injectedTags: data.tags});
|
|
2181
2181
|
}
|
|
2182
|
-
|
|
2182
|
+
if (data.tags) {
|
|
2183
|
+
this.props.globalActions.setInjectedTags(data.tags);
|
|
2184
|
+
}
|
|
2183
2185
|
}
|
|
2184
2186
|
|
|
2185
2187
|
startLoading = (ifEdit) => {
|
|
@@ -19,6 +19,25 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.creatives-templates-list {
|
|
22
|
+
|
|
23
|
+
.delete-template-confirm {
|
|
24
|
+
.ant-modal-footer {
|
|
25
|
+
padding: $CAP_SPACE_16 $CAP_SPACE_24 $CAP_SPACE_24 $CAP_SPACE_24;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ant-modal-header {
|
|
29
|
+
padding: $CAP_SPACE_24 $CAP_SPACE_24 $CAP_SPACE_08 $CAP_SPACE_24;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ant-modal-body {
|
|
33
|
+
padding: 0 $CAP_SPACE_24;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ant-modal-close-x {
|
|
37
|
+
padding: $CAP_SPACE_12;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
22
41
|
.pagination-container {
|
|
23
42
|
.FACEBOOK {
|
|
24
43
|
.ant-card-body {
|
|
@@ -132,20 +151,6 @@
|
|
|
132
151
|
|
|
133
152
|
}
|
|
134
153
|
}
|
|
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
154
|
}
|
|
150
155
|
|
|
151
156
|
.card-title {
|
|
@@ -538,40 +543,9 @@
|
|
|
538
543
|
}
|
|
539
544
|
}
|
|
540
545
|
|
|
541
|
-
.whatsapp-card-title {
|
|
542
|
-
|
|
543
|
-
.whatsapp-status-container {
|
|
544
|
-
margin-top: 12px;
|
|
545
|
-
width: 150%;
|
|
546
|
-
height: 20px;
|
|
547
|
-
|
|
548
|
-
.cap-colored-tag-v2 {
|
|
549
|
-
font-weight: normal;
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
|
|
554
546
|
.whatsapp-illustration-desc {
|
|
555
547
|
font-size: 14px;
|
|
556
548
|
color: rgba(0, 0, 0, 0.87);
|
|
557
549
|
margin: 8px 0;
|
|
558
550
|
white-space: pre-wrap;
|
|
559
551
|
}
|
|
560
|
-
|
|
561
|
-
.delete-template-confirm {
|
|
562
|
-
.ant-modal-footer {
|
|
563
|
-
padding: $CAP_SPACE_16 $CAP_SPACE_24 $CAP_SPACE_24 $CAP_SPACE_24;
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
.ant-modal-header {
|
|
567
|
-
padding: $CAP_SPACE_24 $CAP_SPACE_24 $CAP_SPACE_08 $CAP_SPACE_24;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
.ant-modal-body {
|
|
571
|
-
padding: 0 $CAP_SPACE_24;
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
.ant-modal-close-x {
|
|
575
|
-
padding: $CAP_SPACE_12;
|
|
576
|
-
}
|
|
577
|
-
}
|
|
@@ -55,24 +55,18 @@ export function setWeChatAccount(weChatAccount) {
|
|
|
55
55
|
weChatAccount,
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
|
|
59
58
|
export function setChannelAccount(channel, account) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
type: types.SET_WHATSAPP_ACCOUNT,
|
|
70
|
-
account,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
default:
|
|
74
|
-
return {};
|
|
59
|
+
const channelTypeMapping = {
|
|
60
|
+
LINE: types.SET_LINE_ACCOUNT,
|
|
61
|
+
WHATSAPP: types.SET_WHATSAPP_ACCOUNT,
|
|
62
|
+
};
|
|
63
|
+
if (channelTypeMapping[channel]) {
|
|
64
|
+
return {
|
|
65
|
+
type: channelTypeMapping[channel],
|
|
66
|
+
account,
|
|
67
|
+
};
|
|
75
68
|
}
|
|
69
|
+
return {};
|
|
76
70
|
}
|
|
77
71
|
|
|
78
72
|
export function setViberAccount(viberAccount) {
|