@capillarytech/creatives-library 3.1.49 → 3.2.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.
- package/app.js +1 -1
- package/components/FormBuilder/index.js +1 -1
- package/components/Header/index.js +3 -4
- package/components/Header/messages.js +0 -4
- package/config/app.js +2 -4
- package/containers/Assets/Gallery/index.js +1 -1
- package/containers/Cap/index.js +5 -4
- package/containers/Email/index.js +2 -2
- package/containers/Email/messages.js +0 -8
- package/containers/LanguageProvider/index.js +4 -28
- package/containers/Templates/index.js +2 -2
- package/containers/Templates/messages.js +4 -24
- package/containers/WeChat/MapTemplates/messages.js +0 -4
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +0 -24
- package/i18n.js +9 -16
- package/index.js +0 -6
- package/package.json +4 -1
- package/reducers.js +1 -1
- package/routes.js +1 -2
- package/services/api.js +2 -11
- package/translations/en.json +56 -119
- package/translations/zh.json +53 -116
- package/utils/smsCharCountV2.js +1 -1
- package/v2Components/CapTagList/index.js +2 -2
- package/v2Components/FormBuilder/index.js +4 -7
- package/v2Components/NavigationBar/index.js +17 -11
- package/v2Components/NavigationBar/messages.js +0 -28
- package/v2Components/NewCallTask/index.js +1 -3
- package/v2Components/TopBar/index.js +0 -3
- package/v2Components/TopBar/messages.js +0 -8
- package/v2Containers/Assets/Gallery/index.js +6 -12
- package/v2Containers/Assets/Gallery/messages.js +0 -4
- package/v2Containers/CallTask/index.js +1 -3
- package/v2Containers/Cap/index.js +2 -3
- package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -14
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +1 -2
- package/v2Containers/CreativesContainer/index.js +2 -10
- package/v2Containers/CreativesContainer/index.scss +3 -6
- package/v2Containers/Email/index.js +7 -10
- package/v2Containers/Email/messages.js +0 -16
- package/v2Containers/EmailWrapper/index.js +9 -12
- package/v2Containers/LanguageProvider/actions.js +4 -9
- package/v2Containers/LanguageProvider/constants.js +1 -7
- package/v2Containers/LanguageProvider/index.js +12 -49
- package/v2Containers/LanguageProvider/reducer.js +9 -11
- package/v2Containers/LanguageProvider/selectors.js +1 -1
- package/v2Containers/MobilePush/Create/index.js +1 -2
- package/v2Containers/MobilePush/Create/messages.js +0 -4
- package/v2Containers/MobilePush/Edit/index.js +1 -2
- package/v2Containers/MobilePush/Edit/messages.js +0 -4
- package/v2Containers/Sms/Create/index.js +1 -3
- package/v2Containers/Sms/Create/messages.js +0 -16
- package/v2Containers/Sms/Edit/index.js +1 -3
- package/v2Containers/Sms/Edit/messages.js +0 -16
- package/v2Containers/TagList/index.js +0 -43
- package/v2Containers/Templates/_templates.scss +1 -9
- package/v2Containers/Templates/index.js +53 -66
- package/v2Containers/TemplatesV2/_templatesV2.scss +5 -0
- package/v2Containers/TemplatesV2/index.js +54 -54
- package/v2Containers/WeChat/MapTemplates/index.js +7 -2
- package/v2Containers/WeChat/MapTemplates/messages.js +5 -9
- package/v2Containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +0 -10
- package/v2Containers/WeChat/RichmediaTemplates/Create/actions.js +0 -9
- package/v2Containers/WeChat/RichmediaTemplates/Create/constants.js +0 -3
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +21 -154
- package/v2Containers/WeChat/RichmediaTemplates/Create/messages.js +46 -119
- package/v2Containers/WeChat/RichmediaTemplates/Create/reducer.js +1 -24
- package/v2Containers/WeChat/RichmediaTemplates/Create/sagas.js +1 -46
- package/v2Containers/WeChat/RichmediaTemplates/Edit/constants.js +0 -4
- package/v2Containers/WeChat/RichmediaTemplates/Edit/index.js +1 -8
- package/v2Containers/WeChat/RichmediaTemplates/View/index.js +7 -0
- package/v2Containers/WeChat/Wrapper/_wrapper.scss +1 -9
- package/v2Containers/WeChat/Wrapper/messages.js +5 -5
- package/hoc/withStyles.js +0 -12
- package/v2Containers/LanguageProvider/sagas.js +0 -39
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +0 -29
|
@@ -5,13 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { fromJS } from 'immutable';
|
|
8
|
-
import unionBy from 'lodash/unionBy';
|
|
9
8
|
import * as types from './constants';
|
|
10
9
|
|
|
11
|
-
const initialState = fromJS({
|
|
12
|
-
getAllTemplatesInProgress: false,
|
|
13
|
-
templates: [],
|
|
14
|
-
});
|
|
10
|
+
const initialState = fromJS({});
|
|
15
11
|
|
|
16
12
|
function createReducer(state = initialState, action) {
|
|
17
13
|
switch (action.type) {
|
|
@@ -56,25 +52,6 @@ function createReducer(state = initialState, action) {
|
|
|
56
52
|
return state
|
|
57
53
|
.set('saveTemplateSuccess', false)
|
|
58
54
|
.set('savingTemplate', false);
|
|
59
|
-
case types.GET_ALL_TEMPLATES_REQUEST:
|
|
60
|
-
return state
|
|
61
|
-
.set('getAllTemplatesInProgress', true).set('templateError', {});
|
|
62
|
-
case types.GET_ALL_TEMPLATES_SUCCESS:
|
|
63
|
-
const { data, isReset } = action;
|
|
64
|
-
if (isReset) {
|
|
65
|
-
return state
|
|
66
|
-
.set('getAllTemplatesInProgress', false)
|
|
67
|
-
.set('pagination', true)
|
|
68
|
-
.set('templates', data ? data.templates : [])
|
|
69
|
-
.set('isSearch', data ? data.search : false);
|
|
70
|
-
}
|
|
71
|
-
return state
|
|
72
|
-
.set('getAllTemplatesInProgress', false)
|
|
73
|
-
.set('pagination', data ? Boolean(data.templates.length) : true)
|
|
74
|
-
.set('templates', data ? unionBy(state.get('templates'), data.templates, '_id') : state.get('templates'))
|
|
75
|
-
.set('isSearch', data ? data.search : false);
|
|
76
|
-
case types.GET_ALL_TEMPLATES_FAILURE:
|
|
77
|
-
return state.set('getAllTemplatesInProgress', false).set('templateError', action.error);
|
|
78
55
|
default:
|
|
79
56
|
return state;
|
|
80
57
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
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';
|
|
5
3
|
import * as Api from '../../../../services/api';
|
|
6
4
|
import * as types from './constants';
|
|
7
5
|
// import testschema from './testschema';
|
|
@@ -27,7 +25,7 @@ export function* saveTemplate({template, callback}) {
|
|
|
27
25
|
if (!result.success || result.status.code === 500) {
|
|
28
26
|
errorMsg = result.message;
|
|
29
27
|
}
|
|
30
|
-
if (callback
|
|
28
|
+
if (callback) {
|
|
31
29
|
yield call(callback, result.response);
|
|
32
30
|
}
|
|
33
31
|
yield put({ type: types.SAVE_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg});
|
|
@@ -35,48 +33,6 @@ export function* saveTemplate({template, callback}) {
|
|
|
35
33
|
yield put({ type: types.SAVE_TEMPLATE_FAILURE, error });
|
|
36
34
|
}
|
|
37
35
|
}
|
|
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
|
-
|
|
80
36
|
function* watchUploadAsset() {
|
|
81
37
|
const watcher = yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
|
|
82
38
|
yield take(LOCATION_CHANGE);
|
|
@@ -92,5 +48,4 @@ export default [
|
|
|
92
48
|
defaultSaga,
|
|
93
49
|
watchUploadAsset,
|
|
94
50
|
watchSaveTemplate,
|
|
95
|
-
watchGetAllTemplates,
|
|
96
51
|
];
|
|
@@ -8,7 +8,3 @@ 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,7 +15,6 @@ 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';
|
|
19
18
|
import Create from '../Create';
|
|
20
19
|
import { getCommonProps } from '../../helper';
|
|
21
20
|
|
|
@@ -40,18 +39,12 @@ export class Edit extends React.PureComponent { // eslint-disable-line react/pre
|
|
|
40
39
|
if (!_.isEmpty(templateDetails)) {
|
|
41
40
|
_.forEach(templateDetails.versions.base.mediaList, (content) => {
|
|
42
41
|
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
|
-
}
|
|
49
42
|
formData['title-value'] = content.title;
|
|
50
43
|
formData['author-value'] = content.author;
|
|
51
44
|
formData['cover-abstract-value'] = content.digest;
|
|
52
45
|
formData['content-value'] = content.content;
|
|
53
46
|
formData['source-link-value'] = content.content_source_url;
|
|
54
|
-
formData['post-comments-value'] =
|
|
47
|
+
formData['post-comments-value'] = content.post_comments_scope;
|
|
55
48
|
formData['show-cover-pic-value'] = content.show_cover_pic;
|
|
56
49
|
templateData[contentId] = {
|
|
57
50
|
formData,
|
|
@@ -8,6 +8,7 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { connect } from 'react-redux';
|
|
11
|
+
import Helmet from 'react-helmet';
|
|
11
12
|
import { FormattedMessage } from 'react-intl';
|
|
12
13
|
import { createStructuredSelector } from 'reselect';
|
|
13
14
|
import makeSelectView from './selectors';
|
|
@@ -17,6 +18,12 @@ export class View extends React.PureComponent { // eslint-disable-line react/pre
|
|
|
17
18
|
render() {
|
|
18
19
|
return (
|
|
19
20
|
<div>
|
|
21
|
+
<Helmet
|
|
22
|
+
title="View"
|
|
23
|
+
meta={[
|
|
24
|
+
{ name: 'description', content: 'Description of View' },
|
|
25
|
+
]}
|
|
26
|
+
/>
|
|
20
27
|
<FormattedMessage {...messages.header} />
|
|
21
28
|
</div>
|
|
22
29
|
);
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
@import '~@capillarytech/cap-ui-library/styles/_variables.scss';
|
|
2
|
-
|
|
3
1
|
.template-image {
|
|
4
2
|
margin: 0 -1.142rem;
|
|
5
3
|
height: 274px;
|
|
6
4
|
width: 370px;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.ant-radio-group.#{cap-radioCard-v2} {
|
|
10
|
-
.ant-radio-button-wrapper {
|
|
11
|
-
border: 1px solid $CAP_G07;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
5
|
+
}
|
|
@@ -7,23 +7,23 @@ import { defineMessages } from 'react-intl';
|
|
|
7
7
|
|
|
8
8
|
export default defineMessages({
|
|
9
9
|
richMedia: {
|
|
10
|
-
id: '
|
|
10
|
+
id: 'app.containers.WechatWrapper.richMedia',
|
|
11
11
|
defaultMessage: 'Richmedia template',
|
|
12
12
|
},
|
|
13
13
|
richMediaSubtext: {
|
|
14
|
-
id: '
|
|
14
|
+
id: 'app.containers.WechatWrapper.richMediaSubtext',
|
|
15
15
|
defaultMessage: 'Used for creating rich content using text, image, location and audio',
|
|
16
16
|
},
|
|
17
17
|
mapTemplate: {
|
|
18
|
-
id: '
|
|
18
|
+
id: 'app.containers.WechatWrapper.mapTemplate',
|
|
19
19
|
defaultMessage: 'Map template',
|
|
20
20
|
},
|
|
21
21
|
mapTemplateSubtext: {
|
|
22
|
-
id: '
|
|
22
|
+
id: 'app.containers.WechatWrapper.mapTemplateSubtext',
|
|
23
23
|
defaultMessage: 'Used for announcing offers and transaction related information',
|
|
24
24
|
},
|
|
25
25
|
templateType: {
|
|
26
|
-
id: '
|
|
26
|
+
id: 'app.containers.WechatWrapper.templateType',
|
|
27
27
|
defaultMessage: 'Which type of template you want to create?',
|
|
28
28
|
},
|
|
29
29
|
});
|
package/hoc/withStyles.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Higher Order Component to have consistent logic of styling components
|
|
5
|
-
* @param {*} WrappedComponent
|
|
6
|
-
* @returns {*} styled wrapped component
|
|
7
|
-
*/
|
|
8
|
-
export default (WrappedComponent, styles) => {
|
|
9
|
-
const StyledComponent = styled(WrappedComponent)`${styles};`;
|
|
10
|
-
StyledComponent.defaultProps = WrappedComponent.defaultProps;
|
|
11
|
-
return StyledComponent;
|
|
12
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { takeLatest, take, all, cancel, call, put } from 'redux-saga/effects';
|
|
2
|
-
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
3
|
-
import * as Api from '../../services/api';
|
|
4
|
-
import * as types from './constants';
|
|
5
|
-
|
|
6
|
-
function* getLocizMessage(action) {
|
|
7
|
-
try {
|
|
8
|
-
const result = yield call(Api.getLocizMessage, action.locale);
|
|
9
|
-
yield [
|
|
10
|
-
put({
|
|
11
|
-
type: types.GET_LOCIZ_MESSAGE_SUCCESS,
|
|
12
|
-
data: result,
|
|
13
|
-
}),
|
|
14
|
-
];
|
|
15
|
-
} catch (error) {
|
|
16
|
-
yield [
|
|
17
|
-
put({
|
|
18
|
-
type: types.GET_LOCIZ_MESSAGE_FAILURE,
|
|
19
|
-
data: error,
|
|
20
|
-
}),
|
|
21
|
-
];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export function* watchGetLocizMessage() {
|
|
25
|
-
const watcher = yield takeLatest(
|
|
26
|
-
types.GET_LOCIZ_MESSAGE_REQUEST,
|
|
27
|
-
getLocizMessage,
|
|
28
|
-
);
|
|
29
|
-
yield take(LOCATION_CHANGE);
|
|
30
|
-
yield cancel(watcher);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default [watchGetLocizMessage];
|
|
34
|
-
|
|
35
|
-
export function* LanguageProviderRootSaga() {
|
|
36
|
-
yield all([
|
|
37
|
-
watchGetLocizMessage(),
|
|
38
|
-
]);
|
|
39
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { css } from 'styled-components';
|
|
2
|
-
import {CAP_SPACE_24, CAP_SPACE_16} from '@capillarytech/cap-ui-library/styled/variables';
|
|
3
|
-
|
|
4
|
-
export default css`
|
|
5
|
-
.cap-tab-v2-wrapper{
|
|
6
|
-
.ant-tabs-tabpane {
|
|
7
|
-
border: none;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.component-wrapper {
|
|
12
|
-
${(props) => props.isFullMode ? `
|
|
13
|
-
max-width: 1140px;
|
|
14
|
-
margin: 0 auto;
|
|
15
|
-
width: 100%;
|
|
16
|
-
padding: ${CAP_SPACE_24} 0;
|
|
17
|
-
.ant-tabs-content{
|
|
18
|
-
margin-top: ${CAP_SPACE_16}
|
|
19
|
-
}
|
|
20
|
-
` : `.cap-tab-v2 {
|
|
21
|
-
height: calc(100vh - 118px);
|
|
22
|
-
} `}
|
|
23
|
-
}
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
export const CapTabStyle = css`
|
|
27
|
-
${(props) => props.isFullMode ? `margin-top: ${CAP_SPACE_24}` : ``
|
|
28
|
-
}
|
|
29
|
-
`;
|