@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.
Files changed (241) hide show
  1. package/components/CapTagList/index.js +24 -21
  2. package/components/CardGrid/index.js +10 -16
  3. package/components/Ckeditor/index.js +1 -2
  4. package/components/CustomPopOver/index.js +1 -1
  5. package/components/EmailPreview/index.js +2 -3
  6. package/components/FormBuilder/_formBuilder.scss +15 -8
  7. package/components/FormBuilder/index.js +192 -258
  8. package/components/Header/index.js +1 -4
  9. package/components/PreviewSideBar/_previewsidebar.scss +1 -1
  10. package/components/PreviewSideBar/index.js +5 -3
  11. package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +3 -2
  12. package/components/TemplatePreview/_templatePreview.scss +1 -1
  13. package/components/TemplatePreview/index.js +47 -47
  14. package/components/TemplatePreview/messages.js +1 -9
  15. package/containers/Assets/Gallery/index.js +1 -1
  16. package/containers/Email/index.js +1 -1
  17. package/containers/Login/components/LoginForm/index.js +1 -1
  18. package/containers/Templates/index.js +1 -1
  19. package/containers/WeChat/RichmediaTemplates/Create/index.js +1 -1
  20. package/package.json +2 -1
  21. package/v2Components/BreadCrumbs/index.js +65 -0
  22. package/v2Components/BreadCrumbs/messages.js +13 -0
  23. package/v2Components/BreadCrumbs/tests/index.test.js +10 -0
  24. package/v2Components/CallTaskPreview/_callTaskPreview.scss +17 -0
  25. package/v2Components/CallTaskPreview/images/Footer.png +0 -0
  26. package/v2Components/CallTaskPreview/images/Header.png +0 -0
  27. package/v2Components/CallTaskPreview/index.js +37 -0
  28. package/v2Components/CallTaskPreview/messages.js +13 -0
  29. package/v2Components/CallTaskPreview/tests/index.test.js +15 -0
  30. package/v2Components/CapTagList/index.js +232 -0
  31. package/v2Components/CapTagList/messages.js +25 -0
  32. package/{containers/TemplatesV2 → v2Components/CapTagList}/tests/index.test.js +2 -2
  33. package/v2Components/Card/_customCard.scss +27 -0
  34. package/v2Components/Card/index.js +78 -0
  35. package/{containers/WeChat → v2Components/Card}/tests/index.test.js +2 -2
  36. package/v2Components/CardGrid/index.js +77 -0
  37. package/{containers/EmailWrapper → v2Components/CardGrid}/tests/index.test.js +2 -2
  38. package/v2Components/Ckeditor/index.js +234 -0
  39. package/v2Components/Ckeditor/messages.js +13 -0
  40. package/{containers/ChannelTemplates → v2Components/Ckeditor}/tests/index.test.js +2 -2
  41. package/v2Components/CmsTemplatesComponent/index.js +33 -0
  42. package/v2Components/CmsTemplatesComponent/messages.js +17 -0
  43. package/v2Components/CmsTemplatesComponent/tests/index.test.js +10 -0
  44. package/v2Components/Component/index.js +29 -0
  45. package/v2Components/Component/tests/index.test.js +10 -0
  46. package/v2Components/CustomPopOver/index.js +82 -0
  47. package/v2Components/CustomPopOver/messages.js +13 -0
  48. package/v2Components/CustomPopOver/tests/index.test.js +10 -0
  49. package/v2Components/DateFilter/index.js +349 -0
  50. package/v2Components/DateFilter/messages.js +17 -0
  51. package/v2Components/DateFilter/tests/index.test.js +15 -0
  52. package/v2Components/DateRange/index.js +113 -0
  53. package/v2Components/DateRange/messages.js +13 -0
  54. package/v2Components/DateRange/tests/index.test.js +10 -0
  55. package/v2Components/Edmeditor/index.js +65 -0
  56. package/v2Components/Edmeditor/messages.js +13 -0
  57. package/v2Components/Edmeditor/tests/index.test.js +10 -0
  58. package/v2Components/EmailMobilePreview/index.js +129 -0
  59. package/v2Components/EmailMobilePreview/index.scss +55 -0
  60. package/v2Components/EmailPreview/_emailPreview.scss +119 -0
  61. package/v2Components/EmailPreview/index.js +106 -0
  62. package/v2Components/EmailPreview/messages.js +17 -0
  63. package/v2Components/EmailPreview/tests/index.test.js +10 -0
  64. package/v2Components/EmailPreviewV2/_emailPreviewV2.scss +69 -0
  65. package/v2Components/EmailPreviewV2/index.js +132 -0
  66. package/v2Components/EmailPreviewV2/messages.js +41 -0
  67. package/v2Components/EmailPreviewV2/tests/index.test.js +10 -0
  68. package/v2Components/Footer/index.js +27 -0
  69. package/v2Components/Footer/messages.js +13 -0
  70. package/v2Components/Footer/tests/index.test.js +10 -0
  71. package/v2Components/FormBuilder/_formBuilder.scss +78 -0
  72. package/v2Components/FormBuilder/index.js +3309 -0
  73. package/v2Components/FormBuilder/messages.js +13 -0
  74. package/v2Components/FormBuilder/tests/index.test.js +10 -0
  75. package/v2Components/Header/index.js +46 -0
  76. package/v2Components/Header/messages.js +25 -0
  77. package/v2Components/Header/tests/index.test.js +10 -0
  78. package/v2Components/ImagePreview/_imagePreview.scss +63 -0
  79. package/v2Components/ImagePreview/index.js +52 -0
  80. package/v2Components/ImagePreview/messages.js +13 -0
  81. package/v2Components/ImagePreview/tests/index.test.js +10 -0
  82. package/v2Components/MobilePushPreviewV2/index.js +120 -0
  83. package/v2Components/MobilePushPreviewV2/messages.js +13 -0
  84. package/{containers/MobilepushWrapper → v2Components/MobilePushPreviewV2}/tests/index.test.js +2 -2
  85. package/v2Components/NewCallTask/_newCallTask.scss +9 -0
  86. package/v2Components/NewCallTask/index.js +152 -0
  87. package/v2Components/NewCallTask/messages.js +29 -0
  88. package/{containers/CallTask → v2Components/NewCallTask}/tests/index.test.js +2 -2
  89. package/v2Components/PageHeader/_pageHeader.scss +22 -0
  90. package/v2Components/PageHeader/index.js +37 -0
  91. package/v2Components/PageHeader/messages.js +13 -0
  92. package/v2Components/PageHeader/tests/index.test.js +10 -0
  93. package/v2Components/Pagination/_pagination.scss +5 -0
  94. package/v2Components/Pagination/index.js +49 -0
  95. package/v2Components/Pagination/tests/index.test.js +10 -0
  96. package/v2Components/PreviewSideBar/_previewsidebar.scss +28 -0
  97. package/v2Components/PreviewSideBar/index.js +150 -0
  98. package/v2Components/PreviewSideBar/messages.js +33 -0
  99. package/v2Components/PreviewSideBar/tests/index.test.js +10 -0
  100. package/v2Components/Sidebar/_sidebar.scss +115 -0
  101. package/v2Components/Sidebar/index.js +208 -0
  102. package/v2Components/Sidebar/messages.js +21 -0
  103. package/v2Components/Sidebar/tests/index.test.js +10 -0
  104. package/v2Components/SlideBox/_slideBox.scss +63 -0
  105. package/v2Components/SlideBox/index.js +48 -0
  106. package/v2Components/SlideBox/tests/index.test.js +103 -0
  107. package/v2Components/SmsEditor/index.js +55 -0
  108. package/v2Components/SmsEditor/tests/index.test.js +10 -0
  109. package/v2Components/SmsTest/index.js +115 -0
  110. package/v2Components/SmsTest/messages.js +13 -0
  111. package/v2Components/SmsTest/tests/index.test.js +10 -0
  112. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +42 -0
  113. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +139 -0
  114. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +21 -0
  115. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -0
  116. package/v2Components/TemplatePreview/_templatePreview.scss +352 -0
  117. package/v2Components/TemplatePreview/assets/images/WECHAT_5x.png +0 -0
  118. package/v2Components/TemplatePreview/assets/images/androidPushMessage.svg +45 -0
  119. package/v2Components/TemplatePreview/assets/images/iPhonePushMessage.svg +135 -0
  120. package/v2Components/TemplatePreview/assets/images/mobile.svg +24 -0
  121. package/v2Components/TemplatePreview/assets/images/sms-body.png +0 -0
  122. package/v2Components/TemplatePreview/assets/images/sms-icon.png +0 -0
  123. package/v2Components/TemplatePreview/assets/images/sms_mobile.png +0 -0
  124. package/v2Components/TemplatePreview/assets/images/user-icon.svg +19 -0
  125. package/v2Components/TemplatePreview/assets/images/wechat-mobile.svg +78 -0
  126. package/v2Components/TemplatePreview/index.js +175 -0
  127. package/v2Components/TemplatePreview/messages.js +37 -0
  128. package/v2Components/TemplatePreview/tests/index.test.js +10 -0
  129. package/v2Components/Toastr/index.js +60 -0
  130. package/v2Components/Toastr/messages.js +13 -0
  131. package/v2Components/Toastr/tests/index.test.js +10 -0
  132. package/v2Components/ToastrMessage/index.js +110 -0
  133. package/v2Components/ToastrMessage/messages.js +13 -0
  134. package/v2Components/ToastrMessage/tests/index.test.js +10 -0
  135. package/v2Components/TopBar/_topbar.scss +46 -0
  136. package/v2Components/TopBar/assets/images/capillary_logo.png +0 -0
  137. package/v2Components/TopBar/index.js +113 -0
  138. package/v2Components/TopBar/messages.js +29 -0
  139. package/v2Components/TopBar/tests/index.test.js +10 -0
  140. package/v2Containers/Assets/Gallery/index.js +1 -1
  141. package/v2Containers/CallTask/index.js +1 -1
  142. package/v2Containers/Cap/index.js +2 -2
  143. package/v2Containers/CreativesContainer/SlideBoxContent.js +3 -3
  144. package/v2Containers/CreativesContainer/index.js +1 -0
  145. package/v2Containers/Dashboard/index.js +2 -2
  146. package/v2Containers/Ebill/index.js +2 -2
  147. package/v2Containers/Email/index.js +13 -13
  148. package/v2Containers/EmailWrapper/index.js +1 -1
  149. package/v2Containers/Line/Create/index.js +1 -1
  150. package/v2Containers/Line/Edit/index.js +1 -1
  151. package/v2Containers/Login/index.js +1 -1
  152. package/v2Containers/MobilePush/Create/index.js +26 -3
  153. package/v2Containers/MobilePush/Edit/index.js +32 -7
  154. package/v2Containers/MobilePush/initialSchema.js +2 -0
  155. package/v2Containers/Sms/Create/index.js +1 -1
  156. package/v2Containers/Sms/Edit/index.js +1 -1
  157. package/v2Containers/TagList/index.js +1 -1
  158. package/v2Containers/Templates/index.js +4 -4
  159. package/v2Containers/TestPage/index.js +1 -1
  160. package/v2Containers/WeChat/MapTemplates/index.js +3 -3
  161. package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +3 -3
  162. package/components/FormBuilder/test +0 -1845
  163. package/containers/CallTask/_callTask.scss +0 -5
  164. package/containers/CallTask/actions.js +0 -15
  165. package/containers/CallTask/constants.js +0 -7
  166. package/containers/CallTask/index.js +0 -141
  167. package/containers/CallTask/messages.js +0 -21
  168. package/containers/CallTask/reducer.js +0 -23
  169. package/containers/CallTask/sagas.js +0 -11
  170. package/containers/CallTask/selectors.js +0 -25
  171. package/containers/CallTask/tests/actions.test.js +0 -18
  172. package/containers/CallTask/tests/reducer.test.js +0 -9
  173. package/containers/CallTask/tests/sagas.test.js +0 -15
  174. package/containers/CallTask/tests/selectors.test.js +0 -10
  175. package/containers/ChannelTemplates/actions.js +0 -20
  176. package/containers/ChannelTemplates/constants.js +0 -8
  177. package/containers/ChannelTemplates/index.js +0 -48
  178. package/containers/ChannelTemplates/messages.js +0 -13
  179. package/containers/ChannelTemplates/reducer.js +0 -34
  180. package/containers/ChannelTemplates/sagas.js +0 -32
  181. package/containers/ChannelTemplates/selectors.js +0 -25
  182. package/containers/ChannelTemplates/tests/actions.test.js +0 -18
  183. package/containers/ChannelTemplates/tests/reducer.test.js +0 -9
  184. package/containers/ChannelTemplates/tests/sagas.test.js +0 -15
  185. package/containers/ChannelTemplates/tests/selectors.test.js +0 -10
  186. package/containers/CreativesContainer/SlideBoxContent.js +0 -248
  187. package/containers/CreativesContainer/SlideBoxFooter.js +0 -38
  188. package/containers/CreativesContainer/SlideBoxHeader.js +0 -65
  189. package/containers/CreativesContainer/actions.js +0 -27
  190. package/containers/CreativesContainer/constants.js +0 -13
  191. package/containers/CreativesContainer/index.js +0 -418
  192. package/containers/CreativesContainer/index.scss +0 -27
  193. package/containers/CreativesContainer/messages.js +0 -17
  194. package/containers/CreativesContainer/reducer.js +0 -29
  195. package/containers/CreativesContainer/sagas.js +0 -11
  196. package/containers/CreativesContainer/selectors.js +0 -30
  197. package/containers/CreativesContainer/tests/actions.test.js +0 -18
  198. package/containers/CreativesContainer/tests/index.test.js +0 -10
  199. package/containers/CreativesContainer/tests/reducer.test.js +0 -9
  200. package/containers/CreativesContainer/tests/sagas.test.js +0 -15
  201. package/containers/CreativesContainer/tests/selectors.test.js +0 -10
  202. package/containers/EmailWrapper/actions.js +0 -15
  203. package/containers/EmailWrapper/constants.js +0 -7
  204. package/containers/EmailWrapper/index.js +0 -238
  205. package/containers/EmailWrapper/messages.js +0 -57
  206. package/containers/EmailWrapper/reducer.js +0 -23
  207. package/containers/EmailWrapper/sagas.js +0 -11
  208. package/containers/EmailWrapper/selectors.js +0 -25
  209. package/containers/EmailWrapper/tests/actions.test.js +0 -18
  210. package/containers/EmailWrapper/tests/reducer.test.js +0 -9
  211. package/containers/EmailWrapper/tests/sagas.test.js +0 -15
  212. package/containers/EmailWrapper/tests/selectors.test.js +0 -10
  213. package/containers/MobilePush/commonMethods.js +0 -249
  214. package/containers/MobilePush/eventsMap.js +0 -127
  215. package/containers/MobilePush/initialSchema.js +0 -1739
  216. package/containers/MobilepushWrapper/_mobilepushWrapper.scss +0 -18
  217. package/containers/MobilepushWrapper/index.js +0 -97
  218. package/containers/MobilepushWrapper/messages.js +0 -25
  219. package/containers/TemplatesV2/_templatesV2.scss +0 -5
  220. package/containers/TemplatesV2/actions.js +0 -16
  221. package/containers/TemplatesV2/constants.js +0 -10
  222. package/containers/TemplatesV2/index.js +0 -207
  223. package/containers/TemplatesV2/messages.js +0 -29
  224. package/containers/TemplatesV2/selectors.js +0 -25
  225. package/containers/TemplatesV2/tests/actions.test.js +0 -18
  226. package/containers/TemplatesV2/tests/reducer.test.js +0 -9
  227. package/containers/TemplatesV2/tests/sagas.test.js +0 -15
  228. package/containers/TemplatesV2/tests/selectors.test.js +0 -10
  229. package/containers/WeChat/RichmediaTemplates/Create/testschema.js +0 -379
  230. package/containers/WeChat/_wechat.scss +0 -8
  231. package/containers/WeChat/actions.js +0 -52
  232. package/containers/WeChat/constants.js +0 -28
  233. package/containers/WeChat/index.js +0 -1635
  234. package/containers/WeChat/messages.js +0 -73
  235. package/containers/WeChat/reducer.js +0 -74
  236. package/containers/WeChat/sagas.js +0 -86
  237. package/containers/WeChat/selectors.js +0 -25
  238. package/containers/WeChat/tests/actions.test.js +0 -18
  239. package/containers/WeChat/tests/reducer.test.js +0 -9
  240. package/containers/WeChat/tests/sagas.test.js +0 -15
  241. package/containers/WeChat/tests/selectors.test.js +0 -10
