@capillarytech/creatives-library 3.2.3 → 3.3.0

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.
Files changed (63) hide show
  1. package/components/FormBuilder/index.js +1 -1
  2. package/components/Header/index.js +4 -3
  3. package/components/Header/messages.js +4 -0
  4. package/config/app.js +1 -1
  5. package/containers/Assets/Gallery/index.js +1 -1
  6. package/containers/Cap/index.js +3 -5
  7. package/containers/Email/index.js +2 -2
  8. package/containers/Email/messages.js +8 -0
  9. package/containers/LanguageProvider/index.js +2 -1
  10. package/containers/Templates/index.js +2 -2
  11. package/containers/Templates/messages.js +24 -4
  12. package/containers/WeChat/RichmediaTemplates/Create/messages.js +24 -0
  13. package/i18n.js +16 -9
  14. package/package.json +1 -1
  15. package/translations/en.json +108 -60
  16. package/translations/zh.json +108 -60
  17. package/utils/smsCharCountV2.js +1 -1
  18. package/v2Components/CapTagList/index.js +2 -2
  19. package/v2Components/FormBuilder/index.js +5 -2
  20. package/v2Components/NavigationBar/index.js +9 -10
  21. package/v2Components/NewCallTask/index.js +3 -1
  22. package/v2Components/TopBar/index.js +3 -0
  23. package/v2Components/TopBar/messages.js +8 -0
  24. package/v2Containers/Assets/Gallery/index.js +1 -1
  25. package/v2Containers/Assets/Gallery/messages.js +4 -0
  26. package/v2Containers/CallTask/index.js +3 -1
  27. package/v2Containers/Cap/index.js +3 -2
  28. package/v2Containers/CreativesContainer/SlideBoxContent.js +11 -1
  29. package/v2Containers/CreativesContainer/index.js +4 -1
  30. package/v2Containers/Email/index.js +5 -2
  31. package/v2Containers/Email/messages.js +8 -0
  32. package/v2Containers/EmailWrapper/index.js +3 -0
  33. package/v2Containers/LanguageProvider/constants.js +0 -1
  34. package/v2Containers/LanguageProvider/index.js +2 -0
  35. package/v2Containers/LanguageProvider/reducer.js +1 -7
  36. package/v2Containers/MobilePush/Create/index.js +2 -1
  37. package/v2Containers/MobilePush/Create/messages.js +4 -0
  38. package/v2Containers/MobilePush/Edit/index.js +2 -1
  39. package/v2Containers/MobilePush/Edit/messages.js +4 -0
  40. package/v2Containers/Sms/Create/index.js +3 -1
  41. package/v2Containers/Sms/Create/messages.js +16 -0
  42. package/v2Containers/Sms/Edit/index.js +3 -1
  43. package/v2Containers/Sms/Edit/messages.js +16 -0
  44. package/v2Containers/TagList/index.js +43 -0
  45. package/v2Containers/Templates/_templates.scss +9 -1
  46. package/v2Containers/Templates/index.js +65 -52
  47. package/v2Containers/TemplatesV2/index.js +1 -0
  48. package/v2Containers/WeChat/MapTemplates/index.js +0 -1
  49. package/v2Containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +10 -0
  50. package/v2Containers/WeChat/RichmediaTemplates/Create/actions.js +9 -0
  51. package/v2Containers/WeChat/RichmediaTemplates/Create/constants.js +3 -0
  52. package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +146 -4
  53. package/v2Containers/WeChat/RichmediaTemplates/Create/messages.js +86 -57
  54. package/v2Containers/WeChat/RichmediaTemplates/Create/reducer.js +24 -1
  55. package/v2Containers/WeChat/RichmediaTemplates/Create/sagas.js +45 -0
  56. package/v2Containers/WeChat/RichmediaTemplates/Edit/constants.js +4 -0
  57. package/v2Containers/WeChat/RichmediaTemplates/Edit/index.js +8 -1
  58. package/v2Containers/WeChat/Wrapper/_wrapper.scss +9 -1
  59. package/v2Containers/WeChat/Wrapper/messages.js +5 -5
  60. package/containers/Cap/messsages.js +0 -63
  61. package/v2Components/Header/index.js +0 -46
  62. package/v2Components/Header/tests/index.test.js +0 -10
  63. package/v2Containers/TemplatesV2/_templatesV2.scss +0 -5
