@capillarytech/creatives-library 7.1.11 → 7.2.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 (62) hide show
  1. package/assets/viber.png +0 -0
  2. package/index.js +8 -1
  3. package/package.json +2 -1
  4. package/reducers.js +2 -0
  5. package/routes.js +7 -1
  6. package/services/api.js +5 -0
  7. package/v2Components/TemplatePreview/_templatePreview.scss +8 -2
  8. package/v2Components/TemplatePreview/assets/images/viberMobile.svg +135 -0
  9. package/v2Components/TemplatePreview/index.js +108 -18
  10. package/v2Containers/App/constants.js +1 -1
  11. package/v2Containers/CreativesContainer/SlideBoxContent.js +67 -2
  12. package/v2Containers/CreativesContainer/constants.js +2 -0
  13. package/v2Containers/CreativesContainer/index.js +40 -5
  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 +534 -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/Templates/_templates.scss +57 -0
  23. package/v2Containers/Templates/actions.js +117 -110
  24. package/v2Containers/Templates/constants.js +2 -0
  25. package/v2Containers/Templates/index.js +88 -7
  26. package/v2Containers/Templates/messages.js +4 -0
  27. package/v2Containers/Templates/reducer.js +2 -0
  28. package/v2Containers/TemplatesV2/index.js +9 -1
  29. package/v2Containers/TemplatesV2/messages.js +4 -0
  30. package/v2Containers/Viber/actions.js +74 -0
  31. package/v2Containers/Viber/constants.js +30 -0
  32. package/v2Containers/Viber/index.js +727 -0
  33. package/v2Containers/Viber/messages.js +145 -0
  34. package/v2Containers/Viber/reducer.js +84 -0
  35. package/v2Containers/Viber/sagas.js +107 -0
  36. package/v2Containers/Viber/selectors.js +21 -0
  37. package/v2Components/TemplatePreview/assets/images/mobile.svg +0 -24
  38. package/v2Containers/Line/Create/_lineCreate.scss +0 -64
  39. package/v2Containers/Line/Create/actions.js +0 -94
  40. package/v2Containers/Line/Create/constants.js +0 -43
  41. package/v2Containers/Line/Create/index.js +0 -1132
  42. package/v2Containers/Line/Create/initialSchema.js +0 -378
  43. package/v2Containers/Line/Create/messages.js +0 -229
  44. package/v2Containers/Line/Create/reducer.js +0 -99
  45. package/v2Containers/Line/Create/sagas.js +0 -113
  46. package/v2Containers/Line/Create/selectors.js +0 -30
  47. package/v2Containers/Line/CreateWrapper/constants.js +0 -2
  48. package/v2Containers/Line/CreateWrapper/index.js +0 -117
  49. package/v2Containers/Line/CreateWrapper/messages.js +0 -55
  50. package/v2Containers/Line/Edit/_lineEdit.scss +0 -23
  51. package/v2Containers/Line/Edit/actions.js +0 -79
  52. package/v2Containers/Line/Edit/constants.js +0 -27
  53. package/v2Containers/Line/Edit/index.js +0 -1051
  54. package/v2Containers/Line/Edit/messages.js +0 -173
  55. package/v2Containers/Line/Edit/reducer.js +0 -83
  56. package/v2Containers/Line/Edit/sagas.js +0 -81
  57. package/v2Containers/Line/Edit/selectors.js +0 -29
  58. package/v2Containers/Line/Edit/tests/actions.test.js +0 -18
  59. package/v2Containers/Line/Edit/tests/index.test.js +0 -10
  60. package/v2Containers/Line/Edit/tests/reducer.test.js +0 -9
  61. package/v2Containers/Line/Edit/tests/sagas.test.js +0 -15
  62. package/v2Containers/Line/Edit/tests/selectors.test.js +0 -10
@@ -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: 215px;
58
+ height: 24px;
59
+ padding: 2px 0px;
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-viber{
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
 
@@ -4,119 +4,126 @@
4
4
  *
5
5
  */
6
6
 
7
- import * as types from './constants';
8
-
9
- export function getAllTemplates(channel, queryParams) {
10
- console.log('get all templates action trigereed', channel, queryParams);
11
- return {
12
- type: types.GET_ALL_TEMPLATES_REQUEST, channel, queryParams,
13
- };
14
- }
15
-
16
- export function resetTemplate() {
17
- return {
18
- type: types.RESET_TEMPLATE,
19
- };
20
- }
21
-
22
- export function resetAccount() {
23
- return {
24
- type: types.RESET_ACCOUNT,
25
- };
26
- }
27
-
28
- export function deleteTemplate(channel, id) {
29
- console.log('delete template action trigereed', channel, id);
30
- return {
31
- type: types.DELETE_TEMPLATE_REQUEST, channel, id,
32
- };
33
- }
34
-
35
- export function getUserList() {
36
- return {
37
- type: types.GET_USER_LIST_REQUEST,
38
- };
39
- }
40
-
41
- export function getWeCrmAccounts(source) {
42
- return {
43
- type: types.GET_WECRM_ACCOUNTS_REQUEST, source,
44
- };
45
- }
46
-
47
- export function setWeChatAccount(weChatAccount) {
48
- console.log('setting wechat account', weChatAccount);
49
- return {
50
- type: types.SET_WECHAT_ACCOUNT,
51
- weChatAccount,
52
- };
53
- }
54
-
55
- export function setLineAccount(lineAccount) {
7
+ import * as types from './constants';
8
+
9
+ export function getAllTemplates(channel, queryParams) {
10
+ console.log('get all templates action trigereed', channel, queryParams);
11
+ return {
12
+ type: types.GET_ALL_TEMPLATES_REQUEST, channel, queryParams,
13
+ };
14
+ }
15
+
16
+ export function resetTemplate() {
17
+ return {
18
+ type: types.RESET_TEMPLATE,
19
+ };
20
+ }
21
+
22
+ export function resetAccount() {
23
+ return {
24
+ type: types.RESET_ACCOUNT,
25
+ };
26
+ }
27
+
28
+ export function deleteTemplate(channel, id) {
29
+ console.log('delete template action trigereed', channel, id);
30
+ return {
31
+ type: types.DELETE_TEMPLATE_REQUEST, channel, id,
32
+ };
33
+ }
34
+
35
+ export function getUserList() {
36
+ return {
37
+ type: types.GET_USER_LIST_REQUEST,
38
+ };
39
+ }
40
+
41
+ export function getWeCrmAccounts(source) {
42
+ return {
43
+ type: types.GET_WECRM_ACCOUNTS_REQUEST, source,
44
+ };
45
+ }
46
+
47
+ export function setWeChatAccount(weChatAccount) {
48
+ console.log('setting wechat account', weChatAccount);
49
+ return {
50
+ type: types.SET_WECHAT_ACCOUNT,
51
+ weChatAccount,
52
+ };
53
+ }
54
+
55
+ export function setLineAccount(lineAccount) {
56
56
  return {
57
57
  type: types.SET_LINE_ACCOUNT,
58
58
  lineAccount,
59
59
  };
60
60
  }
61
61
 
62
- export function handleHtmlUpload(selectedTemplate) {
63
- return {
64
- type: types.SET_SELECTED_LAYOUT,
65
- selectedTemplate,
66
- };
67
- }
68
-
69
- export function handleZipUpload(selectedFile, successHandler, errorHandler) {
70
- return {
71
- type: types.SEND_ZIPPED_FILE_REQUEST,
72
- selectedFile,
73
- successHandler,
74
- errorHandler,
75
- };
76
- }
77
-
78
- export function getDefaultBeeTemplates() {
79
- return {
80
- type: types.GET_DEAFULT_BEE_TEMPLATES_REQUEST,
81
- };
82
- }
83
-
84
- export function setEdmTemplate(template) {
85
- return {
86
- type: types.SET_EDM_TEMPLATE,
87
- template,
88
- };
89
- }
90
- export function setBEETemplate(template) {
91
- return {
92
- type: types.SET_BEE_TEMPLATE,
93
- template,
94
- };
95
- }
96
- export function getTemplateDetails(id, channel) {
97
- console.log('getting template', id, channel);
98
- return {
99
- type: types.GET_TEMPLATE_DETAILS_REQUEST,
100
- id,
101
- channel,
102
- };
103
- }
104
-
105
- export function resetTemplateData() {
106
- return {
107
- type: types.RESET_TEMPLATE_DATA,
108
- };
109
- }
110
-
111
- export function resetUploadData() {
112
- console.log('clearing upload data');
113
- return {
114
- type: types.RESET_UPLOAD_DATA,
115
- };
116
- }
117
-
118
- export function resetTemplateStoreData() {
119
- return {
120
- type: types.CLEAR_TEMPLATE_STORE_DATA,
121
- };
122
- }
62
+ export function setViberAccount(viberAccount) {
63
+ return {
64
+ type: types.SET_VIBER_ACCOUNT,
65
+ viberAccount,
66
+ };
67
+ }
68
+
69
+ export function handleHtmlUpload(selectedTemplate) {
70
+ return {
71
+ type: types.SET_SELECTED_LAYOUT,
72
+ selectedTemplate,
73
+ };
74
+ }
75
+
76
+ export function handleZipUpload(selectedFile, successHandler, errorHandler) {
77
+ return {
78
+ type: types.SEND_ZIPPED_FILE_REQUEST,
79
+ selectedFile,
80
+ successHandler,
81
+ errorHandler,
82
+ };
83
+ }
84
+
85
+ export function getDefaultBeeTemplates() {
86
+ return {
87
+ type: types.GET_DEAFULT_BEE_TEMPLATES_REQUEST,
88
+ };
89
+ }
90
+
91
+ export function setEdmTemplate(template) {
92
+ return {
93
+ type: types.SET_EDM_TEMPLATE,
94
+ template,
95
+ };
96
+ }
97
+ export function setBEETemplate(template) {
98
+ return {
99
+ type: types.SET_BEE_TEMPLATE,
100
+ template,
101
+ };
102
+ }
103
+ export function getTemplateDetails(id, channel) {
104
+ console.log('getting template', id, channel);
105
+ return {
106
+ type: types.GET_TEMPLATE_DETAILS_REQUEST,
107
+ id,
108
+ channel,
109
+ };
110
+ }
111
+
112
+ export function resetTemplateData() {
113
+ return {
114
+ type: types.RESET_TEMPLATE_DATA,
115
+ };
116
+ }
117
+
118
+ export function resetUploadData() {
119
+ console.log('clearing upload data');
120
+ return {
121
+ type: types.RESET_UPLOAD_DATA,
122
+ };
123
+ }
124
+
125
+ export function resetTemplateStoreData() {
126
+ return {
127
+ type: types.CLEAR_TEMPLATE_STORE_DATA,
128
+ };
129
+ }
@@ -43,6 +43,8 @@ export const RESET_UPLOAD_DATA = "app/v2Containers/Templates/RESET_UPLOAD_DATA";
43
43
  export const CLEAR_TEMPLATE_STORE_DATA = "app/v2Containers/Templates/CLEAR_TEMPLATE_STORE_DATA";
44
44
 
45
45
  export const SET_LINE_ACCOUNT = "app/v2Containers/Templates/SET_LINE_ACCOUNT";
46
+ export const SET_VIBER_ACCOUNT = "app/v2Containers/Templates/SET_VIBER_ACCOUNT";
47
+
46
48
 
47
49
  export const GET_DEAFULT_BEE_TEMPLATES_REQUEST = 'app/v2Containers/Templates/GET_DEAFULT_BEE_TEMPLATES_REQUEST';
48
50
  export const GET_DEAFULT_BEE_TEMPLATES_SUCCESS = 'app/v2Containers/Templates/GET_DEAFULT_BEE_TEMPLATES_SUCCESS';
@@ -30,6 +30,7 @@ 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';
33
34
  import { UserIsAuthenticated } from '../../utils/authWrapper';
34
35
  import messages from './messages';
35
36
  import {checkUnicode} from '../../utils/smsCharCountV2';
@@ -40,6 +41,8 @@ import * as smsEditActions from '../Sms/Edit/actions';
40
41
  import * as ebillActions from '../Ebill/actions';
41
42
  import * as emailActions from '../Email/actions';
42
43
  import * as lineActions from '../Line/Container/actions';
44
+ import * as viberActions from '../Viber/actions';
45
+
43
46
  import CardGrid from '../../v2Components/CardGrid';
44
47
  import config from '../../config/app';
45
48
  import './_templates.scss';
@@ -50,8 +53,13 @@ import Pagination from '../../v2Components/Pagination';
50
53
  import EmailPreview from '../../v2Components/EmailPreview';
51
54
  import CreativesContainer from '../CreativesContainer';
52
55
  import WechatRichmediaTemplatePreview from '../../v2Components/TemplatePreview/WechatRichmediaTemplatePreview';
53
- import { CHANNEL_CREATE_TRACK_MAPPING, CHANNEL_EDIT_TRACK_MAPPING } from '../App/constants';
54
- import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE } from '../CreativesContainer/constants';
56
+ import {
57
+ CHANNEL_CREATE_TRACK_MAPPING,
58
+ CHANNEL_EDIT_TRACK_MAPPING,
59
+ VIBER as VIBER_CHANNEL,
60
+ } from '../App/constants';
61
+ import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER } from '../CreativesContainer/constants';
62
+
55
63
  import emailIllustration from '../Assets/images/emailIllustration.svg';
56
64
  import smsIllustration from '../Assets/images/smsIllustration.svg';
57
65
  import pushIllustration from '../Assets/images/pushIllustration.svg';
@@ -161,6 +169,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
161
169
  case EBILL:
162
170
  channel = 'Ebill';
163
171
  break;
172
+ case VIBER:
173
+ channel = 'Viber';
174
+ activeMode = ACCOUNT_SELECTION_MODE;
175
+ this.props.actions.getWeCrmAccounts(channel);
176
+ break;
164
177
  case LINE:
165
178
  channel = "Line";
166
179
  if (!this.props.isFullMode) {
@@ -185,7 +198,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
185
198
  if (this.props.location.query.type === 'embedded') {
186
199
  this.props.actions.resetAccount();
187
200
  }
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))) {
201
+ if ((['line', VIBER_CHANNEL, 'sms', 'email', 'ebill'].includes((this.state.channel || '').toLowerCase())) || ((['wechat', 'mobilepush'].includes(this.state.channel.toLowerCase()) && !isEmpty(this.props.Templates.selectedWeChatAccount)))) {
189
202
  const queryParams = {
190
203
  // name: this.state.searchText,
191
204
  // sortBy: this.state.sortBy,
@@ -245,9 +258,14 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
245
258
  this.setState({defaultAccount: true});
246
259
  nextProps.actions.getWeCrmAccounts(channel);
247
260
  }
261
+ } else if (nextProps.route.name.toLowerCase() === VIBER_CHANNEL) {
262
+ channel = 'Viber';
263
+ this.setState({defaultAccount: true});
264
+ nextProps.actions.getWeCrmAccounts(channel);
248
265
  }
266
+
249
267
  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))) {
268
+ if (['line', VIBER_CHANNEL, 'sms', 'email', 'ebill'].includes(this.state.channel.toLowerCase()) || (this.state.channel.toLowerCase() === 'wechat' && !isEmpty(nextProps.Templates.selectedWeChatAccount))) {
251
269
  if (this.state.channel.toLowerCase() === 'wechat' && !isEmpty(nextProps.Templates.selectedWeChatAccount)) {
252
270
  params.wecrmId = (nextProps.Templates.selectedWeChatAccount.configs || {}).wecrm_app_id;
253
271
  params.wecrmToken = (nextProps.Templates.selectedWeChatAccount.configs || {}).wecrm_token;
@@ -268,6 +286,22 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
268
286
  if ((this.state.channel || '').toLowerCase() === "mobilepush" && nextProps.Templates.selectedWeChatAccount) {
269
287
  params.accountId = nextProps.Templates.selectedWeChatAccount.id;
270
288
  }
289
+ if (this.state.channel.toLowerCase() === VIBER_CHANNEL && isEmpty(nextProps.Templates.selectedViberAccount)) {
290
+ let selectedAccount = '';
291
+ if (isEmpty(nextProps.Templates.weCrmAccounts)) {
292
+ return;
293
+ }
294
+ selectedAccount = nextProps.Templates.weCrmAccounts[0];
295
+ const { configs = {}, name = "" } = selectedAccount;
296
+ const { wecrm_app_id = "", wecrm_token = "", sourceAccountIdentifier = "" } = configs;
297
+ this.setState({selectedAccount: name}, () => {
298
+ params.wecrmId = wecrm_app_id;
299
+ params.wecrmToken = wecrm_token;
300
+ params.originalId = sourceAccountIdentifier;
301
+ this.props.actions.setViberAccount(nextProps.Templates.weCrmAccounts[0]);
302
+ this.getAllTemplates({params});
303
+ });
304
+ }
271
305
  if ((this.state.channel.toLowerCase() === 'wechat' || this.state.channel.toLowerCase() === 'mobilepush') && isEmpty(nextProps.Templates.selectedWeChatAccount) && (this.props.location.query.type === 'embedded') && !this.isEnabledInLibraryModule("showAccountSelection")) {
272
306
  let selectedAccount = '';
273
307
  if (isEmpty(nextProps.Templates.weCrmAccounts)) {
@@ -336,6 +370,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
336
370
  this.props.ebillActions.clearCreateResponse();
337
371
  } else if (this.state.channel.toLowerCase() === "line") {
338
372
  this.props.lineActions.clearCreateResponse();
373
+ } else if (this.state.channel.toLowerCase() === VIBER_CHANNEL) {
374
+ this.props.viberActions.clearCreateResponse();
339
375
  }
340
376
  }
341
377
  }
@@ -432,6 +468,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
432
468
  } else if (this.state.channel.toLowerCase() === 'line') {
433
469
  this.props.actions.setLineAccount(this.props.Templates.weCrmAccounts.find((item) => item.name === this.state.selectedAccount));
434
470
  }
471
+
435
472
  this.setState({activeMode: TEMPLATES_MODE});
436
473
  console.log("getAllTemplates params: ", params);
437
474
  this.getAllTemplates({params, resetPage: true});
@@ -651,7 +688,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
651
688
  <video height="279">
652
689
  <source src={originalVideoContentUrl} type="video/mp4" />
653
690
  </video>
654
- )
691
+ );
655
692
  }
