@capillarytech/creatives-library 3.8.11 → 3.9.0

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 (52) hide show
  1. package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +8 -7
  2. package/components/TemplatePreview/_templatePreview.scss +20 -279
  3. package/components/TemplatePreview/index.js +20 -180
  4. package/components/TemplatePreview/messages.js +0 -16
  5. package/index.js +6 -0
  6. package/package.json +1 -1
  7. package/v2Components/FormBuilder/index.js +17 -25
  8. package/v2Components/MobilePushPreviewV2/index.js +32 -40
  9. package/v2Components/MobilePushPreviewV2/messages.js +8 -0
  10. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +0 -64
  11. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +19 -101
  12. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +0 -12
  13. package/v2Components/TemplatePreview/_templatePreview.scss +4 -13
  14. package/v2Components/TemplatePreview/index.js +20 -147
  15. package/v2Components/TemplatePreview/messages.js +0 -8
  16. package/v2Containers/Assets/Gallery/index.js +1 -0
  17. package/v2Containers/CreativesContainer/SlideBoxContent.js +17 -17
  18. package/v2Containers/CreativesContainer/SlideBoxHeader.js +1 -1
  19. package/v2Containers/CreativesContainer/index.js +51 -4
  20. package/v2Containers/CreativesContainer/messages.js +2 -2
  21. package/v2Containers/Email/_email.scss +1 -7
  22. package/v2Containers/Email/index.js +13 -39
  23. package/v2Containers/Email/messages.js +0 -4
  24. package/v2Containers/EmailWrapper/index.js +5 -7
  25. package/v2Containers/Line/Create/actions.js +2 -1
  26. package/v2Containers/Line/Create/index.js +137 -61
  27. package/v2Containers/Line/Create/sagas.js +2 -2
  28. package/v2Containers/Line/Create/selectors.js +2 -7
  29. package/v2Containers/Line/CreateWrapper/index.js +5 -2
  30. package/v2Containers/Line/CreateWrapper/messages.js +12 -0
  31. package/v2Containers/MobilePush/Create/index.js +0 -5
  32. package/v2Containers/MobilePush/Edit/index.js +0 -5
  33. package/v2Containers/MobilepushWrapper/index.js +1 -4
  34. package/v2Containers/Sms/Create/index.js +1 -2
  35. package/v2Containers/Sms/Edit/index.js +0 -2
  36. package/v2Containers/Templates/_templates.scss +20 -16
  37. package/v2Containers/Templates/actions.js +7 -0
  38. package/v2Containers/Templates/constants.js +2 -0
  39. package/v2Containers/Templates/index.js +58 -9
  40. package/v2Containers/Templates/messages.js +8 -0
  41. package/v2Containers/Templates/reducer.js +2 -0
  42. package/components/TemplatePreview/assets/images/home-screen-android.svg +0 -21
  43. package/components/TemplatePreview/assets/images/home-screen-ios.svg +0 -16
  44. package/components/TemplatePreview/assets/images/sms_mobile_android.svg +0 -22
  45. package/components/TemplatePreview/assets/images/sms_mobile_ios.svg +0 -16
  46. package/components/TemplatePreview/assets/images/wechat_mobile_android.svg +0 -20
  47. package/package-lock.json +0 -3096
  48. package/v2Components/TemplatePreview/assets/images/home-screen-android.svg +0 -21
  49. package/v2Components/TemplatePreview/assets/images/home-screen-ios.svg +0 -16
  50. package/v2Components/TemplatePreview/assets/images/sms_mobile_android.svg +0 -22
  51. package/v2Components/TemplatePreview/assets/images/wechat-home-screen-android.svg +0 -21
  52. package/v2Components/TemplatePreview/assets/images/wechat_mobile_android.svg +0 -20
@@ -8,145 +8,18 @@ import PropTypes from 'prop-types';
8
8
 
9
9
  import React from 'react';
10
10
  import _ from 'lodash';
11
- import { injectIntl, intlShape, FormattedMessage} from 'react-intl';
12
- import {CapColumn, CapTab, CapIcon, CapLabel, CapImage} from '@capillarytech/cap-ui-library';
11
+ import { injectIntl, intlShape} from 'react-intl';
12
+ import {CapColumn} from '@capillarytech/cap-react-ui-library';
13
13
  import './_templatePreview.scss';
14
14
  import {updateCharCount} from '../../utils/smsCharCountV2';
