@capillarytech/creatives-library 7.1.11 → 7.2.1
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/assets/viber.png +0 -0
- package/index.js +8 -1
- package/package.json +2 -1
- package/reducers.js +2 -0
- package/routes.js +7 -1
- package/services/api.js +5 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +8 -2
- package/v2Components/TemplatePreview/assets/images/viberMobile.svg +135 -0
- package/v2Components/TemplatePreview/index.js +108 -18
- package/v2Containers/App/constants.js +1 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +67 -2
- package/v2Containers/CreativesContainer/constants.js +2 -0
- package/v2Containers/CreativesContainer/index.js +40 -5
- package/v2Containers/FTP/_FTP.scss +103 -0
- package/v2Containers/FTP/actions.js +7 -0
- package/v2Containers/FTP/constants.js +3 -0
- package/v2Containers/FTP/index.js +534 -0
- package/v2Containers/FTP/messages.js +60 -0
- package/v2Containers/FTP/reducer.js +32 -0
- package/v2Containers/FTP/sagas.js +26 -0
- package/v2Containers/FTP/selectors.js +20 -0
- package/v2Containers/Templates/_templates.scss +57 -0
- package/v2Containers/Templates/actions.js +117 -110
- package/v2Containers/Templates/constants.js +2 -0
- package/v2Containers/Templates/index.js +88 -7
- package/v2Containers/Templates/messages.js +4 -0
- package/v2Containers/Templates/reducer.js +2 -0
- package/v2Containers/TemplatesV2/index.js +9 -1
- package/v2Containers/TemplatesV2/messages.js +4 -0
- package/v2Containers/Viber/actions.js +74 -0
- package/v2Containers/Viber/constants.js +30 -0
- package/v2Containers/Viber/index.js +727 -0
- package/v2Containers/Viber/messages.js +145 -0
- package/v2Containers/Viber/reducer.js +84 -0
- package/v2Containers/Viber/sagas.js +107 -0
- package/v2Containers/Viber/selectors.js +21 -0
- package/v2Components/TemplatePreview/assets/images/mobile.svg +0 -24
- package/v2Containers/Line/Create/_lineCreate.scss +0 -64
- package/v2Containers/Line/Create/actions.js +0 -94
- package/v2Containers/Line/Create/constants.js +0 -43
- package/v2Containers/Line/Create/index.js +0 -1132
- package/v2Containers/Line/Create/initialSchema.js +0 -378
- package/v2Containers/Line/Create/messages.js +0 -229
- package/v2Containers/Line/Create/reducer.js +0 -99
- package/v2Containers/Line/Create/sagas.js +0 -113
- package/v2Containers/Line/Create/selectors.js +0 -30
- package/v2Containers/Line/CreateWrapper/constants.js +0 -2
- package/v2Containers/Line/CreateWrapper/index.js +0 -117
- package/v2Containers/Line/CreateWrapper/messages.js +0 -55
- package/v2Containers/Line/Edit/_lineEdit.scss +0 -23
- package/v2Containers/Line/Edit/actions.js +0 -79
- package/v2Containers/Line/Edit/constants.js +0 -27
- package/v2Containers/Line/Edit/index.js +0 -1051
- package/v2Containers/Line/Edit/messages.js +0 -173
- package/v2Containers/Line/Edit/reducer.js +0 -83
- package/v2Containers/Line/Edit/sagas.js +0 -81
- package/v2Containers/Line/Edit/selectors.js +0 -29
- package/v2Containers/Line/Edit/tests/actions.test.js +0 -18
- package/v2Containers/Line/Edit/tests/index.test.js +0 -10
- package/v2Containers/Line/Edit/tests/reducer.test.js +0 -9
- package/v2Containers/Line/Edit/tests/sagas.test.js +0 -15
- package/v2Containers/Line/Edit/tests/selectors.test.js +0 -10
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import get from 'lodash/get';
|
|
5
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
5
6
|
import TemplatesV2 from '../TemplatesV2';
|
|
6
7
|
import TemplatePreview from '../../v2Components/TemplatePreview';
|
|
7
8
|
import SmsCreate from '../Sms/Create';
|
|
@@ -18,6 +19,7 @@ import CallTask from '../CallTask';
|
|
|
18
19
|
import MobliPushEdit from '../MobilePush/Edit';
|
|
19
20
|
import * as constants from './constants';
|
|
20
21
|
import LineContainer from '../Line/Container';
|
|
22
|
+
import Viber from '../Viber';
|
|
21
23
|
const CreativesWrapper = styled.div`
|
|
22
24
|
.ant-popover,
|
|
23
25
|
.ant-notification,
|
|
@@ -32,7 +34,6 @@ function getWechatTemplateType(mode, templateData, weChatTemplateType = '') {
|
|
|
32
34
|
}
|
|
33
35
|
return weChatTemplateType;
|
|
34
36
|
}
|
|
35
|
-
|
|
36
37
|
const getLineType = ({
|
|
37
38
|
slidBoxContent,
|
|
38
39
|
channel,
|
|
@@ -70,6 +71,22 @@ const getLineType = ({
|
|
|
70
71
|
}
|
|
71
72
|
return {};
|
|
72
73
|
};
|
|
74
|
+
const getViber = ({
|
|
75
|
+
slidBoxContent,
|
|
76
|
+
channel,
|
|
77
|
+
isFullMode,
|
|
78
|
+
templateData,
|
|
79
|
+
}) => {
|
|
80
|
+
if ((channel === constants.VIBER || (slidBoxContent === 'editTemplate' && templateData && templateData.type === constants.VIBER)) && slidBoxContent !== 'templates') {
|
|
81
|
+
const isCreate = slidBoxContent === 'createTemplate';
|
|
82
|
+
const isEdit = slidBoxContent === 'editTemplate';
|
|
83
|
+
return {
|
|
84
|
+
isCreate,
|
|
85
|
+
isEdit,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return {};
|
|
89
|
+
};
|
|
73
90
|
|
|
74
91
|
function SlideBoxContent(props) {
|
|
75
92
|
const {
|
|
@@ -135,6 +152,15 @@ function SlideBoxContent(props) {
|
|
|
135
152
|
isFullMode,
|
|
136
153
|
templateData,
|
|
137
154
|
});
|
|
155
|
+
const {isCreate: isCreateViber = false,
|
|
156
|
+
isEdit: isEditViber = false } = getViber({
|
|
157
|
+
slidBoxContent,
|
|
158
|
+
channel,
|
|
159
|
+
isFullMode,
|
|
160
|
+
templateData,
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
|
|
138
164
|
const isCreateSms = slidBoxContent === 'createTemplate' && channel === constants.SMS;
|
|
139
165
|
const isCreateMPush = slidBoxContent === 'createTemplate' && channel === constants.MOBILE_PUSH;
|
|
140
166
|
const isCreateCallTask = slidBoxContent === 'createTemplate' && channel === constants.CALL_TASK;
|
|
@@ -156,7 +182,7 @@ function SlideBoxContent(props) {
|
|
|
156
182
|
isEditEmailWithId = slidBoxContent === 'editTemplate' && channel === constants.EMAIL && templateData._id;
|
|
157
183
|
isEmailEditWithContent = slidBoxContent === 'editTemplate' && channel === constants.EMAIL && !templateData._id;
|
|
158
184
|
isEditFacebook = slidBoxContent === 'editTemplate' && channel === constants.FACEBOOK;
|
|
159
|
-
isPreview = slidBoxContent === 'preview' && (channel === constants.SMS || channel === constants.LINE);
|
|
185
|
+
isPreview = slidBoxContent === 'preview' && (channel === constants.SMS || channel === constants.LINE || channel === constants.VIBER);
|
|
160
186
|
isEmailPreview = slidBoxContent === 'preview' && channel === constants.EMAIL;
|
|
161
187
|
isMpushPreview = slidBoxContent === 'preview' && channel === constants.MOBILE_PUSH;
|
|
162
188
|
}
|
|
@@ -223,6 +249,16 @@ function SlideBoxContent(props) {
|
|
|
223
249
|
return previewContent;
|
|
224
250
|
});
|
|
225
251
|
}
|
|
252
|
+
case constants.VIBER: {
|
|
253
|
+
const template = cloneDeep(templateDataObject);
|
|
254
|
+
const { text = "", imageURL = "", buttonText = "" } = get(template, 'versions.base.content.viber', {});
|
|
255
|
+
template.content = {
|
|
256
|
+
messageContent: text,
|
|
257
|
+
imageURL,
|
|
258
|
+
buttonText,
|
|
259
|
+
};
|
|
260
|
+
return template.content;
|
|
261
|
+
}
|
|
226
262
|
default:
|
|
227
263
|
return get(templateDataObject, `versions.base.content`);
|
|
228
264
|
}
|
|
@@ -255,6 +291,8 @@ function SlideBoxContent(props) {
|
|
|
255
291
|
{isPreview && (
|
|
256
292
|
<TemplatePreview
|
|
257
293
|
content={getChannelPreviewContent(templateData)}
|
|
294
|
+
viberBrandName={selectedAccount || ""}
|
|
295
|
+
viberAccountName={(selectedAccount || "")[0]}
|
|
258
296
|
unicodeEnabled={get(templateData, `versions.base['unicode-validity']`)}
|
|
259
297
|
channel={(templateData.type || '').toLowerCase()}
|
|
260
298
|
charCounterEnabled={channel === constants.SMS}
|
|
@@ -500,6 +538,33 @@ function SlideBoxContent(props) {
|
|
|
500
538
|
/>
|
|
501
539
|
)
|
|
502
540
|
}
|
|
541
|
+
{isCreateViber && (
|
|
542
|
+
<Viber
|
|
543
|
+
location={creativesLocationProps}
|
|
544
|
+
onCreateComplete={onCreateComplete}
|
|
545
|
+
isFullMode={isFullMode}
|
|
546
|
+
handleClose={handleClose}
|
|
547
|
+
isGetFormData={isGetFormData}
|
|
548
|
+
getFormSubscriptionData={getFormData}
|
|
549
|
+
onShowTemplates={onShowTemplates}
|
|
550
|
+
templateData={templateData}
|
|
551
|
+
createNew/>
|
|
552
|
+
)}
|
|
553
|
+
|
|
554
|
+
{isEditViber && <Viber
|
|
555
|
+
location={creativesLocationProps}
|
|
556
|
+
params={{
|
|
557
|
+
id: templateData._id,
|
|
558
|
+
}}
|
|
559
|
+
onCreateComplete={onCreateComplete}
|
|
560
|
+
isFullMode={isFullMode}
|
|
561
|
+
handleClose={handleClose}
|
|
562
|
+
isGetFormData={isGetFormData}
|
|
563
|
+
getFormSubscriptionData={getFormData}
|
|
564
|
+
onShowTemplates={onShowTemplates}
|
|
565
|
+
templateData={templateData}
|
|
566
|
+
createNew/> }
|
|
567
|
+
|
|
503
568
|
</CreativesWrapper>
|
|
504
569
|
);
|
|
505
570
|
}
|
|
@@ -13,5 +13,7 @@ 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 VIBER = "VIBER";
|
|
17
|
+
|
|
16
18
|
export const SHOW_CONTANER_LOADER = "app/CreativesContainer/SHOW_CONTANER_LOADER";
|
|
17
19
|
export const HIDE_CONTAINER_LOADER = "app/CreativesContainer/HIDE_CONTAINER_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} from 'lodash';
|
|
8
|
+
import {isEmpty, get, forEach, cloneDeep} from 'lodash';
|
|
9
9
|
import { connect } from 'react-redux';
|
|
10
10
|
import { createStructuredSelector } from 'reselect';
|
|
11
11
|
import { bindActionCreators } from 'redux';
|
|
@@ -18,7 +18,6 @@ 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
|
-
|
|
22
21
|
import './index.scss';
|
|
23
22
|
import * as templateActions from '../Templates/actions';
|
|
24
23
|
import * as globalActions from '../Cap/actions';
|
|
@@ -247,6 +246,24 @@ class Creatives extends React.Component {
|
|
|
247
246
|
};
|
|
248
247
|
break;
|
|
249
248
|
}
|
|
249
|
+
case constants.VIBER: {
|
|
250
|
+
const { messageBody, isDefault } = templateData;
|
|
251
|
+
const viber = JSON.parse(messageBody || '{}');
|
|
252
|
+
creativesTemplateData = {
|
|
253
|
+
type: constants.VIBER,
|
|
254
|
+
isDefault,
|
|
255
|
+
edit: true,
|
|
256
|
+
name: "",
|
|
257
|
+
versions: {
|
|
258
|
+
base: {
|
|
259
|
+
content: {
|
|
260
|
+
...viber,
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
250
267
|
default:
|
|
251
268
|
break;
|
|
252
269
|
}
|
|
@@ -332,6 +349,24 @@ class Creatives extends React.Component {
|
|
|
332
349
|
};
|
|
333
350
|
}
|
|
334
351
|
break;
|
|
352
|
+
case constants.VIBER:
|
|
353
|
+
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
|
+
const { versions } = template.value;
|
|
360
|
+
const content = cloneDeep(versions.base.content);
|
|
361
|
+
content.scenarioKey = get(accountDetails, 'configs.scenario_key');
|
|
362
|
+
templateData = {
|
|
363
|
+
channel,
|
|
364
|
+
accountId,
|
|
365
|
+
accountDetails,
|
|
366
|
+
messageBody: JSON.stringify(content),
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
break;
|
|
335
370
|
default:
|
|
336
371
|
break;
|
|
337
372
|
}
|
|
@@ -446,8 +481,8 @@ class Creatives extends React.Component {
|
|
|
446
481
|
}
|
|
447
482
|
}
|
|
448
483
|
|
|
449
|
-
const
|
|
450
|
-
if (
|
|
484
|
+
const isLineViberChannel = templateData && [constants.LINE, constants.VIBER].includes(templateData);
|
|
485
|
+
if ([constants.LINE, constants.VIBER].includes(channel) || isLineViberChannel) {
|
|
451
486
|
showFooter = false;
|
|
452
487
|
}
|
|
453
488
|
|
|
@@ -675,4 +710,4 @@ function mapDispatchToProps(dispatch) {
|
|
|
675
710
|
actions: bindActionCreators(actions, dispatch),
|
|
676
711
|
};
|
|
677
712
|
}
|
|
678
|
-
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
|
+
}
|