@capillarytech/creatives-library 3.0.17 → 3.0.19

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.
@@ -2638,20 +2638,22 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2638
2638
  const formData = _.cloneDeep(this.state.formData);
2639
2639
  formData[0].selectedLanguages = [];
2640
2640
  let tabKey;
2641
+ const isDragDrop = _.get(data, 'base.is_drag_drop');
2641
2642
  if (this.props.location.query.type === 'embedded' && (this.props.location.query.isLanguageSupport === undefined || this.props.location.query.isLanguageSupport === 'false')) {
2642
- formData['template-subject'] = data.base.subject ? data.base.subject : '';
2643
+ formData['template-subject'] = _.get(data, 'base.subject', '');
2643
2644
  const baseLanguage = this.props.Global.currentOrgDetails.basic_details.base_language;
2644
2645
  let languageIndex = _.findIndex(this.supportedLanguages, {iso_code: baseLanguage});
2645
2646
  console.log("startTemplatecreation before index", languageIndex, this.supportedLanguages, baseLanguage, formData);
2646
2647
  if (languageIndex === -1) {
2647
2648
  languageIndex = 0;
2648
2649
  }
2650
+ const isDragDrop = _.get(data, 'base.is_drag_drop');
2649
2651
  const tempData = {
2650
- "is_drag_drop": data.base.is_drag_drop,
2652
+ "is_drag_drop": isDragDrop,
2651
2653
  "lang_id": this.supportedLanguages[languageIndex].lang_id,
2652
2654
  "iso_code": this.supportedLanguages[languageIndex].iso_code,
2653
2655
  "language": this.supportedLanguages[languageIndex].language,
2654
- "template-content": !data.base.is_drag_drop && data.base.is_drag_drop !== 1 ? data.base.html_content : "",
2656
+ "template-content": !isDragDrop && isDragDrop !== 1 ? _.get(data, 'base.html_content') : "",
2655
2657
  };
2656
2658
  formData[0].base = true;
2657
2659
  formData[0].selectedLanguages.push(this.supportedLanguages[languageIndex].iso_code);
@@ -2700,7 +2702,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2700
2702
  }
2701
2703
  formData.base = _.cloneDeep(formData[0]);
2702
2704
  console.log('startTemplateCreation final ', formData);