@@ -0,0 +1,129 @@
1
+ /**
2
+ *
3
+ * EmailPreviewV2
4
+ *
5
+ */
6
+
7
+ import React from 'react';
8
+ // import styled from 'styled-components';
9
+ import PropTypes from 'prop-types';
10
+ import { FormattedMessage } from 'react-intl';
11
+ import {isEmpty} from 'lodash';
12
+ import { connect } from 'react-redux';
13
+ import { bindActionCreators } from 'redux';
14
+ import { createStructuredSelector } from 'reselect';
15
+ import { CapSpin, CapButton } from '@capillarytech/cap-ui-library';
16
+ import moment from 'moment';
17
+ import EmailPreviewV2 from '../EmailPreviewV2';
18
+ import messages from '../EmailPreviewV2/messages';
19
+ import './index.scss';
20
+ import mobileBody from '../../assets/mobile.png';
21
+
22
+ import {selectTemplateContent} from '../../containers/Templates/selectors';
23
+ import * as templateActions from '../../containers/Templates/actions';
24
+
25
+ const deviceAspectRatio = {
26
+ mobile: {
27
+ height: "440",
28
+ width: "230",
29
+ },
30
+ };
31
+
32
+ class EmailMobilePreview extends React.Component {
33
+ constructor() {
34
+ super();
35
+ this.state = {
36
+ showAllDevices: false,
37
+ };
38
+ }
39
+ componentWillMount() {
40
+ const {templateData, templateContent} = this.props;
41
+ if (isEmpty(templateContent) && !isEmpty(templateData) && templateData._id) { // templateData: comes from templates list email preview
42
+ this.props.templateActions.getTemplateDetails(templateData._id); // templateContent: html data to be shown in iframe
43
+ }
44
+ }
45
+ onClickShowInAllDevices = () => {
46
+ const { onClickShowInAllDevices } = this.props;
47
+ if (onClickShowInAllDevices) {
48
+ onClickShowInAllDevices();
49
+ } else {
50
+ this.setState({
51
+ showAllDevices: true,
52
+ });
53
+ }
54
+ }
55
+ render() {
56
+ const messageContainerName = 'mobile-message-container';
57
+ const {
58
+ templateContent,
59
+ enableShowAllDevices,
60
+ } = this.props;
61
+ const { showAllDevices } = this.state;
62
+
63
+ return (
64
+ <div className="email-mobile-preview-container">
65
+ {showAllDevices ? (
66
+ <EmailPreviewV2 {...this.props} />
67
+ ) : (
68
+ <CapSpin spinning={!templateContent}>
69
+ <div id="emailPreivew-container">
70
+ <div id="emailPreivew-content-wrapper">
71
+ <div id="emailPreivew-content">
72
+ <div className="email-preview-container">
73
+ {enableShowAllDevices && (
74
+ <CapButton
75
+ type="flat"
76
+ onClick={this.onClickShowInAllDevices}
77
+ >
78
+ View in all devices
79
+ </CapButton>
80
+ )}
81
+ <div className={"shell align-center"}>
82
+ <img src={mobileBody} alt="capillary" width="60%" />
83
+ <div className={messageContainerName}>
84
+ <iframe srcDoc={templateContent} {...deviceAspectRatio.mobile} >
85
+ <p><FormattedMessage {...messages.noIframeSupport}/></p>
86
+ </iframe>
87
+ </div>
88
+ </div>
89
+ </div>
90
+ </div>
91
+ </div>
92
+ </div>
93
+ {this.props.templateData &&
94
+ [
95
+ <p className="preview-info"><FormattedMessage {...messages.lastModified} />: {moment(this.props.templateData.updatedAt).format('MM-DD-YYYY')}</p>,
96
+ <p style={{marginBottom: '8px'}} className="preview-info"><FormattedMessage {...messages.uploadedBy} /> : {this.props.templateData.updatedByName}</p>,
97
+ ]
98
+ }
99
+ </CapSpin>
100
+ )}
101
+ </div>
102
+
103
+ );
104
+ }
105
+
106
+ }
107
+
108
+ EmailMobilePreview.propTypes = {
109
+ templateContent: PropTypes.string,
110
+ templateData: PropTypes.object,
111
+ templateActions: PropTypes.object,
112
+ onClickShowInAllDevices: PropTypes.func,
113
+ enableShowAllDevices: PropTypes.bool,
114
+ };
115
+
116
+ EmailMobilePreview.defaultProps = {
117
+ showDeviceSelection: true,
118
+ };
119
+
120
+ const mapStateToProps = (state, props) => createStructuredSelector({
121
+ templateContent: props.templateData ? selectTemplateContent() : () => props.templateContent, // when props has templateContent that means preview with content
122
+ });
123
+ function mapDispatchToProps(dispatch) {
124
+ return {
125
+ templateActions: bindActionCreators(templateActions, dispatch),
126
+ };
127
+ }
128
+
129
+ export default connect(mapStateToProps, mapDispatchToProps)(EmailMobilePreview);
@@ -0,0 +1,55 @@
1
+ $classPrefix: email-mobile-preview-container;
2
+ .#{$classPrefix}{
3
+ #emailPreivew-container {
4
+ position: relative;
5
+ // padding: 0 24px 0 24px;
6
+ overflow-y: auto;
7
+ // font-family: 'proxima-nova';
8
+ overflow: hidden;
9
+ #emailPreivew-content-wrapper{
10
+ width: 100%;
11
+ height: 90%;
12
+ // display: table;
13
+
14
+ #emailPreivew-content {
15
+ .device-wrapper {
16
+ display: inline-flex;
17
+ margin-bottom: 8px;
18
+ margin-top: 16px;
19
+ .device-name {
20
+ padding: 6px 24px;
21
+ background: #E6F0FB;
22
+ border: 2px solid #E6F0FB;
23
+ font-family: "open-sans";
24
+ line-height: 20px;
25
+ font-size: 14px;
26
+ color: #4E92E5;
27
+ cursor: pointer;
28
+ }
29
+ .active {
30
+ background: #FFFFFF !important;
31
+ border: 2px solid #E6F0FB;
32
+ }
33
+
34
+ }
35
+ .email-preview-container{
36
+
37
+ .mobile-message-container {
38
+ position: absolute;
39
+ top: 10.3%;
40
+ left: 24%;
41
+ overflow: auto;
42
+ display: -webkit-box;
43
+ display: -ms-flexbox;
44
+ display: flex;
45
+ }
46
+ }
47
+ padding: 0 0px 0 24px;
48
+ // display: table-cell;
49
+ // vertical-align: middle;
50
+ text-align: center;
51
+ margin-bottom: 36px;
52
+ }
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,119 @@
1
+ .modal-emailPreivew-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
+ #emailPreivew-container {
11
+ position: relative;
12
+ left: 20vw;
13
+ width: 80vw;
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
+ overflow: hidden;
20
+
21
+ .emailPreivew-header {
22
+ display: inline-flex;
23
+ width: 100%;
24
+ padding: 16px 24px;
25
+ -webkit-box-shadow: 0px 0px 4px 2px rgba(0,0,0,0.12);
26
+ -moz-box-shadow: 0px 0px 4px 2px rgba(0,0,0,0.12);
27
+ box-shadow: 0px 0px 4px 2px rgba(0,0,0,0.12);
28
+ margin-bottom: 6px;
29
+ height: 56px;
30
+ align-items: center;
31
+ .heading-title {
32
+ font-size: 20px;
33
+ line-height: 24px;
34
+ font-weight: 600;
35
+ width: 97%;
36
+ text-overflow: ellipsis;
37
+ overflow: hidden;
38
+ white-space: nowrap;
39
+
40
+ &:first-letter{
41
+ text-transform: capitalize;
42
+ }
43
+ }
44
+ .close-emailPreivew{
45
+ cursor: pointer;
46
+ }
47
+ }
48
+
49
+ #emailPreivew-content-wrapper{
50
+ width: 100%;
51
+ height: 90%;
52
+ overflow: auto;
53
+ // display: table;
54
+
55
+ #emailPreivew-content {
56
+ .device-wrapper {
57
+ display: inline-flex;
58
+ margin-bottom: 8px;
59
+ margin-top: 16px;
60
+ .device-name {
61
+ padding: 6px 24px;
62
+ background: #E6F0FB;
63
+ border: 2px solid #E6F0FB;
64
+ font-family: "open-sans";
65
+ line-height: 20px;
66
+ font-size: 14px;
67
+ color: #4E92E5;
68
+ cursor: pointer;
69
+ }
70
+ .active {
71
+ background: #FFFFFF !important;
72
+ border: 2px solid #E6F0FB;
73
+ }
74
+
75
+ }
76
+ .email-preview-container{
77
+ .tablet-message-container {
78
+ position: absolute;
79
+ top: 9%;
80
+ left: 10%;
81
+ width: 100%;
82
+ height: 100%;
83
+ overflow: auto;
84
+ display: -webkit-box;
85
+ display: -ms-flexbox;
86
+ display: flex;
87
+ }
88
+ .mobile-message-container {
89
+ position: absolute;
90
+ top: 10.3%;
91
+ left: 14%;
92
+ width: 100%;
93
+ height: 100%;
94
+ overflow: auto;
95
+ display: -webkit-box;
96
+ display: -ms-flexbox;
97
+ display: flex;
98
+ }
99
+ }
100
+ padding: 0 0px 0 24px;
101
+ // display: table-cell;
102
+ // vertical-align: middle;
103
+ text-align: center;
104
+ margin-bottom: 36px;
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+ .show-emailPreivew {
111
+ visibility: visible;
112
+ opacity: 1;
113
+ transition: visibility 1s linear 0.33s, opacity 0.33s linear;
114
+ }
115
+ .hide-emailPreivew {
116
+ visibility: hidden;
117
+ opacity: 0;
118
+ transition-delay: 0s;
119
+ }
@@ -0,0 +1,106 @@
1
+ /**
2
+ *
3
+ * EmailPreview
4
+ *
5
+ */
6
+
7
+ import PropTypes from 'prop-types';
8
+
9
+ import React from 'react';
10
+ import { FormattedMessage } from 'react-intl';
11
+ import moment from "moment";
12
+ import messages from "./messages";
13
+ import './_emailPreview.scss';
14
+ import tabletBody from '../../assets/iPad.svg';
15
+ import mobileBody from '../../assets/mobile.png';
16
+
17
+ // this component will be deprecated after replacing with the v2 component.
18
+ const deviceAspectRatio = {
19
+ desktop: {
20
+ height: "500",
21
+ width: "1024",
22
+ },
23
+ tablet: {
24
+ height: "600",
25
+ width: "520",
26
+ },
27
+ mobile: {
28
+ height: "600",
29
+ width: "320",
30
+ },
31
+ };
32
+
33
+ class EmailPreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
34
+ render() {
35
+ console.log('URL tablet', tabletBody, mobileBody);
36
+ let messageContainerName = '';
37
+ if (this.props.device === 'tablet') {
38
+ messageContainerName = 'tablet-message-container';
39
+ } else if (this.props.device === 'mobile') {
40
+ messageContainerName = 'mobile-message-container';
41
+ }
42
+
43
+ return (
44
+ <div className={this.props.show ? "modal-emailPreivew-wrapper show-emailPreivew" : "modal-emailPreivew-wrapper hide-emailPreivew"}>
45
+ <div id="emailPreivew-container">
46
+ <div className="emailPreivew-header">
47
+ <div className="heading-title">
48
+ {this.props.header}
49
+ </div>
50
+ <div id="box-actions" style={{ float: 'right' }} onClick={this.props.handleClose}>
51
+ <i className="material-icons close-emailPreivew">close</i>
52
+ </div>
53
+ </div>
54
+
55
+ <div id="emailPreivew-content-wrapper">
56
+ <div id="emailPreivew-content">
57
+ {/* {this.props.content} */}
58
+ <div className="device-wrapper">
59
+ <div onClick={() => this.props.changePreviewDevice("desktop")} className={(this.props.device.toLowerCase() === "desktop") ? "device-name active" : "device-name"}>Desktop</div>
60
+ <div onClick={() => this.props.changePreviewDevice("tablet")} className={(this.props.device.toLowerCase() === "tablet") ? "device-name active" : "device-name"}>Tablet</div>
61
+ <div onClick={() => this.props.changePreviewDevice("mobile")} className={(this.props.device.toLowerCase() === "mobile") ? "device-name active" : "device-name"}>Mobile</div>
62
+ </div>
63
+ <div className="email-preview-container">
64
+ <div className={this.props.device === 'desktop' ? '' : "shell align-center"}>
65
+ {this.props.device === 'tablet' ?
66
+ <img src={tabletBody} alt="capillary" width="520" /> : ''}
67
+ {this.props.device === 'mobile' ?
68
+ <img src={mobileBody} alt="capillary" width="85%" /> : ''}
69
+ <div className={messageContainerName}>
70
+ <iframe srcDoc={this.props.content} {...deviceAspectRatio[this.props.device]} >
71
+ <p>Your browser does not support iframes.</p>
72
+ </iframe>
73
+ </div>
74
+ </div>
75
+
76
+ {(this.props.lastModified && this.props.updatedByName) ? <div>
77
+ <p className="preview-info" style={{ marginBottom: '8px', paddingTop: '8px'}}><FormattedMessage {...messages.lastModified} />: {moment(this.props.lastModified).format('MM-DD-YYYY')}</p>
78
+ <p style={{marginBottom: '8px'}} className="preview-info"><FormattedMessage {...messages.uploadedBy} /> : {this.props.updatedByName}</p>
79
+ </div> : ''}
80
+ </div>
81
+ </div>
82
+ </div>
83
+ </div>
84
+ </div>
85
+ );
86
+ }
87
+ }
88
+
89
+ EmailPreview.propTypes = {
90
+ header: PropTypes.oneOfType([
91
+ PropTypes.element,
92
+ PropTypes.string,
93
+ ]).isRequired,
94
+ content: PropTypes.oneOfType([
95
+ PropTypes.object,
96
+ PropTypes.string,
97
+ ]),
98
+ show: PropTypes.bool,
99
+ device: PropTypes.string,
100
+ handleClose: PropTypes.func,
101
+ changePreviewDevice: PropTypes.func,
102
+ lastModified: PropTypes.string,
103
+ updatedByName: PropTypes.string,
104
+ };
105
+
106
+ export default EmailPreview;
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Edmeditor Messages
3
+ *
4
+ * This contains all the text for the Edmeditor component.
5
+ */
6
+ import { defineMessages } from 'react-intl';
7
+
8
+ export default defineMessages({
9
+ lastModified: {
10
+ id: 'app.components.EmailPreview.lastModified',
11
+ defaultMessage: 'Last Modified On',
12
+ },
13
+ uploadedBy: {
14
+ id: 'app.components.EmailPreview.uploadedBy',
15
+ defaultMessage: 'Last Modified By',
16
+ },
17
+ });
@@ -0,0 +1,10 @@
1
+ // import React from 'react';
2
+ // import { shallow } from 'enzyme';
3
+
4
+ // import EmailPreview from '../index';
5
+
6
+ describe('<EmailPreview />', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(false);
9
+ });
10
+ });
@@ -0,0 +1,69 @@
1
+ $classPrefix: email-preview-v2;
2
+ .#{$classPrefix}{
3
+ #emailPreivew-container {
4
+ position: relative;
5
+ // padding: 0 24px 0 24px;
6
+ overflow-y: auto;
7
+ // font-family: 'proxima-nova';
8
+ overflow: hidden;
9
+
10
+ #email-iframe {
11
+ width: -webkit-fill-available;
12
+ }
13
+ #emailPreivew-content-wrapper{
14
+ width: 100%;
15
+ height: 90%;
16
+ // display: table;
17
+
18
+ #emailPreivew-content {
19
+ .device-wrapper {
20
+ display: inline-flex;
21
+ margin-bottom: 8px;
22
+ margin-top: 16px;
23
+ .device-name {
24
+ padding: 6px 24px;
25
+ background: #E6F0FB;
26
+ border: 2px solid #E6F0FB;
27
+ font-family: "open-sans";
28
+ line-height: 20px;
29
+ font-size: 14px;
30
+ color: #4E92E5;
31
+ cursor: pointer;
32
+ }
33
+ .active {
34
+ background: #FFFFFF !important;
35
+ border: 2px solid #E6F0FB;
36
+ }
37
+
38
+ }
39
+ .email-preview-container{
40
+ .tablet-message-container {
41
+ position: absolute;
42
+ top: 9%;
43
+ left: 10%;
44
+ width: 100%;
45
+ height: 100%;
46
+ overflow: auto;
47
+ display: -webkit-box;
48
+ display: -ms-flexbox;
49
+ display: flex;
50
+ }
51
+ .mobile-message-container {
52
+ position: absolute;
53
+ top: 10.3%;
54
+ left: 14%;
55
+ overflow: auto;
56
+ display: -webkit-box;
57
+ display: -ms-flexbox;
58
+ display: flex;
59
+ }
60
+ }
61
+ padding: 0 0px 0 24px;
62
+ // display: table-cell;
63
+ // vertical-align: middle;
64
+ text-align: center;
65
+ margin-bottom: 36px;
66
+ }
67
+ }
68
+ }
69
+ }
@@ -0,0 +1,132 @@
1
+ /**
2
+ *
3
+ * EmailPreviewV2
4
+ *
5
+ */
6
+
7
+ import React from 'react';
8
+ // import styled from 'styled-components';
9
+ import PropTypes from 'prop-types';
10
+ import { FormattedMessage } from 'react-intl';
11
+ import {isEmpty} from 'lodash';
12
+ import { connect } from 'react-redux';
13
+ import { bindActionCreators } from 'redux';
14
+ import { createStructuredSelector } from 'reselect';
15
+ import { CapSpin } from '@capillarytech/cap-ui-library';
16
+ import moment from 'moment';
17
+ import messages from './messages';
18
+ import './_emailPreviewV2.scss';
19
+ import tabletBody from '../../assets/iPad.svg';
20
+ import mobileBody from '../../assets/mobile.png';
21
+
22
+ import {selectTemplateContent} from '../../containers/Templates/selectors';
23
+ import * as templateActions from '../../containers/Templates/actions';
24
+
25
+ const deviceAspectRatio = {
26
+ desktop: {
27
+ height: "500",
28
+ width: "1024",
29
+ },
30
+ tablet: {
31
+ height: "600",
32
+ width: "520",
33
+ },
34
+ mobile: {
35
+ height: "600",
36
+ width: "320",
37
+ },
38
+ };
39
+ const devices = {
40
+ mobile: 'mobile',
41
+ desktop: 'desktop',
42
+ tablet: 'tablet',
43
+ };
44
+ class EmailPreviewV2 extends React.Component {
45
+ constructor(props) {
46
+ super(props);
47
+ this.state = {
48
+ currentDevice: props.device || devices.desktop,
49
+ };
50
+ }
51
+ componentWillMount() {
52
+ const {templateData, templateContent} = this.props;
53
+ if (isEmpty(templateContent) && !isEmpty(templateData) && templateData._id) { // templateData: comes from templates list email preview
54
+ this.props.templateActions.getTemplateDetails(templateData._id); // templateContent: html data to be shown in iframe
55
+ }
56
+ }
57
+ componentWillUnmount() {
58
+ this.props.templateActions.resetTemplateData();
59
+ }
60
+ changePreviewDevice = (ev) => {
61
+ this.setState({currentDevice: ev.currentTarget.id});
62
+ }
63
+ render() {
64
+ let messageContainerName = '';
65
+ const {currentDevice} = this.state;
66
+ const {templateContent} = this.props;
67
+
68
+ if (currentDevice === devices.tablet) {
69
+ messageContainerName = 'tablet-message-container';
70
+ } else if (currentDevice === devices.mobile) {
71
+ messageContainerName = 'mobile-message-container';
72
+ }
73
+ return (
74
+ <div className="email-preview-v2">
75
+ <CapSpin spinning={!templateContent}>
76
+ <div id="emailPreivew-container">
77
+ <div id="emailPreivew-content-wrapper">
78
+ <div id="emailPreivew-content">
79
+ <div className="device-wrapper">
80
+ <div id={devices.desktop} onClick={this.changePreviewDevice} className={`device-name ${currentDevice === devices.desktop ? 'active' : ''}`}><FormattedMessage {...messages.desktop}/></div>
81
+ <div id={devices.tablet} onClick={this.changePreviewDevice} className={`device-name ${currentDevice === devices.tablet ? 'active' : ''}`}><FormattedMessage {...messages.tablet}/></div>
82
+ <div id={devices.mobile} onClick={this.changePreviewDevice} className={`device-name ${currentDevice === devices.mobile ? 'active' : ''}`}><FormattedMessage {...messages.mobile}/></div>
83
+ </div>
84
+ <div className="email-preview-container">
85
+ <div className={currentDevice === devices.desktop ? '' : "shell align-center"}>
86
+ {currentDevice === devices.tablet ?
87
+ <img src={tabletBody} alt="capillary" width="520" /> : ''}
88
+ {currentDevice === devices.mobile ?
89
+ <img src={mobileBody} alt="capillary" width="85%" /> : ''}
90
+ <div className={messageContainerName}>
91
+ <iframe id="email-iframe" srcDoc={templateContent} {...deviceAspectRatio[currentDevice]} >
92
+ <p><FormattedMessage {...messages.noIframeSupport}/></p>
93
+ </iframe>
94
+ </div>
95
+ </div>
96
+
97
+
98
+ </div>
99
+ </div>
100
+ </div>
101
+ </div>
102
+ {this.props.templateData &&
103
+ [
104
+ <p className="preview-info" key="lastModified"><FormattedMessage {...messages.lastModified} />: {moment(this.props.templateData.updatedAt).format('MM-DD-YYYY')}</p>,
105
+ <p style={{marginBottom: '8px'}} key="uploadedBy" className="preview-info"><FormattedMessage {...messages.uploadedBy} /> : {this.props.templateData.updatedByName}</p>,
106
+ ]
107
+ }
108
+ </CapSpin>
109
+ </div>
110
+
111
+ );
112
+ }
113
+
114
+ }
115
+
116
+ EmailPreviewV2.propTypes = {
117
+ templateContent: PropTypes.string,
118
+ templateData: PropTypes.object,
119
+ templateActions: PropTypes.object,
120
+ device: PropTypes.string,
121
+ };
122
+
123
+ const mapStateToProps = (state, props) => createStructuredSelector({
124
+ templateContent: props.templateData ? selectTemplateContent() : () => props.templateContent, // when props has templateContent that means preview with content
125
+ });
126
+ function mapDispatchToProps(dispatch) {
127
+ return {
128
+ templateActions: bindActionCreators(templateActions, dispatch),
129
+ };
130
+ }
131
+
132
+ export default connect(mapStateToProps, mapDispatchToProps)(EmailPreviewV2);
@@ -0,0 +1,41 @@
1
+ /*
2
+ * EmailPreviewV2 Messages
3
+ *
4
+ * This contains all the text for the EmailPreviewV2 component.
5
+ */
6
+ import { defineMessages } from 'react-intl';
7
+
8
+ export default defineMessages({
9
+ header: {
10
+ id: 'app.components.EmailPreviewV2.header',
11
+ defaultMessage: 'This is the EmailPreviewV2 component !',
12
+ },
13
+ desktop: {
14
+ id: 'app.components.EmailPreviewV2.desktop',
15
+ defaultMessage: 'Desktop',
16
+ },
17
+ tablet: {
18
+ id: 'app.components.EmailPreviewV2.tablet',
19
+ defaultMessage: 'Tablet',
20
+ },
21
+ mobile: {
22
+ id: 'app.components.EmailPreviewV2.mobile',
23
+ defaultMessage: 'Mobile',
24
+ },
25
+ noIframeSupport: {
26
+ id: 'app.components.EmailPreviewV2.noIframeSupport',
27
+ defaultMessage: 'Your browser does not support iframes.',
28
+ },
29
+ showAllDevices: {
30
+ id: 'app.components.EmailPreviewV2.showAllDevices',
31
+ defaultMessage: 'Show all devices',
32
+ },
33
+ lastModified: {
34
+ id: 'app.components.PreviewSideBar.lastModified',
35
+ defaultMessage: 'Last Modified On',
36
+ },
37
+ uploadedBy: {
38
+ id: 'app.components.PreviewSideBar.uploadedBy',
39
+ defaultMessage: 'Last Modified By',
40
+ },
41
+ });
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { shallow } from 'enzyme';
3
+ import EmailPreviewV2 from '../index';
4
+
5
+ describe('<EmailPreviewV2 />', () => {
6
+ it('<EmailPreviewV2 /> without the templateData', () => {
7
+ const compoent = shallow(<EmailPreviewV2 templateData={{_id: 'test'}}/>);
8
+ expect(compoent).toMatchSnapshot();
9
+ });
10
+ });