@capillarytech/creatives-library 7.5.9 → 7.6.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.
@@ -46,6 +46,7 @@ export const LineVideo = ({
46
46
  updateUploadedAssetList,
47
47
  deleteUploadedImgList,
48
48
  }) => {
49
+
49
50
  if (activeKey !== 'video') {
50
51
  return null;
51
52
  }
@@ -117,7 +118,7 @@ export const LineVideo = ({
117
118
  updateVideoDuration(videoDuration);
118
119
  updateActionUrl(linkUri || actionUrl);
119
120
  updateActionLabel(videoActionLabel);
120
- updateSelectedAction(selectedAction || (videoActionLabel ? DISPLAY_ACTION_BUTTON : HIDE_ACTION_BUTTON));
121
+ updateSelectedAction(selectedAction || (!!videoActionLabel ? DISPLAY_ACTION_BUTTON : HIDE_ACTION_BUTTON));
121
122
  updateTitle(altText);
122
123
  if (videoPreviewUrl) {
123
124
  updateImagePreview(videoPreviewUrl);
@@ -223,9 +224,11 @@ export const LineVideo = ({
223
224
  messageType: 'videoSrc',
224
225
  });
225
226
  }
226
- };
227
+ }
227
228
 
228
- const checkAction = useCallback((label = actionLabel, url = actionUrl, type = selectedAction) => type === DISPLAY_ACTION_BUTTON ? (url && label && !updateActionLabelError(label) && !updateActionUrlError(url)) : true, [actionLabel, actionUrl, selectedAction]);
229
+ const checkAction = useCallback((label = actionLabel, url = actionUrl, type = selectedAction) => {
230
+ return type === DISPLAY_ACTION_BUTTON ? (url && label && !updateActionLabelError(label) && !updateActionUrlError(url)) : true;
231
+ }, [actionLabel, actionUrl, selectedAction]);
229
232
 
230
233
  const submitVideoAction = useCallback((data, incorrectFile) => {
231
234
  const {
@@ -302,7 +305,7 @@ export const LineVideo = ({
302
305
  selectedAction,
303
306
  messageType: 'videoSrc',
304
307
  });
305
- };
308
+ }
306
309
 
307
310
  const onReUpload = () => {
308
311
  updateVideoStatus(false);
@@ -329,24 +332,24 @@ export const LineVideo = ({
329
332
  selectedAction,
330
333
  messageType: 'videoSrc',
331
334
  });
332
- };
335
+ }
333
336
 
334
337
  const onSelectTemplate = useCallback((event) => {
335
338
  event.stopPropagation();
336
339
  updateTemplateDrawerRequirement(true);
337
- }, []);
340
+ }, [])
338
341
 
339
342
  const playVideo = (e) => {
340
343
  if (e.target.paused && !isPlaying) {
341
344
  e.target.play();
342
345
  }
343
- };
346
+ }
344
347
 
345
348
  const pauseVideo = (e) => {
346
349
  if (!e.target.paused && isPlaying) {
347
350
  e.target.pause();
348
351
  }
349
- };
352
+ }
350
353
 