@@ -1,5 +1,7 @@
1
1
  import { take, cancel, call, put, takeLatest } from 'redux-saga/effects';
2
2
  import { LOCATION_CHANGE } from 'react-router-redux';
3
+ import orderBy from 'lodash/orderBy';
4
+ import moment from 'moment';
3
5
  import * as Api from '../../../../services/api';
4
6
  import * as types from './constants';
5
7
  // import testschema from './testschema';
@@ -33,6 +35,48 @@ export function* saveTemplate({template, callback}) {
33
35
  yield put({ type: types.SAVE_TEMPLATE_FAILURE, error });
34
36
  }
35
37
  }
38
+
39
+ export function* getAllTemplates(action) {
40
+ try {
41
+ const result = yield call(Api.getAllTemplates, action);
42
+ const channelTemplates = {
43
+ templates: result.response.richmedia,
44
+ };
45
+ if (
46
+ action.channel === 'wechat' &&
47
+ action.queryParams &&
48
+ action.queryParams.sortBy
49
+ ) {
50
+ if (action.queryParams.sortBy.toLocaleLowerCase() === ("Most Recent").toLocaleLowerCase()) {
51
+ channelTemplates.templates = orderBy(channelTemplates.templates, (template) => moment(template.updatedAt), ['desc']);
52
+ // channelTemplates.templates.sort((a, b) => {
53
+ // const dateA = new Date(a.updatedAt);
54
+ // const dateB = new Date(b.updatedAt);
55
+ // return dateB - dateA;
56
+ // });
57
+ } else if (action.queryParams.sortBy.toLocaleLowerCase() === ("Alphabetically").toLocaleLowerCase()) {
58
+ channelTemplates.templates.sort((a, b) => b.name - a.name);
59
+ }
60
+ }
61
+ yield put({
62
+ type: types.GET_ALL_TEMPLATES_SUCCESS,
63
+ data: channelTemplates,
64
+ isReset: action.queryParams.page === 1,
65
+ });
66
+ } catch (error) {
67
+ yield put({
68
+ type: types.GET_ALL_TEMPLATES_FAILURE,
69
+ error,
70
+ });
71
+ }
72
+ }
73
+
74
+ function* watchGetAllTemplates() {
75
+ const watcher = yield takeLatest(types.GET_ALL_TEMPLATES_REQUEST, getAllTemplates);
76
+ yield take(LOCATION_CHANGE);
77
+ yield cancel(watcher);
78
+ }
79
+
36
80
  function* watchUploadAsset() {
37
81
  const watcher = yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
38
82
  yield take(LOCATION_CHANGE);
@@ -48,4 +92,5 @@ export default [
48
92
  defaultSaga,
49
93
  watchUploadAsset,
50
94
  watchSaveTemplate,
95
+ watchGetAllTemplates,
51
96
  ];
@@ -8,3 +8,7 @@ export const DEFAULT_ACTION = 'app/Edit/DEFAULT_ACTION';
8
8
  export const GET_TEMPLATE_DETAILS_REQUEST = 'app/v2Containers/WeChat/RichmediaTemplates/Edit/GET_TEMPLATE_DETAILS_REQUEST';
9
9
  export const GET_TEMPLATE_DETAILS_SUCCESS = 'app/v2Containers/WeChat/RichmediaTemplates/Edit/GET_TEMPLATE_DETAILS_SUCCESS';
10
10
  export const GET_TEMPLATE_DETAILS_FAILURE = 'app/v2Containers/WeChat/RichmediaTemplates/Edit/GET_TEMPLATE_DETAILS_FAILURE';
11
+
12
+ export const NO_ONE = 'No one';
13
+ export const ONLY_FOLLOWERS = 'Only followers';
14
+ export const ANYONE = 'Anyone';
@@ -15,6 +15,7 @@ import { CapSpin } from '@capillarytech/cap-ui-library';
15
15
  import { createStructuredSelector } from 'reselect';
16
16
  import makeSelectEdit, { makeSelectTemplates } from './selectors';
17
17
  import * as actions from './actions';
18
+ import { NO_ONE, ONLY_FOLLOWERS, ANYONE } from './constants';
18
19
  import Create from '../Create';
19
20
  import { getCommonProps } from '../../helper';
20
21
 
@@ -39,12 +40,18 @@ export class Edit extends React.PureComponent { // eslint-disable-line react/pre
39
40
  if (!_.isEmpty(templateDetails)) {
40
41
  _.forEach(templateDetails.versions.base.mediaList, (content) => {
41
42
  const formData = {};
43
+ let postCommentsValue = NO_ONE;
44
+ if (content.only_fans_can_comment && content.need_open_comment) {
45
+ postCommentsValue = ONLY_FOLLOWERS;
46
+ } else if (content.need_open_comment) {
47
+ postCommentsValue = ANYONE;
48
+ }
42
49
  formData['title-value'] = content.title;
43
50
  formData['author-value'] = content.author;
44
51
  formData['cover-abstract-value'] = content.digest;
45
52
  formData['content-value'] = content.content;
46
53
  formData['source-link-value'] = content.content_source_url;
47
- formData['post-comments-value'] = content.post_comments_scope;
54
+ formData['post-comments-value'] = postCommentsValue;
48
55
  formData['show-cover-pic-value'] = content.show_cover_pic;
49
56
  templateData[contentId] = {
50
57
  formData,
@@ -1,5 +1,13 @@
1
+ @import '~@capillarytech/cap-ui-library/styles/_variables.scss';
2
+
1
3
  .template-image {
2
4
  margin: 0 -1.142rem;
3
5
  height: 274px;
4
6
  width: 370px;
5
- }
7
+ }
8
+
9
+ .ant-radio-group.#{cap-radioCard-v2} {
10
+ .ant-radio-button-wrapper {
11
+ border: 1px solid $CAP_G07;
12
+ }
13
+ }
@@ -7,23 +7,23 @@ import { defineMessages } from 'react-intl';
7
7
 
8
8
  export default defineMessages({
9
9
  richMedia: {
10
- id: 'app.containers.WechatWrapper.richMedia',
10
+ id: 'creatives.containers.WechatWrapper.richMedia',
11
11
  defaultMessage: 'Richmedia template',
12
12
  },
13
13
  richMediaSubtext: {
14
- id: 'app.containers.WechatWrapper.richMediaSubtext',
14
+ id: 'creatives.containers.WechatWrapper.richMediaSubtext',
15
15
  defaultMessage: 'Used for creating rich content using text, image, location and audio',
16
16
  },
17
17
  mapTemplate: {
18
- id: 'app.containers.WechatWrapper.mapTemplate',
18
+ id: 'creatives.containers.WechatWrapper.mapTemplate',
19
19
  defaultMessage: 'Map template',
20
20
  },
21
21
  mapTemplateSubtext: {
22
- id: 'app.containers.WechatWrapper.mapTemplateSubtext',
22
+ id: 'creatives.containers.WechatWrapper.mapTemplateSubtext',
23
23
  defaultMessage: 'Used for announcing offers and transaction related information',
24
24
  },
25
25
  templateType: {
26
- id: 'app.containers.WechatWrapper.templateType',
26
+ id: 'creatives.containers.WechatWrapper.templateType',
27
27
  defaultMessage: 'Which type of template you want to create?',
28
28
  },
29
29
  });
@@ -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
- }