@capillarytech/creatives-library 8.0.136-alpha.4 → 8.0.136-beta.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.
- package/components/BreadCrumbs/index.js +65 -0
- package/components/BreadCrumbs/messages.js +13 -0
- package/components/CapTagList/index.js +235 -0
- package/components/CapTagList/messages.js +45 -0
- package/components/Card/_customCard.scss +40 -0
- package/components/Card/index.js +78 -0
- package/components/Card/tests/__snapshots__/index.test.js.snap +22 -0
- package/components/Card/tests/index.test.js +20 -0
- package/components/CardGrid/index.js +71 -0
- package/components/Ckeditor/index.js +238 -0
- package/components/Ckeditor/messages.js +13 -0
- package/components/Ckeditor/style.scss +3 -0
- package/components/Component/index.js +29 -0
- package/components/CustomPopOver/index.js +81 -0
- package/components/CustomPopOver/messages.js +17 -0
- package/components/DateFilter/index.js +349 -0
- package/components/DateFilter/messages.js +57 -0
- package/components/DateRange/index.js +114 -0
- package/components/DateRange/messages.js +25 -0
- package/components/Edmeditor/index.js +65 -0
- package/components/Edmeditor/messages.js +13 -0
- package/components/EmailPreview/_emailPreview.scss +119 -0
- package/components/EmailPreview/assets/images/iPad.svg +10 -0
- package/components/EmailPreview/assets/images/mobile.png +0 -0
- package/components/EmailPreview/index.js +107 -0
- package/components/EmailPreview/messages.js +33 -0
- package/components/Footer/index.js +27 -0
- package/components/Footer/messages.js +13 -0
- package/components/FormBuilder/_formBuilder.scss +83 -0
- package/components/FormBuilder/index.js +3279 -0
- package/components/FormBuilder/messages.js +61 -0
- package/components/Header/index.js +44 -0
- package/components/Header/messages.js +29 -0
- package/components/ImagePreview/_imagePreview.scss +63 -0
- package/components/ImagePreview/index.js +52 -0
- package/components/ImagePreview/messages.js +17 -0
- package/components/PageHeader/_pageHeader.scss +22 -0
- package/components/PageHeader/index.js +37 -0
- package/components/PageHeader/messages.js +13 -0
- package/components/Pagination/_pagination.scss +5 -0
- package/components/Pagination/index.js +49 -0
- package/components/PreviewSideBar/_previewsidebar.scss +28 -0
- package/components/PreviewSideBar/index.js +152 -0
- package/components/PreviewSideBar/messages.js +41 -0
- package/components/Sidebar/_sidebar.scss +115 -0
- package/components/Sidebar/index.js +214 -0
- package/components/Sidebar/messages.js +21 -0
- package/components/SlideBox/_slideBox.scss +63 -0
- package/components/SlideBox/index.js +47 -0
- package/components/SlideBox/tests/index.test.js +103 -0
- package/components/SmsEditor/index.js +55 -0
- package/components/SmsTest/index.js +117 -0
- package/components/SmsTest/messages.js +21 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +42 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +141 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +21 -0
- package/components/TemplatePreview/_templatePreview.scss +642 -0
- package/components/TemplatePreview/assets/images/WECHAT_5x.png +0 -0
- package/components/TemplatePreview/assets/images/androidPushMessage.svg +45 -0
- package/components/TemplatePreview/assets/images/home-screen-android.svg +21 -0
- package/components/TemplatePreview/assets/images/home-screen-ios.svg +16 -0
- package/components/TemplatePreview/assets/images/iPhonePushMessage.svg +135 -0
- package/components/TemplatePreview/assets/images/mobile.svg +24 -0
- package/components/TemplatePreview/assets/images/sms-body.png +0 -0
- package/components/TemplatePreview/assets/images/sms-icon.png +0 -0
- package/components/TemplatePreview/assets/images/sms_mobile.png +0 -0
- package/components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -0
- package/components/TemplatePreview/assets/images/sms_mobile_ios.svg +16 -0
- package/components/TemplatePreview/assets/images/user-icon.svg +19 -0
- package/components/TemplatePreview/assets/images/wechat-mobile.svg +78 -0
- package/components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -0
- package/components/TemplatePreview/index.js +617 -0
- package/components/TemplatePreview/messages.js +78 -0
- package/components/Toastr/index.js +60 -0
- package/components/Toastr/messages.js +13 -0
- package/components/ToastrMessage/index.js +113 -0
- package/components/ToastrMessage/messages.js +17 -0
- package/components/TopBar/_topbar.scss +46 -0
- package/components/TopBar/assets/images/capillary_logo.png +0 -0
- package/components/TopBar/assets/images/old_capillary_logo.png +0 -0
- package/components/TopBar/index.js +113 -0
- package/components/TopBar/messages.js +29 -0
- package/containers/App/actions.js +7 -0
- package/containers/App/constants.js +114 -0
- package/containers/App/index.js +52 -0
- package/containers/App/reducer.js +19 -0
- package/containers/App/sagas.js +31 -0
- package/containers/App/selectors.js +25 -0
- package/containers/App/test/saga.test.js +11 -0
- package/containers/Assets/Gallery/_gallery.scss +126 -0
- package/containers/Assets/Gallery/actions.js +37 -0
- package/containers/Assets/Gallery/constants.js +23 -0
- package/containers/Assets/Gallery/index.js +473 -0
- package/containers/Assets/Gallery/messages.js +93 -0
- package/containers/Assets/Gallery/reducer.js +81 -0
- package/containers/Assets/Gallery/sagas.js +80 -0
- package/containers/Assets/Gallery/selectors.js +25 -0
- package/containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +9 -0
- package/containers/Assets/Gallery/tests/actions.test.js +25 -0
- package/containers/Assets/Gallery/tests/reducer.test.js +96 -0
- package/containers/Assets/Gallery/tests/saga.test.js +157 -0
- package/containers/Cap/actions.js +66 -0
- package/containers/Cap/constants.js +25 -0
- package/containers/Cap/index.js +402 -0
- package/containers/Cap/messages.js +75 -0
- package/containers/Cap/reducer.js +113 -0
- package/containers/Cap/sagas.js +159 -0
- package/containers/Cap/selectors.js +75 -0
- package/containers/Cap/tests/__snapshots__/index.test.js.snap +2269 -0
- package/containers/Cap/tests/index.test.js +22 -0
- package/containers/Cap/tests/saga.test.js +284 -0
- package/containers/Dashboard/actions.js +15 -0
- package/containers/Dashboard/constants.js +7 -0
- package/containers/Dashboard/index.js +76 -0
- package/containers/Dashboard/messages.js +13 -0
- package/containers/Dashboard/reducer.js +21 -0
- package/containers/Dashboard/sagas.js +17 -0
- package/containers/Dashboard/selectors.js +25 -0
- package/containers/Dashboard/test/saga.test.js +9 -0
- package/containers/Ebill/_ebill.scss +5 -0
- package/containers/Ebill/actions.js +43 -0
- package/containers/Ebill/constants.js +20 -0
- package/containers/Ebill/index.js +1278 -0
- package/containers/Ebill/messages.js +77 -0
- package/containers/Ebill/reducer.js +72 -0
- package/containers/Ebill/sagas.js +74 -0
- package/containers/Ebill/selectors.js +25 -0
- package/containers/Ebill/test/saga.test.js +11 -0
- package/containers/Email/_email.scss +141 -0
- package/containers/Email/actions.js +81 -0
- package/containers/Email/constants.js +36 -0
- package/containers/Email/index.js +3325 -0
- package/containers/Email/messages.js +289 -0
- package/containers/Email/reducer.js +142 -0
- package/containers/Email/sagas.js +135 -0
- package/containers/Email/selectors.js +31 -0
- package/containers/Email/test/saga.test.js +671 -0
- package/containers/LanguageProvider/actions.js +17 -0
- package/containers/LanguageProvider/constants.js +8 -0
- package/containers/LanguageProvider/index.js +80 -0
- package/containers/LanguageProvider/reducer.js +30 -0
- package/containers/LanguageProvider/selectors.js +20 -0
- package/containers/LanguageProvider/tests/actions.test.js +19 -0
- package/containers/LanguageProvider/tests/index.test.js +78 -0
- package/containers/LanguageProvider/tests/reducer.test.js +20 -0
- package/containers/LanguageProvider/tests/selectors.test.js +15 -0
- package/containers/Line/Create/_lineCreate.scss +54 -0
- package/containers/Line/Create/actions.js +90 -0
- package/containers/Line/Create/constants.js +39 -0
- package/containers/Line/Create/index.js +836 -0
- package/containers/Line/Create/messages.js +189 -0
- package/containers/Line/Create/reducer.js +99 -0
- package/containers/Line/Create/sagas.js +121 -0
- package/containers/Line/Create/selectors.js +36 -0
- package/containers/Line/Create/tests/saga.test.js +202 -0
- package/containers/Line/Edit/_lineEdit.scss +35 -0
- package/containers/Line/Edit/actions.js +79 -0
- package/containers/Line/Edit/constants.js +27 -0
- package/containers/Line/Edit/index.js +1050 -0
- package/containers/Line/Edit/messages.js +177 -0
- package/containers/Line/Edit/reducer.js +83 -0
- package/containers/Line/Edit/sagas.js +80 -0
- package/containers/Line/Edit/selectors.js +29 -0
- package/containers/Line/Edit/test/saga.test.js +160 -0
- package/containers/Login/assets/images/capillary_logo.png +0 -0
- package/containers/Login/components/LoginForm/index.js +62 -0
- package/containers/Login/components/LoginForm/messages.js +33 -0
- package/containers/Login/index.js +130 -0
- package/containers/Login/messages.js +25 -0
- package/containers/Login/selectors.js +25 -0
- package/containers/MobilePush/Create/_mobilePushCreate.scss +39 -0
- package/containers/MobilePush/Create/actions.js +46 -0
- package/containers/MobilePush/Create/constants.js +23 -0
- package/containers/MobilePush/Create/index.js +2303 -0
- package/containers/MobilePush/Create/messages.js +269 -0
- package/containers/MobilePush/Create/reducer.js +70 -0
- package/containers/MobilePush/Create/sagas.js +74 -0
- package/containers/MobilePush/Create/selectors.js +28 -0
- package/containers/MobilePush/Create/test/saga.test.js +19 -0
- package/containers/MobilePush/Edit/_mobilePushCreate.scss +39 -0
- package/containers/MobilePush/Edit/actions.js +91 -0
- package/containers/MobilePush/Edit/constants.js +35 -0
- package/containers/MobilePush/Edit/index.js +2601 -0
- package/containers/MobilePush/Edit/messages.js +266 -0
- package/containers/MobilePush/Edit/reducer.js +112 -0
- package/containers/MobilePush/Edit/sagas.js +126 -0
- package/containers/MobilePush/Edit/selectors.js +29 -0
- package/containers/MobilePush/Edit/tests/saga.test.js +255 -0
- package/containers/NotFoundPage/index.js +25 -0
- package/containers/NotFoundPage/messages.js +13 -0
- package/containers/NotFoundPage/tests/index.test.js +17 -0
- package/containers/Sms/Create/_smsCreate.scss +42 -0
- package/containers/Sms/Create/actions.js +27 -0
- package/containers/Sms/Create/constants.js +16 -0
- package/containers/Sms/Create/index.js +1488 -0
- package/containers/Sms/Create/messages.js +109 -0
- package/containers/Sms/Create/reducer.js +41 -0
- package/containers/Sms/Create/sagas.js +40 -0
- package/containers/Sms/Create/selectors.js +28 -0
- package/containers/Sms/Create/test/saga.test.js +11 -0
- package/containers/Sms/Edit/actions.js +40 -0
- package/containers/Sms/Edit/constants.js +17 -0
- package/containers/Sms/Edit/index.js +1472 -0
- package/containers/Sms/Edit/messages.js +105 -0
- package/containers/Sms/Edit/reducer.js +50 -0
- package/containers/Sms/Edit/sagas.js +60 -0
- package/containers/Sms/Edit/selectors.js +32 -0
- package/containers/Sms/Edit/test/saga.test.js +13 -0
- package/containers/TagList/_tagList.scss +8 -0
- package/containers/TagList/actions.js +15 -0
- package/containers/TagList/constants.js +32 -0
- package/containers/TagList/index.js +236 -0
- package/containers/TagList/messages.js +13 -0
- package/containers/TagList/reducer.js +23 -0
- package/containers/TagList/sagas.js +11 -0
- package/containers/TagList/selectors.js +25 -0
- package/containers/Templates/_templates.scss +333 -0
- package/containers/Templates/actions.js +103 -0
- package/containers/Templates/constants.js +60 -0
- package/containers/Templates/index.js +1756 -0
- package/containers/Templates/messages.js +337 -0
- package/containers/Templates/reducer.js +142 -0
- package/containers/Templates/sagas.js +163 -0
- package/containers/Templates/selectors.js +28 -0
- package/containers/Templates/test/saga.test.js +241 -0
- package/containers/WeChat/MapTemplates/_mapTemplates.scss +8 -0
- package/containers/WeChat/MapTemplates/actions.js +52 -0
- package/containers/WeChat/MapTemplates/constants.js +28 -0
- package/containers/WeChat/MapTemplates/index.js +1610 -0
- package/containers/WeChat/MapTemplates/messages.js +157 -0
- package/containers/WeChat/MapTemplates/reducer.js +74 -0
- package/containers/WeChat/MapTemplates/sagas.js +84 -0
- package/containers/WeChat/MapTemplates/selectors.js +25 -0
- package/containers/WeChat/MapTemplates/test/saga.test.js +155 -0
- package/containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +57 -0
- package/containers/WeChat/RichmediaTemplates/Create/actions.js +36 -0
- package/containers/WeChat/RichmediaTemplates/Create/constants.js +15 -0
- package/containers/WeChat/RichmediaTemplates/Create/index.js +1071 -0
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +165 -0
- package/containers/WeChat/RichmediaTemplates/Create/reducer.js +60 -0
- package/containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +497 -0
- package/containers/WeChat/RichmediaTemplates/Create/sagas.js +51 -0
- package/containers/WeChat/RichmediaTemplates/Create/selectors.js +37 -0
- package/containers/WeChat/RichmediaTemplates/Create/test/saga.test.js +13 -0
- package/containers/WeChat/RichmediaTemplates/Edit/actions.js +20 -0
- package/containers/WeChat/RichmediaTemplates/Edit/constants.js +10 -0
- package/containers/WeChat/RichmediaTemplates/Edit/index.js +136 -0
- package/containers/WeChat/RichmediaTemplates/Edit/messages.js +13 -0
- package/containers/WeChat/RichmediaTemplates/Edit/reducer.js +28 -0
- package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +36 -0
- package/containers/WeChat/RichmediaTemplates/Edit/selectors.js +30 -0
- package/containers/WeChat/RichmediaTemplates/Edit/test/saga.test.js +12 -0
- package/containers/WeChat/RichmediaTemplates/View/actions.js +15 -0
- package/containers/WeChat/RichmediaTemplates/View/constants.js +7 -0
- package/containers/WeChat/RichmediaTemplates/View/index.js +47 -0
- package/containers/WeChat/RichmediaTemplates/View/messages.js +21 -0
- package/containers/WeChat/RichmediaTemplates/View/reducer.js +23 -0
- package/containers/WeChat/RichmediaTemplates/View/sagas.js +11 -0
- package/containers/WeChat/RichmediaTemplates/View/selectors.js +25 -0
- package/index.js +2 -4
- package/package.json +1 -1
- package/routes.js +202 -136
- package/services/getSchema.js +1 -1
- package/services/localStorageApi.js +0 -1
- package/tests/i18n.test.js +1 -1
- package/utils/asyncInjectors.js +78 -0
- package/utils/authWrapper.js +1 -1
- package/utils/callNativeEvent.js +16 -0
- package/utils/checkStore.js +21 -0
- package/utils/common.js +2 -2
- package/utils/customAuthWrapper.js +62 -0
- package/utils/customConnectedAuthWrapper.js +26 -0
- package/utils/tagValidations.js +1 -1
- package/utils/tests/checkStore.test.js +1 -1
- package/utils/tests/customAuth.test.js +1 -1
- package/utils/transformerUtils.js +195 -1
- package/v2Components/CapTagList/index.js +14 -9
- package/v2Components/Carousel/style.scss +1 -1
- package/v2Components/EmailMobilePreview/index.js +2 -2
- package/v2Components/FormBuilder/index.js +2 -2
- package/v2Components/TemplatePreview/index.js +1 -2
- package/v2Containers/Cap/tests/saga.test.js +1 -1
- package/v2Containers/Email/index.js +1 -1
- package/v2Containers/FTP/index.js +1 -1
- package/v2Containers/Line/Container/Text/index.js +6 -6
- package/v2Containers/Sms/Create/index.js +2 -2
- package/v2Containers/Sms/Edit/index.js +1 -1
- package/v2Containers/TagList/index.js +1 -1
- package/v2Containers/TagList/utils.js +1 -1
- package/v2Containers/Templates/index.js +1 -1
- package/v2Containers/Templates/sagas.js +1 -1
- package/constants/unified.js +0 -189
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* Edit
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { connect } from 'react-redux';
|
|
11
|
+
import { bindActionCreators, compose } from 'redux';
|
|
12
|
+
import _ from 'lodash';
|
|
13
|
+
import { createStructuredSelector } from 'reselect';
|
|
14
|
+
import makeSelectEdit, { makeSelectTemplates } from './selectors';
|
|
15
|
+
import * as actions from './actions';
|
|
16
|
+
import Create from '../Create';
|
|
17
|
+
import injectSaga from '../../../../utils/injectSaga';
|
|
18
|
+
import injectReducer from '../../../../utils/injectReducer';
|
|
19
|
+
import reducer from './reducer';
|
|
20
|
+
import createReducer from '../Create/reducer';
|
|
21
|
+
import { richMediaTemplatesEditSaga } from './sagas';
|
|
22
|
+
import { richMediaTemplatesSaga } from '../Create/sagas';
|
|
23
|
+
import { createQueryString } from '../../../../utils/common';
|
|
24
|
+
|
|
25
|
+
export class Edit extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
|
|
26
|
+
constructor(props) {
|
|
27
|
+
super(props);
|
|
28
|
+
this.state = {
|
|
29
|
+
totalContentBlocks: 0,
|
|
30
|
+
templateData: {},
|
|
31
|
+
};
|
|
32
|
+
this.setTemplateData = this.setTemplateData.bind(this);
|
|
33
|
+
}
|
|
34
|
+
componentWillMount = () => {
|
|
35
|
+
if (_.isEmpty(this.props.Templates.selectedWeChatAccount)) {
|
|
36
|
+
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
37
|
+
const type = this.props.location.query.type;
|
|
38
|
+
this.props.router.push({
|
|
39
|
+
pathname: `/wechat`,
|
|
40
|
+
search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
componentDidMount = () => {
|
|
45
|
+
this.props.actions.getTemplateDetails(this.props.params.id, "wechat");
|
|
46
|
+
}
|
|
47
|
+
componentWillReceiveProps = (nextProps) => {
|
|
48
|
+
if (nextProps.Edit.templateDetails && !_.isEmpty(nextProps.Edit.templateDetails) && !_.isEqual(this.props.Edit.templateDetails, nextProps.Edit.templateDetails)) {
|
|
49
|
+
const templateData = this.setTemplateData(nextProps.Edit.templateDetails);
|
|
50
|
+
this.setState({templateData});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
setTemplateData = (templateDetails) => {
|
|
54
|
+
const templateData = {};
|
|
55
|
+
let contentId = 0;
|
|
56
|
+
if (!_.isEmpty(templateDetails)) {
|
|
57
|
+
_.forEach(templateDetails.versions.base.mediaList, (content) => {
|
|
58
|
+
const formData = {};
|
|
59
|
+
formData['title-value'] = content.title;
|
|
60
|
+
formData['author-value'] = content.author;
|
|
61
|
+
formData['cover-abstract-value'] = content.digest;
|
|
62
|
+
formData['content-value'] = content.content;
|
|
63
|
+
formData['source-link-value'] = content.content_source_url;
|
|
64
|
+
formData['post-comments-value'] = content.post_comments_scope;
|
|
65
|
+
formData['show-cover-pic-value'] = content.show_cover_pic;
|
|
66
|
+
templateData[contentId] = {
|
|
67
|
+
formData,
|
|
68
|
+
imageUrl: content.image_url,
|
|
69
|
+
mediaId: content.thumb_media_id,
|
|
70
|
+
};
|
|
71
|
+
contentId += 1;
|
|
72
|
+
});
|
|
73
|
+
if (this.props.location.query.type === "embedded" && this.props.location.query.module === "outbound") {
|
|
74
|
+
templateData.templateDetails = templateDetails;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
this.setState({totalContentBlocks: contentId});
|
|
78
|
+
return templateData;
|
|
79
|
+
}
|
|
80
|
+
render() {
|
|
81
|
+
if (this.state.templateData && !_.isEmpty(this.state.templateData) && this.state.totalContentBlocks > 0) {
|
|
82
|
+
return (
|
|
83
|
+
<div className="richmedia-container">
|
|
84
|
+
<Create
|
|
85
|
+
templateData={this.state.templateData}
|
|
86
|
+
mode="EDIT"
|
|
87
|
+
totalContentBlocks={this.state.totalContentBlocks}
|
|
88
|
+
templateName={this.props.Edit && this.props.Edit.templateDetails && this.props.Edit.templateDetails.name ? this.props.Edit.templateDetails.name : ""}
|
|
89
|
+
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 : ""}
|
|
90
|
+
templateId={this.props.Edit && this.props.Edit.templateDetails && this.props.Edit.templateDetails._id ? this.props.Edit.templateDetails._id : ""}
|
|
91
|
+
router={this.props.router}
|
|
92
|
+
location={this.props.location}
|
|
93
|
+
/>
|
|
94
|
+
</div>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return (
|
|
98
|
+
<div></div>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
Edit.propTypes = {
|
|
104
|
+
router: PropTypes.object,
|
|
105
|
+
location: PropTypes.object,
|
|
106
|
+
actions: PropTypes.object,
|
|
107
|
+
params: PropTypes.object,
|
|
108
|
+
Edit: PropTypes.object,
|
|
109
|
+
Templates: PropTypes.object,
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const mapStateToProps = createStructuredSelector({
|
|
113
|
+
Edit: makeSelectEdit(),
|
|
114
|
+
Templates: makeSelectTemplates(),
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
function mapDispatchToProps(dispatch) {
|
|
118
|
+
return {
|
|
119
|
+
actions: bindActionCreators(actions, dispatch),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
124
|
+
const withReducer = injectReducer({ key: 'edit', reducer });
|
|
125
|
+
const withCreateReducer = injectReducer({ key: 'create', reducer: createReducer });
|
|
126
|
+
const withSaga = injectSaga({ key: 'edit', saga: richMediaTemplatesEditSaga });
|
|
127
|
+
const withCreateSaga = injectSaga({ key: 'create', saga: richMediaTemplatesSaga });
|
|
128
|
+
|
|
129
|
+
export default compose(
|
|
130
|
+
withReducer,
|
|
131
|
+
withCreateReducer,
|
|
132
|
+
withSaga,
|
|
133
|
+
withCreateSaga,
|
|
134
|
+
withConnect,
|
|
135
|
+
)(Edit);
|
|
136
|
+
|
|
@@ -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: 'creatives.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,36 @@
|
|
|
1
|
+
import { call, put, takeLatest, all } from 'redux-saga/effects';
|
|
2
|
+
import * as Api from '../../../../services/api';
|
|
3
|
+
import * as types from './constants';
|
|
4
|
+
|
|
5
|
+
// Individual exports for testing
|
|
6
|
+
export function* defaultSaga() {
|
|
7
|
+
// See example in containers/HomePage/sagas.js
|
|
8
|
+
}
|
|
9
|
+
export function* getTemplateDetails({id, channel}) {
|
|
10
|
+
try {
|
|
11
|
+
const params = {
|
|
12
|
+
id, channel,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const result = yield call(Api.getTemplateDetails, params);
|
|
16
|
+
// const sidebar = result.response.sidebar;
|
|
17
|
+
yield put({ type: types.GET_TEMPLATE_DETAILS_SUCCESS, data: result.response });
|
|
18
|
+
} catch (error) {
|
|
19
|
+
yield put({ type: types.GET_TEMPLATE_DETAILS_FAILURE, error });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function* watchGetTemplateDetails() {
|
|
23
|
+
yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
24
|
+
}
|
|
25
|
+
// All sagas to be loaded
|
|
26
|
+
export default [
|
|
27
|
+
defaultSaga,
|
|
28
|
+
watchGetTemplateDetails,
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export function* richMediaTemplatesEditSaga() {
|
|
32
|
+
yield all([
|
|
33
|
+
defaultSaga(),
|
|
34
|
+
watchGetTemplateDetails(),
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createSelector } from 'reselect';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Direct selector to the edit state domain
|
|
5
|
+
*/
|
|
6
|
+
const selectEditDomain = () => (state) => state.get('edit');
|
|
7
|
+
const selectTemplatesDomain = (state) => state.get('templates');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Other specific selectors
|
|
11
|
+
*/
|
|
12
|
+
const makeSelectTemplates = () => createSelector(
|
|
13
|
+
selectTemplatesDomain,
|
|
14
|
+
(globalState) => globalState.toJS()
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Default selector used by Edit
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const makeSelectEdit = () => createSelector(
|
|
22
|
+
selectEditDomain(),
|
|
23
|
+
(substate) => substate.toJS()
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export default makeSelectEdit;
|
|
27
|
+
export {
|
|
28
|
+
selectEditDomain,
|
|
29
|
+
makeSelectTemplates,
|
|
30
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import { expectSaga } from "redux-saga-test-plan";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
richMediaTemplatesEditSaga,
|
|
6
|
+
} from "../sagas";
|
|
7
|
+
|
|
8
|
+
describe("richMediaTemplatesEditSaga Combined", () => {
|
|
9
|
+
it.concurrent("should initialize all richMediaTemplatesEditSaga-related watcher sagas without error", () => {
|
|
10
|
+
return expectSaga(richMediaTemplatesEditSaga).run();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* View
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { connect } from 'react-redux';
|
|
11
|
+
import Helmet from 'react-helmet';
|
|
12
|
+
import { FormattedMessage } from 'react-intl';
|
|
13
|
+
import { createStructuredSelector } from 'reselect';
|
|
14
|
+
import makeSelectView from './selectors';
|
|
15
|
+
import messages from './messages';
|
|
16
|
+
|
|
17
|
+
export class View extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
|
|
18
|
+
render() {
|
|
19
|
+
return (
|
|
20
|
+
<div>
|
|
21
|
+
<Helmet
|
|
22
|
+
title={<FormattedMessage {...messages.view} />}
|
|
23
|
+
meta={[
|
|
24
|
+
{ name: 'description', content: <FormattedMessage {...messages.descriptionView} /> },
|
|
25
|
+
]}
|
|
26
|
+
/>
|
|
27
|
+
<FormattedMessage {...messages.header} />
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
View.propTypes = {
|
|
34
|
+
dispatch: PropTypes.func.isRequired,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const mapStateToProps = createStructuredSelector({
|
|
38
|
+
View: makeSelectView(),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
function mapDispatchToProps(dispatch) {
|
|
42
|
+
return {
|
|
43
|
+
dispatch,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default connect(mapStateToProps, mapDispatchToProps)(View);
|
|
@@ -0,0 +1,21 @@
|
|
|
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: 'creatives.containers.View.header',
|
|
11
|
+
defaultMessage: 'This is View container !',
|
|
12
|
+
},
|
|
13
|
+
view: {
|
|
14
|
+
id: 'creatives.containers.View.view',
|
|
15
|
+
defaultMessage: 'View',
|
|
16
|
+
},
|
|
17
|
+
descriptionView: {
|
|
18
|
+
id: 'creatives.containers.View.descriptionView',
|
|
19
|
+
defaultMessage: 'Description of View',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -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
|
+
};
|
package/index.js
CHANGED
|
@@ -138,10 +138,8 @@ const FTPContainer = {FTP, FTPReducer, FTPSagas};
|
|
|
138
138
|
export {default as TagList} from './v2Containers/TagList/index';
|
|
139
139
|
export {default as TagListSaga} from './v2Containers/TagList/sagas';
|
|
140
140
|
export {default as TagListReducer} from './v2Containers/TagList/reducer';
|
|
141
|
-
|
|
142
|
-
export {default as
|
|
143
|
-
export {default as EmailPreview} from './v2Components/EmailPreview';
|
|
144
|
-
|
|
141
|
+
export {default as TemplatePreview} from './components/TemplatePreview';
|
|
142
|
+
export {default as EmailPreview} from './components/EmailPreview';
|
|
145
143
|
export {default as EmailPreviewV2} from './v2Components/EmailPreviewV2';
|
|
146
144
|
export {default as CallTaskPreview} from './v2Components/CallTaskPreview';
|
|
147
145
|
export {default as EmailMobilePreview} from './v2Components/EmailMobilePreview';
|