@capillarytech/creatives-library 2.0.84 → 2.0.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app.js +9 -2
- package/config/app.js +4 -4
- package/config/path.js +1 -0
- package/index.js +4 -4
- package/package.json +2 -2
- package/routes.js +5 -0
- package/v2Components/EmailPreviewV2/index.js +3 -3
- package/v2Components/NavigationBar/index.js +235 -0
- package/v2Components/NavigationBar/messages.js +20 -0
- package/v2Components/NavigationBar/tests/index.test.js +11 -0
- package/v2Components/TopBar/index.js +63 -106
- package/v2Components/TopBar/messages.js +8 -0
- package/v2Containers/Cap/actions.js +12 -0
- package/v2Containers/Cap/constants.js +10 -0
- package/v2Containers/Cap/index.js +26 -142
- package/v2Containers/Cap/reducer.js +14 -0
- package/v2Containers/Cap/sagas.js +24 -0
- package/assets/android-message-gui-2.svg +0 -55
- package/components/CallTaskPreview/_callTaskPreview.scss +0 -17
- package/components/CallTaskPreview/images/Footer.png +0 -0
- package/components/CallTaskPreview/images/Header.png +0 -0
- package/components/CallTaskPreview/index.js +0 -37
- package/components/CallTaskPreview/messages.js +0 -13
- package/components/CallTaskPreview/tests/index.test.js +0 -15
- package/components/CmsTemplatesComponent/index.js +0 -33
- package/components/CmsTemplatesComponent/messages.js +0 -17
- package/components/CmsTemplatesComponent/tests/index.test.js +0 -10
- package/components/EmailMobilePreview/index.js +0 -129
- package/components/EmailMobilePreview/index.scss +0 -55
- package/components/EmailPreviewV2/_emailPreviewV2.scss +0 -69
- package/components/EmailPreviewV2/index.js +0 -132
- package/components/EmailPreviewV2/messages.js +0 -41
- package/components/EmailPreviewV2/tests/index.test.js +0 -10
- package/components/MobilePushPreviewV2/index.js +0 -120
- package/components/MobilePushPreviewV2/messages.js +0 -13
- package/components/MobilePushPreviewV2/tests/index.test.js +0 -10
- package/components/NewCallTask/_newCallTask.scss +0 -9
- package/components/NewCallTask/index.js +0 -152
- package/components/NewCallTask/messages.js +0 -29
- package/components/NewCallTask/tests/index.test.js +0 -10
- package/components/SmsPreviewV2/_smsPreviewV2.scss +0 -353
- package/components/SmsPreviewV2/index.js +0 -69
- package/components/SmsPreviewV2/messages.js +0 -13
- package/components/SmsPreviewV2/tests/index.test.js +0 -10
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
$classPrefix: email-mobile-preview-container;
|
|
2
|
-
.#{$classPrefix}{
|
|
3
|
-
#emailPreivew-container {
|
|
4
|
-
position: relative;
|
|
5
|
-
// padding: 0 24px 0 24px;
|
|
6
|
-
overflow-y: auto;
|
|
7
|
-
// font-family: 'proxima-nova';
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
#emailPreivew-content-wrapper{
|
|
10
|
-
width: 100%;
|
|
11
|
-
height: 90%;
|
|
12
|
-
// display: table;
|
|
13
|
-
|
|
14
|
-
#emailPreivew-content {
|
|
15
|
-
.device-wrapper {
|
|
16
|
-
display: inline-flex;
|
|
17
|
-
margin-bottom: 8px;
|
|
18
|
-
margin-top: 16px;
|
|
19
|
-
.device-name {
|
|
20
|
-
padding: 6px 24px;
|
|
21
|
-
background: #E6F0FB;
|
|
22
|
-
border: 2px solid #E6F0FB;
|
|
23
|
-
font-family: "open-sans";
|
|
24
|
-
line-height: 20px;
|
|
25
|
-
font-size: 14px;
|
|
26
|
-
color: #4E92E5;
|
|
27
|
-
cursor: pointer;
|
|
28
|
-
}
|
|
29
|
-
.active {
|
|
30
|
-
background: #FFFFFF !important;
|
|
31
|
-
border: 2px solid #E6F0FB;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
.email-preview-container{
|
|
36
|
-
|
|
37
|
-
.mobile-message-container {
|
|
38
|
-
position: absolute;
|
|
39
|
-
top: 10.3%;
|
|
40
|
-
left: 24%;
|
|
41
|
-
overflow: auto;
|
|
42
|
-
display: -webkit-box;
|
|
43
|
-
display: -ms-flexbox;
|
|
44
|
-
display: flex;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
padding: 0 0px 0 24px;
|
|
48
|
-
// display: table-cell;
|
|
49
|
-
// vertical-align: middle;
|
|
50
|
-
text-align: center;
|
|
51
|
-
margin-bottom: 36px;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
$classPrefix: email-preview-v2;
|
|
2
|
-
.#{$classPrefix}{
|
|
3
|
-
#emailPreivew-container {
|
|
4
|
-
position: relative;
|
|
5
|
-
// padding: 0 24px 0 24px;
|
|
6
|
-
overflow-y: auto;
|
|
7
|
-
// font-family: 'proxima-nova';
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
|
|
10
|
-
#email-iframe {
|
|
11
|
-
width: -webkit-fill-available;
|
|
12
|
-
}
|
|
13
|
-
#emailPreivew-content-wrapper{
|
|
14
|
-
width: 100%;
|
|
15
|
-
height: 90%;
|
|
16
|
-
// display: table;
|
|
17
|
-
|
|
18
|
-
#emailPreivew-content {
|
|
19
|
-
.device-wrapper {
|
|
20
|
-
display: inline-flex;
|
|
21
|
-
margin-bottom: 8px;
|
|
22
|
-
margin-top: 16px;
|
|
23
|
-
.device-name {
|
|
24
|
-
padding: 6px 24px;
|
|
25
|
-
background: #E6F0FB;
|
|
26
|
-
border: 2px solid #E6F0FB;
|
|
27
|
-
font-family: "open-sans";
|
|
28
|
-
line-height: 20px;
|
|
29
|
-
font-size: 14px;
|
|
30
|
-
color: #4E92E5;
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
}
|
|
33
|
-
.active {
|
|
34
|
-
background: #FFFFFF !important;
|
|
35
|
-
border: 2px solid #E6F0FB;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
.email-preview-container{
|
|
40
|
-
.tablet-message-container {
|
|
41
|
-
position: absolute;
|
|
42
|
-
top: 9%;
|
|
43
|
-
left: 10%;
|
|
44
|
-
width: 100%;
|
|
45
|
-
height: 100%;
|
|
46
|
-
overflow: auto;
|
|
47
|
-
display: -webkit-box;
|
|
48
|
-
display: -ms-flexbox;
|
|
49
|
-
display: flex;
|
|
50
|
-
}
|
|
51
|
-
.mobile-message-container {
|
|
52
|
-
position: absolute;
|
|
53
|
-
top: 10.3%;
|
|
54
|
-
left: 14%;
|
|
55
|
-
overflow: auto;
|
|
56
|
-
display: -webkit-box;
|
|
57
|
-
display: -ms-flexbox;
|
|
58
|
-
display: flex;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
padding: 0 0px 0 24px;
|
|
62
|
-
// display: table-cell;
|
|
63
|
-
// vertical-align: middle;
|
|
64
|
-
text-align: center;
|
|
65
|
-
margin-bottom: 36px;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* EmailPreviewV2
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
// import styled from 'styled-components';
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
|
-
import { FormattedMessage } from 'react-intl';
|
|
11
|
-
import {isEmpty} from 'lodash';
|
|
12
|
-
import { connect } from 'react-redux';
|
|
13
|
-
import { bindActionCreators } from 'redux';
|
|
14
|
-
import { createStructuredSelector } from 'reselect';
|
|
15
|
-
import { CapSpin } from '@capillarytech/cap-ui-library';
|
|
16
|
-
import moment from 'moment';
|
|
17
|
-
import messages from './messages';
|
|
18
|
-
import './_emailPreviewV2.scss';
|
|
19
|
-
import tabletBody from '../../assets/iPad.svg';
|
|
20
|
-
import mobileBody from '../../assets/mobile.png';
|
|
21
|
-
|
|
22
|
-
import {selectTemplateContent} from '../../containers/Templates/selectors';
|
|
23
|
-
import * as templateActions from '../../containers/Templates/actions';
|
|
24
|
-
|
|
25
|
-
const deviceAspectRatio = {
|
|
26
|
-
desktop: {
|
|
27
|
-
height: "500",
|
|
28
|
-
width: "1024",
|
|
29
|
-
},
|
|
30
|
-
tablet: {
|
|
31
|
-
height: "600",
|
|
32
|
-
width: "520",
|
|
33
|
-
},
|
|
34
|
-
mobile: {
|
|
35
|
-
height: "600",
|
|
36
|
-
width: "320",
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
const devices = {
|
|
40
|
-
mobile: 'mobile',
|
|
41
|
-
desktop: 'desktop',
|
|
42
|
-
tablet: 'tablet',
|
|
43
|
-
};
|
|
44
|
-
class EmailPreviewV2 extends React.Component {
|
|
45
|
-
constructor(props) {
|
|
46
|
-
super(props);
|
|
47
|
-
this.state = {
|
|
48
|
-
currentDevice: props.device || devices.desktop,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
componentWillMount() {
|
|
52
|
-
const {templateData, templateContent} = this.props;
|
|
53
|
-
if (isEmpty(templateContent) && !isEmpty(templateData) && templateData._id) { // templateData: comes from templates list email preview
|
|
54
|
-
this.props.templateActions.getTemplateDetails(templateData._id); // templateContent: html data to be shown in iframe
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
componentWillUnmount() {
|
|
58
|
-
this.props.templateActions.resetTemplateData();
|
|
59
|
-
}
|
|
60
|
-
changePreviewDevice = (ev) => {
|
|
61
|
-
this.setState({currentDevice: ev.currentTarget.id});
|
|
62
|
-
}
|
|
63
|
-
render() {
|
|
64
|
-
let messageContainerName = '';
|
|
65
|
-
const {currentDevice} = this.state;
|
|
66
|
-
const {templateContent} = this.props;
|
|
67
|
-
|
|
68
|
-
if (currentDevice === devices.tablet) {
|
|
69
|
-
messageContainerName = 'tablet-message-container';
|
|
70
|
-
} else if (currentDevice === devices.mobile) {
|
|
71
|
-
messageContainerName = 'mobile-message-container';
|
|
72
|
-
}
|
|
73
|
-
return (
|
|
74
|
-
<div className="email-preview-v2">
|
|
75
|
-
<CapSpin spinning={!templateContent}>
|
|
76
|
-
<div id="emailPreivew-container">
|
|
77
|
-
<div id="emailPreivew-content-wrapper">
|
|
78
|
-
<div id="emailPreivew-content">
|
|
79
|
-
<div className="device-wrapper">
|
|
80
|
-
<div id={devices.desktop} onClick={this.changePreviewDevice} className={`device-name ${currentDevice === devices.desktop ? 'active' : ''}`}><FormattedMessage {...messages.desktop}/></div>
|
|
81
|
-
<div id={devices.tablet} onClick={this.changePreviewDevice} className={`device-name ${currentDevice === devices.tablet ? 'active' : ''}`}><FormattedMessage {...messages.tablet}/></div>
|
|
82
|
-
<div id={devices.mobile} onClick={this.changePreviewDevice} className={`device-name ${currentDevice === devices.mobile ? 'active' : ''}`}><FormattedMessage {...messages.mobile}/></div>
|
|
83
|
-
</div>
|
|
84
|
-
<div className="email-preview-container">
|
|
85
|
-
<div className={currentDevice === devices.desktop ? '' : "shell align-center"}>
|
|
86
|
-
{currentDevice === devices.tablet ?
|
|
87
|
-
<img src={tabletBody} alt="capillary" width="520" /> : ''}
|
|
88
|
-
{currentDevice === devices.mobile ?
|
|
89
|
-
<img src={mobileBody} alt="capillary" width="85%" /> : ''}
|
|
90
|
-
<div className={messageContainerName}>
|
|
91
|
-
<iframe id="email-iframe" srcDoc={templateContent} {...deviceAspectRatio[currentDevice]} >
|
|
92
|
-
<p><FormattedMessage {...messages.noIframeSupport}/></p>
|
|
93
|
-
</iframe>
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
</div>
|
|
102
|
-
{this.props.templateData &&
|
|
103
|
-
[
|
|
104
|
-
<p className="preview-info" key="lastModified"><FormattedMessage {...messages.lastModified} />: {moment(this.props.templateData.updatedAt).format('MM-DD-YYYY')}</p>,
|
|
105
|
-
<p style={{marginBottom: '8px'}} key="uploadedBy" className="preview-info"><FormattedMessage {...messages.uploadedBy} /> : {this.props.templateData.updatedByName}</p>,
|
|
106
|
-
]
|
|
107
|
-
}
|
|
108
|
-
</CapSpin>
|
|
109
|
-
</div>
|
|
110
|
-
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
EmailPreviewV2.propTypes = {
|
|
117
|
-
templateContent: PropTypes.string,
|
|
118
|
-
templateData: PropTypes.object,
|
|
119
|
-
templateActions: PropTypes.object,
|
|
120
|
-
device: PropTypes.string,
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const mapStateToProps = (state, props) => createStructuredSelector({
|
|
124
|
-
templateContent: props.templateData ? selectTemplateContent() : () => props.templateContent, // when props has templateContent that means preview with content
|
|
125
|
-
});
|
|
126
|
-
function mapDispatchToProps(dispatch) {
|
|
127
|
-
return {
|
|
128
|
-
templateActions: bindActionCreators(templateActions, dispatch),
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export default connect(mapStateToProps, mapDispatchToProps)(EmailPreviewV2);
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* EmailPreviewV2 Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the EmailPreviewV2 component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
export default defineMessages({
|
|
9
|
-
header: {
|
|
10
|
-
id: 'app.components.EmailPreviewV2.header',
|
|
11
|
-
defaultMessage: 'This is the EmailPreviewV2 component !',
|
|
12
|
-
},
|
|
13
|
-
desktop: {
|
|
14
|
-
id: 'app.components.EmailPreviewV2.desktop',
|
|
15
|
-
defaultMessage: 'Desktop',
|
|
16
|
-
},
|
|
17
|
-
tablet: {
|
|
18
|
-
id: 'app.components.EmailPreviewV2.tablet',
|
|
19
|
-
defaultMessage: 'Tablet',
|
|
20
|
-
},
|
|
21
|
-
mobile: {
|
|
22
|
-
id: 'app.components.EmailPreviewV2.mobile',
|
|
23
|
-
defaultMessage: 'Mobile',
|
|
24
|
-
},
|
|
25
|
-
noIframeSupport: {
|
|
26
|
-
id: 'app.components.EmailPreviewV2.noIframeSupport',
|
|
27
|
-
defaultMessage: 'Your browser does not support iframes.',
|
|
28
|
-
},
|
|
29
|
-
showAllDevices: {
|
|
30
|
-
id: 'app.components.EmailPreviewV2.showAllDevices',
|
|
31
|
-
defaultMessage: 'Show all devices',
|
|
32
|
-
},
|
|
33
|
-
lastModified: {
|
|
34
|
-
id: 'app.components.PreviewSideBar.lastModified',
|
|
35
|
-
defaultMessage: 'Last Modified On',
|
|
36
|
-
},
|
|
37
|
-
uploadedBy: {
|
|
38
|
-
id: 'app.components.PreviewSideBar.uploadedBy',
|
|
39
|
-
defaultMessage: 'Last Modified By',
|
|
40
|
-
},
|
|
41
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { shallow } from 'enzyme';
|
|
3
|
-
import EmailPreviewV2 from '../index';
|
|
4
|
-
|
|
5
|
-
describe('<EmailPreviewV2 />', () => {
|
|
6
|
-
it('<EmailPreviewV2 /> without the templateData', () => {
|
|
7
|
-
const compoent = shallow(<EmailPreviewV2 templateData={{_id: 'test'}}/>);
|
|
8
|
-
expect(compoent).toMatchSnapshot();
|
|
9
|
-
});
|
|
10
|
-
});
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* PreviewSideBar
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import { CapButton } from '@capillarytech/cap-ui-library';
|
|
11
|
-
// import styled from 'styled-components';
|
|
12
|
-
|
|
13
|
-
import { FormattedMessage } from 'react-intl';
|
|
14
|
-
import { Button } from 'antd';
|
|
15
|
-
import { get, map, isEmpty} from 'lodash';
|
|
16
|
-
import TemplatePreview from '../TemplatePreview';
|
|
17
|
-
import '../PreviewSideBar/_previewsidebar.scss';
|
|
18
|
-
import messages from './messages';
|
|
19
|
-
const ButtonGroup = Button.Group;
|
|
20
|
-
|
|
21
|
-
class MobilePushPreviewV2 extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
22
|
-
constructor(props) {
|
|
23
|
-
super(props);
|
|
24
|
-
this.goToEdit = this.goToEdit.bind(this);
|
|
25
|
-
this.goToDuplicate = this.goToDuplicate.bind(this);
|
|
26
|
-
this.changeDevice = this.changeDevice.bind(this);
|
|
27
|
-
const hasAndroid = get(props, 'templateData.versions.base.ANDROID') || get(props, 'templateData.androidContent');
|
|
28
|
-
const hasIos = get(props, 'templateData.versions.base.IOS') || get(props, 'templateData.iosContent');
|
|
29
|
-
let device = "android";
|
|
30
|
-
if (hasAndroid) {
|
|
31
|
-
device = 'android';
|
|
32
|
-
} else if (hasIos) {
|
|
33
|
-
device = 'ios';
|
|
34
|
-
}
|
|
35
|
-
this.state = {
|
|
36
|
-
device,
|
|
37
|
-
content: this.setContent(props.templateData, device),
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
setContent = (templateData, device) => {
|
|
42
|
-
const androidContent = get(templateData, 'versions.base.ANDROID') || get(templateData, 'androidContent');
|
|
43
|
-
const iosContent = get(templateData, 'versions.base.IOS') || get(templateData, 'iosContent');
|
|
44
|
-
|
|
45
|
-
const data = device === "android" ? androidContent : iosContent;
|
|
46
|
-
const content = {
|
|
47
|
-
header: data.title,
|
|
48
|
-
bodyText: data.message,
|
|
49
|
-
bodyImage: data.expandableDetails && data.expandableDetails.image,
|
|
50
|
-
actions: [],
|
|
51
|
-
appName: templateData.appName,
|
|
52
|
-
};
|
|
53
|
-
if (data.expandableDetails && data.expandableDetails.ctas && data.expandableDetails.ctas.length) {
|
|
54
|
-
if (device === "android" ) {
|
|
55
|
-
content.actions = map(data.expandableDetails.ctas, (cta) => ({label: cta.actionText}));
|
|
56
|
-
} else {
|
|
57
|
-
content.actions = [{label: data.expandableDetails.ctas[0].actionLabel}, {label: data.expandableDetails.ctas[0].actionLabel2}];
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return content;
|
|
61
|
-
}
|
|
62
|
-
goToDuplicate() {
|
|
63
|
-
this.props.onDuplicateClick(this.props.templateData);
|
|
64
|
-
this.props.handleClose();
|
|
65
|
-
}
|
|
66
|
-
changeDevice(ev) {
|
|
67
|
-
const device = ev.target.value;
|
|
68
|
-
const content = this.setContent(this.props.templateData, device);
|
|
69
|
-
this.setState({device, content });
|
|
70
|
-
}
|
|
71
|
-
goToEdit(e, path) {
|
|
72
|
-
this.props.onEditClick(e, this.props.templateData._id, this.props.templateData.modeType, path);
|
|
73
|
-
}
|
|
74
|
-
render() {
|
|
75
|
-
const {templateData, channel} = this.props;
|
|
76
|
-
|
|
77
|
-
const hasAndroid = get(templateData, 'versions.base.ANDROID') || get(templateData, 'androidContent');
|
|
78
|
-
const hasIos = get(templateData, 'versions.base.IOS') || get(templateData, 'iosContent');
|
|
79
|
-
|
|
80
|
-
const {device, content} = this.state;
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
|
|
84
|
-
<div>
|
|
85
|
-
<div className="devices">
|
|
86
|
-
{!isEmpty(templateData) && hasAndroid && hasIos &&
|
|
87
|
-
<ButtonGroup onClick={this.changeDevice}>
|
|
88
|
-
<CapButton type={device === "android" ? "primary" : "secondary"} value={"android"}>Android</CapButton>
|
|
89
|
-
<CapButton type={device === "iphone" ? "primary" : "secondary"} value={"iphone"}>IOS</CapButton>
|
|
90
|
-
</ButtonGroup>}
|
|
91
|
-
</div>
|
|
92
|
-
<TemplatePreview
|
|
93
|
-
device={device === "android" ? "android" : "iphone"}
|
|
94
|
-
channel={channel}
|
|
95
|
-
content={content || ''}
|
|
96
|
-
templateData={templateData}
|
|
97
|
-
>
|
|
98
|
-
</TemplatePreview>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</div>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
MobilePushPreviewV2.propTypes = {
|
|
110
|
-
templateData: PropTypes.object.isRequired,
|
|
111
|
-
channel: PropTypes.string.isRequired,
|
|
112
|
-
showPreview: PropTypes.bool,
|
|
113
|
-
handleClose: PropTypes.func,
|
|
114
|
-
onEditClick: PropTypes.func,
|
|
115
|
-
onDuplicateClick: PropTypes.func,
|
|
116
|
-
location: PropTypes.object,
|
|
117
|
-
embedded: PropTypes.bool,
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export default MobilePushPreviewV2;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* MobilePushPreviewV2 Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the MobilePushPreviewV2 component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
export default defineMessages({
|
|
9
|
-
header: {
|
|
10
|
-
id: 'app.components.MobilePushPreviewV2.header',
|
|
11
|
-
defaultMessage: 'This is the MobilePushPreviewV2 component !',
|
|
12
|
-
},
|
|
13
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// import React from 'react';
|
|
2
|
-
// import { shallow } from 'enzyme';
|
|
3
|
-
|
|
4
|
-
// import MobilePushPreviewV2 from '../index';
|
|
5
|
-
|
|
6
|
-
describe('<MobilePushPreviewV2 />', () => {
|
|
7
|
-
it('Expect to have unit tests specified', () => {
|
|
8
|
-
expect(true).toEqual(false);
|
|
9
|
-
});
|
|
10
|
-
});
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* NewCallTask
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
9
|
-
import { CapRow, CapColumn, CapInput, CapButton, CapSpin } from '@capillarytech/cap-ui-library';
|
|
10
|
-
import { injectIntl, intlShape } from 'react-intl';
|
|
11
|
-
import TagList from '../../containers/TagList';
|
|
12
|
-
import CallTaskPreview from '../CallTaskPreview';
|
|
13
|
-
import messages from './messages';
|
|
14
|
-
import './_newCallTask.scss';
|
|
15
|
-
|
|
16
|
-
class NewCallTask extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
17
|
-
constructor(props) {
|
|
18
|
-
super(props);
|
|
19
|
-
this.state = this.getInitialState();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
getInitialState = () => {
|
|
23
|
-
const { templateData } = this.props;
|
|
24
|
-
return {
|
|
25
|
-
subject: templateData && templateData.subject ? templateData.subject : '',
|
|
26
|
-
messageBody: templateData && templateData.messageBody ? templateData.messageBody : '',
|
|
27
|
-
description: templateData && templateData.description ? templateData.description : '',
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
onTagSelect = (data) => {
|
|
32
|
-
this.insertAtCursor(`{{${data}}}`);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
setInputRef = (textarea) => {
|
|
36
|
-
this.textArea = textarea;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
insertAtCursor = (myValue) => {
|
|
40
|
-
this.textArea.focus();
|
|
41
|
-
const textAreaRef = this.textArea.textAreaRef;
|
|
42
|
-
let pos = textAreaRef.selectionEnd + myValue.length;
|
|
43
|
-
//IE support
|
|
44
|
-
let newMessage = textAreaRef.value + myValue;
|
|
45
|
-
if (document.selection) {
|
|
46
|
-
this.textArea.focus();
|
|
47
|
-
const sel = document.selection.createRange();
|
|
48
|
-
sel.text = myValue;
|
|
49
|
-
} else if (textAreaRef.selectionStart || textAreaRef.selectionStart === '0') { //MOZILLA and others
|
|
50
|
-
const startPos = textAreaRef.selectionStart;
|
|
51
|
-
const endPos = textAreaRef.selectionEnd;
|
|
52
|
-
newMessage = textAreaRef.value.substring(0, startPos) + myValue + textAreaRef.value.substring(endPos, textAreaRef.value.length);
|
|
53
|
-
pos = startPos + myValue.length;
|
|
54
|
-
}
|
|
55
|
-
this.setState({
|
|
56
|
-
messageBody: newMessage,
|
|
57
|
-
}, () => {
|
|
58
|
-
textAreaRef.selectionStart = pos;
|
|
59
|
-
textAreaRef.selectionEnd = pos;
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
updateSubject = (e) => {
|
|
64
|
-
this.setState({
|
|
65
|
-
subject: e.target.value,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
updateMessageBody = (e) => {
|
|
70
|
-
this.setState({
|
|
71
|
-
messageBody: e.target.value,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
updateDescription = (e) => {
|
|
76
|
-
this.setState({
|
|
77
|
-
description: e.target.value,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
submitForm = () => {
|
|
82
|
-
this.props.onCallTaskSubmit(this.state);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
render() {
|
|
86
|
-
const { intl, isLoading, metaEntities } = this.props;
|
|
87
|
-
const { formatMessage } = intl;
|
|
88
|
-
const { subject, messageBody, description } = this.state;
|
|
89
|
-
const tags = metaEntities && metaEntities.tags ? metaEntities.tags.standard : [];
|
|
90
|
-
return (
|
|
91
|
-
<CapSpin spinning={isLoading}>
|
|
92
|
-
<CapRow gutter={16}>
|
|
93
|
-
<CapColumn span={12}>
|
|
94
|
-
<div style={{ height: 'calc(100vh - 187px)', overflowY: 'auto', paddingRight: "8px" }}>
|
|
95
|
-
<div style={{ marginBottom: '34px' }}>
|
|
96
|
-
<CapInput
|
|
97
|
-
label={formatMessage(messages.callTaskTitle)}
|
|
98
|
-
onChange={this.updateSubject}
|
|
99
|
-
value={subject}
|
|
100
|
-
isRequired
|
|
101
|
-
/>
|
|
102
|
-
</div>
|
|
103
|
-
<div style={{ position: 'relative', marginBottom: '34px' }}>
|
|
104
|
-
<TagList
|
|
105
|
-
className="new-call-task-tagList"
|
|
106
|
-
label={formatMessage(messages.personalisationTags)}
|
|
107
|
-
tags={tags}
|
|
108
|
-
onTagSelect={this.onTagSelect}
|
|
109
|
-
/>
|
|
110
|
-
<CapInput.TextArea
|
|
111
|
-
setInputRef={this.setInputRef}
|
|
112
|
-
label={formatMessage(messages.messageHeader)}
|
|
113
|
-
onChange={this.updateMessageBody}
|
|
114
|
-
value={messageBody}
|
|
115
|
-
isRequired
|
|
116
|
-
/>
|
|
117
|
-
</div>
|
|
118
|
-
<CapInput.TextArea
|
|
119
|
-
label={formatMessage(messages.description)}
|
|
120
|
-
onChange={this.updateDescription}
|
|
121
|
-
value={description}
|
|
122
|
-
isRequired
|
|
123
|
-
/>
|
|
124
|
-
</div>
|
|
125
|
-
<CapButton
|
|
126
|
-
disabled={!subject || !messageBody || !description}
|
|
127
|
-
className="new-call-task-done-button"
|
|
128
|
-
onClick={this.submitForm}>
|
|
129
|
-
{formatMessage(messages.done)}
|
|
130
|
-
</CapButton>
|
|
131
|
-
</CapColumn>
|
|
132
|
-
<CapColumn span={12}>
|
|
133
|
-
<CallTaskPreview
|
|
134
|
-
subject={subject}
|
|
135
|
-
messageBody={messageBody}
|
|
136
|
-
/>
|
|
137
|
-
</CapColumn>
|
|
138
|
-
</CapRow>
|
|
139
|
-
</CapSpin>
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
NewCallTask.propTypes = {
|
|
145
|
-
intl: intlShape.isRequired,
|
|
146
|
-
onCallTaskSubmit: PropTypes.func,
|
|
147
|
-
templateData: PropTypes.object,
|
|
148
|
-
isLoading: PropTypes.bool,
|
|
149
|
-
metaEntities: PropTypes.object,
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
export default injectIntl(NewCallTask);
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* NewCallTask Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the NewCallTask component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
export default defineMessages({
|
|
9
|
-
callTaskTitle: {
|
|
10
|
-
id: 'app.components.NewCallTask.callTaskTitle',
|
|
11
|
-
defaultMessage: 'Call Task title',
|
|
12
|
-
},
|
|
13
|
-
messageHeader: {
|
|
14
|
-
id: 'app.components.NewCallTask.messageHeader',
|
|
15
|
-
defaultMessage: 'Message',
|
|
16
|
-
},
|
|
17
|
-
description: {
|
|
18
|
-
id: 'app.components.NewCallTask.description',
|
|
19
|
-
defaultMessage: 'Description',
|
|
20
|
-
},
|
|
21
|
-
done: {
|
|
22
|
-
id: 'app.components.NewCallTask.done',
|
|
23
|
-
defaultMessage: 'Done',
|
|
24
|
-
},
|
|
25
|
-
personalisationTags: {
|
|
26
|
-
id: 'app.components.NewCallTask.personalisationTags',
|
|
27
|
-
defaultMessage: 'Personalisation tags',
|
|
28
|
-
},
|
|
29
|
-
});
|