@capillarytech/creatives-library 2.0.82 → 2.0.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/CapTagList/index.js +24 -21
- package/components/CardGrid/index.js +10 -16
- package/components/Ckeditor/index.js +1 -2
- package/components/CustomPopOver/index.js +1 -1
- package/components/EmailPreview/index.js +2 -3
- package/components/FormBuilder/_formBuilder.scss +15 -8
- package/components/FormBuilder/index.js +194 -260
- package/components/Header/index.js +1 -4
- package/components/PreviewSideBar/_previewsidebar.scss +1 -1
- package/components/PreviewSideBar/index.js +5 -3
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +3 -2
- package/components/TemplatePreview/_templatePreview.scss +1 -1
- package/components/TemplatePreview/index.js +47 -47
- package/components/TemplatePreview/messages.js +1 -9
- package/containers/Assets/Gallery/index.js +1 -1
- package/containers/Email/index.js +1 -1
- package/containers/Login/components/LoginForm/index.js +1 -1
- package/containers/Templates/index.js +1 -1
- package/containers/WeChat/RichmediaTemplates/Create/index.js +1 -1
- package/package.json +2 -1
- package/v2Components/BreadCrumbs/index.js +65 -0
- package/v2Components/BreadCrumbs/messages.js +13 -0
- package/v2Components/BreadCrumbs/tests/index.test.js +10 -0
- package/v2Components/CallTaskPreview/_callTaskPreview.scss +17 -0
- package/v2Components/CallTaskPreview/images/Footer.png +0 -0
- package/v2Components/CallTaskPreview/images/Header.png +0 -0
- package/v2Components/CallTaskPreview/index.js +37 -0
- package/v2Components/CallTaskPreview/messages.js +13 -0
- package/v2Components/CallTaskPreview/tests/index.test.js +15 -0
- package/v2Components/CapTagList/index.js +232 -0
- package/v2Components/CapTagList/messages.js +25 -0
- package/v2Components/CapTagList/tests/index.test.js +10 -0
- package/v2Components/Card/_customCard.scss +27 -0
- package/v2Components/Card/index.js +78 -0
- package/{containers/WeChat → v2Components/Card}/tests/index.test.js +2 -2
- package/v2Components/CardGrid/index.js +77 -0
- package/v2Components/CardGrid/tests/index.test.js +10 -0
- package/v2Components/Ckeditor/index.js +234 -0
- package/v2Components/Ckeditor/messages.js +13 -0
- package/v2Components/Ckeditor/tests/index.test.js +10 -0
- package/v2Components/CmsTemplatesComponent/index.js +33 -0
- package/v2Components/CmsTemplatesComponent/messages.js +17 -0
- package/v2Components/CmsTemplatesComponent/tests/index.test.js +10 -0
- package/v2Components/Component/index.js +29 -0
- package/v2Components/Component/tests/index.test.js +10 -0
- package/v2Components/CustomPopOver/index.js +82 -0
- package/v2Components/CustomPopOver/messages.js +13 -0
- package/v2Components/CustomPopOver/tests/index.test.js +10 -0
- package/v2Components/DateFilter/index.js +349 -0
- package/v2Components/DateFilter/messages.js +17 -0
- package/v2Components/DateFilter/tests/index.test.js +15 -0
- package/v2Components/DateRange/index.js +113 -0
- package/v2Components/DateRange/messages.js +13 -0
- package/v2Components/DateRange/tests/index.test.js +10 -0
- package/v2Components/Edmeditor/index.js +65 -0
- package/v2Components/Edmeditor/messages.js +13 -0
- package/v2Components/Edmeditor/tests/index.test.js +10 -0
- package/v2Components/EmailMobilePreview/index.js +129 -0
- package/v2Components/EmailMobilePreview/index.scss +55 -0
- package/v2Components/EmailPreview/_emailPreview.scss +119 -0
- package/v2Components/EmailPreview/index.js +106 -0
- package/v2Components/EmailPreview/messages.js +17 -0
- package/v2Components/EmailPreview/tests/index.test.js +10 -0
- package/v2Components/EmailPreviewV2/_emailPreviewV2.scss +69 -0
- package/v2Components/EmailPreviewV2/index.js +132 -0
- package/v2Components/EmailPreviewV2/messages.js +41 -0
- package/v2Components/EmailPreviewV2/tests/index.test.js +10 -0
- package/v2Components/Footer/index.js +27 -0
- package/v2Components/Footer/messages.js +13 -0
- package/v2Components/Footer/tests/index.test.js +10 -0
- package/v2Components/FormBuilder/_formBuilder.scss +78 -0
- package/v2Components/FormBuilder/index.js +3309 -0
- package/v2Components/FormBuilder/messages.js +13 -0
- package/v2Components/FormBuilder/tests/index.test.js +10 -0
- package/v2Components/Header/index.js +46 -0
- package/v2Components/Header/messages.js +25 -0
- package/v2Components/Header/tests/index.test.js +10 -0
- package/v2Components/ImagePreview/_imagePreview.scss +63 -0
- package/v2Components/ImagePreview/index.js +52 -0
- package/v2Components/ImagePreview/messages.js +13 -0
- package/v2Components/ImagePreview/tests/index.test.js +10 -0
- package/v2Components/MobilePushPreviewV2/index.js +120 -0
- package/v2Components/MobilePushPreviewV2/messages.js +13 -0
- package/v2Components/MobilePushPreviewV2/tests/index.test.js +10 -0
- package/v2Components/NewCallTask/_newCallTask.scss +9 -0
- package/v2Components/NewCallTask/index.js +152 -0
- package/v2Components/NewCallTask/messages.js +29 -0
- package/v2Components/NewCallTask/tests/index.test.js +10 -0
- package/v2Components/PageHeader/_pageHeader.scss +22 -0
- package/v2Components/PageHeader/index.js +37 -0
- package/v2Components/PageHeader/messages.js +13 -0
- package/v2Components/PageHeader/tests/index.test.js +10 -0
- package/v2Components/Pagination/_pagination.scss +5 -0
- package/v2Components/Pagination/index.js +49 -0
- package/v2Components/Pagination/tests/index.test.js +10 -0
- package/v2Components/PreviewSideBar/_previewsidebar.scss +28 -0
- package/v2Components/PreviewSideBar/index.js +150 -0
- package/v2Components/PreviewSideBar/messages.js +33 -0
- package/v2Components/PreviewSideBar/tests/index.test.js +10 -0
- package/v2Components/Sidebar/_sidebar.scss +115 -0
- package/v2Components/Sidebar/index.js +208 -0
- package/v2Components/Sidebar/messages.js +21 -0
- package/v2Components/Sidebar/tests/index.test.js +10 -0
- package/v2Components/SlideBox/_slideBox.scss +63 -0
- package/v2Components/SlideBox/index.js +48 -0
- package/v2Components/SlideBox/tests/index.test.js +103 -0
- package/v2Components/SmsEditor/index.js +55 -0
- package/v2Components/SmsEditor/tests/index.test.js +10 -0
- package/v2Components/SmsTest/index.js +115 -0
- package/v2Components/SmsTest/messages.js +13 -0
- package/v2Components/SmsTest/tests/index.test.js +10 -0
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +42 -0
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +139 -0
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +21 -0
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +352 -0
- package/v2Components/TemplatePreview/assets/images/WECHAT_5x.png +0 -0
- package/v2Components/TemplatePreview/assets/images/androidPushMessage.svg +45 -0
- package/v2Components/TemplatePreview/assets/images/iPhonePushMessage.svg +135 -0
- package/v2Components/TemplatePreview/assets/images/mobile.svg +24 -0
- package/v2Components/TemplatePreview/assets/images/sms-body.png +0 -0
- package/v2Components/TemplatePreview/assets/images/sms-icon.png +0 -0
- package/v2Components/TemplatePreview/assets/images/sms_mobile.png +0 -0
- package/v2Components/TemplatePreview/assets/images/user-icon.svg +19 -0
- package/v2Components/TemplatePreview/assets/images/wechat-mobile.svg +78 -0
- package/v2Components/TemplatePreview/index.js +175 -0
- package/v2Components/TemplatePreview/messages.js +37 -0
- package/v2Components/TemplatePreview/tests/index.test.js +10 -0
- package/v2Components/Toastr/index.js +60 -0
- package/v2Components/Toastr/messages.js +13 -0
- package/v2Components/Toastr/tests/index.test.js +10 -0
- package/v2Components/ToastrMessage/index.js +110 -0
- package/v2Components/ToastrMessage/messages.js +13 -0
- package/v2Components/ToastrMessage/tests/index.test.js +10 -0
- package/v2Components/TopBar/_topbar.scss +46 -0
- package/v2Components/TopBar/assets/images/capillary_logo.png +0 -0
- package/v2Components/TopBar/index.js +113 -0
- package/v2Components/TopBar/messages.js +29 -0
- package/v2Components/TopBar/tests/index.test.js +10 -0
- package/v2Containers/Assets/Gallery/index.js +1 -1
- package/v2Containers/CallTask/index.js +1 -1
- package/v2Containers/Cap/index.js +2 -2
- package/v2Containers/CreativesContainer/SlideBoxContent.js +3 -3
- package/v2Containers/CreativesContainer/index.js +1 -0
- package/v2Containers/Dashboard/index.js +2 -2
- package/v2Containers/Ebill/index.js +2 -2
- package/v2Containers/Email/index.js +4 -4
- package/v2Containers/EmailWrapper/index.js +1 -1
- package/v2Containers/Line/Create/index.js +1 -1
- package/v2Containers/Line/Edit/index.js +1 -1
- package/v2Containers/Login/index.js +1 -1
- package/v2Containers/MobilePush/Create/index.js +1 -1
- package/v2Containers/MobilePush/Edit/index.js +1 -1
- package/v2Containers/Sms/Create/index.js +1 -1
- package/v2Containers/Sms/Edit/index.js +1 -1
- package/v2Containers/TagList/index.js +1 -1
- package/v2Containers/Templates/index.js +4 -4
- package/v2Containers/TestPage/index.js +1 -1
- package/v2Containers/WeChat/MapTemplates/index.js +3 -3
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +3 -3
- package/containers/WeChat/_wechat.scss +0 -8
- package/containers/WeChat/actions.js +0 -46
- package/containers/WeChat/constants.js +0 -28
- package/containers/WeChat/index.js +0 -1617
- package/containers/WeChat/messages.js +0 -73
- package/containers/WeChat/reducer.js +0 -74
- package/containers/WeChat/sagas.js +0 -86
- package/containers/WeChat/selectors.js +0 -25
- package/containers/WeChat/tests/actions.test.js +0 -18
- package/containers/WeChat/tests/reducer.test.js +0 -9
- package/containers/WeChat/tests/sagas.test.js +0 -15
- package/containers/WeChat/tests/selectors.test.js +0 -10
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Ckeditor
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
// import styled from 'styled-components';
|
|
11
|
+
|
|
12
|
+
// import { FormattedMessage } from 'react-intl';
|
|
13
|
+
import _ from 'lodash';
|
|
14
|
+
// import messages from './messages';
|
|
15
|
+
const loadScript = require('load-script');
|
|
16
|
+
const defaultScriptUrl = "https://ckeditor.com/assets/libs/ckeditor4/4.11.4/ckeditor.js";
|
|
17
|
+
const user = localStorage.getItem('user');
|
|
18
|
+
let locale = 'en';
|
|
19
|
+
if (user && JSON.parse(user).lang) {
|
|
20
|
+
locale = JSON.parse(user).lang;
|
|
21
|
+
}
|
|
22
|
+
const CKEditorConfig = {
|
|
23
|
+
skin: 'moono',
|
|
24
|
+
toolbar: [
|
|
25
|
+
{ name: 'document', items: ['Source', '-'] },
|
|
26
|
+
{ name: 'clipboard', items: ['Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
|
|
27
|
+
{ name: 'editing', items: ['Find', 'Replace', '-', 'SelectAll', '-'] },
|
|
28
|
+
{ name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'CopyFormatting', 'RemoveFormat'] },
|
|
29
|
+
{ name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language'] },
|
|
30
|
+
{ name: 'links', items: ['Link', 'Unlink', 'Anchor'] },
|
|
31
|
+
{ name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'Smiley'] },
|
|
32
|
+
// '/',
|
|
33
|
+
{ name: 'styles', items: ['Format', 'Font', 'FontSize'] },
|
|
34
|
+
{ name: 'colors', items: ['TextColor', 'BGColor'] },
|
|
35
|
+
{ name: 'tools', items: ['Maximize', 'ShowBlocks'] },
|
|
36
|
+
],
|
|
37
|
+
format_tags: 'p;h1;h2;h3;pre',
|
|
38
|
+
toolbarCanCollapse: true,
|
|
39
|
+
toolbarStartupExpanded: true,
|
|
40
|
+
uiColor: '#e3e3e3',
|
|
41
|
+
width: 'calc(100% - 2px)',
|
|
42
|
+
height: 'calc(100vh - 290px)',
|
|
43
|
+
fullPage: true,
|
|
44
|
+
htmlEncodeOutput: true,
|
|
45
|
+
startupFocus: true,
|
|
46
|
+
allowedContent: {
|
|
47
|
+
// Allow all content.
|
|
48
|
+
$1: {
|
|
49
|
+
// elements: this.editorInstance.dtd,
|
|
50
|
+
//elements: window.CKEDITOR.dtd,
|
|
51
|
+
attributes: true,
|
|
52
|
+
styles: true,
|
|
53
|
+
classes: true,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
disallowedContent: 'script; *[on*]',
|
|
57
|
+
language: locale,
|
|
58
|
+
toolbar_Basic:
|
|
59
|
+
[
|
|
60
|
+
['SwitchBar', '-', 'Source', '-', 'Bold', 'Italic', 'Underline'],
|
|
61
|
+
['NumberedList', 'BulletedList'],
|
|
62
|
+
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
|
63
|
+
['Link', 'Unlink', 'Anchor'],
|
|
64
|
+
['Image', 'Table'],
|
|
65
|
+
['Font', 'FontSize'],
|
|
66
|
+
['TextColor', 'BGColor'],
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
class Ckeditor extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
71
|
+
constructor(props) {
|
|
72
|
+
super(props);
|
|
73
|
+
const config = CKEditorConfig;
|
|
74
|
+
if (this.props.channel && this.props.channel.toLowerCase() === 'wechat') {
|
|
75
|
+
config.startupFocus = false;
|
|
76
|
+
config.toolbar[6].items = ['Table', 'HorizontalRule', 'Smiley'];
|
|
77
|
+
config.width = 'calc(100% - 70px)';
|
|
78
|
+
config.height = 'calc(100vh - 450px)';
|
|
79
|
+
}
|
|
80
|
+
//State initialization
|
|
81
|
+
this.state = {
|
|
82
|
+
config,
|
|
83
|
+
events: {
|
|
84
|
+
blur: this.onBlur,
|
|
85
|
+
afterPaste: this.afterPaste,
|
|
86
|
+
change: this.onChange,
|
|
87
|
+
},
|
|
88
|
+
content: "",
|
|
89
|
+
editorInstance: undefined,
|
|
90
|
+
setInitData: false,
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
this.delayTimer = 0;
|
|
94
|
+
//Bindings
|
|
95
|
+
this.onLoad = this.onLoad.bind(this);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
componentWillMount() {
|
|
99
|
+
let content = '';
|
|
100
|
+
this.id = this.props.id;
|
|
101
|
+
if (this.props.content !== '') {
|
|
102
|
+
content = this.props.content;
|
|
103
|
+
content = content.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\\"/g, "\"");
|
|
104
|
+
}
|
|
105
|
+
this.setState({content}, () => {
|
|
106
|
+
if (this.editorInstance) {
|
|
107
|
+
this.editorInstance.setData(content);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
//load ckeditor script as soon as component mounts if not already loaded
|
|
113
|
+
componentDidMount() {
|
|
114
|
+
loadScript(defaultScriptUrl, this.onLoad);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
componentWillReceiveProps(nextProps) {
|
|
118
|
+
this.id = this.props.id;
|
|
119
|
+
if (this.editorInstance && this.editorInstance.status === "ready") {
|
|
120
|
+
// setTimeout(() => {
|
|
121
|
+
// this.editorInstance.name = this.id;
|
|
122
|
+
// }, 5000);
|
|
123
|
+
console.log('nextProps CKEditor', nextProps, this.state.content, this.props.id);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
componentWillUnmount() {
|
|
128
|
+
this.unmounting = true;
|
|
129
|
+
if (this.editorInstance) {
|
|
130
|
+
this.editorInstance.destroy();
|
|
131
|
+
if (window.CKEDITOR && !_.isEmpty(window.CKEDITOR.instances)) {
|
|
132
|
+
window.CKEDITOR.instances = {};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
onLoad() {
|
|
138
|
+
if (this.unmounting) return;
|
|
139
|
+
|
|
140
|
+
console.log('CKEditor Loading');
|
|
141
|
+
if (!window.CKEDITOR) {
|
|
142
|
+
console.error("CKEditor not found");
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
let html = this.props.content;
|
|
147
|
+
html = html.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, "\"");
|
|
148
|
+
console.log("ckeditor loading 1", this.node, html);
|
|
149
|
+
this.editorInstance = window.CKEDITOR.appendTo(
|
|
150
|
+
this.node,
|
|
151
|
+
this.state.config,
|
|
152
|
+
html
|
|
153
|
+
);
|
|
154
|
+
console.log('2');
|
|
155
|
+
|
|
156
|
+
if (this.props.getEditorInstanse) {
|
|
157
|
+
this.props.getEditorInstanse(this.editorInstance, this.props.id);
|
|
158
|
+
}
|
|
159
|
+
//this.editorInstance.name = this.id;
|
|
160
|
+
|
|
161
|
+
//Register listener for custom events if any
|
|
162
|
+
this.editorInstance.on('change', this.handleContentChange);
|
|
163
|
+
_.forEach(this.props.events, (event, index) => {
|
|
164
|
+
this.editorInstance.on(index, event);
|
|
165
|
+
});
|
|
166
|
+
const channel = _.get(this.props, 'channel');
|
|
167
|
+
if (channel && channel.toLowerCase() === 'wechat') {
|
|
168
|
+
this.editorInstance.on('blur', this.onFocusOut);
|
|
169
|
+
_.forEach(this.props.events, (event, index) => {
|
|
170
|
+
this.editorInstance.on(index, event);
|
|
171
|
+
});
|
|
172
|
+
this.editorInstance.on('focus', this.onFocusIn);
|
|
173
|
+
_.forEach(this.props.events, (event, index) => {
|
|
174
|
+
this.editorInstance.on(index, event);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
onFocusOut = () => {
|
|
180
|
+
this.props.onFocusOut();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
onFocusIn = () => {
|
|
184
|
+
this.props.onFocusIn();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
delay(callback, ms) {
|
|
188
|
+
clearTimeout(this.delayTimer);
|
|
189
|
+
this.delayTimer = setTimeout(callback, ms);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
handleContentChange = (evt) => {
|
|
193
|
+
// this.setState({content: this.editorInstance.getData()}, () => {
|
|
194
|
+
// this.props.handleContentChange(evt);
|
|
195
|
+
// // evt.setData(this.editorInstance.getData());
|
|
196
|
+
// });
|
|
197
|
+
this.delay(() => {
|
|
198
|
+
this.setState({content: this.editorInstance.getData()}, () => {
|
|
199
|
+
this.props.handleContentChange(evt);
|
|
200
|
+
});
|
|
201
|
+
}, 1000);
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
render() {
|
|
205
|
+
console.log('ckeditor loading render', this.props);
|
|
206
|
+
return (
|
|
207
|
+
<div id={this.props.id} style={{borderRight: "1px solid #000 !important"}}>
|
|
208
|
+
<div className={this.props.activeClass} ref={(node) => (this.node = node)}/>
|
|
209
|
+
</div>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
Ckeditor.defaultProps = {
|
|
215
|
+
id: 'ckeditor',
|
|
216
|
+
content: "<html><body></body></html>",
|
|
217
|
+
config: {},
|
|
218
|
+
activeClass: "",
|
|
219
|
+
events: {},
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
Ckeditor.propTypes = {
|
|
223
|
+
id: PropTypes.string,
|
|
224
|
+
content: PropTypes.any,
|
|
225
|
+
activeClass: PropTypes.string,
|
|
226
|
+
events: PropTypes.object,
|
|
227
|
+
getEditorInstanse: PropTypes.func,
|
|
228
|
+
handleContentChange: PropTypes.func,
|
|
229
|
+
channel: PropTypes.string,
|
|
230
|
+
onFocusOut: PropTypes.func,
|
|
231
|
+
onFocusIn: PropTypes.func,
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export default Ckeditor;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Ckeditor Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the Ckeditor component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
header: {
|
|
10
|
+
id: 'app.components.Ckeditor.header',
|
|
11
|
+
defaultMessage: 'This is the Ckeditor component !',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* CmsTemplatesComponent
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
// import styled from 'styled-components';
|
|
10
|
+
import {CapButton, CapCustomCard} from '@capillarytech/cap-ui-library';
|
|
11
|
+
import { FormattedMessage } from 'react-intl';
|
|
12
|
+
import messages from './messages';
|
|
13
|
+
const {CapCustomCardList} = CapCustomCard;
|
|
14
|
+
function CmsTemplatesComponent(props) {
|
|
15
|
+
const cardDataList = props.cmsTemplates.map((template) => (
|
|
16
|
+
{
|
|
17
|
+
key: template.name,
|
|
18
|
+
title: template.name,
|
|
19
|
+
url: template.versions.base.preview_http_url,
|
|
20
|
+
hoverOption: <CapButton onClick={() => props.handleEdmDefaultTemplateSelection(template._id)}><FormattedMessage {...messages.select}/></CapButton>,
|
|
21
|
+
}));
|
|
22
|
+
return (<div>
|
|
23
|
+
<div className="pagination-container">
|
|
24
|
+
<CapCustomCardList cardList={cardDataList} type="Email" />
|
|
25
|
+
</div>
|
|
26
|
+
</div>);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
CmsTemplatesComponent.propTypes = {
|
|
30
|
+
cmsTemplates: PropTypes.array,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default CmsTemplatesComponent;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* CmsTemplatesComponent Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the CmsTemplatesComponent component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
header: {
|
|
10
|
+
id: 'app.components.CmsTemplatesComponent.header',
|
|
11
|
+
defaultMessage: 'This is the CmsTemplatesComponent component !',
|
|
12
|
+
},
|
|
13
|
+
select: {
|
|
14
|
+
id: 'app.components.CmsTemplatesComponent.select',
|
|
15
|
+
defaultMessage: 'Select',
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// import React from 'react';
|
|
2
|
+
// import { shallow } from 'enzyme';
|
|
3
|
+
|
|
4
|
+
// import CmsTemplatesComponent from '../index';
|
|
5
|
+
|
|
6
|
+
describe('<CmsTemplatesComponent />', () => {
|
|
7
|
+
it('Expect to have unit tests specified', () => {
|
|
8
|
+
expect(true).toEqual(false);
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Component
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
import React from "react";
|
|
10
|
+
// import styled from 'styled-components';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Component extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
14
|
+
render() {
|
|
15
|
+
const className = this.props.name;
|
|
16
|
+
return (
|
|
17
|
+
<div className={className}>
|
|
18
|
+
{this.props.children}
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Component.propTypes = {
|
|
25
|
+
name: PropTypes.string.isRequired,
|
|
26
|
+
children: PropTypes.array,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default Component;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* CustomPopOver
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
// import styled from 'styled-components';
|
|
11
|
+
import {CapPopover} from '@capillarytech/cap-ui-library';
|
|
12
|
+
// import { FormattedMessage } from 'react-intl';
|
|
13
|
+
// import messages from './messages';
|
|
14
|
+
import _ from "lodash";
|
|
15
|
+
|
|
16
|
+
class CustomPopOver extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
17
|
+
componentWillMount() {
|
|
18
|
+
console.log('popOver List ', this.props.popOverList, this.props.excludeList);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
componentWillReceiveProps(nextProps) {
|
|
22
|
+
console.log('next popOver List ', nextProps.popOverList, nextProps.excludeList);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
renderPopoverContent() {
|
|
26
|
+
const elem = [];
|
|
27
|
+
_.forEach(this.props.popOverList, (content, index) => {
|
|
28
|
+
console.log('PopOver Content', content);
|
|
29
|
+
if (this.props.excludeList.indexOf(content.iso_code) === -1) {
|
|
30
|
+
elem.push(
|
|
31
|
+
<p style={{ cursor: "pointer"}} key={index} onClick={() => this.props.handlePopOverClick(content)}>{content.language}</p>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return elem;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
render() {
|
|
40
|
+
return (
|
|
41
|
+
<div>
|
|
42
|
+
<CapPopover
|
|
43
|
+
id={this.props.id}
|
|
44
|
+
className={this.props.className}
|
|
45
|
+
trigger={this.props.trigger}
|
|
46
|
+
placement={this.props.placement}
|
|
47
|
+
visible={this.props.visible}
|
|
48
|
+
onVisibleChange={this.props.onVisibleChange}
|
|
49
|
+
style={{height: '100%'}}
|
|
50
|
+
content={
|
|
51
|
+
this.renderPopoverContent()
|
|
52
|
+
}
|
|
53
|
+
>
|
|
54
|
+
<p style={{fontFamily: "open-sans", fontWeight: '600', display: `${this.props.popOverList.length === this.props.excludeList.length ? 'none' : ''}`}}>+ Languages</p>
|
|
55
|
+
</CapPopover>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
CustomPopOver.defaultProps = {
|
|
62
|
+
id: 'popover',
|
|
63
|
+
className: '',
|
|
64
|
+
trigger: "click",
|
|
65
|
+
placement: "bottomLeft",
|
|
66
|
+
popOverList: [],
|
|
67
|
+
excludeList: [],
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
CustomPopOver.propTypes = {
|
|
71
|
+
id: PropTypes.string,
|
|
72
|
+
className: PropTypes.string,
|
|
73
|
+
popOverList: PropTypes.array,
|
|
74
|
+
excludeList: PropTypes.array,
|
|
75
|
+
trigger: PropTypes.string,
|
|
76
|
+
placement: PropTypes.string,
|
|
77
|
+
visible: PropTypes.bool,
|
|
78
|
+
onVisibleChange: PropTypes.func,
|
|
79
|
+
handlePopOverClick: PropTypes.func,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default CustomPopOver;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* CustomPopOver Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the CustomPopOver component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
header: {
|
|
10
|
+
id: 'app.components.CustomPopOver.header',
|
|
11
|
+
defaultMessage: 'This is the CustomPopOver component !',
|
|
12
|
+
},
|
|
13
|
+
});
|