@capillarytech/creatives-library 2.0.44 → 2.0.46

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 (91) hide show
  1. package/components/CmsTemplatesComponent/index.js +1 -0
  2. package/components/EmailMobilePreview/index.js +108 -0
  3. package/components/EmailMobilePreview/index.scss +66 -0
  4. package/components/FormBuilder/_formBuilder.scss +2 -14
  5. package/components/FormBuilder/index.js +106 -93
  6. package/components/Header/index.js +41 -0
  7. package/components/Header/messages.js +13 -0
  8. package/components/Header/tests/index.test.js +10 -0
  9. package/components/PreviewSideBar/index.js +7 -3
  10. package/components/TemplatePreview/index.js +6 -7
  11. package/config/app.js +2 -2
  12. package/containers/Cap/index.js +1 -1
  13. package/containers/Cap/selectors.js +11 -1
  14. package/containers/CreativesContainer/SlideBoxContent.js +5 -1
  15. package/containers/CreativesContainer/SlideBoxFooter.js +5 -9
  16. package/containers/CreativesContainer/index.js +59 -16
  17. package/containers/Email/actions.js +2 -3
  18. package/containers/Email/index.js +32 -26
  19. package/containers/Email/sagas.js +1 -0
  20. package/containers/EmailWrapper/index.js +43 -13
  21. package/containers/EmailWrapper/messages.js +8 -0
  22. package/containers/MobilePush/Create/index.js +1 -1
  23. package/containers/Sms/Create/actions.js +4 -4
  24. package/containers/Sms/Create/index.js +28 -17
  25. package/containers/Sms/Create/sagas.js +1 -2
  26. package/containers/Sms/Edit/actions.js +4 -5
  27. package/containers/Sms/Edit/index.js +31 -5
  28. package/containers/Sms/Edit/sagas.js +1 -3
  29. package/containers/Templates/actions.js +3 -1
  30. package/containers/Templates/index.js +219 -84
  31. package/containers/Templates/messages.js +8 -0
  32. package/containers/Templates/sagas.js +16 -4
  33. package/containers/Templates/selectors.js +2 -0
  34. package/containers/TemplatesV2/index.js +9 -4
  35. package/containers/TemplatesV2/reducer.js +34 -0
  36. package/containers/TemplatesV2/sagas.js +32 -0
  37. package/containers/WeChat/MapTemplates/_mapTemplates.scss +8 -0
  38. package/containers/WeChat/MapTemplates/actions.js +52 -0
  39. package/containers/WeChat/MapTemplates/constants.js +28 -0
  40. package/containers/WeChat/MapTemplates/index.js +1401 -0
  41. package/containers/WeChat/MapTemplates/messages.js +73 -0
  42. package/containers/WeChat/MapTemplates/reducer.js +74 -0
  43. package/containers/WeChat/MapTemplates/sagas.js +86 -0
  44. package/containers/WeChat/MapTemplates/selectors.js +25 -0
  45. package/containers/WeChat/MapTemplates/tests/actions.test.js +18 -0
  46. package/containers/WeChat/MapTemplates/tests/index.test.js +10 -0
  47. package/containers/WeChat/MapTemplates/tests/reducer.test.js +9 -0
  48. package/containers/WeChat/MapTemplates/tests/sagas.test.js +15 -0
  49. package/containers/WeChat/MapTemplates/tests/selectors.test.js +10 -0
  50. package/containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +13 -0
  51. package/containers/WeChat/RichmediaTemplates/Create/actions.js +35 -0
  52. package/containers/WeChat/RichmediaTemplates/Create/constants.js +14 -0
  53. package/containers/WeChat/RichmediaTemplates/Create/index.js +679 -0
  54. package/containers/WeChat/RichmediaTemplates/Create/messages.js +13 -0
  55. package/containers/WeChat/RichmediaTemplates/Create/reducer.js +49 -0
  56. package/containers/WeChat/RichmediaTemplates/Create/sagas.js +44 -0
  57. package/containers/WeChat/RichmediaTemplates/Create/selectors.js +32 -0
  58. package/containers/WeChat/RichmediaTemplates/Create/tests/actions.test.js +18 -0
  59. package/containers/WeChat/RichmediaTemplates/Create/tests/index.test.js +10 -0
  60. package/containers/WeChat/RichmediaTemplates/Create/tests/reducer.test.js +9 -0
  61. package/containers/WeChat/RichmediaTemplates/Create/tests/sagas.test.js +15 -0
  62. package/containers/WeChat/RichmediaTemplates/Create/tests/selectors.test.js +10 -0
  63. package/containers/WeChat/RichmediaTemplates/Create/testschema.js +379 -0
  64. package/containers/WeChat/RichmediaTemplates/Edit/actions.js +20 -0
  65. package/containers/WeChat/RichmediaTemplates/Edit/constants.js +10 -0
  66. package/containers/WeChat/RichmediaTemplates/Edit/index.js +98 -0
  67. package/containers/WeChat/RichmediaTemplates/Edit/messages.js +13 -0
  68. package/containers/WeChat/RichmediaTemplates/Edit/reducer.js +28 -0
  69. package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +32 -0
  70. package/containers/WeChat/RichmediaTemplates/Edit/selectors.js +25 -0
  71. package/containers/WeChat/RichmediaTemplates/Edit/tests/actions.test.js +18 -0
  72. package/containers/WeChat/RichmediaTemplates/Edit/tests/index.test.js +10 -0
  73. package/containers/WeChat/RichmediaTemplates/Edit/tests/reducer.test.js +9 -0
  74. package/containers/WeChat/RichmediaTemplates/Edit/tests/sagas.test.js +15 -0
  75. package/containers/WeChat/RichmediaTemplates/Edit/tests/selectors.test.js +10 -0
  76. package/containers/WeChat/RichmediaTemplates/View/actions.js +15 -0
  77. package/containers/WeChat/RichmediaTemplates/View/constants.js +7 -0
  78. package/containers/WeChat/RichmediaTemplates/View/index.js +45 -0
  79. package/containers/WeChat/RichmediaTemplates/View/messages.js +13 -0
  80. package/containers/WeChat/RichmediaTemplates/View/reducer.js +23 -0
  81. package/containers/WeChat/RichmediaTemplates/View/sagas.js +11 -0
  82. package/containers/WeChat/RichmediaTemplates/View/selectors.js +25 -0
  83. package/containers/WeChat/RichmediaTemplates/View/tests/actions.test.js +18 -0
  84. package/containers/WeChat/RichmediaTemplates/View/tests/index.test.js +10 -0
  85. package/containers/WeChat/RichmediaTemplates/View/tests/reducer.test.js +9 -0
  86. package/containers/WeChat/RichmediaTemplates/View/tests/sagas.test.js +15 -0
  87. package/containers/WeChat/RichmediaTemplates/View/tests/selectors.test.js +10 -0
  88. package/index.js +3 -3
  89. package/package.json +1 -1
  90. package/routes.js +53 -13
  91. package/services/api.js +6 -1