351
354
  const getVideoSection = () => {
352
355
  if (!isVideo) {
@@ -409,7 +412,7 @@ export const LineVideo = ({
409
412
  onMouseOut={pauseVideo}
410
413
  ref={videoEl}
411
414
  >
412
- <source src={videoSrc} type="video/mp4" />
415
+ <source src={videoSrc} type="video/mp4" />
413
416
  </video>
414
417
  <div style={{ marginLeft: CAP_SPACE_24 }}>
415
418
  <CapHeading type="h6">
@@ -422,7 +425,7 @@ export const LineVideo = ({
422
425
  </div>
423
426
  </Fragment>
424
427
  );
425
- };
428
+ }
426
429
 
427
430
  const onTitleChange = ({ target: { value } }) => {
428
431
  updateTitle(value);
@@ -448,7 +451,7 @@ export const LineVideo = ({
448
451
  selectedAction,
449
452
  messageType: 'videoSrc',
450
453
  });
451
- };
454
+ }
452
455
 
453
456
  const onChangeSelectedAction = () => {
454
457
  event.stopPropagation();
@@ -471,7 +474,7 @@ export const LineVideo = ({
471
474
  selectedAction: value,
472
475
  messageType: 'videoSrc',
473
476
  });
474
- };
477
+ }
475
478
 
476
479
  const updateActionLabelError = (value = '') => {
477
480
  if (value.length > MAX_ACTION_LABEL_LENGTH) {
@@ -483,7 +486,7 @@ export const LineVideo = ({
483
486
  } else {
484
487
  updateActionLabelErrorMessage();
485
488
  }
486
- };
489
+ }
487
490
 
488
491
  const updateActionUrlError = (value) => {
489
492
  if (value === '') {
@@ -495,7 +498,7 @@ export const LineVideo = ({
495
498
  } else {
496
499
  updateActionUrlErrorMessage();
497
500
  }
498
- };
501
+ }
499
502
 
500
503
  const onActionLabelChange = ({ target: { value } }) => {
501
504
  updateActionLabel(value);
@@ -517,7 +520,7 @@ export const LineVideo = ({
517
520
  selectedAction,
518
521
  messageType: 'videoSrc',
519
522
  });
520
- };
523
+ }
521
524
 
522
525
  const onActionUrlChange = ({ target: { value } }) => {
523
526
  updateActionUrl(value);
@@ -539,9 +542,10 @@ export const LineVideo = ({
539
542
  selectedAction,
540
543
  messageType: 'videoSrc',
541
544
  });
542
- };
545
+ }
543
546
 
544
- const getActionSection = () => (
547
+ const getActionSection = () => {
548
+ return (
545
549
  <>
546
550
  <CapHeading type="h6" style={{ marginTop: CAP_SPACE_12 }}>
547
551
  <FormattedMessage {...messages.actionButtonLabel} />
@@ -554,12 +558,12 @@ export const LineVideo = ({
554
558
  options={[
555
559
  {
556
560
  label: 'Hide',
557
- value: HIDE_ACTION_BUTTON,
561
+ value: HIDE_ACTION_BUTTON
558
562
  },
559
563
  {
560
564
  label: 'Display',
561
- value: DISPLAY_ACTION_BUTTON,
562
- },
565
+ value: DISPLAY_ACTION_BUTTON
566
+ }
563
567
  ]}
564
568
  />
565
569
  {
@@ -589,18 +593,18 @@ export const LineVideo = ({
589
593
  : null
590
594
  }
591
595
  </>
592
- );
596
+ )
597
+ }
593
598
 
594
599
  const getLineVideoSection = () => {
595
600
  if (!isCreateNew) {
596
601
  return (
597
- <div
598
- className="form-builder-dragger" style={{
599
- textAlign: 'center',
600
- border: `1px dashed ${CAP_G06}`,
601
- minHeight: 120,
602
- padding: 60,
603
- }}>
602
+ <div className="form-builder-dragger" style={{
603
+ textAlign: 'center',
604
+ border: `1px dashed ${CAP_G06}`,
605
+ minHeight: 120,
606
+ padding: 60
607
+ }}>
604
608
  <CapHeader
605
609
  className="choice-title"
606
610
  size="regular"
@@ -630,8 +634,7 @@ export const LineVideo = ({
630
634
  >
631
635
  <FormattedMessage {...messages.textMessageSelectTemplate} />
632
636
  </CapButton>
633
- </div>
634
- );
637
+ </div>);
635
638
  } else {
636
639
  return (
637
640
  <>
@@ -649,7 +652,7 @@ export const LineVideo = ({
649
652
  </>
650
653
  );
651
654
  }
652
- };
655
+ }
653
656
 
654
657
  const setNewContent = useCallback(() => updateCreateNew(true), []);
655
658
 
@@ -685,9 +688,9 @@ export const LineVideo = ({
685
688
  updateVideoDuration(videoDuration);
686
689
  updateActionUrl(linkUri);
687
690
  updateActionLabel(label);
688
- updateSelectedAction(label ? DISPLAY_ACTION_BUTTON : HIDE_ACTION_BUTTON);
691
+ updateSelectedAction(!!label ? DISPLAY_ACTION_BUTTON : HIDE_ACTION_BUTTON);
689
692
  updateTitle(altText);
690
- };
693
+ }
691
694
 
692
695
  const getLineVideoDrawerContent = () => {
693
696
  const lineTextTemplates = Templates.templates;
@@ -696,8 +699,8 @@ export const LineVideo = ({
696
699
  }
697
700
 
698
701
  const cardDataList = [];
699
- lineTextTemplates.forEach((template) => {
700
- const templateData = {};
702
+ lineTextTemplates.forEach(template => {
703
+ let templateData = {};
701
704
  const {
702
705
  content: {
703
706
  messages: [{
@@ -777,7 +780,7 @@ export const LineVideo = ({
777
780
  />
778
781
  </form>
779
782
  </div>
780
- );
781
- };
783
+ )
784
+ }
782
785
 
783
- export default injectIntl(withStyles(LineVideo, style));
786
+ export default injectIntl(withStyles(LineVideo, style));
@@ -20,32 +20,6 @@
20
20
 
21
21
  .creatives-templates-list {
22
22
  .pagination-container {
23
- .FACEBOOK {
24
- .ant-card-body {
25
- background-color: $CAP_G09;
26
- height: 320px;
27
- }
28
-
29
- &.no-image .ant-card-meta {
30
- height: 276px;
31
- background: $CAP_WHITE;
32
- padding: $CAP_SPACE_16 $CAP_SPACE_12;
33
-
34
- .ant-card-meta-description {
35
- height: 250px;
36
- word-wrap: break-word;
37
- }
38
- }
39
-
40
- &.carousel-img-section {
41
- .ant-card-body {
42
- padding: $CAP_SPACE_24 0;
43
- }
44
- .ant-card-meta {
45
- padding: 0;
46
- }
47
- }
48
- }
49
23
  .LINE {
50
24
  .ant-card-body {
51
25
  background-color: $CAP_G09;
@@ -7,7 +7,7 @@
7
7
  import * as types from './constants';
8
8
 
9
9
  export function getAllTemplates(channel, queryParams) {
10
- // console.log('get all templates action trigereed', channel, queryParams);
10
+ console.log('get all templates action trigereed', channel, queryParams);
11
11
  return {
12
12
  type: types.GET_ALL_TEMPLATES_REQUEST, channel, queryParams,
13
13
  };
@@ -44,12 +44,6 @@ export function getWeCrmAccounts(source) {
44
44
  };
45
45
  }
46
46
 
47
- export function getAccountsSettings() {
48
- return {
49
- type: types.GET_ORG_LEVEL_CAMPAIGN_SETTINGS_REQUEST,
50
- };
51
- }
52
-
53
47
  export function setWeChatAccount(weChatAccount) {
54
48
  console.log('setting wechat account', weChatAccount);
55
49
  return {
@@ -72,13 +66,6 @@ export function setViberAccount(viberAccount) {
72
66
  };
73
67
  }
74
68
 
75
- export function setFacebookAccount(faceBookAccount) {
76
- return {
77
- type: types.SET_FACEBOOK_ACCOUNT,
78
- faceBookAccount,
79
- };
80
- }
81
-
82
69
  export function handleHtmlUpload(selectedTemplate) {
83
70
  return {
84
71
  type: types.SET_SELECTED_LAYOUT,
@@ -44,16 +44,8 @@ export const CLEAR_TEMPLATE_STORE_DATA = "app/v2Containers/Templates/CLEAR_TEMPL
44
44
 
45
45
  export const SET_LINE_ACCOUNT = "app/v2Containers/Templates/SET_LINE_ACCOUNT";
46
46
  export const SET_VIBER_ACCOUNT = "app/v2Containers/Templates/SET_VIBER_ACCOUNT";
47
- export const SET_FACEBOOK_ACCOUNT = "app/v2Containers/Templates/SET_FACEBOOK_ACCOUNT";
48
47
 
49
48
 
50
49
  export const GET_DEAFULT_BEE_TEMPLATES_REQUEST = 'app/v2Containers/Templates/GET_DEAFULT_BEE_TEMPLATES_REQUEST';
51
50
  export const GET_DEAFULT_BEE_TEMPLATES_SUCCESS = 'app/v2Containers/Templates/GET_DEAFULT_BEE_TEMPLATES_SUCCESS';
52
51
  export const GET_DEAFULT_BEE_TEMPLATES_FAILURE = 'app/v2Containers/Templates/GET_DEAFULT_BEE_TEMPLATES_FAILURE';
53
-
54
- export const GET_ORG_LEVEL_CAMPAIGN_SETTINGS_REQUEST =
55
- 'app/v2Containers/Templates/GET_ORG_LEVEL_CAMPAIGN_SETTINGS_REQUEST';
56
- export const GET_ORG_LEVEL_CAMPAIGN_SETTINGS_SUCCESS =
57
- 'app/v2Containers/Templates/GET_ORG_LEVEL_CAMPAIGN_SETTINGS_SUCCESS';
58
- export const GET_ORG_LEVEL_CAMPAIGN_SETTINGS_FAILURE =
59
- 'app/v2Containers/Templates/GET_ORG_LEVEL_CAMPAIGN_SETTINGS_FAILURE';
@@ -42,7 +42,6 @@ import * as ebillActions from '../Ebill/actions';
42
42
  import * as emailActions from '../Email/actions';
43
43
  import * as lineActions from '../Line/Container/actions';
44
44
  import * as viberActions from '../Viber/actions';
45
- import * as facebookActions from '../Facebook/actions';
46
45
 
47
46
  import CardGrid from '../../v2Components/CardGrid';
48
47
  import config from '../../config/app';
@@ -58,9 +57,8 @@ import {
58
57
  CHANNEL_CREATE_TRACK_MAPPING,
59
58
  CHANNEL_EDIT_TRACK_MAPPING,
60
59
  VIBER as VIBER_CHANNEL,
61
- FACEBOOK as FACEBOOK_CHANNEL,
62
60
  } from '../App/constants';
63
- import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER, FACEBOOK } from '../CreativesContainer/constants';
61
+ import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER } from '../CreativesContainer/constants';
64
62
 
65
63
  import emailIllustration from '../Assets/images/emailIllustration.svg';
66
64
  import smsIllustration from '../Assets/images/smsIllustration.svg';
@@ -183,11 +181,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
183
181
  this.props.actions.getWeCrmAccounts(channel);
184
182
  }
185
183
  break;
186
- case FACEBOOK:
187
- channel = 'Facebook';
188
- activeMode = ACCOUNT_SELECTION_MODE;
189
- this.props.actions.getAccountsSettings();
190
- break;
191
184
  default:
192
185
  channel = '';
193
186
  }
@@ -205,7 +198,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
205
198
  if (this.props.location.query.type === 'embedded') {
206
199
  this.props.actions.resetAccount();
207
200
  }
208
- if ((['line', VIBER_CHANNEL, FACEBOOK_CHANNEL, 'sms', 'email', 'ebill'].includes((this.state.channel || '').toLowerCase())) || ((['wechat', 'mobilepush'].includes(this.state.channel.toLowerCase()) && !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)))) {
209
202
  const queryParams = {
210
203
  // name: this.state.searchText,
211
204
  // sortBy: this.state.sortBy,
@@ -269,14 +262,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
269
262
  channel = 'Viber';
270
263
  this.setState({defaultAccount: true});
271
264
  nextProps.actions.getWeCrmAccounts(channel);
272
- } else if ( nextProps.route.name.toLowerCase() === FACEBOOK_CHANNEL) {
273
- channel = 'Facebook';
274
- this.setState({defaultAccount: true});
275
- nextProps.actions.getAccountsSettings();
276
265
  }
277
266
 
278
267
  this.setState({ channel }, () => {
279
- if (['line', VIBER_CHANNEL, FACEBOOK_CHANNEL, 'sms', 'email', 'ebill'].includes(this.state.channel.toLowerCase()) || (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))) {
280
269
  if (this.state.channel.toLowerCase() === 'wechat' && !isEmpty(nextProps.Templates.selectedWeChatAccount)) {
281
270
  params.wecrmId = (nextProps.Templates.selectedWeChatAccount.configs || {}).wecrm_app_id;
282
271
  params.wecrmToken = (nextProps.Templates.selectedWeChatAccount.configs || {}).wecrm_token;
@@ -297,8 +286,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
297
286
  if ((this.state.channel || '').toLowerCase() === "mobilepush" && nextProps.Templates.selectedWeChatAccount) {
298
287
  params.accountId = nextProps.Templates.selectedWeChatAccount.id;
299
288
  }
300
- const selectedChannel = this.state.channel.toLowerCase();
301
- if (selectedChannel === VIBER_CHANNEL && isEmpty(nextProps.Templates.selectedViberAccount)) {
289
+ if (this.state.channel.toLowerCase() === VIBER_CHANNEL && isEmpty(nextProps.Templates.selectedViberAccount)) {
302
290
  let selectedAccount = '';
303
291
  if (isEmpty(nextProps.Templates.weCrmAccounts)) {
304
292
  return;
@@ -314,31 +302,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
314
302
  this.getAllTemplates({params});
315
303
  });
316
304
  }
317
-
318
- if (selectedChannel === FACEBOOK_CHANNEL && isEmpty(nextProps.Templates.selectedFacebookAccount)) {
319
- if (isEmpty(nextProps.Templates.campaignSettings)) {
320
- return;
321
- }
322
- const fbSetting = get(nextProps.Templates, 'campaignSettings.accountSettings.socialAccountSettings.facebookAccountSettings', []);
323
- const { accountName = "",
324
- orgUnitFacebookPageSettingsMap = {},
325
- } = fbSetting[0] || {};
326
- let pageAccessToken = false;
327
- if (!isEmpty(orgUnitFacebookPageSettingsMap)) {
328
- Object.values(orgUnitFacebookPageSettingsMap).forEach((obj) => {
329
- if (obj.pageAccessToken) {
330
- pageAccessToken = true;
331
- }
332
- });
333
- if (!pageAccessToken) {
334
- return;
335
- }
336
- this.setState({selectedAccount: accountName}, () => {
337
- this.props.actions.setFacebookAccount(fbSetting[0]);
338
- this.getAllTemplates({params});
339
- });
340
- }
341
- }
342
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")) {
343
306
  let selectedAccount = '';
344
307
  if (isEmpty(nextProps.Templates.weCrmAccounts)) {
@@ -411,8 +374,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
411
374
  this.props.lineActions.clearCreateResponse();
412
375
  } else if (this.state.channel.toLowerCase() === VIBER_CHANNEL) {
413
376
  this.props.viberActions.clearCreateResponse();
414
- } else if (this.state.channel.toLowerCase() === FACEBOOK_CHANNEL) {
415
- this.props.facebookActions.clearCreateResponse();
416
377
  }
417
378
  }
418
379
  }
@@ -422,7 +383,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
422
383
  }
423
384
  if (!nextProps.Templates.deleteTemplateInProgress && !isEqual(nextProps.Templates.deleteTemplateInProgress, this.props.Templates.deleteTemplateInProgress) &&
424
385
  nextProps.Templates.deleteResponse) {
425
- const message = `${this.state.channel} ${this.props.intl.formatMessage(messages['Template deleted successfully'])}`;
386
+ const message = `${this.state.channel.toUpperCase()} ${this.props.intl.formatMessage(messages['Template deleted successfully'])}`;
426
387
  CapNotification.success({key: 'deleteSucess', message});
427
388
  this.getAllTemplates({params, resetPage: true});
428
389
  }
@@ -706,27 +667,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
706
667
  case WECHAT:
707
668
  templateData.content = this.prepareWeChatPreviewData(template);
708
669
  break;
709
- case FACEBOOK:
710
- const { FacebookAd = {} } = get(template.versions.base, 'content', {});
711
- const isCarousel = get(FacebookAd, '[0].type', '') === 'CAROUSEL';
712
- const fbAdImages = Object.values(FacebookAd).map((obj) => {
713
- if (obj.subType === "VIDEO") {
714
- return {url: obj.video.previewImageUrl};
715
- }
716
- return {url: obj.imgSrc};
717
- });
718
- templateData.content = (<div style={{ display: 'flex'}}>{
719
- (fbAdImages.map((img) => <img
720
- width={208}
721
- height={279}
722
- src={img.url}
723
- alt={"test"}
724
- key={`${img.url}_`}
725
- /> ))
726
- }
727
- </div>);
728
- templateData.className = isCarousel ? 'carousel-img-section' : '';
729
- break;
730
670
  case LINE: {
731
671
  const {
732
672
  content: {
@@ -810,13 +750,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
810
750
  {!isLoading && <div>
811
751
  {!isEmpty(filteredTemplates) || !isEmpty(this.state.searchText) || !isEmpty(this.props.Templates.templateError) ? (
812
752
  <div className={!isEmpty(this.state.searchText) && isEmpty(cardDataList) ? '' : "pagination-container"}>
813
- <CapCustomCardList
814
- key={`${currentChannel}-card-list`}
815
- cardList={cardDataList}
816
- type={currentChannel}
817
- style={{marginLeft: '16px'}}
818
- fbType={"list"}
819
- />
753
+ <CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={currentChannel} style={{marginLeft: '16px'}}/>
820
754
  </div>)
821
755
  : ['sms', "email"].includes(this.state.channel.toLowerCase()) && <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />
822
756
  }
@@ -1308,15 +1242,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1308
1242
  this.props.viberActions.clearCreateResponse();
1309
1243
  }
1310
1244
  });
1311
- } else if (this.state.channel.toLowerCase() === FACEBOOK_CHANNEL) {
1312
- this.props.facebookActions.createTemplate(duplicateObj, (response) => {
1313
- if (response && response.templateId) {
1314
- const message = `${this.state.channel} ${this.props.intl.formatMessage(messages.templateDuplicateSuccess)}`;
1315
- CapNotification.success({key: 'duplicateSucess', message});
1316
- this.getAllTemplates({params, resetPage: true});
1317
- this.props.facebookActions.clearCreateResponse();
1318
- }
1319
- });
1320
1245
  }
1321
1246
  }
1322
1247
 
@@ -1401,9 +1326,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1401
1326
  if (this.state.channel.toLowerCase() === VIBER_CHANNEL) {
1402
1327
  pathName = `/viber/edit/${id}/`;
1403
1328
  }
1404
- if (this.state.channel.toLowerCase() === FACEBOOK_CHANNEL) {
1405
- pathName = `/facebook/edit/${id}/`;
1406
- }
1407
1329
  if (this.state.channel.toUpperCase() === WECHAT) {
1408
1330
  if (get(template, 'definition.msgcontent', '') === "RICH_MEDIA_WECHAT") {
1409
1331
  pathName = `/wechat/richmedia/edit/${id}`;
@@ -1703,8 +1625,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1703
1625
  const lineLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === 'line');
1704
1626
  const smsLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === 'sms');
1705
1627
  const viberLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === VIBER_CHANNEL);
1706
- const facebookLoader = (getAllTemplatesInProgress && this.state.channel.toLowerCase() === FACEBOOK_CHANNEL);
1707
-
1708
1628
  const wechatLoader = (((this.state.selectedAccount !== '' && getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'wechat');
1709
1629
  const mobilePushLoader = (((getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'mobilepush');
1710
1630
  const emailLoader = (
@@ -1719,7 +1639,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1719
1639
  (ebillLoader !== undefined ? ebillLoader : false) ||
1720
1640
  (mobilePushLoader !== undefined ? mobilePushLoader : false) ||
1721
1641
  (lineLoader !== undefined ? lineLoader : false) ||
1722
- (facebookLoader !== undefined ? facebookLoader : false) ||
1723
1642
  (viberLoader !== undefined ? viberLoader : false);
1724
1643
  return isLoading;
1725
1644
  }
@@ -1797,7 +1716,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1797
1716
  channel = channel.toUpperCase();
1798
1717
  const { Templates: templates = {}, location = {} } = this.props;
1799
1718
  const { query = {} } = location;
1800
- const { weCrmAccounts = [], fetchingWeCrmAccounts = false, campaignSettings = {} } = templates;
1719
+ const { weCrmAccounts = [], fetchingWeCrmAccounts = false } = templates;
1801
1720
  const isWechatChannel = channel === WECHAT;
1802
1721
  const isMobilePushChannel = channel === MOBILE_PUSH;
1803
1722
  const isLineChannel = channel === LINE;
@@ -1865,31 +1784,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1865
1784
  noAccountHeader = messages.noAccountsPresentViber;
1866
1785
  break;
1867
1786
  }
1868
- case FACEBOOK: {
1869
- noAccountHeader = messages.noAccountsPresentFacebook;
1870
- break;
1871
- }
1872
1787
  default:
1873
1788
  break;
1874
1789
  }
1875
- let showNoAccountHeader = isEmpty(weCrmAccounts) && !fetchingWeCrmAccounts;
1876
- if (channel === FACEBOOK && !isEmpty(campaignSettings) ) {
1877
- const fbSetting = get(campaignSettings, 'accountSettings.socialAccountSettings.facebookAccountSettings', []);
1878
- const { orgUnitFacebookPageSettingsMap } = fbSetting[0] || {};
1879
- let pageAccessToken = false;
1880
- if (!isEmpty(orgUnitFacebookPageSettingsMap)) {
1881
- Object.values(orgUnitFacebookPageSettingsMap).forEach((obj) => {
1882
- if (obj.pageAccessToken) {
1883
- pageAccessToken = true;
1884
- }
1885
- });
1886
- showNoAccountHeader = !pageAccessToken;
1887
- } else {
1888
- showNoAccountHeader = true;
1889
- }
1890
- }
1891
1790
  return (<CapSpin spinning={fetchingWeCrmAccounts}>
1892
- {showNoAccountHeader ? <FormattedMessage {...noAccountHeader} /> :
1791
+ {isEmpty(weCrmAccounts) && !fetchingWeCrmAccounts ? <FormattedMessage {...noAccountHeader} /> :
1893
1792
  <div style={{ overflowX: "auto", paddingBottom: CAP_SPACE_16 }}>
1894
1793
  <CapHeader
1895
1794
  title={accountHeader}
@@ -1943,15 +1842,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1943
1842
  render() {
1944
1843
  const isFullMode = this.isFullMode();
1945
1844
  const { activeMode, channel, wechatFilter, lineFilter } = this.state;
1946
- const showForViber = (![VIBER_CHANNEL, FACEBOOK_CHANNEL].includes(channel.toLowerCase()) ||
1947
- (channel.toLowerCase() === VIBER_CHANNEL && !this.props.isFullMode && isEmpty(get(this.props, 'Templates.selectedViberAccount', {}))) ||
1948
- (channel.toLowerCase() === FACEBOOK_CHANNEL && isEmpty(get(this.props, 'Templates.selectedFacebookAccount', {})))
1949
- );
1845
+ const showForViber = (channel.toLowerCase() !== VIBER_CHANNEL ||
1846
+ (channel.toLowerCase() === VIBER_CHANNEL && !this.props.isFullMode && isEmpty(get(this.props, 'Templates.selectedViberAccount', {}))));
1950
1847
  if (activeMode === ACCOUNT_SELECTION_MODE && showForViber ) {
1951
1848
  return this.renderAccountSelection();
1952
1849
  }
1953
-
1954
-
1955
1850
  const pageHeader = "";
1956
1851
  const pageHeaderDvs = "";
1957
1852
  const isLoading = this.isLoading();
@@ -2163,7 +2058,6 @@ Templates.propTypes = {
2163
2058
  handlePeviewTemplate: PropTypes.func,
2164
2059
  router: PropTypes.object,
2165
2060
  viberActions: PropTypes.object,
2166
- facebookActions: PropTypes.object,
2167
2061
  };
2168
2062
 
2169
2063
  const mapStateToProps = createStructuredSelector({
@@ -2190,7 +2084,6 @@ function mapDispatchToProps(dispatch) {
2190
2084
  globalActions: bindActionCreators(globalActions, dispatch),
2191
2085
  lineActions: bindActionCreators(lineActions, dispatch),
2192
2086
  viberActions: bindActionCreators(viberActions, dispatch),
2193
- facebookActions: bindActionCreators(facebookActions, dispatch),
2194
2087
  };
2195
2088
  }
2196
2089
 
@@ -358,20 +358,16 @@ export default defineMessages({
358
358
  id: `${scope}.richMediaTemplates`,
359
359
  defaultMessage: 'Rich media templates',
360
360
  },
361
- "deletingTemplate": {
361
+ deletingTemplate: {
362
362
  id: `${scope}.deletingTemplate`,
363
363
  defaultMessage: 'Deleting template...',
364
364
  },
365
- "duplicatingTemplate": {
365
+ duplicatingTemplate: {
366
366
  id: `${scope}.duplicatingTemplate`,
367
- defaultMessage: 'Duplicating template...',
367
+ defaultMessage: 'Duplicating template...'
368
368
  },
369
- "noAccountsPresentViber": {
369
+ noAccountsPresentViber: {
370
370
  id: `${scope}.noAccountsPresentViber`,
371
371
  defaultMessage: "Viber accounts are not setup for your brand",
372
372
  },
373
- "noAccountsPresentFacebook": {
374
- id: `${scope}.noAccountsPresentFacebook`,
375
- defaultMessage: "Facebook accounts or Facebook Page are not setup for your brand",
376
- },
377
373
  });
@@ -9,18 +9,10 @@ import * as types from './constants';
9
9
 
10
10
  const initialState = fromJS({
11
11
  getAllTemplatesInProgress: false,
12
- fetchingOrgLevelCampaignSettings: true,
13
12
  templates: [],
14
13
  deleteResponse: {},
15
14
  deleteTemplateInProgress: false,
16
15
  templateError: {},
17
- campaignSettings: {
18
- messageSettings: {
19
- enableLinkTracking: false,
20
- },
21
- alertsSettings: {},
22
- reportsSettings: {},
23
- },
24
16
  });
25
17
 
26
18
  function templatesReducer(state = initialState, action) {
@@ -83,8 +75,6 @@ function templatesReducer(state = initialState, action) {
83
75
  return state.set('selectedLineAccount', fromJS(action.lineAccount));
84
76
  case types.SET_VIBER_ACCOUNT:
85
77
  return state.set('selectedViberAccount', fromJS(action.viberAccount));
86
- case types.SET_FACEBOOK_ACCOUNT:
87
- return state.set('selectedFacebookAccount', fromJS(action.faceBookAccount));
88
78
  case types.RESET_ACCOUNT:
89
79
  return state
90
80
  .remove('selectedWeChatAccount')
@@ -157,18 +147,6 @@ function templatesReducer(state = initialState, action) {
157
147
  return state
158
148
  .set('templates', [])
159
149
  .set('weCRMtemplates', fromJS({}));
160
- case types.GET_ORG_LEVEL_CAMPAIGN_SETTINGS_REQUEST:
161
- return state.set('fetchingOrgLevelCampaignSettings', true);
162
- case types.GET_ORG_LEVEL_CAMPAIGN_SETTINGS_SUCCESS:
163
- return state.set('fetchingOrgLevelCampaignSettings', false).set(
164
- 'campaignSettings',
165
- fromJS({
166
- ...state.get('campaignSettings'),
167
- ...(action.result || {}).entity,
168
- }),
169
- );
170
- case types.GET_ORG_LEVEL_CAMPAIGN_SETTINGS_FAILURE:
171
- return state.set('fetchingOrgLevelCampaignSettings', false);
172
150
  default:
173
151
  return state;
174
152
  }