2703
- this.setState({formData, loading: false, injectedTags: data.tags, tabKey, isDragDrop: (data.base.is_drag_drop !== 0 )}, () => {
2705
+ this.setState({formData, loading: false, injectedTags: data.tags, tabKey, isDragDrop: (isDragDrop !== 0 )}, () => {
2704
2706
  // this.setState({tabKey: ''});
2705
2707
  _.forEach(formData[0].selectedLanguages, (language) => {
2706
2708
  if (formData[0][language].is_drag_drop) {
@@ -222,13 +222,15 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
222
222
  }
223
223
  }
224
224
  });
225
- this.setState({selectedAccount: selectedAccount.name}, () => {
226
- params.wecrmId = selectedAccount.configs.wecrm_app_id;
227
- params.wecrmToken = selectedAccount.configs.wecrm_token;
228
- params.originalId = selectedAccount.sourceAccountIdentifier;
229
- nextProps.actions.setWeChatAccount(selectedAccount);
230
- this.getAllTemplates({params});
231
- });
225
+ if (!_.isEmpty(selectedAccount)) {
226
+ this.setState({selectedAccount: selectedAccount.name}, () => {
227
+ params.wecrmId = selectedAccount.configs.wecrm_app_id;
228
+ params.wecrmToken = selectedAccount.configs.wecrm_token;
229
+ params.originalId = selectedAccount.sourceAccountIdentifier;
230
+ nextProps.actions.setWeChatAccount(selectedAccount);
231
+ this.getAllTemplates({params});
232
+ });
233
+ }
232
234
  } else if (this.state.channel.toLowerCase() === 'mobilepush' && (nextProps.location.query.account_id || nextProps.location.query.source_account_id)) {
233
235
  _.forEach(nextProps.Templates.weCrmAccounts, (account) => {
234
236
  if ((nextProps.location.query.account_id && account.id === Number(nextProps.location.query.account_id)) || (nextProps.location.query.source_account_id && account.sourceAccountIdentifier && account.sourceAccountIdentifier === nextProps.location.query.source_account_id)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "3.0.17",
4
+ "version": "3.0.19",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -72,10 +72,7 @@ class NavigationBar extends React.Component {
72
72
  onHelpIconClick = () => {
73
73
  const { helpUrl } = this.props;
74
74
  if (helpUrl) {
75
- const stateObj = {
76
- page: "help",
77
- };
78
- window.history.pushState(stateObj, 'Help', window.location.replace(helpUrl));
75
+ window.open(helpUrl, '_blank');
79
76
  }
80
77
  };
81
78
 
@@ -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, CapIllustration} from '@capillarytech/cap-ui-library';
16
+ import { CapHeading, 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';
@@ -336,6 +336,11 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
336
336
  {!isLoading && <div>
337
337
  {!_.isEmpty(templates) || !_.isEmpty(this.state.searchText) ? <div className="pagination-container">
338
338
  <CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={'Email'} />
339
+ {!_.isEmpty(this.state.searchText) && _.isEmpty(templates) && (
340
+ <div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
341
+ <CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesFound)}</CapHeading>
342
+ </div>
343
+ )}
339
344
  </div> : <CapIllustration {...this.getIllustrationProps} />}</div>
340
345
  }
341
346
  </CapSpin>
@@ -98,4 +98,8 @@ export default defineMessages({
98
98
  id: 'app.containers.Assets.Gallery.lastUpdated',
99
99
  defaultMessage: 'Last update {on} by {by}',
100
100
  },
101
+ noTemplatesFound: {
102
+ id: `app.containers.Assets.Gallery.noTemplatesFound`,
103
+ defaultMessage: 'No templates found',
104
+ },
101
105
  });
@@ -31,4 +31,4 @@ export const CLEAR_TOPBAR_MENU_DATA = 'creatives/cap/CLEAR_TOPBAR_MENU_DATA';
31
31
  export const CAMPAIGN_SETTINGS_URL = '/creatives/settings/message';
32
32
  export const BRAND_SETTINGS_URL = '/org/index';
33
33
  export const PROFILE_SETTINGS_URL = '/org/users/NewProfile';
34
- export const HELP_URL = 'https://support.capillarytech.com';
34
+ export const HELP_URL = 'https://support.capillarytech.com/en/support/solutions/4000007853';
@@ -542,9 +542,11 @@ 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) || !_.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)} />
545
+ {!_.isEmpty(templates) || !_.isEmpty(this.state.searchText) || !_.isEmpty(this.props.Templates.templateError) ? (
546
+ <div className={!_.isEmpty(this.state.searchText) && _.isEmpty(cardDataList) ? '' : "pagination-container"}>
547
+ <CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={currentChannel} />
548
+ </div>)
549
+ : ['sms', "email"].includes(this.state.channel.toLowerCase()) && <CapIllustration {...this.getChannelTypeIllustrationInfo(currentChannel)} />
548
550
  }
549
551
 
550
552
  {(this.state.selectedAccount === '' && _.isEmpty(this.props.Templates.selectedWeChatAccount)) && (this.state.channel.toLowerCase() === 'wechat' || this.state.channel.toLowerCase() === "mobilepush") &&
@@ -1671,7 +1673,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1671
1673
  </Pagination>} */}
1672
1674
  {(((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) &&
1673
1675
  <div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
1674
- <CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesMessage)}</CapHeading>
1676
+ <CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesFound)}</CapHeading>
1675
1677
  </div>}
1676
1678
  </CapRow>
1677
1679
 
@@ -306,5 +306,8 @@ export default defineMessages({
306
306
  id: `${scope}.template`,
307
307
  defaultMessage: 'template',
308
308
  },
309
-
309
+ "noTemplatesFound": {
310
+ id: `${scope}.noTemplatesFound`,
311
+ defaultMessage: 'No templates found',
312
+ },
310
313
  });