@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
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
.modal-slidebox-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
|
+
#slidebox-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
|
+
.slidebox-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-slidebox{
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#slidebox-content {
|
|
49
|
+
padding: 0 0px 0 24px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.show-slidebox {
|
|
55
|
+
visibility: visible;
|
|
56
|
+
opacity: 1;
|
|
57
|
+
transition: visibility 1s linear 0.33s, opacity 0.33s linear;
|
|
58
|
+
}
|
|
59
|
+
.hide-slidebox {
|
|
60
|
+
visibility: hidden;
|
|
61
|
+
opacity: 0;
|
|
62
|
+
transition-delay: 0s;
|
|
63
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './_slideBox.scss';
|
|
4
|
+
|
|
5
|
+
class SlideBox extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
6
|
+
render() {
|
|
7
|
+
return (
|
|
8
|
+
<div className={this.props.show ? "modal-slidebox-wrapper show-slidebox" : "modal-slidebox-wrapper hide-slidebox"}>
|
|
9
|
+
<div id="slidebox-container" style={{ width: `${this.props.width}vw`, left: `${100 - this.props.width}vw`}}>
|
|
10
|
+
<div className="slidebox-header">
|
|
11
|
+
<div className="heading-title">
|
|
12
|
+
{this.props.header}
|
|
13
|
+
</div>
|
|
14
|
+
<div id="box-actions" style={{ float: 'right' }} onClick={this.props.handleClose}>
|
|
15
|
+
<i className="material-icons close-slidebox">close</i>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div id="slidebox-content">
|
|
20
|
+
{this.props.isLoading ? <div style={{height: '100%', lineHeight: '90vh', textAlign: 'center', fontSize: '18px', fontFamily: "open-sans"}}>{this.props.loadingText}</div> : this.props.content}
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
SlideBox.defaultProps = {
|
|
29
|
+
show: false,
|
|
30
|
+
width: 40,
|
|
31
|
+
loadingText: 'loading',
|
|
32
|
+
isLoading: false,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
SlideBox.propTypes = {
|
|
36
|
+
header: PropTypes.oneOfType([
|
|
37
|
+
PropTypes.element,
|
|
38
|
+
PropTypes.string,
|
|
39
|
+
]).isRequired,
|
|
40
|
+
content: PropTypes.element.isRequired,
|
|
41
|
+
show: PropTypes.bool,
|
|
42
|
+
handleClose: PropTypes.func.isRequired,
|
|
43
|
+
width: PropTypes.number,
|
|
44
|
+
loadingText: PropTypes.string,
|
|
45
|
+
isLoading: PropTypes.bool,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default SlideBox;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {mount, shallow} from 'enzyme';
|
|
3
|
+
import SlideBox from '../index';
|
|
4
|
+
|
|
5
|
+
describe('<SlideBox />', () => {
|
|
6
|
+
let props;
|
|
7
|
+
let mountedSlideBox;
|
|
8
|
+
|
|
9
|
+
const slideBox = () => {
|
|
10
|
+
if (!mountedSlideBox) {
|
|
11
|
+
mountedSlideBox = mount(
|
|
12
|
+
<SlideBox {...props} />
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
return mountedSlideBox;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
props = {
|
|
20
|
+
header: <h1>Header</h1>,
|
|
21
|
+
content: <p>Content</p>,
|
|
22
|
+
show: undefined,
|
|
23
|
+
handleClose: jest.fn(),
|
|
24
|
+
};
|
|
25
|
+
mountedSlideBox = undefined;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('always renders a wrapping div', () => {
|
|
29
|
+
const divs = slideBox().find("div");
|
|
30
|
+
expect(divs.length).toBeGreaterThan(0);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('the rendered div', () => {
|
|
34
|
+
it('contains everything else that gets rendered', () => {
|
|
35
|
+
const divs = slideBox().find("div");
|
|
36
|
+
const wrappingDiv = divs.first();
|
|
37
|
+
expect(wrappingDiv.children()).toEqual(slideBox().children());
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('has a className of show-slidebox if "show" props is true', () => {
|
|
41
|
+
props.show = true;
|
|
42
|
+
const divs = slideBox().find("div");
|
|
43
|
+
const wrappingDiv = divs.first();
|
|
44
|
+
expect(wrappingDiv.props().className).toBe('modal-slidebox-wrapper show-slidebox');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('has a className of hide-slidebox if "show" props is false', () => {
|
|
48
|
+
props.show = false;
|
|
49
|
+
const divs = slideBox().find("div");
|
|
50
|
+
const wrappingDiv = divs.first();
|
|
51
|
+
expect(wrappingDiv.props().className).toBe('modal-slidebox-wrapper hide-slidebox');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('should render a div with class heading-title', () => {
|
|
55
|
+
const divs = slideBox().find("div");
|
|
56
|
+
const header = divs.find('.heading-title');
|
|
57
|
+
expect(header.length).toBe(1);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should render a div with id box-actions', () => {
|
|
61
|
+
const divs = slideBox().find("div");
|
|
62
|
+
const header = divs.find('#box-actions');
|
|
63
|
+
expect(header.length).toBe(1);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe('Slidebox header', () => {
|
|
68
|
+
it('renders the element passed as header prop', () => {
|
|
69
|
+
const renderedComponent = shallow(<SlideBox {...props}/>);
|
|
70
|
+
expect(renderedComponent.find('.heading-title').contains(props.header)).toBe(true);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe('Slidebox Content', () => {
|
|
75
|
+
it('renders the element passed as content prop', () => {
|
|
76
|
+
const renderedComponent = shallow(<SlideBox {...props}/>);
|
|
77
|
+
expect(renderedComponent.find('#slidebox-content').contains(props.content)).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
describe('when handleClose is defined', () => {
|
|
82
|
+
it('sets onClick action of action box to be same as handleClose ', () => {
|
|
83
|
+
const actionBox = slideBox().find('#box-actions');
|
|
84
|
+
expect(actionBox.props().onClick).toBe(props.handleClose);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe('Box Actions Div', () => {
|
|
89
|
+
it('renders one icon', () => {
|
|
90
|
+
const renderedComponent = shallow(<SlideBox {...props}/>);
|
|
91
|
+
const boxActionDiv = renderedComponent.find('#box-actions').first();
|
|
92
|
+
const icon = boxActionDiv.find('i');
|
|
93
|
+
expect(icon.length).toBe(1);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('has close as the content for rendered icon', () => {
|
|
97
|
+
const renderedComponent = shallow(<SlideBox {...props}/>);
|
|
98
|
+
const boxActionDiv = renderedComponent.find('#box-actions').first();
|
|
99
|
+
const icon = boxActionDiv.find('i');
|
|
100
|
+
expect(icon.node.props.children).toBe('close');
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* SmsEditor
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
// import styled from 'styled-components';
|
|
11
|
+
import {TextArea} from 'semantic-ui-react';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class SmsEditor extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props);
|
|
17
|
+
if (this.props.content) {
|
|
18
|
+
this.state = {
|
|
19
|
+
content: this.props.content,
|
|
20
|
+
};
|
|
21
|
+
} else {
|
|
22
|
+
this.state = {
|
|
23
|
+
content: '',
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
this.onContentChange = this.onContentChange.bind(this);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
onContentChange(e, data) {
|
|
30
|
+
this.props.onDataChange(data);
|
|
31
|
+
this.setState({
|
|
32
|
+
content: data,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
render() {
|
|
37
|
+
return (
|
|
38
|
+
<div>
|
|
39
|
+
<TextArea
|
|
40
|
+
autoHeight
|
|
41
|
+
style={{minHeight: 100}}
|
|
42
|
+
value={this.props.content}
|
|
43
|
+
onChange={(e, data) => { this.onContentChange(e, data); }}
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
SmsEditor.propTypes = {
|
|
51
|
+
content: PropTypes.string,
|
|
52
|
+
onDataChange: PropTypes.func,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default SmsEditor;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* SmsTest
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
// import styled from 'styled-components';
|
|
9
|
+
|
|
10
|
+
// import { FormattedMessage } from 'react-intl';
|
|
11
|
+
// import messages from './messages';
|
|
12
|
+
import FormBuilder from '../FormBuilder';
|
|
13
|
+
|
|
14
|
+
class SmsTest extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props);
|
|
17
|
+
this.saveFormData = this.saveFormData.bind(this);
|
|
18
|
+
this.onFormDataChange = this.onFormDataChange.bind(this);
|
|
19
|
+
this.onTemplateNameChange = this.onTemplateNameChange.bind(this);
|
|
20
|
+
this.onTemplateContentChange = this.onTemplateContentChange.bind(this);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
onTemplateNameChange(name) {
|
|
24
|
+
console.log('Template name changed to ', name);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
onTemplateContentChange(content) {
|
|
28
|
+
console.log('Template content changed to ', content);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
onFormDataChange(formData) {
|
|
32
|
+
console.log('Form data changed is ', formData);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
saveFormData(formData) {
|
|
36
|
+
//Logic to save in db etc
|
|
37
|
+
console.log('Saving form data', formData);
|
|
38
|
+
}
|
|
39
|
+
render() {
|
|
40
|
+
const schema = {
|
|
41
|
+
inputFields: [
|
|
42
|
+
{
|
|
43
|
+
id: "template-name",
|
|
44
|
+
label: "Template Name",
|
|
45
|
+
type: "input", //Resembles component to be used
|
|
46
|
+
metaType: "text",
|
|
47
|
+
datatype: "string",
|
|
48
|
+
required: true,
|
|
49
|
+
placeholder: "Please input template name.",
|
|
50
|
+
fluid: true,
|
|
51
|
+
styling: "semantic",
|
|
52
|
+
order: 1,
|
|
53
|
+
customComponent: false,
|
|
54
|
+
supportedEvents: {
|
|
55
|
+
onChange: this.onTemplateNameChange,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "sms-editor",
|
|
60
|
+
label: "Template Content",
|
|
61
|
+
type: "SmsEditor",
|
|
62
|
+
metaType: "text",
|
|
63
|
+
datatype: "string",
|
|
64
|
+
required: true,
|
|
65
|
+
placeholder: "Please input sms template content.",
|
|
66
|
+
fluid: false,
|
|
67
|
+
styling: "custom",
|
|
68
|
+
order: 2,
|
|
69
|
+
customComponent: true,
|
|
70
|
+
supportedEvents: {
|
|
71
|
+
onChange: this.onTemplateContentChange,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
actionFields: [
|
|
76
|
+
{
|
|
77
|
+
id: "submit-button",
|
|
78
|
+
metaType: "submit-button",
|
|
79
|
+
type: "button",
|
|
80
|
+
value: "Create Template",
|
|
81
|
+
customComponent: false,
|
|
82
|
+
styling: "semantic",
|
|
83
|
+
order: 3,
|
|
84
|
+
fluid: false,
|
|
85
|
+
supportedEvents: {
|
|
86
|
+
onClick: this.saveFormData,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
channel: "SMS",
|
|
91
|
+
module: "Campaigns",
|
|
92
|
+
};
|
|
93
|
+
const json = {
|
|
94
|
+
"sms-editor": "asa121s",
|
|
95
|
+
"template-name": "台北",
|
|
96
|
+
};
|
|
97
|
+
return (
|
|
98
|
+
<div>
|
|
99
|
+
<FormBuilder
|
|
100
|
+
formData={json}
|
|
101
|
+
schema={schema}
|
|
102
|
+
onSubmit={this.saveFormData}
|
|
103
|
+
onChange={this.onFormDataChange}
|
|
104
|
+
usingTabContainer
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
SmsTest.propTypes = {
|
|
112
|
+
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export default SmsTest;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SmsTest Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the SmsTest component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
header: {
|
|
10
|
+
id: 'app.components.SmsTest.header',
|
|
11
|
+
defaultMessage: 'This is the SmsTest component !',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.wechatMsgContainer{
|
|
2
|
+
position: absolute;
|
|
3
|
+
left: 30%;
|
|
4
|
+
top: 20%;
|
|
5
|
+
background: white;
|
|
6
|
+
width: 40%;
|
|
7
|
+
text-align: left;
|
|
8
|
+
}
|
|
9
|
+
.wechatMsgContainerOutbound{
|
|
10
|
+
position: absolute;
|
|
11
|
+
left: 35%;
|
|
12
|
+
top: 20%;
|
|
13
|
+
background: white;
|
|
14
|
+
width: 30%;
|
|
15
|
+
text-align: left;
|
|
16
|
+
}
|
|
17
|
+
.wechatMsgContainerCardLayout {
|
|
18
|
+
position: absolute;
|
|
19
|
+
left: 20%;
|
|
20
|
+
top: 20%;
|
|
21
|
+
background: white;
|
|
22
|
+
width: 60%;
|
|
23
|
+
text-align: left;
|
|
24
|
+
}
|
|
25
|
+
.overflow-handle-preview {
|
|
26
|
+
height: 430px;
|
|
27
|
+
overflow-y: auto;
|
|
28
|
+
}
|
|
29
|
+
.overflow-handle-preview-outbound {
|
|
30
|
+
height: 330px;
|
|
31
|
+
overflow-y: auto;
|
|
32
|
+
}
|
|
33
|
+
.preview-overflow-wrap-fields {
|
|
34
|
+
text-overflow: ellipsis;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
overflow-wrap: break-word;
|
|
37
|
+
display: -webkit-box !important;
|
|
38
|
+
-webkit-box-orient: vertical;
|
|
39
|
+
-webkit-line-clamp: 2;
|
|
40
|
+
text-align: left;
|
|
41
|
+
width: 200px;
|
|
42
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* WechatRichmediaTemplatePreview
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { CapRow, CapColumn, CapButton } from '@capillarytech/cap-ui-library/';
|
|
10
|
+
import { FormattedMessage } from 'react-intl';
|
|
11
|
+
import _ from 'lodash';
|
|
12
|
+
import SlideBox from '../../SlideBox';
|
|
13
|
+
import './_wechatRichmediaTemplatePrev.scss';
|
|
14
|
+
import messages from './messages';
|
|
15
|
+
const wechatBody = require('./../assets/images/WECHAT_5x.png');
|
|
16
|
+
|
|
17
|
+
class WechatRichmediaTemplatePreview extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
|
|
18
|
+
preparePreviewData = (mediaList) => {
|
|
19
|
+
const returnObj = [];
|
|
20
|
+
_.forEach(mediaList, (contentData, contentIndex) => {
|
|
21
|
+
const id = parseInt(contentIndex, 10);
|
|
22
|
+
if (id === 0) {
|
|
23
|
+
returnObj.push(
|
|
24
|
+
<div style={{ width: "100%", height: 116, position: "relative" }}>
|
|
25
|
+
<CapRow>
|
|
26
|
+
<img alt="default" width="100%" height="110px" src={contentData.image_url} />
|
|
27
|
+
<div className="preview-overflow-wrap-fields" style={{ position: "absolute", bottom: "5%", left: "5%" }}>{contentData.title ? contentData.title : ""}</div>
|
|
28
|
+
</CapRow>
|
|
29
|
+
{Object.keys(mediaList).length === 1 ?
|
|
30
|
+
<CapRow style={{ height: 32 }}>
|
|
31
|
+
{contentData.digest ? contentData.digest : ""}
|
|
32
|
+
</CapRow>
|
|
33
|
+
:
|
|
34
|
+
""
|
|
35
|
+
}
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
} else {
|
|
39
|
+
returnObj.push(
|
|
40
|
+
<CapRow style={{ "width": "100%", "height": 64, "border-bottom": "0.5px solid lightgrey" }}>
|
|
41
|
+
<CapColumn className="preview-overflow-wrap-fields" style={{ padding: "5% 0% 0% 5%", float: "left", width: "auto" }}>
|
|
42
|
+
{contentData.title}
|
|
43
|
+
</CapColumn>
|
|
44
|
+
<CapColumn style={{ float: "right" }}>
|
|
45
|
+
<img alt="default" width="60px" height="60px" src={contentData.image_url} style={{ "padding-right": "10%", "float": "left" }}/>
|
|
46
|
+
</CapColumn>
|
|
47
|
+
</CapRow>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return returnObj;
|
|
52
|
+
}
|
|
53
|
+
prepareCardLayoutPreviewData = (mediaList) => {
|
|
54
|
+
const returnObj = [];
|
|
55
|
+
_.forEach(mediaList, (contentData, contentIndex) => {
|
|
56
|
+
const id = parseInt(contentIndex, 10);
|
|
57
|
+
if (id === 0) {
|
|
58
|
+
returnObj.push(
|
|
59
|
+
<div style={{ width: "100%", height: 116, position: "relative" }}>
|
|
60
|
+
<CapRow>
|
|
61
|
+
<img alt="default" width="100%" height="110px" src={contentData.image_url} />
|
|
62
|
+
<div className="preview-overflow-wrap-fields" style={{ position: "absolute", bottom: "5%", left: "10%", width: "auto" }}>{contentData.title ? contentData.title : ""}</div>
|
|
63
|
+
</CapRow>
|
|
64
|
+
{Object.keys(mediaList).length === 1 ?
|
|
65
|
+
<CapRow style={{ height: 32, left: "12%" }}>
|
|
66
|
+
{contentData.digest ? contentData.digest : ""}
|
|
67
|
+
</CapRow>
|
|
68
|
+
:
|
|
69
|
+
""
|
|
70
|
+
}
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
} else {
|
|
74
|
+
returnObj.push(
|
|
75
|
+
<CapRow style={{ "width": "100%", "height": 64, "border-bottom": "0.5px solid lightgrey", "padding": "0 8px" }}>
|
|
76
|
+
<CapColumn className="preview-overflow-wrap-fields" style={{ padding: "5% 0% 0% 8%", float: "left", width: "auto" }}>
|
|
77
|
+
{contentData.title}
|
|
78
|
+
</CapColumn>
|
|
79
|
+
<CapColumn style={{ float: "right" }}>
|
|
80
|
+
<img alt="default" width="60px" height="60px" src={contentData.image_url}/>
|
|
81
|
+
</CapColumn>
|
|
82
|
+
</CapRow>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
return returnObj;
|
|
87
|
+
}
|
|
88
|
+
goToEdit(e, path) {
|
|
89
|
+
this.props.onEditClick(e, this.props.templateId, this.props.modeType, path);
|
|
90
|
+
}
|
|
91
|
+
render() {
|
|
92
|
+
return (
|
|
93
|
+
this.props.showSlidebox ?
|
|
94
|
+
<SlideBox
|
|
95
|
+
show={this.props.show}
|
|
96
|
+
handleClose={this.props.closeSlideBox}
|
|
97
|
+
header={this.props.templateName}
|
|
98
|
+
width={50}
|
|
99
|
+
content={
|
|
100
|
+
<div className={`preview-container ${this.props.type === 'embedded' ? 'embedded-preview' : ''}`}>
|
|
101
|
+
<div className="shell align-center" id="sms-preview">
|
|
102
|
+
<img className="preview-image" src={wechatBody} alt="Preview is being generated"/>
|
|
103
|
+
<div className={this.props.type === 'embedded' ? "wechatMsgContainerOutbound" : "wechatMsgContainer"}>
|
|
104
|
+
<div className={this.props.type === 'embedded' ? "overflow-handle-preview-outbound" : "overflow-handle-preview"}>{this.preparePreviewData(this.props.content)}
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
{this.props.showEdit ? <CapButton onClick={(e) => this.goToEdit(e, this.props.path)} className="preview-buttons" type="primary">{this.props.type === 'embedded' ? <FormattedMessage {...messages.select} /> : <FormattedMessage {...messages.edit} /> }</CapButton> : ""}
|
|
109
|
+
</div>
|
|
110
|
+
}
|
|
111
|
+
/>
|
|
112
|
+
:
|
|
113
|
+
<div className={`preview-container ${this.props.type === 'embedded' ? 'embedded-preview' : ''}`}>
|
|
114
|
+
<div className="shell align-center" id="sms-preview">
|
|
115
|
+
<div className="wechatMsgContainerCardLayout">
|
|
116
|
+
<div>{this.prepareCardLayoutPreviewData(this.props.content)}
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
WechatRichmediaTemplatePreview.propTypes = {
|
|
126
|
+
showSlidebox: PropTypes.bool,
|
|
127
|
+
show: PropTypes.bool,
|
|
128
|
+
closeSlideBox: PropTypes.function,
|
|
129
|
+
templateName: PropTypes.string,
|
|
130
|
+
type: PropTypes.string,
|
|
131
|
+
content: PropTypes.array,
|
|
132
|
+
onEditClick: PropTypes.func,
|
|
133
|
+
showEdit: PropTypes.bool,
|
|
134
|
+
path: PropTypes.string,
|
|
135
|
+
templateId: PropTypes.string,
|
|
136
|
+
modeType: PropTypes.string,
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export default WechatRichmediaTemplatePreview;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* WechatRichmediaTemplatePreview Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the WechatRichmediaTemplatePreview component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
header: {
|
|
10
|
+
id: 'app.components.WechatRichmediaTemplatePreview.header',
|
|
11
|
+
defaultMessage: 'This is the WechatRichmediaTemplatePreview component !',
|
|
12
|
+
},
|
|
13
|
+
select: {
|
|
14
|
+
id: 'app.components.WechatRichmediaTemplatePreview.select',
|
|
15
|
+
defaultMessage: 'Select',
|
|
16
|
+
},
|
|
17
|
+
edit: {
|
|
18
|
+
id: 'app.components.WechatRichmediaTemplatePreview.edit',
|
|
19
|
+
defaultMessage: 'Edit',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// import React from 'react';
|
|
2
|
+
// import { shallow } from 'enzyme';
|
|
3
|
+
|
|
4
|
+
// import WechatRichmediaTemplatePreview from '../index';
|
|
5
|
+
|
|
6
|
+
describe('<WechatRichmediaTemplatePreview />', () => {
|
|
7
|
+
it('Expect to have unit tests specified', () => {
|
|
8
|
+
expect(true).toEqual(false);
|
|
9
|
+
});
|
|
10
|
+
});
|