@capillarytech/creatives-library 3.3.3 → 3.4.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "3.3.3",
4
+ "version": "3.4.1",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -13,7 +13,6 @@
13
13
  "license": "LicenseRef-LICENSE",
14
14
  "dependencies": {
15
15
  "@babel/polyfill": "7.4.3",
16
- "@capillarytech/cap-ui-utils": "1.0.6",
17
16
  "babel-cli": "^6.26.0",
18
17
  "chalk": "1.1.3",
19
18
  "jquery": "^3.3.1",
@@ -12,32 +12,3 @@ export const getTopbarMenuDataValue = () => ([
12
12
  { label: <FormattedMessage {...globalMessages.incentive} />, link: '/coupons/ui/', key: 'incentive' },
13
13
  { label: <FormattedMessage {...globalMessages.creatives} />, link: '/creatives/ui/v2', key: 'creatives' },
14
14
  ]);
15
-
16
- export const TRACK_CREATE_SMS = 'createSms';
17
- export const TRACK_CREATE_EMAIL = 'createEmail';
18
- export const TRACK_CREATE_MPUSH = 'createMpush';
19
- export const TRACK_CREATE_WECHAT = 'createWeChat';
20
- export const TRACK_CREATE_IMAGE = 'createImage';
21
-
22
-
23
- export const TRACK_EDIT_SMS = 'editSms';
24
- export const TRACK_EDIT_EMAIL = 'editEmail';
25
- export const TRACK_EDIT_MPUSH = 'editMpush';
26
- export const TRACK_EDIT_WECHAT = 'editWeChat';
27
- export const TRACK_EDIT_IMAGE = 'editImage';
28
-
29
- export const CHANNEL_CREATE_TRACK_MAPPING = {
30
- sms: TRACK_CREATE_SMS,
31
- email: TRACK_CREATE_EMAIL,
32
- mobilepush: TRACK_CREATE_MPUSH,
33
- wechat: TRACK_CREATE_WECHAT,
34
- gallery: TRACK_CREATE_IMAGE,
35
- };
36
-
37
- export const CHANNEL_EDIT_TRACK_MAPPING = {
38
- sms: TRACK_EDIT_SMS,
39
- email: TRACK_EDIT_EMAIL,
40
- mobilepush: TRACK_EDIT_MPUSH,
41
- wechat: TRACK_EDIT_WECHAT,
42
- gallery: TRACK_EDIT_IMAGE,
43
- };
@@ -9,7 +9,6 @@ import { createStructuredSelector } from 'reselect';
9
9
  import _ from 'lodash';
10
10
  import moment from 'moment';
11
11
  // import 'moment/locale/zh-cn';
12
- import { GA } from '@capillarytech/cap-ui-utils';
13
12
  import { injectIntl, FormattedMessage } from 'react-intl';
14
13
  import messages from './messages';
15
14
  import { makeSelectAuthenticated, makeSelectUser } from './selectors';
@@ -34,8 +33,6 @@ const CapWrapper = styled.div`
34
33
  flex-direction: column;
35
34
  `;
36
35
 
37
- GA.initialize({ accessKey: 'UA-152081629-1' });
38
-
39
36
  export class Cap extends React.Component { // eslint-disable-line react/prefer-stateless-function
40
37
 
41
38
  constructor(props) {
@@ -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,11 +620,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
622
620
  });
623
621
  }
