@capillarytech/creatives-library 3.0.13 → 3.0.14
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/Cap/actions.js +6 -0
- package/containers/Cap/constants.js +1 -0
- package/containers/Cap/reducer.js +2 -0
- package/containers/Email/index.js +9 -7
- package/containers/MobilePush/Create/index.js +1 -0
- package/containers/MobilePush/Edit/index.js +0 -1
- package/containers/Templates/index.js +1 -1
- package/package.json +1 -1
- package/v2Components/EmailMobilePreview/index.js +9 -0
- package/v2Containers/Assets/Gallery/index.js +18 -9
- package/v2Containers/Assets/Gallery/messages.js +4 -0
- package/v2Containers/CallTask/index.js +14 -6
- package/v2Containers/CallTask/messages.js +8 -0
- package/v2Containers/Templates/index.js +83 -44
- package/v2Containers/Templates/messages.js +24 -0
|
@@ -51,6 +51,12 @@ export function fetchSchemaForEntity(queryParams) {
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
export function removeEntitySchema() {
|
|
55
|
+
return {
|
|
56
|
+
type: types.ROMOVE_ENTITY_SCHEMA,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
54
60
|
export function setInjectedTags(injectedTags) {
|
|
55
61
|
return {
|
|
56
62
|
type: types.SET_INJECTED_TAGS, injectedTags,
|
|
@@ -18,6 +18,7 @@ export const GET_USER_DATA_FAILURE = 'cap/GET_USER_DATA_FAILURE';
|
|
|
18
18
|
export const GET_SCHEMA_FOR_ENTITY_FAILURE = 'cap/GET_SCHEMA_FOR_ENTITY_FAILURE';
|
|
19
19
|
export const GET_SCHEMA_FOR_ENTITY_REQUEST = 'cap/GET_SCHEMA_FOR_ENTITY_REQUEST';
|
|
20
20
|
export const GET_SCHEMA_FOR_ENTITY_SUCCESS = 'cap/GET_SCHEMA_FOR_ENTITY_SUCCESS';
|
|
21
|
+
export const ROMOVE_ENTITY_SCHEMA = 'cap/ROMOVE_ENTITY_SCHEMA';
|
|
21
22
|
export const CLEAR_META_ENTITIES = 'cap/CLEAR_META_ENTITIES';
|
|
22
23
|
export const HIDE_TAGS = 'cap/HIDE_TAGS';
|
|
23
24
|
|
|
@@ -90,6 +90,8 @@ function capReducer(state = fromJS(initialState), action) {
|
|
|
90
90
|
tags: action.data && action.entityType === 'TAG' ? action.data.metaEntities : stateMeta.tags,
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
+
case types.ROMOVE_ENTITY_SCHEMA:
|
|
94
|
+
return state.set('metaEntities', {});
|
|
93
95
|
case types.CLEAR_META_ENTITIES:
|
|
94
96
|
return state.set('metaEntities', {
|
|
95
97
|
layouts: [],
|
|
@@ -2537,13 +2537,15 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2537
2537
|
});
|
|
2538
2538
|
}
|
|
2539
2539
|
});
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2540
|
+
if (temp.standalone.sections && temp.standalone.sections.length > 0) {
|
|
2541
|
+
_.forEach(temp.standalone.sections[1].inputFields[0].cols, (inputField) => {
|
|
2542
|
+
if (inputField.id === "template-version") {
|
|
2543
|
+
const iF = inputField;
|
|
2544
|
+
iF.colStyle = {};
|
|
2545
|
+
iF.colStyle.display = "none";
|
|
2546
|
+
}
|
|
2547
|
+
});
|
|
2548
|
+
}
|
|
2547
2549
|
//}
|
|
2548
2550
|
temp = type === 'embedded' ? this.removeStandAlone(temp) : temp;
|
|
2549
2551
|
this.setState({schema: temp, isSchemaChanged: true, loadingStatus: this.state.loadingStatus + 1}, () => {
|
|
@@ -179,6 +179,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
179
179
|
query: type === 'embedded' ? {type: 'embedded', module} : {module},
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
+
this.props.globalActions.removeEntitySchema();
|
|
182
183
|
};
|
|
183
184
|
|
|
184
185
|
componentDidMount = () => {
|
|
@@ -1128,7 +1128,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1128
1128
|
{template._id === this.state.hoveredItem ? <CapButton onClick={(e) => this.handleEditClick(e, template._id)} className="edit-button" type="secondary">{type === 'embedded' ? this.props.intl.formatMessage(messages.selectButton) : this.props.intl.formatMessage(messages.editButton)}</CapButton> : ''}
|
|
1129
1129
|
{template._id === this.state.hoveredItem ? <CapButton onClick={() => this.handlePreviewClick(template)} className="preview-button" type="cancel">{this.props.intl.formatMessage(messages.previewButton)}</CapButton> : ''}
|
|
1130
1130
|
</div>);
|
|
1131
|
-
} else if (this.state.channel.toLowerCase() === 'line') {
|
|
1131
|
+
} else if (this.state.channel.toLowerCase() === 'line' && template.type.toLowerCase() === 'line') {
|
|
1132
1132
|
//content = template.versions.base.messages[0].Text;
|
|
1133
1133
|
content = {
|
|
1134
1134
|
bodyText: template.versions.base.content.messages[0].text ? template.versions.base.content.messages[0].text : '',
|
package/package.json
CHANGED
|
@@ -30,6 +30,14 @@ const deviceAspectRatio = {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
class EmailMobilePreview extends React.Component {
|
|
33
|
+
static getDerivedStateFromProps(props) {
|
|
34
|
+
if (props.showAllDevices) {
|
|
35
|
+
return {
|
|
36
|
+
showAllDevices: true,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
33
41
|
constructor() {
|
|
34
42
|
super();
|
|
35
43
|
this.state = {
|
|
@@ -115,6 +123,7 @@ EmailMobilePreview.propTypes = {
|
|
|
115
123
|
|
|
116
124
|
EmailMobilePreview.defaultProps = {
|
|
117
125
|
showDeviceSelection: true,
|
|
126
|
+
showAllDevices: false,
|
|
118
127
|
};
|
|
119
128
|
|
|
120
129
|
const mapStateToProps = (state, props) => createStructuredSelector({
|
|
@@ -13,7 +13,7 @@ import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
|
|
|
13
13
|
import { createStructuredSelector } from 'reselect';
|
|
14
14
|
import moment from "moment";
|
|
15
15
|
import _ from "lodash";
|
|
16
|
-
import { CapHeader, CapInput, CapButton, CapSpin, CapIcon, CapDropdown, CapMenu, CapCustomCard, CapSlideBox, CapLabel } from '@capillarytech/cap-ui-library';
|
|
16
|
+
import { CapHeader, CapInput, CapButton, CapSpin, CapIcon, CapDropdown, CapMenu, CapCustomCard, CapSlideBox, CapLabel, CapIllustration} from '@capillarytech/cap-ui-library';
|
|
17
17
|
import { Popover } from 'antd';
|
|
18
18
|
import makeSelectGallery from './selectors';
|
|
19
19
|
import messages from './messages';
|
|
@@ -23,7 +23,7 @@ import * as globalActions from '../../Cap/actions';
|
|
|
23
23
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
24
24
|
import * as commonUtil from '../../../utils/common';
|
|
25
25
|
import Pagination from '../../../v2Components/Pagination';
|
|
26
|
-
|
|
26
|
+
import imageGalleryIllustration from '../images/imageGalleryIllustration.svg';
|
|
27
27
|
import './_gallery.scss';
|
|
28
28
|
const {CapCustomCardList} = CapCustomCard;
|
|
29
29
|
export class Gallery extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
@@ -240,6 +240,12 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
|
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
+
getIllustrationProps={
|
|
244
|
+
buttonLabel: <FormattedMessage {...messages.upload} />,
|
|
245
|
+
onClick: (e) => this.openFileDialog(e),
|
|
246
|
+
illustrationImage: imageGalleryIllustration,
|
|
247
|
+
title: <FormattedMessage {...messages.addImages} />,
|
|
248
|
+
}
|
|
243
249
|
|
|
244
250
|
prepareData() {
|
|
245
251
|
const data = [];
|
|
@@ -326,10 +332,12 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
|
|
|
326
332
|
}) : [];
|
|
327
333
|
return (<div>
|
|
328
334
|
{filterContent}
|
|
329
|
-
<CapSpin spinning={isLoading} tip={loadingTip}>
|
|
330
|
-
{!
|
|
331
|
-
<
|
|
332
|
-
|
|
335
|
+
<CapSpin spinning={isLoading} tip={loadingTip} style={{width: "100%"}}>
|
|
336
|
+
{!isLoading && <div>
|
|
337
|
+
{!_.isEmpty(templates) ? <div className="pagination-container">
|
|
338
|
+
<CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={'Email'} />
|
|
339
|
+
</div> : <CapIllustration {...this.getIllustrationProps} />}</div>
|
|
340
|
+
}
|
|
333
341
|
</CapSpin>
|
|
334
342
|
|
|
335
343
|
</div>);
|
|
@@ -383,7 +391,8 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
|
|
|
383
391
|
);
|
|
384
392
|
}
|
|
385
393
|
render() {
|
|
386
|
-
const
|
|
394
|
+
const assetList = this.props.Gallery.assetList;
|
|
395
|
+
const filterContent = !_.isEmpty(assetList) ? (
|
|
387
396
|
<div className="action-container" style={{ display: 'inline-flex', width: '100%'}}>
|
|
388
397
|
<div style={{ marginTop: '8px', width: '50%'}}>
|
|
389
398
|
<CapInput.Search
|
|
@@ -404,10 +413,10 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
|
|
|
404
413
|
</form>
|
|
405
414
|
</div>
|
|
406
415
|
</div>
|
|
407
|
-
)
|
|
416
|
+
) : <input style={{ display: 'none'}} id="fileName" type="file" onChange={(e) => this.uploadImages(e, {files: e.target.files})} accept="image/*" multiple/>;
|
|
408
417
|
const isLoading = this.props.Gallery.assetUploading || this.props.Gallery.fetchingAllAssets;
|
|
409
418
|
const loadingTip = "Loading gallery... ";
|
|
410
|
-
|
|
419
|
+
|
|
411
420
|
return (
|
|
412
421
|
<div>
|
|
413
422
|
{this.state.showEmbeddedPreview ?
|
|
@@ -22,6 +22,10 @@ export default defineMessages({
|
|
|
22
22
|
id: 'app.containers.Assets.Gallery.upload',
|
|
23
23
|
defaultMessage: 'Upload image',
|
|
24
24
|
},
|
|
25
|
+
addImages: {
|
|
26
|
+
id: `app.containers.Assets.Gallery.addImages`,
|
|
27
|
+
defaultMessage: 'Add images',
|
|
28
|
+
},
|
|
25
29
|
imagePreview: {
|
|
26
30
|
id: 'app.containers.Assets.Gallery.imagePreview',
|
|
27
31
|
defaultMessage: 'Image preview',
|
|
@@ -9,10 +9,10 @@ import { bindActionCreators } from "redux";
|
|
|
9
9
|
import { connect } from 'react-redux';
|
|
10
10
|
import {
|
|
11
11
|
//CapSlideBox,
|
|
12
|
-
CapButton,
|
|
13
12
|
//CapIcon,
|
|
14
13
|
//CapHeader,
|
|
15
14
|
CapLabel,
|
|
15
|
+
CapIllustration,
|
|
16
16
|
} from '@capillarytech/cap-ui-library';
|
|
17
17
|
import { injectIntl, intlShape } from 'react-intl';
|
|
18
18
|
import { createStructuredSelector } from 'reselect';
|
|
@@ -23,7 +23,7 @@ import makeSelectCallTask from './selectors';
|
|
|
23
23
|
import NewCallTask from '../../v2Components/NewCallTask';
|
|
24
24
|
import messages from './messages';
|
|
25
25
|
import './_callTask.scss';
|
|
26
|
-
|
|
26
|
+
import calltaskIllustration from '../Assets/images/calltaskIllustration.svg';
|
|
27
27
|
export class CallTask extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
28
28
|
constructor(props) {
|
|
29
29
|
super(props);
|
|
@@ -57,8 +57,18 @@ export class CallTask extends React.Component { // eslint-disable-line react/pre
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
getIllustrationProps=() => {
|
|
61
|
+
const { intl, showContentInSlidebox, onCreateNew } = this.props;
|
|
62
|
+
const { formatMessage } = intl;
|
|
63
|
+
return {
|
|
64
|
+
buttonLabel: formatMessage(messages.newCallTaskTemplate),
|
|
65
|
+
onClick: showContentInSlidebox ? this.showNewCallTask : onCreateNew,
|
|
66
|
+
illustrationImage: calltaskIllustration,
|
|
67
|
+
title: formatMessage(messages.callTaskTitleIllustartion),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
60
70
|
render() {
|
|
61
|
-
const { intl, onCallTaskSubmit, templateData, loadingMetaEntities, metaEntities
|
|
71
|
+
const { intl, onCallTaskSubmit, templateData, loadingMetaEntities, metaEntities } = this.props;
|
|
62
72
|
const { formatMessage } = intl;
|
|
63
73
|
const { mode } = this.state;
|
|
64
74
|
return (
|
|
@@ -77,9 +87,7 @@ export class CallTask extends React.Component { // eslint-disable-line react/pre
|
|
|
77
87
|
{formatMessage(messages.callTaskInfo)}
|
|
78
88
|
</CapLabel>
|
|
79
89
|
<div className="call-task-action-button">
|
|
80
|
-
<
|
|
81
|
-
{formatMessage(messages.addNewCallTask)}
|
|
82
|
-
</CapButton>
|
|
90
|
+
<CapIllustration {...this.getIllustrationProps()} />
|
|
83
91
|
</div>
|
|
84
92
|
{/* {
|
|
85
93
|
showCallTaskSlidebox && showContentInSlidebox &&
|
|
@@ -18,4 +18,12 @@ export default defineMessages({
|
|
|
18
18
|
id: 'app.containers.CallTask.callTaskInfo',
|
|
19
19
|
defaultMessage: 'Call Tasks are message sent to store staff. The messages are displayed on the Point of Sale (POS) machines for store staff to take action.',
|
|
20
20
|
},
|
|
21
|
+
callTaskTitleIllustartion: {
|
|
22
|
+
id: `app.containers.CallTask.callTaskTitleIllustartion`,
|
|
23
|
+
defaultMessage: 'Create a Call Task template',
|
|
24
|
+
},
|
|
25
|
+
newCallTaskTemplate: {
|
|
26
|
+
id: `app.containers.CallTask.newCallTaskTemplate`,
|
|
27
|
+
defaultMessage: 'New Call Task template',
|
|
28
|
+
},
|
|
21
29
|
});
|
|
@@ -15,7 +15,7 @@ import moment from "moment";
|
|
|
15
15
|
import _ from 'lodash';
|
|
16
16
|
import { bindActionCreators } from 'redux';
|
|
17
17
|
import { Modal} from 'antd';
|
|
18
|
-
import {CapMenu, CapDropdown, CapButton, CapInput, CapIcon, CapSelect, CapPopover, CapSpin, CapCustomCard, CapRow, CapSlideBox, CapLink, CapHeading, CapNotification} from '@capillarytech/cap-ui-library';
|
|
18
|
+
import {CapMenu, CapDropdown, CapButton, CapInput, CapIcon, CapSelect, CapPopover, CapSpin, CapCustomCard, CapRow, CapSlideBox, CapLink, CapHeading, CapNotification, CapIllustration} from '@capillarytech/cap-ui-library';
|
|
19
19
|
import { makeSelectTemplates, makeSelectTemplatesResponse } from './selectors';
|
|
20
20
|
import { makeSelectCreate as makeSelectCreateSms} from '../Sms/Create/selectors';
|
|
21
21
|
import { makeSelectCreate as makeSelectCreateMobilePush } from '../MobilePush/Create/selectors';
|
|
@@ -44,6 +44,11 @@ import EmailPreview from '../../v2Components/EmailPreview';
|
|
|
44
44
|
import CreativesContainer from '../CreativesContainer';
|
|
45
45
|
import WechatRichmediaTemplatePreview from '../../v2Components/TemplatePreview/WechatRichmediaTemplatePreview';
|
|
46
46
|
import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE } from '../CreativesContainer/constants';
|
|
47
|
+
import emailIllustration from '../Assets/images/emailIllustration.svg';
|
|
48
|
+
import smsIllustration from '../Assets/images/smsIllustration.svg';
|
|
49
|
+
import pushIllustration from '../Assets/images/pushIllustration.svg';
|
|
50
|
+
|
|
51
|
+
|
|
47
52
|
const {CapCustomCardList} = CapCustomCard;
|
|
48
53
|
const InlineDiv = styled.div`
|
|
49
54
|
display: inline;
|
|
@@ -79,6 +84,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
79
84
|
modeType: null,
|
|
80
85
|
routeParams: null,
|
|
81
86
|
};
|
|
87
|
+
|
|
82
88
|
this.handleOnHoverItem = this.handleOnHoverItem.bind(this);
|
|
83
89
|
this.handleOnItemClick = this.handleOnItemClick.bind(this);
|
|
84
90
|
this.handleEditClick = this.handleEditClick.bind(this);
|
|
@@ -255,7 +261,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
255
261
|
}
|
|
256
262
|
}
|
|
257
263
|
if (this.state.channel.toLowerCase() === "mobilepush" && nextProps.CreateMobilePush && nextProps.CreateMobilePush.response && nextProps.CreateMobilePush.response.templateId && nextProps.CreateMobilePush.response.templateId !== '') {
|
|
258
|
-
|
|
264
|
+
|
|
259
265
|
}
|
|
260
266
|
|
|
261
267
|
if (this.state.channel.toLowerCase() === "ebill" && nextProps.CreateEbill && nextProps.CreateEbill.createResponse && nextProps.CreateEbill.createResponse.templateId && nextProps.CreateEbill.createResponse.templateId !== '') {
|
|
@@ -377,6 +383,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
377
383
|
this.setState({selectedAccountError: true});
|
|
378
384
|
this.props.actions.resetTemplate();
|
|
379
385
|
return;
|
|
386
|
+
} else {
|
|
387
|
+
this.setState({selectedAccountError: false});
|
|
380
388
|
}
|
|
381
389
|
}
|
|
382
390
|
|
|
@@ -532,24 +540,32 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
532
540
|
const accounts = _.get(this.props, 'Templates.weCrmAccounts');
|
|
533
541
|
return (<div>
|
|
534
542
|
{filterContent}
|
|
535
|
-
<CapSpin spinning={isLoading} tip={loadingTip}>
|
|
536
|
-
{!
|
|
537
|
-
<
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
{ !_.isEmpty(this.props.Templates.selectedWeChatAccount) && this.state.channel.toLowerCase() === "mobilepush" && this.state.selectedAccountError &&
|
|
543
|
+
<CapSpin spinning={isLoading} tip={loadingTip} style={{width: '100%'}}>
|
|
544
|
+
{!isLoading && <div>
|
|
545
|
+
{!_.isEmpty(templates) ? <div className="pagination-container">
|
|
546
|
+
<CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={currentChannel} />
|
|
547
|
+
</div> : ['sms', "email"].includes(this.state.channel.toLowerCase()) && <CapIllustration {...this.getChannelTypeIllustrationInfo(currentChannel)} />
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
{(this.state.selectedAccount === '' && _.isEmpty(this.props.Templates.selectedWeChatAccount)) && (this.state.channel.toLowerCase() === 'wechat' || this.state.channel.toLowerCase() === "mobilepush") &&
|
|
544
551
|
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
545
|
-
<CapHeading type="h6" >
|
|
546
|
-
{this.props.intl.formatMessage(messages.accountConfigError)}
|
|
547
|
-
<InlineDiv>
|
|
548
|
-
<CapLink title="here" style={{display: 'inline'}} onClick={() => { window.open(config.production.accountConfig`${accountId}`); }}/>
|
|
549
|
-
</InlineDiv>
|
|
550
|
-
</CapHeading>
|
|
552
|
+
<CapHeading type="h6">{accounts ? this.props.intl.formatMessage(messages.noAccountMessage) : this.props.intl.formatMessage(messages.noAccountsPresent)}</CapHeading>
|
|
551
553
|
</div>
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
{ !_.isEmpty(this.props.Templates.selectedWeChatAccount) && this.state.channel.toLowerCase() === "mobilepush" && this.state.selectedAccountError ?
|
|
557
|
+
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
558
|
+
<CapHeading type="h6" >
|
|
559
|
+
{this.props.intl.formatMessage(messages.accountConfigError)}
|
|
560
|
+
<InlineDiv>
|
|
561
|
+
<CapLink title="here" style={{display: 'inline'}} onClick={() => { window.open(config.production.accountConfig`${accountId}`); }}/>
|
|
562
|
+
</InlineDiv>
|
|
563
|
+
</CapHeading>
|
|
564
|
+
</div> : ["mobilepush"].includes(this.state.channel.toLowerCase()) && _.isEmpty(templates) && <CapIllustration {...this.getChannelTypeIllustrationInfo(currentChannel)} />
|
|
565
|
+
}
|
|
566
|
+
</div>
|
|
552
567
|
}
|
|
568
|
+
|
|
553
569
|
</CapSpin>
|
|
554
570
|
|
|
555
571
|
</div>);
|
|
@@ -1355,6 +1371,33 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1355
1371
|
(lineLoader !== undefined ? lineLoader : false);
|
|
1356
1372
|
return isLoading;
|
|
1357
1373
|
}
|
|
1374
|
+
getChannelTypeIllustrationInfo = (type) => {
|
|
1375
|
+
switch (type) {
|
|
1376
|
+
case 'SMS':
|
|
1377
|
+
return {
|
|
1378
|
+
buttonLabel: <FormattedMessage {...messages.newSMSTemplate} />,
|
|
1379
|
+
onClick: this.createTemplate,
|
|
1380
|
+
illustrationImage: smsIllustration,
|
|
1381
|
+
title: <FormattedMessage {...messages.smsTitleIllustartion} />,
|
|
1382
|
+
};
|
|
1383
|
+
case 'EMAIL':
|
|
1384
|
+
return {
|
|
1385
|
+
buttonLabel: <FormattedMessage {...messages.newEmailTemplate} />,
|
|
1386
|
+
onClick: this.createTemplate,
|
|
1387
|
+
illustrationImage: emailIllustration,
|
|
1388
|
+
title: <FormattedMessage {...messages.emailTitleIllustartion} />,
|
|
1389
|
+
};
|
|
1390
|
+
case 'MOBILEPUSH':
|
|
1391
|
+
return {
|
|
1392
|
+
buttonLabel: <FormattedMessage {...messages.newNotificationTemplate} />,
|
|
1393
|
+
onClick: this.createTemplate,
|
|
1394
|
+
illustrationImage: pushIllustration,
|
|
1395
|
+
title: <FormattedMessage {...messages.pushTitleIllustartion} />,
|
|
1396
|
+
};
|
|
1397
|
+
default:
|
|
1398
|
+
return {};
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1358
1401
|
checkSearchDisabled = () => (this.props.route.name === "mobilepush" && !(this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier && this.props.Templates.selectedWeChatAccount.configs && (this.props.Templates.selectedWeChatAccount.configs.ios === '1' || this.props.Templates.selectedWeChatAccount.configs.android === '1')))
|
|
1359
1402
|
renderEmailPreviewModal() {
|
|
1360
1403
|
const slideboxContent = (
|
|
@@ -1391,6 +1434,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1391
1434
|
</Modal>);
|
|
1392
1435
|
return modal;
|
|
1393
1436
|
};
|
|
1437
|
+
|
|
1394
1438
|
render() {
|
|
1395
1439
|
const accountOptions = [];
|
|
1396
1440
|
const isFullMode = this.isFullMode();
|
|
@@ -1565,30 +1609,28 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1565
1609
|
>
|
|
1566
1610
|
</CardGrid>
|
|
1567
1611
|
);
|
|
1568
|
-
const filterContent = (
|
|
1569
|
-
<
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
</CapButton>
|
|
1588
|
-
</div>
|
|
1589
|
-
|
|
1612
|
+
const filterContent = ((!_.isEmpty(this.props.TemplatesList) || this.state.channel.toLowerCase() === 'mobilepush' ) && <div className="action-container">
|
|
1613
|
+
{!_.isEmpty(this.props.TemplatesList) && <CapInput.Search
|
|
1614
|
+
className="search-text"
|
|
1615
|
+
style={{width: '210px'}}
|
|
1616
|
+
placeholder={this.props.intl.formatMessage(messages.searchText)}
|
|
1617
|
+
value={this.state.searchText}
|
|
1618
|
+
onChange={(e) => this.searchTemplate(e.target.value)}
|
|
1619
|
+
disabled={this.checkSearchDisabled()}
|
|
1620
|
+
onClear={() => this.searchTemplate('')}
|
|
1621
|
+
/>}
|
|
1622
|
+
<div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
|
|
1623
|
+
{(this.props.location.query.type === 'embedded' ) ? pageHeaderDvs : pageHeader}
|
|
1624
|
+
{!_.isEmpty(this.props.TemplatesList) && <CapButton
|
|
1625
|
+
type={"primary"}
|
|
1626
|
+
disabled={this.isCreateDisabled()}
|
|
1627
|
+
style={{marginLeft: '8px'}}
|
|
1628
|
+
onClick={this.createTemplate} >
|
|
1629
|
+
{ this.props.intl.formatMessage(messages.createNewActionButton) }
|
|
1630
|
+
</CapButton>}
|
|
1590
1631
|
</div>
|
|
1591
|
-
|
|
1632
|
+
|
|
1633
|
+
</div>);
|
|
1592
1634
|
let htmlPreviewContent = "";
|
|
1593
1635
|
if (this.state.channel.toLowerCase() === 'ebill') {
|
|
1594
1636
|
htmlPreviewContent = this.state.previewTemplate && this.state.previewTemplate.versions && this.state.previewTemplate.versions.base && this.state.previewTemplate.versions.base['ebill-editor'];
|
|
@@ -1623,10 +1665,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1623
1665
|
>
|
|
1624
1666
|
</CardGrid>
|
|
1625
1667
|
</Pagination>} */}
|
|
1626
|
-
{(((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 &&
|
|
1627
|
-
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
1628
|
-
<CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesMessage)}</CapHeading>
|
|
1629
|
-
</div>}
|
|
1630
1668
|
</CapRow>
|
|
1631
1669
|
<CapRow>
|
|
1632
1670
|
{!_.isEmpty(creativesParams.mode) && isFullMode && //creatives container for fullmode
|
|
@@ -1684,6 +1722,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1684
1722
|
</div>
|
|
1685
1723
|
);
|
|
1686
1724
|
}
|
|
1725
|
+
|
|
1687
1726
|
}
|
|
1688
1727
|
|
|
1689
1728
|
Templates.propTypes = {
|
|
@@ -278,5 +278,29 @@ export default defineMessages({
|
|
|
278
278
|
id: `${scope}.accountConfigError`,
|
|
279
279
|
defaultMessage: 'This account is not configured properly. You can configure it ',
|
|
280
280
|
},
|
|
281
|
+
"newSMSTemplate": {
|
|
282
|
+
id: `${scope}.newSMSTemplate`,
|
|
283
|
+
defaultMessage: 'New SMS template',
|
|
284
|
+
},
|
|
285
|
+
"newEmailTemplate": {
|
|
286
|
+
id: `${scope}.newEmailTemplate`,
|
|
287
|
+
defaultMessage: 'New email template',
|
|
288
|
+
},
|
|
289
|
+
"newNotificationTemplate": {
|
|
290
|
+
id: `${scope}.newNotificationTemplate`,
|
|
291
|
+
defaultMessage: 'New notification template',
|
|
292
|
+
},
|
|
293
|
+
"pushTitleIllustartion": {
|
|
294
|
+
id: `${scope}.pushTitleIllustartion`,
|
|
295
|
+
defaultMessage: 'Create a mobile push notification template',
|
|
296
|
+
},
|
|
297
|
+
"emailTitleIllustartion": {
|
|
298
|
+
id: `${scope}.emailTitleIllustartion`,
|
|
299
|
+
defaultMessage: 'Create an email template',
|
|
300
|
+
},
|
|
301
|
+
"smsTitleIllustartion": {
|
|
302
|
+
id: `${scope}.smsTitleIllustartion`,
|
|
303
|
+
defaultMessage: 'Create an SMS template',
|
|
304
|
+
},
|
|
281
305
|
|
|
282
306
|
});
|