15
15
  import messages from './messages';
16
16
  const smsIcon = require('./assets/images/user-icon.svg');
17
- const smsMobileAndroid = require('./assets/images/sms_mobile_android.svg');
18
- const wechatMobileAndroid = require('./assets/images/wechat_mobile_android.svg');
19
- const smsMobileIos = require('./assets/images/sms_mobile_ios.svg');
20
- const smsAndroidHomeScreen = require('./assets/images/home-screen-android.svg');
21
- const smsIosHomeScreen = require('./assets/images/home-screen-ios.svg');
22
17
  const wechatBody = require('./assets/images/WECHAT_5x.png');
23
18
  const smsBody = require('./assets/images/mobile.svg');
24
19
  const androidPushMessagePhone = require('./assets/images/androidPushMessage.svg');
25
20
  const iPhonePushMessagePhone = require('./assets/images/iPhonePushMessage.svg');
26
21
 
27
22
  class TemplatePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
28
- getWechatAndroidPreview = (content) => (
29
- <div className="shell-lock-screen-android align-center" id="sms-preview">
30
- <div className="lock-screen-preview">
31
- <CapImage className="preview-image sms" src={smsAndroidHomeScreen} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
32
- <div className="lock-msgContainer wechat">
33
- <div className="sender-id-text">
34
- {this.props.intl.formatMessage(messages.senderId)}
35
- </div>
36
- <div className="message-text-container">
37
- <CapLabel type="label1" style={{ height: '15px' }} >{content}</CapLabel>
38
- </div>
39
- </div>
40
- <div className="action-text">
41
- <FormattedMessage {...messages.markAsRead}/> <FormattedMessage {...messages.reply}/>
42
- </div>
43
- </div>
44
- <div className="main-screen-preview">
45
- <CapImage className="preview-image" src={wechatMobileAndroid} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
46
- <div className="msgContainer wechat">
47
- <div className="message-pop wechat align-left" style={{ background: '#ffffff', color: '#333333' }}>
48
- {content}
49
- </div>
50
- </div>
51
- </div>
52
- </div>
53
- );
54
-
55
- getWechatIosPreview = (content) => (
56
- <div className="shell-lock-screen-ios align-center" id="sms-preview">
57
- <div className="lock-screen-preview">
58
- <CapImage className="preview-image sms" src={smsIosHomeScreen} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
59
- <div className="lock-msgContainer wechat">
60
- <div className="sender-id-text">
61
- {this.props.intl.formatMessage(messages.senderId)}
62
- </div>
63
- <div className="message-text-container">
64
- <CapLabel type="label1" style={{ height: '15px' }} >{content}</CapLabel>
65
- </div>
66
- </div>
67
- <div className="action-text-reply">
68
- <FormattedMessage {...messages.reply}/>
69
- </div>
70
- <div className="action-text-cancel">
71
- <FormattedMessage {...messages.cancel}/>
72
- </div>
73
- </div>
74
- <div className="main-screen-preview">
75
- <CapImage className="preview-image" src={wechatMobileAndroid} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
76
- <div className="msgContainer wechat">
77
- <div className="message-pop wechat align-left" style={{ background: '#ffffff', color: '#333333' }}>
78
- {content}
79
- </div>
80
- </div>
81
- </div>
82
- </div>
83
- );
84
-
85
- getSmsAndroidPreview = (content) => (
86
- <div className="shell-lock-screen-android align-center" id="sms-preview">
87
- <div className="lock-screen-preview">
88
- <CapImage className="preview-image sms" src={smsAndroidHomeScreen} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
89
- <div className="lock-msgContainer sms">
90
- <div className="sender-id-text">
91
- {this.props.intl.formatMessage(messages.senderId)}
92
- </div>
93
- <div className="message-text-container">
94
- <CapLabel type="label1" style={{ height: '15px' }} >{content}</CapLabel>
95
- </div>
96
- </div>
97
- <div className="action-text">
98
- <FormattedMessage {...messages.markAsRead}/> <FormattedMessage {...messages.reply}/>
99
- </div>
100
- </div>
101
- <div className="main-screen-preview">
102
- <CapImage className="preview-image sms" src={smsMobileAndroid} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
103
- <div className="msgContainer sms">
104
- <div className={"message-pop sms"}>
105
- {content && content.length && content.map((msg) =>
106
- <CapColumn className="message-pop-item align-left" style={{ background: '#FFFFFF', color: '#091e42'}}>
107
- {msg}
108
- </CapColumn>)
109
- }
110
- </div>
111
- </div>
112
- </div>
113
- </div>
114
- );
115
-
116
- getSmsIosPreview = (content) => (
117
- <div className="shell-lock-screen-ios align-center" id="sms-preview">
118
- <div className="lock-screen-preview">
119
- <CapImage className="preview-image sms" src={smsIosHomeScreen} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
120
- <div className="lock-msgContainer sms">
121
- <div className="sender-id-text">
122
- {this.props.intl.formatMessage(messages.senderId)}
123
- </div>
124
- <div className="message-text-container">
125
- <CapLabel type="label1" style={{ height: '15px' }} >{content}</CapLabel>
126
- </div>
127
- </div>
128
- <div className="action-text-reply">
129
- <FormattedMessage {...messages.reply}/>
130
- </div>
131
- <div className="action-text-cancel">
132
- <FormattedMessage {...messages.cancel}/>
133
- </div>
134
- </div>
135
- <div className="main-screen-preview">
136
- <CapImage className="preview-image sms" src={smsMobileIos} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
137
- <div className="msgContainer sms">
138
- <div className={"message-pop sms"}>
139
- {content && content.length && content.map((msg) =>
140
- <CapColumn className="message-pop-item align-left" style={{ background: '#ebecf0', color: '#091e42'}}>
141
- {msg}
142
- </CapColumn>)
143
- }
144
- </div>
145
- </div>
146
- </div>
147
- </div>
148
- );
149
-
150
23
  render() {
151
24
  console.log('preview props', this.props);
152
25
  let content = channel && channel.toLowerCase() === 'sms' ? [this.props.content] : this.props.content;
@@ -165,7 +38,6 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
165
38
  //smsText = this.props.intl.formatMessage(messages.previewGenerationMessage);
166
39
  //console.log('message text', smsText);
167
40
  }
