@capillarytech/creatives-library 7.6.1 → 7.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/DeviceForEmail.png +0 -0
- package/components/CapTagList/index.js +5 -5
- package/components/Card/index.js +1 -1
- package/components/Ckeditor/index.js +5 -5
- package/components/CustomPopOver/index.js +3 -3
- package/components/Edmeditor/index.js +4 -4
- package/components/EmailPreview/index.js +1 -1
- package/components/PreviewSideBar/index.js +3 -3
- package/components/Sidebar/index.js +1 -1
- package/components/SmsTest/index.js +4 -4
- package/components/TemplatePreview/index.js +2 -2
- package/components/Toastr/index.js +1 -1
- package/config/app.js +2 -0
- package/containers/Assets/Gallery/index.js +2 -2
- package/containers/Assets/Gallery/sagas.js +1 -1
- package/containers/Cap/actions.js +2 -2
- package/containers/Cap/reducer.js +1 -1
- package/containers/Cap/sagas.js +3 -3
- package/containers/Cap/selectors.js +1 -1
- package/containers/Ebill/actions.js +1 -1
- package/containers/Ebill/index.js +34 -34
- package/containers/Ebill/sagas.js +3 -3
- package/containers/Email/actions.js +2 -2
- package/containers/Email/index.js +171 -171
- package/containers/Email/reducer.js +1 -1
- package/containers/Email/sagas.js +6 -6
- package/containers/LanguageProvider/actions.js +1 -1
- package/containers/Line/Create/actions.js +5 -5
- package/containers/Line/Create/index.js +37 -37
- package/containers/Line/Create/sagas.js +7 -7
- package/containers/Line/Edit/actions.js +3 -3
- package/containers/Line/Edit/index.js +24 -24
- package/containers/Line/Edit/sagas.js +4 -4
- package/containers/MobilePush/Create/actions.js +2 -2
- package/containers/MobilePush/Create/index.js +35 -35
- package/containers/MobilePush/Create/sagas.js +2 -2
- package/containers/MobilePush/Edit/actions.js +3 -3
- package/containers/MobilePush/Edit/index.js +32 -32
- package/containers/MobilePush/Edit/sagas.js +5 -5
- package/containers/Sms/Create/actions.js +2 -2
- package/containers/Sms/Create/index.js +57 -57
- package/containers/Sms/Create/sagas.js +2 -2
- package/containers/Sms/Edit/actions.js +3 -3
- package/containers/Sms/Edit/index.js +44 -44
- package/containers/Sms/Edit/sagas.js +3 -3
- package/containers/TagList/index.js +9 -9
- package/containers/Templates/actions.js +5 -5
- package/containers/Templates/index.js +44 -44
- package/containers/Templates/sagas.js +5 -5
- package/containers/WeChat/MapTemplates/actions.js +1 -1
- package/containers/WeChat/MapTemplates/index.js +34 -34
- package/containers/WeChat/MapTemplates/sagas.js +2 -2
- package/containers/WeChat/RichmediaTemplates/Create/index.js +9 -9
- package/containers/WeChat/RichmediaTemplates/Edit/actions.js +1 -1
- package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +1 -1
- package/index.js +6 -0
- package/package.json +1 -1
- package/reducers.js +2 -1
- package/routes.js +5 -0
- package/services/api.js +43 -14
- package/utils/authWrapper.js +2 -2
- package/utils/common.js +13 -1
- package/utils/smsCharCount.js +5 -5
- package/v2Components/CapTagList/index.js +1 -1
- package/v2Components/CapVideoUpload/index.js +14 -6
- package/v2Components/Card/index.js +1 -1
- package/v2Components/Ckeditor/index.js +5 -5
- package/v2Components/CustomPopOver/index.js +3 -3
- package/v2Components/Edmeditor/index.js +4 -4
- package/v2Components/EmailMobilePreview/index.js +4 -4
- package/v2Components/EmailPreviewV2/index.js +4 -4
- package/v2Components/FormBuilder/index.js +3 -3
- package/v2Components/PreviewSideBar/index.js +3 -3
- package/v2Components/SmsTest/index.js +4 -4
- package/v2Components/TemplatePreview/index.js +24 -3
- package/v2Components/Toastr/index.js +1 -1
- package/v2Containers/App/constants.js +21 -0
- package/v2Containers/Assets/Gallery/sagas.js +1 -1
- package/v2Containers/Cap/actions.js +1 -1
- package/v2Containers/Cap/index.js +2 -2
- package/v2Containers/Cap/messages.js +30 -0
- package/v2Containers/Cap/reducer.js +1 -1
- package/v2Containers/Cap/sagas.js +3 -3
- package/v2Containers/Cap/selectors.js +1 -1
- package/v2Containers/CapFacebookPreview/actions.js +3 -15
- package/v2Containers/CapFacebookPreview/constants.js +3 -11
- package/v2Containers/CapFacebookPreview/index.js +6 -6
- package/v2Containers/CapFacebookPreview/reducer.js +3 -9
- package/v2Containers/CapFacebookPreview/sagas.js +6 -65
- package/v2Containers/CreativesContainer/SlideBoxContent.js +64 -1
- package/v2Containers/CreativesContainer/index.js +19 -8
- package/v2Containers/Ebill/actions.js +1 -1
- package/v2Containers/Ebill/index.js +34 -34
- package/v2Containers/Ebill/sagas.js +3 -3
- package/v2Containers/Email/reducer.js +1 -1
- package/v2Containers/EmailWrapper/index.js +4 -4
- package/v2Containers/Facebook/Advertisement/index.js +38 -15
- package/v2Containers/Facebook/Advertisement/index.scss +9 -0
- package/v2Containers/Facebook/Advertisement/messages.js +2 -2
- package/v2Containers/Facebook/actions.js +63 -0
- package/v2Containers/Facebook/constants.js +25 -1
- package/v2Containers/Facebook/index.js +135 -107
- package/v2Containers/Facebook/reducer.js +98 -1
- package/v2Containers/Facebook/sagas.js +147 -0
- package/v2Containers/Facebook/selectors.js +10 -0
- package/v2Containers/LanguageProvider/actions.js +1 -1
- package/v2Containers/Line/Container/Video/index.js +38 -41
- package/v2Containers/Line/Container/actions.js +5 -5
- package/v2Containers/Line/Container/sagas.js +4 -4
- package/v2Containers/MobilePush/Create/actions.js +2 -2
- package/v2Containers/MobilePush/Create/index.js +1 -1
- package/v2Containers/MobilePush/Create/sagas.js +2 -2
- package/v2Containers/MobilePush/Edit/actions.js +3 -3
- package/v2Containers/MobilePush/Edit/index.js +26 -26
- package/v2Containers/MobilePush/Edit/sagas.js +5 -5
- package/v2Containers/Sms/Create/index.js +4 -4
- package/v2Containers/TagList/index.js +6 -6
- package/v2Containers/Templates/_templates.scss +26 -0
- package/v2Containers/Templates/actions.js +18 -5
- package/v2Containers/Templates/constants.js +8 -0
- package/v2Containers/Templates/index.js +139 -11
- package/v2Containers/Templates/messages.js +8 -4
- package/v2Containers/Templates/reducer.js +22 -0
- package/v2Containers/Templates/sagas.js +30 -5
- package/v2Containers/TemplatesV2/index.js +13 -13
- package/v2Containers/Viber/actions.js +2 -2
- package/v2Containers/Viber/index.js +2 -1
- package/v2Containers/Viber/sagas.js +2 -2
- package/v2Containers/WeChat/MapTemplates/actions.js +1 -1
- package/v2Containers/WeChat/MapTemplates/index.js +19 -19
- package/v2Containers/WeChat/MapTemplates/sagas.js +3 -3
- package/v2Containers/WeChat/RichmediaTemplates/Create/actions.js +1 -1
- package/v2Containers/WeChat/RichmediaTemplates/Edit/actions.js +1 -1
- package/v2Containers/WeChat/RichmediaTemplates/Edit/sagas.js +1 -1
|
@@ -51,6 +51,7 @@ class Creatives extends React.Component {
|
|
|
51
51
|
currentChannel: this.props.channel || 'sms',
|
|
52
52
|
weChatTemplateType: '',
|
|
53
53
|
weChatMaptemplateStep: 0,
|
|
54
|
+
|
|
54
55
|
};
|
|
55
56
|
this.creativesTemplateSteps = {
|
|
56
57
|
1: 'modeSelection',
|
|
@@ -104,7 +105,6 @@ class Creatives extends React.Component {
|
|
|
104
105
|
if ((currentChannel.toUpperCase() === constants.EMAIL && emailCreateMode === "upload") || currentChannel.toUpperCase() === constants.MOBILE_PUSH || currentChannel.toUpperCase() === constants.WECHAT) {
|
|
105
106
|
templateStep = prevState.templateStep + 2;
|
|
106
107
|
}
|
|
107
|
-
|
|
108
108
|
return {
|
|
109
109
|
templateStep,
|
|
110
110
|
};
|
|
@@ -114,6 +114,8 @@ class Creatives extends React.Component {
|
|
|
114
114
|
onEmailModeChange = (mode) => {
|
|
115
115
|
this.setState({ emailCreateMode: mode});
|
|
116
116
|
}
|
|
117
|
+
|
|
118
|
+
|
|
117
119
|
onMobilepushModeChange = (mode) => {
|
|
118
120
|
this.setState({ mobilePushCreateMode: mode});
|
|
119
121
|
}
|
|
@@ -479,17 +481,19 @@ class Creatives extends React.Component {
|
|
|
479
481
|
showFooter = true;
|
|
480
482
|
}
|
|
481
483
|
|
|
482
|
-
|
|
483
484
|
if (showFooter) {
|
|
484
|
-
if (slidBoxContent === "createTemplate" && ((channel === constants.EMAIL && currentStep === 'createTemplateContent') ||
|
|
485
|
+
if (slidBoxContent === "createTemplate" && ((channel === constants.EMAIL && currentStep === 'createTemplateContent') ||
|
|
486
|
+
([constants.SMS, constants.WECHAT].includes(channel) && currentStep === 'modeSelection'))) {
|
|
485
487
|
showFooter = showFooter && !this.state.isLoadingContent;
|
|
486
|
-
} else if (slidBoxContent === "editTemplate" &&
|
|
488
|
+
} else if (slidBoxContent === "editTemplate" &&
|
|
489
|
+
([constants.SMS, constants.WECHAT, constants.EMAIL].includes(channel) &&
|
|
490
|
+
currentStep === 'modeSelection')) {
|
|
487
491
|
showFooter = showFooter && !this.state.isLoadingContent;
|
|
488
492
|
}
|
|
489
493
|
}
|
|
490
494
|
|
|
491
495
|
const isLineViberChannel = templateData && [constants.LINE, constants.VIBER].includes(templateData);
|
|
492
|
-
if ([constants.LINE, constants.VIBER].includes(channel) || isLineViberChannel) {
|
|
496
|
+
if ([constants.LINE, constants.VIBER, constants.FACEBOOK].includes(channel) || isLineViberChannel) {
|
|
493
497
|
showFooter = false;
|
|
494
498
|
}
|
|
495
499
|
|
|
@@ -573,6 +577,13 @@ class Creatives extends React.Component {
|
|
|
573
577
|
}
|
|
574
578
|
return false;
|
|
575
579
|
}
|
|
580
|
+
shouldShowHeader = () => {
|
|
581
|
+
const {currentChannel} = this.state;
|
|
582
|
+
if (currentChannel === constants.FACEBOOK) {
|
|
583
|
+
return false;
|
|
584
|
+
}
|
|
585
|
+
return true;
|
|
586
|
+
}
|
|
576
587
|
render() {
|
|
577
588
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
578
589
|
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor} = this.props;
|
|
@@ -582,7 +593,7 @@ class Creatives extends React.Component {
|
|
|
582
593
|
<SlideBoxWrapper className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'} ${mapTemplateCreate ? 'map-template-create' : ''}`)}>
|
|
583
594
|
<CapSlideBox
|
|
584
595
|
header={
|
|
585
|
-
<SlideBoxHeader
|
|
596
|
+
this.shouldShowHeader() && <SlideBoxHeader
|
|
586
597
|
key="creatives-container-slidebox-header"
|
|
587
598
|
channel={currentChannel}
|
|
588
599
|
messages={this.props.messages}
|
|
@@ -599,8 +610,7 @@ class Creatives extends React.Component {
|
|
|
599
610
|
weChatTemplateType={weChatTemplateType}
|
|
600
611
|
showPrefix={!isUploading} // not show back button when email template is being uploaded
|
|
601
612
|
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
602
|
-
/>
|
|
603
|
-
}
|
|
613
|
+
/>}
|
|
604
614
|
content={
|
|
605
615
|
<SlideBoxContent
|
|
606
616
|
key="creatives-container-slidebox-content"
|
|
@@ -609,6 +619,7 @@ class Creatives extends React.Component {
|
|
|
609
619
|
onPreviewTemplate={this.onPreviewTemplate}
|
|
610
620
|
slidBoxContent={slidBoxContent}
|
|
611
621
|
templateData={templateData}
|
|
622
|
+
campaignSettings={this.props.Templates.campaignSettings}
|
|
612
623
|
location={this.props.location}
|
|
613
624
|
messageDetails={this.props.messageDetails}
|
|
614
625
|
getFormData={this.getFormData}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\\"/g, "\"");
|
|
634
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
672
|
+
|
|
673
673
|
this.setState({currentTab: data, formData});
|
|
674
674
|
};
|
|
675
675
|
|
|
676
676
|
onFormDataChange = (formData, tabCount, currentTab) => {
|
|
677
|
-
|
|
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
|
-
|
|
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
|
-
|
|
697
|
+
|
|
698
698
|
};
|
|
699
699
|
|
|
700
700
|
onTemplateContentChange = (content) => {
|
|
701
|
-
|
|
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
|
-
|
|
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
|
-
|
|
738
|
+
|
|
739
739
|
this.setState({tabCount, formData, editData: data, currentTab: 1}, () => {
|
|
740
740
|
});
|
|
741
741
|
};
|
|
742
742
|
|
|
743
743
|
getMappedEvent = (id, event) => {
|
|
744
|
-
|
|
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
|
-
//
|
|
772
|
+
//
|
|
773
773
|
// if (!isValidated) {
|
|
774
774
|
// return;
|
|
775
775
|
// }
|
|
776
|
-
|
|
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
|
-
|
|
793
|
+
|
|
794
794
|
_.forEach(obj.versions.history, (index, version) => {
|
|
795
|
-
|
|
795
|
+
|
|
796
796
|
});
|
|
797
|
-
|
|
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
|
-
|
|
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
|
-
|
|
819
|
+
|
|
820
820
|
return false;
|
|
821
821
|
};
|
|
822
822
|
|
|
823
823
|
handleOnTagsContextChange = (data) => {
|
|
824
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1111
|
+
|
|
1112
1112
|
return section;
|
|
1113
1113
|
}
|
|
1114
1114
|
|
|
1115
1115
|
cloneMultiCol(sectionObj, tabIndex) {
|
|
1116
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 });
|
|
@@ -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
|
-
|
|
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
|
|
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) &&
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
IMAGE_VIDEO,
|
|
55
55
|
NO_CALL_TO_ACTION,
|
|
56
56
|
} from './constant';
|
|
57
|
-
|
|
57
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
58
58
|
export const Advertisement = (props) => {
|
|
59
59
|
const CarouselContainer = styled.div`
|
|
60
60
|
width: ${(styledProps) => styledProps.width || '22px'};
|
|
@@ -122,11 +122,28 @@ export const Advertisement = (props) => {
|
|
|
122
122
|
type,
|
|
123
123
|
fileParams,
|
|
124
124
|
indexFile) => {
|
|
125
|
+
let videoData = {};
|
|
126
|
+
if (type === 'video') {
|
|
127
|
+
const {
|
|
128
|
+
orgUnitFacebookPageSettingsMap = {},
|
|
129
|
+
employeeAccessToken: accessToken = "",
|
|
130
|
+
accountId = "",
|
|
131
|
+
} = selectedFacebookAccount;
|
|
132
|
+
const { pageAccessToken, pageId: pId } = orgUnitFacebookPageSettingsMap[pageId] || {};
|
|
133
|
+
videoData = {
|
|
134
|
+
accessToken,
|
|
135
|
+
actId: accountId,
|
|
136
|
+
pageAccessToken,
|
|
137
|
+
pageId: pId,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
125
140
|
actions.uploadFbAdAsset(file,
|
|
126
141
|
type,
|
|
127
142
|
fileParams,
|
|
128
|
-
indexFile
|
|
129
|
-
|
|
143
|
+
indexFile,
|
|
144
|
+
videoData,
|
|
145
|
+
);
|
|
146
|
+
}, [pageId]);
|
|
130
147
|
|
|
131
148
|
const paramObj = params || {};
|
|
132
149
|
|
|
@@ -142,7 +159,7 @@ export const Advertisement = (props) => {
|
|
|
142
159
|
|
|
143
160
|
useEffect(() => {
|
|
144
161
|
if ((params && params.id) || (templateData || {}).edit) {
|
|
145
|
-
const { FacebookAd = [],
|
|
162
|
+
const { FacebookAd = [], pageOrgUnitId: editPageId} = get(templateData, `versions.base.content`) || get(fbADData, `templateDetails.versions.base.content`) || {};
|
|
146
163
|
const editMessageTitle = (templateData || {}).name || get(fbADData, 'templateDetails.name');
|
|
147
164
|
const editFBContent = Object.values(FacebookAd);
|
|
148
165
|
if (editPageId) {
|
|
@@ -182,6 +199,7 @@ export const Advertisement = (props) => {
|
|
|
182
199
|
videoName,
|
|
183
200
|
videoHeight,
|
|
184
201
|
videoWidth,
|
|
202
|
+
videoId,
|
|
185
203
|
} = obj.video;
|
|
186
204
|
data.videoData = {
|
|
187
205
|
videoSrc,
|
|
@@ -189,6 +207,7 @@ export const Advertisement = (props) => {
|
|
|
189
207
|
videoHeight,
|
|
190
208
|
videoWidth,
|
|
191
209
|
previewUrl,
|
|
210
|
+
videoId,
|
|
192
211
|
};
|
|
193
212
|
}
|
|
194
213
|
newCarouselData[index] = {...defaultCarouselContent, ...data};
|
|
@@ -248,14 +267,16 @@ export const Advertisement = (props) => {
|
|
|
248
267
|
}, [selectedAd]);
|
|
249
268
|
|
|
250
269
|
const updateOnImageReUpload = useCallback(() => {
|
|
251
|
-
const newCarouselData =
|
|
270
|
+
const newCarouselData = cloneDeep(carouselData);
|
|
252
271
|
newCarouselData[activeIndex].imageData.imageSrc = '';
|
|
253
272
|
updateCarouselData(newCarouselData);
|
|
254
273
|
}, [carouselData, activeIndex]);
|
|
255
274
|
|
|
256
275
|
const setUpdateImageSrc = useCallback((val) => {
|
|
257
|
-
const newCarouselData =
|
|
258
|
-
newCarouselData[activeIndex].imageData
|
|
276
|
+
const newCarouselData = cloneDeep(carouselData);
|
|
277
|
+
newCarouselData[activeIndex].imageData = {
|
|
278
|
+
imageSrc: val,
|
|
279
|
+
};
|
|
259
280
|
updateCarouselData(newCarouselData);
|
|
260
281
|
actions.clearFbAdAsset(activeIndex);
|
|
261
282
|
}, [carouselData, activeIndex]);
|
|
@@ -314,6 +335,7 @@ export const Advertisement = (props) => {
|
|
|
314
335
|
videoHeight,
|
|
315
336
|
videoWidth,
|
|
316
337
|
previewUrl,
|
|
338
|
+
videoId,
|
|
317
339
|
} = obj.videoData;
|
|
318
340
|
data.video = {
|
|
319
341
|
previewImageUrl: previewUrl,
|
|
@@ -322,6 +344,7 @@ export const Advertisement = (props) => {
|
|
|
322
344
|
baseUrl: previewUrl.replace('/1040', ''),
|
|
323
345
|
videoHeight,
|
|
324
346
|
videoWidth,
|
|
347
|
+
videoId,
|
|
325
348
|
};
|
|
326
349
|
}
|
|
327
350
|
messageData.push(data);
|
|
@@ -332,7 +355,7 @@ export const Advertisement = (props) => {
|
|
|
332
355
|
base: {
|
|
333
356
|
content: {
|
|
334
357
|
FacebookAd: {...messageData},
|
|
335
|
-
pageId,
|
|
358
|
+
pageOrgUnitId: pageId,
|
|
336
359
|
},
|
|
337
360
|
},
|
|
338
361
|
},
|
|
@@ -780,7 +803,7 @@ export const Advertisement = (props) => {
|
|
|
780
803
|
}, [pageId]);
|
|
781
804
|
|
|
782
805
|
const selectedFacebookAccount = get(facebookTemplateData, 'selectedFacebookAccount', {});
|
|
783
|
-
const {orgUnitFacebookPageSettingsMap = {}, accessToken = "", accountId = "" } = selectedFacebookAccount;
|
|
806
|
+
const {orgUnitFacebookPageSettingsMap = {}, employeeAccessToken: accessToken = "", accountId = "" } = selectedFacebookAccount;
|
|
784
807
|
|
|
785
808
|
const getPageAccessOrgs = useCallback(() => {
|
|
786
809
|
const {status, data } = fbADData.orgOuData || {};
|
|
@@ -865,17 +888,17 @@ export const Advertisement = (props) => {
|
|
|
865
888
|
>
|
|
866
889
|
{editNameState ? <CapInput
|
|
867
890
|
type="input"
|
|
868
|
-
|
|
891
|
+
className="cap-input-edit-name"
|
|
869
892
|
onBlur={onEditFocusOut}
|
|
870
893
|
defaultValue={messageTitle || ''}
|
|
871
894
|
/> : messageTitle
|
|
872
895
|
}
|
|
873
|
-
{!editNameState && <CapLink
|
|
874
|
-
style={{display: "inline-flex"}}
|
|
875
|
-
title={<FormattedMessage {...messages.creativesTemplatesEditName}/>}
|
|
876
|
-
onClick={onClickEditName}
|
|
877
|
-
/>}
|
|
878
896
|
</CapHeading>
|
|
897
|
+
{!editNameState && <CapLink
|
|
898
|
+
className="cap-link-edit-name"
|
|
899
|
+
title={<FormattedMessage {...messages.creativesTemplatesEditName}/>}
|
|
900
|
+
onClick={onClickEditName}
|
|
901
|
+
/>}
|
|
879
902
|
</div>
|
|
880
903
|
<CapColumn span={12}>
|
|
881
904
|
{isFullMode && <><CapHeading
|
|
@@ -18,7 +18,16 @@ $classPrefix: add-facebook-ad-section;
|
|
|
18
18
|
white-space: nowrap;
|
|
19
19
|
min-width: 112px;
|
|
20
20
|
max-width: 920px;
|
|
21
|
+
display: inline-block;
|
|
21
22
|
}
|
|
23
|
+
.cap-input-edit-name{
|
|
24
|
+
width: 500px;
|
|
25
|
+
}
|
|
26
|
+
.cap-link-edit-name{
|
|
27
|
+
display: inline-block;
|
|
28
|
+
margin-bottom: 4px;
|
|
29
|
+
}
|
|
30
|
+
|
|
22
31
|
.cap-header-facebook-ad{
|
|
23
32
|
position: fixed;
|
|
24
33
|
top: 27px;
|
|
@@ -17,7 +17,7 @@ export default defineMessages({
|
|
|
17
17
|
},
|
|
18
18
|
imageVideoDesc: {
|
|
19
19
|
id: `${messagePrefix}.imageVideoDesc`,
|
|
20
|
-
defaultMessage: 'Create an Ad with one image or video
|
|
20
|
+
defaultMessage: 'Create an Ad with one image or video',
|
|
21
21
|
},
|
|
22
22
|
carouselTitle: {
|
|
23
23
|
id: `${messagePrefix}.carouselTitle`,
|
|
@@ -93,7 +93,7 @@ export default defineMessages({
|
|
|
93
93
|
},
|
|
94
94
|
video_slideshow: {
|
|
95
95
|
id: `${messagePrefix}.video_slideshow`,
|
|
96
|
-
defaultMessage: 'Video
|
|
96
|
+
defaultMessage: 'Video',
|
|
97
97
|
},
|
|
98
98
|
doneButtonLabel: {
|
|
99
99
|
id: `${messagePrefix}.doneButtonLabel`,
|
|
@@ -6,8 +6,71 @@
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
GET_MARKETING_OBJECTIVES,
|
|
9
|
+
UPLOAD_FB_AD_ASSET_REQUEST,
|
|
10
|
+
CREATE_FACEBOOK_AD_TEMPLATE_REQUEST,
|
|
11
|
+
EDIT_FACEBOOK_AD_TEMPLATE_REQUEST,
|
|
12
|
+
GET_FACEBOOK_AD_TEMPLATE_DETAILS_REQUEST,
|
|
13
|
+
CLEAR_FACEBOOK_AD_ASSET,
|
|
14
|
+
CLEAR_FACEBOOK_AD_CREATE_RESPONSE_REQUEST,
|
|
15
|
+
CLEAR_FACEBOOK_AD_DATA,
|
|
16
|
+
CLEAR_FACEBOOK_AD_EDIT_RESPONSE_REQUEST,
|
|
17
|
+
GET_ORG_OU_LIST_REQUEST,
|
|
9
18
|
} from './constants';
|
|
10
19
|
|
|
11
20
|
export const getMarketingObjectives = () => ({
|
|
12
21
|
type: GET_MARKETING_OBJECTIVES,
|
|
13
22
|
});
|
|
23
|
+
|
|
24
|
+
export const uploadFbAdAsset = (file, assetType, fileParams, templateType, videoData) => ({
|
|
25
|
+
type: UPLOAD_FB_AD_ASSET_REQUEST,
|
|
26
|
+
file,
|
|
27
|
+
assetType,
|
|
28
|
+
fileParams,
|
|
29
|
+
templateType,
|
|
30
|
+
videoData,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const createTemplate = (template, callback) => ({
|
|
34
|
+
type: CREATE_FACEBOOK_AD_TEMPLATE_REQUEST,
|
|
35
|
+
template,
|
|
36
|
+
callback,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const getOrgOUs = (orgID) => ({
|
|
40
|
+
type: GET_ORG_OU_LIST_REQUEST,
|
|
41
|
+
orgID,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// FOR EDIT
|
|
45
|
+
|
|
46
|
+
export const editTemplate = (template, callback) => ({
|
|
47
|
+
type: EDIT_FACEBOOK_AD_TEMPLATE_REQUEST,
|
|
48
|
+
template,
|
|
49
|
+
callback,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const getTemplateDetails = (id, callback) => ({
|
|
53
|
+
type: GET_FACEBOOK_AD_TEMPLATE_DETAILS_REQUEST,
|
|
54
|
+
id,
|
|
55
|
+
channel: 'FACEBOOK',
|
|
56
|
+
callback,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export const clearData = () => ({
|
|
60
|
+
type: CLEAR_FACEBOOK_AD_DATA,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export const clearEditResponse = () => ({
|
|
64
|
+
type: CLEAR_FACEBOOK_AD_EDIT_RESPONSE_REQUEST,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
export const clearCreateResponse = () => ({
|
|
69
|
+
type: CLEAR_FACEBOOK_AD_CREATE_RESPONSE_REQUEST,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export const clearFbAdAsset = (templateType) => ({
|
|
73
|
+
type: CLEAR_FACEBOOK_AD_ASSET,
|
|
74
|
+
templateType,
|
|
75
|
+
});
|
|
76
|
+
|