624
622
  onUpdateTemplateComplete = (createResponse) => {
625
- GA.timeTracker.stopTimer(this.state.isEdit ? TRACK_EDIT_EMAIL : TRACK_CREATE_EMAIL, {
626
- category: 'Creatives',
627
- action: this.state.isEdit ? 'Create' : 'Edit',
628
- label: 'using editor',
629
- });
630
623
  if (createResponse && createResponse.templateId) {
631
624
  // this.resetSchema();
632
625
  let message;
@@ -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 : 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 : 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
- import { GA } from '@capillarytech/cap-ui-utils';
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
- import { TRACK_EDIT_SMS } from '../../App/constants'
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
- import { GA } from '@capillarytech/cap-ui-utils';
60
- const { timeTracker } = GA;
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
  }
@@ -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
- import { GA } from '@capillarytech/cap-ui-utils';
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
- const isEdit = this.state.isEdit;
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,63 +0,0 @@
1
- import { defineMessages } from 'react-intl';
2
- export default defineMessages({
3
- "sms": {
4
- id: 'reon.components.Cap.sms',
5
- defaultMessage: 'SMS',
6
- },
7
- "wechat": {
8
- id: 'reon.components.Cap.wechat',
9
- defaultMessage: 'WeChat',
10
- },
11
- "gallery": {
12
- id: 'reon.components.Cap.gallery',
13
- defaultMessage: 'Gallery',
14
- },
15
- "creativesDashboard": {
16
- id: 'reon.components.Cap.creativesDashboard',
17
- defaultMessage: 'Creatives',
18
- },
19
- "creatives": {
20
- id: 'reon.components.Cap.creatives',
21
- defaultMessage: 'Creatives',
22
- },
23
- "campaigns": {
24
- id: 'reon.components.Cap.campaigns',
25
- defaultMessage: 'Campaigns',
26
- },
27
- "loyalty": {
28
- id: 'reon.components.Cap.loyalty',
29
- defaultMessage: 'Loyalty',
30
- },
31
- "member care": {
32
- id: 'reon.components.Cap.memberCare',
33
- defaultMessage: 'Member Care',
34
- },
35
- "workbench": {
36
- id: 'reon.components.Cap.Workbench',
37
- defaultMessage: 'WorkBench',
38
- },
39
- "store care": {
40
- id: 'reon.components.Cap.storeCare',
41
- defaultMessage: 'Store Care',
42
- },
43
- "store performance": {
44
- id: 'reon.components.Cap.storePerformance',
45
- defaultMessage: 'Store Performance',
46
- },
47
- "email": {
48
- id: 'reon.components.Cap.email',
49
- defaultMessage: 'Email',
50
- },
51
- "ebill": {
52
- id: 'reon.components.Cap.ebill',
53
- defaultMessage: 'Ebill',
54
- },
55
- "campaignsDashboard": {
56
- id: 'reon.components.campaignsDashboard',
57
- defaultMessage: 'Campaigns',
58
- },
59
- "campaignsHome": {
60
- id: 'reon.components.campaignsHome',
61
- defaultMessage: "Campaigns Home",
62
- },
63
- });
@@ -1,46 +0,0 @@
1
- /**
2
- *
3
- * Header
4
- *
5
- */
6
-
7
- import PropTypes from 'prop-types';
8
-
9
- import React from 'react';
10
- // import styled from 'styled-components';
11
- import { FormattedMessage } from 'react-intl';
12
-
13
- import { CapRow, CapColumn, CapInput, CapButton } from '@capillarytech/cap-ui-library';
14
- import messages from './messages';
15
-
16
-
17
- function Header(props) {
18
- return (
19
- <div>
20
- <CapRow className="template-form-header">
21
- <CapColumn span={10}>
22
- <CapInput id="template-name" placeholder="Enter template name*" defaultValue={props.templateName} type="input" onChange={props.templateNameHandler}/>
23
- </CapColumn>
24
- <CapColumn span={2} offset={8}>
25
- <CapButton id="preview-button" type="cancel" onClick={props.previewHandler}> <FormattedMessage {...messages.preview} /> </CapButton>
26
- </CapColumn>
27
- <CapColumn span={2}>
28
- <CapButton id="cancel-button" type="cancel" onClick={props.cancelHandler}> <FormattedMessage {...messages.cancel} /> </CapButton>
29
- </CapColumn>
30
- <CapColumn span={2}>
31
- <CapButton id="save-button" type="primary" onClick={props.saveHandler}> <FormattedMessage {...messages.save} /> </CapButton>
32
- </CapColumn>
33
- </CapRow>
34
- </div>
35
- );
36
- }
37
-
38
- Header.propTypes = {
39
- templateNameHandler: PropTypes.func,
40
- previewHandler: PropTypes.func,
41
- cancelHandler: PropTypes.func,
42
- saveHandler: PropTypes.func,
43
- templateName: PropTypes.string,
44
- };
45
-
46
- export default Header;
@@ -1,10 +0,0 @@
1
- // import React from 'react';
2
- // import { shallow } from 'enzyme';
3
-
4
- // import Header from '../index';
5
-
6
- describe('<Header />', () => {
7
- it('Expect to have unit tests specified', () => {
8
- expect(true).toEqual(false);
9
- });
10
- });
@@ -1,5 +0,0 @@
1
- .cap-tab-v2-wrapper{
2
- .ant-tabs-tabpane {
3
- border: none;
4
- }
5
- }