168
- const showLockScreenPreview = !!this.props.showLockScreenPreview;
169
41
  const type = this.props.location && this.props.location.query.type ? this.props.location.query.type : '';
170
42
  let iosActions = [];
171
43
  if (channel.toLowerCase() === "mobilepush") {
@@ -180,67 +52,35 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
180
52
  }
181
53
  return (
182
54
  <div className={`preview-container ${type === 'embedded' ? 'embedded-preview' : ''}`}>
183
- { channel && channel.toLowerCase() === 'sms' &&
184
- (showLockScreenPreview ? (
185
- <CapTab
186
- panes={[
187
- {
188
- content: this.getSmsAndroidPreview(content),
189
- tab: <CapIcon type="android" size='m' />,
190
- key: 'android',
191
- },
192
- {
193
- content: this.getSmsIosPreview(content),
194
- tab: <CapIcon type="ios" size='m' />,
195
- key: 'ios',
196
- },
197
- ]}
198
- tabBarStyle={{margin: 'auto', width: '14%'}}
199
- />
200
- ) : (
201
- <div className="shell align-center" id="sms-preview">
202
- <CapImage className="preview-image sms" src={smsMobileAndroid} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
55
+ { channel && channel.toLowerCase() === 'sms' &&
56
+ <div className="shell align-center" id="sms-preview">
57
+ <img className="preview-image sms" src={smsBody} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
203
58
  <div className="msgContainer sms">
59
+ <img className="sms-icon" src={smsIcon} alt={this.props.intl.formatMessage(messages.smsIcon)} />
204
60
  <div className={"message-pop sms"}>
205
61
  {content && content.length && content.map((msg) =>
206
- <CapColumn className="message-pop-item align-left" style={{ background: '#FFFFFF', color: '#091e42'}}>
62
+ <CapColumn className="message-pop-item align-left" style={{ background: '#3F51B5', color: '#ffffff'}}>
207
63
  {msg}
208
64
  </CapColumn>)
209
65
  }
210
66
  </div>
211
67
  </div>
212
- </div>)
213
- )}
214
- {channel && channel.toLowerCase() === 'wechat' &&
215
- (showLockScreenPreview ? (
216
- <CapTab
217
- panes={[
218
- {
219
- content: this.getWechatAndroidPreview(content),
220
- tab: <CapIcon type="android" size='m' />,
221
- key: 'android',
222
- },
223
- {
224
- content: this.getWechatIosPreview(content),
225
- tab: <CapIcon type="ios" size='m' />,
226
- key: 'ios',
227
- },
228
- ]}
229
- tabBarStyle={{margin: 'auto', width: '14%'}}
230
- />
231
- ) : (
232
- <div className="shell align-center" id="sms-preview">
233
- <CapImage className="preview-image" src={channel.toLowerCase() === 'wechat' ? wechatMobileAndroid : smsBody} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
68
+ </div>
69
+ }
70
+ {channel && channel.toLowerCase() === 'wechat' ?
71
+ ( <div className="shell align-center" id="sms-preview">
72
+ <img className="preview-image" src={channel.toLowerCase() === 'wechat' ? wechatBody : smsBody} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
234
73
  <div className="msgContainer">
74
+ {this.props.channel.toLowerCase() === 'wechat' ? <div className="sms-icon" style={{ width: '25px', height: '25px', background: '#2E89DF' }}></div> : <img className="sms-icon" src={smsIcon} alt={this.props.intl.formatMessage(messages.smsIcon)} />}
235
75
  <div className="message-pop align-left" style={{ background: `${this.props.channel.toLowerCase() === 'wechat' ? '#ffffff' : '#3F51B5'}`, color: `${this.props.channel.toLowerCase() === 'wechat' ? '#333333' : '#ffffff'}`}}>{content}
236
76
  </div>
237
77
  </div>
238
78
  </div>
239
- )
240
- )}
79
+ ) : ''
80
+ }
241
81
  { channel && (channel.toLowerCase() === 'mobilepush') &&
242
82
  (<div className="shell align-center" id="mobilepush-preview">
243
- <CapImage className="preview-image" src={this.props.device === "android" ? androidPushMessagePhone : iPhonePushMessagePhone} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
83
+ <img className="preview-image" src={this.props.device === "android" ? androidPushMessagePhone : iPhonePushMessagePhone} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
244
84
  {(!!content.header || !!content.bodyText || !!content.bodyImage) &&
245
85
  <div className={`${this.props.device}-push-message-Container`}>
246
86
  {this.props.device === "android" ?
@@ -255,7 +95,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
255
95
  {content.bodyText}
256
96
  </div>
257
97
  {content.bodyImage && <div className="body-image">
258
- <CapImage src={content.bodyImage} alt="" />
98
+ <img src={content.bodyImage} alt="" />
259
99
  </div>}
260
100
  {content.actions.filter((action) => action.label).length ?
261
101
  <div className="actions">
@@ -271,7 +111,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
271
111
  <span className="app-icon"></span>{content.appName ? content.appName : "App name"} <i className="material-icons">{this.props.intl.formatMessage(messages.close)}</i>
272
112
  </div>
273
113
  {content.bodyImage && <div className="body-image">
274
- <CapImage src={content.bodyImage} alt=""/>
114
+ <img src={content.bodyImage} alt=""/>
275
115
  </div>}
276
116
  <div className="title">
277
117
  {content.header}
@@ -290,11 +130,11 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
290
130
  {
291
131
  channel && channel.toLowerCase() === 'line' ? (
292
132
  <div className="shell align-center" id="sms-preview">
293
- <CapImage className="preview-image" src={wechatBody} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
133
+ <img className="preview-image" src={wechatBody} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
294
134
  <div className="msgContainer">
295
135
  <div className="sms-icon" style={{ width: '25px', height: '25px', background: '#2E89DF' }}></div>
296
136
  <div className="message-pop align-left" style={{ background: '#ffffff', color: '#333333' }}>
297
- { (content && content.bodyImage) ? <CapImage src={content.bodyImage} alt="ddd" style={{maxWidth: '100%'}}/> : '' }
137
+ { (content && content.bodyImage) ? <img src={content.bodyImage} alt="ddd" style={{maxWidth: '100%'}}/> : '' }
298
138
  { (content && content.bodyText) ? content.bodyText : ''}
299
139
  </div>
300
140
  </div>
@@ -10,10 +10,6 @@ export default defineMessages({
10
10
  id: 'creatives.components.TemplatePreview.previewGenerationMessage',
11
11
  defaultMessage: "Preview is being generated",
12
12
  },
13
- senderId: {
14
- id: 'creatives.components.TemplatePreview.senderId',
15
- defaultMessage: "Sender ID",
16
- },
17
13
  sms: {
18
14
  id: 'creatives.components.TemplatePreview.sms',
19
15
  defaultMessage: "SMS",
@@ -50,16 +46,4 @@ export default defineMessages({
50
46
  id: 'creatives.components.TemplatePreview.smsIcon',
51
47
  defaultMessage: 'Sms Icon',
52
48
  },
53
- markAsRead: {
54
- id: 'creatives.components.TemplatePreview.markAsRead',
55
- defaultMessage: 'Mark as read',
56
- },
57
- reply: {
58
- id: 'creatives.components.TemplatePreview.reply',
59
- defaultMessage: 'Reply',
60
- },
61
- cancel: {
62
- id: 'creatives.components.TemplatePreview.cancel',
63
- defaultMessage: 'Cancel',
64
- },
65
49
  });
package/index.js CHANGED
@@ -43,6 +43,10 @@ import Facebook from './v2Containers/Facebook';
43
43
  import facebookReducer from './v2Containers/Facebook/reducer';
44
44
  import facebookSaga from './v2Containers/Facebook/sagas';
45
45
 
46
+ import Gallery from './v2Containers/Assets/Gallery';
47
+ import galleryReducer from './v2Containers/Assets/Gallery/reducer';
48
+ import gallerySagas from './v2Containers/Assets/Gallery/sagas';
49
+
46
50
  import MobilepushCreate from './v2Containers/MobilePush/Create';
47
51
  import mobilepushCreateReducer from './v2Containers/MobilePush/Create/reducer';
48
52
  import mobilepushCreateSaga from './v2Containers/MobilePush/Create/sagas';
@@ -86,6 +90,7 @@ const LineCreateContainer = {LineCreate, lineCreateReducer, lineCreateSaga};
86
90
  const LineEditContainer = {LineEdit, lineEditReducer, lineEditSaga};
87
91
  const TemplatesV2Container = {TemplatesV2, templateReducer, templateSaga};
88
92
  const FacebookContainer = {Facebook, facebookReducer, facebookSaga};
93
+ const GalleryContainer = {Gallery, galleryReducer, gallerySagas};
89
94
 
90
95
  export {default as TagList} from './v2Containers/TagList/index';
91
96
  export {default as TagListSaga} from './v2Containers/TagList/sagas';
@@ -123,4 +128,5 @@ export { CapContainer,
123
128
  CreativesContainer,
124
129
  updateCharCount,
125
130
  FacebookContainer,
131
+ GalleryContainer,
126
132
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "3.8.11",
4
+ "version": "3.9.0",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -11,7 +11,7 @@ import PropTypes from 'prop-types';
11
11
  import React from 'react';
12
12
  import _ from 'lodash';
13
13
  import { Tabs, Table, Modal} from 'antd';
14
- import { CapDrawer, CapButton, CapInput, CapPopover, CapImage, CapCheckbox, CapRadio, CapSelect, CapTable, CapRow, CapColumn, CapNotification, CapUploader, CapHeading, CapIcon} from '@capillarytech/cap-ui-library';
14
+ import { CapDrawer, CapButton, CapInput, CapPopover, CapCheckbox, CapRadio, CapSelect, CapTable, CapRow, CapColumn, CapNotification, CapUploader, CapHeading, CapIcon} from '@capillarytech/cap-ui-library';
15
15
  import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
16
16
  import LabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
17
17
  import { CAP_SPACE_12, CAP_SPACE_08, FONT_COLOR_05, FONT_COLOR_04 } from '@capillarytech/cap-ui-library/styled/variables';
@@ -2197,7 +2197,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2197
2197
  //
2198
2198
  const imgSrc = template && template.versions && template.versions.base ? template.versions.base.preview_http_url : '';
2199
2199
  // const ifPreviewGenerated = template && template.versions && template.versions.base ? template.versions.base.isPreviewGenerated : 0;
2200
- const content = <CapImage src={imgSrc || ''} alt="" />;
2200
+ const content = <img src={imgSrc || ''} alt="" />;
2201
2201
 
2202
2202
  temp.content = (
2203
2203
  <div
@@ -2382,10 +2382,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2382
2382
  content={content}
2383
2383
  charCounterEnabled={val.charCounterEnabled}
2384
2384
  unicodeEnabled={unicodeEnabled}
2385
- showTestAndPreviewIcon
2386
- onPreviewContentClicked={this.props.onPreviewContentClicked}
2387
- onTestContentClicked={this.props.onTestContentClicked}
2388
- />
2385
+ >
2386
+ </TemplatePreview>
2389
2387
  </CapColumn>
2390
2388
  );
2391
2389
  break;
@@ -2596,6 +2594,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2596
2594
  image: undefined,
2597
2595
  imagePreview: undefined,
2598
2596
  },
2597
+ reUpload: true,
2599
2598
  });
2600
2599
  }
2601
2600
 
@@ -2824,7 +2823,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2824
2823
  <div>
2825
2824
  <div className={`image-container ${ifError ? 'error' : ''}`}>
2826
2825
  {self.state && !!self.state.formData[`${self.state.currentTab - 1}`].image ?
2827
- <CapImage src={self.state.formData[`${self.state.currentTab - 1}`].image} alt={val.alt} style={val.style}/>
2826
+ <img src={self.state.formData[`${self.state.currentTab - 1}`].image} alt={val.alt} style={val.style}/>
2828
2827
  :
2829
2828
  <div style={{width: "100%", textAlign: "center"}}><span className="image-placeholder">{val.placeholder}</span></div>
2830
2829
  }
@@ -2835,15 +2834,21 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2835
2834
  );
2836
2835
  break;
2837
2836
  case 'upload':
2838
- const isImage = self.state && !!self.state.formData[`${self.state.currentTab - 1}`].image;
2837
+ const {
2838
+ formData: {
2839
+ [`${self.state.currentTab - 1}`]: {
2840
+ image,
2841
+ } = {},
2842
+ } = {},
2843
+ } = self.state;
2844
+ const isImage = !!image;
2839
2845
  ifError = (this.state.checkValidation || this.props.startValidation) && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
2840
2846
  const ImageComponent = (props) => (
2841
2847
  <div key={`${val.id}-${this.state.currentTab}`}>
2842
2848
  <div className={`image-container ${props.ifError ? 'error' : ''}`}>
2843
-
2844
2849
  {isImage ?
2845
- <CapImage src={self.state.formData[`${self.state.currentTab - 1}`].image} alt={props.alt} style={props.style}/>
2846
- :
2850
+ <img src={self.state.formData[`${self.state.currentTab - 1}`].image} alt={props.alt} style={props.style}/>
2851
+ :
2847
2852
  <div style={{width: "100%", textAlign: "center"}}><span className="image-placeholder">{props.placeholder}</span></div>
2848
2853
  }
2849
2854
  </div>
@@ -2901,16 +2906,11 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2901
2906
  );
2902
2907
  break;
2903
2908
  case "tag-list":
2904
- let moduleFilterEnabled = this.props.location && this.props.location.query && this.props.location.query.type !== 'embedded';
2905
- const channel = _.get(this.props, 'schema.channel', "");
2906
- if (channel === 'EMAIL') {
2907
- moduleFilterEnabled = this.props.isFullMode;
2908
- }
2909
2909
  columns.push(
2910
2910
  <CapColumn key={`input-${val.id}`} offset={val.offset} span={val.width ? val.width : ''} style={val.style ? val.style : {marginBottom: '16px'}}>
2911
2911
  <TagList
2912
2912
  key={`input-${val.id}`}
2913
- moduleFilterEnabled={moduleFilterEnabled}
2913
+ moduleFilterEnabled={this.props.location && this.props.location.query && this.props.location.query.type !== 'embedded'}
2914
2914
  label={val.label ? val.label : ''}
2915
2915
  onTagSelect={(data) => this.callChildEvent(data, val, 'onTagSelect')}
2916
2916
  onContextChange={this.props.onContextChange}
@@ -2957,9 +2957,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2957
2957
  content={content}
2958
2958
  charCounterEnabled={val.charCounterEnabled}
2959
2959
  unicodeEnabled={unicodeEnabled}
2960
- showTestAndPreviewIcon
2961
- onPreviewContentClicked={this.props.onPreviewContentClicked}
2962
- onTestContentClicked={this.props.onTestContentClicked}
2963
2960
  >
2964
2961
  </TemplatePreview>
2965
2962
  </CapColumn>
@@ -3009,10 +3006,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3009
3006
  ],
3010
3007
  appName: val.content.appName,
3011
3008
  }}
3012
- showTestAndPreviewIcon
3013
- onPreviewContentClicked={this.props.onPreviewContentClicked}
3014
- onTestContentClicked={this.props.onTestContentClicked}
3015
- templateDataRaw={this.props.templateData}
3016
3009
  >
3017
3010
  </TemplatePreview>
3018
3011
  </CapColumn>
@@ -3488,7 +3481,6 @@ FormBuilder.propTypes = {
3488
3481
  selectedOfferDetails: PropTypes.array,
3489
3482
  setDrawerVisibility: PropTypes.bool,
3490
3483
  capDrawerContent: PropTypes.array,
3491
- isFullMode: PropTypes.bool,
3492
3484
  };
3493
3485
 
3494
3486
  export default injectIntl(FormBuilder);
@@ -7,10 +7,16 @@
7
7
  import PropTypes from 'prop-types';
8
8
 
9
9
  import React from 'react';
10
- import { CapTab, CapIcon } from '@capillarytech/cap-ui-library';
10
+ import { CapButton } from '@capillarytech/cap-ui-library';
11
+ // import styled from 'styled-components';
12
+
13
+ import { FormattedMessage } from 'react-intl';
14
+ import { Button } from 'antd';
11
15
  import { get, map, isEmpty} from 'lodash';
12
16
  import TemplatePreview from '../TemplatePreview';
13
17
  import '../PreviewSideBar/_previewsidebar.scss';
18
+ import messages from './messages';
19
+ const ButtonGroup = Button.Group;
14
20
 
15
21
  class MobilePushPreviewV2 extends React.Component { // eslint-disable-line react/prefer-stateless-function
16
22
  constructor(props) {
@@ -18,9 +24,6 @@ class MobilePushPreviewV2 extends React.Component { // eslint-disable-line react
18
24
  this.goToEdit = this.goToEdit.bind(this);
19
25
  this.goToDuplicate = this.goToDuplicate.bind(this);
20
26
  this.changeDevice = this.changeDevice.bind(this);
21
- this.getPreview = this.getPreview.bind(this);
22
- this.setContent = this.setContent.bind(this);
23
- this.goToDuplicate = this.goToDuplicate.bind(this);
24
27
  const hasAndroid = get(props, 'templateData.versions.base.ANDROID') || get(props, 'templateData.androidContent');
25
28
  const hasIos = get(props, 'templateData.versions.base.IOS') || get(props, 'templateData.iosContent');
26
29
  let device = "android";
@@ -35,7 +38,7 @@ class MobilePushPreviewV2 extends React.Component { // eslint-disable-line react
35
38
  };
36
39
  }
37
40
 
38
- setContent(templateData, device) {
41
+ setContent = (templateData, device) => {
39
42
  const androidContent = get(templateData, 'versions.base.ANDROID') || get(templateData, 'androidContent');
40
43
  const iosContent = get(templateData, 'versions.base.IOS') || get(templateData, 'iosContent');
41
44
 
@@ -56,21 +59,12 @@ class MobilePushPreviewV2 extends React.Component { // eslint-disable-line react
56
59
  }
57
60
  return content;
58
61
  }
59
- getPreview(device) {
60
- return (
61
- <TemplatePreview
62
- device={device}
63
- channel={this.props.channel}
64
- content={this.state.content || ''}
65
- templateData={this.props.templateData}
66
- />
67
- );
68
- }
69
62
  goToDuplicate() {
70
63
  this.props.onDuplicateClick(this.props.templateData);
71
64
  this.props.handleClose();
72
65
  }
73
- changeDevice(device) {
66
+ changeDevice(ev) {
67
+ const device = ev.target.value;
74
68
  const content = this.setContent(this.props.templateData, device);
75
69
  this.setState({device, content });
76
70
  }
@@ -78,40 +72,38 @@ class MobilePushPreviewV2 extends React.Component { // eslint-disable-line react
78
72
  this.props.onEditClick(e, this.props.templateData._id, this.props.templateData.modeType, path);
79
73
  }
80
74
  render() {
81
- const {templateData} = this.props;
75
+ const {templateData, channel} = this.props;
76
+
82
77
  const hasAndroid = get(templateData, 'versions.base.ANDROID') || get(templateData, 'androidContent');
83
78
  const hasIos = get(templateData, 'versions.base.IOS') || get(templateData, 'iosContent');
84
- const hasBothAndroidAndIos = hasAndroid && hasIos;
79
+
80
+ const {device, content} = this.state;
85
81
 
86
82
  return (
83
+
87
84
  <div>
88
85
  <div className="devices">
89
- {!isEmpty(templateData) &&
90
- ( hasBothAndroidAndIos ? (
91
- <CapTab
92
- panes={[
93
- {
94
- content: this.getPreview('android'),
95
- tab: <CapIcon type="android" size="m" />,
96
- key: 'android',
97
- },
98
- {
99
- content: this.getPreview('iphone'),
100
- tab: <CapIcon type="ios" size="m" />,
101
- key: 'iphone',
102
- },
103
- ]}
104
- onChange={(activeKey) => this.changeDevice(activeKey)}
105
- tabBarStyle={{margin: 'auto', width: '38%'}}
106
- />
107
- ) : (
108
- (hasAndroid || hasIos) && this.getPreview(hasAndroid ? 'android' : 'ios')
109
- ))
110
- }
86
+ {!isEmpty(templateData) && hasAndroid && hasIos &&
87
+ <ButtonGroup onClick={this.changeDevice}>
88
+ <CapButton type={device === "android" ? "primary" : "secondary"} value={"android"}><FormattedMessage {...messages.android} /></CapButton>
89
+ <CapButton type={device === "iphone" ? "primary" : "secondary"} value={"iphone"}><FormattedMessage {...messages.ios} /></CapButton>
90
+ </ButtonGroup>}
111
91
  </div>
92
+ <TemplatePreview
93
+ device={device === "android" ? "android" : "iphone"}
94
+ channel={channel}
95
+ content={content || ''}
96
+ templateData={templateData}
97
+ >
98
+ </TemplatePreview>
99
+
100
+
112
101
  </div>
102
+
103
+
113
104
  );
114
105
  }
106
+
115
107
  }
116
108
 
117
109
  MobilePushPreviewV2.propTypes = {
@@ -10,4 +10,12 @@ export default defineMessages({
10
10
  id: 'creatives.componentsv2.MobilePushPreviewV2.header',
11
11
  defaultMessage: 'This is the MobilePushPreviewV2 component !',
12
12
  },
13
+ android: {
14
+ id: 'creatives.componentsv2.MobilePushPreviewV2.android',
15
+ defaultMessage: 'Android',
16
+ },
17
+ ios: {
18
+ id: 'creatives.componentsv2.MobilePushPreviewV2.ios',
19
+ defaultMessage: 'IOS',
20
+ },
13
21
  });
@@ -1,69 +1,5 @@
1
1
  @import '~@capillarytech/cap-ui-library/styles/_variables.scss';
2
2
 
3
- .shell-lock-screen-android .main-screen-preview .wechatMsgContainer{
4
- position: absolute;
5
- left: 53.5%;
6
- top:28%;
7
- background: white;
8
- width: 19.5%;
9
- text-align: left;
10
- height: fit-content;
11
- border-radius: 0.285rem;
12
- }
13
-
14
- .shell-lock-screen-android .lock-screen-preview{
15
- .wechat-android-sender-id{
16
- position: absolute;
17
- top: 46%;
18
- font-size: 10px;
19
- left: 28%;
20
- }
21
- .wechat-android-title{
22
- position: absolute;
23
- top: 49%;
24
- font-size: 10px;
25
- left: 28%;
26
- color: #5e6c84;
27
- }
28
- .wechat-android-action-buttons{
29
- position: absolute;
30
- left: 28%;
31
- top: 53%;
32
- font-size: 10px;
33
- color: #3861ca;
34
- font-weight: 500;
35
- }
36
- .wechat-ios-sender-id{
37
- position: absolute;
38
- top: 44%;
39
- font-size: 10px;
40
- left: 28.5%;
41
- }
42
- .wechat-ios-title{
43
- position: absolute;
44
- top: 47%;
45
- font-size: 10px;
46
- left: 28.5%;
47
- color: #5e6c84;
48
- }
49
- .wechat-ios-action-reply{
50
- position: absolute;
51
- left: 35%;
52
- top: 59%;
53
- font-size: 12px;
54
- color: #3861ca;
55
- font-weight: 500;
56
- }
57
- .wechat-ios-action-cancel{
58
- position: absolute;
59
- left: 34.5%;
60
- top: 66%;
61
- font-size: 12px;
62
- color: #3861ca;
63
- font-weight: 500;
64
- }
65
- }
66
-
67
3
  .wechatMsgContainer{
68
4
  position: absolute;
69
5
  left: 30%;