@capillarytech/creatives-library 3.0.14 → 3.0.16

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,12 +51,6 @@ 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
-
60
54
  export function setInjectedTags(injectedTags) {
61
55
  return {
62
56
  type: types.SET_INJECTED_TAGS, injectedTags,
@@ -18,7 +18,6 @@ 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';
22
21
  export const CLEAR_META_ENTITIES = 'cap/CLEAR_META_ENTITIES';
23
22
  export const HIDE_TAGS = 'cap/HIDE_TAGS';
24
23
 
@@ -90,8 +90,6 @@ 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', {});
95
93
  case types.CLEAR_META_ENTITIES:
96
94
  return state.set('metaEntities', {
97
95
  layouts: [],
@@ -2537,15 +2537,13 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2537
2537
  });
2538
2538
  }
2539
2539
  });
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
- }
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
+ });
2549
2547
  //}
2550
2548
  temp = type === 'embedded' ? this.removeStandAlone(temp) : temp;
2551
2549
  this.setState({schema: temp, isSchemaChanged: true, loadingStatus: this.state.loadingStatus + 1}, () => {
@@ -179,7 +179,6 @@ 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();
183
182
  };
184
183
 
185
184
  componentDidMount = () => {
@@ -803,6 +803,7 @@ 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);
806
807
  const response = {
807
808
  action: e.action,
808
809
  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' && template.type.toLowerCase() === 'line') {
1131
+ } else if (this.state.channel.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.14",
4
+ "version": "3.0.16",
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: