@capillarytech/creatives-library 3.4.4 → 3.4.5
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/config/app.js +0 -2
- package/index.js +0 -6
- package/initialState.js +0 -3
- package/package.json +1 -2
- package/routes.js +1 -6
- package/services/api.js +9 -25
- package/translations/en.json +0 -56
- package/translations/zh.json +0 -56
- package/v2Components/NavigationBar/index.js +10 -5
- package/v2Components/NavigationBar/messages.js +0 -28
- package/v2Containers/App/constants.js +0 -30
- package/v2Containers/Cap/index.js +0 -5
- package/v2Containers/CreativesContainer/SlideBoxContent.js +0 -18
- package/v2Containers/CreativesContainer/constants.js +0 -1
- package/v2Containers/CreativesContainer/index.js +1 -10
- package/v2Containers/Email/index.js +1 -9
- package/v2Containers/Email/messages.js +0 -8
- package/v2Containers/EmailWrapper/index.js +1 -15
- package/v2Containers/MobilePush/Create/index.js +0 -8
- package/v2Containers/MobilePush/Edit/index.js +0 -8
- package/v2Containers/Sms/Create/index.js +1 -6
- package/v2Containers/Sms/Edit/index.js +1 -6
- package/v2Containers/Templates/index.js +3 -9
- package/v2Containers/TemplatesV2/index.js +22 -53
- package/v2Containers/TemplatesV2/messages.js +0 -4
- package/v2Containers/WeChat/MapTemplates/index.js +1 -9
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +2 -9
- package/v2Components/MarketingObjective/MarketingObjective.style.js +0 -73
- package/v2Components/MarketingObjective/index.js +0 -107
- package/v2Components/MarketingObjective/messages.js +0 -23
- package/v2Containers/Facebook/Facebook.style.js +0 -75
- package/v2Containers/Facebook/actions.js +0 -13
- package/v2Containers/Facebook/constants.js +0 -25
- package/v2Containers/Facebook/index.js +0 -358
- package/v2Containers/Facebook/messages.js +0 -167
- package/v2Containers/Facebook/reducer.js +0 -31
- package/v2Containers/Facebook/sagas.js +0 -41
- package/v2Containers/Facebook/selectors.js +0 -20
|
@@ -207,14 +207,6 @@ class Creatives extends React.Component {
|
|
|
207
207
|
};
|
|
208
208
|
break;
|
|
209
209
|
}
|
|
210
|
-
case constants.FACEBOOK: {
|
|
211
|
-
creativesTemplateData = {
|
|
212
|
-
selectedMarketingObjective: templateData.selectedMarketingObjective,
|
|
213
|
-
edit: true,
|
|
214
|
-
type: channel,
|
|
215
|
-
};
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
210
|
default:
|
|
219
211
|
break;
|
|
220
212
|
}
|
|
@@ -473,7 +465,7 @@ class Creatives extends React.Component {
|
|
|
473
465
|
}
|
|
474
466
|
render() {
|
|
475
467
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
476
|
-
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails
|
|
468
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails} = this.props;
|
|
477
469
|
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
478
470
|
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
479
471
|
return (
|
|
@@ -538,7 +530,6 @@ class Creatives extends React.Component {
|
|
|
538
530
|
weChatMaptemplateStep={weChatMaptemplateStep}
|
|
539
531
|
selectedWeChatAccount={selectedWeChatAccount}
|
|
540
532
|
onWeChatMaptemplateStepChange={this.onWeChatMaptemplateStepChange}
|
|
541
|
-
onFacebookSubmit={getCreativesData}
|
|
542
533
|
/>
|
|
543
534
|
}
|
|
544
535
|
footer={this.shouldShowFooter() &&
|
|
@@ -29,8 +29,6 @@ import EmailPreview from '../../v2Components/EmailPreview';
|
|
|
29
29
|
import Pagination from '../../v2Components/Pagination';
|
|
30
30
|
import * as creativesContainerActions from '../CreativesContainer/actions';
|
|
31
31
|
import withCreatives from '../../hoc/withCreatives';
|
|
32
|
-
import { GA } from '@capillarytech/cap-ui-utils';
|
|
33
|
-
import { TRACK_CREATE_EMAIL, TRACK_EDIT_EMAIL } from '../App/constants';
|
|
34
32
|
|
|
35
33
|
const {CapCustomCardList} = CapCustomCard;
|
|
36
34
|
export class Email extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
@@ -622,16 +620,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
622
620
|
});
|
|
623
621
|
}
|
|
624
622
|
onUpdateTemplateComplete = (createResponse) => {
|
|
625
|
-
const isEdit = this.state.isEdit;
|
|
626
|
-
GA.timeTracker.stopTimer(isEdit ? TRACK_EDIT_EMAIL : TRACK_CREATE_EMAIL, {
|
|
627
|
-
category: 'Creatives',
|
|
628
|
-
action: isEdit ? 'Create' : 'Edit',
|
|
629
|
-
label: 'using editor',
|
|
630
|
-
});
|
|
631
623
|
if (createResponse && createResponse.templateId) {
|
|
632
624
|
// this.resetSchema();
|
|
633
625
|
let message;
|
|
634
|
-
if (isEdit) {
|
|
626
|
+
if (this.state.isEdit) {
|
|
635
627
|
message = this.props.intl.formatMessage(messages.emailEditSuccess);
|
|
636
628
|
} else {
|
|
637
629
|
message = this.props.intl.formatMessage(messages.emailCreateSuccess);
|
|
@@ -286,12 +286,4 @@ export default defineMessages({
|
|
|
286
286
|
id: 'creatives.containersV2.Email.h3imageSelection',
|
|
287
287
|
defaultMessage: 'Image selection',
|
|
288
288
|
},
|
|
289
|
-
"English": {
|
|
290
|
-
id: 'creatives.containersV2.Email.english',
|
|
291
|
-
defaultMessage: 'English',
|
|
292
|
-
},
|
|
293
|
-
"Add label": {
|
|
294
|
-
id: 'creatives.containersV2.Email.addLabel',
|
|
295
|
-
defaultMessage: 'Add label',
|
|
296
|
-
},
|
|
297
289
|
});
|
|
@@ -7,7 +7,6 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { connect } from 'react-redux';
|
|
9
9
|
import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
|
|
10
|
-
import { GA } from '@capillarytech/cap-ui-utils';
|
|
11
10
|
import { createStructuredSelector } from 'reselect';
|
|
12
11
|
import { bindActionCreators } from 'redux';
|
|
13
12
|
import _ from 'lodash';
|
|
@@ -20,10 +19,7 @@ import * as templatesActionsCreators from '../Templates/actions';
|
|
|
20
19
|
import Email from '../Email';
|
|
21
20
|
import CmsTemplatesComponent from '../../v2Components/CmsTemplatesComponent';
|
|
22
21
|
import messages from './messages';
|
|
23
|
-
import { CHANNEL_CREATE_TRACK_MAPPING } from '../App/constants'
|
|
24
|
-
|
|
25
22
|
const CapRadioCardWithLabel = ComponentWithLabelHOC(CapRadioCard);
|
|
26
|
-
const { timeTracker } = GA;
|
|
27
23
|
const CardContainer = styled.div`
|
|
28
24
|
margin-top: 16px;
|
|
29
25
|
.ant-radio-group{
|
|
@@ -110,16 +106,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
110
106
|
};
|
|
111
107
|
CapNotification.error(message);
|
|
112
108
|
}
|
|
113
|
-
stopTimerGA=()=>{
|
|
114
|
-
// stop timer
|
|
115
|
-
timeTracker.stopTimer(CHANNEL_CREATE_TRACK_MAPPING['email'], {
|
|
116
|
-
category: 'Creatives',
|
|
117
|
-
action: 'Create',
|
|
118
|
-
label: 'uploadZip',
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
109
|
handleFileUpload = (file) => {
|
|
122
|
-
|
|
123
110
|
const { templatesActions, intl, showNextStep, isUploading } = this.props;
|
|
124
111
|
if (!isUploading) {
|
|
125
112
|
const fileExtension = file.name.split('.').pop();
|
|
@@ -129,9 +116,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
129
116
|
if (supportedZipFormats.indexOf(fileExtension.toLowerCase()) !== -1) {
|
|
130
117
|
templatesActions.handleZipUpload(file.originFileObj, () => { //handle upload success
|
|
131
118
|
this.setState({ modeContent: { file } }, showNextStep);
|
|
132
|
-
stopTimerGA();
|
|
133
119
|
}, this.handleZipUploadError);
|
|
134
|
-
|
|
135
120
|
} else if (fileExtension === 'html' || fileExtension === 'htm') {
|
|
136
121
|
const reader = new FileReader();
|
|
137
122
|
reader.onload = () => {
|
|
@@ -139,6 +124,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
139
124
|
this.setState({ modeContent: { file } }, () => {
|
|
140
125
|
templatesActions.handleHtmlUpload(text);
|
|
141
126
|
});
|
|
127
|
+
|
|
142
128
|
// showNextStep();
|
|
143
129
|
};
|
|
144
130
|
reader.readAsText(file.originFileObj);
|
|
@@ -25,8 +25,6 @@ import {getMessageObject} from '../../../utils/messageUtils';
|
|
|
25
25
|
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
26
26
|
import messages from './messages';
|
|
27
27
|
import getEventsMap from '../eventsMap';
|
|
28
|
-
import { GA } from '@capillarytech/cap-ui-utils';
|
|
29
|
-
import { TRACK_CREATE_MPUSH } from '../../App/constants';
|
|
30
28
|
|
|
31
29
|
const PrefixWrapper = styled.div`
|
|
32
30
|
margin-right: 16px;
|
|
@@ -1404,13 +1402,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1404
1402
|
saveFormData = (formData) => {
|
|
1405
1403
|
//this function gets called from form bulder only when the form data is valid
|
|
1406
1404
|
const obj = this.getTransformedData(formData);
|
|
1407
|
-
const label = this.props.location.pathname.indexOf('image') >= 0 ? 'image' : 'text';
|
|
1408
1405
|
this.props.actions.createTemplate(obj, () => {
|
|
1409
|
-
GA.timeTracker.stopTimer(TRACK_CREATE_MPUSH, {
|
|
1410
|
-
category: 'Creatives',
|
|
1411
|
-
action: 'Create',
|
|
1412
|
-
label,
|
|
1413
|
-
});
|
|
1414
1406
|
this.discardValues();
|
|
1415
1407
|
const message = this.props.intl.formatMessage(messages.messageCreateSuccess);
|
|
1416
1408
|
CapNotification.success({message, key: 'createMpushSuccess'});
|
|
@@ -29,8 +29,6 @@ import withCreatives from '../../../hoc/withCreatives';
|
|
|
29
29
|
|
|
30
30
|
import getEventsMap from '../eventsMap';
|
|
31
31
|
import {getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields} from '../commonMethods';
|
|
32
|
-
import { GA } from '@capillarytech/cap-ui-utils';
|
|
33
|
-
import { TRACK_EDIT_MPUSH } from '../../App/constants';
|
|
34
32
|
|
|
35
33
|
const PrefixWrapper = styled.div`
|
|
36
34
|
margin-right: 16px;
|
|
@@ -273,12 +271,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
273
271
|
};
|
|
274
272
|
onUpdateTemplateComplete = () => {
|
|
275
273
|
console.log('reseting schema');
|
|
276
|
-
const label = this.props.location.pathname.indexOf('image') >= 0 ? 'image' : 'text';
|
|
277
|
-
GA.timeTracker.stopTimer(TRACK_EDIT_MPUSH, {
|
|
278
|
-
category: 'Creatives',
|
|
279
|
-
action: 'Edit',
|
|
280
|
-
label,
|
|
281
|
-
});
|
|
282
274
|
this.resetSchema();
|
|
283
275
|
this.setState({
|
|
284
276
|
formData: {},
|
|
@@ -26,8 +26,7 @@ import {SMS} from '../../CreativesContainer/constants';
|
|
|
26
26
|
// import callNativeEvent from '../../../utils/callNativeEvent';
|
|
27
27
|
import {showError} from '../commonMethods';
|
|
28
28
|
import withCreatives from '../../../hoc/withCreatives';
|
|
29
|
-
|
|
30
|
-
import { TRACK_CREATE_SMS } from '../../App/constants'
|
|
29
|
+
|
|
31
30
|
export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
32
31
|
constructor(props) {
|
|
33
32
|
super(props);
|
|
@@ -202,10 +201,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
202
201
|
this.setState({currentTab: data});
|
|
203
202
|
}
|
|
204
203
|
onCreateTemplateComplete = (editResponse) => {
|
|
205
|
-
GA.timeTracker.stopTimer(TRACK_CREATE_SMS, {
|
|
206
|
-
category: 'Creatives',
|
|
207
|
-
action: 'Create',
|
|
208
|
-
});
|
|
209
204
|
if (editResponse.templateId) {
|
|
210
205
|
this.resetSchema();
|
|
211
206
|
this.setState({
|
|
@@ -25,8 +25,7 @@ import * as creativesContainerActions from '../../CreativesContainer/actions';
|
|
|
25
25
|
// import callNativeEvent from '../../../utils/callNativeEvent';
|
|
26
26
|
import {showError} from '../commonMethods';
|
|
27
27
|
import withCreatives from '../../../hoc/withCreatives';
|
|
28
|
-
|
|
29
|
-
import { GA } from '@capillarytech/cap-ui-utils';
|
|
28
|
+
|
|
30
29
|
export class Edit extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
31
30
|
constructor(props) {
|
|
32
31
|
super(props);
|
|
@@ -220,10 +219,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
220
219
|
this.setState({currentTab: data});
|
|
221
220
|
}
|
|
222
221
|
onUpdateTemplateComplete = (editResponse) => {
|
|
223
|
-
GA.timeTracker.stopTimer(TRACK_EDIT_SMS, {
|
|
224
|
-
category: 'Creatives',
|
|
225
|
-
action: 'Edit',
|
|
226
|
-
});
|
|
227
222
|
if (editResponse.templateId) {
|
|
228
223
|
this.resetSchema();
|
|
229
224
|
this.setState({
|
|
@@ -50,14 +50,13 @@ import Pagination from '../../v2Components/Pagination';
|
|
|
50
50
|
import EmailPreview from '../../v2Components/EmailPreview';
|
|
51
51
|
import CreativesContainer from '../CreativesContainer';
|
|
52
52
|
import WechatRichmediaTemplatePreview from '../../v2Components/TemplatePreview/WechatRichmediaTemplatePreview';
|
|
53
|
-
import { CHANNEL_CREATE_TRACK_MAPPING, CHANNEL_EDIT_TRACK_MAPPING } from '../App/constants'
|
|
54
53
|
import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE } from '../CreativesContainer/constants';
|
|
55
54
|
import emailIllustration from '../Assets/images/emailIllustration.svg';
|
|
56
55
|
import smsIllustration from '../Assets/images/smsIllustration.svg';
|
|
57
56
|
import pushIllustration from '../Assets/images/pushIllustration.svg';
|
|
58
57
|
import { CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
|
|
59
|
+
|
|
61
60
|
const {CapCustomCardList} = CapCustomCard;
|
|
62
61
|
const InlineDiv = styled.div`
|
|
63
62
|
display: inline;
|
|
@@ -76,8 +75,6 @@ const WECHAT_FILTERS = {
|
|
|
76
75
|
RICHMEDIA: 'richmedia',
|
|
77
76
|
MAPTEMPLATES: 'maptemplate',
|
|
78
77
|
};
|
|
79
|
-
|
|
80
|
-
|
|
81
78
|
export class Templates extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
82
79
|
constructor(props) {
|
|
83
80
|
super(props);
|
|
@@ -166,7 +163,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
166
163
|
}
|
|
167
164
|
|
|
168
165
|
componentDidMount() {
|
|
169
|
-
|
|
170
166
|
if (this.props.location.query.type === 'embedded' && this.isEnabledInLibraryModule("setLocale")) {
|
|
171
167
|
this.setLocale();
|
|
172
168
|
}
|
|
@@ -926,14 +922,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
926
922
|
break;
|
|
927
923
|
}
|
|
928
924
|
};
|
|
929
|
-
|
|
925
|
+
|
|
930
926
|
createTemplate(ev) {
|
|
931
927
|
const type = this.props.location.query.type;
|
|
932
928
|
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
933
929
|
const channel = this.state.channel.toLowerCase();
|
|
934
930
|
//const keyType = ev.key && ev.key.toLowerCase() !== undefined ? ev.state.toLowerCase() : '';
|
|
935
931
|
let routeParams = {};
|
|
936
|
-
timeTracker.startTimer(CHANNEL_CREATE_TRACK_MAPPING[channel]);
|
|
937
932
|
if (this.isEnabledInLibraryModule("callCreateFromProps")) {
|
|
938
933
|
this.props.createNew();
|
|
939
934
|
} else if (ev.key && (ev.key.toLowerCase() === "text" || ev.key.toLowerCase() === "image")) {
|
|
@@ -1128,7 +1123,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1128
1123
|
};
|
|
1129
1124
|
|
|
1130
1125
|
handleEditClick(e, template, modeType, path) {
|
|
1131
|
-
timeTracker.startTimer(CHANNEL_EDIT_TRACK_MAPPING[this.state.channel.toLowerCase()]);
|
|
1132
1126
|
if (modeType && modeType !== undefined) {
|
|
1133
1127
|
this.setState({modeType});
|
|
1134
1128
|
}
|
|
@@ -21,7 +21,6 @@ import messages from './messages';
|
|
|
21
21
|
import * as actions from './actions';
|
|
22
22
|
import Templates from '../Templates';
|
|
23
23
|
import CallTask from '../CallTask';
|
|
24
|
-
import Facebook from '../Facebook';
|
|
25
24
|
import Gallery from '../Assets/Gallery';
|
|
26
25
|
import withStyles from '../../hoc/withStyles';
|
|
27
26
|
import styles, { CapTabStyle } from './TemplatesV2.style';
|
|
@@ -34,44 +33,32 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
34
33
|
constructor(props) {
|
|
35
34
|
super(props);
|
|
36
35
|
let defaultChannel = get(this, 'props.channel') || get(this, 'props.params.channel') || 'sms';
|
|
37
|
-
const {
|
|
38
|
-
intl,
|
|
39
|
-
channelsToHide = [],
|
|
40
|
-
channelsToDisable = [],
|
|
41
|
-
isFullMode,
|
|
42
|
-
onChannelChange,
|
|
43
|
-
} = props;
|
|
44
|
-
|
|
45
36
|
const defaultPanes = {
|
|
46
|
-
sms: {content: <div></div>, tab: intl.formatMessage(messages.sms), key: 'sms'},
|
|
47
|
-
email: {content: <div></div>, tab: intl.formatMessage(messages.email), key: 'email'},
|
|
48
|
-
weChat: {content: <div></div>, tab: intl.formatMessage(messages.wechat), key: 'wechat'},
|
|
37
|
+
sms: {content: <div></div>, tab: props.intl.formatMessage(messages.sms), key: 'sms'},
|
|
38
|
+
email: {content: <div></div>, tab: props.intl.formatMessage(messages.email), key: 'email'},
|
|
39
|
+
weChat: {content: <div></div>, tab: props.intl.formatMessage(messages.wechat), key: 'wechat'},
|
|
49
40
|
//'wechat': {content: this.getTemplatesComponent('wechat'), tab: 'Wechat', key: 'wechat'},
|
|
50
|
-
mPush: {content: <div></div>, tab: intl.formatMessage(messages.pushNotification), key: 'mobilepush'},
|
|
41
|
+
mPush: {content: <div></div>, tab: props.intl.formatMessage(messages.pushNotification), key: 'mobilepush'},
|
|
51
42
|
};
|
|
43
|
+
const channelsToHide = this.props.channelsToHide || [];
|
|
44
|
+
const channelsToDisable = this.props.channelsToDisable || [];
|
|
52
45
|
let filteredPanes = Object.keys(defaultPanes)
|
|
53
46
|
.filter((key) => !channelsToHide.includes(key)).reduce((obj = [], key) => {
|
|
54
47
|
obj.push(defaultPanes[key]);
|
|
55
48
|
return obj;
|
|
56
49
|
}, []);
|
|
57
50
|
|
|
58
|
-
if (isFullMode ) {
|
|
59
|
-
filteredPanes.push({content: <div></div>, tab: intl.formatMessage(messages.gallery), key: 'assets'});
|
|
60
|
-
} else {
|
|
61
|
-
|
|
62
|
-
filteredPanes.push({content: <div></div>, tab: intl.formatMessage(messages.callTask), key: 'call_task'});
|
|
63
|
-
}
|
|
64
|
-
if (!channelsToHide.includes('facebook')) {
|
|
65
|
-
filteredPanes.push({content: <div></div>, tab: intl.formatMessage(messages.facebook), key: 'facebook'});
|
|
66
|
-
}
|
|
51
|
+
if (props.isFullMode ) {
|
|
52
|
+
filteredPanes.push({content: <div></div>, tab: props.intl.formatMessage(messages.gallery), key: 'assets'});
|
|
53
|
+
} else if (!channelsToHide.includes('callTask')) {
|
|
54
|
+
filteredPanes.push({content: <div></div>, tab: props.intl.formatMessage(messages.callTask), key: 'call_task'});
|
|
67
55
|
}
|
|
68
56
|
|
|
69
57
|
filteredPanes = filteredPanes.map( (pane) => {
|
|
70
58
|
if (channelsToDisable.includes(pane.key)) {
|
|
71
|
-
// eslint-disable-next-line no-param-reassign
|
|
72
59
|
pane.disabled = true;
|
|
73
60
|
}
|
|
74
|
-
|
|
61
|
+
return pane;
|
|
75
62
|
});
|
|
76
63
|
|
|
77
64
|
const channel = ['sms', 'email', 'mobilepush', 'call_task'];
|
|
@@ -91,9 +78,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
91
78
|
selectedChannel: defaultChannel,
|
|
92
79
|
panes,
|
|
93
80
|
};
|
|
94
|
-
|
|
95
|
-
onChannelChange(defaultChannel);
|
|
96
|
-
}
|
|
81
|
+
!props.isFullMode && this.props.onChannelChange(defaultChannel);
|
|
97
82
|
}
|
|
98
83
|
componentWillReceiveProps(nextProps) {
|
|
99
84
|
if (this.props.channel !== nextProps.channel) {
|
|
@@ -137,17 +122,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
137
122
|
/>
|
|
138
123
|
);
|
|
139
124
|
|
|
140
|
-
getFacebookComponent = () => {
|
|
141
|
-
const { messageDetails, cap, onFacebookSubmit } = this.props;
|
|
142
|
-
return (
|
|
143
|
-
<Facebook
|
|
144
|
-
messageDetails={messageDetails}
|
|
145
|
-
cap={cap}
|
|
146
|
-
onFacebookSubmit={onFacebookSubmit}
|
|
147
|
-
/>
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
125
|
getTemplatesComponent(channel) {
|
|
152
126
|
// const templates = this.props.Templates[`${channel}Templates`];
|
|
153
127
|
let query = {};
|
|
@@ -160,8 +134,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
160
134
|
return this.getCallTaskComponent();
|
|
161
135
|
case 'assets':
|
|
162
136
|
return this.getGalleryComponent(location);
|
|
163
|
-
case 'facebook':
|
|
164
|
-
return this.getFacebookComponent();
|
|
165
137
|
default:
|
|
166
138
|
return (<Templates
|
|
167
139
|
key={channel}
|
|
@@ -210,16 +182,16 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
210
182
|
{ name: 'description', content: this.props.intl.formatMessage(messages.creativesDesc) },
|
|
211
183
|
]}
|
|
212
184
|
/>}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
185
|
+
<div className="component-wrapper">
|
|
186
|
+
{isFullMode && <CapHeader title={<FormattedMessage {...messages.creatives}/>} description={<FormattedMessage {...messages.creativesDesc}/>}/>}
|
|
187
|
+
<StyledCapTab
|
|
188
|
+
panes={this.state.panes}
|
|
189
|
+
onChange={this.channelChange}
|
|
190
|
+
activeKey={this.state.selectedChannel}
|
|
191
|
+
defaultActiveKey={this.state.selectedChannel}
|
|
192
|
+
isFullMode={isFullMode}
|
|
193
|
+
/>
|
|
194
|
+
</div>
|
|
223
195
|
</div>
|
|
224
196
|
|
|
225
197
|
);
|
|
@@ -241,9 +213,6 @@ TemplatesV2.propTypes = {
|
|
|
241
213
|
channelsToHide: PropTypes.array,
|
|
242
214
|
className: PropTypes.string.isRequired,
|
|
243
215
|
channelsToDisable: PropTypes.array,
|
|
244
|
-
onFacebookSubmit: PropTypes.func,
|
|
245
|
-
messageDetails: PropTypes.object,
|
|
246
|
-
cap: PropTypes.object,
|
|
247
216
|
};
|
|
248
217
|
|
|
249
218
|
TemplatesV2.defaultProps = {
|
|
@@ -42,10 +42,6 @@ export default defineMessages({
|
|
|
42
42
|
id: 'creatives.containersV2.TemplatesV2.callTask',
|
|
43
43
|
defaultMessage: 'Call Task',
|
|
44
44
|
},
|
|
45
|
-
facebook: {
|
|
46
|
-
id: 'creatives.containersV2.TemplatesV2.facebook',
|
|
47
|
-
defaultMessage: 'Facebook',
|
|
48
|
-
},
|
|
49
45
|
gallery: {
|
|
50
46
|
id: 'creatives.containersV2.TemplatesV2.gallery',
|
|
51
47
|
defaultMessage: 'Gallery',
|
|
@@ -29,8 +29,6 @@ import {getMessageObject} from '../../../utils/messageUtils';
|
|
|
29
29
|
import * as templateActions from '../../Templates/actions';
|
|
30
30
|
import './_mapTemplates.scss';
|
|
31
31
|
import withCreatives from '../../../hoc/withCreatives';
|
|
32
|
-
import { GA } from '@capillarytech/cap-ui-utils';
|
|
33
|
-
import { TRACK_CREATE_WECHAT, TRACK_EDIT_WECHAT } from '../../App/constants'
|
|
34
32
|
|
|
35
33
|
const SELECT_TEMPLATE_MODE = "selectTemplate";
|
|
36
34
|
const MAP_TEMPLATE_MODE = "mapTemplateMode";
|
|
@@ -957,9 +955,8 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
957
955
|
saveFormData(formData) {
|
|
958
956
|
const obj = {};
|
|
959
957
|
let selectedWechatData = {};
|
|
960
|
-
const isEdit = this.state.isEdit;
|
|
961
958
|
const { getFormData } = this.props;
|
|
962
|
-
if (isEdit) {
|
|
959
|
+
if (this.state.isEdit) {
|
|
963
960
|
obj['_id'] = this.state.editTemplateData._id;
|
|
964
961
|
selectedWechatData = {
|
|
965
962
|
'template_id': this.state.editTemplateData.versions.base.template_id,
|
|
@@ -1013,11 +1010,6 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
1013
1010
|
getFormData(this.getFormData(obj));
|
|
1014
1011
|
}, 0);
|
|
1015
1012
|
}
|
|
1016
|
-
GA.timeTracker.stopTimer(isEdit ? TRACK_EDIT_WECHAT : TRACK_CREATE_WECHAT, {
|
|
1017
|
-
category: 'Creatives',
|
|
1018
|
-
action: isEdit ? 'Edit' : 'Create',
|
|
1019
|
-
label : 'MapTemplates',
|
|
1020
|
-
});
|
|
1021
1013
|
console.log("Template created successfully", response, obj);
|
|
1022
1014
|
});
|
|
1023
1015
|
}
|
|
@@ -28,8 +28,7 @@ import WechatRichmediaTemplatePreview from '../../../../v2Components/TemplatePre
|
|
|
28
28
|
import noImage from '../../../../assets/noImage.png';
|
|
29
29
|
import Pagination from '../../../../v2Components/Pagination';
|
|
30
30
|
import { CAP_SPACE_08, CAP_SPACE_12, CAP_SPACE_20, CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
31
|
-
|
|
32
|
-
import { TRACK_CREATE_WECHAT, TRACK_EDIT_WECHAT } from '../../../App/constants'
|
|
31
|
+
|
|
33
32
|
export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
34
33
|
constructor(props) {
|
|
35
34
|
super(props);
|
|
@@ -545,8 +544,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
545
544
|
msgtype: "MPNEWS",
|
|
546
545
|
msgcontent: "RICH_MEDIA_WECHAT",
|
|
547
546
|
};
|
|
548
|
-
|
|
549
|
-
if (isEdit) {
|
|
547
|
+
if (this.state.isEdit) {
|
|
550
548
|
saveObj._id = this.props.templateId;
|
|
551
549
|
saveObj.mediaId = this.props.mediaId;
|
|
552
550
|
saveObj.type = "WECHAT";
|
|
@@ -556,11 +554,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
556
554
|
// CapNotification.success({
|
|
557
555
|
// message: this.props.intl.formatMessage(messages.saveSuccess),
|
|
558
556
|
// });
|
|
559
|
-
GA.timeTracker.stopTimer(isEdit ? TRACK_EDIT_WECHAT : TRACK_CREATE_WECHAT, {
|
|
560
|
-
category: 'Creatives',
|
|
561
|
-
action: isEdit ? 'Edit' : 'Create',
|
|
562
|
-
label : 'RichMedia',
|
|
563
|
-
});
|
|
564
557
|
if (getFormData) {
|
|
565
558
|
getFormData(this.getFormData({
|
|
566
559
|
mediaId: response.mediaId,
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { css } from 'styled-components';
|
|
2
|
-
import {
|
|
3
|
-
CAP_SPACE_16,
|
|
4
|
-
CAP_PRIMARY,
|
|
5
|
-
CAP_G06,
|
|
6
|
-
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
7
|
-
|
|
8
|
-
export default css`
|
|
9
|
-
.ant-radio-group.cap-radioCard-v2 {
|
|
10
|
-
.ant-radio-button-wrapper {
|
|
11
|
-
margin-left: 0;
|
|
12
|
-
margin-right: 0;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.icon-container {
|
|
16
|
-
background-color: transparent;
|
|
17
|
-
|
|
18
|
-
.anticon {
|
|
19
|
-
color: ${CAP_G06};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&.green-color {
|
|
23
|
-
background-color: transparent;
|
|
24
|
-
|
|
25
|
-
.anticon {
|
|
26
|
-
color: ${CAP_PRIMARY.base};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.radio-group-heading {
|
|
33
|
-
margin-top: ${CAP_SPACE_16};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.submit-button-section {
|
|
37
|
-
margin-top: ${CAP_SPACE_16};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.ant-radio-button-wrapper-checked {
|
|
41
|
-
&:not(.ant-radio-button-wrapper-disabled) {
|
|
42
|
-
box-shadow: none;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.ant-radio-group.cap-radioCard-v2 {
|
|
47
|
-
.ant-radio-button-wrapper-checked .radio-card-checked {
|
|
48
|
-
display: none;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.non-selected-radio-group {
|
|
53
|
-
.ant-radio-button-wrapper {
|
|
54
|
-
&:last-child {
|
|
55
|
-
display: none;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.selected-radio-group {
|
|
61
|
-
.ant-radio-button-wrapper-checked {
|
|
62
|
-
&:not(.ant-radio-button-wrapper-disabled) {
|
|
63
|
-
box-shadow: -1px 0 0 0 ${CAP_PRIMARY.base};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.ant-radio-group.cap-radioCard-v2 {
|
|
68
|
-
.ant-radio-button-wrapper-checked .radio-card-checked {
|
|
69
|
-
display: block;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
`;
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { injectIntl, FormattedMessage } from "react-intl";
|
|
4
|
-
import {
|
|
5
|
-
CapHeading,
|
|
6
|
-
CapRadioCard,
|
|
7
|
-
CapLabel,
|
|
8
|
-
CapButton,
|
|
9
|
-
CapSpin,
|
|
10
|
-
} from '@capillarytech/cap-ui-library';
|
|
11
|
-
import messages from './messages';
|
|
12
|
-
import styles from './MarketingObjective.style';
|
|
13
|
-
import withStyles from '../../hoc/withStyles';
|
|
14
|
-
|
|
15
|
-
const renderMarketingObjectiveList = ({
|
|
16
|
-
onMarketingObjectiveChange,
|
|
17
|
-
marketingObjectiveSelectedOption,
|
|
18
|
-
defaultmarketingObjective,
|
|
19
|
-
marketingObjectiveList = [],
|
|
20
|
-
}) => {
|
|
21
|
-
const marketingList = (marketingObjective) => {
|
|
22
|
-
const { label, panes = [] } = marketingObjective;
|
|
23
|
-
const selectedPaneExists = panes.some((item) => item.value === marketingObjectiveSelectedOption);
|
|
24
|
-
const modifiedPanes = !selectedPaneExists
|
|
25
|
-
? [...panes, {
|
|
26
|
-
value: marketingObjectiveSelectedOption,
|
|
27
|
-
}]
|
|
28
|
-
: panes;
|
|
29
|
-
return (
|
|
30
|
-
<div key={label} className={selectedPaneExists ? 'selected-radio-group' : 'non-selected-radio-group'}>
|
|
31
|
-
<CapHeading type="h4" className="radio-group-heading">{label}</CapHeading>
|
|
32
|
-
<CapRadioCard
|
|
33
|
-
onChange={({ target: { value } }) => onMarketingObjectiveChange(value)}
|
|
34
|
-
panes={modifiedPanes}
|
|
35
|
-
cardWidth="324px"
|
|
36
|
-
cardHeight="auto"
|
|
37
|
-
selected={marketingObjectiveSelectedOption}
|
|
38
|
-
defaultValue={defaultmarketingObjective}
|
|
39
|
-
/>
|
|
40
|
-
</div>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
return marketingObjectiveList.map((marketinObjective) => marketingList(marketinObjective));
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const MarketingObjective = ({
|
|
48
|
-
onMarketingObjectiveSelect,
|
|
49
|
-
selectedMarketingObjective,
|
|
50
|
-
defaultmarketingObjective,
|
|
51
|
-
onSubmit,
|
|
52
|
-
className,
|
|
53
|
-
marketingObjectiveList,
|
|
54
|
-
}) => {
|
|
55
|
-
const [marketingObjectiveSelectedOption, onMarketingObjectiveChange] = useState(selectedMarketingObjective || defaultmarketingObjective);
|
|
56
|
-
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
[...document.querySelectorAll('.non-selected-radio-group .ant-radio-group')].forEach((node) => {
|
|
59
|
-
const paneToSelect = node.lastChild;
|
|
60
|
-
paneToSelect.click();
|
|
61
|
-
});
|
|
62
|
-
}, [marketingObjectiveSelectedOption]);
|
|
63
|
-
|
|
64
|
-
const onSubmitAction = () => {
|
|
65
|
-
onMarketingObjectiveSelect(marketingObjectiveSelectedOption);
|
|
66
|
-
onSubmit(false);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<div className={className}>
|
|
71
|
-
<>
|
|
72
|
-
<CapHeading type="h3">
|
|
73
|
-
<FormattedMessage {...messages.fbMarketingObjectiveTitle} />
|
|
74
|
-
</CapHeading>
|
|
75
|
-
<CapLabel type="label1">
|
|
76
|
-
<FormattedMessage {...messages.fbMarketingObjectiveDescription} />
|
|
77
|
-
</CapLabel>
|
|
78
|
-
</>
|
|
79
|
-
<CapSpin spinning={!marketingObjectiveList.length}>
|
|
80
|
-
{renderMarketingObjectiveList({
|
|
81
|
-
onMarketingObjectiveChange,
|
|
82
|
-
marketingObjectiveSelectedOption,
|
|
83
|
-
defaultmarketingObjective,
|
|
84
|
-
marketingObjectiveList,
|
|
85
|
-
})}
|
|
86
|
-
</CapSpin>
|
|
87
|
-
<CapButton
|
|
88
|
-
type="primary"
|
|
89
|
-
className="submit-button-section"
|
|
90
|
-
onClick={() => onSubmitAction(false)}
|
|
91
|
-
>
|
|
92
|
-
<FormattedMessage {...messages.fbMarketingObjectiveDone} />
|
|
93
|
-
</CapButton>
|
|
94
|
-
</div>
|
|
95
|
-
);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
MarketingObjective.propTypes = {
|
|
99
|
-
onMarketingObjectiveSelect: PropTypes.func,
|
|
100
|
-
selectedMarketingObjective: PropTypes.string,
|
|
101
|
-
defaultmarketingObjective: PropTypes.string,
|
|
102
|
-
onSubmit: PropTypes.func,
|
|
103
|
-
className: PropTypes.string,
|
|
104
|
-
marketingObjectiveList: PropTypes.arrayOf(PropTypes.object),
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export default injectIntl(withStyles(MarketingObjective, styles));
|