@capillarytech/creatives-library 6.5.1 → 6.6.1

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/index.html CHANGED
@@ -10,10 +10,7 @@
10
10
  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
11
11
  <meta http-equiv="Pragma" content="no-cache" />
12
12
  <meta http-equiv="Expires" content="0" />
13
- <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
14
13
  <script src="https://use.typekit.net/ifw1ntv.js"></script>
15
- <!-- Roboto Font -->
16
- <link href="https://fonts.googleapis.com/css?family=Roboto:400,500" rel="stylesheet">
17
14
  <!-- Google Tag Manager -->
18
15
  <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
19
16
  new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
@@ -43,5 +40,8 @@
43
40
  </div>
44
41
  </div>
45
42
  <!-- A lot of magic happens in this file. HtmlWebpackPlugin automatically includes all assets (e.g. bundle.js, main.css) with the correct HTML tags, which is why they are missing in this HTML file. Don't add any assets here! (Check out webpackconfig.js if you want to know more) -->
43
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons&display=swap" rel="stylesheet">
44
+ <!-- Roboto Font -->
45
+ <link href="https://fonts.googleapis.com/css?family=Roboto:400,500&display=swap" rel="stylesheet">
46
46
  </body>
47
47
  </html>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "6.5.1",
4
+ "version": "6.6.1",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -15,3 +15,5 @@ export const WECHAT = "WECHAT";
15
15
  export const FACEBOOK = "FACEBOOK";
16
16
  export const SHOW_CONTANER_LOADER = "app/CreativesContainer/SHOW_CONTANER_LOADER";
17
17
  export const HIDE_CONTAINER_LOADER = "app/CreativesContainer/HIDE_CONTAINER_LOADER";
18
+ export const ANDROID = "android";
19
+ export const IOS = "ios";
@@ -27,6 +27,7 @@ import messages from './messages';
27
27
  import getEventsMap from '../eventsMap';
28
28
  import { GA } from '@capillarytech/cap-ui-utils';
29
29
  import { TRACK_CREATE_MPUSH } from '../../App/constants';
30
+ import { ANDROID, IOS } from '../../CreativesContainer/constants';
30
31
 
31
32
  const PrefixWrapper = styled.div`
32
33
  margin-right: 16px;
@@ -103,8 +104,10 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
103
104
  }
104
105
  if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && isEmpty(this.state.schema)) {
105
106
  const schema = this.props.params.mode === "text" ? nextProps.metaEntities.layouts[0].definition.textSchema : nextProps.metaEntities.layouts[0].definition.imageSchema;
106
- const isAndroidSupported = get(this, "props.Templates.selectedWeChatAccount.configs.android") === '1';
107
- const isIosSupported = get(this, "props.Templates.selectedWeChatAccount.configs.ios") === '1';
107
+ const account = this.props.Templates.selectedWeChatAccount;
108
+ const { commChannels = [] } = account;
109
+ const isAndroidSupported = commChannels.includes(ANDROID);
110
+ const isIosSupported = commChannels.includes(IOS);
108
111
  if (!isAndroidSupported) {
109
112
  const androidField = get(schema, "containers[0].panes[0]");
110
113
  androidField.isSupported = false;
@@ -31,6 +31,7 @@ import getEventsMap from '../eventsMap';
31
31
  import {getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields} from '../commonMethods';
32
32
  import { GA } from '@capillarytech/cap-ui-utils';
33
33
  import { TRACK_EDIT_MPUSH } from '../../App/constants';
34
+ import { ANDROID, IOS } from '../../CreativesContainer/constants';
34
35
 
35
36
  const PrefixWrapper = styled.div`
36
37
  margin-right: 16px;
@@ -145,8 +146,10 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
145
146
  this.props = nextProps;
146
147
  const mode = nextProps.templateDetails.definition ? nextProps.templateDetails.definition.mode : nextProps.templateDetails.mode;
147
148
  const schema = mode === "text" ? this.state.fullSchema.textSchema : this.state.fullSchema.imageSchema;
