@capillarytech/creatives-library 7.0.8 → 7.1.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 (33) hide show
  1. package/config/app.js +2 -0
  2. package/index.js +7 -0
  3. package/package.json +1 -1
  4. package/reducers.js +2 -1
  5. package/services/api.js +7 -0
  6. package/utils/common.js +177 -0
  7. package/v2Components/TemplatePreview/assets/images/mobile.svg +24 -0
  8. package/v2Components/TemplatePreview/index.js +8 -12
  9. package/v2Containers/App/constants.js +1 -1
  10. package/v2Containers/CreativesContainer/SlideBoxContent.js +17 -3
  11. package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -0
  12. package/v2Containers/CreativesContainer/constants.js +2 -0
  13. package/v2Containers/CreativesContainer/index.js +14 -14
  14. package/v2Containers/FTP/_FTP.scss +103 -0
  15. package/v2Containers/FTP/actions.js +7 -0
  16. package/v2Containers/FTP/constants.js +3 -0
  17. package/v2Containers/FTP/index.js +509 -0
  18. package/v2Containers/FTP/messages.js +60 -0
  19. package/v2Containers/FTP/reducer.js +32 -0
  20. package/v2Containers/FTP/sagas.js +26 -0
  21. package/v2Containers/FTP/selectors.js +20 -0
  22. package/v2Containers/FTP/temp.js +11838 -0
  23. package/v2Containers/Templates/_templates.scss +2 -2
  24. package/v2Containers/Templates/actions.js +110 -117
  25. package/v2Containers/Templates/constants.js +0 -2
  26. package/v2Containers/Templates/index.js +1 -29
  27. package/v2Containers/Templates/messages.js +0 -4
  28. package/v2Containers/Templates/reducer.js +0 -2
  29. package/v2Containers/TemplatesV2/index.js +13 -0
  30. package/v2Containers/TemplatesV2/messages.js +4 -0
  31. package/v2Containers/Viber/index.js +12 -32
  32. package/v2Containers/Viber/messages.js +4 -12
  33. package/v2Components/TemplatePreview/assets/images/viberMobile.svg +0 -135
@@ -20,7 +20,7 @@ import { VIBER } from '../../v2Containers/App/constants';
20
20
  const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
21
21
  const smsMobileAndroid = require('./assets/images/sms_mobile_android.svg');
22
22
  const lineMobileAndroid = require('../../assets/line.png');
23
- const viberMobileAndroid = require('./assets/images/viberMobile.svg');
23
+ const viberMobileAndroid = require('../../assets/viber.png');
24
24
 
25
25
  const lineImgPlaceholder = require('../../assets/line-image-placeholder.svg');
26
26
  const lineStickerPlaceholder = require('../../assets/smiley-placeholder.svg');
@@ -131,7 +131,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
131
131
 
132
132
  render() {
133
133
  let content = channel && channel.toLowerCase() === 'sms' ? [this.props.content] : this.props.content;
134
- const { channel, showTestAndPreviewIcon, module, viberBrandName, viberAccountName } = this.props;
134
+ const { channel, showTestAndPreviewIcon, module } = this.props;
135
135
  const { buttonText, imageURL, messageContent: viberMessageContent } = content || {};
136
136
  let smsDetails = {};
137
137
  // let smsText = '';
@@ -184,7 +184,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
184
184
  "padding": '3.5px 0 0',
185
185
  'border-radius': '8px',
186
186
  'background-color': CAP_G15,
187
- 'width': '81%',
187
+ 'width': '79%',
188
188
  };
189
189
  const getVideoContent = ({
190
190
  video,
@@ -561,7 +561,6 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
561
561
  channel && channel.toLowerCase() === VIBER ? (
562
562
  <div className="shell-v2 align-center" id="sms-preview">
563
563
  <CapImage className="preview-image" src={viberMobileAndroid} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
564
- <div style={{ position: 'absolute', top: '12%', left: '36%'}}>{viberBrandName}</div>
565
564
  <div
566
565
  className="msgContainer viber-preview"
567
566
  style={{
@@ -575,14 +574,15 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
575
574
  "width": 20,
576
575
  "height": 20,
577
576
  "margin": '0 4px 277px 0',
577
+ "padding": '6px 2px 7px 3px',
578
578
  'border-radius': '4px',
579
579
  'background-color': CAP_PURPLE01,
580
- 'font-size': '12px',
580
+ 'font-size': '6px',
581
581
  'font-weight': 900,
582
582
  "color": CAP_WHITE,
583
583
  }}
584
584
  >
585
- {viberAccountName}
585
+ {this.props.viberAccountName}
586
586
  </div>
587
587
  <div
588
588
  className="message-pop align-left"
@@ -614,17 +614,13 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
614
614
  'background-color': CAP_PURPLE01,
615
615
  "margin-top": '14px',
616
616
  'text-align': 'center',
617
- "width": '140px',
617
+ "width": '132px',
618
618
  "height": '20px',
619
- "margin-left": "2px",
619
+ "margin-left": "5px",
620
620
  }}>
621
621
  <p
622
622
  style={{ 'font-size': '12px',
623
623
  'font-weight': '500',
624
- "display": '-webkit-box',
625
- '-webkit-line-clamp': '1',
626
- '-webkit-box-orient': 'vertical',
627
- 'overflow': 'hidden',
628
624
  "color": CAP_WHITE }}
629
625
  >
630
626
  {buttonText || ''}</p>
@@ -47,5 +47,5 @@ export const CHANNEL_EDIT_TRACK_MAPPING = {
47
47
  };
48
48
  export const GTM_TRACKING_ID = 'UA-110024621-2';
49
49
  export const BEE_PLUGIN = 'BEE_PLUGIN';
50
-
50
+ export const NO_COMMUNICATION = 'NO_COMMUNICATION';
51
51
  export const CREATIVES_UI_VIEW = 'CREATIVES_UI_VIEW';
@@ -19,6 +19,7 @@ import CallTask from '../CallTask';
19
19
  import MobliPushEdit from '../MobilePush/Edit';
20
20
  import * as constants from './constants';
21
21
  import LineContainer from '../Line/Container';
22
+ import FTP from '../FTP';
22
23
  import Viber from '../Viber';
23
24
  const CreativesWrapper = styled.div`
24
25
  .ant-popover,
@@ -134,6 +135,7 @@ function SlideBoxContent(props) {
134
135
  selectedAccount,
135
136
  onShowTemplates,
136
137
  handleClose,
138
+ onFTPSubmit,
137
139
  } = props;
138
140
  const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
139
141
  const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
@@ -173,6 +175,7 @@ function SlideBoxContent(props) {
173
175
  let isEditCallTask = false;
174
176
  let isEditMPush = false;
175
177
  let isEditFacebook = false;
178
+ let isEditFTP = false;
176
179
  const isEmailCreate = slidBoxContent === 'createTemplate' && channel === constants.EMAIL;
177
180
  if (templateData && channel) {
178
181
  channel = templateData.type;// for edit mode with template data
@@ -185,6 +188,7 @@ function SlideBoxContent(props) {
185
188
  isPreview = slidBoxContent === 'preview' && (channel === constants.SMS || channel === constants.LINE || channel === constants.VIBER);
186
189
  isEmailPreview = slidBoxContent === 'preview' && channel === constants.EMAIL;
187
190
  isMpushPreview = slidBoxContent === 'preview' && channel === constants.MOBILE_PUSH;
191
+ isEditFTP = slidBoxContent === 'editTemplate' && [constants.NO_COMMUNICATION, constants.FTP].includes(channel);
188
192
  }
189
193
 
190
194
  const getChannelPreviewContent = (templateDataObject) => {
@@ -263,7 +267,6 @@ function SlideBoxContent(props) {
263
267
  return get(templateDataObject, `versions.base.content`);
264
268
  }
265
269
  };
266
-
267
270
  return (
268
271
  <CreativesWrapper>
269
272
  {!isFullMode && slidBoxContent === 'templates' && (
@@ -286,13 +289,15 @@ function SlideBoxContent(props) {
286
289
  onCreateComplete={onCreateComplete}
287
290
  getFormSubscriptionData={getFormData}
288
291
  handleClose={handleClose}
292
+ onFTPSubmit={onFTPSubmit}
293
+ slidBoxContent={slidBoxContent}
294
+ FTPMode="create"
295
+ selectedOfferDetails={selectedOfferDetails}
289
296
  />
290
297
  )}
291
298
  {isPreview && (
292
299
  <TemplatePreview
293
300
  content={getChannelPreviewContent(templateData)}
294
- viberBrandName={selectedAccount || ""}
295
- viberAccountName={(selectedAccount || "")[0]}
296
301
  unicodeEnabled={get(templateData, `versions.base['unicode-validity']`)}
297
302
  channel={(templateData.type || '').toLowerCase()}
298
303
  charCounterEnabled={channel === constants.SMS}
@@ -354,6 +359,14 @@ function SlideBoxContent(props) {
354
359
  onTestContentClicked={onTestContentClicked}
355
360
  />
356
361
  )}
362
+ {isEditFTP && (
363
+ <FTP
364
+ mode="edit"
365
+ onFTPSubmit={onFTPSubmit}
366
+ messageDetails={messageDetails}
367
+ selectedOfferDetails={selectedOfferDetails}
368
+ />
369
+ )}
357
370
  {
358
371
  isEditCallTask &&
359
372
  <CallTask
@@ -608,5 +621,6 @@ SlideBoxContent.propTypes = {
608
621
  onCreateComplete: PropTypes.func,
609
622
  saveMessage: PropTypes.func,
610
623
  selectedAccount: PropTypes.object,
624
+ onFTPSubmit: PropTypes.func,
611
625
  };
612
626
  export default SlideBoxContent;
@@ -15,6 +15,8 @@ function getChannelLabel(channel = '') {
15
15
  email: 'Email',
16
16
  mobilepush: 'Push notification',
17
17
  wechat: 'Wechat',
18
+ no_communication: 'NO_COMMUNICATION',
19
+ ftp: 'FTP',
18
20
  };
19
21
  return labels[channel.toLowerCase()];
20
22
  }
@@ -13,6 +13,8 @@ export const CALL_TASK = "CALL_TASK";
13
13
  export const MOBILE_PUSH = "MOBILEPUSH";
14
14
  export const WECHAT = "WECHAT";
15
15
  export const FACEBOOK = "FACEBOOK";
16
+ export const FTP = "FTP";
17
+ export const NO_COMMUNICATION = "NO_COMMUNICATION";
16
18
  export const VIBER = "VIBER";
17
19
 
18
20
  export const SHOW_CONTANER_LOADER = "app/CreativesContainer/SHOW_CONTANER_LOADER";
@@ -5,7 +5,7 @@ import {
5
5
  } from '@capillarytech/cap-ui-library';
6
6
  import { injectIntl, FormattedMessage } from 'react-intl';
7
7
  import classnames from 'classnames';
8
- import {isEmpty, get, forEach, cloneDeep} from 'lodash';
8
+ import {isEmpty, get, forEach} from 'lodash';
9
9
  import { connect } from 'react-redux';
10
10
  import { createStructuredSelector } from 'reselect';
11
11
  import { bindActionCreators } from 'redux';
@@ -18,6 +18,7 @@ import SlideBoxHeader from './SlideBoxHeader';
18
18
  import SlideBoxFooter from './SlideBoxFooter';
19
19
  import * as constants from './constants';
20
20
  import * as commonUtil from '../../utils/common';
21
+
21
22
  import './index.scss';
22
23
  import * as templateActions from '../Templates/actions';
23
24
  import * as globalActions from '../Cap/actions';
@@ -142,6 +143,13 @@ class Creatives extends React.Component {
142
143
  const {channel} = templateData;
143
144
  let creativesTemplateData = {type: channel };
144
145
  switch (channel) {
146
+ case constants.NO_COMMUNICATION: {
147
+ creativesTemplateData = {
148
+ type: channel,
149
+ ...templateData,
150
+ };
151
+ break;
152
+ }
145
153
  case constants.SMS: {
146
154
  const formData = {
147
155
  "sms-editor": templateData.messageBody,
@@ -248,7 +256,7 @@ class Creatives extends React.Component {
248
256
  }
249
257
  case constants.VIBER: {
250
258
  const { messageBody, isDefault } = templateData;
251
- const viber = JSON.parse(messageBody || '{}');
259
+ const viberContent = JSON.parse(messageBody || '{}').messages || [{}];
252
260
  creativesTemplateData = {
253
261
  type: constants.VIBER,
254
262
  isDefault,
@@ -257,7 +265,7 @@ class Creatives extends React.Component {
257
265
  versions: {
258
266
  base: {
259
267
  content: {
260
- ...viber,
268
+ viber: viberContent,
261
269
  },
262
270
  },
263
271
  },
@@ -351,19 +359,10 @@ class Creatives extends React.Component {
351
359
  break;
352
360
  case constants.VIBER:
353
361
  if (template.value) {
354
- const { Templates, templateData: templateDataProps } = this.props;
355
- const { accountDetails: selectedAccountDetails, accountId: selectedAccountId } = templateDataProps || {};
356
- const selectedViberAccount = Templates && Templates.selectedViberAccount;
357
- const accountDetails = selectedAccountDetails || (selectedViberAccount ? JSON.stringify(selectedViberAccount) : '');
358
- const accountId = selectedAccountId || (selectedViberAccount ? selectedViberAccount.id : '');
359
362
  const { versions } = template.value;
360
- const content = cloneDeep(versions.base.content);
361
- content.scenarioKey = get(accountDetails, 'configs.scenario_key');
362
363
  templateData = {
363
364
  channel,
364
- accountId,
365
- accountDetails,
366
- messageBody: JSON.stringify(content),
365
+ messageBody: JSON.stringify(versions.base.content),
367
366
  };
368
367
  }
369
368
  break;
@@ -641,6 +640,7 @@ class Creatives extends React.Component {
641
640
  selectedAccount={this.props.selectedAccount}
642
641
  onShowTemplates={this.onShowTemplates}
643
642
  handleClose={this.handleCloseSlideBox}
643
+ onFTPSubmit={getCreativesData}
644
644
  editor={editor}
645
645
  />
646
646
  }
@@ -710,4 +710,4 @@ function mapDispatchToProps(dispatch) {
710
710
  actions: bindActionCreators(actions, dispatch),
711
711
  };
712
712
  }
713
- export default connect(mapStatesToProps, mapDispatchToProps)(injectIntl(Creatives));
713
+ export default connect(mapStatesToProps, mapDispatchToProps)(injectIntl(Creatives));
@@ -0,0 +1,103 @@
1
+ @import '~@capillarytech/cap-ui-library/styles/_variables.scss';
2
+
3
+ .selected-server-name{
4
+ display: flex;
5
+ align-items: center;
6
+ margin-top: $CAP_SPACE_16;
7
+ .server-avtar, .server-name, .server-change{
8
+ display: inline-block;
9
+ }
10
+ .server-change{
11
+ margin-left: $CAP_SPACE_24;
12
+ }
13
+ }
14
+ .select-server{
15
+ display: inline-block;
16
+ }
17
+ .configure-csv-container{
18
+ margin-top: $CAP_SPACE_32;
19
+ .configure-csv, .add-column{
20
+ display: inline-block;
21
+ }
22
+ }
23
+ .column-selection-container{
24
+ width: 200px;
25
+ display: inline-block;
26
+ margin: $CAP_SPACE_04;
27
+ }
28
+ .column-selection-container-cid{
29
+ width: 120px;
30
+ display: inline-block;
31
+ }
32
+ .select-csv-column{
33
+ width: 80%;
34
+ border: 1px solid #d9d9d9 !important;
35
+ border-radius: 4px !important;
36
+ display: inline-block;
37
+ }
38
+ .select-csv-col-dropdown ul{
39
+ padding: 0 $CAP_SPACE_04;
40
+ }
41
+ .select-csv-col-dropdown ul li{
42
+ margin: $CAP_SPACE_08 0 !important;
43
+ padding: 0;
44
+ white-space: nowrap;
45
+ list-style: none;
46
+ outline: 0;
47
+ }
48
+ .select-csv-col-dropdown {
49
+ .ant-select-tree-switcher-noop, .ant-select-tree-node-content-wrapper{
50
+ display: inline-block !important;
51
+ margin: 0 !important;
52
+ }
53
+ .ant-select-tree-child-tree-open {
54
+ display: block !important;
55
+ padding: 0 0 0 $CAP_SPACE_16 !important;
56
+ }
57
+ }
58
+ .remove-csv-column{
59
+ display: inline-block;
60
+ margin-left: $CAP_SPACE_08;
61
+ }
62
+ .scrollable-section{
63
+ height: calc(100vh - 220px);
64
+ overflow-y: auto;
65
+ }
66
+ .FTP-tagList {
67
+ position: absolute;
68
+ right: 0;
69
+ top: -10px;
70
+ }
71
+ .ftp-message-container{
72
+ margin-top: $CAP_SPACE_32;
73
+ .message-content-title{
74
+ margin-top: $CAP_SPACE_24;
75
+ position: relative;
76
+ }
77
+ }
78
+
79
+ .ftp-preview-container{
80
+ .ftp-preview-message-title{
81
+ margin-top: $CAP_SPACE_16;
82
+ }
83
+ .ftp-preview-message-content{
84
+ max-width: 450px;
85
+ margin-top: 4px;
86
+ color: $FONT_COLOR_02;
87
+ }
88
+ .ftp-preview-data-title{
89
+ margin-top: $CAP_SPACE_40;
90
+ }
91
+ .ftp-preview-data-col-container{
92
+ margin-top: $CAP_SPACE_16;
93
+ .ant-tag.cap-tag-v2{
94
+ background-color: $CAP_WHITE;
95
+ font-weight: 500;
96
+ }
97
+ }
98
+ }
99
+
100
+ .manage-ftp-setting-div{
101
+ display: flex;
102
+ align-items: baseline;
103
+ }
@@ -0,0 +1,7 @@
1
+ import * as types from './constants';
2
+
3
+ export function getFTPServers() {
4
+ return {
5
+ type: types.GET_FTP_SERVERS_REQUEST,
6
+ };
7
+ }
@@ -0,0 +1,3 @@
1
+ export const GET_FTP_SERVERS_REQUEST = 'app/v2Containers/FTP/GET_FTP_SERVERS_REQUEST';
2
+ export const GET_FTP_SERVERS_SUCCESS = 'app/v2Containers/FTP/GET_FTP_SERVERS_SUCCESS';
3
+ export const GET_FTP_SERVERS_FAILURE = 'app/v2Containers/FTP/GET_FTP_SERVERS_FAILURE';