@capillarytech/creatives-library 3.0.13 → 3.0.15

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.
@@ -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
- _.forEach(temp.standalone.sections[1].inputFields[0].cols, (inputField) => {
2541
- if (inputField.id === "template-version") {
2542
- const iF = inputField;
2543
- iF.colStyle = {};
2544
- iF.colStyle.display = "none";
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 = () => {
@@ -803,7 +803,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
803
803
  };
804
804
 
805
805
  getCurrentWindow = (e) => {
806
- console.log('in sms create', e);
807
806
  const response = {
808
807
  action: e.action,
809
808
  value: 'edit',
@@ -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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "3.0.13",
4
+ "version": "3.0.15",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -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
- {!_.isEmpty(templates) && <div className="pagination-container">
331
- <CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={'Email'} />
332
- </div>}
335
+ <CapSpin spinning={isLoading} tip={loadingTip} style={{width: "100%"}}>
336
+ {!isLoading && <div>
337
+ {!_.isEmpty(templates) || !_.isEmpty(this.state.searchText) ? <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 filterContent = (
394
+ const assetList = this.props.Gallery.assetList;
395
+ const filterContent = !_.isEmpty(assetList) || !_.isEmpty(this.state.searchText) ? (
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
- const assetList = this.props.Gallery.assetList;
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, showContentInSlidebox, onCreateNew } = this.props;
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
- <CapButton onClick={showContentInSlidebox ? this.showNewCallTask : onCreateNew}>
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
- {!_.isEmpty(templates) && <div className="pagination-container">
537
- <CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={currentChannel} />
538
- </div>}
539
- {(this.state.selectedAccount === '' && _.isEmpty(this.props.Templates.selectedWeChatAccount)) && (this.state.channel.toLowerCase() === 'wechat' || this.state.channel.toLowerCase() === "mobilepush") &&
540
- <div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
541
- <CapHeading type="h6">{accounts ? this.props.intl.formatMessage(messages.noAccountMessage) : this.props.intl.formatMessage(messages.noAccountsPresent)}</CapHeading>
542
- </div>}
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) || !_.isEmpty(this.state.searchText) || !_.isEmpty(this.props.Templates.templateError) ? <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,29 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1565
1609
  >
1566
1610
  </CardGrid>
1567
1611
  );
1568
- const filterContent = (
1569
- <div className="action-container">
1570
- <CapInput.Search
1571
- className="search-text"
1572
- style={{width: '210px'}}
1573
- placeholder={this.props.intl.formatMessage(messages.searchText)}
1574
- value={this.state.searchText}
1575
- onChange={(e) => this.searchTemplate(e.target.value)}
1576
- disabled={this.checkSearchDisabled()}
1577
- onClear={() => this.searchTemplate('')}
1578
- />
1579
- <div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
1580
- {(this.props.location.query.type === 'embedded' ) ? pageHeaderDvs : pageHeader}
1581
- <CapButton
1582
- type={"primary"}
1583
- disabled={this.isCreateDisabled()}
1584
- style={{marginLeft: '8px'}}
1585
- onClick={this.createTemplate} >
1586
- { this.props.intl.formatMessage(messages.createNewActionButton) }
1587
- </CapButton>
1588
- </div>
1589
-
1612
+ const isfilterContentVisisble = !_.isEmpty(this.props.TemplatesList) || !_.isEmpty(this.state.searchText) || !_.isEmpty(this.props.Templates.templateError);
1613
+ const filterContent = (( isfilterContentVisisble || this.state.channel.toLowerCase() === 'mobilepush' ) && <div className="action-container">
1614
+ {isfilterContentVisisble && <CapInput.Search
1615
+ className="search-text"
1616
+ style={{width: '210px'}}
1617
+ placeholder={this.props.intl.formatMessage(messages.searchText)}
1618
+ value={this.state.searchText}
1619
+ onChange={(e) => this.searchTemplate(e.target.value)}
1620
+ disabled={this.checkSearchDisabled()}
1621
+ onClear={() => this.searchTemplate('')}
1622
+ />}
1623
+ <div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
1624
+ {(this.props.location.query.type === 'embedded' ) ? pageHeaderDvs : pageHeader}
1625
+ {isfilterContentVisisble && <CapButton
1626
+ type={"primary"}
1627
+ disabled={this.isCreateDisabled()}
1628
+ style={{marginLeft: '8px'}}
1629
+ onClick={this.createTemplate} >
1630
+ { this.props.intl.formatMessage(messages.createNewActionButton) }
1631
+ </CapButton>}
1590
1632
  </div>
1591
- );
1633
+
1634
+ </div>);
1592
1635
  let htmlPreviewContent = "";
1593
1636
  if (this.state.channel.toLowerCase() === 'ebill') {
1594
1637
  htmlPreviewContent = this.state.previewTemplate && this.state.previewTemplate.versions && this.state.previewTemplate.versions.base && this.state.previewTemplate.versions.base['ebill-editor'];
@@ -1623,11 +1666,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1623
1666
  >
1624
1667
  </CardGrid>
1625
1668
  </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 &&
1669
+ {(((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) &&
1627
1670
  <div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
1628
1671
  <CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesMessage)}</CapHeading>
1629
1672
  </div>}
1630
1673
  </CapRow>
1674
+
1675
+
1631
1676
  <CapRow>
1632
1677
  {!_.isEmpty(creativesParams.mode) && isFullMode && //creatives container for fullmode
1633
1678
  <CreativesContainer
@@ -1684,6 +1729,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1684
1729
  </div>
1685
1730
  );
1686
1731
  }
1732
+
1687
1733
  }
1688
1734
 
1689
1735
  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
  });
@@ -12,6 +12,7 @@ const initialState = fromJS({
12
12
  templates: [],
13
13
  deleteResponse: {},
14
14
  deleteTemplateInProgress: false,
15
+ templateError: {},
15
16
  });
16
17
 
17
18
  function templatesReducer(state = initialState, action) {
@@ -19,20 +20,20 @@ function templatesReducer(state = initialState, action) {
19
20
  case types.DEFAULT_ACTION:
20
21
  return state;
21
22
  case types.GET_ALL_TEMPLATES_REQUEST:
22
- return state.set('getAllTemplatesInProgress', true);
23
+ return state.set('getAllTemplatesInProgress', true).set('templateError', {});
23
24
  case types.GET_ALL_TEMPLATES_SUCCESS:
24
25
  if (action.isReset) {
25
26
  return state.set('getAllTemplatesInProgress', false)
26
27
  .set('templates', action.data ? action.data.templates : [])
27
28
  .set('isSearch', action.data ? action.data.search : false)
28
- .set('weCRMtemplates', action.weCRMTemplate ? action.weCRMTemplate : []);
29
+ .set('weCRMtemplates', action.weCRMTemplate ? action.weCRMTemplate : []).set('templateError', {});
29
30
  }
30
31
  return state.set('getAllTemplatesInProgress', false)
31
32
  .set('templates', action.data ? state.get('templates').concat(action.data.templates) : [])
32
33
  .set('isSearch', action.data ? action.data.search : false)
33
34
  .set('weCRMtemplates', action.weCRMTemplate ? state.get('weCRMtemplates').concat(action.weCRMTemplate) : []);
34
35
  case types.GET_ALL_TEMPLATES_FAILURE:
35
- return state.set('getAllTemplatesInProgress', false);
36
+ return state.set('getAllTemplatesInProgress', false).set('templateError', action.error);
36
37
  case types.DELETE_TEMPLATE_REQUEST:
37
38
  return state.set('deleteTemplateInProgress', true);
38
39
  case types.DELETE_TEMPLATE_SUCCESS: