@capillarytech/creatives-library 7.6.8 → 7.6.10

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 (110) hide show
  1. package/components/CapTagList/index.js +5 -5
  2. package/components/Card/index.js +1 -1
  3. package/components/Ckeditor/index.js +5 -5
  4. package/components/CustomPopOver/index.js +3 -3
  5. package/components/Edmeditor/index.js +4 -4
  6. package/components/EmailPreview/index.js +1 -1
  7. package/components/PreviewSideBar/index.js +3 -3
  8. package/components/Sidebar/index.js +1 -1
  9. package/components/SmsTest/index.js +4 -4
  10. package/components/TemplatePreview/index.js +2 -2
  11. package/components/Toastr/index.js +1 -1
  12. package/containers/Assets/Gallery/index.js +2 -2
  13. package/containers/Assets/Gallery/sagas.js +1 -1
  14. package/containers/Cap/actions.js +2 -2
  15. package/containers/Cap/reducer.js +1 -1
  16. package/containers/Cap/sagas.js +3 -3
  17. package/containers/Cap/selectors.js +1 -1
  18. package/containers/Ebill/actions.js +1 -1
  19. package/containers/Ebill/index.js +34 -34
  20. package/containers/Ebill/sagas.js +3 -3
  21. package/containers/Email/actions.js +2 -2
  22. package/containers/Email/index.js +171 -171
  23. package/containers/Email/reducer.js +1 -1
  24. package/containers/Email/sagas.js +6 -6
  25. package/containers/LanguageProvider/actions.js +1 -1
  26. package/containers/Line/Create/actions.js +5 -5
  27. package/containers/Line/Create/index.js +37 -37
  28. package/containers/Line/Create/sagas.js +7 -7
  29. package/containers/Line/Edit/actions.js +3 -3
  30. package/containers/Line/Edit/index.js +24 -24
  31. package/containers/Line/Edit/sagas.js +4 -4
  32. package/containers/MobilePush/Create/actions.js +2 -2
  33. package/containers/MobilePush/Create/index.js +35 -35
  34. package/containers/MobilePush/Create/sagas.js +2 -2
  35. package/containers/MobilePush/Edit/actions.js +3 -3
  36. package/containers/MobilePush/Edit/index.js +32 -32
  37. package/containers/MobilePush/Edit/sagas.js +5 -5
  38. package/containers/Sms/Create/actions.js +2 -2
  39. package/containers/Sms/Create/index.js +57 -57
  40. package/containers/Sms/Create/sagas.js +2 -2
  41. package/containers/Sms/Edit/actions.js +3 -3
  42. package/containers/Sms/Edit/index.js +44 -44
  43. package/containers/Sms/Edit/sagas.js +3 -3
  44. package/containers/TagList/index.js +9 -9
  45. package/containers/Templates/actions.js +5 -5
  46. package/containers/Templates/index.js +44 -44
  47. package/containers/Templates/sagas.js +5 -5
  48. package/containers/WeChat/MapTemplates/actions.js +1 -1
  49. package/containers/WeChat/MapTemplates/index.js +34 -34
  50. package/containers/WeChat/MapTemplates/sagas.js +2 -2
  51. package/containers/WeChat/RichmediaTemplates/Create/index.js +9 -9
  52. package/containers/WeChat/RichmediaTemplates/Edit/actions.js +1 -1
  53. package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +1 -1
  54. package/package.json +1 -1
  55. package/services/api.js +13 -13
  56. package/utils/authWrapper.js +2 -2
  57. package/utils/smsCharCount.js +5 -5
  58. package/v2Components/CapTagList/index.js +1 -1
  59. package/v2Components/Card/index.js +1 -1
  60. package/v2Components/Ckeditor/index.js +5 -5
  61. package/v2Components/CustomPopOver/index.js +3 -3
  62. package/v2Components/Edmeditor/index.js +4 -4
  63. package/v2Components/EmailMobilePreview/index.js +4 -4
  64. package/v2Components/EmailPreviewV2/index.js +4 -4
  65. package/v2Components/FormBuilder/index.js +3 -3
  66. package/v2Components/PreviewSideBar/index.js +3 -3
  67. package/v2Components/SmsTest/index.js +4 -4
  68. package/v2Components/TemplatePreview/index.js +1 -1
  69. package/v2Components/Toastr/index.js +1 -1
  70. package/v2Containers/Assets/Gallery/sagas.js +1 -1
  71. package/v2Containers/Cap/actions.js +1 -1
  72. package/v2Containers/Cap/index.js +2 -2
  73. package/v2Containers/Cap/reducer.js +1 -1
  74. package/v2Containers/Cap/sagas.js +3 -3
  75. package/v2Containers/Cap/selectors.js +1 -1
  76. package/v2Containers/CreativesContainer/SlideBoxContent.js +8 -1
  77. package/v2Containers/CreativesContainer/index.js +31 -22
  78. package/v2Containers/Ebill/actions.js +1 -1
  79. package/v2Containers/Ebill/index.js +34 -34
  80. package/v2Containers/Ebill/sagas.js +3 -3
  81. package/v2Containers/Email/reducer.js +1 -1
  82. package/v2Containers/EmailWrapper/index.js +4 -4
  83. package/v2Containers/Facebook/Advertisement/index.js +22 -3
  84. package/v2Containers/Facebook/index.js +5 -1
  85. package/v2Containers/Facebook/messages.js +9 -5
  86. package/v2Containers/Facebook/sagas.js +1 -1
  87. package/v2Containers/LanguageProvider/actions.js +1 -1
  88. package/v2Containers/Line/Container/actions.js +5 -5
  89. package/v2Containers/Line/Container/sagas.js +4 -4
  90. package/v2Containers/MobilePush/Create/actions.js +2 -2
  91. package/v2Containers/MobilePush/Create/index.js +1 -1
  92. package/v2Containers/MobilePush/Create/sagas.js +2 -2
  93. package/v2Containers/MobilePush/Edit/actions.js +3 -3
  94. package/v2Containers/MobilePush/Edit/index.js +26 -26
  95. package/v2Containers/MobilePush/Edit/sagas.js +5 -5
  96. package/v2Containers/Sms/Create/index.js +4 -4
  97. package/v2Containers/TagList/index.js +6 -6
  98. package/v2Containers/Templates/actions.js +5 -5
  99. package/v2Containers/Templates/index.js +5 -4
  100. package/v2Containers/Templates/sagas.js +4 -4
  101. package/v2Containers/TemplatesV2/index.js +14 -2
  102. package/v2Containers/TemplatesV2/messages.js +4 -0
  103. package/v2Containers/Viber/actions.js +2 -2
  104. package/v2Containers/Viber/sagas.js +2 -2
  105. package/v2Containers/WeChat/MapTemplates/actions.js +1 -1
  106. package/v2Containers/WeChat/MapTemplates/index.js +19 -19
  107. package/v2Containers/WeChat/MapTemplates/sagas.js +3 -3
  108. package/v2Containers/WeChat/RichmediaTemplates/Create/actions.js +1 -1
  109. package/v2Containers/WeChat/RichmediaTemplates/Edit/actions.js +1 -1
  110. package/v2Containers/WeChat/RichmediaTemplates/Edit/sagas.js +1 -1
