@capillarytech/creatives-library 2.0.82 → 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 +194 -260
- 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/v2Components/CapTagList/tests/index.test.js +10 -0
- 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/v2Components/CardGrid/tests/index.test.js +10 -0
- package/v2Components/Ckeditor/index.js +234 -0
- package/v2Components/Ckeditor/messages.js +13 -0
- package/v2Components/Ckeditor/tests/index.test.js +10 -0
- 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/v2Components/MobilePushPreviewV2/tests/index.test.js +10 -0
- package/v2Components/NewCallTask/_newCallTask.scss +9 -0
- package/v2Components/NewCallTask/index.js +152 -0
- package/v2Components/NewCallTask/messages.js +29 -0
- package/v2Components/NewCallTask/tests/index.test.js +10 -0
- 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 +4 -4
- 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 +1 -1
- package/v2Containers/MobilePush/Edit/index.js +1 -1
- 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/containers/WeChat/_wechat.scss +0 -8
- package/containers/WeChat/actions.js +0 -46
- package/containers/WeChat/constants.js +0 -28
- package/containers/WeChat/index.js +0 -1617
- 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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* FormBuilder Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the FormBuilder component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
header: {
|
|
10
|
+
id: 'app.components.FormBuilder.header',
|
|
11
|
+
defaultMessage: 'This is the FormBuilder component !',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// import React from 'react';
|
|
2
|
+
// import { shallow } from 'enzyme';
|
|
3
|
+
|
|
4
|
+
// import FormBuilder from '../index';
|
|
5
|
+
|
|
6
|
+
// describe('<FormBuilder />', () => {
|
|
7
|
+
// it('Expect to have unit tests specified', () => {
|
|
8
|
+
// expect(true).toEqual(false);
|
|
9
|
+
// });
|
|
10
|
+
// });
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Header
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
// import styled from 'styled-components';
|
|
11
|
+
import { FormattedMessage } from 'react-intl';
|
|
12
|
+
|
|
13
|
+
import { CapRow, CapColumn, CapInput, CapButton } from '@capillarytech/cap-ui-library';
|
|
14
|
+
import messages from './messages';
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
function Header(props) {
|
|
18
|
+
return (
|
|
19
|
+
<div>
|
|
20
|
+
<CapRow className="template-form-header">
|
|
21
|
+
<CapColumn span={10}>
|
|
22
|
+
<CapInput id="template-name" placeholder="Enter template name*" defaultValue={props.templateName} type="input" onChange={props.templateNameHandler}/>
|
|
23
|
+
</CapColumn>
|
|
24
|
+
<CapColumn span={2} offset={8}>
|
|
25
|
+
<CapButton id="preview-button" type="cancel" onClick={props.previewHandler}> <FormattedMessage {...messages.preview} /> </CapButton>
|
|
26
|
+
</CapColumn>
|
|
27
|
+
<CapColumn span={2}>
|
|
28
|
+
<CapButton id="cancel-button" type="cancel" onClick={props.cancelHandler}> <FormattedMessage {...messages.cancel} /> </CapButton>
|
|
29
|
+
</CapColumn>
|
|
30
|
+
<CapColumn span={2}>
|
|
31
|
+
<CapButton id="save-button" type="primary" onClick={props.saveHandler}> <FormattedMessage {...messages.save} /> </CapButton>
|
|
32
|
+
</CapColumn>
|
|
33
|
+
</CapRow>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
Header.propTypes = {
|
|
39
|
+
templateNameHandler: PropTypes.func,
|
|
40
|
+
previewHandler: PropTypes.func,
|
|
41
|
+
cancelHandler: PropTypes.func,
|
|
42
|
+
saveHandler: PropTypes.func,
|
|
43
|
+
templateName: PropTypes.string,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default Header;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Header Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the Header component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
header: {
|
|
10
|
+
id: 'app.components.Header.header',
|
|
11
|
+
defaultMessage: 'This is the Header component !',
|
|
12
|
+
},
|
|
13
|
+
preview: {
|
|
14
|
+
id: 'app.components.Header.preview',
|
|
15
|
+
defaultMessage: 'Preview',
|
|
16
|
+
},
|
|
17
|
+
cancel: {
|
|
18
|
+
id: 'app.components.Header.cancel',
|
|
19
|
+
defaultMessage: 'Cancel',
|
|
20
|
+
},
|
|
21
|
+
save: {
|
|
22
|
+
id: 'app.components.Header.save',
|
|
23
|
+
defaultMessage: 'Save',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
.modal-image-preview-wrapper {
|
|
2
|
+
width: 100vw;
|
|
3
|
+
height: 100vh;
|
|
4
|
+
position: fixed;
|
|
5
|
+
top: 0;
|
|
6
|
+
left: 0;
|
|
7
|
+
background: rgba(0,0,0,0.56);
|
|
8
|
+
z-index: 10002;
|
|
9
|
+
|
|
10
|
+
#image-preview-container {
|
|
11
|
+
position: relative;
|
|
12
|
+
left: 40vw;
|
|
13
|
+
width: 60vw;
|
|
14
|
+
height: 100vh;
|
|
15
|
+
background: rgba(255,255,255,1);
|
|
16
|
+
// padding: 0 24px 0 24px;
|
|
17
|
+
overflow-y: auto;
|
|
18
|
+
// font-family: 'proxima-nova';
|
|
19
|
+
|
|
20
|
+
.image-preview-header {
|
|
21
|
+
display: inline-flex;
|
|
22
|
+
width: 100%;
|
|
23
|
+
padding: 16px 24px;
|
|
24
|
+
-webkit-box-shadow: 0px 0px 4px 2px rgba(0,0,0,0.12);
|
|
25
|
+
-moz-box-shadow: 0px 0px 4px 2px rgba(0,0,0,0.12);
|
|
26
|
+
box-shadow: 0px 0px 4px 2px rgba(0,0,0,0.12);
|
|
27
|
+
margin-bottom: 6px;
|
|
28
|
+
height: 56px;
|
|
29
|
+
align-items: center;
|
|
30
|
+
.heading-title {
|
|
31
|
+
font-size: 20px;
|
|
32
|
+
line-height: 24px;
|
|
33
|
+
font-weight: 600;
|
|
34
|
+
width: 97%;
|
|
35
|
+
text-overflow: ellipsis;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
white-space: nowrap;
|
|
38
|
+
|
|
39
|
+
&:first-letter{
|
|
40
|
+
text-transform: capitalize;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
.close-image-preview{
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#image-preview-content {
|
|
49
|
+
padding: 0 0px 0 24px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.show-image-preview {
|
|
55
|
+
visibility: visible;
|
|
56
|
+
opacity: 1;
|
|
57
|
+
transition: visibility 1s linear 0.33s, opacity 0.33s linear;
|
|
58
|
+
}
|
|
59
|
+
.hide-image-preview {
|
|
60
|
+
visibility: hidden;
|
|
61
|
+
opacity: 0;
|
|
62
|
+
transition-delay: 0s;
|
|
63
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* ImagePreview
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { injectIntl, intlShape } from 'react-intl';
|
|
11
|
+
import { Spin } from 'antd';
|
|
12
|
+
import messages from './messages';
|
|
13
|
+
import './_imagePreview.scss';
|
|
14
|
+
|
|
15
|
+
class ImagePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
16
|
+
render() {
|
|
17
|
+
return (
|
|
18
|
+
<div className={this.props.show ? "modal-image-preview-wrapper show-image-preview" : "modal-image-preview-wrapper hide-image-preview"}>
|
|
19
|
+
<div id="image-preview-container">
|
|
20
|
+
<div className="image-preview-header">
|
|
21
|
+
<div className="heading-title">
|
|
22
|
+
{this.props.header}
|
|
23
|
+
</div>
|
|
24
|
+
<div id="box-actions" style={{ float: 'right' }} onClick={this.props.handleClose}>
|
|
25
|
+
<i className="material-icons close-image-preview">close</i>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div id="image-preview-content">
|
|
30
|
+
<Spin tip={this.props.intl.formatMessage(messages.loadingImage)} spinning={this.props.isLoading}>
|
|
31
|
+
{this.props.content}
|
|
32
|
+
</Spin>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
ImagePreview.propTypes = {
|
|
41
|
+
header: PropTypes.oneOfType([
|
|
42
|
+
PropTypes.element,
|
|
43
|
+
PropTypes.string,
|
|
44
|
+
]).isRequired,
|
|
45
|
+
content: PropTypes.element.isRequired,
|
|
46
|
+
show: PropTypes.bool,
|
|
47
|
+
handleClose: PropTypes.func.isRequired,
|
|
48
|
+
isLoading: PropTypes.bool,
|
|
49
|
+
intl: intlShape.isRequired,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default injectIntl(ImagePreview);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* ImagePreview Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the ImagePreview component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
loadingImage: {
|
|
10
|
+
id: 'app.components.ImagePreview.loadingImage',
|
|
11
|
+
defaultMessage: 'Loading Images !!!!',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
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;
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,152 @@
|
|
|
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);
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.pageHeader{
|
|
2
|
+
.pageHeader-wrapper{
|
|
3
|
+
padding-top: 8px;
|
|
4
|
+
padding-bottom: 8px;
|
|
5
|
+
|
|
6
|
+
.title-container {
|
|
7
|
+
padding-left: 0px !important;
|
|
8
|
+
|
|
9
|
+
.title {
|
|
10
|
+
font-size: 24px;
|
|
11
|
+
line-height: 32px;
|
|
12
|
+
color: #323B4E;
|
|
13
|
+
font-family: 'Proxima-Nova';
|
|
14
|
+
font-weight: 600;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
.action-buttons{
|
|
18
|
+
text-align: right;
|
|
19
|
+
padding-right: 0 !important;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
// import styled from 'styled-components';
|
|
4
|
+
|
|
5
|
+
import { Grid } from 'semantic-ui-react';
|
|
6
|
+
import './_pageHeader.scss';
|
|
7
|
+
|
|
8
|
+
// import { FormattedMessage } from 'react-intl';
|
|
9
|
+
// import messages from './messages';
|
|
10
|
+
|
|
11
|
+
class PageHeader extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
12
|
+
render() {
|
|
13
|
+
return (
|
|
14
|
+
<Grid className="pageHeader">
|
|
15
|
+
<Grid.Row className="pageHeader-wrapper">
|
|
16
|
+
<Grid.Column width={8} className="title-container">
|
|
17
|
+
<h2 className="title">{this.props.pageHeading}</h2>
|
|
18
|
+
</Grid.Column>
|
|
19
|
+
<Grid.Column className="action-buttons" width={8}>
|
|
20
|
+
{this.props.actionComponents}
|
|
21
|
+
</Grid.Column>
|
|
22
|
+
</Grid.Row>
|
|
23
|
+
</Grid>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
PageHeader.propTypes = {
|
|
29
|
+
// Need Formatted Message in pageHeading Props
|
|
30
|
+
pageHeading: PropTypes.oneOfType([
|
|
31
|
+
PropTypes.element,
|
|
32
|
+
PropTypes.string,
|
|
33
|
+
]),
|
|
34
|
+
actionComponents: PropTypes.element,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default PageHeader;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* PageHeader Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the PageHeader component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
header: {
|
|
10
|
+
id: 'app.components.PageHeader.header',
|
|
11
|
+
defaultMessage: 'This is the PageHeader component !',
|
|
12
|
+
},
|
|
13
|
+
});
|