@@ -0,0 +1,98 @@
1
+ /*
2
+ *
3
+ * Edit
4
+ *
5
+ */
6
+
7
+ import React, { PropTypes } from 'react';
8
+ import { connect } from 'react-redux';
9
+ import { bindActionCreators } from 'redux';
10
+ import _ from 'lodash';
11
+ import { createStructuredSelector } from 'reselect';
12
+ import makeSelectEdit from './selectors';
13
+ import * as actions from './actions';
14
+ import Create from '../Create';
15
+
16
+ export class Edit extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
17
+ constructor(props) {
18
+ super(props);
19
+ this.state = {
20
+ totalContentBlocks: 0,
21
+ };
22
+ this.setTemplateData = this.setTemplateData.bind(this);
23
+ }
24
+ componentDidMount = () => {
25
+ this.props.actions.getTemplateDetails(this.props.params.id, "wechat");
26
+ }
27
+ setTemplateData = (templateDetails) => {
28
+ const templateData = {};
29
+ let contentId = 0;
30
+ if (!_.isEmpty(templateDetails)) {
31
+ _.forEach(templateDetails.versions.base.mediaList, (content) => {
32
+ const formData = {};
33
+ formData['title-value'] = content.title;
34
+ formData['author-value'] = content.author;
35
+ formData['cover-abstract-value'] = content.digest;
36
+ formData['content-value'] = content.content;
37
+ formData['source-link-value'] = content.content_source_url;
38
+ formData['post-comments-value'] = content.post_comments_scope;
39
+ templateData[contentId] = {
40
+ formData,
41
+ imageUrl: content.image_url,
42
+ mediaId: content.thumb_media_id,
43
+ };
44
+ contentId += 1;
45
+ });
46
+ if (this.props.location.query.type === "embedded" && this.props.location.query.module === "outbound") {
47
+ templateData.templateDetails = templateDetails;
48
+ }
49
+ }
50
+ this.setState({totalContentBlocks: contentId});
51
+ return templateData;
52
+ }
53
+ render() {
54
+ let templateData = {};
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) {
59
+ return (
60
+ <div>
61
+ <Create
62
+ templateData={templateData}
63
+ mode="EDIT"
64
+ totalContentBlocks={this.state.totalContentBlocks}
65
+ templateName={this.props.Edit && this.props.Edit.templateDetails && this.props.Edit.templateDetails.name ? this.props.Edit.templateDetails.name : ""}
66
+ mediaId={this.props.Edit && this.props.Edit.templateDetails && this.props.Edit.templateDetails.versions && this.props.Edit.templateDetails.versions.base && this.props.Edit.templateDetails.versions.base.mediaId ? this.props.Edit.templateDetails.versions.base.mediaId : ""}
67
+ templateId={this.props.Edit && this.props.Edit.templateDetails && this.props.Edit.templateDetails._id ? this.props.Edit.templateDetails._id : ""}
68
+ router={this.props.router}
69
+ location={this.props.location}
70
+ />
71
+ </div>
72
+ );
73
+ }
74
+ return (
75
+ <div></div>
76
+ );
77
+ }
78
+ }
79
+
80
+ Edit.propTypes = {
81
+ router: PropTypes.object,
82
+ location: PropTypes.object,
83
+ actions: PropTypes.object,
84
+ params: PropTypes.object,
85
+ Edit: PropTypes.object,
86
+ };
87
+
88
+ const mapStateToProps = createStructuredSelector({
89
+ Edit: makeSelectEdit(),
90
+ });
91
+
92
+ function mapDispatchToProps(dispatch) {
93
+ return {
94
+ actions: bindActionCreators(actions, dispatch),
95
+ };
96
+ }
97
+
98
+ export default connect(mapStateToProps, mapDispatchToProps)(Edit);
@@ -0,0 +1,13 @@
1
+ /*
2
+ * Edit Messages
3
+ *
4
+ * This contains all the text for the Edit component.
5
+ */
6
+ import { defineMessages } from 'react-intl';
7
+
8
+ export default defineMessages({
9
+ header: {
10
+ id: 'app.containers.Edit.header',
11
+ defaultMessage: 'This is Edit container !',
12
+ },
13
+ });
@@ -0,0 +1,28 @@
1
+ /*
2
+ *
3
+ * Edit reducer
4
+ *
5
+ */
6
+
7
+ import { fromJS } from 'immutable';
8
+ import * as types from './constants';
9
+
10
+ const initialState = fromJS({});
11
+
12
+ function editReducer(state = initialState, action) {
13
+ switch (action.type) {
14
+ case types.DEFAULT_ACTION:
15
+ return state;
16
+ case types.GET_TEMPLATE_DETAILS_REQUEST:
17
+ return state.set('getTemplateDetailsInProgress', true);
18
+ case types.GET_TEMPLATE_DETAILS_SUCCESS:
19
+ return state.set('getTemplateDetailsInProgress', false)
20
+ .set('templateDetails', action.data);
21
+ case types.GET_TEMPLATE_DETAILS_FAILURE:
22
+ return state.set('getTemplateDetailsInProgress', false);
23
+ default:
24
+ return state;
25
+ }
26
+ }
27
+
28
+ export default editReducer;
@@ -0,0 +1,32 @@
1
+ import { take, cancel, call, put, takeLatest } 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
+ // Individual exports for testing
7
+ export function* defaultSaga() {
8
+ // See example in containers/HomePage/sagas.js
9
+ }
10
+ export function* getTemplateDetails({id, channel}) {
11
+ try {
12
+ const params = {
13
+ id, channel,
14
+ };
15
+ console.log('saga get Template details', id);
16
+ const result = yield call(Api.getTemplateDetails, params);
17
+ // const sidebar = result.response.sidebar;
18
+ yield put({ type: types.GET_TEMPLATE_DETAILS_SUCCESS, data: result.response });
19
+ } catch (error) {
20
+ yield put({ type: types.GET_TEMPLATE_DETAILS_FAILURE, error });
21
+ }
22
+ }
23
+ function* watchGetTemplateDetails() {
24
+ const watcher = yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
25
+ yield take(LOCATION_CHANGE);
26
+ yield cancel(watcher);
27
+ }
28
+ // All sagas to be loaded
29
+ export default [
30
+ defaultSaga,
31
+ watchGetTemplateDetails,
32
+ ];
@@ -0,0 +1,25 @@
1
+ import { createSelector } from 'reselect';
2
+
3
+ /**
4
+ * Direct selector to the edit state domain
5
+ */
6
+ const selectEditDomain = () => (state) => state.get('edit');
7
+
8
+ /**
9
+ * Other specific selectors
10
+ */
11
+
12
+
13
+ /**
14
+ * Default selector used by Edit
15
+ */
16
+
17
+ const makeSelectEdit = () => createSelector(
18
+ selectEditDomain(),
19
+ (substate) => substate.toJS()
20
+ );
21
+
22
+ export default makeSelectEdit;
23
+ export {
24
+ selectEditDomain,
25
+ };
@@ -0,0 +1,18 @@
1
+
2
+ import {
3
+ defaultAction,
4
+ } from '../actions';
5
+ import {
6
+ DEFAULT_ACTION,
7
+ } from '../constants';
8
+
9
+ describe('Edit actions', () => {
10
+ describe('Default Action', () => {
11
+ it('has a type of DEFAULT_ACTION', () => {
12
+ const expected = {
13
+ type: DEFAULT_ACTION,
14
+ };
15
+ expect(defaultAction()).toEqual(expected);
16
+ });
17
+ });
18
+ });
@@ -0,0 +1,10 @@
1
+ // import React from 'react';
2
+ // import { shallow } from 'enzyme';
3
+
4
+ // import { Edit } from '../index';
5
+
6
+ describe('<Edit />', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(false);
9
+ });
10
+ });
@@ -0,0 +1,9 @@
1
+
2
+ import { fromJS } from 'immutable';
3
+ import editReducer from '../reducer';
4
+
5
+ describe('editReducer', () => {
6
+ it('returns the initial state', () => {
7
+ expect(editReducer(undefined, {})).toEqual(fromJS({}));
8
+ });
9
+ });
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Test sagas
3
+ */
4
+
5
+ /* eslint-disable redux-saga/yield-effects */
6
+ // import { take, call, put, select } from 'redux-saga/effects';
7
+ // import { defaultSaga } from '../sagas';
8
+
9
+ // const generator = defaultSaga();
10
+
11
+ describe('defaultSaga Saga', () => {
12
+ it('Expect to have unit tests specified', () => {
13
+ expect(true).toEqual(false);
14
+ });
15
+ });
@@ -0,0 +1,10 @@
1
+ // import { fromJS } from 'immutable';
2
+ // import { makeSelectEditDomain } from '../selectors';
3
+
4
+ // const selector = makeSelectEditDomain();
5
+
6
+ describe('makeSelectEditDomain', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(false);
9
+ });
10
+ });
@@ -0,0 +1,15 @@
1
+ /*
2
+ *
3
+ * View actions
4
+ *
5
+ */
6
+
7
+ import {
8
+ DEFAULT_ACTION,
9
+ } from './constants';
10
+
11
+ export function defaultAction() {
12
+ return {
13
+ type: DEFAULT_ACTION,
14
+ };
15
+ }
@@ -0,0 +1,7 @@
1
+ /*
2
+ *
3
+ * View constants
4
+ *
5
+ */
6
+
7
+ export const DEFAULT_ACTION = 'app/View/DEFAULT_ACTION';
@@ -0,0 +1,45 @@
1
+ /*
2
+ *
3
+ * View
4
+ *
5
+ */
6
+
7
+ import React, { PropTypes } from 'react';
8
+ import { connect } from 'react-redux';
9
+ import Helmet from 'react-helmet';
10
+ import { FormattedMessage } from 'react-intl';
11
+ import { createStructuredSelector } from 'reselect';
12
+ import makeSelectView from './selectors';
13
+ import messages from './messages';
14
+
15
+ export class View extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
16
+ render() {
17
+ return (
18
+ <div>
19
+ <Helmet
20
+ title="View"
21
+ meta={[
22
+ { name: 'description', content: 'Description of View' },
23
+ ]}
24
+ />
25
+ <FormattedMessage {...messages.header} />
26
+ </div>
27
+ );
28
+ }
29
+ }
30
+
31
+ View.propTypes = {
32
+ dispatch: PropTypes.func.isRequired,
33
+ };
34
+
35
+ const mapStateToProps = createStructuredSelector({
36
+ View: makeSelectView(),
37
+ });
38
+
39
+ function mapDispatchToProps(dispatch) {
40
+ return {
41
+ dispatch,
42
+ };
43
+ }
44
+
45
+ export default connect(mapStateToProps, mapDispatchToProps)(View);
@@ -0,0 +1,13 @@
1
+ /*
2
+ * View Messages
3
+ *
4
+ * This contains all the text for the View component.
5
+ */
6
+ import { defineMessages } from 'react-intl';
7
+
8
+ export default defineMessages({
9
+ header: {
10
+ id: 'app.containers.View.header',
11
+ defaultMessage: 'This is View container !',
12
+ },
13
+ });
@@ -0,0 +1,23 @@
1
+ /*
2
+ *
3
+ * View reducer
4
+ *
5
+ */
6
+
7
+ import { fromJS } from 'immutable';
8
+ import {
9
+ DEFAULT_ACTION,
10
+ } from './constants';
11
+
12
+ const initialState = fromJS({});
13
+
14
+ function viewReducer(state = initialState, action) {
15
+ switch (action.type) {
16
+ case DEFAULT_ACTION:
17
+ return state;
18
+ default:
19
+ return state;
20
+ }
21
+ }
22
+
23
+ export default viewReducer;
@@ -0,0 +1,11 @@
1
+ // import { take, call, put, select } from 'redux-saga/effects';
2
+
3
+ // Individual exports for testing
4
+ export function* defaultSaga() {
5
+ // See example in containers/HomePage/sagas.js
6
+ }
7
+
8
+ // All sagas to be loaded
9
+ export default [
10
+ defaultSaga,
11
+ ];
@@ -0,0 +1,25 @@
1
+ import { createSelector } from 'reselect';
2
+
3
+ /**
4
+ * Direct selector to the view state domain
5
+ */
6
+ const selectViewDomain = () => (state) => state.get('view');
7
+
8
+ /**
9
+ * Other specific selectors
10
+ */
11
+
12
+
13
+ /**
14
+ * Default selector used by View
15
+ */
16
+
17
+ const makeSelectView = () => createSelector(
18
+ selectViewDomain(),
19
+ (substate) => substate.toJS()
20
+ );
21
+
22
+ export default makeSelectView;
23
+ export {
24
+ selectViewDomain,
25
+ };
@@ -0,0 +1,18 @@
1
+
2
+ import {
3
+ defaultAction,
4
+ } from '../actions';
5
+ import {
6
+ DEFAULT_ACTION,
7
+ } from '../constants';
8
+
9
+ describe('View actions', () => {
10
+ describe('Default Action', () => {
11
+ it('has a type of DEFAULT_ACTION', () => {
12
+ const expected = {
13
+ type: DEFAULT_ACTION,
14
+ };
15
+ expect(defaultAction()).toEqual(expected);
16
+ });
17
+ });
18
+ });
@@ -0,0 +1,10 @@
1
+ // import React from 'react';
2
+ // import { shallow } from 'enzyme';
3
+
4
+ // import { View } from '../index';
5
+
6
+ describe('<View />', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(false);
9
+ });
10
+ });
@@ -0,0 +1,9 @@
1
+
2
+ import { fromJS } from 'immutable';
3
+ import viewReducer from '../reducer';
4
+
5
+ describe('viewReducer', () => {
6
+ it('returns the initial state', () => {
7
+ expect(viewReducer(undefined, {})).toEqual(fromJS({}));
8
+ });
9
+ });
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Test sagas
3
+ */
4
+
5
+ /* eslint-disable redux-saga/yield-effects */
6
+ // import { take, call, put, select } from 'redux-saga/effects';
7
+ // import { defaultSaga } from '../sagas';
8
+
9
+ // const generator = defaultSaga();
10
+
11
+ describe('defaultSaga Saga', () => {
12
+ it('Expect to have unit tests specified', () => {
13
+ expect(true).toEqual(false);
14
+ });
15
+ });
@@ -0,0 +1,10 @@
1
+ // import { fromJS } from 'immutable';
2
+ // import { makeSelectViewDomain } from '../selectors';
3
+
4
+ // const selector = makeSelectViewDomain();
5
+
6
+ describe('makeSelectViewDomain', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(false);
9
+ });
10
+ });
package/index.js CHANGED
@@ -19,9 +19,9 @@ import Email from './containers/Email/index';
19
19
  import emailReducer from './containers/Email/reducer';
