@capillarytech/creatives-library 3.6.1 → 3.6.3

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.
@@ -19,22 +19,12 @@ import moment from 'moment';
19
19
  import { makeSelectLocale } from './selectors';
20
20
 
21
21
  export class LanguageProvider extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
22
- getMappedLocale = (locale) => {
23
- const map = {
24
- 'en': 'en-US',
25
- 'zh-cn': 'zh',
26
- 'en-US': 'en-US',
27
- 'zh': 'zh',
28
- };
29
- return map[locale];
30
- }
31
-
32
22
  render() {
33
23
  const mappedLocale = {
34
24
  'en': enUS,
35
25
  'zh-cn': zhCN,
36
26
  'en-US': enUS,
37
- zh: zhCN,
27
+ 'zh': zhCN,
38
28
  };
39
29
  const jLocale = localStorage.getItem('jlocale') || 'en';
40
30
  moment.locale(jLocale);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "3.6.1",
4
+ "version": "3.6.3",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -13,7 +13,7 @@
13
13
  "license": "LicenseRef-LICENSE",
14
14
  "dependencies": {
15
15
  "@babel/polyfill": "7.4.3",
16
- "@capillarytech/cap-ui-utils": "1.0.8",
16
+ "@capillarytech/cap-ui-utils": "1.2.1",
17
17
  "babel-cli": "^6.26.0",
18
18
  "chalk": "1.1.3",
19
19
  "jquery": "^3.3.1",
@@ -29,6 +29,11 @@ export default css`
29
29
  }
30
30
  }
31
31
 
32
+ .is-scrollable-section {
33
+ height: calc(100vh - 150px);
34
+ overflow-y: auto;
35
+ }
36
+
32
37
  .radio-group-heading {
33
38
  margin-top: ${CAP_SPACE_16};
34
39
  }
@@ -41,7 +41,11 @@ const renderMarketingObjectiveList = ({
41
41
  );
42
42
  };
43
43
 
44
- return marketingObjectiveList.map((marketinObjective) => marketingList(marketinObjective));
44
+ return (
45
+ <div className="is-scrollable-section">
46
+ {marketingObjectiveList.map(marketingList)}
47
+ </div>
48
+ );
45
49
  };
46
50
 
47
51
  const MarketingObjective = ({
@@ -41,4 +41,4 @@ export const CHANNEL_EDIT_TRACK_MAPPING = {
41
41
  wechat: TRACK_EDIT_WECHAT,
42
42
  gallery: TRACK_EDIT_IMAGE,
43
43
  };
44
- export const GTM_TRACKING_ID = 'UA-152081629-1';
44
+ export const GTM_TRACKING_ID = 'UA-110024621-2';
@@ -37,9 +37,10 @@ export function removeMessageFromQueue(messageIndex) {
37
37
  };
38
38
  }
39
39
 
40
- export function getUserData() {
40
+ export function getUserData(callback) {
41
41
  return {
42
42
  type: types.GET_USER_DATA_REQUEST,
43
+ callback,
43
44
  };
44
45
  }
45
46
 
@@ -35,9 +35,9 @@ const CapWrapper = styled.div`
35
35
  padding: 0;
36
36
  flex-direction: column;
37
37
  `;
38
-
39
38
  GA.initialize({ accessKey: GTM_TRACKING_ID });
40
39
 
40
+
41
41
  export class Cap extends React.Component { // eslint-disable-line react/prefer-stateless-function
42
42
 
43
43
  constructor(props) {
@@ -52,10 +52,12 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
52
52
  }
53
53
 
54
54
  componentWillMount() {
55
- this.props.actions.getUserData();
55
+ this.props.actions.getUserData(() => {
56
+ this.setDimensionData();
57
+ });
56
58
  this.props.actions.getTopbarMenuData();
57
59
  if (this.props.Global.user) {
58
- const userGtmData = this.getUserGtmData(this.props);
60
+ const userGtmData = this.getUserGtmData();
59
61
  gtm.push(userGtmData);
60
62
  }
61
63
  if (this.props.Global.orgID !== undefined) {
@@ -117,21 +119,30 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
117
119
  this.setState({ switchedOrg: false });
118
120
  this.props.actions.clearTopbarMenuData();
119
121
  }
120
-
121
- getUserGtmData = (props) => {
122
- const { user: userData } = props.Global;
123
- const userName = userData.attributes.USERNAME;
124
- const userEmail = userData.attributes.EMAIL;
125
- const orgObj = _.find(userData.proxyOrgList, {orgID: props.Global.orgID});
126
- const gtmData = {
127
- orgId: props.Global.orgID,
128
- orgName: orgObj && orgObj.orgName,
129
- userId: userData.refID,
130
- userName: userName && userName.value,
131
- userEmail: userEmail && userEmail.value,
132
- isCapUser: userData.isCapUser,
133
- };
134
- return gtmData;
122
+ setDimensionData() {
123
+ const userGtmData = this.getUserGtmData();
124
+ Object.values(userGtmData).forEach((value, index) => {
125
+ GA.setCustomDimension({ [`dimension${index + 1}`]: value });
126
+ });
127
+ }
128
+ getUserGtmData(props) {
129
+ const selectedProps = props || this.props;
130
+ const { user: userData } = selectedProps.Global;
131
+ if (userData) {
132
+ const userName = userData.attributes.USERNAME;
133
+ const userEmail = userData.attributes.EMAIL;
134
+ const orgObj = _.find(userData.proxyOrgList, {orgID: selectedProps.Global.orgID});
135
+ const gtmData = {
136
+ isCapUser: userData.isCapUser,
137
+ orgId: selectedProps.Global.orgID,
138
+ orgName: orgObj && orgObj.orgName,
139
+ userId: userData.refID,
140
+ userName: userName && userName.value,
141
+ userEmail: userEmail && userEmail.value,
142
+ };
143
+ return gtmData;
144
+ }
145
+ return {};
135
146
  }
136
147
 
137
148
  getMappedLocale(locale) {
@@ -70,7 +70,7 @@ function* logoutFlow() {
70
70
  }
71
71
  }
72
72
 
73
- export function* fetchUserInfo() {
73
+ export function* fetchUserInfo(option) {
74
74
  try {
75
75
  const result = yield call(Api.getUserData);
76
76
  const userData = result.user;
@@ -92,6 +92,9 @@ export function* fetchUserInfo() {
92
92
  yield call(LocalStorage.saveItem, 'orgID', result.currentOrgId);
93
93
  yield call(LocalStorage.saveItem, 'user', userData);
94
94
  yield put({type: types.GET_USER_DATA_SUCCESS, userData, currentOrgId: result.currentOrgId, currentOrgDetails});
95
+ if (option.callback) {
96
+ option.callback(userData);
97
+ }
95
98
  } catch (error) {
96
99
  yield call(LocalStorage.clearItem, 'user');
97
100
  yield put({
@@ -625,7 +625,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
625
625
  const isEdit = this.state.isEdit;
626
626
  GA.timeTracker.stopTimer(isEdit ? TRACK_EDIT_EMAIL : TRACK_CREATE_EMAIL, {
627
627
  category: 'Creatives',
628
- action: isEdit ? 'Create' : 'Edit',
628
+ action: isEdit ? TRACK_EDIT_EMAIL : TRACK_CREATE_EMAIL,
629
629
  label: 'using editor',
630
630
  });
631
631
  if (createResponse && createResponse.templateId) {
@@ -273,7 +273,7 @@ const Facebook = (props) => {
273
273
  />
274
274
  }
275
275
  visible={isDrawerVisible}
276
- width={372}
276
+ width={380}
277
277
  onClose={() => setDrawerVisibility(false)}
278
278
  />
279
279
  </div>
@@ -1408,7 +1408,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
1408
1408
  this.props.actions.createTemplate(obj, () => {
1409
1409
  GA.timeTracker.stopTimer(TRACK_CREATE_MPUSH, {
1410
1410
  category: 'Creatives',
1411
- action: 'Create',
1411
+ action: TRACK_CREATE_MPUSH,
1412
1412
  label,
1413
1413
  });
1414
1414
  this.discardValues();
@@ -276,7 +276,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
276
276
  const label = this.props.location.pathname.indexOf('image') >= 0 ? 'image' : 'text';
277
277
  GA.timeTracker.stopTimer(TRACK_EDIT_MPUSH, {
278
278
  category: 'Creatives',
279
- action: 'Edit',
279
+ action: TRACK_EDIT_MPUSH,
280
280
  label,
281
281
  });
282
282
  this.resetSchema();
@@ -27,7 +27,7 @@ import {SMS} from '../../CreativesContainer/constants';
27
27
  import {showError} from '../commonMethods';
28
28
  import withCreatives from '../../../hoc/withCreatives';
29
29
  import { GA } from '@capillarytech/cap-ui-utils';
30
- import { TRACK_CREATE_SMS } from '../../App/constants'
30
+ import { TRACK_CREATE_SMS } from '../../App/constants';
31
31
  export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
32
32
  constructor(props) {
33
33
  super(props);
@@ -204,7 +204,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
204
204
  onCreateTemplateComplete = (editResponse) => {
205
205
  GA.timeTracker.stopTimer(TRACK_CREATE_SMS, {
206
206
  category: 'Creatives',
207
- action: 'Create',
207
+ action: TRACK_CREATE_SMS,
208
208
  });
209
209
  if (editResponse.templateId) {
210
210
  this.resetSchema();
@@ -25,7 +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'
28
+ import { TRACK_EDIT_SMS } from '../../App/constants';
29
29
  import { GA } from '@capillarytech/cap-ui-utils';
30
30
  export class Edit extends React.Component { // eslint-disable-line react/prefer-stateless-function
31
31
  constructor(props) {
@@ -222,7 +222,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
222
222
  onUpdateTemplateComplete = (editResponse) => {
223
223
  GA.timeTracker.stopTimer(TRACK_EDIT_SMS, {
224
224
  category: 'Creatives',
225
- action: 'Edit',
225
+ action: TRACK_EDIT_SMS,
226
226
  });
227
227
  if (editResponse.templateId) {
228
228
  this.resetSchema();
@@ -30,7 +30,7 @@ import * as templateActions from '../../Templates/actions';
30
30
  import './_mapTemplates.scss';
31
31
  import withCreatives from '../../../hoc/withCreatives';
32
32
  import { GA } from '@capillarytech/cap-ui-utils';
33
- import { TRACK_CREATE_WECHAT, TRACK_EDIT_WECHAT } from '../../App/constants'
33
+ import { TRACK_CREATE_WECHAT, TRACK_EDIT_WECHAT } from '../../App/constants';
34
34
 
35
35
  const SELECT_TEMPLATE_MODE = "selectTemplate";
36
36
  const MAP_TEMPLATE_MODE = "mapTemplateMode";
@@ -1015,7 +1015,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
1015
1015
  }
1016
1016
  GA.timeTracker.stopTimer(isEdit ? TRACK_EDIT_WECHAT : TRACK_CREATE_WECHAT, {
1017
1017
  category: 'Creatives',
1018
- action: isEdit ? 'Edit' : 'Create',
1018
+ action: isEdit ? TRACK_EDIT_WECHAT : TRACK_CREATE_WECHAT,
1019
1019
  label : 'MapTemplates',
1020
1020
  });
1021
1021
  console.log("Template created successfully", response, obj);
@@ -27,9 +27,9 @@ import FormBuilder from '../../../../v2Components/FormBuilder';
27
27
  import WechatRichmediaTemplatePreview from '../../../../v2Components/TemplatePreview/WechatRichmediaTemplatePreview';
28
28
  import noImage from '../../../../assets/noImage.png';
29
29
  import Pagination from '../../../../v2Components/Pagination';
30
- import { CAP_SPACE_08, CAP_SPACE_12, CAP_SPACE_20, CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
30
+ import { CAP_SPACE_08, CAP_SPACE_12, CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
31
31
  import { GA } from '@capillarytech/cap-ui-utils';
32
- import { TRACK_CREATE_WECHAT, TRACK_EDIT_WECHAT } from '../../../App/constants'
32
+ import { TRACK_CREATE_WECHAT, TRACK_EDIT_WECHAT } from '../../../App/constants';
33
33
  export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
34
34
  constructor(props) {
35
35
  super(props);
@@ -274,9 +274,9 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
274
274
  // if (temp.value && messages[temp.value] && temp.metaType === 'label') {
275
275
  // temp.value = this.props.intl.formatMessage(messages[temp.value]);
276
276
  // }
277
- // if (temp.inductiveText && messages[temp.inductiveText]) {
278
- // temp.inductiveText = this.props.intl.formatMessage(messages[temp.inductiveText]);
279
- // }
277
+ if (temp.inductiveText && messages[temp.inductiveText]) {
278
+ temp.inductiveText = this.props.intl.formatMessage(messages[temp.inductiveText]);
279
+ }
280
280
  if (temp.options) {
281
281
  forEach(temp.options, (option, id) => {
282
282
  if (messages[option]) {
@@ -558,8 +558,8 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
558
558
  // });
559
559
  GA.timeTracker.stopTimer(isEdit ? TRACK_EDIT_WECHAT : TRACK_CREATE_WECHAT, {
560
560
  category: 'Creatives',
561
- action: isEdit ? 'Edit' : 'Create',
562
- label : 'RichMedia',
561
+ action: isEdit ? TRACK_EDIT_WECHAT : TRACK_CREATE_WECHAT,
562
+ label: 'RichMedia',
563
563
  });
564
564
  if (getFormData) {
565
565
  getFormData(this.getFormData({
@@ -729,13 +729,13 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
729
729
  <div className={`custom-image ${totalContentBlocks !== 1 && "custom-image-border-bottom"}`}>
730
730
  <img alt="" width="100%" height="136px" src={imageUrl} />
731
731
  {totalContentBlocks !== 1 && <div className="name-container">
732
- <CapHeading type="h4">{formData['title-value'] || "Title"}</CapHeading>
732
+ <CapHeading type="h4">{formData['title-value'] || this.props.intl.formatMessage(messages.title)}</CapHeading>
733
733
  </div>}
734
734
  </div>
735
735
  {totalContentBlocks === 1 &&
736
736
  <div className="custom-card">
737
- <CapHeading type="h4" className="overflow-wrap-fields">{formData['title-value'] || "Title"}</CapHeading>
738
- <CapLabel type="label9" className="overflow-wrap-fields">{formData['cover-abstract-value'] || "Cover abstract"}</CapLabel>
737
+ <CapHeading type="h4" className="overflow-wrap-fields">{formData['title-value'] || this.props.intl.formatMessage(messages.title)}</CapHeading>
738
+ <CapLabel type="label9" className="overflow-wrap-fields">{formData['cover-abstract-value'] || this.props.intl.formatMessage(messages.coverAbstract)}</CapLabel>
739
739
  </div>
740
740
  }
741
741
  </div>
@@ -754,7 +754,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
754
754
  >
755
755
  <div className="richmedia-card-container">
756
756
  <CapColumn span={18} className="overflow-wrap-fields title" >
757
- <CapLabel type="label9">{formData['title-value'] || "Title"}</CapLabel>
757
+ <CapLabel type="label9">{formData['title-value'] || this.props.intl.formatMessage(messages.title)}</CapLabel>
758
758
  </CapColumn>
759
759
  <CapColumn span={6} className="image">
760
760
  <img alt="" width="40px" height="40px" src={imageUrl} />
@@ -889,7 +889,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
889
889
  this.setState({showExistingTemplates: true});
890
890
  const queryParams = {
891
891
  name: searchText || '',
892
- sortBy: sortBy,
892
+ sortBy,
893
893
  wecrmId: selectedWeChatAccount.configs.wecrm_app_id,
894
894
  wecrmToken: selectedWeChatAccount.configs.wecrm_token,
895
895
  originalId: selectedWeChatAccount.sourceAccountIdentifier,
@@ -914,7 +914,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
914
914
  () => {
915
915
  this.getExistingTemplates();
916
916
  setTimeout(() => {
917
- this.setState({ scrollDebounce: true })
917
+ this.setState({ scrollDebounce: true });
918
918
  }, 500);
919
919
  });
920
920
  }
@@ -934,27 +934,27 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
934
934
  />
935
935
  <Pagination style={{ height: 'calc(100vh - 150px)', overflowY: 'auto' }} onPageChange={templates.length && this.onPaginationChange}>
936
936
  { templates.map((template) => (
937
- <CapCard
938
- key={template._id}
939
- bordered={false}
940
- bodyStyle={{
941
- padding: 0,
942
- borderRadius: '4px',
943
- width: '276px',
944
- border: '16px solid #f4f5f7',
945
- }}
946
- onClick={(e) => this.onChooseExistingTemplate(template, e)}
947
- style={{ paddingBottom: CAP_SPACE_12 }}
937
+ <CapCard
938
+ key={template._id}
939
+ bordered={false}
940
+ bodyStyle={{
941
+ padding: 0,
942
+ borderRadius: '4px',
943
+ width: '276px',
944
+ border: '16px solid #f4f5f7',
945
+ }}
946
+ onClick={(e) => this.onChooseExistingTemplate(template, e)}
947
+ style={{ paddingBottom: CAP_SPACE_12 }}
948
948
  >
949
- <div>
950
- <div className="custom-image">
951
- <img alt="" width="244px" height="136px" src={template.versions.base.mediaList[0].image_url} />
952
- </div>
953
- <div className="existing-template-title-card">
954
- <CapHeading type="h5" className="overflow-wrap-fields">{template.name || "Title"}</CapHeading>
955
- </div>
949
+ <div>
950
+ <div className="custom-image">
951
+ <img alt="" width="244px" height="136px" src={template.versions.base.mediaList[0].image_url} />
956
952
  </div>
957
- </CapCard>
953
+ <div className="existing-template-title-card">
954
+ <CapHeading type="h5" className="overflow-wrap-fields">{template.name || this.props.intl.formatMessage(messages.title)}</CapHeading>
955
+ </div>
956
+ </div>
957
+ </CapCard>
958
958
  ))
959
959
  }
960
960
  </Pagination>
@@ -263,4 +263,12 @@ export default defineMessages({
263
263
  id: `${scope}.searchText`,
264
264
  defaultMessage: 'Search Templates',
265
265
  },
266
+ 'coverAbstract': {
267
+ id: `${scope}.coverAbstract`,
268
+ defaultMessage: 'Cover abstract',
269
+ },
270
+ 'title': {
271
+ id: `${scope}.wechatTitle`,
272
+ defaultMessage: 'Title',
273
+ },
266
274
  });