@capillarytech/creatives-library 3.0.14 → 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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "3.0.14",
4
+ "version": "3.0.15",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -334,7 +334,7 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
334
334
  {filterContent}
335
335
  <CapSpin spinning={isLoading} tip={loadingTip} style={{width: "100%"}}>
336
336
  {!isLoading && <div>
337
- {!_.isEmpty(templates) ? <div className="pagination-container">
337
+ {!_.isEmpty(templates) || !_.isEmpty(this.state.searchText) ? <div className="pagination-container">
338
338
  <CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={'Email'} />
339
339
  </div> : <CapIllustration {...this.getIllustrationProps} />}</div>
340
340
  }
@@ -392,7 +392,7 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
392
392
  }
393
393
  render() {
394
394
  const assetList = this.props.Gallery.assetList;
395
- const filterContent = !_.isEmpty(assetList) ? (
395
+ const filterContent = !_.isEmpty(assetList) || !_.isEmpty(this.state.searchText) ? (
396
396
  <div className="action-container" style={{ display: 'inline-flex', width: '100%'}}>
397
397
  <div style={{ marginTop: '8px', width: '50%'}}>
398
398
  <CapInput.Search
@@ -542,7 +542,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
542
542
  {filterContent}
543
543
  <CapSpin spinning={isLoading} tip={loadingTip} style={{width: '100%'}}>
544
544
  {!isLoading && <div>
545
- {!_.isEmpty(templates) ? <div className="pagination-container">
545
+ {!_.isEmpty(templates) || !_.isEmpty(this.state.searchText) || !_.isEmpty(this.props.Templates.templateError) ? <div className="pagination-container">
546
546
  <CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={currentChannel} />
547
547
  </div> : ['sms', "email"].includes(this.state.channel.toLowerCase()) && <CapIllustration {...this.getChannelTypeIllustrationInfo(currentChannel)} />
548
548
  }
@@ -1609,8 +1609,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1609
1609
  >
1610
1610
  </CardGrid>
1611
1611
  );
1612
- const filterContent = ((!_.isEmpty(this.props.TemplatesList) || this.state.channel.toLowerCase() === 'mobilepush' ) && <div className="action-container">
1613
- {!_.isEmpty(this.props.TemplatesList) && <CapInput.Search
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
1614
1615
  className="search-text"
1615
1616
  style={{width: '210px'}}
1616
1617
  placeholder={this.props.intl.formatMessage(messages.searchText)}
@@ -1621,7 +1622,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1621
1622
  />}
1622
1623
  <div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
1623
1624
  {(this.props.location.query.type === 'embedded' ) ? pageHeaderDvs : pageHeader}
1624
- {!_.isEmpty(this.props.TemplatesList) && <CapButton
1625
+ {isfilterContentVisisble && <CapButton
1625
1626
  type={"primary"}
1626
1627
  disabled={this.isCreateDisabled()}
1627
1628
  style={{marginLeft: '8px'}}
@@ -1665,7 +1666,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1665
1666
  >
1666
1667
  </CardGrid>
1667
1668
  </Pagination>} */}
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) &&
1670
+ <div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
1671
+ <CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesMessage)}</CapHeading>
1672
+ </div>}
1668
1673
  </CapRow>
1674
+
1675
+
1669
1676
  <CapRow>
1670
1677
  {!_.isEmpty(creativesParams.mode) && isFullMode && //creatives container for fullmode
1671
1678
  <CreativesContainer
@@ -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: