@capillarytech/creatives-library 6.13.2 → 6.13.4
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/app.js +2 -5
- package/assets/viber.png +0 -0
- package/components/FormBuilder/index.js +2 -6
- package/containers/Ebill/index.js +0 -3
- package/containers/Email/index.js +8 -16
- package/containers/Sms/Create/index.js +1 -2
- package/index.js +8 -1
- package/package.json +2 -2
- package/reducers.js +2 -0
- package/routes.js +7 -1
- package/services/api.js +6 -0
- package/v2Components/FormBuilder/index.js +3 -5
- package/v2Components/TemplatePreview/_templatePreview.scss +8 -2
- package/v2Components/TemplatePreview/index.js +100 -17
- package/v2Containers/Cap/index.js +9 -30
- package/v2Containers/CreativesContainer/SlideBoxContent.js +65 -2
- package/v2Containers/CreativesContainer/constants.js +2 -0
- package/v2Containers/CreativesContainer/index.js +29 -2
- package/v2Containers/Templates/_templates.scss +57 -0
- package/v2Containers/Templates/index.js +54 -5
- package/v2Containers/TemplatesV2/index.js +12 -1
- package/v2Containers/TemplatesV2/messages.js +4 -0
- package/v2Containers/Viber/_viber.scss +3 -0
- package/v2Containers/Viber/actions.js +74 -0
- package/v2Containers/Viber/constants.js +30 -0
- package/v2Containers/Viber/index.js +700 -0
- package/v2Containers/Viber/messages.js +137 -0
- package/v2Containers/Viber/reducer.js +84 -0
- package/v2Containers/Viber/sagas.js +107 -0
- package/v2Containers/Viber/selectors.js +21 -0
- package/v2Containers/WeChat/MapTemplates/index.js +1 -1
- package/utils/ignoredErrorMessages.js +0 -4
|
@@ -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
|
}
|
|
@@ -500,6 +536,33 @@ function SlideBoxContent(props) {
|
|
|
500
536
|
/>
|
|
501
537
|
)
|
|
502
538
|
}
|
|
539
|
+
{isCreateViber && (
|
|
540
|
+
<Viber
|
|
541
|
+
location={creativesLocationProps}
|
|
542
|
+
onCreateComplete={onCreateComplete}
|
|
543
|
+
isFullMode={isFullMode}
|
|
544
|
+
handleClose={handleClose}
|
|
545
|
+
isGetFormData={isGetFormData}
|
|
546
|
+
getFormSubscriptionData={getFormData}
|
|
547
|
+
onShowTemplates={onShowTemplates}
|
|
548
|
+
templateData={templateData}
|
|
549
|
+
createNew/>
|
|
550
|
+
)}
|
|
551
|
+
|
|
552
|
+
{isEditViber && <Viber
|
|
553
|
+
location={creativesLocationProps}
|
|
554
|
+
params={{
|
|
555
|
+
id: templateData._id,
|
|
556
|
+
}}
|
|
557
|
+
onCreateComplete={onCreateComplete}
|
|
558
|
+
isFullMode={isFullMode}
|
|
559
|
+
handleClose={handleClose}
|
|
560
|
+
isGetFormData={isGetFormData}
|
|
561
|
+
getFormSubscriptionData={getFormData}
|
|
562
|
+
onShowTemplates={onShowTemplates}
|
|
563
|
+
templateData={templateData}
|
|
564
|
+
createNew/> }
|
|
565
|
+
|
|
503
566
|
</CreativesWrapper>
|
|
504
567
|
);
|
|
505
568
|
}
|
|
@@ -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";
|
|
@@ -247,6 +247,24 @@ class Creatives extends React.Component {
|
|
|
247
247
|
};
|
|
248
248
|
break;
|
|
249
249
|
}
|
|
250
|
+
case constants.VIBER: {
|
|
251
|
+
const { messageBody, isDefault } = templateData;
|
|
252
|
+
const viberContent = JSON.parse(messageBody || '{}').messages || [{}];
|
|
253
|
+
creativesTemplateData = {
|
|
254
|
+
type: constants.VIBER,
|
|
255
|
+
isDefault,
|
|
256
|
+
edit: true,
|
|
257
|
+
name: "Campaign message VIBER content",
|
|
258
|
+
versions: {
|
|
259
|
+
base: {
|
|
260
|
+
content: {
|
|
261
|
+
viber: viberContent,
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
250
268
|
default:
|
|
251
269
|
break;
|
|
252
270
|
}
|
|
@@ -332,6 +350,15 @@ class Creatives extends React.Component {
|
|
|
332
350
|
};
|
|
333
351
|
}
|
|
334
352
|
break;
|
|
353
|
+
case constants.VIBER:
|
|
354
|
+
if (template.value) {
|
|
355
|
+
const { versions } = template.value;
|
|
356
|
+
templateData = {
|
|
357
|
+
channel,
|
|
358
|
+
messageBody: JSON.stringify(versions.base.content),
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
break;
|
|
335
362
|
default:
|
|
336
363
|
break;
|
|
337
364
|
}
|
|
@@ -446,8 +473,8 @@ class Creatives extends React.Component {
|
|
|
446
473
|
}
|
|
447
474
|
}
|
|
448
475
|
|
|
449
|
-
const
|
|
450
|
-
if (
|
|
476
|
+
const isLineViberChannel = templateData && [constants.LINE, constants.VIBER].includes(templateData);
|
|
477
|
+
if ([constants.LINE, constants.VIBER].includes(channel) || isLineViberChannel) {
|
|
451
478
|
showFooter = false;
|
|
452
479
|
}
|
|
453
480
|
|
|
@@ -46,6 +46,63 @@
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
+
.VIBER {
|
|
50
|
+
&.cap-custom-card{
|
|
51
|
+
height: 241px;
|
|
52
|
+
.ant-card-body {
|
|
53
|
+
padding:0px 24px 0px;
|
|
54
|
+
.button-content {
|
|
55
|
+
.ant-card-meta-description {
|
|
56
|
+
min-width: 108px;
|
|
57
|
+
max-width: 160px;
|
|
58
|
+
height: 24px;
|
|
59
|
+
padding: 1px 23px 2px 22px;
|
|
60
|
+
border-radius: 16px;
|
|
61
|
+
font-size: 14px;
|
|
62
|
+
font-weight: 500;
|
|
63
|
+
background-color:$CAP_PURPLE01;
|
|
64
|
+
color:$CAP_WHITE;
|
|
65
|
+
text-align:center;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
.truncate-text{
|
|
69
|
+
.ant-card-meta-description{
|
|
70
|
+
display: -webkit-box;
|
|
71
|
+
-webkit-line-clamp: 9;
|
|
72
|
+
-webkit-box-orient: vertical;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
.truncate-text-with-button{
|
|
76
|
+
.ant-card-meta-description{
|
|
77
|
+
-webkit-line-clamp: 8;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
.truncate-text-with-image{
|
|
81
|
+
.ant-card-meta-description{
|
|
82
|
+
-webkit-line-clamp: 2;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&.no-image .ant-card-meta {
|
|
89
|
+
.ant-card-meta-description {
|
|
90
|
+
word-wrap: break-word;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
&.carousel-img-section {
|
|
96
|
+
.ant-card-body {
|
|
97
|
+
padding: $CAP_SPACE_24 0;
|
|
98
|
+
}
|
|
99
|
+
.ant-card-meta {
|
|
100
|
+
padding: 0;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
}
|
|
49
106
|
}
|
|
50
107
|
}
|
|
51
108
|
|
|
@@ -30,6 +30,8 @@ import { makeSelectEbill as makeSelectCreateEbill } from '../Ebill/selectors';
|
|
|
30
30
|
import { makeSelectEmail as makeSelectCreateEmail } from '../Email/selectors';
|
|
31
31
|
import { makeSelectEdit } from '../Sms/Edit/selectors';
|
|
32
32
|
import { makeSelectLine } from '../Line/Container/selectors';
|
|
33
|
+
import { makeSelectViber } from '../Viber/selectors';
|
|
34
|
+
|
|
33
35
|
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
34
36
|
import messages from './messages';
|
|
35
37
|
import {checkUnicode} from '../../utils/smsCharCountV2';
|
|
@@ -40,6 +42,8 @@ import * as smsEditActions from '../Sms/Edit/actions';
|
|
|
40
42
|
import * as ebillActions from '../Ebill/actions';
|
|
41
43
|
import * as emailActions from '../Email/actions';
|
|
42
44
|
import * as lineActions from '../Line/Container/actions';
|
|
45
|
+
import * as viberActions from '../Viber/actions';
|
|
46
|
+
|
|
43
47
|
import CardGrid from '../../v2Components/CardGrid';
|
|
44
48
|
import config from '../../config/app';
|
|
45
49
|
import './_templates.scss';
|
|
@@ -51,7 +55,7 @@ import EmailPreview from '../../v2Components/EmailPreview';
|
|
|
51
55
|
import CreativesContainer from '../CreativesContainer';
|
|
52
56
|
import WechatRichmediaTemplatePreview from '../../v2Components/TemplatePreview/WechatRichmediaTemplatePreview';
|
|
53
57
|
import { CHANNEL_CREATE_TRACK_MAPPING, CHANNEL_EDIT_TRACK_MAPPING } from '../App/constants';
|
|
54
|
-
import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE } from '../CreativesContainer/constants';
|
|
58
|
+
import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER } from '../CreativesContainer/constants';
|
|
55
59
|
import emailIllustration from '../Assets/images/emailIllustration.svg';
|
|
56
60
|
import smsIllustration from '../Assets/images/smsIllustration.svg';
|
|
57
61
|
import pushIllustration from '../Assets/images/pushIllustration.svg';
|
|
@@ -161,6 +165,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
161
165
|
case EBILL:
|
|
162
166
|
channel = 'Ebill';
|
|
163
167
|
break;
|
|
168
|
+
case VIBER:
|
|
169
|
+
channel = 'Viber';
|
|
170
|
+
break;
|
|
164
171
|
case LINE:
|
|
165
172
|
channel = "Line";
|
|
166
173
|
if (!this.props.isFullMode) {
|
|
@@ -185,7 +192,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
185
192
|
if (this.props.location.query.type === 'embedded') {
|
|
186
193
|
this.props.actions.resetAccount();
|
|
187
194
|
}
|
|
188
|
-
if ((this.state.channel && (this.state.channel.toLowerCase() === 'line' || this.state.channel.toLowerCase() === 'sms' || this.state.channel.toLowerCase() === 'email' || this.state.channel.toLowerCase() === 'ebill')) || ((this.state.channel.toLowerCase() === 'wechat' || this.state.channel.toLowerCase() === 'mobilepush') && !isEmpty(this.props.Templates.selectedWeChatAccount))) {
|
|
195
|
+
if ((this.state.channel && (this.state.channel.toLowerCase() === 'line' || this.state.channel.toLowerCase() === 'viber' || this.state.channel.toLowerCase() === 'sms' || this.state.channel.toLowerCase() === 'email' || this.state.channel.toLowerCase() === 'ebill')) || ((this.state.channel.toLowerCase() === 'wechat' || this.state.channel.toLowerCase() === 'mobilepush') && !isEmpty(this.props.Templates.selectedWeChatAccount))) {
|
|
189
196
|
const queryParams = {
|
|
190
197
|
// name: this.state.searchText,
|
|
191
198
|
// sortBy: this.state.sortBy,
|
|
@@ -245,9 +252,12 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
245
252
|
this.setState({defaultAccount: true});
|
|
246
253
|
nextProps.actions.getWeCrmAccounts(channel);
|
|
247
254
|
}
|
|
255
|
+
} else if (nextProps.route.name.toLowerCase() === 'viber') {
|
|
256
|
+
channel = 'Viber';
|
|
248
257
|
}
|
|
258
|
+
|
|
249
259
|
this.setState({ channel }, () => {
|
|
250
|
-
if ((this.state.channel.toLowerCase() === 'line' || this.state.channel.toLowerCase() === 'sms' || this.state.channel.toLowerCase() === 'email' || this.state.channel.toLowerCase() === 'ebill') || (this.state.channel.toLowerCase() === 'wechat' && !isEmpty(nextProps.Templates.selectedWeChatAccount))) {
|
|
260
|
+
if ((this.state.channel.toLowerCase() === 'line' || this.state.channel.toLowerCase() === 'viber' || this.state.channel.toLowerCase() === 'sms' || this.state.channel.toLowerCase() === 'email' || this.state.channel.toLowerCase() === 'ebill') || (this.state.channel.toLowerCase() === 'wechat' && !isEmpty(nextProps.Templates.selectedWeChatAccount))) {
|
|
251
261
|
if (this.state.channel.toLowerCase() === 'wechat' && !isEmpty(nextProps.Templates.selectedWeChatAccount)) {
|
|
252
262
|
params.wecrmId = (nextProps.Templates.selectedWeChatAccount.configs || {}).wecrm_app_id;
|
|
253
263
|
params.wecrmToken = (nextProps.Templates.selectedWeChatAccount.configs || {}).wecrm_token;
|
|
@@ -336,6 +346,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
336
346
|
this.props.ebillActions.clearCreateResponse();
|
|
337
347
|
} else if (this.state.channel.toLowerCase() === "line") {
|
|
338
348
|
this.props.lineActions.clearCreateResponse();
|
|
349
|
+
} else if (this.state.channel.toLowerCase() === "viber") {
|
|
350
|
+
this.props.viberActions.clearCreateResponse();
|
|
339
351
|
}
|
|
340
352
|
}
|
|
341
353
|
}
|
|
@@ -651,7 +663,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
651
663
|
<video height="279">
|
|
652
664
|
<source src={originalVideoContentUrl} type="video/mp4" />
|
|
653
665
|
</video>
|
|
654
|
-
)
|
|
666
|
+
);
|
|
655
667
|
}
|
|
656
668
|
if (carouselTemplate) {
|
|
657
669
|
const carouselContent = get(carouselTemplate, 'columns', [{}]).map(({ imageUrl, action: { label: actionLabel } = {} }) => ({ imageUrl, actionLabel }) );
|
|
@@ -677,6 +689,26 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
677
689
|
}
|
|
678
690
|
break;
|
|
679
691
|
}
|
|
692
|
+
case VIBER: {
|
|
693
|
+
const {
|
|
694
|
+
content: {
|
|
695
|
+
viber: {
|
|
696
|
+
text = '',
|
|
697
|
+
imageURL = '',
|
|
698
|
+
buttonURL = '',
|
|
699
|
+
buttonText = '',
|
|
700
|
+
} = {},
|
|
701
|
+
} = {},
|
|
702
|
+
} = template.versions.base;
|
|
703
|
+
templateData.content = text;
|
|
704
|
+
if (imageURL) {
|
|
705
|
+
templateData.url = imageURL;
|
|
706
|
+
}
|
|
707
|
+
if (buttonURL && buttonText) {
|
|
708
|
+
templateData.buttonText = buttonText;
|
|
709
|
+
}
|
|
710
|
+
break;
|
|
711
|
+
}
|
|
680
712
|
default:
|
|
681
713
|
templateData.content = "";
|
|
682
714
|
}
|
|
@@ -1174,6 +1206,15 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1174
1206
|
this.props.lineActions.clearCreateResponse();
|
|
1175
1207
|
}
|
|
1176
1208
|
});
|
|
1209
|
+
} else if (this.state.channel.toLowerCase() === "viber") {
|
|
1210
|
+
this.props.viberActions.createTemplate(duplicateObj, (response) => {
|
|
1211
|
+
if (response && response.templateId) {
|
|
1212
|
+
const message = `${this.state.channel} ${this.props.intl.formatMessage(messages.templateDuplicateSuccess)}`;
|
|
1213
|
+
CapNotification.success({key: 'duplicateSucess', message});
|
|
1214
|
+
this.getAllTemplates({params, resetPage: true});
|
|
1215
|
+
this.props.viberActions.clearCreateResponse();
|
|
1216
|
+
}
|
|
1217
|
+
});
|
|
1177
1218
|
}
|
|
1178
1219
|
}
|
|
1179
1220
|
|
|
@@ -1255,6 +1296,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1255
1296
|
pathName += `/${options.account}`;
|
|
1256
1297
|
}
|
|
1257
1298
|
}
|
|
1299
|
+
if (this.state.channel.toLowerCase() === 'viber') {
|
|
1300
|
+
pathName = `/viber/edit/${id}/`;
|
|
1301
|
+
}
|
|
1258
1302
|
if (this.state.channel.toUpperCase() === WECHAT) {
|
|
1259
1303
|
if (get(template, 'definition.msgcontent', '') === "RICH_MEDIA_WECHAT") {
|
|
1260
1304
|
pathName = `/wechat/richmedia/edit/${id}`;
|
|
@@ -1553,6 +1597,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1553
1597
|
} = Templates;
|
|
1554
1598
|
const lineLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === 'line');
|
|
1555
1599
|
const smsLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === 'sms');
|
|
1600
|
+
const viberLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === 'viber');
|
|
1556
1601
|
const wechatLoader = (((this.state.selectedAccount !== '' && getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'wechat');
|
|
1557
1602
|
const mobilePushLoader = (((getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'mobilepush');
|
|
1558
1603
|
const emailLoader = (
|
|
@@ -1566,7 +1611,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1566
1611
|
(emailLoader !== undefined ? emailLoader : false) ||
|
|
1567
1612
|
(ebillLoader !== undefined ? ebillLoader : false) ||
|
|
1568
1613
|
(mobilePushLoader !== undefined ? mobilePushLoader : false) ||
|
|
1569
|
-
(lineLoader !== undefined ? lineLoader : false)
|
|
1614
|
+
(lineLoader !== undefined ? lineLoader : false) ||
|
|
1615
|
+
(viberLoader !== undefined ? viberLoader : false);
|
|
1570
1616
|
return isLoading;
|
|
1571
1617
|
}
|
|
1572
1618
|
getChannelTypeIllustrationInfo = (type) => {
|
|
@@ -1977,6 +2023,7 @@ Templates.propTypes = {
|
|
|
1977
2023
|
isFullMode: PropTypes.bool,
|
|
1978
2024
|
handlePeviewTemplate: PropTypes.func,
|
|
1979
2025
|
router: PropTypes.object,
|
|
2026
|
+
viberActions: PropTypes.object,
|
|
1980
2027
|
};
|
|
1981
2028
|
|
|
1982
2029
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -1989,6 +2036,7 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1989
2036
|
EmailCreate: makeSelectCreateEmail(),
|
|
1990
2037
|
Global: makeSelectAuthenticated(),
|
|
1991
2038
|
Line: makeSelectLine(),
|
|
2039
|
+
Viber: makeSelectViber(),
|
|
1992
2040
|
});
|
|
1993
2041
|
|
|
1994
2042
|
function mapDispatchToProps(dispatch) {
|
|
@@ -2001,6 +2049,7 @@ function mapDispatchToProps(dispatch) {
|
|
|
2001
2049
|
emailActions: bindActionCreators(emailActions, dispatch),
|
|
2002
2050
|
globalActions: bindActionCreators(globalActions, dispatch),
|
|
2003
2051
|
lineActions: bindActionCreators(lineActions, dispatch),
|
|
2052
|
+
viberActions: bindActionCreators(viberActions, dispatch),
|
|
2004
2053
|
};
|
|
2005
2054
|
}
|
|
2006
2055
|
|
|
@@ -22,6 +22,7 @@ import * as actions from './actions';
|
|
|
22
22
|
import Templates from '../Templates';
|
|
23
23
|
import CallTask from '../CallTask';
|
|
24
24
|
import Facebook from '../Facebook';
|
|
25
|
+
import Viber from '../Viber';
|
|
25
26
|
import Line from '../Line/Container';
|
|
26
27
|
import Gallery from '../Assets/Gallery';
|
|
27
28
|
import withStyles from '../../hoc/withStyles';
|
|
@@ -52,6 +53,8 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
52
53
|
//'wechat': {content: this.getTemplatesComponent('wechat'), tab: 'Wechat', key: 'wechat'},
|
|
53
54
|
mPush: {content: <></>, tab: intl.formatMessage(messages.pushNotification), key: 'mobilepush'},
|
|
54
55
|
line: {content: <></>, tab: intl.formatMessage(messages.line), key: 'line'},
|
|
56
|
+
viber: {content: <></>, tab: intl.formatMessage(messages.viber), key: 'viber'},
|
|
57
|
+
|
|
55
58
|
|
|
56
59
|
};
|
|
57
60
|
let filteredPanes = Object.keys(defaultPanes)
|
|
@@ -152,7 +155,12 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
152
155
|
/>
|
|
153
156
|
);
|
|
154
157
|
}
|
|
155
|
-
|
|
158
|
+
getViberComponent =() => (
|
|
159
|
+
<Viber
|
|
160
|
+
{...this.props}
|
|
161
|
+
isCreateFlow
|
|
162
|
+
></Viber>
|
|
163
|
+
)
|
|
156
164
|
getLineComponent = () => (
|
|
157
165
|
<Line
|
|
158
166
|
{...this.props}
|
|
@@ -168,6 +176,9 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
168
176
|
if (channel === 'line') {
|
|
169
177
|
return this.getLineComponent();
|
|
170
178
|
}
|
|
179
|
+
if (channel === 'viber') {
|
|
180
|
+
return this.getViberComponent();
|
|
181
|
+
}
|
|
171
182
|
}
|
|
172
183
|
const location = {pathname: `/${channel}`, search: '', query};
|
|
173
184
|
switch (channel) {
|
|
@@ -46,6 +46,10 @@ export default defineMessages({
|
|
|
46
46
|
id: 'creatives.containersV2.TemplatesV2.facebook',
|
|
47
47
|
defaultMessage: 'Facebook',
|
|
48
48
|
},
|
|
49
|
+
viber: {
|
|
50
|
+
id: 'creatives.containersV2.TemplatesV2.viber',
|
|
51
|
+
defaultMessage: 'Viber',
|
|
52
|
+
},
|
|
49
53
|
gallery: {
|
|
50
54
|
id: 'creatives.containersV2.TemplatesV2.gallery',
|
|
51
55
|
defaultMessage: 'Gallery',
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
|
|
2
|
+
import * as types from './constants';
|
|
3
|
+
|
|
4
|
+
export function defaultAction() {
|
|
5
|
+
return {
|
|
6
|
+
type: types.DEFAULT_ACTION,
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const uploadViberAsset = (file, assetType, fileParams, templateType) => ({
|
|
11
|
+
type: types.UPLOAD_VIBER_ASSET_REQUEST,
|
|
12
|
+
file,
|
|
13
|
+
assetType,
|
|
14
|
+
fileParams,
|
|
15
|
+
templateType,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export function createTemplate(template, callback) {
|
|
20
|
+
return {
|
|
21
|
+
type: types.CREATE_VIBER_TEMPLATE_REQUEST,
|
|
22
|
+
template,
|
|
23
|
+
callback,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
// FOR EDIT
|
|
29
|
+
|
|
30
|
+
export function editTemplate(template, callback) {
|
|
31
|
+
console.log('action trigereed editTemplate viber @@@');
|
|
32
|
+
return {
|
|
33
|
+
type: types.EDIT_VIBER_TEMPLATE_REQUEST,
|
|
34
|
+
template,
|
|
35
|
+
callback,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function getTemplateDetails(id, callback) {
|
|
40
|
+
console.log('getting template viber @@@', id);
|
|
41
|
+
return {
|
|
42
|
+
type: types.GET_VIBER_TEMPLATE_DETAILS_REQUEST,
|
|
43
|
+
id,
|
|
44
|
+
channel: 'VIBER',
|
|
45
|
+
callback,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function clearData() {
|
|
50
|
+
return {
|
|
51
|
+
type: types.CLEAR_VIBER_DATA,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function clearEditResponse() {
|
|
56
|
+
return {
|
|
57
|
+
type: types.CLEAR_VIBER_EDIT_RESPONSE_REQUEST,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
export function clearCreateResponse() {
|
|
63
|
+
return {
|
|
64
|
+
type: types.CLEAR_VIBER_CREATE_RESPONSE_REQUEST,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function clearViberAsset(templateType) {
|
|
69
|
+
return {
|
|
70
|
+
type: types.CLEAR_VIBER_ASSET,
|
|
71
|
+
templateType,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const DEFAULT_ACTION = 'app/v2Containers/Viber/DEFAULT_ACTION';
|
|
2
|
+
export const ALLOWED_EXTENSIONS_REGEX = (/\.(jpe?g|png)$/i);
|
|
3
|
+
export const VIBER_IMG_HEIGHT = 400;
|
|
4
|
+
export const VIBER_IMG_WIDTH = 300;
|
|
5
|
+
export const VIBER_IMG_SIZE = 10000000;
|
|
6
|
+
export const charLimit = 1000;
|
|
7
|
+
|
|
8
|
+
export const UPLOAD_VIBER_ASSET_REQUEST = 'app/v2Containers/Viber/UPLOAD_ASSET_REQUEST';
|
|
9
|
+
export const UPLOAD_VIBER_ASSET_SUCCESS = 'app/v2Containers/Viber/UPLOAD_ASSET_SUCCESS';
|
|
10
|
+
export const UPLOAD_VIBER_ASSET_FAILURE = 'app/v2Containers/Viber/UPLOAD_ASSET_FAILURE';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export const CREATE_VIBER_TEMPLATE_REQUEST = 'app/v2Containers/Viber/CREATE_VIBER_TEMPLATE_REQUEST';
|
|
14
|
+
export const CREATE_VIBER_TEMPLATE_SUCCESS = 'app/v2Containers/Viber/CREATE_VIBER_TEMPLATE_SUCCESS';
|
|
15
|
+
export const CREATE_VIBER_TEMPLATE_FAILURE = 'app/v2Containers/Viber/CREATE_VIBER_TEMPLATE_FAILURE';
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export const GET_VIBER_TEMPLATE_DETAILS_REQUEST = 'app/v2Containers/Viber/EDIT/CREATE_VIBER_TEMPLATE_DETAILS_REQUEST';
|
|
19
|
+
export const GET_VIBER_TEMPLATE_DETAILS_SUCCESS = 'app/v2Containers/Viber/EDIT/CREATE_VIBER_TEMPLATE_DETAILS_SUCCESS';
|
|
20
|
+
export const GET_VIBER_TEMPLATE_DETAILS_FAILURE = 'app/v2Containers/Viber/EDIT/CREATE_VIBER_TEMPLATE_DETAILS_FAILURE';
|
|
21
|
+
|
|
22
|
+
export const EDIT_VIBER_TEMPLATE_REQUEST = 'app/v2Containers/VIBER/Edit/EDIT_VIBER_TEMPLATE_REQUEST';
|
|
23
|
+
export const EDIT_VIBER_TEMPLATE_SUCCESS = 'app/v2Containers/VIBER/Edit/EDIT_VIBER_TEMPLATE_SUCCESS';
|
|
24
|
+
export const EDIT_VIBER_TEMPLATE_FAILURE = 'app/v2Containers/VIBER/Edit/EDIT_VIBER_TEMPLATE_FAILURE';
|
|
25
|
+
|
|
26
|
+
export const CLEAR_VIBER_EDIT_RESPONSE_REQUEST = 'app/v2Containers/VIBER/Edit/CLEAR_EDIT_RESPONSE_REQUEST';
|
|
27
|
+
export const CLEAR_VIBER_DATA = 'app/v2Containers/VIBER/Edit/CLEAR_DATA';
|
|
28
|
+
export const CLEAR_VIBER_CREATE_RESPONSE_REQUEST = 'app/v2Containers/VIBER/Create/CLEAR_EDIT_RESPONSE_REQUEST';
|
|
29
|
+
export const CLEAR_VIBER_ASSET = 'app/v2Containers/Viber/CLEAR_ASSET';
|
|
30
|
+
|