656
693
  if (carouselTemplate) {
657
694
  const carouselContent = get(carouselTemplate, 'columns', [{}]).map(({ imageUrl, action: { label: actionLabel } = {} }) => ({ imageUrl, actionLabel }) );
@@ -677,6 +714,26 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
677
714
  }
678
715
  break;
679
716
  }
717
+ case VIBER: {
718
+ const {
719
+ content: {
720
+ viber: {
721
+ text = '',
722
+ imageURL = '',
723
+ buttonURL = '',
724
+ buttonText = '',
725
+ } = {},
726
+ } = {},
727
+ } = template.versions.base;
728
+ templateData.content = text;
729
+ if (imageURL) {
730
+ templateData.url = imageURL;
731
+ }
732
+ if (buttonURL && buttonText) {
733
+ templateData.buttonText = buttonText;
734
+ }
735
+ break;
736
+ }
680
737
  default:
681
738
  templateData.content = "";
682
739
  }
@@ -1174,6 +1231,15 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1174
1231
  this.props.lineActions.clearCreateResponse();
1175
1232
  }
1176
1233
  });
1234
+ } else if (this.state.channel.toLowerCase() === VIBER_CHANNEL) {
1235
+ this.props.viberActions.createTemplate(duplicateObj, (response) => {
1236
+ if (response && response.templateId) {
1237
+ const message = `${this.state.channel} ${this.props.intl.formatMessage(messages.templateDuplicateSuccess)}`;
1238
+ CapNotification.success({key: 'duplicateSucess', message});
1239
+ this.getAllTemplates({params, resetPage: true});
1240
+ this.props.viberActions.clearCreateResponse();
1241
+ }
1242
+ });
1177
1243
  }
