@capillarytech/creatives-library 2.0.71 → 2.0.73
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/components/CapTagList/index.js +2 -7
- package/components/EmailMobilePreview/index.scss +0 -1
- package/components/EmailPreviewV2/_emailPreviewV2.scss +4 -1
- package/components/EmailPreviewV2/index.js +1 -1
- package/components/FormBuilder/index.js +18 -8
- package/config/app.js +1 -0
- package/package.json +2 -2
- package/v2Containers/Email/index.js +5 -1
- package/v2Containers/MobilePush/Create/index.js +1 -2
- package/v2Containers/MobilePush/Create/messages.js +4 -0
- package/v2Containers/MobilePush/Edit/index.js +5 -0
- package/v2Containers/MobilePush/commonMethods.js +4 -4
- package/v2Containers/Templates/index.js +52 -9
- package/v2Containers/Templates/messages.js +5 -0
|
@@ -65,13 +65,11 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
65
65
|
return list;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
handleOnChange = (data
|
|
69
|
-
console.log('module data', data, e);
|
|
68
|
+
handleOnChange = (data) => {
|
|
70
69
|
this.props.onContextChange(data);
|
|
71
70
|
};
|
|
72
71
|
|
|
73
|
-
handleDynamicDateChange = (data
|
|
74
|
-
console.log('data.target', data.target.value, e);
|
|
72
|
+
handleDynamicDateChange = (data) => {
|
|
75
73
|
this.setState({dynamicDateValue: data.target.value});
|
|
76
74
|
};
|
|
77
75
|
|
|
@@ -126,7 +124,6 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
126
124
|
this.setState({expandedKeys, autoExpandParent: false});
|
|
127
125
|
};
|
|
128
126
|
togglePopoverVisibility = (visible) => {
|
|
129
|
-
console.log('popover ');
|
|
130
127
|
this.setState({visible});
|
|
131
128
|
};
|
|
132
129
|
|
|
@@ -135,7 +132,6 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
135
132
|
};
|
|
136
133
|
|
|
137
134
|
renderTags(tags, searchString) {
|
|
138
|
-
console.log('final tags list', tags);
|
|
139
135
|
const list = [];
|
|
140
136
|
_.forEach(tags, (val, key) => {
|
|
141
137
|
let supportedTagsString = '';
|
|
@@ -143,7 +139,6 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
143
139
|
supportedTagsString += `${supportedTag} ,`;
|
|
144
140
|
});
|
|
145
141
|
supportedTagsString = supportedTagsString.replace(/,\s*$/, "");
|
|
146
|
-
console.log('supportedTagsString', supportedTagsString);
|
|
147
142
|
if (_.has(val, 'subtags')) {
|
|
148
143
|
const temp = this.renderTags(val.subtags);
|
|
149
144
|
list.push((
|
|
@@ -6,10 +6,13 @@ $classPrefix: email-preview-v2;
|
|
|
6
6
|
overflow-y: auto;
|
|
7
7
|
// font-family: 'proxima-nova';
|
|
8
8
|
overflow: hidden;
|
|
9
|
+
|
|
10
|
+
#email-iframe {
|
|
11
|
+
width: -webkit-fill-available;
|
|
12
|
+
}
|
|
9
13
|
#emailPreivew-content-wrapper{
|
|
10
14
|
width: 100%;
|
|
11
15
|
height: 90%;
|
|
12
|
-
overflow: auto;
|
|
13
16
|
// display: table;
|
|
14
17
|
|
|
15
18
|
#emailPreivew-content {
|
|
@@ -88,7 +88,7 @@ class EmailPreviewV2 extends React.Component {
|
|
|
88
88
|
{currentDevice === devices.mobile ?
|
|
89
89
|
<img src={mobileBody} alt="capillary" width="85%" /> : ''}
|
|
90
90
|
<div className={messageContainerName}>
|
|
91
|
-
<iframe srcDoc={templateContent} {...deviceAspectRatio[currentDevice]} >
|
|
91
|
+
<iframe id="email-iframe" srcDoc={templateContent} {...deviceAspectRatio[currentDevice]} >
|
|
92
92
|
<p><FormattedMessage {...messages.noIframeSupport}/></p>
|
|
93
93
|
</iframe>
|
|
94
94
|
</div>
|
|
@@ -31,7 +31,10 @@ const {CapRadioGroup} = CapRadio;
|
|
|
31
31
|
|
|
32
32
|
// import { FormattedMessage } from 'react-intl';
|
|
33
33
|
// import messages from './messages';
|
|
34
|
-
|
|
34
|
+
const isUrl = (str) => {
|
|
35
|
+
const res = str.match(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g);
|
|
36
|
+
return res;
|
|
37
|
+
};
|
|
35
38
|
class FormBuilder extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
36
39
|
constructor(props) {
|
|
37
40
|
super(props);
|
|
@@ -409,7 +412,10 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
409
412
|
});
|
|
410
413
|
}
|
|
411
414
|
}
|
|
412
|
-
|
|
415
|
+
isValidExternalLink = ({obj, key}) => {
|
|
416
|
+
const url = _.get(obj, key);
|
|
417
|
+
return (url && url !== "" && isUrl(url));
|
|
418
|
+
}
|
|
413
419
|
/* eslint-disable */
|
|
414
420
|
validateForm(tags, injectedTags, isSave, showMessages) {
|
|
415
421
|
|
|
@@ -640,15 +646,15 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
640
646
|
errorData[parseInt(index)]['cta-deeplink2-select'] = false;
|
|
641
647
|
}
|
|
642
648
|
// }
|
|
643
|
-
if(tab
|
|
649
|
+
if(!this.isValidExternalLink({obj: tab, key: 'cta-deeplink-text'})){
|
|
644
650
|
errorData[parseInt(index)][`cta-deeplink-text`] = true;
|
|
645
651
|
isValid = false;
|
|
646
652
|
isCurrentTabValid = false;
|
|
647
653
|
}else {
|
|
648
654
|
errorData[parseInt(index)]['cta-deeplink-text'] = false;
|
|
649
655
|
}
|
|
650
|
-
|
|
651
|
-
if(tab
|
|
656
|
+
|
|
657
|
+
if(!this.isValidExternalLink({obj: tab, key: 'cta-deeplink2-text'})){
|
|
652
658
|
errorData[parseInt(index)][`cta-deeplink2-text`] = true;
|
|
653
659
|
isValid = false;
|
|
654
660
|
isCurrentTabValid = false;
|
|
@@ -671,7 +677,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
671
677
|
}else {
|
|
672
678
|
errorData[parseInt(index)]['secondary-cta-0-label'] = false;
|
|
673
679
|
}
|
|
674
|
-
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
if(!this.isValidExternalLink({obj: tab, key: 'cta-deeplink-secondary-cta-0-text'})){
|
|
675
683
|
errorData[parseInt(index)][`cta-deeplink-secondary-cta-0-text`] = true;
|
|
676
684
|
isValid = false;
|
|
677
685
|
isCurrentTabValid = false;
|
|
@@ -692,7 +700,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
692
700
|
}else {
|
|
693
701
|
errorData[parseInt(index)]['secondary-cta-1-label'] = false;
|
|
694
702
|
}
|
|
695
|
-
|
|
703
|
+
|
|
704
|
+
if(!this.isValidExternalLink({obj: tab, key: 'cta-deeplink-secondary-cta-1-text'})){
|
|
696
705
|
errorData[parseInt(index)][`cta-deeplink-secondary-cta-1-text`] = true;
|
|
697
706
|
isValid = false;
|
|
698
707
|
isCurrentTabValid = false;
|
|
@@ -706,7 +715,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
706
715
|
}else {
|
|
707
716
|
errorData[parseInt(index)]['cta-deeplink-secondary-cta-1-select'] = false;
|
|
708
717
|
}
|
|
709
|
-
|
|
718
|
+
|
|
719
|
+
if(!this.isValidExternalLink({obj: tab, key: 'cta-deeplink-secondary-cta-1-text2'})){
|
|
710
720
|
errorData[parseInt(index)][`cta-deeplink-secondary-cta-1-text2`] = true;
|
|
711
721
|
isValid = false;
|
|
712
722
|
isCurrentTabValid = false;
|
package/config/app.js
CHANGED
|
@@ -8,6 +8,7 @@ const config = {
|
|
|
8
8
|
login_url: 'auth/login',
|
|
9
9
|
//dashboard_url: '/sms',
|
|
10
10
|
dashboard_url: '/v2',
|
|
11
|
+
accountConfig: (strs, accountId) => `org/config/AccountAdd?q=a&channelId=2&accountId=${accountId}&edit=1`,
|
|
11
12
|
},
|
|
12
13
|
development: {
|
|
13
14
|
api_endpoint: 'https://nightly.capillary.in/arya/api/v1/creatives',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capillarytech/creatives-library",
|
|
3
3
|
"author": "meharaj",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.73",
|
|
5
5
|
"description": "Capillary creatives ui",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"module": "./index.es.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "LicenseRef-LICENSE",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@capillarytech/cap-ui-library": "^1.0.
|
|
15
|
+
"@capillarytech/cap-ui-library": "^1.0.144",
|
|
16
16
|
"antd": "3.19.6",
|
|
17
17
|
"axios": "^0.16.2",
|
|
18
18
|
"babel-polyfill": "6.20.0",
|
|
@@ -307,7 +307,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
307
307
|
this.setEditData(nextProps.Email.templateDetails);
|
|
308
308
|
});
|
|
309
309
|
}
|
|
310
|
-
if (this.state.isEdit && nextProps.location.query.module === "library" && !_.isEmpty(nextProps.templateData) && !this.props.params.id && !nextProps.isGetFormData) {
|
|
310
|
+
if (this.state.isEdit && nextProps.location.query.module === "library" && !_.isEmpty(nextProps.templateData) && !this.props.params.id && !nextProps.isGetFormData && _.isEmpty(_.get(this, `state.formData['template-subject']`))) {
|
|
311
311
|
this.startTemplateCreation(nextProps.templateData);
|
|
312
312
|
}
|
|
313
313
|
if (nextProps.location.query.module === 'library' && nextProps.isGetFormData) {
|
|
@@ -2065,6 +2065,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2065
2065
|
"language": this.supportedLanguages[languageIndex].language,
|
|
2066
2066
|
"template-content": !data.base.is_drag_drop && data.base.is_drag_drop !== 1 ? data.base.html_content : "",
|
|
2067
2067
|
};
|
|
2068
|
+
const dragDropId = _.get(data, 'base.drag_drop_id');
|
|
2069
|
+
if (dragDropId) {
|
|
2070
|
+
tempData.drag_drop_id = dragDropId;
|
|
2071
|
+
}
|
|
2068
2072
|
formData[0].base = true;
|
|
2069
2073
|
formData[0].selectedLanguages.push(this.supportedLanguages[languageIndex].iso_code);
|
|
2070
2074
|
formData[0][this.supportedLanguages[languageIndex].iso_code] = tempData;
|
|
@@ -269,7 +269,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
269
269
|
type: "input", //Resembles component to be used
|
|
270
270
|
metaType: "text",
|
|
271
271
|
datatype: "string",
|
|
272
|
-
errorMessage:
|
|
272
|
+
errorMessage: <FormattedMessage {...messages.invalidExternalLink}/>,
|
|
273
273
|
required: true,
|
|
274
274
|
fluid: true,
|
|
275
275
|
width: 18,
|
|
@@ -277,7 +277,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
277
277
|
style: {
|
|
278
278
|
width: '100%',
|
|
279
279
|
|
|
280
|
-
marginBottom: '16px',
|
|
281
280
|
},
|
|
282
281
|
styling: "semantic",
|
|
283
282
|
order: 1,
|
|
@@ -154,6 +154,10 @@ export default defineMessages({
|
|
|
154
154
|
id: 'app.containers.MobilePush.Create.externalLinkCantEmpty',
|
|
155
155
|
defaultMessage: 'External Link cannot be empty',
|
|
156
156
|
},
|
|
157
|
+
"invalidExternalLink": {
|
|
158
|
+
id: 'app.containers.MobilePush.Create.invalidExternalLink',
|
|
159
|
+
defaultMessage: 'External Link cannot be empty / Invalid url',
|
|
160
|
+
},
|
|
157
161
|
"Do you really want to go back? All your temporary changes will be lost!": {
|
|
158
162
|
id: 'app.containers.MobilePush.Create.goBackConfirmation',
|
|
159
163
|
defaultMessage: "Going back will discard all the changes you've made. Continue?",
|
|
@@ -604,6 +604,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
604
604
|
}
|
|
605
605
|
if (androidData) {
|
|
606
606
|
if (androidData.cta) {
|
|
607
|
+
android['add-pri-cta'] = true;
|
|
607
608
|
android['cta-deeplink'] = androidData.cta.type === "DEEP_LINK" ? "Deeplink" : "External Link";
|
|
608
609
|
if ( androidData.cta.type === "DEEP_LINK") {
|
|
609
610
|
android['cta-deeplink-select'] = androidData ? androidData.cta.actionLink : '';
|
|
@@ -623,6 +624,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
623
624
|
android.image = androidData.expandableDetails.image;
|
|
624
625
|
}
|
|
625
626
|
if (androidData.expandableDetails && androidData.expandableDetails.ctas && androidData.expandableDetails.ctas.length) {
|
|
627
|
+
android['add-sec-cta'] = true;
|
|
626
628
|
android['cta-deeplink-secondary-cta-0'] = androidData.expandableDetails.ctas[0].type === "DEEP_LINK" ? "Deeplink" : "External Link";
|
|
627
629
|
if ( androidData.expandableDetails.ctas[0].type === "DEEP_LINK") {
|
|
628
630
|
android['cta-deeplink-secondary-cta-0-select'] = androidData.expandableDetails.ctas[0].actionLink;
|
|
@@ -640,6 +642,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
640
642
|
}
|
|
641
643
|
}
|
|
642
644
|
if (androidData.expandableDetails && androidData.expandableDetails.ctas && androidData.expandableDetails.ctas.length > 1) {
|
|
645
|
+
android['add-sec-cta-2'] = true;
|
|
643
646
|
android['cta-deeplink-secondary-cta-1'] = androidData.expandableDetails.ctas[1].type === "DEEP_LINK" ? "Deeplink" : "External Link";
|
|
644
647
|
if (androidData.expandableDetails.ctas[1].type === "DEEP_LINK") {
|
|
645
648
|
android['cta-deeplink-secondary-cta-1-select'] = androidData.expandableDetails.ctas[1].actionLink;
|
|
@@ -667,6 +670,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
667
670
|
}
|
|
668
671
|
if (iosData) {
|
|
669
672
|
if (iosData.cta) {
|
|
673
|
+
ios['add-pri-cta-ios'] = true;
|
|
670
674
|
ios['cta-deeplink2'] = iosData.cta.type === "DEEP_LINK" ? "Deeplink" : "External Link";
|
|
671
675
|
if (iosData.cta.type === "DEEP_LINK") {
|
|
672
676
|
ios['cta-deeplink2-select'] = iosData ? iosData.cta.actionLink : '';
|
|
@@ -689,6 +693,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
689
693
|
ios.image = iosData.expandableDetails.image;
|
|
690
694
|
}
|
|
691
695
|
if (iosData.expandableDetails && iosData.expandableDetails.ctas && iosData.expandableDetails.ctas.length) {
|
|
696
|
+
iosData['add-sec-cta-ios'] = true;
|
|
692
697
|
if (iosData.expandableDetails.ctas[0].type) {
|
|
693
698
|
ios['cta-deeplink-secondary-cta-1'] = iosData.expandableDetails.ctas[0].type === "DEEP_LINK" ? "Deeplink" : "External Link";
|
|
694
699
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {get, filter, cloneDeep} from 'lodash';
|
|
2
|
-
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import {FormattedMessage} from 'react-intl';
|
|
4
|
+
import messages from './Create/messages';
|
|
3
5
|
function getPrimaryCtaFields({inputFields, fieldIndex, deepLinkOptions}) {
|
|
4
6
|
const newInputFields = cloneDeep(inputFields);
|
|
5
7
|
newInputFields.splice(fieldIndex + 1, 0, {
|
|
@@ -205,15 +207,13 @@ function getLinkTypeFields({inputFieldsArgs, fieldIndex, deepLinkOptions, formDa
|
|
|
205
207
|
type: "input", //Resembles component to be used
|
|
206
208
|
metaType: "text",
|
|
207
209
|
datatype: "string",
|
|
208
|
-
errorMessage:
|
|
210
|
+
errorMessage: <FormattedMessage {...messages.invalidExternalLink}/>,
|
|
209
211
|
required: true,
|
|
210
212
|
fluid: true,
|
|
211
213
|
width: 18,
|
|
212
214
|
offset: 1,
|
|
213
215
|
style: {
|
|
214
216
|
width: '100%',
|
|
215
|
-
|
|
216
|
-
marginBottom: '16px',
|
|
217
217
|
},
|
|
218
218
|
styling: "semantic",
|
|
219
219
|
order: 1,
|
|
@@ -8,13 +8,14 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { connect } from 'react-redux';
|
|
11
|
+
import styled from 'styled-components';
|
|
11
12
|
import {injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
12
13
|
import { createStructuredSelector } from 'reselect';
|
|
13
14
|
import moment from "moment";
|
|
14
15
|
import _ from 'lodash';
|
|
15
16
|
import { bindActionCreators } from 'redux';
|
|
16
17
|
import { Modal} from 'antd';
|
|
17
|
-
import {CapMenu, CapDropdown, CapButton, CapInput, CapIcon, CapSelect, CapPopover, CapSpin, CapCustomCard, CapRow, CapSlideBox} from '@capillarytech/cap-ui-library';
|
|
18
|
+
import {CapMenu, CapDropdown, CapButton, CapInput, CapIcon, CapSelect, CapPopover, CapSpin, CapCustomCard, CapRow, CapSlideBox, CapLink, CapHeading} from '@capillarytech/cap-ui-library';
|
|
18
19
|
import { makeSelectTemplates, makeSelectTemplatesResponse } from './selectors';
|
|
19
20
|
import { makeSelectCreate as makeSelectCreateSms} from '../Sms/Create/selectors';
|
|
20
21
|
import { makeSelectCreate as makeSelectCreateMobilePush } from '../MobilePush/Create/selectors';
|
|
@@ -33,6 +34,7 @@ import * as ebillActions from '../Ebill/actions';
|
|
|
33
34
|
import * as emailActions from '../Email/actions';
|
|
34
35
|
import * as lineActions from '../Line/Create/actions';
|
|
35
36
|
import CardGrid from '../../components/CardGrid';
|
|
37
|
+
import config from '../../config/app';
|
|
36
38
|
import './_templates.scss';
|
|
37
39
|
import * as globalActions from '../Cap/actions';
|
|
38
40
|
import { makeSelectAuthenticated } from '../Cap/selectors';
|
|
@@ -44,7 +46,15 @@ import CreativesContainer from '../CreativesContainer';
|
|
|
44
46
|
import WechatRichmediaTemplatePreview from '../../components/TemplatePreview/WechatRichmediaTemplatePreview';
|
|
45
47
|
import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE } from '../CreativesContainer/constants';
|
|
46
48
|
const {CapCustomCardList} = CapCustomCard;
|
|
47
|
-
|
|
49
|
+
const InlineDiv = styled.div`
|
|
50
|
+
display: inline;
|
|
51
|
+
.ant-anchor.fixed{
|
|
52
|
+
display: inline;
|
|
53
|
+
.ant-anchor-link{
|
|
54
|
+
display: inline;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
48
58
|
export class Templates extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
49
59
|
constructor(props) {
|
|
50
60
|
super(props);
|
|
@@ -141,7 +151,14 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
141
151
|
queryParams.originalId = this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier;
|
|
142
152
|
}
|
|
143
153
|
if (this.state.channel.toLowerCase() === "mobilepush" && !_.isEmpty(this.props.Templates.selectedWeChatAccount)) {
|
|
144
|
-
|
|
154
|
+
const account = this.props.Templates.selectedWeChatAccount;
|
|
155
|
+
queryParams.accountId = account.id;
|
|
156
|
+
const isAndroidSupported = _.get(account, "configs.android") === '1';
|
|
157
|
+
const isIosSupported = _.get(account, "configs.ios") === '1';
|
|
158
|
+
if (!(isAndroidSupported || isIosSupported)) {
|
|
159
|
+
this.props.actions.resetAccount();
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
145
162
|
}
|
|
146
163
|
queryParams.page = this.state.page;
|
|
147
164
|
queryParams.perPage = this.state.perPageLimit;
|
|
@@ -360,8 +377,17 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
360
377
|
params.originalId = this.props.Templates.weCrmAccounts[_.findIndex(this.props.Templates.weCrmAccounts, { name: value})].sourceAccountIdentifier;
|
|
361
378
|
} else if (this.state.channel.toLowerCase() === 'mobilepush') {
|
|
362
379
|
this.props.actions.setWeChatAccount(this.props.Templates.weCrmAccounts[_.findIndex(this.props.Templates.weCrmAccounts, { name: value})]);
|
|
363
|
-
|
|
380
|
+
const account = this.props.Templates.weCrmAccounts[_.findIndex(this.props.Templates.weCrmAccounts, { name: value})];
|
|
381
|
+
params.accountId = account.id;
|
|
382
|
+
const isAndroidSupported = _.get(account, "configs.android") === '1';
|
|
383
|
+
const isIosSupported = _.get(account, "configs.ios") === '1';
|
|
384
|
+
if (!(isAndroidSupported || isIosSupported)) {
|
|
385
|
+
this.setState({selectedAccountError: true});
|
|
386
|
+
this.props.actions.resetTemplate();
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
364
389
|
}
|
|
390
|
+
|
|
365
391
|
console.log("getAllTemplates params: ", params);
|
|
366
392
|
this.getAllTemplates({params, resetPage: true});
|
|
367
393
|
});
|
|
@@ -501,15 +527,27 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
501
527
|
}
|
|
502
528
|
return templateData;
|
|
503
529
|
}) : [];
|
|
530
|
+
const accountId = _.get(this.props, 'Templates.selectedWeChatAccount.uuid');
|
|
504
531
|
return (<div>
|
|
505
532
|
{filterContent}
|
|
506
533
|
<CapSpin spinning={isLoading} tip={loadingTip}>
|
|
507
534
|
{!_.isEmpty(templates) && <div className="pagination-container">
|
|
508
535
|
<CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={currentChannel} />
|
|
509
536
|
</div>}
|
|
510
|
-
{(this.state.selectedAccount === '' && _.isEmpty(this.props.Templates.selectedWeChatAccount)) && (this.state.channel.toLowerCase() === 'wechat' || this.state.channel.toLowerCase() === "mobilepush") &&
|
|
511
|
-
|
|
537
|
+
{(this.state.selectedAccount === '' && _.isEmpty(this.props.Templates.selectedWeChatAccount)) && (this.state.channel.toLowerCase() === 'wechat' || this.state.channel.toLowerCase() === "mobilepush") &&
|
|
538
|
+
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
539
|
+
<CapHeading type="h6">{this.props.intl.formatMessage(messages.noAccountMessage)}</CapHeading>
|
|
512
540
|
</div>}
|
|
541
|
+
{ !_.isEmpty(this.props.Templates.selectedWeChatAccount) && this.state.channel.toLowerCase() === "mobilepush" && this.state.selectedAccountError &&
|
|
542
|
+
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
543
|
+
<CapHeading type="h6" >
|
|
544
|
+
{this.props.intl.formatMessage(messages.accountConfigError)}
|
|
545
|
+
<InlineDiv>
|
|
546
|
+
<CapLink title="here" style={{display: 'inline'}} onClick={() => { window.open(config.production.accountConfig`${accountId}`); }}/>
|
|
547
|
+
</InlineDiv>
|
|
548
|
+
</CapHeading>
|
|
549
|
+
</div>
|
|
550
|
+
}
|
|
513
551
|
</CapSpin>
|
|
514
552
|
|
|
515
553
|
</div>);
|
|
@@ -1282,9 +1320,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1282
1320
|
isFullMode = () => this.props.location.query.type !== "embedded" || this.props.isFullMode
|
|
1283
1321
|
isCreateDisabled = () => {
|
|
1284
1322
|
let isDisabled = this.isLoading();
|
|
1285
|
-
|
|
1323
|
+
const channel = this.state.channel.toUpperCase();
|
|
1324
|
+
if (channel === MOBILE_PUSH || channel === WECHAT) {
|
|
1286
1325
|
isDisabled = isDisabled || _.isEmpty(this.props.Templates.selectedWeChatAccount);
|
|
1287
1326
|
}
|
|
1327
|
+
if (channel === MOBILE_PUSH) {
|
|
1328
|
+
isDisabled = isDisabled || this.state.selectedAccountError;
|
|
1329
|
+
}
|
|
1288
1330
|
return isDisabled;
|
|
1289
1331
|
}
|
|
1290
1332
|
|
|
@@ -1569,8 +1611,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1569
1611
|
>
|
|
1570
1612
|
</CardGrid>
|
|
1571
1613
|
</Pagination>} */}
|
|
1572
|
-
{(((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 &&
|
|
1573
|
-
<
|
|
1614
|
+
{(((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 &&
|
|
1615
|
+
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
1616
|
+
<CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesMessage)}</CapHeading>
|
|
1574
1617
|
</div>}
|
|
1575
1618
|
</CapRow>
|
|
1576
1619
|
<CapRow>
|
|
@@ -270,4 +270,9 @@ export default defineMessages({
|
|
|
270
270
|
id: `${scope}.wechatAccountNotConfigured`,
|
|
271
271
|
defaultMessage: 'Selected wechat account is not configured to create wechat templates',
|
|
272
272
|
},
|
|
273
|
+
"accountConfigError": {
|
|
274
|
+
id: `${scope}.accountConfigError`,
|
|
275
|
+
defaultMessage: 'This account is not configured properly. You can configure it ',
|
|
276
|
+
},
|
|
277
|
+
|
|
273
278
|
});
|