@capillarytech/creatives-library 2.0.82 → 2.0.84

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.
Files changed (177) hide show
  1. package/assets/android-message-gui-2.svg +55 -0
  2. package/components/CapTagList/index.js +24 -21
  3. package/components/CardGrid/index.js +10 -16
  4. package/components/Ckeditor/index.js +1 -2
  5. package/components/CustomPopOver/index.js +1 -1
  6. package/components/EmailPreview/index.js +2 -3
  7. package/components/FormBuilder/_formBuilder.scss +15 -8
  8. package/components/FormBuilder/index.js +194 -260
  9. package/components/Header/index.js +1 -4
  10. package/components/PreviewSideBar/_previewsidebar.scss +1 -1
  11. package/components/PreviewSideBar/index.js +5 -3
  12. package/components/SmsPreviewV2/_smsPreviewV2.scss +353 -0
  13. package/components/SmsPreviewV2/index.js +69 -0
  14. package/components/SmsPreviewV2/messages.js +13 -0
  15. package/components/SmsPreviewV2/tests/index.test.js +10 -0
  16. package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +3 -2
  17. package/components/TemplatePreview/_templatePreview.scss +1 -1
  18. package/components/TemplatePreview/index.js +47 -47
  19. package/components/TemplatePreview/messages.js +1 -9
  20. package/containers/Assets/Gallery/index.js +1 -1
  21. package/containers/Email/index.js +1 -1
  22. package/containers/Login/components/LoginForm/index.js +1 -1
  23. package/containers/Templates/index.js +1 -1
  24. package/containers/WeChat/RichmediaTemplates/Create/index.js +1 -1
  25. package/package.json +2 -1
  26. package/v2Components/BreadCrumbs/index.js +65 -0
  27. package/v2Components/BreadCrumbs/messages.js +13 -0
  28. package/v2Components/BreadCrumbs/tests/index.test.js +10 -0
  29. package/v2Components/CallTaskPreview/_callTaskPreview.scss +17 -0
  30. package/v2Components/CallTaskPreview/images/Footer.png +0 -0
  31. package/v2Components/CallTaskPreview/images/Header.png +0 -0
  32. package/v2Components/CallTaskPreview/index.js +37 -0
  33. package/v2Components/CallTaskPreview/messages.js +13 -0
  34. package/v2Components/CallTaskPreview/tests/index.test.js +15 -0
  35. package/v2Components/CapTagList/index.js +232 -0
  36. package/v2Components/CapTagList/messages.js +25 -0
  37. package/v2Components/CapTagList/tests/index.test.js +10 -0
  38. package/v2Components/Card/_customCard.scss +27 -0
  39. package/v2Components/Card/index.js +78 -0
  40. package/{containers/WeChat → v2Components/Card}/tests/index.test.js +2 -2
  41. package/v2Components/CardGrid/index.js +77 -0
  42. package/v2Components/CardGrid/tests/index.test.js +10 -0
  43. package/v2Components/Ckeditor/index.js +234 -0
  44. package/v2Components/Ckeditor/messages.js +13 -0
  45. package/v2Components/Ckeditor/tests/index.test.js +10 -0
  46. package/v2Components/CmsTemplatesComponent/index.js +33 -0
  47. package/v2Components/CmsTemplatesComponent/messages.js +17 -0
  48. package/v2Components/CmsTemplatesComponent/tests/index.test.js +10 -0
  49. package/v2Components/Component/index.js +29 -0
  50. package/v2Components/Component/tests/index.test.js +10 -0
  51. package/v2Components/CustomPopOver/index.js +82 -0
  52. package/v2Components/CustomPopOver/messages.js +13 -0
  53. package/v2Components/CustomPopOver/tests/index.test.js +10 -0
  54. package/v2Components/DateFilter/index.js +349 -0
  55. package/v2Components/DateFilter/messages.js +17 -0
  56. package/v2Components/DateFilter/tests/index.test.js +15 -0
  57. package/v2Components/DateRange/index.js +113 -0
  58. package/v2Components/DateRange/messages.js +13 -0
  59. package/v2Components/DateRange/tests/index.test.js +10 -0
  60. package/v2Components/Edmeditor/index.js +65 -0
  61. package/v2Components/Edmeditor/messages.js +13 -0
  62. package/v2Components/Edmeditor/tests/index.test.js +10 -0
  63. package/v2Components/EmailMobilePreview/index.js +129 -0
  64. package/v2Components/EmailMobilePreview/index.scss +55 -0
  65. package/v2Components/EmailPreview/_emailPreview.scss +119 -0
  66. package/v2Components/EmailPreview/index.js +106 -0
  67. package/v2Components/EmailPreview/messages.js +17 -0
  68. package/v2Components/EmailPreview/tests/index.test.js +10 -0
  69. package/v2Components/EmailPreviewV2/_emailPreviewV2.scss +69 -0
  70. package/v2Components/EmailPreviewV2/index.js +132 -0
  71. package/v2Components/EmailPreviewV2/messages.js +41 -0
  72. package/v2Components/EmailPreviewV2/tests/index.test.js +10 -0
  73. package/v2Components/Footer/index.js +27 -0
  74. package/v2Components/Footer/messages.js +13 -0
  75. package/v2Components/Footer/tests/index.test.js +10 -0
  76. package/v2Components/FormBuilder/_formBuilder.scss +78 -0
  77. package/v2Components/FormBuilder/index.js +3309 -0
  78. package/v2Components/FormBuilder/messages.js +13 -0
  79. package/v2Components/FormBuilder/tests/index.test.js +10 -0
  80. package/v2Components/Header/index.js +46 -0
  81. package/v2Components/Header/messages.js +25 -0
  82. package/v2Components/Header/tests/index.test.js +10 -0
  83. package/v2Components/ImagePreview/_imagePreview.scss +63 -0
  84. package/v2Components/ImagePreview/index.js +52 -0
  85. package/v2Components/ImagePreview/messages.js +13 -0
  86. package/v2Components/ImagePreview/tests/index.test.js +10 -0
  87. package/v2Components/MobilePushPreviewV2/index.js +120 -0
  88. package/v2Components/MobilePushPreviewV2/messages.js +13 -0
  89. package/v2Components/MobilePushPreviewV2/tests/index.test.js +10 -0
  90. package/v2Components/NewCallTask/_newCallTask.scss +9 -0
  91. package/v2Components/NewCallTask/index.js +152 -0
  92. package/v2Components/NewCallTask/messages.js +29 -0
  93. package/v2Components/NewCallTask/tests/index.test.js +10 -0
  94. package/v2Components/PageHeader/_pageHeader.scss +22 -0
  95. package/v2Components/PageHeader/index.js +37 -0
  96. package/v2Components/PageHeader/messages.js +13 -0
  97. package/v2Components/PageHeader/tests/index.test.js +10 -0
  98. package/v2Components/Pagination/_pagination.scss +5 -0
  99. package/v2Components/Pagination/index.js +49 -0
  100. package/v2Components/Pagination/tests/index.test.js +10 -0
  101. package/v2Components/PreviewSideBar/_previewsidebar.scss +28 -0
  102. package/v2Components/PreviewSideBar/index.js +150 -0
  103. package/v2Components/PreviewSideBar/messages.js +33 -0
  104. package/v2Components/PreviewSideBar/tests/index.test.js +10 -0
  105. package/v2Components/Sidebar/_sidebar.scss +115 -0
  106. package/v2Components/Sidebar/index.js +208 -0
  107. package/v2Components/Sidebar/messages.js +21 -0
  108. package/v2Components/Sidebar/tests/index.test.js +10 -0
  109. package/v2Components/SlideBox/_slideBox.scss +63 -0
  110. package/v2Components/SlideBox/index.js +48 -0
  111. package/v2Components/SlideBox/tests/index.test.js +103 -0
  112. package/v2Components/SmsEditor/index.js +55 -0
  113. package/v2Components/SmsEditor/tests/index.test.js +10 -0
  114. package/v2Components/SmsTest/index.js +115 -0
  115. package/v2Components/SmsTest/messages.js +13 -0
  116. package/v2Components/SmsTest/tests/index.test.js +10 -0
  117. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +42 -0
  118. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +139 -0
  119. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +21 -0
  120. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -0
  121. package/v2Components/TemplatePreview/_templatePreview.scss +352 -0
  122. package/v2Components/TemplatePreview/assets/images/WECHAT_5x.png +0 -0
  123. package/v2Components/TemplatePreview/assets/images/androidPushMessage.svg +45 -0
  124. package/v2Components/TemplatePreview/assets/images/iPhonePushMessage.svg +135 -0
  125. package/v2Components/TemplatePreview/assets/images/mobile.svg +24 -0
  126. package/v2Components/TemplatePreview/assets/images/sms-body.png +0 -0
  127. package/v2Components/TemplatePreview/assets/images/sms-icon.png +0 -0
  128. package/v2Components/TemplatePreview/assets/images/sms_mobile.png +0 -0
  129. package/v2Components/TemplatePreview/assets/images/user-icon.svg +19 -0
  130. package/v2Components/TemplatePreview/assets/images/wechat-mobile.svg +78 -0
  131. package/v2Components/TemplatePreview/index.js +175 -0
  132. package/v2Components/TemplatePreview/messages.js +37 -0
  133. package/v2Components/TemplatePreview/tests/index.test.js +10 -0
  134. package/v2Components/Toastr/index.js +60 -0
  135. package/v2Components/Toastr/messages.js +13 -0
  136. package/v2Components/Toastr/tests/index.test.js +10 -0
  137. package/v2Components/ToastrMessage/index.js +110 -0
  138. package/v2Components/ToastrMessage/messages.js +13 -0
  139. package/v2Components/ToastrMessage/tests/index.test.js +10 -0
  140. package/v2Components/TopBar/_topbar.scss +46 -0
  141. package/v2Components/TopBar/assets/images/capillary_logo.png +0 -0
  142. package/v2Components/TopBar/index.js +113 -0
  143. package/v2Components/TopBar/messages.js +29 -0
  144. package/v2Components/TopBar/tests/index.test.js +10 -0
  145. package/v2Containers/Assets/Gallery/index.js +1 -1
  146. package/v2Containers/CallTask/index.js +1 -1
  147. package/v2Containers/Cap/index.js +2 -2
  148. package/v2Containers/CreativesContainer/SlideBoxContent.js +3 -3
  149. package/v2Containers/CreativesContainer/index.js +1 -0
  150. package/v2Containers/Dashboard/index.js +2 -2
  151. package/v2Containers/Ebill/index.js +2 -2
  152. package/v2Containers/Email/index.js +4 -4
  153. package/v2Containers/EmailWrapper/index.js +1 -1
  154. package/v2Containers/Line/Create/index.js +1 -1
  155. package/v2Containers/Line/Edit/index.js +1 -1
  156. package/v2Containers/Login/index.js +1 -1
  157. package/v2Containers/MobilePush/Create/index.js +1 -1
  158. package/v2Containers/MobilePush/Edit/index.js +1 -1
  159. package/v2Containers/Sms/Create/index.js +1 -1
  160. package/v2Containers/Sms/Edit/index.js +1 -1
  161. package/v2Containers/TagList/index.js +1 -1
  162. package/v2Containers/Templates/index.js +4 -4
  163. package/v2Containers/TestPage/index.js +1 -1
  164. package/v2Containers/WeChat/MapTemplates/index.js +3 -3
  165. package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +3 -3
  166. package/containers/WeChat/_wechat.scss +0 -8
  167. package/containers/WeChat/actions.js +0 -46
  168. package/containers/WeChat/constants.js +0 -28
  169. package/containers/WeChat/index.js +0 -1617
  170. package/containers/WeChat/messages.js +0 -73
  171. package/containers/WeChat/reducer.js +0 -74
  172. package/containers/WeChat/sagas.js +0 -86
  173. package/containers/WeChat/selectors.js +0 -25
  174. package/containers/WeChat/tests/actions.test.js +0 -18
  175. package/containers/WeChat/tests/reducer.test.js +0 -9
  176. package/containers/WeChat/tests/sagas.test.js +0 -15
  177. 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,10 @@
1
+ // import React from 'react';
2
+ // import { shallow } from 'enzyme';
3
+
4
+ // import SmsEditor from '../index';
5
+
6
+ // describe('<SmsEditor />', () => {
7
+ // it('Expect to have unit tests specified', () => {
8
+ // expect(true).toEqual(false);
9
+ // });
10
+ // });
@@ -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,10 @@
1
+ // import React from 'react';
2
+ // import { shallow } from 'enzyme';
3
+
4
+ // import SmsTest from '../index';
5
+
6
+ // describe('<SmsTest />', () => {
7
+ // it('Expect to have unit tests specified', () => {
8
+ // expect(true).toEqual(false);
9
+ // });
10
+ // });
@@ -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
+ });