@@ -25,6 +25,9 @@ import {isLoading as isLoadingSelector} from './selectors';
25
25
  import messages from './messages';
26
26
  import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
27
27
  import { makeSelectFetchingCmsData } from '../Email/selectors';
28
+ import {IMAGE, VIDEO } from '../Facebook/Advertisement/constant';
29
+ import { CREATIVE } from '../Facebook/constant';
30
+
28
31
 
29
32
  const classPrefix = 'add-creatives-section';
30
33
 
@@ -74,11 +77,11 @@ class Creatives extends React.Component {
74
77
  }
75
78
 
76
79
  onSelectTemplate = (template, fbAdManger) => {
80
+ const data = {slidBoxContent: 'editTemplate', templateData: template};
77
81
  if (fbAdManger) {
78
- this.setState({ slidBoxContent: 'editTemplate', templateData: template, fbAdManger});
79
- } else {
80
- this.setState({ slidBoxContent: 'editTemplate', templateData: template });
82
+ data.fbAdManger = fbAdManger;
81
83
  }
84
+ this.setState(data);
82
85
  };
83
86
  onPreviewTemplate = (template) => {
84
87
  const templateData = template;
@@ -91,11 +94,11 @@ class Creatives extends React.Component {
91
94
  this.setState({ slidBoxContent: 'editTemplate', showSlideBox: true });
92
95
  };
93
96
  onCreateNew = (fbAdManger) => {
97
+ const data = { slidBoxContent: 'createTemplate', showSlideBox: true };
94
98
  if (fbAdManger) {
95
- this.setState({ slidBoxContent: 'createTemplate', showSlideBox: true, fbAdManger });
96
- } else {
97
- this.setState({ slidBoxContent: 'createTemplate', showSlideBox: true });
99
+ data.fbAdManger = fbAdManger;
98
100
  }
101
+ this.setState(data);
99
102
  };
100
103
 
101
104
  onShowTemplates = () => {
@@ -227,29 +230,33 @@ class Creatives extends React.Component {
227
230
  break;
228
231
  }
229
232
  case constants.FACEBOOK: {
230
- if (templateData.fbContentType === "CREATIVE") {
231
- const { creativeType, selectedFacebookAccount } = templateData || {};
232
- const fBContent = templateData.facebookCreativeList;
233
+ if (templateData.fbContentType === CREATIVE) {
234
+ const {
235
+ creativeType = "",
236
+ selectedFacebookAccount = {},
237
+ facebookCreativeList: fbCreativeList = [],
238
+ } = templateData || {};
239
+ const fBContent = fbCreativeList;
233
240
  const facebookCreativeList = [];
234
241
  fBContent.forEach((obj) => {
235
242
  const data = cloneDeep(obj);
236
- const {subType, linkDescription, imageLink, websiteLink, videoId} = obj;
243
+ const {subType, linkDescription, imageLink, websiteLink, videoId, videoName, videoUrl} = obj || {};
237
244
  delete data.linkDescription;
238
245
  delete data.websiteLink;
239
246
  data.linkDesc = linkDescription;
240
247
  data.webSiteLink = websiteLink;
241
248
  data.type = creativeType;
242
249
  switch (subType) {
243
- case "IMAGE":
250
+ case IMAGE:
244
251
  data.imgSrc = imageLink;
245
252
  delete data.imageLink;
246
253
  break;
247
- case "VIDEO":
254
+ case VIDEO:
248
255
  data.video = {
249
256
  previewImageUrl: imageLink,
250
257
  videoId,
251
- videoSrc: "",
252
- videoName: "",
258
+ videoSrc: videoUrl,
259
+ videoName,
253
260
  };
254
261
  delete data.imageLink;
255
262
  break;
@@ -267,7 +274,7 @@ class Creatives extends React.Component {
267
274
  },
268
275
  },
269
276
  },
270
- type: "FACEBOOK",
277
+ type: constants.FACEBOOK,
271
278
  edit: true,
272
279
  selectedFacebookAccount,
273
280
  };
@@ -446,27 +453,27 @@ class Creatives extends React.Component {
446
453
  data.websiteLink = webSiteLink;
447
454
 
448
455
  switch (subType) {
449
- case "IMAGE":
456
+ case IMAGE:
450
457
  data.imageLink = imgSrc;
451
458
  delete data.imgSrc;
452
459
  break;
453
- case "VIDEO":
460
+ case VIDEO:
454
461
  data.imageLink = video.previewImageUrl;
455
462
  data.videoId = video.videoId;
463
+ data.videoUrl = video.videoSrc;
464
+ data.videoName = video.videoName;
456
465
  delete data.video;
457
466
  break;
458
- case "CAROUSEL":
459
- break;
460
467
  default:
461
468
  break;
462
469
  }
463
470
  facebookCreativeList.push(data);
464
471
  });
465
472
  templateData = {
466
- fbContentType: "CREATIVE",
473
+ fbContentType: CREATIVE,
467
474
  creativeType: type,
468
475
  facebookCreativeList,
469
- channel: "FACEBOOK",
476
+ channel: constants.FACEBOOK,
470
477
  accountId,
471
478
  selectedMarketingObjective: template.value.selectedMarketingObjective,
472
479
  };
@@ -719,6 +726,7 @@ class Creatives extends React.Component {
719
726
  campaignSettings={this.props.Templates.campaignSettings}
720
727
  location={this.props.location}
721
728
  messageDetails={this.props.messageDetails}
729
+ showDisableInfoForFacebook={this.props.showDisableInfoForFacebook}
722
730
  getFormData={this.getFormData}
723
731
  onCallTaskSubmit={this.onCallTaskSubmit}
724
732
  onCreateNew={this.onCreateNew}
@@ -760,6 +768,7 @@ class Creatives extends React.Component {
760
768
  onFTPSubmit={getCreativesData}
761
769
  editor={editor}
762
770
  messageStrategy={this.props.strategy}
771
+ orgUnitId={this.props.orgUnitId}
763
772
  />
764
773
  }
765
774
  footer={this.shouldShowFooter() &&
@@ -813,7 +822,7 @@ Creatives.propTypes = {
813
822
  Templates: PropTypes.object,
814
823
  selectedAccount: PropTypes.object,
815
824
  strategy: PropTypes.string,
816
-
825
+ orgUnitId: PropTypes.number,
817
826
  };
818
827
  const mapStatesToProps = () => createStructuredSelector({
819
828
  isLoading: isLoadingSelector(),
@@ -14,7 +14,7 @@ export function createTemplate(template) {
14
14
  }
15
15
 
16
16
  export function getTemplateDetails(id, channel) {
17
- console.log('getting template', id, channel);
17
+
18
18
  return {
19
19
  type: types.GET_TEMPLATE_DETAILS_REQUEST,
20
20
  id,
@@ -585,13 +585,13 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
585
585
  type: 'LAYOUT',
586
586
  };
587
587
  this.props.globalActions.fetchSchemaForEntity(query);
588
- console.log('Form Data After 2', this.state.formData, this.props.Ebill.cmsData);
588
+
589
589
  }
590
590
 
591
591
  componentWillReceiveProps(nextProps) {
592
592
  if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.schema)) {
593
593
  this.injectEvents(nextProps.metaEntities.layouts[0].definition);
594
- console.log('isTagLoaded', this.isTagLoaded);
594
+
595
595
  const query = {
596
596
  layout: 'EBILL',
597
597
  type: 'TAG',
@@ -627,18 +627,18 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
627
627
  this.props.globalActions.addMessageToQueue(message);
628
628
  }
629
629
 
630
- console.log('Form Data After ', nextProps.Ebill.cmsData, this.props.Ebill.cmsData);
630
+
631
631
  if (nextProps.Ebill.cmsData !== '' && !_.isEqual(nextProps.Ebill.cmsData, this.props.Ebill.cmsData)) {
632
632
  const formData = _.cloneDeep(this.state.formData);
633
633
  formData[this.state.currentTab - 1][`ebill-editor${this.state.currentTab > 1 ? this.state.currentTab : ''}`] = nextProps.Ebill.cmsData.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/\\&quot;/g, "\"");
634
- console.log('Manoj Form Data After 21', formData);
634
+
635
635
  this.setState({formData});
636
636
  }
637
637
 
638
638
  if (nextProps.Templates.selectedEmailLayout && nextProps.Templates.selectedEmailLayout !== '' && this.state.formData[this.state.currentTab - 1] && this.state.formData[this.state.currentTab - 1][`ebill-editor${this.state.currentTab > 1 ? this.state.currentTab : ''}`] !== '') {
639
639
  const formData = _.cloneDeep(this.state.formData);
640
640
  formData[this.state.currentTab - 1][`ebill-editor${this.state.currentTab > 1 ? this.state.currentTab : ''}`] = nextProps.Templates.selectedEmailLayout;
641
- console.log('Manoj Form Data After 01', formData);
641
+
642
642
  this.setState({formData});
643
643
  }
644
644
 
@@ -654,7 +654,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
654
654
  }
655
655
 
656
656
  onTagSelect = (data, currentTab, value) => {
657
- console.log('On Tag selection ', data, currentTab, value);
657
+
658
658
  if (this.state.isDragDrop) {
659
659
  const msg = {
660
660
  action: "InsertToCursor",
@@ -669,12 +669,12 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
669
669
  };
670
670
 
671
671
  onTabChange = (data, formData) => {
672
- console.log('inside parent ontabchange', data, this.state);
672
+
673
673
  this.setState({currentTab: data, formData});
674
674
  };
675
675
 
676
676
  onFormDataChange = (formData, tabCount, currentTab) => {
677
- console.log('Form data changed is ', formData, tabCount, currentTab);
677
+
678
678
  const tmpFormData = _.cloneDeep(formData);
679
679
  if (this.props.Templates.selectedEmailLayout !== '' && tmpFormData['0']['ebill-editor'] === '') {
680
680
  tmpFormData['0']['ebill-editor'] = this.props.Templates.selectedEmailLayout;
@@ -687,18 +687,18 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
687
687
  };
688
688
 
689
689
  onTagSelect = (data, currentTab) => {
690
- console.log('parent data tag', data, currentTab);
690
+
691
691
  const editorId = currentTab > 1 ? `ebill-editor${currentTab}` : 'ebill-editor';
692
692
  this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
693
693
  document.getElementById(editorId).focus();
694
694
  };
695
695
 
696
696
  onTemplateNameChange = (name) => {
697
- console.log('Template name changed to ', name);
697
+
698
698
  };
699
699
 
700
700
  onTemplateContentChange = (content) => {
701
- console.log('Template content changed to ', content);
701
+
702
702
  };
703
703
 
704
704
  setEditState = (data) => {
@@ -719,7 +719,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
719
719
  }
720
720
  if (type === 'embedded' || count > 0) {
721
721
  setTimeout( () => {
722
- console.log('removing standalone');
722
+
723
723
  if (type === 'embedded') {
724
724
  that.removeStandAlone();
725
725
  } else {
@@ -735,13 +735,13 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
735
735
  formData[0].base = true;
736
736
  }
737
737
  formData.base = data.versions.base;
738
- console.log('form data after discarding ', formData);
738
+
739
739
  this.setState({tabCount, formData, editData: data, currentTab: 1}, () => {
740
740
  });
741
741
  };
742
742
 
743
743
  getMappedEvent = (id, event) => {
744
- console.log('Map ', this.map, id, event);
744
+
745
745
  return this.map[id][event];
746
746
  };
747
747
 
@@ -769,11 +769,11 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
769
769
  saveFormData = (formData) => {
770
770
  //Logic to save in db etc
771
771
  // const isValidated = this.validateFormData(formData);
772
- // console.log('whyyyy');
772
+ //
773
773
  // if (!isValidated) {
774
774
  // return;
775
775
  // }
776
- console.log('Saving form data', formData, this.state.tabCount);
776
+
777
777
  const obj = {};
778
778
  obj.versions = {
779
779
  base: {},
@@ -790,11 +790,11 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
790
790
  });
791
791
  obj.name = formData['template-name'];
792
792
  obj.versions.base = formData.base;
793
- console.log('HTML file ', obj.versions.history);
793
+
794
794
  _.forEach(obj.versions.history, (index, version) => {
795
- console.log('Encoding ', index, version);
795
+
796
796
  });
797
- console.log('obj', obj);
797
+
798
798
  this.props.actions.createTemplate(obj);
799
799
  };
800
800
 
@@ -811,17 +811,17 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
811
811
  }
812
812
  }
813
813
  if (isValid) {
814
- console.log('isValid');
814
+
815
815
  return true;
816
816
  }
817
817
  const message = getMessageObject('error', this.props.intl.formatMessage(messages.templateDataNotValid), true);
818
818
  this.props.globalActions.addMessageToQueue(message);
819
- console.log('not valid');
819
+
820
820
  return false;
821
821
  };
822
822
 
823
823
  handleOnTagsContextChange = (data) => {
824
- console.log('parent tags context', data);
824
+
825
825
  const query = {
826
826
  layout: 'EBILL',
827
827
  type: 'TAG',
@@ -905,7 +905,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
905
905
 
906
906
 
907
907
  injectEvents(schema) {
908
- console.log('now injecting events', schema);
908
+
909
909
  const temp = schema;
910
910
  temp.standalone.sections = this.injectSections(temp.standalone.sections);
911
911
  _.forEach(temp.containers, (container) => {
@@ -913,7 +913,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
913
913
  tempContainer = this.injectContainer(tempContainer);
914
914
  return tempContainer;
915
915
  });
916
- console.log('final injected schema', schema);
916
+
917
917
  this.setState({schema}, () => {
918
918
  const type = this.props.location.query.type;
919
919
  if (type === 'embedded') {
@@ -955,7 +955,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
955
955
  console.log('injected event for ', col, event, this.getMappedEvent(col.id, event));
956
956
  temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
957
957
  });
958
- console.log('should translate multicol', temp);
958
+
959
959
  if (temp.type === 'icon') {
960
960
  return true;
961
961
  }
@@ -986,7 +986,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
986
986
  _.forEach(col.supportedEvents, (event) => {
987
987
  temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
988
988
  });
989
- console.log('should translate multicol action', temp);
989
+
990
990
  if (temp.type === 'icon') {
991
991
  return true;
992
992
  }
@@ -1020,7 +1020,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
1020
1020
  _.forEach(inputField.supportedEvents, (event) => {
1021
1021
  temp.injectedEvents[event] = this.getMappedEvent(inputField.id, event);
1022
1022
  });
1023
- console.log('should translate collabel', temp);
1023
+
1024
1024
  if (temp.type === 'icon') {
1025
1025
  return true;
1026
1026
  }
@@ -1049,7 +1049,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
1049
1049
  _.forEach(actionField.supportedEvents, (event) => {
1050
1050
  temp.injectedEvents[event] = this.getMappedEvent(actionField.id, event);
1051
1051
  });
1052
- console.log('should translate collabel action', temp);
1052
+
1053
1053
  if (temp.type === 'icon') {
1054
1054
  return true;
1055
1055
  }
@@ -1099,7 +1099,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
1099
1099
  }
1100
1100
 
1101
1101
  cloneColLabel(sectionObj, tabIndex) {
1102
- console.log('cloning cloneColLabel', sectionObj, tabIndex);
1102
+
1103
1103
  const section = _.cloneDeep(sectionObj);
1104
1104
  const inputFields = _.forEach(section.inputFields, (inputField) => {
1105
1105
  const inputF = inputField;
@@ -1108,12 +1108,12 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
1108
1108
  return inputF;
1109
1109
  });
1110
1110
  section.inputFields = inputFields;
1111
- console.log('cloned ifs are', section);
1111
+
1112
1112
  return section;
1113
1113
  }
1114
1114
 
1115
1115
  cloneMultiCol(sectionObj, tabIndex) {
1116
- console.log('cloning multicol ', sectionObj, tabIndex);
1116
+
1117
1117
  const section = _.cloneDeep(sectionObj);
1118
1118
  const inputFields = _.forEach(section.inputFields, (inputField) => {
1119
1119
  const inputF = inputField;
@@ -1127,7 +1127,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
1127
1127
  return inputF;
1128
1128
  });
1129
1129
  section.inputFields = inputFields;
1130
- console.log('cloned cols are', section);
1130
+
1131
1131
  return section;
1132
1132
  }
1133
1133
 
@@ -1145,13 +1145,13 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
1145
1145
  } else if (childSection.type === 'parent') {
1146
1146
  sect = this.cloneParent(childSection, tabIndex);
1147
1147
  }
1148
- console.log('returning cloned parent section', sect);
1148
+
1149
1149
  childSections.push(sect);
1150
1150
  return true;
1151
1151
  });
1152
1152
  console.log('returning cloned parent section final 1', JSON.stringify(childSections));
1153
1153
  parentsect.childSections = childSections;
1154
- console.log('returning cloned parent section final', parentsect);
1154
+
1155
1155
  return _.cloneDeep(parentsect);
1156
1156
  }
1157
1157
 
@@ -7,7 +7,7 @@ import * as types from './constants';
7
7
  export function* createTemplate(template) {
8
8
  let errorMsg = "";
9
9
  try {
10
- console.log('Template data ', template);
10
+
11
11
  const result = yield call(Api.createEbillTemplate, template);
12
12
  if ((result.message && typeof result.message === 'string') || result.status.code === 500) {
13
13
  errorMsg = result.message;
@@ -20,7 +20,7 @@ export function* createTemplate(template) {
20
20
 
21
21
  export function* getTemplateDetails(id, channel) {
22
22
  try {
23
- console.log('saga get Template details', id);
23
+
24
24
  const result = yield call(Api.getTemplateDetails, id, channel);
25
25
  // const sidebar = result.response.sidebar;
26
26
  yield put({ type: types.GET_TEMPLATE_DETAILS_SUCCESS, data: result.response });
@@ -32,7 +32,7 @@ export function* getTemplateDetails(id, channel) {
32
32
  export function* getCmsData({cmsType, projectId}) {
33
33
  try {
34
34
  const result = yield call(Api.getCmsData, cmsType, projectId);
35
- console.log('CMS Data ', result);
35
+
36
36
  yield put({ type: types.GET_CMS_EDITOR_DATA_SUCCESS, data: decodeURIComponent(result.data.response.cmsData.htmlContent) });
37
37
  } catch (error) {
38
38
  yield put({ type: types.GET_CMS_EDITOR_DATA_FAILURE, error });
@@ -14,7 +14,7 @@ const initialState = fromJS({
14
14
  });
15
15
 
16
16
  function emailReducer(state = initialState, action) {
17
- //console.log('email reducer', action);
17
+ //
18
18
  switch (action.type) {
19
19
  case types.CREATE_TEMPLATE_REQUEST:
20
20
  return state
@@ -132,9 +132,9 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
132
132
 
133
133
 
134
134
  if (supportedZipFormats.indexOf(fileExtension.toLowerCase()) !== -1) {
135
- templatesActions.handleZipUpload(file, () => { //handle upload success
135
+ templatesActions.handleZipUpload(file.originFileObj, () => { //handle upload success
136
136
  this.setState({ modeContent: { file } }, showNextStep);
137
- this.stopTimerGA();
137
+ stopTimerGA();
138
138
  }, this.handleZipUploadError);
139
139
  } else if (fileExtension === 'html' || fileExtension === 'htm') {
140
140
  const reader = new FileReader();
@@ -145,7 +145,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
145
145
  });
146
146
  // showNextStep();
147
147
  };
148
- reader.readAsText(file);
148
+ reader.readAsText(file.originFileObj);
149
149
  } else {
150
150
  const message = {
151
151
  key: "email-upload-error",
@@ -229,7 +229,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
229
229
  <div>
230
230
  {emailCreateMode === "upload" &&
231
231
  <div style={{ marginLeft: '8px' }}>
232
- <CapUploader customRequest={this.useFileUpload} accept=".zip, .html, .htm" showUploadList={false}>
232
+ <CapUploader onChange={this.useFileUpload} accept=".zip, .html, .htm" showUploadList={false}>
233
233
  <CapButton>{this.props.intl.formatMessage(messages.upload)}</CapButton>
234
234
  </CapUploader>
235
235
  {!_.isEmpty(EmailLayout) &&
@@ -90,6 +90,7 @@ export const Advertisement = (props) => {
90
90
  facebookTemplateData,
91
91
  selectedMarketingObjective,
92
92
  fbAdManger,
93
+ orgUnitId,
93
94
  } = props;
94
95
  const {
95
96
  formatMessage,
@@ -821,14 +822,32 @@ export const Advertisement = (props) => {
821
822
  const orgName = (
822
823
  proxyOrgList.find(({ orgID }) => orgID === Number(orgId)) || {}
823
824
  ).orgName;
824
- if (status === 'SUCCESS') {
825
+ if (!status) {
826
+ // !status is the case of library
827
+ //if org id is the parent org
828
+ if (orgUnitFacebookPageSettingsMap[-1] && !pageId) {
829
+ setPageId(-1);
830
+ }
831
+ if (orgUnitFacebookPageSettingsMap[-1]) {
832
+ pageAccessOrgsOptions.push({label: orgName, value: -1});
833
+ }
834
+ // if we are coming from default startegy and calling templates from facebook/index.js
835
+ if (!pageId && orgUnitId && orgUnitFacebookPageSettingsMap[orgUnitId]) {
836
+ setPageId(orgUnitId);
837
+ }
838
+ } else if (status === 'SUCCESS') {
825
839
  Object.keys(data).forEach((obj) => {
826
840
  if ((orgUnitFacebookPageSettingsMap[data[obj]] || {}).pageAccessToken) {
827
- pageAccessOrgsOptions.push({label: data[obj] === -1 ? orgName : obj, value: data[obj]});
841
+ pageAccessOrgsOptions.push({label: obj, value: data[obj]});
828
842
  }
829
843
  });
830
- if (!pageId) {
844
+ if (orgUnitFacebookPageSettingsMap[-1]) {
845
+ pageAccessOrgsOptions.push({label: orgName, value: -1});
846
+ }
847
+ if (!pageId && !isEmpty(data)) {
831
848
  setPageId((pageAccessOrgsOptions[0] || {} ).value);
849
+ } else if (orgUnitFacebookPageSettingsMap[-1] && !pageId) {
850
+ setPageId(-1);
832
851
  }
833
852
  }
834
853
  return pageAccessOrgsOptions;
@@ -16,6 +16,7 @@ import {
16
16
  CapCustomCard,
17
17
  CapIcon,
18
18
  CapRadioGroup,
19
+ CapTooltip,
19
20
  } from '@capillarytech/cap-ui-library';
20
21
  import Templates from '../Templates';
21
22
  import { createStructuredSelector } from 'reselect';
@@ -195,6 +196,8 @@ const Facebook = (props) => {
195
196
  createNew,
196
197
  fbAdManger,
197
198
  getFormSubscriptionData,
199
+ showDisableInfoForFacebook,
200
+ orgUnitId,
198
201
  } = props;
199
202
  const {
200
203
  selectedMarketingObjective: fbMarketingObjectiveValue = VALUE_REACH,
@@ -241,7 +244,7 @@ const Facebook = (props) => {
241
244
  const onMarketingObjectiveSelect = (value) => setMarketingObjective(value);
242
245
 
243
246
  const radioOptions = [{
244
- label: intl.formatMessage(messages.capFbAdManager), value: CREATIVE,
247
+ label: showDisableInfoForFacebook ? <CapTooltip title={intl.formatMessage(messages.facebookDisableinfo)}>{intl.formatMessage(messages.capFbAdManager)}</CapTooltip> : intl.formatMessage(messages.capFbAdManager), value: CREATIVE, disabled: showDisableInfoForFacebook,
245
248
  }, {
246
249
  label: intl.formatMessage(messages.fbAdManager), value: AD_MANAGER,
247
250
  }];
@@ -419,6 +422,7 @@ const Facebook = (props) => {
419
422
  getFormSubscriptionData={getFormSubscriptionData}
420
423
  selectedMarketingObjective={selectedMarketingObjective}
421
424
  fbAdManger={fbAdManger}
425
+ orgUnitId={orgUnitId}
422
426
  />
423
427
  </div>
424
428
  );
@@ -172,12 +172,16 @@ export default defineMessages({
172
172
  id: `${messagePrefix}.fbAdManager`,
173
173
  defaultMessage: 'Facebook ad manager',
174
174
  },
175
- adManagerHeading:{
175
+ adManagerHeading: {
176
176
  id: `${messagePrefix}.adManagerHeading`,
177
- defaultMessage: "Where do you want to create your Facebook ad creative?"
177
+ defaultMessage: "Where do you want to create your Facebook ad creative?",
178
178
  },
179
- capAdManagerHeading:{
179
+ capAdManagerHeading: {
180
180
  id: `${messagePrefix}.capAdManagerHeading`,
181
- defaultMessage: "You can create Facebook ads creative in Engage+ Facebook ad Manager."
182
- }
181
+ defaultMessage: "You can create Facebook ads creative in Engage+ Facebook ad Manager.",
182
+ },
183
+ facebookDisableinfo: {
184
+ id: `${messagePrefix}.facebookDisableinfo`,
185
+ defaultMessage: 'Please integrate Facebook Ad page ID & username to enable this option.',
186
+ },
183
187
  });
@@ -76,7 +76,7 @@ export function* uploadFbAdAsset(file, assetType, fileParams) {
76
76
  }
77
77
  if (result.status.isError) {
78
78
  yield put({ type: UPLOAD_FB_AD_ASSET_FAILURE, error: result.status.message });
79
- } else if (videoIdResponse.status.isError) {
79
+ } else if (videoIdResponse.status?.isError) {
80
80
  yield put({ type: UPLOAD_FB_AD_ASSET_FAILURE, error: result.status });
81
81
  } else {
82
82
  yield put({
@@ -7,7 +7,7 @@
7
7
  import * as types from './constants';
8
8
 
9
9
  export function changeLocale(languageLocale) {
10
- console.log('trying to change locale', languageLocale);
10
+
11
11
  return {
12
12
  type: types.CHANGE_LOCALE,
13
13
  locale: languageLocale,
@@ -7,7 +7,7 @@
7
7
  import * as types from './constants';
8
8
 
9
9
  export function createTemplate(template, callback) {
10
- console.log('action trigereed createtemplate');
10
+
11
11
  return {
12
12
  type: types.CREATE_TEMPLATE_REQUEST,
13
13
  template,
@@ -16,7 +16,7 @@ export function createTemplate(template, callback) {
16
16
  }
17
17
 
18
18
  export function clearCreateResponse() {
19
- console.log('clearCreateResponse');
19
+
20
20
  return {
21
21
  type: types.CLEAR_CREATE_RESPONSE_REQUEST,
22
22
  };
@@ -50,7 +50,7 @@ export function clearAsset(templateType) {
50
50
 
51
51
 
52
52
  export function editTemplate(template, callback) {
53
- console.log('action trigereed editTemplate line @@@');
53
+
54
54
  return {
55
55
  type: types.EDIT_TEMPLATE_REQUEST,
56
56
  template,
@@ -59,7 +59,7 @@ export function editTemplate(template, callback) {
59
59
  }
60
60
 
61
61
  export function getTemplateDetails(id, callback) {
62
- console.log('getting template line @@@', id);
62
+
63
63
  return {
64
64
  type: types.GET_TEMPLATE_DETAILS_REQUEST,
65
65
  id,
@@ -69,7 +69,7 @@ export function getTemplateDetails(id, callback) {
69
69
  }
70
70
 
71
71
  export function clearEditResponse() {
72
- console.log('clearEditResponse');
72
+
73
73
  return {
74
74
  type: types.CLEAR_EDIT_RESPONSE_REQUEST,
75
75
  };