148
- const isAndroidSupported = get(this, "props.Templates.selectedWeChatAccount.configs.android") === '1';
149
- const isIosSupported = get(this, "props.Templates.selectedWeChatAccount.configs.ios") === '1';
149
+ const account = this.props.Templates.selectedWeChatAccount;
150
+ const { commChannels = [] } = account;
151
+ const isAndroidSupported = commChannels.includes(ANDROID);
152
+ const isIosSupported = commChannels.includes(IOS);
150
153
  if (!isAndroidSupported) {
151
154
  const androidField = get(schema, "containers[0].panes[0]");
152
155
  androidField.isSupported = false;
@@ -51,7 +51,7 @@ import EmailPreview from '../../v2Components/EmailPreview';
51
51
  import CreativesContainer from '../CreativesContainer';
52
52
  import WechatRichmediaTemplatePreview from '../../v2Components/TemplatePreview/WechatRichmediaTemplatePreview';
53
53
  import { CHANNEL_CREATE_TRACK_MAPPING, CHANNEL_EDIT_TRACK_MAPPING } from '../App/constants';
54
- import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE } from '../CreativesContainer/constants';
54
+ import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, ANDROID, IOS } from '../CreativesContainer/constants';
55
55
  import emailIllustration from '../Assets/images/emailIllustration.svg';
56
56
  import smsIllustration from '../Assets/images/smsIllustration.svg';
57
57
  import pushIllustration from '../Assets/images/pushIllustration.svg';
@@ -193,11 +193,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
193
193
  queryParams.originalId = this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier;
194
194
  }
195
195
  if (this.state.channel.toLowerCase() === "mobilepush" && !isEmpty(this.props.Templates.selectedWeChatAccount)) {
196
- const account = this.props.Templates.selectedWeChatAccount;
197
196
  queryParams.accountId = account.id;
198
- const isAndroidSupported = get(account, "configs.android") === '1';
199
- const isIosSupported = get(account, "configs.ios") === '1';
200
- if (!(isAndroidSupported || isIosSupported)) {
197
+ if (!this.isAndroidOrIosSuppoerted()) {
201
198
  this.props.actions.resetAccount();
202
199
  return;
203
200
  }
@@ -422,8 +419,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
422
419
  this.props.actions.setWeChatAccount(this.props.Templates.weCrmAccounts[findIndex(this.props.Templates.weCrmAccounts, { name: value})]);
423
420
  const account = this.props.Templates.weCrmAccounts[findIndex(this.props.Templates.weCrmAccounts, { name: value})];
424
421
  params.accountId = account.id;
425
- const isAndroidSupported = get(account, "configs.android") === '1';
426
- const isIosSupported = get(account, "configs.ios") === '1';
422
+ const { commChannels = [] } = account;
423
+ const isAndroidSupported = commChannels.includes(ANDROID);
424
+ const isIosSupported = commChannels.includes(IOS);
427
425
  if (!(isAndroidSupported || isIosSupported)) {
428
426
  this.setState({selectedAccountError: true});
429
427
  this.props.actions.resetTemplate();
@@ -692,6 +690,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
692
690
 
693
691
  </div>);
694
692
  }
693
+ isAndroidOrIosSuppoerted = () => {
694
+ const account = this.props.Templates.selectedWeChatAccount || {};
695
+ const { commChannels = [] } = account;
696
+ const isAndroidSupported = commChannels.includes(ANDROID);
697
+ const isIosSupported = commChannels.includes(IOS);
698
+ return isAndroidSupported || isIosSupported;
699
+ }
695
700
  filterLineTemplates = (templates) => {
696
701
  const { lineFilter } = this.state;
697
702
  if (LINE_FILTERS.ALL === lineFilter) {
@@ -1554,7 +1559,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1554
1559
  return {};
1555
1560
  }
1556
1561
  }
1557
- 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')))
1562
+ checkSearchDisabled = () => (this.props.route.name === "mobilepush" && !(this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier && this.isAndroidOrIosSuppoerted()))
1558
1563
  renderEmailPreviewModal() {
1559
1564
  const slideboxContent = (
1560
1565
  <div style={{height: "75vh", width: '55vw'}}>