1178
1244
  }
1179
1245
 
@@ -1255,6 +1321,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1255
1321
  pathName += `/${options.account}`;
1256
1322
  }
1257
1323
  }
1324
+ if (this.state.channel.toLowerCase() === VIBER_CHANNEL) {
1325
+ pathName = `/viber/edit/${id}/`;
1326
+ }
1258
1327
  if (this.state.channel.toUpperCase() === WECHAT) {
1259
1328
  if (get(template, 'definition.msgcontent', '') === "RICH_MEDIA_WECHAT") {
1260
1329
  pathName = `/wechat/richmedia/edit/${id}`;
@@ -1553,6 +1622,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1553
1622
  } = Templates;
1554
1623
  const lineLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === 'line');
1555
1624
  const smsLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === 'sms');
1625
+ const viberLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === VIBER_CHANNEL);
1556
1626
  const wechatLoader = (((this.state.selectedAccount !== '' && getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'wechat');
1557
1627
  const mobilePushLoader = (((getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'mobilepush');
1558
1628
  const emailLoader = (
@@ -1566,7 +1636,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1566
1636
  (emailLoader !== undefined ? emailLoader : false) ||
1567
1637
  (ebillLoader !== undefined ? ebillLoader : false) ||
1568
1638
  (mobilePushLoader !== undefined ? mobilePushLoader : false) ||
1569
- (lineLoader !== undefined ? lineLoader : false);
1639
+ (lineLoader !== undefined ? lineLoader : false) ||
1640
+ (viberLoader !== undefined ? viberLoader : false);
1570
1641
  return isLoading;
1571
1642
  }
1572
1643
  getChannelTypeIllustrationInfo = (type) => {
@@ -1648,6 +1719,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1648
1719
  const isMobilePushChannel = channel === MOBILE_PUSH;
1649
1720
  const isLineChannel = channel === LINE;
1650
1721
 
1722
+
1651
1723
  if ((isWechatChannel || isMobilePushChannel || isLineChannel) && !isEmpty(weCrmAccounts)) {
1652
1724
  forEach(weCrmAccounts, (account) => {
1653
1725
  if ((isWechatChannel && account.configs && account.configs.is_wecrm_enabled) || isMobilePushChannel || isLineChannel) {
@@ -1706,6 +1778,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1706
1778
  noAccountHeader = messages.noAccountsPresentLine;
1707
1779
  break;
1708
1780
  }
1781
+ case VIBER: {
1782
+ noAccountHeader = messages.noAccountsPresentViber;
1783
+ break;
1784
+ }
1709
1785
  default:
1710
1786
  break;
1711
1787
  }
@@ -1764,7 +1840,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1764
1840
  render() {
1765
1841
  const isFullMode = this.isFullMode();
1766
1842
  const { activeMode, channel, wechatFilter, lineFilter } = this.state;
1767
- if (activeMode === ACCOUNT_SELECTION_MODE) {
1843
+ const showForViber = (channel.toLowerCase() !== VIBER_CHANNEL ||
1844
+ (channel.toLowerCase() === VIBER_CHANNEL && !this.props.isFullMode && isEmpty(get(this.props, 'Templates.selectedViberAccount', {}))));
1845
+ if (activeMode === ACCOUNT_SELECTION_MODE && showForViber ) {
1768
1846
  return this.renderAccountSelection();
1769
1847
  }
1770
1848
  const pageHeader = "";
@@ -1977,6 +2055,7 @@ Templates.propTypes = {
1977
2055
  isFullMode: PropTypes.bool,
1978
2056
  handlePeviewTemplate: PropTypes.func,
1979
2057
  router: PropTypes.object,
2058
+ viberActions: PropTypes.object,
1980
2059
  };
1981
2060
 
1982
2061
  const mapStateToProps = createStructuredSelector({
@@ -1989,6 +2068,7 @@ const mapStateToProps = createStructuredSelector({
1989
2068
  EmailCreate: makeSelectCreateEmail(),
1990
2069
  Global: makeSelectAuthenticated(),
1991
2070
  Line: makeSelectLine(),
2071
+ Viber: makeSelectViber(),
1992
2072
  });
1993
2073
 
1994
2074
  function mapDispatchToProps(dispatch) {
@@ -2001,6 +2081,7 @@ function mapDispatchToProps(dispatch) {
2001
2081
  emailActions: bindActionCreators(emailActions, dispatch),
2002
2082
  globalActions: bindActionCreators(globalActions, dispatch),
2003
2083
  lineActions: bindActionCreators(lineActions, dispatch),
2084
+ viberActions: bindActionCreators(viberActions, dispatch),
2004
2085
  };
2005
2086
  }
2006
2087
 
@@ -366,4 +366,8 @@ export default defineMessages({
366
366
  id: `${scope}.duplicatingTemplate`,
367
367
  defaultMessage: 'Duplicating template...'
368
368
  },
369
+ noAccountsPresentViber: {
370
+ id: `${scope}.noAccountsPresentViber`,
371
+ defaultMessage: "Viber accounts are not setup for your brand",
372
+ },
369
373
  });
@@ -73,6 +73,8 @@ function templatesReducer(state = initialState, action) {
73
73
  .set('selectedWeChatAccount', fromJS(action.weChatAccount));
74
74
  case types.SET_LINE_ACCOUNT:
75
75
  return state.set('selectedLineAccount', fromJS(action.lineAccount));
76
+ case types.SET_VIBER_ACCOUNT:
77
+ return state.set('selectedViberAccount', fromJS(action.viberAccount));
76
78
  case types.RESET_ACCOUNT:
77
79
  return state
78
80
  .remove('selectedWeChatAccount')
@@ -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}
@@ -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',