@capillarytech/creatives-library 2.0.66 → 2.0.69
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/components/Ckeditor/index.js +30 -3
- package/components/FormBuilder/index.js +50 -27
- package/components/FormBuilder/test +1845 -0
- package/components/Header/index.js +7 -4
- package/components/Header/messages.js +12 -0
- package/components/Sidebar/index.js +0 -27
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +42 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +104 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +21 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -0
- package/containers/Cap/actions.js +6 -0
- package/containers/Cap/constants.js +2 -0
- package/containers/Cap/index.js +1 -22
- package/containers/Cap/reducer.js +4 -2
- package/containers/Cap/selectors.js +13 -0
- package/containers/CreativesContainer/SlideBoxContent.js +2 -1
- package/containers/Ebill/index.js +4 -21
- package/containers/Email/index.js +9 -24
- package/containers/Line/Create/index.js +5 -17
- package/containers/Line/Edit/index.js +5 -25
- package/containers/MobilePush/Create/index.js +5 -22
- package/containers/MobilePush/Create/selectors.js +1 -1
- package/containers/MobilePush/Edit/index.js +9 -30
- package/containers/MobilePush/Edit/selectors.js +2 -2
- package/containers/MobilePush/initialSchema.js +0 -12
- package/containers/MobilepushWrapper/index.js +3 -2
- package/containers/Sms/Create/index.js +17 -31
- package/containers/Sms/Edit/index.js +6 -20
- package/containers/Templates/index.js +60 -67
- package/containers/Templates/reducer.js +3 -3
- package/containers/WeChat/MapTemplates/index.js +6 -22
- package/containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +46 -2
- package/containers/WeChat/RichmediaTemplates/Create/actions.js +4 -3
- package/containers/WeChat/RichmediaTemplates/Create/constants.js +1 -0
- package/containers/WeChat/RichmediaTemplates/Create/index.js +525 -165
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +125 -1
- package/containers/WeChat/RichmediaTemplates/Create/reducer.js +15 -4
- package/containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +497 -0
- package/containers/WeChat/RichmediaTemplates/Create/sagas.js +7 -3
- package/containers/WeChat/RichmediaTemplates/Create/selectors.js +5 -0
- package/containers/WeChat/RichmediaTemplates/Edit/index.js +24 -8
- package/containers/WeChat/RichmediaTemplates/Edit/selectors.js +6 -1
- package/initialState.js +1 -0
- package/package.json +2 -2
- package/routes.js +22 -4
|
@@ -7,21 +7,25 @@ import * as types from './constants';
|
|
|
7
7
|
export function* defaultSaga() {
|
|
8
8
|
// See example in containers/HomePage/sagas.js
|
|
9
9
|
}
|
|
10
|
-
export function* uploadAsset({file, assetType, fileParams, mode, wechatParams, contentId}) {
|
|
10
|
+
export function* uploadAsset({file, assetType, fileParams, mode, wechatParams, contentId, uploadId}) {
|
|
11
11
|
try {
|
|
12
12
|
const params = {
|
|
13
13
|
file, assetType, fileParams, mode, wechatParams,
|
|
14
14
|
};
|
|
15
15
|
const result = yield call(Api.uploadFile, params);
|
|
16
|
-
yield put({ type: types.UPLOAD_ASSET_SUCCESS, data: result.response.asset, statusCode: result.status ? result.status.code : '', contentId});
|
|
16
|
+
yield put({ type: types.UPLOAD_ASSET_SUCCESS, data: result.response.asset, statusCode: result.status ? result.status.code : '', contentId, uploadId});
|
|
17
17
|
} catch (error) {
|
|
18
18
|
yield put({ type: types.UPLOAD_ASSET_FAILURE, error });
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
export function* saveTemplate(template) {
|
|
22
22
|
try {
|
|
23
|
+
let errorMsg;
|
|
23
24
|
const result = yield call(Api.createWeChatTemplate, template);
|
|
24
|
-
|
|
25
|
+
if (!result.success || result.status.code === 500) {
|
|
26
|
+
errorMsg = result.message;
|
|
27
|
+
}
|
|
28
|
+
yield put({ type: types.SAVE_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg});
|
|
25
29
|
} catch (error) {
|
|
26
30
|
yield put({ type: types.SAVE_TEMPLATE_FAILURE, error });
|
|
27
31
|
}
|
|
@@ -16,6 +16,10 @@ const getAssetDetails = () => createSelector(
|
|
|
16
16
|
makeSelectCreate(),
|
|
17
17
|
(substate) => substate.uploadedAssetData || null,
|
|
18
18
|
);
|
|
19
|
+
const getContentAssetDetails = () => createSelector(
|
|
20
|
+
makeSelectCreate(),
|
|
21
|
+
(substate) => substate.uploadedContentAssetData || null,
|
|
22
|
+
);
|
|
19
23
|
/**
|
|
20
24
|
* Default selector used by Create
|
|
21
25
|
*/
|
|
@@ -29,4 +33,5 @@ export default makeSelectCreate;
|
|
|
29
33
|
export {
|
|
30
34
|
makeSelectTemplates,
|
|
31
35
|
getAssetDetails,
|
|
36
|
+
getContentAssetDetails,
|
|
32
37
|
};
|
|
@@ -9,7 +9,7 @@ import { connect } from 'react-redux';
|
|
|
9
9
|
import { bindActionCreators } from 'redux';
|
|
10
10
|
import _ from 'lodash';
|
|
11
11
|
import { createStructuredSelector } from 'reselect';
|
|
12
|
-
import makeSelectEdit from './selectors';
|
|
12
|
+
import makeSelectEdit, { makeSelectTemplates } from './selectors';
|
|
13
13
|
import * as actions from './actions';
|
|
14
14
|
import Create from '../Create';
|
|
15
15
|
|
|
@@ -18,12 +18,29 @@ export class Edit extends React.PureComponent { // eslint-disable-line react/pre
|
|
|
18
18
|
super(props);
|
|
19
19
|
this.state = {
|
|
20
20
|
totalContentBlocks: 0,
|
|
21
|
+
templateData: {},
|
|
21
22
|
};
|
|
22
23
|
this.setTemplateData = this.setTemplateData.bind(this);
|
|
23
24
|
}
|
|
25
|
+
componentWillMount = () => {
|
|
26
|
+
if (_.isEmpty(this.props.Templates.selectedWeChatAccount)) {
|
|
27
|
+
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
28
|
+
const type = this.props.location.query.type;
|
|
29
|
+
this.props.router.push({
|
|
30
|
+
pathname: `/wechat`,
|
|
31
|
+
query: type === 'embedded' ? {type: 'embedded', module} : {module},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
24
35
|
componentDidMount = () => {
|
|
25
36
|
this.props.actions.getTemplateDetails(this.props.params.id, "wechat");
|
|
26
37
|
}
|
|
38
|
+
componentWillReceiveProps = (nextProps) => {
|
|
39
|
+
if (nextProps.Edit.templateDetails && !_.isEmpty(nextProps.Edit.templateDetails) && !_.isEqual(this.props.Edit.templateDetails, nextProps.Edit.templateDetails)) {
|
|
40
|
+
const templateData = this.setTemplateData(nextProps.Edit.templateDetails);
|
|
41
|
+
this.setState({templateData});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
27
44
|
setTemplateData = (templateDetails) => {
|
|
28
45
|
const templateData = {};
|
|
29
46
|
let contentId = 0;
|
|
@@ -36,6 +53,7 @@ export class Edit extends React.PureComponent { // eslint-disable-line react/pre
|
|
|
36
53
|
formData['content-value'] = content.content;
|
|
37
54
|
formData['source-link-value'] = content.content_source_url;
|
|
38
55
|
formData['post-comments-value'] = content.post_comments_scope;
|
|
56
|
+
formData['show-cover-pic-value'] = content.show_cover_pic;
|
|
39
57
|
templateData[contentId] = {
|
|
40
58
|
formData,
|
|
41
59
|
imageUrl: content.image_url,
|
|
@@ -51,15 +69,11 @@ export class Edit extends React.PureComponent { // eslint-disable-line react/pre
|
|
|
51
69
|
return templateData;
|
|
52
70
|
}
|
|
53
71
|
render() {
|
|
54
|
-
|
|
55
|
-
if (!_.isEmpty(this.props.Edit.templateDetails)) {
|
|
56
|
-
templateData = this.setTemplateData(this.props.Edit.templateDetails);
|
|
57
|
-
}
|
|
58
|
-
if (templateData && !_.isEmpty(templateData) && this.state.totalContentBlocks > 0) {
|
|
72
|
+
if (this.state.templateData && !_.isEmpty(this.state.templateData) && this.state.totalContentBlocks > 0) {
|
|
59
73
|
return (
|
|
60
|
-
<div>
|
|
74
|
+
<div className="richmedia-container">
|
|
61
75
|
<Create
|
|
62
|
-
templateData={templateData}
|
|
76
|
+
templateData={this.state.templateData}
|
|
63
77
|
mode="EDIT"
|
|
64
78
|
totalContentBlocks={this.state.totalContentBlocks}
|
|
65
79
|
templateName={this.props.Edit && this.props.Edit.templateDetails && this.props.Edit.templateDetails.name ? this.props.Edit.templateDetails.name : ""}
|
|
@@ -83,10 +97,12 @@ Edit.propTypes = {
|
|
|
83
97
|
actions: PropTypes.object,
|
|
84
98
|
params: PropTypes.object,
|
|
85
99
|
Edit: PropTypes.object,
|
|
100
|
+
Templates: PropTypes.object,
|
|
86
101
|
};
|
|
87
102
|
|
|
88
103
|
const mapStateToProps = createStructuredSelector({
|
|
89
104
|
Edit: makeSelectEdit(),
|
|
105
|
+
Templates: makeSelectTemplates(),
|
|
90
106
|
});
|
|
91
107
|
|
|
92
108
|
function mapDispatchToProps(dispatch) {
|
|
@@ -4,11 +4,15 @@ import { createSelector } from 'reselect';
|
|
|
4
4
|
* Direct selector to the edit state domain
|
|
5
5
|
*/
|
|
6
6
|
const selectEditDomain = () => (state) => state.get('edit');
|
|
7
|
+
const selectTemplatesDomain = (state) => state.get('templates');
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Other specific selectors
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
|
+
const makeSelectTemplates = () => createSelector(
|
|
13
|
+
selectTemplatesDomain,
|
|
14
|
+
(globalState) => globalState.toJS()
|
|
15
|
+
);
|
|
12
16
|
|
|
13
17
|
/**
|
|
14
18
|
* Default selector used by Edit
|
|
@@ -22,4 +26,5 @@ const makeSelectEdit = () => createSelector(
|
|
|
22
26
|
export default makeSelectEdit;
|
|
23
27
|
export {
|
|
24
28
|
selectEditDomain,
|
|
29
|
+
makeSelectTemplates,
|
|
25
30
|
};
|
package/initialState.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capillarytech/creatives-library",
|
|
3
3
|
"author": "meharaj",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.69",
|
|
5
5
|
"description": "Capillary creatives ui",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"module": "./index.es.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "LicenseRef-LICENSE",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@capillarytech/cap-ui-library": "^1.0.
|
|
15
|
+
"@capillarytech/cap-ui-library": "^1.0.106",
|
|
16
16
|
"antd": "3.15.0",
|
|
17
17
|
"axios": "^0.16.2",
|
|
18
18
|
"babel-polyfill": "6.20.0",
|
package/routes.js
CHANGED
|
@@ -412,7 +412,7 @@ export default function createRoutes(store) {
|
|
|
412
412
|
const renderRoute = loadModule(cb);
|
|
413
413
|
|
|
414
414
|
importModules.then(([reducer, sagas, component]) => {
|
|
415
|
-
injectReducer('
|
|
415
|
+
injectReducer('mobilepushCreate', reducer.default);
|
|
416
416
|
injectSagas(sagas.default);
|
|
417
417
|
injectSagas(rootSaga.default);
|
|
418
418
|
renderRoute(component);
|
|
@@ -433,7 +433,7 @@ export default function createRoutes(store) {
|
|
|
433
433
|
const renderRoute = loadModule(cb);
|
|
434
434
|
|
|
435
435
|
importModules.then(([reducer, sagas, component]) => {
|
|
436
|
-
injectReducer('
|
|
436
|
+
injectReducer('mobilepushEdit', reducer.default);
|
|
437
437
|
injectSagas(sagas.default);
|
|
438
438
|
injectSagas(rootSaga.default);
|
|
439
439
|
injectSagas(templateSagas.default);
|
|
@@ -578,15 +578,17 @@ export default function createRoutes(store) {
|
|
|
578
578
|
import('containers/WeChat/RichmediaTemplates/Edit/reducer'),
|
|
579
579
|
import('containers/WeChat/RichmediaTemplates/Edit/sagas'),
|
|
580
580
|
import('containers/WeChat/RichmediaTemplates/Create/sagas'),
|
|
581
|
+
import('containers/WeChat/RichmediaTemplates/Create/reducer'),
|
|
581
582
|
import('containers/WeChat/RichmediaTemplates/Edit'),
|
|
582
583
|
]);
|
|
583
584
|
|
|
584
585
|
const renderRoute = loadModule(cb);
|
|
585
586
|
|
|
586
|
-
importModules.then(([reducer, sagas, createSagas, component]) => {
|
|
587
|
+
importModules.then(([reducer, sagas, createSagas, createReducer, component]) => {
|
|
587
588
|
injectReducer('edit', reducer.default);
|
|
588
589
|
injectSagas(sagas.default);
|
|
589
590
|
injectSagas(createSagas.default);
|
|
591
|
+
injectReducer('create', createReducer.default);
|
|
590
592
|
renderRoute(component);
|
|
591
593
|
});
|
|
592
594
|
|
|
@@ -610,23 +612,39 @@ export default function createRoutes(store) {
|
|
|
610
612
|
import('containers/Email/sagas'),
|
|
611
613
|
import('containers/CallTask/reducer'),
|
|
612
614
|
import('containers/CallTask/sagas'),
|
|
615
|
+
import('containers/Mobilepush/Create/sagas'),
|
|
616
|
+
import('containers/Mobilepush/Create/reducer'),
|
|
617
|
+
import('containers/Mobilepush/Edit/sagas'),
|
|
618
|
+
import('containers/Mobilepush/Edit/reducer'),
|
|
613
619
|
]);
|
|
614
620
|
|
|
615
621
|
const renderRoute = loadModule(cb);
|
|
616
622
|
|
|
617
|
-
importModules.then(([reducer,
|
|
623
|
+
importModules.then(([reducer,
|
|
624
|
+
sagas, component,
|
|
625
|
+
emailContainerSagas, creativesContainerReducer,
|
|
626
|
+
smsCreateReducer, smsCreateSaga, smsEditReducer, smsEditSaga,
|
|
627
|
+
emailReducer, emailSaga,
|
|
628
|
+
callTaskReducer, callTaskSagas,
|
|
629
|
+
mpushCreateSagas, mpushCreateReducer,
|
|
630
|
+
mpushEditSagas, mpushEditReducer,
|
|
631
|
+
]) => {
|
|
618
632
|
injectReducer('templates', reducer.default);
|
|
619
633
|
injectReducer('create', smsCreateReducer.default);
|
|
620
634
|
injectReducer('creativesContainer', creativesContainerReducer.default);
|
|
621
635
|
injectReducer('edit', smsEditReducer.default);
|
|
622
636
|
injectReducer('email', emailReducer.default);
|
|
623
637
|
injectReducer('callTask', callTaskReducer.default);
|
|
638
|
+
injectReducer('mobileCreate', mpushCreateReducer.default);
|
|
639
|
+
injectReducer('mobileEdit', mpushEditReducer.default);
|
|
624
640
|
injectSagas(sagas.default);
|
|
625
641
|
injectSagas(emailContainerSagas.default);
|
|
626
642
|
injectSagas(smsCreateSaga.default);
|
|
627
643
|
injectSagas(smsEditSaga.default);
|
|
628
644
|
injectSagas(emailSaga.default);
|
|
629
645
|
injectSagas(callTaskSagas.default);
|
|
646
|
+
injectSagas(mpushCreateSagas.default);
|
|
647
|
+
injectSagas(mpushEditSagas.default);
|
|
630
648
|
renderRoute(component);
|
|
631
649
|
});
|
|
632
650
|
importModules.catch(errorLoading);
|