20
20
  import emailSaga from './containers/Email/sagas';
21
21
 
22
- import WeChat from './containers/WeChat';
23
- import wechatReduce from './containers/WeChat/reducer';
24
- import wechatSaga from './containers/WeChat/sagas';
22
+ import WeChat from './containers/WeChat/MapTemplates';
23
+ import wechatReduce from './containers/WeChat/MapTemplates/reducer';
24
+ import wechatSaga from './containers/WeChat/MapTemplates/sagas';
25
25
 
26
26
  import MobilepushCreate from './containers/MobilePush/Create';
27
27
  import mobilepushCreateReducer from './containers/MobilePush/Create/reducer';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "2.0.44",
4
+ "version": "2.0.46",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/routes.js CHANGED
@@ -240,9 +240,9 @@ export default function createRoutes(store) {
240
240
  name: 'create weChat',
241
241
  getComponent(nextState, cb) {
242
242
  const importModules = Promise.all([
243
- import('containers/WeChat/reducer'),
244
- import('containers/WeChat/sagas'),
245
- import('containers/WeChat'),
243
+ import('containers/WeChat/MapTemplates/reducer'),
244
+ import('containers/WeChat/MapTemplates/sagas'),
245
+ import('containers/WeChat/MapTemplates'),
246
246
  ]);
247
247
 
248
248
  const renderRoute = loadModule(cb);
@@ -262,9 +262,9 @@ export default function createRoutes(store) {
262
262
  name: 'edit weChat',
263
263
  getComponent(nextState, cb) {
264
264
  const importModules = Promise.all([
265
- import('containers/WeChat/reducer'),
266
- import('containers/WeChat/sagas'),
267
- import('containers/WeChat'),
265
+ import('containers/WeChat/MapTemplates/reducer'),
266
+ import('containers/WeChat/MapTemplates/sagas'),
267
+ import('containers/WeChat/MapTemplates'),
268
268
  ]);
269
269
 
270
270
  const renderRoute = loadModule(cb);
@@ -551,7 +551,49 @@ export default function createRoutes(store) {
551
551
  importModules.catch(errorLoading);
552
552
  },
553
553
  }, {
554
- path: '/templates',
554
+ path: '/wechat/richmedia/create',
555
+ name: 'wechat_richmedia_create',
556
+ getComponent(nextState, cb) {
557
+ const importModules = Promise.all([
558
+ import('containers/WeChat/RichmediaTemplates/Create/reducer'),
559
+ import('containers/WeChat/RichmediaTemplates/Create/sagas'),
560
+ import('containers/WeChat/RichmediaTemplates/Create'),
561
+ ]);
562
+
563
+ const renderRoute = loadModule(cb);
564
+
565
+ importModules.then(([reducer, sagas, component]) => {
566
+ injectReducer('create', reducer.default);
567
+ injectSagas(sagas.default);
568
+ renderRoute(component);
569
+ });
570
+
571
+ importModules.catch(errorLoading);
572
+ },
573
+ }, {
574
+ path: '/wechat/richmedia/edit/:id',
575
+ name: 'wechat_richmedia_edit',
576
+ getComponent(nextState, cb) {
577
+ const importModules = Promise.all([
578
+ import('containers/WeChat/RichmediaTemplates/Edit/reducer'),
579
+ import('containers/WeChat/RichmediaTemplates/Edit/sagas'),
580
+ import('containers/WeChat/RichmediaTemplates/Create/sagas'),
581
+ import('containers/WeChat/RichmediaTemplates/Edit'),
582
+ ]);
583
+
584
+ const renderRoute = loadModule(cb);
585
+
586
+ importModules.then(([reducer, sagas, createSagas, component]) => {
587
+ injectReducer('edit', reducer.default);
588
+ injectSagas(sagas.default);
589
+ injectSagas(createSagas.default);
590
+ renderRoute(component);
591
+ });
592
+
593
+ importModules.catch(errorLoading);
594
+ },
595
+ }, {
596
+ path: '/v2(/:channel)',
555
597
  name: 'templatesV2',
556
598
  getComponent(nextState, cb) {
557
599
  const importModules = Promise.all([
@@ -560,13 +602,12 @@ export default function createRoutes(store) {
560
602
  import('containers/TemplatesV2'),
561
603
  import('containers/Email/sagas'),
562
604
  import('containers/CreativesContainer/reducer'),
563
- import('containers/Sms/create/reducer'),
564
- import('containers/Sms/create/sagas'),
605
+ import('containers/Sms/Create/reducer'),
606
+ import('containers/Sms/Create/sagas'),
565
607
  import('containers/Sms/Edit/reducer'),
566
608
  import('containers/Sms/Edit/sagas'),
567
609
  import('containers/Email/reducer'),
568
- import('containers/Email/sagas'),
569
- ]);
610
+ import('containers/Email/sagas')]);
570
611
 
571
612
  const renderRoute = loadModule(cb);
572
613
 
@@ -581,12 +622,11 @@ export default function createRoutes(store) {
581
622
  injectSagas(smsCreateSaga.default);
582
623
  injectSagas(smsEditSaga.default);
583
624
  injectSagas(emailSaga.default);
584
-
585
625
  renderRoute(component);
586
626
  });
587
-
588
627
  importModules.catch(errorLoading);
589
628
  },
629
+
590
630
  }, {
591
631
  path: '*',
592
632
  name: 'notfound',
package/services/api.js CHANGED
@@ -234,13 +234,18 @@ export const deleteAssetById = ({assetId, assetType}) => {
234
234
  // return API.deleteResource(url);
235
235
  };
236
236
 
237
- export const uploadFile = ({file, assetType, fileParams, mode}) => {
237
+ export const uploadFile = ({file, assetType, fileParams, mode, wechatParams}) => {
238
238
  const data = new FormData();
239
239
  data.append('file', file);
240
240
  data.append('fileParam', JSON.stringify(fileParams));
241
241
  if (mode) {
242
242
  data.append('mode', mode);
243
243
  }
244
+ if (wechatParams) {
245
+ data.append('source', wechatParams.source);
246
+ data.append('appId', wechatParams.appId);
247
+ data.append('appSecret', wechatParams.appSecret);
248
+ }
244
249
  const url = `${API_ENDPOINT}/assets/${assetType}`;
245
250
  // return API.post(url, data, true);
246
251
  return request(url, getAPICallObject('POST', data, true));