@capillarytech/creatives-library 2.0.81 → 2.0.83
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/CapTagList/index.js +24 -21
- package/components/CardGrid/index.js +10 -16
- package/components/Ckeditor/index.js +1 -2
- package/components/CustomPopOver/index.js +1 -1
- package/components/EmailPreview/index.js +2 -3
- package/components/FormBuilder/_formBuilder.scss +15 -8
- package/components/FormBuilder/index.js +192 -258
- package/components/Header/index.js +1 -4
- package/components/PreviewSideBar/_previewsidebar.scss +1 -1
- package/components/PreviewSideBar/index.js +5 -3
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +3 -2
- package/components/TemplatePreview/_templatePreview.scss +1 -1
- package/components/TemplatePreview/index.js +47 -47
- package/components/TemplatePreview/messages.js +1 -9
- package/containers/Assets/Gallery/index.js +1 -1
- package/containers/Email/index.js +1 -1
- package/containers/Login/components/LoginForm/index.js +1 -1
- package/containers/Templates/index.js +1 -1
- package/containers/WeChat/RichmediaTemplates/Create/index.js +1 -1
- package/package.json +2 -1
- package/v2Components/BreadCrumbs/index.js +65 -0
- package/v2Components/BreadCrumbs/messages.js +13 -0
- package/v2Components/BreadCrumbs/tests/index.test.js +10 -0
- package/v2Components/CallTaskPreview/_callTaskPreview.scss +17 -0
- package/v2Components/CallTaskPreview/images/Footer.png +0 -0
- package/v2Components/CallTaskPreview/images/Header.png +0 -0
- package/v2Components/CallTaskPreview/index.js +37 -0
- package/v2Components/CallTaskPreview/messages.js +13 -0
- package/v2Components/CallTaskPreview/tests/index.test.js +15 -0
- package/v2Components/CapTagList/index.js +232 -0
- package/v2Components/CapTagList/messages.js +25 -0
- package/{containers/TemplatesV2 → v2Components/CapTagList}/tests/index.test.js +2 -2
- package/v2Components/Card/_customCard.scss +27 -0
- package/v2Components/Card/index.js +78 -0
- package/{containers/WeChat → v2Components/Card}/tests/index.test.js +2 -2
- package/v2Components/CardGrid/index.js +77 -0
- package/{containers/EmailWrapper → v2Components/CardGrid}/tests/index.test.js +2 -2
- package/v2Components/Ckeditor/index.js +234 -0
- package/v2Components/Ckeditor/messages.js +13 -0
- package/{containers/ChannelTemplates → v2Components/Ckeditor}/tests/index.test.js +2 -2
- package/v2Components/CmsTemplatesComponent/index.js +33 -0
- package/v2Components/CmsTemplatesComponent/messages.js +17 -0
- package/v2Components/CmsTemplatesComponent/tests/index.test.js +10 -0
- package/v2Components/Component/index.js +29 -0
- package/v2Components/Component/tests/index.test.js +10 -0
- package/v2Components/CustomPopOver/index.js +82 -0
- package/v2Components/CustomPopOver/messages.js +13 -0
- package/v2Components/CustomPopOver/tests/index.test.js +10 -0
- package/v2Components/DateFilter/index.js +349 -0
- package/v2Components/DateFilter/messages.js +17 -0
- package/v2Components/DateFilter/tests/index.test.js +15 -0
- package/v2Components/DateRange/index.js +113 -0
- package/v2Components/DateRange/messages.js +13 -0
- package/v2Components/DateRange/tests/index.test.js +10 -0
- package/v2Components/Edmeditor/index.js +65 -0
- package/v2Components/Edmeditor/messages.js +13 -0
- package/v2Components/Edmeditor/tests/index.test.js +10 -0
- package/v2Components/EmailMobilePreview/index.js +129 -0
- package/v2Components/EmailMobilePreview/index.scss +55 -0
- package/v2Components/EmailPreview/_emailPreview.scss +119 -0
- package/v2Components/EmailPreview/index.js +106 -0
- package/v2Components/EmailPreview/messages.js +17 -0
- package/v2Components/EmailPreview/tests/index.test.js +10 -0
- package/v2Components/EmailPreviewV2/_emailPreviewV2.scss +69 -0
- package/v2Components/EmailPreviewV2/index.js +132 -0
- package/v2Components/EmailPreviewV2/messages.js +41 -0
- package/v2Components/EmailPreviewV2/tests/index.test.js +10 -0
- package/v2Components/Footer/index.js +27 -0
- package/v2Components/Footer/messages.js +13 -0
- package/v2Components/Footer/tests/index.test.js +10 -0
- package/v2Components/FormBuilder/_formBuilder.scss +78 -0
- package/v2Components/FormBuilder/index.js +3309 -0
- package/v2Components/FormBuilder/messages.js +13 -0
- package/v2Components/FormBuilder/tests/index.test.js +10 -0
- package/v2Components/Header/index.js +46 -0
- package/v2Components/Header/messages.js +25 -0
- package/v2Components/Header/tests/index.test.js +10 -0
- package/v2Components/ImagePreview/_imagePreview.scss +63 -0
- package/v2Components/ImagePreview/index.js +52 -0
- package/v2Components/ImagePreview/messages.js +13 -0
- package/v2Components/ImagePreview/tests/index.test.js +10 -0
- package/v2Components/MobilePushPreviewV2/index.js +120 -0
- package/v2Components/MobilePushPreviewV2/messages.js +13 -0
- package/{containers/MobilepushWrapper → v2Components/MobilePushPreviewV2}/tests/index.test.js +2 -2
- package/v2Components/NewCallTask/_newCallTask.scss +9 -0
- package/v2Components/NewCallTask/index.js +152 -0
- package/v2Components/NewCallTask/messages.js +29 -0
- package/{containers/CallTask → v2Components/NewCallTask}/tests/index.test.js +2 -2
- package/v2Components/PageHeader/_pageHeader.scss +22 -0
- package/v2Components/PageHeader/index.js +37 -0
- package/v2Components/PageHeader/messages.js +13 -0
- package/v2Components/PageHeader/tests/index.test.js +10 -0
- package/v2Components/Pagination/_pagination.scss +5 -0
- package/v2Components/Pagination/index.js +49 -0
- package/v2Components/Pagination/tests/index.test.js +10 -0
- package/v2Components/PreviewSideBar/_previewsidebar.scss +28 -0
- package/v2Components/PreviewSideBar/index.js +150 -0
- package/v2Components/PreviewSideBar/messages.js +33 -0
- package/v2Components/PreviewSideBar/tests/index.test.js +10 -0
- package/v2Components/Sidebar/_sidebar.scss +115 -0
- package/v2Components/Sidebar/index.js +208 -0
- package/v2Components/Sidebar/messages.js +21 -0
- package/v2Components/Sidebar/tests/index.test.js +10 -0
- package/v2Components/SlideBox/_slideBox.scss +63 -0
- package/v2Components/SlideBox/index.js +48 -0
- package/v2Components/SlideBox/tests/index.test.js +103 -0
- package/v2Components/SmsEditor/index.js +55 -0
- package/v2Components/SmsEditor/tests/index.test.js +10 -0
- package/v2Components/SmsTest/index.js +115 -0
- package/v2Components/SmsTest/messages.js +13 -0
- package/v2Components/SmsTest/tests/index.test.js +10 -0
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +42 -0
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +139 -0
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +21 -0
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +352 -0
- package/v2Components/TemplatePreview/assets/images/WECHAT_5x.png +0 -0
- package/v2Components/TemplatePreview/assets/images/androidPushMessage.svg +45 -0
- package/v2Components/TemplatePreview/assets/images/iPhonePushMessage.svg +135 -0
- package/v2Components/TemplatePreview/assets/images/mobile.svg +24 -0
- package/v2Components/TemplatePreview/assets/images/sms-body.png +0 -0
- package/v2Components/TemplatePreview/assets/images/sms-icon.png +0 -0
- package/v2Components/TemplatePreview/assets/images/sms_mobile.png +0 -0
- package/v2Components/TemplatePreview/assets/images/user-icon.svg +19 -0
- package/v2Components/TemplatePreview/assets/images/wechat-mobile.svg +78 -0
- package/v2Components/TemplatePreview/index.js +175 -0
- package/v2Components/TemplatePreview/messages.js +37 -0
- package/v2Components/TemplatePreview/tests/index.test.js +10 -0
- package/v2Components/Toastr/index.js +60 -0
- package/v2Components/Toastr/messages.js +13 -0
- package/v2Components/Toastr/tests/index.test.js +10 -0
- package/v2Components/ToastrMessage/index.js +110 -0
- package/v2Components/ToastrMessage/messages.js +13 -0
- package/v2Components/ToastrMessage/tests/index.test.js +10 -0
- package/v2Components/TopBar/_topbar.scss +46 -0
- package/v2Components/TopBar/assets/images/capillary_logo.png +0 -0
- package/v2Components/TopBar/index.js +113 -0
- package/v2Components/TopBar/messages.js +29 -0
- package/v2Components/TopBar/tests/index.test.js +10 -0
- package/v2Containers/Assets/Gallery/index.js +1 -1
- package/v2Containers/CallTask/index.js +1 -1
- package/v2Containers/Cap/index.js +2 -2
- package/v2Containers/CreativesContainer/SlideBoxContent.js +3 -3
- package/v2Containers/CreativesContainer/index.js +1 -0
- package/v2Containers/Dashboard/index.js +2 -2
- package/v2Containers/Ebill/index.js +2 -2
- package/v2Containers/Email/index.js +13 -13
- package/v2Containers/EmailWrapper/index.js +1 -1
- package/v2Containers/Line/Create/index.js +1 -1
- package/v2Containers/Line/Edit/index.js +1 -1
- package/v2Containers/Login/index.js +1 -1
- package/v2Containers/MobilePush/Create/index.js +26 -3
- package/v2Containers/MobilePush/Edit/index.js +32 -7
- package/v2Containers/MobilePush/initialSchema.js +2 -0
- package/v2Containers/Sms/Create/index.js +1 -1
- package/v2Containers/Sms/Edit/index.js +1 -1
- package/v2Containers/TagList/index.js +1 -1
- package/v2Containers/Templates/index.js +4 -4
- package/v2Containers/TestPage/index.js +1 -1
- package/v2Containers/WeChat/MapTemplates/index.js +3 -3
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +3 -3
- package/components/FormBuilder/test +0 -1845
- package/containers/CallTask/_callTask.scss +0 -5
- package/containers/CallTask/actions.js +0 -15
- package/containers/CallTask/constants.js +0 -7
- package/containers/CallTask/index.js +0 -141
- package/containers/CallTask/messages.js +0 -21
- package/containers/CallTask/reducer.js +0 -23
- package/containers/CallTask/sagas.js +0 -11
- package/containers/CallTask/selectors.js +0 -25
- package/containers/CallTask/tests/actions.test.js +0 -18
- package/containers/CallTask/tests/reducer.test.js +0 -9
- package/containers/CallTask/tests/sagas.test.js +0 -15
- package/containers/CallTask/tests/selectors.test.js +0 -10
- package/containers/ChannelTemplates/actions.js +0 -20
- package/containers/ChannelTemplates/constants.js +0 -8
- package/containers/ChannelTemplates/index.js +0 -48
- package/containers/ChannelTemplates/messages.js +0 -13
- package/containers/ChannelTemplates/reducer.js +0 -34
- package/containers/ChannelTemplates/sagas.js +0 -32
- package/containers/ChannelTemplates/selectors.js +0 -25
- package/containers/ChannelTemplates/tests/actions.test.js +0 -18
- package/containers/ChannelTemplates/tests/reducer.test.js +0 -9
- package/containers/ChannelTemplates/tests/sagas.test.js +0 -15
- package/containers/ChannelTemplates/tests/selectors.test.js +0 -10
- package/containers/CreativesContainer/SlideBoxContent.js +0 -248
- package/containers/CreativesContainer/SlideBoxFooter.js +0 -38
- package/containers/CreativesContainer/SlideBoxHeader.js +0 -65
- package/containers/CreativesContainer/actions.js +0 -27
- package/containers/CreativesContainer/constants.js +0 -13
- package/containers/CreativesContainer/index.js +0 -418
- package/containers/CreativesContainer/index.scss +0 -27
- package/containers/CreativesContainer/messages.js +0 -17
- package/containers/CreativesContainer/reducer.js +0 -29
- package/containers/CreativesContainer/sagas.js +0 -11
- package/containers/CreativesContainer/selectors.js +0 -30
- package/containers/CreativesContainer/tests/actions.test.js +0 -18
- package/containers/CreativesContainer/tests/index.test.js +0 -10
- package/containers/CreativesContainer/tests/reducer.test.js +0 -9
- package/containers/CreativesContainer/tests/sagas.test.js +0 -15
- package/containers/CreativesContainer/tests/selectors.test.js +0 -10
- package/containers/EmailWrapper/actions.js +0 -15
- package/containers/EmailWrapper/constants.js +0 -7
- package/containers/EmailWrapper/index.js +0 -238
- package/containers/EmailWrapper/messages.js +0 -57
- package/containers/EmailWrapper/reducer.js +0 -23
- package/containers/EmailWrapper/sagas.js +0 -11
- package/containers/EmailWrapper/selectors.js +0 -25
- package/containers/EmailWrapper/tests/actions.test.js +0 -18
- package/containers/EmailWrapper/tests/reducer.test.js +0 -9
- package/containers/EmailWrapper/tests/sagas.test.js +0 -15
- package/containers/EmailWrapper/tests/selectors.test.js +0 -10
- package/containers/MobilePush/commonMethods.js +0 -249
- package/containers/MobilePush/eventsMap.js +0 -127
- package/containers/MobilePush/initialSchema.js +0 -1739
- package/containers/MobilepushWrapper/_mobilepushWrapper.scss +0 -18
- package/containers/MobilepushWrapper/index.js +0 -97
- package/containers/MobilepushWrapper/messages.js +0 -25
- package/containers/TemplatesV2/_templatesV2.scss +0 -5
- package/containers/TemplatesV2/actions.js +0 -16
- package/containers/TemplatesV2/constants.js +0 -10
- package/containers/TemplatesV2/index.js +0 -207
- package/containers/TemplatesV2/messages.js +0 -29
- package/containers/TemplatesV2/selectors.js +0 -25
- package/containers/TemplatesV2/tests/actions.test.js +0 -18
- package/containers/TemplatesV2/tests/reducer.test.js +0 -9
- package/containers/TemplatesV2/tests/sagas.test.js +0 -15
- package/containers/TemplatesV2/tests/selectors.test.js +0 -10
- package/containers/WeChat/RichmediaTemplates/Create/testschema.js +0 -379
- package/containers/WeChat/_wechat.scss +0 -8
- package/containers/WeChat/actions.js +0 -52
- package/containers/WeChat/constants.js +0 -28
- package/containers/WeChat/index.js +0 -1635
- package/containers/WeChat/messages.js +0 -73
- package/containers/WeChat/reducer.js +0 -74
- package/containers/WeChat/sagas.js +0 -86
- package/containers/WeChat/selectors.js +0 -25
- package/containers/WeChat/tests/actions.test.js +0 -18
- package/containers/WeChat/tests/reducer.test.js +0 -9
- package/containers/WeChat/tests/sagas.test.js +0 -15
- package/containers/WeChat/tests/selectors.test.js +0 -10
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
.mobilepush-wrapper {
|
|
2
|
-
.ant-card-body {
|
|
3
|
-
padding: unset;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.ant-radio-group.cap-radioCard-v2 {
|
|
7
|
-
.ant-radio-button-wrapper{
|
|
8
|
-
width: 258px;
|
|
9
|
-
height: 258px;
|
|
10
|
-
}
|
|
11
|
-
.radio-card-header {
|
|
12
|
-
margin-top: 8px;
|
|
13
|
-
margin-left: 16px;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* MobilepushWrapper
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { connect } from 'react-redux';
|
|
9
|
-
import { FormattedMessage } from 'react-intl';
|
|
10
|
-
import {CapRadioCard, CapHeader} from '@capillarytech/cap-ui-library';
|
|
11
|
-
import {isEmpty} from 'lodash';
|
|
12
|
-
import MobilepushCreate from '../MobilePush/Create';
|
|
13
|
-
import WithImage from '../../assets/WithImage1';
|
|
14
|
-
import WithNoImage from '../../assets/NoImage1';
|
|
15
|
-
import messages from './messages';
|
|
16
|
-
import './_mobilepushWrapper.scss';
|
|
17
|
-
export class MobilepushWrapper extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
18
|
-
constructor(props) {
|
|
19
|
-
super(props);
|
|
20
|
-
this.modes = [
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
title: <FormattedMessage {...messages.image}/>,
|
|
24
|
-
content: <WithImage height="248px" width={"248px"}/>,
|
|
25
|
-
value: 'image',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
title: <FormattedMessage {...messages.text}/>,
|
|
29
|
-
content: <WithNoImage height="124px" width={"248px"}/>,
|
|
30
|
-
value: 'text',
|
|
31
|
-
// onClick: () => {
|
|
32
|
-
// this.emailUploader.current.click();
|
|
33
|
-
// },
|
|
34
|
-
},
|
|
35
|
-
];
|
|
36
|
-
}
|
|
37
|
-
onChange = (e) => {
|
|
38
|
-
this.props.onMobilepushModeChange( e.target.value );
|
|
39
|
-
};
|
|
40
|
-
render() {
|
|
41
|
-
const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode} = this.props;
|
|
42
|
-
const isShowMobilepushCreate = !isEmpty(mobilePushCreateMode);
|
|
43
|
-
return (
|
|
44
|
-
<div className="mobilepush-wrapper">
|
|
45
|
-
{step === "modeSelection" ?
|
|
46
|
-
<div>
|
|
47
|
-
<CapHeader size="small" title={<FormattedMessage {...messages.createMode}/>}/>
|
|
48
|
-
<CapRadioCard
|
|
49
|
-
panes={this.modes}
|
|
50
|
-
cardHeight={"286px"}
|
|
51
|
-
onChange={this.onChange}
|
|
52
|
-
selected={mobilePushCreateMode}
|
|
53
|
-
/>
|
|
54
|
-
</div>
|
|
55
|
-
:
|
|
56
|
-
<div>
|
|
57
|
-
{isShowMobilepushCreate && <MobilepushCreate
|
|
58
|
-
getFormLibraryData={getFormData}
|
|
59
|
-
setIsLoadingContent={setIsLoadingContent}
|
|
60
|
-
location={{
|
|
61
|
-
pathname: `/mobilepush/create/${mobilePushCreateMode}`,
|
|
62
|
-
query,
|
|
63
|
-
}}
|
|
64
|
-
params={{mode: mobilePushCreateMode}}
|
|
65
|
-
isFullMode={isFullMode}
|
|
66
|
-
isGetFormData={isGetFormData}
|
|
67
|
-
route={{ name: 'mobilepush' }}
|
|
68
|
-
/>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
</div>
|
|
73
|
-
}
|
|
74
|
-
</div>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
MobilepushWrapper.propTypes = {
|
|
80
|
-
onMobilepushModeChange: PropTypes.func,
|
|
81
|
-
mobilePushCreateMode: PropTypes.string,
|
|
82
|
-
step: PropTypes.string,
|
|
83
|
-
getFormData: PropTypes.string,
|
|
84
|
-
setIsLoadingContent: PropTypes.func,
|
|
85
|
-
isGetFormData: PropTypes.bool,
|
|
86
|
-
query: PropTypes.object,
|
|
87
|
-
isFullMode: PropTypes.bool,
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
function mapDispatchToProps(dispatch) {
|
|
92
|
-
return {
|
|
93
|
-
dispatch,
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export default connect(null, mapDispatchToProps)(MobilepushWrapper);
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* MobilepushWrapper Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the MobilepushWrapper component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
export default defineMessages({
|
|
9
|
-
header: {
|
|
10
|
-
id: 'app.containers.MobilepushWrapper.header',
|
|
11
|
-
defaultMessage: 'This is MobilepushWrapper container !',
|
|
12
|
-
},
|
|
13
|
-
image: {
|
|
14
|
-
id: 'app.containers.MobilepushWrapper.image',
|
|
15
|
-
defaultMessage: 'Image content',
|
|
16
|
-
},
|
|
17
|
-
text: {
|
|
18
|
-
id: 'app.containers.MobilepushWrapper.text',
|
|
19
|
-
defaultMessage: 'Text content',
|
|
20
|
-
},
|
|
21
|
-
createMode: {
|
|
22
|
-
id: 'app.containers.MobilepushWrapper.createMode',
|
|
23
|
-
defaultMessage: 'Which type of content you want to create?',
|
|
24
|
-
},
|
|
25
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import * as types from './constants';
|
|
3
|
-
|
|
4
|
-
export function defaultAction() {
|
|
5
|
-
return {
|
|
6
|
-
type: types.DEFAULT_ACTION,
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function getTemplates({channel, query}) {
|
|
11
|
-
return {
|
|
12
|
-
type: types.GET_TEMPLATES_REQUEST,
|
|
13
|
-
channel,
|
|
14
|
-
query,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* TemplatesV2 constants
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export const DEFAULT_ACTION = 'app/TemplatesV2/DEFAULT_ACTION';
|
|
8
|
-
export const GET_TEMPLATES_REQUEST = 'app/TemplatesV2/GET_TEMPLATES_REQUEST';
|
|
9
|
-
export const GET_TEMPLATES_SUCESS = 'app/TemplatesV2/GET_TEMPLATES_SUCESS';
|
|
10
|
-
export const GET_TEMPLATES_FAILURE = 'app/TemplatesV2/GET_TEMPLATES_FAILURE';
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* TemplatesV2
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import { connect } from 'react-redux';
|
|
11
|
-
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
12
|
-
import { createStructuredSelector } from 'reselect';
|
|
13
|
-
import { bindActionCreators } from 'redux';
|
|
14
|
-
import styled from 'styled-components';
|
|
15
|
-
import { CapTab, CapCustomCard, CapButton, CapHeader, CapSpin, CapIcon } from '@capillarytech/cap-ui-library';
|
|
16
|
-
import { find, get } from 'lodash';
|
|
17
|
-
import Helmet from 'react-helmet';
|
|
18
|
-
|
|
19
|
-
import {CAP_SPACE_24, CAP_SPACE_16} from '@capillarytech/cap-ui-library/styled/variables';
|
|
20
|
-
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
21
|
-
import { makeSelectTemplates, makeSelectTemplatesResponse } from '../Templates/selectors';
|
|
22
|
-
import messages from './messages';
|
|
23
|
-
import * as actions from './actions';
|
|
24
|
-
import Templates from '../Templates';
|
|
25
|
-
import CallTask from '../CallTask';
|
|
26
|
-
import './_templatesV2.scss';
|
|
27
|
-
|
|
28
|
-
const {CapCustomCardList} = CapCustomCard;
|
|
29
|
-
|
|
30
|
-
const ComponentWrapper = styled.div`
|
|
31
|
-
${(props) => props.isFullMode ? `
|
|
32
|
-
max-width: 1140px;
|
|
33
|
-
margin: 0 auto;
|
|
34
|
-
width: 100%;
|
|
35
|
-
padding: ${CAP_SPACE_24} 0;
|
|
36
|
-
.ant-tabs-content{
|
|
37
|
-
margin-top: ${CAP_SPACE_16}
|
|
38
|
-
}
|
|
39
|
-
` : `.cap-tab-v2 {
|
|
40
|
-
height: calc(100vh - 118px);
|
|
41
|
-
} `}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
`;
|
|
45
|
-
const MarginTop = styled.div`
|
|
46
|
-
${(props) => props.isFullMode ? `margin-top: ${CAP_SPACE_24}` : ``
|
|
47
|
-
}
|
|
48
|
-
`;
|
|
49
|
-
export class TemplatesV2 extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
50
|
-
constructor(props) {
|
|
51
|
-
super(props);
|
|
52
|
-
const defaultChannel = get(this, 'props.channel') || get(this, 'props.params.channel') || 'sms';
|
|
53
|
-
const defaultPanes = [
|
|
54
|
-
{content: <div></div>, tab: 'Sms', key: 'sms'},
|
|
55
|
-
{content: <div></div>, tab: 'Email', key: 'email'},
|
|
56
|
-
// {content: this.getTemplatesComponent('wechat'), tab: 'Wechat', key: 'wechat'},
|
|
57
|
-
{content: <div></div>, tab: 'Mpush', key: 'mobilepush'},
|
|
58
|
-
];
|
|
59
|
-
if (!props.isFullMode) {
|
|
60
|
-
defaultPanes.push({content: <div></div>, tab: 'Call Task', key: 'call_task'});
|
|
61
|
-
}
|
|
62
|
-
const panes = this.setChannelContent(defaultChannel, defaultPanes);
|
|
63
|
-
this.state = {
|
|
64
|
-
selectedChannel: defaultChannel,
|
|
65
|
-
panes,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
componentWillReceiveProps(nextProps) {
|
|
69
|
-
if (this.props.channel !== nextProps.channel) {
|
|
70
|
-
const panes = this.setChannelContent(nextProps.channel, this.state.panes);
|
|
71
|
-
this.setState({selectedChannel: nextProps.channel, panes });
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
getTemplateDataForGrid = ({templates, handlers, filterContent, channel, isLoading, loadingTip}) => {
|
|
75
|
-
const currentChannel = channel.toUpperCase();
|
|
76
|
-
const cardDataList = templates.map((template) => {
|
|
77
|
-
const templateData =
|
|
78
|
-
{
|
|
79
|
-
key: `${currentChannel}-card-${template.name}`,
|
|
80
|
-
title: <span title={template.name} >{template.name}</span>,
|
|
81
|
-
extra: [<CapIcon type="eye" onClick={() => { if (this.props.isFullMode) { handlers.handlePreviewClick(template); } else { this.props.handlePeviewTemplate(template); } }} />],
|
|
82
|
-
hoverOption: <CapButton onClick={(e) => handlers.handleEditClick(e, template._id)}>{this.props.intl.formatMessage(this.props.isFullMode ? messages.edit : messages.select)}</CapButton>,
|
|
83
|
-
};
|
|
84
|
-
if (currentChannel === "SMS") {
|
|
85
|
-
templateData.content = template.versions.base['sms-editor'];
|
|
86
|
-
} else if (currentChannel === "EMAIL") {
|
|
87
|
-
templateData.url = template.versions.base.preview_http_url;
|
|
88
|
-
}
|
|
89
|
-
return templateData;
|
|
90
|
-
});
|
|
91
|
-
return (<div>
|
|
92
|
-
{filterContent}
|
|
93
|
-
<CapSpin spinning={isLoading} tip={loadingTip}>
|
|
94
|
-
<div className="pagination-container">
|
|
95
|
-
<CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={currentChannel} />
|
|
96
|
-
</div>
|
|
97
|
-
</CapSpin>
|
|
98
|
-
|
|
99
|
-
</div>);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
getCallTaskComponent = () => <CallTask onCreateNew={this.props.createNew} onCallTaskSubmit={this.props.onCallTaskSubmit}/>
|
|
103
|
-
|
|
104
|
-
getTemplatesComponent(channel) {
|
|
105
|
-
// const templates = this.props.Templates[`${channel}Templates`];
|
|
106
|
-
let query = {};
|
|
107
|
-
if (!this.props.isFullMode) {
|
|
108
|
-
query = {type: 'embedded', module: 'library'};
|
|
109
|
-
}
|
|
110
|
-
return (channel === 'call_task' ?
|
|
111
|
-
this.getCallTaskComponent() :
|
|
112
|
-
<Templates
|
|
113
|
-
key={channel}
|
|
114
|
-
location={{pathname: `/${channel}`, search: '', query}}
|
|
115
|
-
route={{name: channel}}
|
|
116
|
-
router={this.props.router}
|
|
117
|
-
isFullMode={this.props.isFullMode}
|
|
118
|
-
createNew={this.props.createNew}
|
|
119
|
-
onSelectTemplate={(id) => this.props.onSelectTemplate(this.selectTemplate(id))}
|
|
120
|
-
renderNewCardGrid={this.getTemplateDataForGrid}
|
|
121
|
-
handlePeviewTemplate={this.props.handlePeviewTemplate}
|
|
122
|
-
/>);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
setChannelContent = (selectedChannel, argsPanes) => {
|
|
126
|
-
const panes = argsPanes.map((p) => {
|
|
127
|
-
const pane = p;
|
|
128
|
-
if (pane.key === selectedChannel) {
|
|
129
|
-
let channel = selectedChannel;
|
|
130
|
-
if (channel === "mpush") {
|
|
131
|
-
channel = "mobilepush";
|
|
132
|
-
}
|
|
133
|
-
pane.content = this.getTemplatesComponent(channel);
|
|
134
|
-
return pane;
|
|
135
|
-
}
|
|
136
|
-
return {...pane, content: <div></div>};
|
|
137
|
-
});
|
|
138
|
-
return panes;
|
|
139
|
-
}
|
|
140
|
-
channelChange = (selectedChannel) => {
|
|
141
|
-
const panes = this.setChannelContent(selectedChannel, this.state.panes);
|
|
142
|
-
this.setState({panes, selectedChannel}, () => { if (!this.props.isFullMode) this.props.onChannelChange(selectedChannel); });
|
|
143
|
-
}
|
|
144
|
-
selectTemplate = (id) => find(this.props.TemplatesList, {_id: id})
|
|
145
|
-
|
|
146
|
-
isLoading() {
|
|
147
|
-
return this.props.Templates.loadingTemplates;
|
|
148
|
-
}
|
|
149
|
-
render() {
|
|
150
|
-
const {isFullMode} = this.props;
|
|
151
|
-
return (
|
|
152
|
-
<div>
|
|
153
|
-
{isFullMode && <Helmet
|
|
154
|
-
title={this.props.intl.formatMessage(messages.creatives)}
|
|
155
|
-
meta={[
|
|
156
|
-
{ name: 'description', content: this.props.intl.formatMessage(messages.creativesDesc) },
|
|
157
|
-
]}
|
|
158
|
-
/>}
|
|
159
|
-
<ComponentWrapper isFullMode={isFullMode}>
|
|
160
|
-
|
|
161
|
-
{isFullMode && <CapHeader title={<FormattedMessage {...messages.creatives}/>} description={<FormattedMessage {...messages.creativesDesc}/>}/>}
|
|
162
|
-
<MarginTop isFullMode={isFullMode}>
|
|
163
|
-
<CapTab
|
|
164
|
-
panes={this.state.panes}
|
|
165
|
-
onChange={this.channelChange}
|
|
166
|
-
activeKey={this.state.selectedChannel}
|
|
167
|
-
defaultActiveKey={this.state.selectedChannel}/>
|
|
168
|
-
</MarginTop>
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
</ComponentWrapper>
|
|
172
|
-
</div>
|
|
173
|
-
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
TemplatesV2.propTypes = {
|
|
179
|
-
router: PropTypes.object,
|
|
180
|
-
isFullMode: PropTypes.bool,
|
|
181
|
-
onSelectTemplate: PropTypes.func,
|
|
182
|
-
createNew: PropTypes.func,
|
|
183
|
-
channel: PropTypes.string,
|
|
184
|
-
Templates: PropTypes.object,
|
|
185
|
-
TemplatesList: PropTypes.arrayOf(PropTypes.object),
|
|
186
|
-
handlePeviewTemplate: PropTypes.func,
|
|
187
|
-
onCallTaskSubmit: PropTypes.func,
|
|
188
|
-
intl: intlShape,
|
|
189
|
-
onChannelChange: PropTypes.func,
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
TemplatesV2.defaultProps = {
|
|
193
|
-
isFullMode: true,
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
const mapStateToProps = createStructuredSelector({
|
|
197
|
-
Templates: makeSelectTemplates(),
|
|
198
|
-
TemplatesList: makeSelectTemplatesResponse(),
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
function mapDispatchToProps(dispatch) {
|
|
202
|
-
return {
|
|
203
|
-
actions: bindActionCreators(actions, dispatch),
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(TemplatesV2)));
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* TemplatesV2 Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the TemplatesV2 component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
export default defineMessages({
|
|
9
|
-
header: {
|
|
10
|
-
id: 'app.containers.TemplatesV2.header',
|
|
11
|
-
defaultMessage: 'This is TemplatesV2 container !',
|
|
12
|
-
},
|
|
13
|
-
select: {
|
|
14
|
-
id: 'app.containers.TemplatesV2.select',
|
|
15
|
-
defaultMessage: 'Select',
|
|
16
|
-
},
|
|
17
|
-
edit: {
|
|
18
|
-
id: 'app.containers.TemplatesV2.edit',
|
|
19
|
-
defaultMessage: 'Edit',
|
|
20
|
-
},
|
|
21
|
-
creatives: {
|
|
22
|
-
id: 'app.containers.TemplatesV2.creatives',
|
|
23
|
-
defaultMessage: 'Creatives',
|
|
24
|
-
},
|
|
25
|
-
creativesDesc: {
|
|
26
|
-
id: 'app.containers.TemplatesV2.creativesDesc',
|
|
27
|
-
defaultMessage: 'These are pre-built templates which you could use to customize your message content.',
|
|
28
|
-
},
|
|
29
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createSelector } from 'reselect';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Direct selector to the templatesV2 state domain
|
|
5
|
-
*/
|
|
6
|
-
const selectTemplatesV2Domain = () => (state) => state.get('templatesV2');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Other specific selectors
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Default selector used by TemplatesV2
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const makeSelectTemplatesV2 = () => createSelector(
|
|
18
|
-
selectTemplatesV2Domain(),
|
|
19
|
-
(substate) => substate.toJS()
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export default makeSelectTemplatesV2;
|
|
23
|
-
export {
|
|
24
|
-
selectTemplatesV2Domain,
|
|
25
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
defaultAction,
|
|
4
|
-
} from '../actions';
|
|
5
|
-
import {
|
|
6
|
-
DEFAULT_ACTION,
|
|
7
|
-
} from '../constants';
|
|
8
|
-
|
|
9
|
-
describe('TemplatesV2 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
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// import { fromJS } from 'immutable';
|
|
2
|
-
// import { makeSelectTemplatesV2Domain } from '../selectors';
|
|
3
|
-
|
|
4
|
-
// const selector = makeSelectTemplatesV2Domain();
|
|
5
|
-
|
|
6
|
-
describe('makeSelectTemplatesV2Domain', () => {
|
|
7
|
-
it('Expect to have unit tests specified', () => {
|
|
8
|
-
expect(true).toEqual(false);
|
|
9
|
-
});
|
|
10
|
-
});
|