@capillarytech/creatives-library 0.0.3 → 0.0.5
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/components/CardGrid/index.js +2 -2
- package/components/Ckeditor/index.js +20 -17
- package/components/CustomPopOver/index.js +4 -1
- package/components/FormBuilder/index.js +117 -44
- package/components/Toastr/index.js +1 -1
- package/containers/Cap/sagas.js +14 -1
- package/containers/Ebill/reducer.js +4 -1
- package/containers/Ebill/selectors.js +1 -1
- package/containers/Email/index.js +573 -158
- package/containers/Email/messages.js +12 -0
- package/containers/Email/reducer.js +4 -1
- package/containers/Email/selectors.js +7 -1
- package/containers/Templates/actions.js +7 -0
- package/containers/Templates/constants.js +1 -1
- package/containers/Templates/index.js +42 -45
- package/containers/Templates/messages.js +1 -1
- package/containers/Templates/reducer.js +5 -2
- package/initialState.js +6 -0
- package/package.json +1 -1
- package/reducers.js +4 -0
- package/routes.js +22 -0
- package/translations/en.json +17 -1
- package/translations/zh.json +16 -0
|
@@ -605,6 +605,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
605
605
|
saveObj: {},
|
|
606
606
|
showEdmEmailTemplates: false,
|
|
607
607
|
editDataSet: false,
|
|
608
|
+
languageDataSet: false,
|
|
609
|
+
addLanguageType: '',
|
|
608
610
|
};
|
|
609
611
|
|
|
610
612
|
this.isTagLoaded = false;
|
|
@@ -698,7 +700,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
698
700
|
formData['template-version'] = "version 1";
|
|
699
701
|
}
|
|
700
702
|
// const formData = _.cloneDeep(this.state.formData);
|
|
701
|
-
if (this.props.params.id || (this.props.location.query.module === "
|
|
703
|
+
if (this.props.params.id || (this.props.location.query.module === "library" && this.props.templateData && !_.isEmpty(this.props.templateData))) {
|
|
702
704
|
this.setState({isEdit: true}, () => {
|
|
703
705
|
if (this.props.params.id) {
|
|
704
706
|
this.props.actions.getTemplateDetails(this.props.params.id, 'email');
|
|
@@ -724,25 +726,18 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
724
726
|
|
|
725
727
|
// setTimeout(() => {
|
|
726
728
|
// // this.getFormData();
|
|
727
|
-
//
|
|
729
|
+
// this.startTemplateCreation();
|
|
728
730
|
// }, 15000);
|
|
729
731
|
}
|
|
730
732
|
|
|
731
733
|
componentDidMount() {
|
|
732
734
|
console.log('email container mounted');
|
|
733
|
-
const type = this.props.location.query.type;
|
|
734
735
|
const query = {
|
|
735
736
|
layout: 'EMAIL',
|
|
736
737
|
type: 'LAYOUT',
|
|
737
738
|
};
|
|
738
739
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
739
740
|
window.addEventListener("message", this.handleFrameTasks);
|
|
740
|
-
if (type === 'embedded') {
|
|
741
|
-
const response = {
|
|
742
|
-
action: 'startTemplateCreation',
|
|
743
|
-
};
|
|
744
|
-
parent.postMessage(JSON.stringify(response), '*');
|
|
745
|
-
}
|
|
746
741
|
if (this.props.location.query.type === 'embedded') {
|
|
747
742
|
this.showNext();
|
|
748
743
|
}
|
|
@@ -754,13 +749,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
754
749
|
// this.showNext();
|
|
755
750
|
// }
|
|
756
751
|
|
|
757
|
-
if (nextProps.Templates.selectedEmailLayout && nextProps.Templates.selectedEmailLayout !== '' && !_.isEqual(this.props.Templates.selectedEmailLayout, nextProps.Templates.selectedEmailLayout )) {
|
|
752
|
+
if (this.state.languageDataSet && nextProps.Templates.selectedEmailLayout && nextProps.Templates.selectedEmailLayout !== '' && !_.isEqual(this.props.Templates.selectedEmailLayout, nextProps.Templates.selectedEmailLayout )) {
|
|
758
753
|
console.log('setting new language content props', nextProps.Templates.selectedEmailLayout);
|
|
759
754
|
this.setNewLanguageContent(nextProps.Templates.selectedEmailLayout);
|
|
760
755
|
}
|
|
761
756
|
if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.schema)) {
|
|
762
|
-
this.injectEvents(nextProps.metaEntities.layouts[0].definition);
|
|
763
|
-
console.log('
|
|
757
|
+
const newSchema = this.injectEvents(nextProps.metaEntities.layouts[0].definition);
|
|
758
|
+
console.log('Schema test 1 ', newSchema);
|
|
759
|
+
this.setState({schema: newSchema});
|
|
764
760
|
const query = {
|
|
765
761
|
layout: 'EMAIL',
|
|
766
762
|
type: 'TAG',
|
|
@@ -768,11 +764,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
768
764
|
embedded: this.props.location.query.type === 'embedded' ? this.props.location.query.type : 'full',
|
|
769
765
|
};
|
|
770
766
|
setTimeout(() => {
|
|
771
|
-
this.
|
|
767
|
+
this.showSubject();
|
|
772
768
|
}, 0);
|
|
773
769
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
774
770
|
}
|
|
775
|
-
if (nextProps.location.query.module === '
|
|
771
|
+
if (nextProps.location.query.module === 'libary' && nextProps.isGetFormData) {
|
|
776
772
|
nextProps.getFormSubscriptionData(this.getFormData());
|
|
777
773
|
}
|
|
778
774
|
if (nextProps.Global.currentOrgDetails && nextProps.Global.currentOrgDetails.basic_details && !_.isEmpty(nextProps.Global.currentOrgDetails.basic_details) && _.isEmpty(this.state.formData)) {
|
|
@@ -791,7 +787,13 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
791
787
|
];
|
|
792
788
|
// console.log('New Form Data Preparing ', this.initFormData());
|
|
793
789
|
formData['template-version'] = "version 1";
|
|
794
|
-
this
|
|
790
|
+
//const that = this;
|
|
791
|
+
this.setState({formData}, () => {
|
|
792
|
+
// setTimeout(() => {
|
|
793
|
+
// // this.getFormData();
|
|
794
|
+
// that.startTemplateCreation();
|
|
795
|
+
// }, 15000);
|
|
796
|
+
});
|
|
795
797
|
} else if (nextProps.Global.currentOrgDetails && nextProps.Global.currentOrgDetails.basic_details) {
|
|
796
798
|
// this.injectEvents(this.state.schema);
|
|
797
799
|
const baseLanguage = nextProps.Global.currentOrgDetails.basic_details.base_language;
|
|
@@ -805,6 +807,20 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
805
807
|
this.setState({formData});
|
|
806
808
|
}
|
|
807
809
|
|
|
810
|
+
if (!_.isEmpty(this.state.schema)) {
|
|
811
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
812
|
+
console.log('Schema test 2', schema);
|
|
813
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
814
|
+
const container = schema.containers[0];
|
|
815
|
+
// const baseLanguage = this.props.Global.currentOrgDetails.basic_details.base_language;
|
|
816
|
+
if (baseLanguage === formData[0].activeTab) {
|
|
817
|
+
container.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: "none"};
|
|
818
|
+
} else {
|
|
819
|
+
container.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: ""};
|
|
820
|
+
}
|
|
821
|
+
this.setState({schema});
|
|
822
|
+
}
|
|
823
|
+
|
|
808
824
|
// console.log('isTagLoaded', this.isTagLoaded);
|
|
809
825
|
// if (!this.isTagLoaded) {
|
|
810
826
|
// this.isTagLoaded = true;
|
|
@@ -823,8 +839,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
823
839
|
this.setEditData(nextProps.Email.templateDetails);
|
|
824
840
|
});
|
|
825
841
|
}
|
|
826
|
-
if (this.state.isEdit && nextProps.location.query.module === "
|
|
827
|
-
this.startTemplateCreation(nextProps.
|
|
842
|
+
if (this.state.isEdit && nextProps.location.query.module === "library" && !_.isEmpty(nextProps.templateData) && !this.props.params.id) {
|
|
843
|
+
this.startTemplateCreation(nextProps.templateData);
|
|
828
844
|
}
|
|
829
845
|
|
|
830
846
|
if (!_.isEmpty(nextProps.Email.CmsSettings) && !_.isEqual(this.props.Email.CmsSettings, nextProps.Email.CmsSettings)) {
|
|
@@ -861,6 +877,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
861
877
|
tempPane.sections[0].inputFields[0].cols[0].colStyle = {display: "none"};
|
|
862
878
|
}
|
|
863
879
|
});
|
|
880
|
+
console.log('Schema test 3', schema);
|
|
864
881
|
this.setState({schema, isSchemaChanged: true});
|
|
865
882
|
} else {
|
|
866
883
|
_.forEach(temp.panes, (pane, index) => {
|
|
@@ -870,12 +887,27 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
870
887
|
tempPane.sections[0].inputFields[0].cols[0].colStyle = {display: ""};
|
|
871
888
|
}
|
|
872
889
|
});
|
|
890
|
+
console.log('Schema test 4', schema);
|
|
873
891
|
this.setState({schema, isSchemaChanged: true});
|
|
874
892
|
let html = decodeURIComponent(nextProps.Email.CmsSettings.htmlContent);
|
|
875
893
|
console.log('Before ', html, nextProps.Email.CmsSettings.htmlContent);
|
|
876
894
|
html = html.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\\"/g, '"');
|
|
877
895
|
console.log('html content ', html);
|
|
878
896
|
formData[this.state.currentTab - 1][langId]["template-content"] = html;
|
|
897
|
+
if (window.CKEDITOR) {
|
|
898
|
+
const instanceName = `template-content${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`;
|
|
899
|
+
console.log('email switch data name', instanceName);
|
|
900
|
+
_.forEach(window.CKEDITOR.instances, (winInstance) => {
|
|
901
|
+
const tempInstance = winInstance;
|
|
902
|
+
console.log('email switch data instance', winInstance, winInstance.name);
|
|
903
|
+
if (winInstance.name === instanceName) {
|
|
904
|
+
console.log('setting instance name after loading', winInstance, name);
|
|
905
|
+
tempInstance.setData(html);
|
|
906
|
+
} else if (winInstance.name.indexOf('editor') !== -1) {
|
|
907
|
+
tempInstance.setData(html);
|
|
908
|
+
}
|
|
909
|
+
});
|
|
910
|
+
}
|
|
879
911
|
}
|
|
880
912
|
|
|
881
913
|
this.setState({ formData }, () => {
|
|
@@ -895,13 +927,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
895
927
|
this.props.actions.clearCRUDResponse();
|
|
896
928
|
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
897
929
|
const type = this.props.location.query.type;
|
|
930
|
+
const isLanguageSupport = this.props.location.query.isLanguageSupport || false;
|
|
898
931
|
this.props.router.push({
|
|
899
932
|
pathname: `/email`,
|
|
900
|
-
query: type === 'embedded' ? {type: 'embedded', module} : {module},
|
|
933
|
+
query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport} : {module, isLanguageSupport},
|
|
901
934
|
});
|
|
902
935
|
}
|
|
903
936
|
if (nextProps.Email.createTemplateError && !_.isEqual(nextProps.Email.createTemplateError, this.props.Email.createTemplateError)) {
|
|
904
|
-
const message = getMessageObject('error', this.props.intl.formatMessage(messages.somethingWentWrong), true);
|
|
937
|
+
const message = getMessageObject('error', (nextProps.Email.createTemplateErrorMessage && nextProps.Email.createTemplateErrorMessage !== '') ? nextProps.Email.createTemplateErrorMessage : this.props.intl.formatMessage(messages.somethingWentWrong), true);
|
|
905
938
|
this.props.globalActions.addMessageToQueue(message);
|
|
906
939
|
}
|
|
907
940
|
if (!nextProps.Email.fetchingCmsData && !_.isEqual(nextProps.Email.cmsData, this.props.Email.cmsData)) {
|
|
@@ -914,6 +947,19 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
914
947
|
}
|
|
915
948
|
} else {
|
|
916
949
|
console.log('email switch data ', this.state.currentTab, formData, formData[`${this.state.currentTab - 1}`].activeTab);
|
|
950
|
+
const langIndex = formData[this.state.currentTab - 1].selectedLanguages.indexOf(formData[this.state.currentTab - 1].activeTab);
|
|
951
|
+
const instanceName = `template-content${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`;
|
|
952
|
+
console.log('email switch data name', instanceName);
|
|
953
|
+
_.forEach(window.CKEDITOR.instances, (winInstance) => {
|
|
954
|
+
const temp = winInstance;
|
|
955
|
+
console.log('email switch data instance', winInstance, winInstance.name);
|
|
956
|
+
if (winInstance.name === instanceName) {
|
|
957
|
+
console.log('setting instance name after loading', winInstance, name);
|
|
958
|
+
temp.setData(decodeURIComponent(nextProps.Email.cmsData));
|
|
959
|
+
} else if (winInstance.name.indexOf('editor') !== -1) {
|
|
960
|
+
temp.setData(decodeURIComponent(nextProps.Email.cmsData));
|
|
961
|
+
}
|
|
962
|
+
});
|
|
917
963
|
formData[`${this.state.currentTab - 1}`][formData[`${this.state.currentTab - 1}`].activeTab]['template-content'] = decodeURIComponent(nextProps.Email.cmsData);
|
|
918
964
|
formData[`${this.state.currentTab - 1}`][formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop = false;
|
|
919
965
|
formData[`${this.state.currentTab - 1}`][formData[`${this.state.currentTab - 1}`].activeTab].drag_drop_id = "";
|
|
@@ -951,7 +997,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
951
997
|
|
|
952
998
|
if ( !_.isEqual(nextProps.Email.uploadAssetSuccess, this.props.Email.uploadAssetSuccess) && nextProps.Email.uploadAssetSuccess) {
|
|
953
999
|
console.log('Post on will receive props');
|
|
954
|
-
|
|
1000
|
+
const isDragDrop = this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop;
|
|
1001
|
+
if (isDragDrop) {
|
|
955
1002
|
console.log('Handle EDM ', this.edmEvent, JSON.parse(this.edmEvent.data)._dynId, nextProps.Email.uploadedAssetData.metaInfo.secure_file_path);
|
|
956
1003
|
const evtData = JSON.parse(this.edmEvent.data);
|
|
957
1004
|
if (evtData.action === 'editBackground') {
|
|
@@ -977,11 +1024,16 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
977
1024
|
}
|
|
978
1025
|
this.edmEvent = undefined;
|
|
979
1026
|
} else {
|
|
980
|
-
this.state.
|
|
1027
|
+
this.resetCkEditorInstance(this.state.currentTab, this.state.formData, true, nextProps.Email.uploadedAssetData, true);
|
|
981
1028
|
}
|
|
982
1029
|
this.setState({showImageSelectionBox: false});
|
|
983
1030
|
}
|
|
984
1031
|
|
|
1032
|
+
if ( !_.isEqual(nextProps.Email.assetUploading, this.props.Email.assetUploading) && !nextProps.Email.assetUploading && !nextProps.Email.uploadAssetSuccess) {
|
|
1033
|
+
const message = getMessageObject('error', this.props.intl.formatMessage(messages.assetUploadFailed), true);
|
|
1034
|
+
this.props.globalActions.addMessageToQueue(message);
|
|
1035
|
+
}
|
|
1036
|
+
|
|
985
1037
|
if (!_.isEqual(nextProps.Global.currentOrgDetails.basic_details.supported_languages, this.props.Global.currentOrgDetails.basic_details.supported_languages)) {
|
|
986
1038
|
this.supportedLanguages = nextProps.Global.currentOrgDetails.basic_details.supported_languages;
|
|
987
1039
|
}
|
|
@@ -994,6 +1046,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
994
1046
|
|
|
995
1047
|
componentWillUnmount() {
|
|
996
1048
|
console.log('removed listener create');
|
|
1049
|
+
this.resetStateValue();
|
|
997
1050
|
window.removeEventListener("message", this.handleFrameTasks);
|
|
998
1051
|
this.props.actions.clearStoreValues();
|
|
999
1052
|
}
|
|
@@ -1005,22 +1058,35 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1005
1058
|
if (currentTab) {
|
|
1006
1059
|
this.setState({currentTab});
|
|
1007
1060
|
}
|
|
1061
|
+
//this.resetCkEditorInstance(currentTab, formData);
|
|
1008
1062
|
}
|
|
1009
1063
|
|
|
1010
|
-
onChange = (evt) => {
|
|
1011
|
-
// console.log('Dark Knight ', this.state);
|
|
1064
|
+
onChange = (evt, id) => {
|
|
1012
1065
|
const formData = _.cloneDeep(this.state.formData);
|
|
1013
|
-
console.log('onChange ');
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1066
|
+
console.log('oncontentchange onChange ', evt, evt.editor.getData());
|
|
1067
|
+
if (evt.editor.name.indexOf('editor') === -1) {
|
|
1068
|
+
_.forEach(window.CKEDITOR.instances, (winInstance) => {
|
|
1069
|
+
const temp = winInstance;
|
|
1070
|
+
if (winInstance.name === evt.editor.name) {
|
|
1071
|
+
console.log('setting instance name after loading', winInstance, name);
|
|
1072
|
+
// setTimeout(() => {
|
|
1073
|
+
// //temp.name = id;
|
|
1074
|
+
// }, 1000);
|
|
1075
|
+
temp.name = id;
|
|
1076
|
+
console.log('setting instance name after loading 2', winInstance, name);
|
|
1077
|
+
}
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
if (!formData[this.state.currentTab - 1][formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop) {
|
|
1081
|
+
formData[`${this.state.currentTab - 1}`][formData[`${this.state.currentTab - 1}`].activeTab][`template-content`] = _.cloneDeep(evt.editor.getData());
|
|
1082
|
+
if (formData[`${this.state.currentTab - 1}`].tabKey === formData.base.tabKey) {
|
|
1083
|
+
formData.base[formData[`${this.state.currentTab - 1}`].activeTab][`template-content`] = _.cloneDeep(evt.editor.getData());
|
|
1084
|
+
}
|
|
1085
|
+
console.log("Modified Form Data ", formData);
|
|
1086
|
+
this.setState({formData, content: evt.editor.getData()}, () => {
|
|
1087
|
+
console.log('Dark Knight ', this.state.content);
|
|
1088
|
+
});
|
|
1017
1089
|
}
|
|
1018
|
-
console.log("Modified Form Data ", formData);
|
|
1019
|
-
this.setState({formData, content: this.state.editorInstanse.getData()}, () => {
|
|
1020
|
-
console.log('Dark Knight ', this.state.content);
|
|
1021
|
-
});//CKEDITOR.instances.editor1
|
|
1022
|
-
console.log('onChange fired with event new', window.CKEDITOR.instances.editor1, window.CKEDITOR.instances.editor1.getData() );
|
|
1023
|
-
console.log("onChange fired with event info: ", evt, "and data: ", this.state.editorInstanse.getData(), this.state.editorInstanse);
|
|
1024
1090
|
}
|
|
1025
1091
|
|
|
1026
1092
|
onBlur = (evt) => {
|
|
@@ -1029,24 +1095,15 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1029
1095
|
|
|
1030
1096
|
onTabChange(data, formData) {
|
|
1031
1097
|
console.log('inside parent ontabchange', data, this.state);
|
|
1032
|
-
|
|
1033
|
-
const langIndex = formData[`${data - 1}`].selectedLanguages.indexOf(formData[`${data - 1}`].activeTab);
|
|
1034
|
-
let instance1 = window.CKEDITOR.instances[`editor${currentLang + 1}`];
|
|
1035
|
-
let instanceCount = 0;
|
|
1036
|
-
_.forEach(window.CKEDITOR.instances, (instance, index) => {
|
|
1037
|
-
console.log('all ck instances ', instance, index, instanceCount, langIndex);
|
|
1038
|
-
instanceCount += 1;
|
|
1039
|
-
if (instanceCount === (langIndex + 1)) {
|
|
1040
|
-
console.log('setting instance as ', instance);
|
|
1041
|
-
instance1 = instance;
|
|
1042
|
-
}
|
|
1043
|
-
});
|
|
1098
|
+
this.resetCkEditorInstance(data, formData);
|
|
1044
1099
|
const schema = _.cloneDeep(this.state.schema);
|
|
1045
1100
|
const container = schema.containers[`${data - 1}`];
|
|
1046
1101
|
if (formData[`${data - 1}`][formData[`${data - 1}`].activeTab].is_drag_drop) {
|
|
1047
1102
|
container.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[3].cols[0].style = {display: ""};
|
|
1103
|
+
container.tabBarExtraContent.sections[0].inputFields[0].cols[2].style.display = "none";
|
|
1048
1104
|
} else {
|
|
1049
1105
|
container.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[3].cols[0].style = {display: "none"};
|
|
1106
|
+
container.tabBarExtraContent.sections[0].inputFields[0].cols[2].style.display = "";
|
|
1050
1107
|
}
|
|
1051
1108
|
const baseLanguage = this.props.Global.currentOrgDetails.basic_details.base_language;
|
|
1052
1109
|
if (baseLanguage === formData[`${data - 1}`].activeTab) {
|
|
@@ -1054,7 +1111,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1054
1111
|
} else {
|
|
1055
1112
|
container.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: ""};
|
|
1056
1113
|
}
|
|
1057
|
-
this.setState({currentTab: data, formData,
|
|
1114
|
+
this.setState({currentTab: data, formData, schema});
|
|
1058
1115
|
}
|
|
1059
1116
|
|
|
1060
1117
|
onTemplateNameChange = (name) => {
|
|
@@ -1064,17 +1121,19 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1064
1121
|
onTagSelect = (data, currentTab, value) => {
|
|
1065
1122
|
console.log('On Tag selection ', data, currentTab, value);
|
|
1066
1123
|
const isDragDrop = this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop;
|
|
1124
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
1067
1125
|
if (isDragDrop) {
|
|
1068
1126
|
const msg = {
|
|
1069
1127
|
action: "InsertToCursor",
|
|
1070
1128
|
content: `{{${data}}}`,
|
|
1071
1129
|
};
|
|
1072
1130
|
const msgString = JSON.stringify(msg);
|
|
1073
|
-
|
|
1074
|
-
this.
|
|
1131
|
+
const langId = formData[this.state.currentTab - 1].activeTab;
|
|
1132
|
+
const langIndex = formData[this.state.currentTab - 1].selectedLanguages.indexOf(langId);
|
|
1133
|
+
const win = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`).contentWindow;
|
|
1134
|
+
win.postMessage(msgString, '*');
|
|
1075
1135
|
} else {
|
|
1076
|
-
|
|
1077
|
-
this.state.editorInstanse.insertHtml(`{{${data}}}`);
|
|
1136
|
+
this.resetCkEditorInstance(currentTab, formData, true, data);
|
|
1078
1137
|
}
|
|
1079
1138
|
}
|
|
1080
1139
|
|
|
@@ -1090,6 +1149,35 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1090
1149
|
});
|
|
1091
1150
|
}
|
|
1092
1151
|
|
|
1152
|
+
setNewLanguageContent = (data) => {
|
|
1153
|
+
const content = _.cloneDeep(data);
|
|
1154
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
1155
|
+
const currentTab = this.state.currentTab - 1;
|
|
1156
|
+
// const schema = _.cloneDeep(this.state.schema);
|
|
1157
|
+
console.log('Setting new language content', formData, this.state.settingLanguage);
|
|
1158
|
+
const currentTabData = formData[currentTab][this.state.settingLanguage.iso_code];
|
|
1159
|
+
currentTabData.is_drag_drop = false;
|
|
1160
|
+
currentTabData.drag_drop_id = "";
|
|
1161
|
+
const newActiveTab = this.state.settingLanguage.iso_code;
|
|
1162
|
+
currentTabData["template-content"] = content;
|
|
1163
|
+
formData[currentTab].activeTab = newActiveTab;
|
|
1164
|
+
if (currentTabData.edmeditorsrc) {
|
|
1165
|
+
delete currentTabData.edmeditorsrc;
|
|
1166
|
+
}
|
|
1167
|
+
formData[currentTab].selectedLanguages.push(newActiveTab);
|
|
1168
|
+
console.log('setting new language content final', formData);
|
|
1169
|
+
// this.setState({formData});
|
|
1170
|
+
// const container = schema.containers[this.state.currentTab - 1];
|
|
1171
|
+
// const temp = container;
|
|
1172
|
+
// const langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(newActiveTab);
|
|
1173
|
+
// console.log('switch language Tab ', langTab, this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages, this.state.formData[`${this.state.currentTab - 1}`].activeTab);
|
|
1174
|
+
// temp.panes[langTab].sections[0].inputFields[0].cols[0].colStyle = {display: ""};
|
|
1175
|
+
// temp.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = {display: "none"};
|
|
1176
|
+
// temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[3].cols[0].style = {display: "none"};
|
|
1177
|
+
this.props.templatesActions.resetUploadData();
|
|
1178
|
+
this.setState({formData, languageDataSet: false, addLanguageType: ''});
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1093
1181
|
getParameterByName = (name, url) => {
|
|
1094
1182
|
const match = RegExp(`[?&]${name}=([^&]*)`).exec(url);
|
|
1095
1183
|
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
|
|
@@ -1105,11 +1193,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1105
1193
|
};
|
|
1106
1194
|
console.log('Get Data', response);
|
|
1107
1195
|
this.setState({checkValidation: true});
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
}
|
|
1111
|
-
return response;
|
|
1112
|
-
};
|
|
1196
|
+
e.source.postMessage(JSON.stringify(response), e.origin);
|
|
1197
|
+
}
|
|
1113
1198
|
|
|
1114
1199
|
setFormValidity = (isFormValid) => {
|
|
1115
1200
|
this.setState({isFormValid});
|
|
@@ -1120,10 +1205,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1120
1205
|
const formData = _.cloneDeep(this.state.formData);
|
|
1121
1206
|
|
|
1122
1207
|
const tabIndex = this.state.currentTab + 1;
|
|
1123
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
1208
|
+
const schema = (this.props.location.query.type === 'embedded') ? this.removeStandAlone() : _.cloneDeep(this.state.schema);
|
|
1124
1209
|
const containers = _.cloneDeep(schema.containers.slice());
|
|
1125
1210
|
let tabKey = "";
|
|
1126
1211
|
let currentTab = _.cloneDeep(this.state.currentTab);
|
|
1212
|
+
const isLanguageSupport = this.props.location.query.isLanguageSupport;
|
|
1127
1213
|
|
|
1128
1214
|
formData['template-name'] = editData.name;
|
|
1129
1215
|
formData.base = editData.versions.base;
|
|
@@ -1131,7 +1217,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1131
1217
|
_.forEach(editData.versions.history, (data1, index) => {
|
|
1132
1218
|
const data = _.cloneDeep(data1);
|
|
1133
1219
|
if (data !== null) {
|
|
1134
|
-
if (index > 0) {
|
|
1220
|
+
if (index > 0 && (isLanguageSupport || this.props.location.query.type !== 'embedded')) {
|
|
1135
1221
|
const firstPane = _.cloneDeep(containers[0].panes[0]);
|
|
1136
1222
|
// schema.containers[this.state.currentTab - 1].isActive = false;
|
|
1137
1223
|
const sections = [];
|
|
@@ -1193,11 +1279,12 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1193
1279
|
schema.containers[index].isActive = false;
|
|
1194
1280
|
console.log('Dummy Random ', schema.containers[index].isActive, index);
|
|
1195
1281
|
}
|
|
1196
|
-
|
|
1282
|
+
const type = this.props.location.query.type;
|
|
1283
|
+
// const isLanguageSupport = this.props.location.query.isLanguageSupport;
|
|
1197
1284
|
console.log('Schema Test ', schema, schema.containers[index]);
|
|
1198
1285
|
_.forEach(data.selectedLanguages, (lang, langIndex) => {
|
|
1199
1286
|
console.log('Language ', lang, langIndex);
|
|
1200
|
-
if (lang !== this.props.Global.currentOrgDetails.basic_details.base_language) {
|
|
1287
|
+
if ((type !== 'embedded' || (type === 'embedded' && isLanguageSupport === 'true')) && lang !== this.props.Global.currentOrgDetails.basic_details.base_language) {
|
|
1201
1288
|
const tabContent = _.cloneDeep(containers[0].tabContent.sections[0]);
|
|
1202
1289
|
const tabContentSection = tabContent.inputFields[0].cols[0];
|
|
1203
1290
|
const panes = containers[0].panes.slice();
|
|
@@ -1229,14 +1316,20 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1229
1316
|
// panes.push(firstPane);
|
|
1230
1317
|
console.log('initial panes', JSON.stringify(this.state.schema.containers));
|
|
1231
1318
|
schema.containers[index].panes.push(firstPane);
|
|
1319
|
+
} else if (lang !== this.props.Global.currentOrgDetails.basic_details.base_language) {
|
|
1320
|
+
delete data[lang];
|
|
1321
|
+
data.selectedLanguages.splice(langIndex, 1);
|
|
1232
1322
|
}
|
|
1233
1323
|
});
|
|
1234
1324
|
}
|
|
1325
|
+
if (data.base) {
|
|
1326
|
+
formData.base = data;
|
|
1327
|
+
}
|
|
1235
1328
|
formData[index] = data;
|
|
1236
1329
|
}
|
|
1237
1330
|
});
|
|
1238
1331
|
|
|
1239
|
-
_.forEach(
|
|
1332
|
+
_.forEach(formData.base.selectedLanguages, (language) => {
|
|
1240
1333
|
if (formData.base.tabKey === formData.base[language].tabKey) {
|
|
1241
1334
|
formData.base.activeTab = language;
|
|
1242
1335
|
}
|
|
@@ -1258,6 +1351,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1258
1351
|
}
|
|
1259
1352
|
});
|
|
1260
1353
|
console.log('final form data edit', formData);
|
|
1354
|
+
// this.resetCkEditorInstance(this.state.currentTab - 1, formData);
|
|
1261
1355
|
// this.setState({formData});
|
|
1262
1356
|
});
|
|
1263
1357
|
}
|
|
@@ -1277,35 +1371,205 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1277
1371
|
parent.postMessage(JSON.stringify(response), '*');
|
|
1278
1372
|
}
|
|
1279
1373
|
|
|
1280
|
-
getEditorInstanse = (instance) => {
|
|
1281
|
-
console.log('Got editor Instance ', instance);
|
|
1282
|
-
this.setState({editorInstanse: instance});
|
|
1374
|
+
getEditorInstanse = (instance, id) => {
|
|
1375
|
+
console.log('Got editor Instance ', instance, id);
|
|
1376
|
+
//this.setState({editorInstanse: instance});
|
|
1283
1377
|
}
|
|
1284
1378
|
|
|
1285
|
-
setModalContent = (type) => {
|
|
1379
|
+
setModalContent = (type, data) => {
|
|
1380
|
+
let modalContent = {};
|
|
1286
1381
|
if (type === 'delete-version') {
|
|
1287
|
-
|
|
1382
|
+
modalContent = {
|
|
1288
1383
|
title: "Alert",
|
|
1289
1384
|
body: "Do you really want to delete this version?",
|
|
1290
1385
|
type: 'confirm',
|
|
1291
1386
|
id: 'email-version-delete-modal',
|
|
1292
1387
|
};
|
|
1293
|
-
this.setState({modalContent, showModal: true});
|
|
1294
1388
|
} else if (type === 'delete-language') {
|
|
1295
|
-
|
|
1389
|
+
modalContent = {
|
|
1296
1390
|
title: "Alert",
|
|
1297
1391
|
body: "Do you really want to delete this language?",
|
|
1298
1392
|
type: 'confirm',
|
|
1299
1393
|
id: 'email-language-delete-modal',
|
|
1300
1394
|
};
|
|
1301
|
-
|
|
1395
|
+
} else if (type === 'add-language') {
|
|
1396
|
+
const jsx = (
|
|
1397
|
+
<div>
|
|
1398
|
+
<div><CapButton type="secondary" style={{width: "100%", marginBottom: "8px"}} onClick={this.uploadFile}>Upload File</CapButton>
|
|
1399
|
+
<input type="file" id="filename" style={{ display: 'none'}} accept=".zip, .html, .htm" onChange={(event) => this.handleFileUpload(event, {files: event.target.files})} />
|
|
1400
|
+
</div>
|
|
1401
|
+
<div><CapButton type="secondary" style={{width: "100%", marginBottom: "8px"}} onClick={this.useEditor}>Use Editor</CapButton></div>
|
|
1402
|
+
<div><CapButton type="secondary" style={{width: "100%", marginBottom: "8px"}} onClick={this.copyPrimaryLanguage}>Copy primary Language</CapButton></div>
|
|
1403
|
+
</div>);
|
|
1404
|
+
modalContent = {
|
|
1405
|
+
title: "New Language",
|
|
1406
|
+
type: "action",
|
|
1407
|
+
jsx,
|
|
1408
|
+
id: 'email-add-language-options',
|
|
1409
|
+
};
|
|
1410
|
+
this.setState({settingLanguage: data});
|
|
1302
1411
|
}
|
|
1412
|
+
this.setState({ modalContent, showModal: true});
|
|
1413
|
+
};
|
|
1414
|
+
|
|
1415
|
+
resetStateValue = () => {
|
|
1416
|
+
this.setState({
|
|
1417
|
+
formData: {},
|
|
1418
|
+
tabCount: 1,
|
|
1419
|
+
currentTab: 1,
|
|
1420
|
+
isEdit: false,
|
|
1421
|
+
schema: {},
|
|
1422
|
+
loading: false,
|
|
1423
|
+
isFormValid: true,
|
|
1424
|
+
injectedTags: {},
|
|
1425
|
+
checkValidation: false,
|
|
1426
|
+
tabKey: '',
|
|
1427
|
+
showEmailPreview: false,
|
|
1428
|
+
device: "desktop",
|
|
1429
|
+
editorInstanse: undefined,
|
|
1430
|
+
showImageSelectionBox: false,
|
|
1431
|
+
isDragDrop: false,
|
|
1432
|
+
showConfirmationModal: false,
|
|
1433
|
+
modalContent: {title: "Alert", body: "Do you really want to delete this language?", type: 'confirm', id: 'email-language-delete-modal'},
|
|
1434
|
+
showModal: false,
|
|
1435
|
+
page: 1,
|
|
1436
|
+
perPageLimit: 25,
|
|
1437
|
+
totalCount: 0,
|
|
1438
|
+
searchText: '',
|
|
1439
|
+
saveCount: 0,
|
|
1440
|
+
targetSaveCount: 0,
|
|
1441
|
+
saveObj: {},
|
|
1442
|
+
showEdmEmailTemplates: false,
|
|
1443
|
+
editDataSet: false,
|
|
1444
|
+
});
|
|
1303
1445
|
}
|
|
1304
1446
|
|
|
1447
|
+
resetCkEditorInstance = (data, formData, onInsert, value, isImage) => {
|
|
1448
|
+
const currentLang = formData[`${data - 1}`].selectedLanguages.indexOf(formData[`${data - 1}`].activeTab);
|
|
1449
|
+
const langIndex = formData[`${data - 1}`].selectedLanguages.indexOf(formData[`${data - 1}`].activeTab);
|
|
1450
|
+
let instance1 = window.CKEDITOR.instances[`editor${currentLang + 1}`];
|
|
1451
|
+
const instanceCount = 0;
|
|
1452
|
+
const instanceArray = [];
|
|
1453
|
+
_.forEach(window.CKEDITOR.instances, (instance, index) => {
|
|
1454
|
+
console.log('all ck instances ', instance, index, instanceCount, langIndex);
|
|
1455
|
+
const name = instance.name;
|
|
1456
|
+
if (instance.status === "destroyed") {
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
let instanceIdx = 0;
|
|
1460
|
+
if (name.indexOf('template-content') > -1 && name !== 'template-content') {
|
|
1461
|
+
instanceIdx = parseInt(name.replace('template-content', ''), 10) - 1;
|
|
1462
|
+
const obj = {
|
|
1463
|
+
idx: instanceIdx,
|
|
1464
|
+
instance,
|
|
1465
|
+
};
|
|
1466
|
+
instanceArray.push(obj);
|
|
1467
|
+
} else {
|
|
1468
|
+
const obj = {
|
|
1469
|
+
idx: 0,
|
|
1470
|
+
instance,
|
|
1471
|
+
};
|
|
1472
|
+
instanceArray.push(obj);
|
|
1473
|
+
}
|
|
1474
|
+
});
|
|
1475
|
+
console.log('sorted instance array before sort', instanceArray);
|
|
1476
|
+
instanceArray.sort( (a, b) => {
|
|
1477
|
+
const idxA = a.idx;
|
|
1478
|
+
const idxB = b.idx;
|
|
1479
|
+
if (idxA < idxB) {
|
|
1480
|
+
return -1;
|
|
1481
|
+
} else if (idxA > idxB) {
|
|
1482
|
+
return 1;
|
|
1483
|
+
}
|
|
1484
|
+
return 0;
|
|
1485
|
+
});
|
|
1486
|
+
console.log('sorted instance array after sort', instanceArray);
|
|
1487
|
+
//instanceCount += 1;
|
|
1488
|
+
// if (instanceIdx === langIndex) {
|
|
1489
|
+
const instance = instanceArray[langIndex].instance;
|
|
1490
|
+
console.log('setting instance as ', instance, instance.name);
|
|
1491
|
+
instance1 = instance;
|
|
1492
|
+
this.setState({editorInstanse: instance1}, () => {
|
|
1493
|
+
if (onInsert && !isImage) {
|
|
1494
|
+
this.state.editorInstanse.insertHtml(`{{${value}}}`);
|
|
1495
|
+
} else if (onInsert) {
|
|
1496
|
+
this.state.editorInstanse.insertHtml(`<img src='${value.metaInfo.secure_file_path}' alt='Capillary Image'>`);
|
|
1497
|
+
}
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
uploadFile = () => {
|
|
1502
|
+
console.log('uploadFile');
|
|
1503
|
+
document.getElementById('filename').click();
|
|
1504
|
+
console.log('Upload File initiated');
|
|
1505
|
+
};
|
|
1506
|
+
|
|
1507
|
+
useEditor = () => {
|
|
1508
|
+
console.log('useEditor');
|
|
1509
|
+
//this.toggleEdmEmailTemplateSelection();
|
|
1510
|
+
this.setState({addLanguageType: "useEditor"}, () => {
|
|
1511
|
+
this.setState({showModal: false}, () => {
|
|
1512
|
+
this.toggleEdmEmailTemplateSelection();
|
|
1513
|
+
});
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
copyPrimaryLanguage = () => {
|
|
1518
|
+
console.log('copy primary language');
|
|
1519
|
+
this.setState({addLanguageType: "copyPrimaryLanguage"}, () => {
|
|
1520
|
+
this.setState({showModal: false});
|
|
1521
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
1522
|
+
const currentTab = this.state.currentTab - 1;
|
|
1523
|
+
const baseLanguage = this.props.Global.currentOrgDetails.basic_details.base_language ? this.props.Global.currentOrgDetails.basic_details.base_language : 'en';
|
|
1524
|
+
if (formData[currentTab][baseLanguage].is_drag_drop) {
|
|
1525
|
+
this.props.actions.getCmsSetting('edm', formData[currentTab][baseLanguage].drag_drop_id, 'duplicate', baseLanguage);
|
|
1526
|
+
}
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
handleFileUpload = (e, {files}) => {
|
|
1531
|
+
if (files.length === 0) {
|
|
1532
|
+
return;
|
|
1533
|
+
}
|
|
1534
|
+
const fileExtension = files[0].name.split('.').pop();
|
|
1535
|
+
const supportedZipFormats = ['zip'];
|
|
1536
|
+
console.log('File Params ', fileExtension);
|
|
1537
|
+
if (supportedZipFormats.indexOf(fileExtension.toLowerCase()) !== -1) {
|
|
1538
|
+
this.setState({ addLanguageType: "upload"}, () => {
|
|
1539
|
+
console.log('Zip Format got');
|
|
1540
|
+
this.props.templatesActions.handleZipUpload(files[0]);
|
|
1541
|
+
document.getElementById("filename").value = "";
|
|
1542
|
+
this.setState({showModal: false});
|
|
1543
|
+
});
|
|
1544
|
+
} else if (fileExtension === 'html' || fileExtension === 'htm') {
|
|
1545
|
+
console.log('html Format got');
|
|
1546
|
+
const reader = new FileReader();
|
|
1547
|
+
reader.onload = () => {
|
|
1548
|
+
this.setState({ addLanguageType: "upload"}, () => {
|
|
1549
|
+
const text = reader.result;
|
|
1550
|
+
this.props.templatesActions.handleHtmlUpload(text);
|
|
1551
|
+
document.getElementById("filename").value = "";
|
|
1552
|
+
this.setState({showModal: false});
|
|
1553
|
+
});
|
|
1554
|
+
};
|
|
1555
|
+
reader.readAsText(files[0]);
|
|
1556
|
+
} else {
|
|
1557
|
+
alert('Invalid file type added! Please Give a proper zip/html file');
|
|
1558
|
+
console.log('Invalid file type added! Please Give a proper zip/html file');
|
|
1559
|
+
}
|
|
1560
|
+
};
|
|
1561
|
+
|
|
1305
1562
|
uploadImages(e, {files}) {
|
|
1306
1563
|
e.preventDefault();
|
|
1307
1564
|
const _URL = window.URL || window.webkitURL;
|
|
1308
1565
|
const file = files[0];
|
|
1566
|
+
const fileSize = (file.size / ( 1024 * 1024 ));
|
|
1567
|
+
if (fileSize > 5) {
|
|
1568
|
+
const message = getMessageObject('error', this.props.intl.formatMessage(messages.uploadSizeError), true);
|
|
1569
|
+
this.props.globalActions.addMessageToQueue(message);
|
|
1570
|
+
document.getElementById("fileName").value = "";
|
|
1571
|
+
return;
|
|
1572
|
+
}
|
|
1309
1573
|
const img = new Image();
|
|
1310
1574
|
const that = this;
|
|
1311
1575
|
img.src = _URL.createObjectURL(file);
|
|
@@ -1315,6 +1579,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1315
1579
|
height: this.height,
|
|
1316
1580
|
};
|
|
1317
1581
|
that.props.actions.uploadAsset(file, 'image', fileParams);
|
|
1582
|
+
that.handleImagePreviewClose();
|
|
1318
1583
|
};
|
|
1319
1584
|
}
|
|
1320
1585
|
|
|
@@ -1365,10 +1630,13 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1365
1630
|
this.delayTimer = setTimeout(callback, ms);
|
|
1366
1631
|
}
|
|
1367
1632
|
|
|
1368
|
-
deleteLanguage = (
|
|
1633
|
+
deleteLanguage = (passedData, val) => {
|
|
1634
|
+
const formData = _.cloneDeep(passedData);
|
|
1369
1635
|
console.log('Delete Language ', formData, val);
|
|
1370
1636
|
const schema = _.cloneDeep(this.state.schema);
|
|
1371
|
-
schema.containers[
|
|
1637
|
+
schema.containers[this.state.currentTab - 1].panes.splice(val, 1);
|
|
1638
|
+
schema.containers[this.state.currentTab - 1].tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: "none"};
|
|
1639
|
+
this.resetCkEditorInstance(this.state.currentTab, formData);
|
|
1372
1640
|
this.setState({schema, formData, showModal: false});
|
|
1373
1641
|
console.log('Schema ', schema, formData, val);
|
|
1374
1642
|
}
|
|
@@ -1400,7 +1668,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1400
1668
|
baseData.selectedLanguages = [baseLanguage];
|
|
1401
1669
|
newFormData.base = baseData;
|
|
1402
1670
|
newFormData[0] = baseData;
|
|
1671
|
+
newFormData[0].base = true;
|
|
1403
1672
|
}
|
|
1673
|
+
this.props.templatesActions.resetUploadData();
|
|
1404
1674
|
return newFormData;
|
|
1405
1675
|
}
|
|
1406
1676
|
|
|
@@ -1415,6 +1685,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1415
1685
|
console.log('Type test ', content.constructor);
|
|
1416
1686
|
if (content.constructor === Object) {
|
|
1417
1687
|
const tmpData = {};
|
|
1688
|
+
if (_.isEmpty(content)) {
|
|
1689
|
+
return;
|
|
1690
|
+
}
|
|
1418
1691
|
tmpData.html_content = content['template-content'];
|
|
1419
1692
|
tmpData.is_drag_drop = content.is_drag_drop;
|
|
1420
1693
|
tmpData.lang_id = content.lang_id;
|
|
@@ -1431,7 +1704,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1431
1704
|
console.log('Tranforming data for embedded mode', tmpData);
|
|
1432
1705
|
}
|
|
1433
1706
|
});
|
|
1434
|
-
if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "
|
|
1707
|
+
if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "timeline" ||
|
|
1708
|
+
this.props.location.query.module === "library")) {
|
|
1435
1709
|
newFormData.base.subject = formData['template-subject'];
|
|
1436
1710
|
}
|
|
1437
1711
|
|
|
@@ -1467,6 +1741,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1467
1741
|
case "create":
|
|
1468
1742
|
this.edmEvent = e;
|
|
1469
1743
|
break;
|
|
1744
|
+
case "select":
|
|
1745
|
+
this.edmEvent = e;
|
|
1746
|
+
break;
|
|
1470
1747
|
case "startLoading":
|
|
1471
1748
|
this.startLoading(type.edit);
|
|
1472
1749
|
break;
|
|
@@ -1527,6 +1804,27 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1527
1804
|
this.props.actions.createTemplate(this.state.saveObj);
|
|
1528
1805
|
}
|
|
1529
1806
|
});
|
|
1807
|
+
} else if (this.state.mode === 'preview' || this.state.mode === 'switchEditor') {
|
|
1808
|
+
this.props.actions.getCmsData('edm', this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].drag_drop_id);
|
|
1809
|
+
if (this.state.mode === 'switchEditor') {
|
|
1810
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
1811
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
1812
|
+
_.forEach(schema.containers, (container, index) => {
|
|
1813
|
+
if (parseInt(index, 10) === (this.state.currentTab - 1)) {
|
|
1814
|
+
const temp = container;
|
|
1815
|
+
const langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(formData[`${this.state.currentTab - 1}`].activeTab);
|
|
1816
|
+
console.log('switch language Tab ', langTab, formData[`${this.state.currentTab - 1}`].selectedLanguages, formData[`${this.state.currentTab - 1}`].activeTab);
|
|
1817
|
+
temp.panes[langTab].sections[0].inputFields[0].cols[0].colStyle = {display: ""};
|
|
1818
|
+
temp.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = {display: "none"};
|
|
1819
|
+
temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[3].cols[0].style = {display: "none"};
|
|
1820
|
+
}
|
|
1821
|
+
});
|
|
1822
|
+
|
|
1823
|
+
console.log('Handle OK ', schema);
|
|
1824
|
+
this.setState({ schema, showConfirmationModal: false, isSchemaChanged: true }, () => {
|
|
1825
|
+
this.injectEvents(schema);
|
|
1826
|
+
});
|
|
1827
|
+
}
|
|
1530
1828
|
}
|
|
1531
1829
|
}
|
|
1532
1830
|
|
|
@@ -1541,15 +1839,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1541
1839
|
this.setState({formData});
|
|
1542
1840
|
}
|
|
1543
1841
|
|
|
1544
|
-
hideSubject = () => {
|
|
1545
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
1546
|
-
if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "subscription")) {
|
|
1547
|
-
schema.standalone.sections[0].inputFields[0].style.display = "";
|
|
1548
|
-
schema.standalone.sections[0].inputFields[0].labelStyle.display = "";
|
|
1549
|
-
}
|
|
1550
|
-
this.setState({schema});
|
|
1551
|
-
}
|
|
1552
|
-
|
|
1553
1842
|
handleOnHoverItem = (isHovering, id) => {
|
|
1554
1843
|
console.log('Card Howering ', isHovering, id);
|
|
1555
1844
|
if (!isHovering) {
|
|
@@ -1570,6 +1859,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1570
1859
|
_.forEach(schema.containers, (container) => {
|
|
1571
1860
|
if (container.isActive) {
|
|
1572
1861
|
_.forEach(container.tabBarExtraContent.sections[0].inputFields[0].cols, (containerInputFieldCol) => {
|
|
1862
|
+
if (containerInputFieldCol.id === 'insert-image') {
|
|
1863
|
+
const newContainerInputFieldCol = containerInputFieldCol;
|
|
1864
|
+
newContainerInputFieldCol.style.display = isDragDrop ? "none" : '';
|
|
1865
|
+
}
|
|
1573
1866
|
if (containerInputFieldCol.id === 'tab-options-popover') {
|
|
1574
1867
|
_.forEach(containerInputFieldCol.content.sections[0].inputFields, (tabPopoverSection) => {
|
|
1575
1868
|
if (tabPopoverSection.cols[0].id === 'switch-editor-label') {
|
|
@@ -1585,6 +1878,32 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1585
1878
|
this.setState({schema, isSchemaChanged: true});
|
|
1586
1879
|
}
|
|
1587
1880
|
|
|
1881
|
+
hideMarkAsFinalButton = () => {
|
|
1882
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
1883
|
+
_.forEach(schema.containers, (container) => {
|
|
1884
|
+
if (container.isActive) {
|
|
1885
|
+
_.forEach(container.tabBarExtraContent.sections[0].inputFields[0].cols, (containerInputFieldCol) => {
|
|
1886
|
+
if (containerInputFieldCol.id === 'mark-final-version-label') {
|
|
1887
|
+
const newContainerInputFieldCol = containerInputFieldCol;
|
|
1888
|
+
newContainerInputFieldCol.style.display = "none";
|
|
1889
|
+
}
|
|
1890
|
+
});
|
|
1891
|
+
}
|
|
1892
|
+
});
|
|
1893
|
+
console.log('HandleHideMarkAsFinal ', JSON.stringify(schema));
|
|
1894
|
+
this.setState({schema, isSchemaChanged: true});
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
showSubject = () => {
|
|
1898
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
1899
|
+
if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "timeline" ||
|
|
1900
|
+
this.props.location.query.module === "library")) {
|
|
1901
|
+
schema.standalone.sections[0].inputFields[0].style.display = "";
|
|
1902
|
+
schema.standalone.sections[0].inputFields[0].labelStyle.display = "";
|
|
1903
|
+
}
|
|
1904
|
+
this.setState({schema});
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1588
1907
|
handleOnItemClick = (isSelected, id) => {
|
|
1589
1908
|
console.log('Dummy ', isSelected, id, event);
|
|
1590
1909
|
const isDragDrop = this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop;
|
|
@@ -1618,7 +1937,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1618
1937
|
}
|
|
1619
1938
|
this.edmEvent = undefined;
|
|
1620
1939
|
} else {
|
|
1621
|
-
this.state.
|
|
1940
|
+
this.resetCkEditorInstance(this.state.currentTab, this.state.formData, true, data, true);
|
|
1622
1941
|
}
|
|
1623
1942
|
}
|
|
1624
1943
|
this.setState({ showImageSelectionBox: false });
|
|
@@ -1628,9 +1947,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1628
1947
|
toggleEmailPreview = () => {
|
|
1629
1948
|
const isDragDrop = this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop;
|
|
1630
1949
|
if (isDragDrop && !this.state.showEmailPreview) {
|
|
1631
|
-
this.
|
|
1632
|
-
|
|
1633
|
-
});
|
|
1950
|
+
const activeLangTab = this.state.formData[`${this.state.currentTab - 1}`].activeTab;
|
|
1951
|
+
const langIndex = this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(activeLangTab);
|
|
1952
|
+
const win = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`).contentWindow;
|
|
1953
|
+
win.postMessage("saveProject", '*');
|
|
1954
|
+
this.setState({mode: "preview", gettingPreviewData: true});
|
|
1955
|
+
// this.setState({gettingPreviewData: true}, () => {
|
|
1956
|
+
// this.props.actions.getCmsData('edm', this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].drag_drop_id);
|
|
1957
|
+
// });
|
|
1634
1958
|
} else if (this.state.showEmailPreview) {
|
|
1635
1959
|
const formData = _.cloneDeep(this.state.formData);
|
|
1636
1960
|
formData[`${this.state.currentTab - 1}`][formData[`${this.state.currentTab - 1}`].activeTab]['template-content'] = "";
|
|
@@ -1771,58 +2095,106 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1771
2095
|
}
|
|
1772
2096
|
}
|
|
1773
2097
|
|
|
1774
|
-
addLanguage = (
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
const tabContentSection = tabContent.inputFields[0].cols[0];
|
|
1783
|
-
const panes = containers[`${this.state.currentTab - 1}`].panes.slice();
|
|
1784
|
-
const firstPane = _.cloneDeep(panes[0]);
|
|
1785
|
-
const sections = [];
|
|
1786
|
-
_.forEach(firstPane.sections, (section) => {
|
|
1787
|
-
let sect = _.cloneDeep(section);
|
|
1788
|
-
console.log('trying to clone in add version', JSON.stringify(sect), tabIndex);
|
|
1789
|
-
if (sect.type === 'col-label') {
|
|
1790
|
-
sect = this.cloneColLabel(sect, tabIndex);
|
|
1791
|
-
} else if (sect.type === 'multicols') {
|
|
1792
|
-
sect = this.cloneMultiCol(sect, tabIndex);
|
|
1793
|
-
} else if (sect.type === 'parent') {
|
|
1794
|
-
sect = this.cloneParent(sect, tabIndex);
|
|
2098
|
+
addLanguage = (tempLang, passedData, val, asyncLanguages) => {
|
|
2099
|
+
this.setState({languageDataSet: true}, () => {
|
|
2100
|
+
console.log('adding from add language 1', this.props.Templates);
|
|
2101
|
+
if (this.props.Templates.selectedEmailLayout && this.props.Templates.selectedEmailLayout !== '' && this.state.addLanguageType === "upload") {
|
|
2102
|
+
console.log('adding from add language 2');
|
|
2103
|
+
this.setNewLanguageContent(this.props.Templates.selectedEmailLayout);
|
|
2104
|
+
} else if (this.state.addLanguageType === "upload") {
|
|
2105
|
+
//this.componentWillReceiveProps()
|
|
1795
2106
|
}
|
|
1796
|
-
console.log('returning section', sect);
|
|
1797
|
-
sections.push(sect);
|
|
1798
|
-
return true;
|
|
1799
2107
|
});
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
2108
|
+
let addLanguageLength = 1;
|
|
2109
|
+
if (asyncLanguages) {
|
|
2110
|
+
addLanguageLength = asyncLanguages.length;
|
|
2111
|
+
}
|
|
2112
|
+
let data = tempLang;
|
|
2113
|
+
let tabKey = '';
|
|
2114
|
+
let langTab = 0;
|
|
2115
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
2116
|
+
const formData = _.cloneDeep(passedData);
|
|
2117
|
+
for (let idx = 0; idx < addLanguageLength; idx += 1) {
|
|
2118
|
+
let newActiveTab = this.state.settingLanguage ? this.state.settingLanguage.iso_code : 'en';
|
|
2119
|
+
if (asyncLanguages) {
|
|
2120
|
+
newActiveTab = asyncLanguages[idx].iso_code;
|
|
2121
|
+
data = asyncLanguages[idx];
|
|
1811
2122
|
}
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
2123
|
+
langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(newActiveTab);
|
|
2124
|
+
if (langTab === -1) {
|
|
2125
|
+
formData[`${this.state.currentTab - 1}`].selectedLanguages.push(newActiveTab);
|
|
2126
|
+
langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(newActiveTab);
|
|
2127
|
+
}
|
|
2128
|
+
const selectedLanguage = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(data.iso_code);
|
|
2129
|
+
tabKey = formData[`${this.state.currentTab - 1}`][data.iso_code].tabKey;
|
|
2130
|
+
console.log('adding language', data, formData, val, selectedLanguage, formData[`${this.state.currentTab - 1}`]);
|
|
2131
|
+
const tabIndex = (selectedLanguage) + 1;
|
|
2132
|
+
const containers = schema.containers.slice();
|
|
2133
|
+
const tabContent = _.cloneDeep(containers[0].tabContent.sections[0]);
|
|
2134
|
+
const tabContentSection = tabContent.inputFields[0].cols[0];
|
|
2135
|
+
const panes = containers[`${this.state.currentTab - 1}`].panes.slice();
|
|
2136
|
+
const firstPane = _.cloneDeep(panes[0]);
|
|
2137
|
+
const sections = [];
|
|
2138
|
+
_.forEach(firstPane.sections, (section) => {
|
|
2139
|
+
let sect = _.cloneDeep(section);
|
|
2140
|
+
console.log('trying to clone in add version', JSON.stringify(sect), tabIndex);
|
|
2141
|
+
if (sect.type === 'col-label') {
|
|
2142
|
+
sect = this.cloneColLabel(sect, tabIndex);
|
|
2143
|
+
} else if (sect.type === 'multicols') {
|
|
2144
|
+
sect = this.cloneMultiCol(sect, tabIndex);
|
|
2145
|
+
} else if (sect.type === 'parent') {
|
|
2146
|
+
sect = this.cloneParent(sect, tabIndex);
|
|
2147
|
+
}
|
|
2148
|
+
console.log('returning section', sect);
|
|
2149
|
+
sections.push(sect);
|
|
2150
|
+
return true;
|
|
2151
|
+
});
|
|
2152
|
+
console.log('tabContent.inputFields[0].cols[0]', tabContentSection, this.state.currentTab);
|
|
2153
|
+
tabContentSection.id = `${tabContentSection.id}${tabIndex}`;
|
|
2154
|
+
tabContentSection.value = `${data.language}`;
|
|
2155
|
+
console.log('cloned final sections', sections, tabContent);
|
|
2156
|
+
_.forEach(sections[0].inputFields[0].cols, (inputField) => {
|
|
2157
|
+
if (this.map[inputField.id] === undefined) {
|
|
2158
|
+
if (inputField.id.indexOf('template-content') > -1) {
|
|
2159
|
+
this.map[inputField.id] = this.map['template-content'];
|
|
2160
|
+
} else if (inputField.id.indexOf('edmeditor2') > -1) {
|
|
2161
|
+
this.map[inputField.id] = this.map.edmeditor2;
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
});
|
|
2165
|
+
firstPane.sections = sections;
|
|
2166
|
+
firstPane.sectionsHeaders = [tabContent];
|
|
2167
|
+
console.log('firstPane final version', JSON.stringify(firstPane));
|
|
2168
|
+
// panes.push(firstPane);
|
|
2169
|
+
console.log('initial panes', JSON.stringify(this.state.schema.containers));
|
|
2170
|
+
schema.containers[`${this.state.currentTab - 1}`].panes.push(firstPane);
|
|
2171
|
+
// schema.containers[0].tabContent.sections.push(tabContent);
|
|
2172
|
+
console.log('final schema after adding version', firstPane, schema);
|
|
2173
|
+
}
|
|
1821
2174
|
//this.props.templatesActions.getEdmDefaultTemplates();
|
|
2175
|
+
const container = schema.containers[this.state.currentTab - 1];
|
|
2176
|
+
const temp = container;
|
|
2177
|
+
console.log('switch language Tab ', langTab, formData[`${this.state.currentTab - 1}`].selectedLanguages, this.state.formData[`${this.state.currentTab - 1}`].activeTab);
|
|
2178
|
+
if (this.state.addLanguageType === "upload") {
|
|
2179
|
+
temp.panes[langTab].sections[0].inputFields[0].cols[0].colStyle = {display: ""};
|
|
2180
|
+
temp.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = {display: "none"};
|
|
2181
|
+
temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[3].cols[0].style = {display: "none"};
|
|
2182
|
+
}
|
|
2183
|
+
temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: ""};
|
|
1822
2184
|
if (schema) {
|
|
1823
2185
|
this.setState({schema, isSchemaChanged: true, tabKey});
|
|
1824
|
-
this.
|
|
2186
|
+
if (this.state.addLanguageType !== "upload") {
|
|
2187
|
+
this.setState({addLanguageType: ''});
|
|
2188
|
+
}
|
|
2189
|
+
//this.toggleEdmEmailTemplateSelection();
|
|
1825
2190
|
}
|
|
2191
|
+
// const mode = this.state.addLanguageMode;
|
|
2192
|
+
// switch (mode) {
|
|
2193
|
+
// case "upload":
|
|
2194
|
+
//
|
|
2195
|
+
// default:
|
|
2196
|
+
// break;
|
|
2197
|
+
// }
|
|
1826
2198
|
}
|
|
1827
2199
|
|
|
1828
2200
|
openPreviewMode = (selectedAsset) => {
|
|
@@ -1930,9 +2302,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1930
2302
|
cancelTemplate = () => {
|
|
1931
2303
|
const type = this.props.location.query.type;
|
|
1932
2304
|
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
2305
|
+
const isLanguageSupport = this.props.location.query.isLanguageSupport || false;
|
|
1933
2306
|
this.props.router.push({
|
|
1934
2307
|
pathname: `/email/`,
|
|
1935
|
-
query: type === 'embedded' ? {type: 'embedded', module} : {module},
|
|
2308
|
+
query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport} : {module, isLanguageSupport},
|
|
1936
2309
|
});
|
|
1937
2310
|
}
|
|
1938
2311
|
|
|
@@ -1998,12 +2371,38 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1998
2371
|
tempContainer = this.injectContainer(tempContainer);
|
|
1999
2372
|
return tempContainer;
|
|
2000
2373
|
});
|
|
2374
|
+
console.log("Lang Test ", this.props.location.query.isLanguageSupport, (this.props.location.query.isLanguageSupport === false));
|
|
2375
|
+
if ( this.props.location.query.type === 'embedded' && (this.props.location.query.isLanguageSupport === "false" || this.props.location.query.isLanguageSupport === undefined)) {
|
|
2376
|
+
_.forEach(temp.containers, (container) => {
|
|
2377
|
+
if (container.isActive) {
|
|
2378
|
+
let hideLang = false;
|
|
2379
|
+
_.forEach(container.tabBarExtraContent.sections[0].inputFields[0].cols, (containerInputFieldCol) => {
|
|
2380
|
+
if (hideLang) {
|
|
2381
|
+
const newContainerInputFieldCol = containerInputFieldCol;
|
|
2382
|
+
hideLang = false;
|
|
2383
|
+
newContainerInputFieldCol.width = 7;
|
|
2384
|
+
}
|
|
2385
|
+
if (containerInputFieldCol.id === 'add-language-button') {
|
|
2386
|
+
const newContainerInputFieldCol = containerInputFieldCol;
|
|
2387
|
+
newContainerInputFieldCol.colStyle.display = "none";
|
|
2388
|
+
hideLang = true;
|
|
2389
|
+
}
|
|
2390
|
+
});
|
|
2391
|
+
}
|
|
2392
|
+
});
|
|
2393
|
+
}
|
|
2001
2394
|
console.log('final injected schema', schema);
|
|
2002
2395
|
this.setState({schema, isSchemaChanged: true}, () => {
|
|
2003
2396
|
const type = this.props.location.query.type;
|
|
2004
2397
|
if (type === 'embedded') {
|
|
2005
2398
|
this.removeStandAlone();
|
|
2006
2399
|
}
|
|
2400
|
+
if (type === 'embedded' && (this.props.route.name === 'EmailView' || (this.props.location.query.module && this.props.location.query.module.toLowerCase() === 'loyalty'))) {
|
|
2401
|
+
const response = {
|
|
2402
|
+
action: 'startTemplateCreation',
|
|
2403
|
+
};
|
|
2404
|
+
parent.postMessage(JSON.stringify(response), '*');
|
|
2405
|
+
}
|
|
2007
2406
|
});
|
|
2008
2407
|
return schema;
|
|
2009
2408
|
}
|
|
@@ -2024,7 +2423,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2024
2423
|
delete schema.standalone;
|
|
2025
2424
|
schema.standalone = {};
|
|
2026
2425
|
schema.standalone.sections = [];
|
|
2027
|
-
if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "
|
|
2426
|
+
if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "timeline" ||
|
|
2427
|
+
this.props.location.query.module === "library")) {
|
|
2028
2428
|
schema.standalone.sections.push(_.cloneDeep(this.state.schema.standalone.sections[0]));
|
|
2029
2429
|
}
|
|
2030
2430
|
|
|
@@ -2053,15 +2453,17 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2053
2453
|
}
|
|
2054
2454
|
});
|
|
2055
2455
|
this.setState({ schema, isSchemaChanged: true });
|
|
2456
|
+
return schema;
|
|
2056
2457
|
}
|
|
2057
2458
|
|
|
2058
2459
|
startTemplateCreation(data) {
|
|
2460
|
+
console.log('startTemplatecreations', data);
|
|
2059
2461
|
if (_.isEmpty(data)) {
|
|
2060
2462
|
return;
|
|
2061
2463
|
}
|
|
2062
2464
|
|
|
2063
|
-
|
|
2064
|
-
// const data = {edit: true, "base":{"subject":"testsubject","html_content":"<html> <head> \t<meta charset=\"utf-8\" /> \t<title>Aster Secure</title> \t<style type=\"text/css\">#outlook a { padding: 0; } body { width: 100% !important; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; margin: 0; padding: 0;} .ExternalClass { width: 100%; } .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; } #backgroundTable { margin: 0; padding: 0; width: 100% !important; line-height: 100% !important; } img { outline: none; text-decoration: none; border: none; -ms-interpolation-mode: bicubic; } a img { border: none; } .image_fix { display: block; } p { margin: 0px 0px !important; } table td { border-collapse: collapse; } table { border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; } table[class=full] { width: 100%; clear: both; } table[class=spacetable] { height: 176px; } table[class=spacetable1] { height: 431px; } table[class=spacetable2] { height: 50px; } table[class=spacetable3] { height: 55px; } \t @media only screen and (min-width: 320px) and (max-width: 540px) { a[href^=\"tel\"], a[href^=\"sms\"] { text-decoration: none; color: #ffffff; pointer-events: none; cursor: default; } .mobile_link a[href^=\"tel\"], .mobile_link a[href^=\"sms\"] { text-decoration: default; color: #ffffff !important; pointer-events: auto; cursor: default; } img[class=logo] { width: 132px!important; } img[class=shop] { width:53px!important; text-align: center!important; } table[class=innerlayer] { width: 300px !important; text-align: center; } img[class=spot] { width: 65px!important; } img[class=banner] { width: 290px !important; text-align: center; } img[class=banner1] { width: 229px!important; } img[class=click] { width:55px!important; } img[class=border] { width: 290px!important; } td[class=txtfont] { font-size:11px!important; height:50px!important; line-height: 15px!important; } \t span[class=txtfont] { font-size:9px!important; height:98px!important; line-height:23px!important; } \t td[class=txtfont1] { font-size:11px!important; height:40px!important; line-height: 14px!important; } img[class=left] { width:195px!important; } img[class=right] { width:46px!important; } \t \t td[class=txtfont3] { font-size:8px!important;} \ttd[class=txtfont2] { font-size:6px!important; line-height:9px!important; } td[class=txtbold] { font-size: 21px!important; } img[class=gap] { width:92px!important; } img[class=gap1] { width: 20px!important; } table[class=social] { width: 99% !important; } img[class=fb] { width:20px!important; } img[class=in] { width:21px!important; } img[class=tw] { width:20px!important; } img[class=pin] { width:41px!important; } \t img[class=and] { width:81px!important; } img[class=my] { width: 44px!important; } \t img[class=you] { width:21px!important; } img[class=store] { width:65px!important; } \t \t img[class=snap] { width:24px!important; } td[class=textlen] { height:52px!important; } \ttd[class=tdlen] \t{ \theight:35px!important;font-size: 10px !important; \t} \t\t\timg[class=a] { width: 42px!important; } \t\t\timg[class=b] { width: 22px!important; } \t\t\timg[class=c] { width: 72px!important; } \t\t\timg[class=d] { width: 50px!important; } \t\t\timg[class=e] { width: 56px!important; } \t\t\timg[class=f] { width: 56px!important; } \t\t\t} \t</style> </head> <body><center>\n\t\t\t\t\t\t\t\t\t\tIf you have difficulties viewing this mail, click\n\t\t\t\t\t\t\t\t\t\t<a href=\"https://nightly.capillary.in/business_controller/campaigns/emails/links/view.php?utrack={{user_id_b64}}&mtrack={{outbox_id_b64}}\" style = \"text-decoration: underline;color: #369;\" target=\"_blank\">here</a><br/>\n\t\t\t\t\t\t\t\t\t</center> <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"outerlayer\" style=\"width:650px\"> \t<tbody> \t\t<tr> \t\t\t<td> \t\t\t<table align=\"center\" bgcolor=\"#fff\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"outerlayer\" style=\"width:650px\"> \t\t\t\t<tbody> \t\t\t\t\t<tr> \t\t\t\t\t\t<td class=\"txtfont2\" height=\"40\" style=\"font-family: Verdana, Geneva, sans-serif; text-align:center; font-size:11px; color:gray; line-height:13px;\" width=\"600\">Shop at Aster Pharmacy this month and You could be the next lucky winner!</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><a href=\"#\" style=\"pointer-events:none;\"><img class=\"banner\" src=\"https://s3-eu-west-1.amazonaws.com/fs.capillary.eu/intouch_creative_assets/890bdffee3b2322d8ec7.jpg\" style=\"border:none; display:block\" /></a></td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td class=\"txtfont2\" height=\"40\" style=\"font-family: Verdana, Geneva, sans-serif; text-align:center; font-size:11px; color:gray; line-height:13px;\" width=\"600\">To remove your email address from our mailing list , please click on {{unsubscribe}}</td> \t\t\t\t\t</tr> \t\t\t\t</tbody> \t\t\t</table> \t\t\t</td> \t\t</tr> \t</tbody> </table> </body> </html> ","is_drag_drop":0,"drag_drop_id":null},"secondary_templates":[{"is_preview_generated":null,"preview_url":null,"is_favourite":null,"is_drag_drop":false,"drag_drop_id":null,"scope":null,"tag":null,"is_default":null,"html_content":"<html>\r\n<head>\r\n\t<meta charset=\"utf-8\" />\r\n\t<title>Aster Secure</title>\r\n\t<style type=\"text/css\">#outlook a { padding: 0; } body { width: 100% !important; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; margin: 0; padding: 0;} .ExternalClass { width: 100%; } .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; } #backgroundTable { margin: 0; padding: 0; width: 100% !important; line-height: 100% !important; } img { outline: none; text-decoration: none; border: none; -ms-interpolation-mode: bicubic; } a img { border: none; } .image_fix { display: block; } p { margin: 0px 0px !important; } table td { border-collapse: collapse; } table { border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; } table[class=full] { width: 100%; clear: both; } table[class=spacetable] { height: 176px; } table[class=spacetable1] { height: 431px; } table[class=spacetable2] { height: 50px; } table[class=spacetable3] { height: 55px; } \t @media only screen and (min-width: 320px) and (max-width: 540px) { a[href^=\"tel\"], a[href^=\"sms\"] { text-decoration: none; color: #ffffff; pointer-events: none; cursor: default; } .mobile_link a[href^=\"tel\"], .mobile_link a[href^=\"sms\"] { text-decoration: default; color: #ffffff !important; pointer-events: auto; cursor: default; } img[class=logo] { width: 132px!important; } img[class=shop] { width:53px!important; text-align: center!important; } table[class=innerlayer] { width: 300px !important; text-align: center; } img[class=spot] { width: 65px!important; } img[class=banner] { width: 290px !important; text-align: center; } img[class=banner1] { width: 229px!important; } img[class=click] { width:55px!important; } img[class=border] { width: 290px!important; } td[class=txtfont] { font-size:11px!important; height:50px!important; line-height: 15px!important; } \t span[class=txtfont] { font-size:9px!important; height:98px!important; line-height:23px!important; } \t td[class=txtfont1] { font-size:11px!important; height:40px!important; line-height: 14px!important; } img[class=left] { width:195px!important; } img[class=right] { width:46px!important; } \t \t td[class=txtfont3] { font-size:8px!important;} \ttd[class=txtfont2] { font-size:6px!important; line-height:9px!important; } td[class=txtbold] { font-size: 21px!important; } img[class=gap] { width:92px!important; } img[class=gap1] { width: 20px!important; } table[class=social] { width: 99% !important; } img[class=fb] { width:20px!important; } img[class=in] { width:21px!important; } img[class=tw] { width:20px!important; } img[class=pin] { width:41px!important; } \t img[class=and] { width:81px!important; } img[class=my] { width: 44px!important; } \t img[class=you] { width:21px!important; } img[class=store] { width:65px!important; } \t \t img[class=snap] { width:24px!important; } td[class=textlen] { height:52px!important; } \ttd[class=tdlen] \t{ \theight:35px!important;font-size: 10px !important; \t} \t\t\timg[class=a] { width: 42px!important; } \t\t\timg[class=b] { width: 22px!important; } \t\t\timg[class=c] { width: 72px!important; } \t\t\timg[class=d] { width: 50px!important; } \t\t\timg[class=e] { width: 56px!important; } \t\t\timg[class=f] { width: 56px!important; } \t\t\t}\r\n\t</style>\r\n</head>\r\n<body>\r\n<table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"outerlayer\" style=\"width:650px\">\r\n\t<tbody>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t<table align=\"center\" bgcolor=\"#fff\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"outerlayer\" style=\"width:650px\">\r\n\t\t\t\t<tbody>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td class=\"txtfont2\" height=\"40\" style=\"font-family: Verdana, Geneva, sans-serif; text-align:center; font-size:11px; color:gray; line-height:13px;\" width=\"600\">Shop at Aster Pharmacy this month and You could be the next lucky winner!</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td><a href=\"#\" style=\"pointer-events:none;\"><img class=\"banner\" src=\"https://s3-eu-west-1.amazonaws.com/fs.capillary.eu/intouch_creative_assets/890bdffee3b2322d8ec7.jpg\" style=\"border:none; display:block\" /></a></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td class=\"txtfont2\" height=\"40\" style=\"font-family: Verdana, Geneva, sans-serif; text-align:center; font-size:11px; color:gray; line-height:13px;\" width=\"600\">To remove your email address from our mailing list , please click on {{unsubscribe}}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</tbody>\r\n\t\t\t</table>\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</tbody>\r\n</table>\r\n</body>\r\n</html>\r\n","secondary_template_id":"9584","is_base_template":1,"language_name":"English","language":"English","lang_id":"69"}]};
|
|
2465
|
+
//const data = {"base":{"subject":"deded","html_content":"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <html> <head> \t<title>Scheduled Report</title> \t<meta http-equiv=\"Content-Type\" content=\"text/html charset=UTF-8\"/> \t<style type=\"text/css\">.container-main p{line-height: 1.6;}@media screen and (max-width: 480px){a.brand{font-size: 35px;}}@media screen and (max-width: 480px){.container-main a{text-align: center;}a.brand{text-align: center;}}a.brand img{vertical-align: middle; padding: 0 8px 0 0; width: 250px;}@media screen and (max-width: 480px){a.brand img{width: 220px !important;}}@media screen and (max-width: 480px){.container-content{padding: 15px 20px; font-size: 12px !important;} .email-footer{font-size: 12px !important;}}.container-content table{border-collapse: collapse;}.container-content table tr td p{margin: 5px;}.container-content table tr td p span{font-weight: bold; padding: 0 3px 0 0;}@media screen and (max-width: 480px){a.btn-view-reports{margin: 25px auto 10px;}}a.btn-view-reports:hover{background: grey; color: #fff;}.email-footer p{text-align: center; font-size: 12px; color: grey;}.email-footer p a{color: blue; cursor: pointer;}.email-footer p a:hover{color: grey;} \t</style> </head> <body><center>\n\t\t\t\t\t\t\t\t\t\tIf you have difficulties viewing this mail, click\n\t\t\t\t\t\t\t\t\t\t<a href=\"https://nightly.capillary.in/business_controller/campaigns/emails/links/view.php?utrack={{user_id_b64}}&mtrack={{outbox_id_b64}}\" style = \"text-decoration: underline;color: #369;\" target=\"_blank\">here</a><br/>\n\t\t\t\t\t\t\t\t\t</center> <table class=\"container-main\" style=\"background:#eeeeee; color:#000000; font-family:'Open Sans',sans-serif; font-size:16px; font-weight:400; margin:0 auto; max-width:978px; padding:15px; width:100%\"> \t<tbody> \t\t<tr> \t\t\t<td> \t\t\t<table class=\"email-header\" style=\"background:#ffffff; margin:0 0 5px; padding:17px 0; width:100%\"> \t\t\t\t<tbody> \t\t\t\t\t<tr> \t\t\t\t\t\t<td style=\"width:100%\"><a class=\"brand\" href=\"#\" style=\"display: table; margin: 0 auto; text-decoration: none; font-size: 37px; color: grey;\"><img alt=\"Capillary Technologies\" src=\"https://s3.amazonaws.com/fileservice.in/intouch_creative_assets/60221e2020ba572f6787.png\" /> </a></td> \t\t\t\t\t</tr> \t\t\t\t</tbody> \t\t\t</table> \t\t\t<div class=\"container-content\" style=\"background:#ffffff; padding:20px 35px\"> \t\t\t<p>Hi Ashish Karan,</p> \t\t\t<p>You've received a new scheduled report. {{unsubscribe}}</p> \t\t\t<table> \t\t\t\t<tbody> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Org Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>autotest1</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Scheduled Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>Schedule Test</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Time Period: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>1st Jan, 2017 to 24th Sep, 2017</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Report Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>redDart Report</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t</tbody> \t\t\t</table> \t\t\t<p style=\"font-size:15px; margin-top:25px\">By clicking "View Report" you will be redirected to Capillary Analytics to view the automated report.</p> \t\t\t<a href=\"https://nightly.capillary.in/analytics/v2/report/59c37820e626a10df78c8d91?snapshot=59c8bce750f4e75ec8b0d24c\" style=\"background: #009e0f; text-align: center; color: #fff; font-size: 16px; padding: 10px 25px; cursor: pointer; text-decoration: none; display: block; width: 120px; margin: 25px auto 15px;\" target=\"_blank\">View Report</a></div> \t\t\t<div class=\"email-footer\"> \t\t\t<p style=\"color:grey; font-size:12px; text-align:center\">You've received this mail because you subscribed to Schedule Test schedule of redDart Report. <a href=\"https://nightly.capillary.in/analytics/v2/report/59c37820e626a10df78c8d91/schedule/59c8bce750f4e75ec8b0d24c/unsubscribeSchedule\" style=\"color: blue; cursor: pointer;\" target=\"_blank\">Unsubscribe</a></p> \t\t\t<p><a href=\"http://capillarytech.com/privacy-policy/\" target=\"_blank\">Privacy Policy</a> | <a href=\"http://capillarytech.com/about-us/\" target=\"_blank\">About Capillary</a></p> \t\t\t</div> \t\t\t</td> \t\t</tr> \t</tbody> </table> </body> </html> ","is_drag_drop":false,"drag_drop_id":null},"secondary_templates":[{"is_preview_generated":null,"preview_url":null,"is_favourite":null,"is_drag_drop":false,"drag_drop_id":null,"scope":null,"tag":null,"is_default":null,"html_content":"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <html> <head> \t<title>Scheduled Report</title> \t<meta http-equiv=\"Content-Type\" content=\"text/html charset=UTF-8\"/> \t<style type=\"text/css\">.container-main p{line-height: 1.6;}@media screen and (max-width: 480px){a.brand{font-size: 35px;}}@media screen and (max-width: 480px){.container-main a{text-align: center;}a.brand{text-align: center;}}a.brand img{vertical-align: middle; padding: 0 8px 0 0; width: 250px;}@media screen and (max-width: 480px){a.brand img{width: 220px !important;}}@media screen and (max-width: 480px){.container-content{padding: 15px 20px; font-size: 12px !important;} .email-footer{font-size: 12px !important;}}.container-content table{border-collapse: collapse;}.container-content table tr td p{margin: 5px;}.container-content table tr td p span{font-weight: bold; padding: 0 3px 0 0;}@media screen and (max-width: 480px){a.btn-view-reports{margin: 25px auto 10px;}}a.btn-view-reports:hover{background: grey; color: #fff;}.email-footer p{text-align: center; font-size: 12px; color: grey;}.email-footer p a{color: blue; cursor: pointer;}.email-footer p a:hover{color: grey;} \t</style> </head> <body><center>\n\t\t\t\t\t\t\t\t\t\tIf you have difficulties viewing this mail, click\n\t\t\t\t\t\t\t\t\t\t<a href=\"https://nightly.capillary.in/business_controller/campaigns/emails/links/view.php?utrack={{user_id_b64}}&mtrack={{outbox_id_b64}}\" style = \"text-decoration: underline;color: #369;\" target=\"_blank\">here</a><br/>\n\t\t\t\t\t\t\t\t\t</center> <table class=\"container-main\" style=\"background:#eeeeee; color:#000000; font-family:'Open Sans',sans-serif; font-size:16px; font-weight:400; margin:0 auto; max-width:978px; padding:15px; width:100%\"> \t<tbody> \t\t<tr> \t\t\t<td> \t\t\t<table class=\"email-header\" style=\"background:#ffffff; margin:0 0 5px; padding:17px 0; width:100%\"> \t\t\t\t<tbody> \t\t\t\t\t<tr> \t\t\t\t\t\t<td style=\"width:100%\"><a class=\"brand\" href=\"#\" style=\"display: table; margin: 0 auto; text-decoration: none; font-size: 37px; color: grey;\"><img alt=\"Capillary Technologies\" src=\"https://s3.amazonaws.com/fileservice.in/intouch_creative_assets/60221e2020ba572f6787.png\" /> </a></td> \t\t\t\t\t</tr> \t\t\t\t</tbody> \t\t\t</table> \t\t\t<div class=\"container-content\" style=\"background:#ffffff; padding:20px 35px\"> \t\t\t<p>Hi Ashish Karan,</p> \t\t\t<p>You've received a new scheduled report. {{unsubscribe}}</p> \t\t\t<table> \t\t\t\t<tbody> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Org Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>autotest1</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Scheduled Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>Schedule Test</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Time Period: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>1st Jan, 2017 to 24th Sep, 2017</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Report Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>redDart Report</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t</tbody> \t\t\t</table> \t\t\t<p style=\"font-size:15px; margin-top:25px\">By clicking "View Report" you will be redirected to Capillary Analytics to view the automated report.</p> \t\t\t<a href=\"https://nightly.capillary.in/analytics/v2/report/59c37820e626a10df78c8d91?snapshot=59c8bce750f4e75ec8b0d24c\" style=\"background: #009e0f; text-align: center; color: #fff; font-size: 16px; padding: 10px 25px; cursor: pointer; text-decoration: none; display: block; width: 120px; margin: 25px auto 15px;\" target=\"_blank\">View Report</a></div> \t\t\t<div class=\"email-footer\"> \t\t\t<p style=\"color:grey; font-size:12px; text-align:center\">You've received this mail because you subscribed to Schedule Test schedule of redDart Report. <a href=\"https://nightly.capillary.in/analytics/v2/report/59c37820e626a10df78c8d91/schedule/59c8bce750f4e75ec8b0d24c/unsubscribeSchedule\" style=\"color: blue; cursor: pointer;\" target=\"_blank\">Unsubscribe</a></p> \t\t\t<p><a href=\"http://capillarytech.com/privacy-policy/\" target=\"_blank\">Privacy Policy</a> | <a href=\"http://capillarytech.com/about-us/\" target=\"_blank\">About Capillary</a></p> \t\t\t</div> \t\t\t</td> \t\t</tr> \t</tbody> </table> </body> </html> ","secondary_template_id":"9500","is_base_template":1,"language_name":"English","language":"English","lang_id":"69"}],"edit":true,"tags":[]};
|
|
2466
|
+
// const data = {edit: true, "base":{"subject":"testsubject","html_content":"<html> <head> \t<meta charset=\"utf-8\" /> \t<title>Aster Secure</title> \t<style type=\"text/css\">#outlook a { padding: 0; } body { width: 100% !important; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; margin: 0; padding: 0;} .ExternalClass { width: 100%; } .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; } #backgroundTable { margin: 0; padding: 0; width: 100% !important; line-height: 100% !important; } img { outline: none; text-decoration: none; border: none; -ms-interpolation-mode: bicubic; } a img { border: none; } .image_fix { display: block; } p { margin: 0px 0px !important; } table td { border-collapse: collapse; } table { border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; } table[class=full] { width: 100%; clear: both; } table[class=spacetable] { height: 176px; } table[class=spacetable1] { height: 431px; } table[class=spacetable2] { height: 50px; } table[class=spacetable3] { height: 55px; } \t @media only screen and (min-width: 320px) and (max-width: 540px) { a[href^=\"tel\"], a[href^=\"sms\"] { text-decoration: none; color: #ffffff; pointer-events: none; cursor: default; } .mobile_link a[href^=\"tel\"], .mobile_link a[href^=\"sms\"] { text-decoration: default; color: #ffffff !important; pointer-events: auto; cursor: default; } img[class=logo] { width: 132px!important; } img[class=shop] { width:53px!important; text-align: center!important; } table[class=innerlayer] { width: 300px !important; text-align: center; } img[class=spot] { width: 65px!important; } img[class=banner] { width: 290px !important; text-align: center; } img[class=banner1] { width: 229px!important; } img[class=click] { width:55px!important; } img[class=border] { width: 290px!important; } td[class=txtfont] { font-size:11px!important; height:50px!important; line-height: 15px!important; } \t span[class=txtfont] { font-size:9px!important; height:98px!important; line-height:23px!important; } \t td[class=txtfont1] { font-size:11px!important; height:40px!important; line-height: 14px!important; } img[class=left] { width:195px!important; } img[class=right] { width:46px!important; } \t \t td[class=txtfont3] { font-size:8px!important;} \ttd[class=txtfont2] { font-size:6px!important; line-height:9px!important; } td[class=txtbold] { font-size: 21px!important; } img[class=gap] { width:92px!important; } img[class=gap1] { width: 20px!important; } table[class=social] { width: 99% !important; } img[class=fb] { width:20px!important; } img[class=in] { width:21px!important; } img[class=tw] { width:20px!important; } img[class=pin] { width:41px!important; } \t img[class=and] { width:81px!important; } img[class=my] { width: 44px!important; } \t img[class=you] { width:21px!important; } img[class=store] { width:65px!important; } \t \t img[class=snap] { width:24px!important; } td[class=textlen] { height:52px!important; } \ttd[class=tdlen] \t{ \theight:35px!important;font-size: 10px !important; \t} \t\t\timg[class=a] { width: 42px!important; } \t\t\timg[class=b] { width: 22px!important; } \t\t\timg[class=c] { width: 72px!important; } \t\t\timg[class=d] { width: 50px!important; } \t\t\timg[class=e] { width: 56px!important; } \t\t\timg[class=f] { width: 56px!important; } \t\t\t} \t</style> </head> <body><center>\n\t\t\t\t\t\t\t\t\t\tIf you have difficulties viewing this mail, click\n\t\t\t\t\t\t\t\t\t\t<a href=\"https://nightly.capillary.in/business_controller/campaigns/emails/links/view.php?utrack={{user_id_b64}}&mtrack={{outbox_id_b64}}\" style = \"text-decoration: underline;color: #369;\" target=\"_blank\">here</a><br/>\n\t\t\t\t\t\t\t\t\t</center> <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"outerlayer\" style=\"width:650px\"> \t<tbody> \t\t<tr> \t\t\t<td> \t\t\t<table align=\"center\" bgcolor=\"#fff\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"outerlayer\" style=\"width:650px\"> \t\t\t\t<tbody> \t\t\t\t\t<tr> \t\t\t\t\t\t<td class=\"txtfont2\" height=\"40\" style=\"font-family: Verdana, Geneva, sans-serif; text-align:center; font-size:11px; color:gray; line-height:13px;\" width=\"600\">Shop at Aster Pharmacy this month and You could be the next lucky winner!</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><a href=\"#\" style=\"pointer-events:none;\"><img class=\"banner\" src=\"https://s3-eu-west-1.amazonaws.com/fs.capillary.eu/intouch_creative_assets/890bdffee3b2322d8ec7.jpg\" style=\"border:none; display:block\" /></a></td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td class=\"txtfont2\" height=\"40\" style=\"font-family: Verdana, Geneva, sans-serif; text-align:center; font-size:11px; color:gray; line-height:13px;\" width=\"600\">To remove your email address from our mailing list , please click on {{unsubscribe}}</td> \t\t\t\t\t</tr> \t\t\t\t</tbody> \t\t\t</table> \t\t\t</td> \t\t</tr> \t</tbody> </table> </body> </html> ","is_drag_drop":0,"drag_drop_id":null},"secondary_templates":[{"is_preview_generated":null,"preview_url":null,"is_favourite":null,"is_drag_drop":false,"drag_drop_id":null,"scope":null,"tag":null,"is_default":null,"html_content":"<html>\r\n<head>\r\n\t<meta charset=\"utf-8\" />\r\n\t<title>Aster Secure</title>\r\n\t<style type=\"text/css\">#outlook a { padding: 0; } body { width: 100% !important; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; margin: 0; padding: 0;} .ExternalClass { width: 100%; } .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; } #backgroundTable { margin: 0; padding: 0; width: 100% !important; line-height: 100% !important; } img { outline: none; text-decoration: none; border: none; -ms-interpolation-mode: bicubic; } a img { border: none; } .image_fix { display: block; } p { margin: 0px 0px !important; } table td { border-collapse: collapse; } table { border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; } table[class=full] { width: 100%; clear: both; } table[class=spacetable] { height: 176px; } table[class=spacetable1] { height: 431px; } table[class=spacetable2] { height: 50px; } table[class=spacetable3] { height: 55px; } \t @media only screen and (min-width: 320px) and (max-width: 540px) { a[href^=\"tel\"], a[href^=\"sms\"] { text-decoration: none; color: #ffffff; pointer-events: none; cursor: default; } .mobile_link a[href^=\"tel\"], .mobile_link a[href^=\"sms\"] { text-decoration: default; color: #ffffff !important; pointer-events: auto; cursor: default; } img[class=logo] { width: 132px!important; } img[class=shop] { width:53px!important; text-align: center!important; } table[class=innerlayer] { width: 300px !important; text-align: center; } img[class=spot] { width: 65px!important; } img[class=banner] { width: 290px !important; text-align: center; } img[class=banner1] { width: 229px!important; } img[class=click] { width:55px!important; } img[class=border] { width: 290px!important; } td[class=txtfont] { font-size:11px!important; height:50px!important; line-height: 15px!important; } \t span[class=txtfont] { font-size:9px!important; height:98px!important; line-height:23px!important; } \t td[class=txtfont1] { font-size:11px!important; height:40px!important; line-height: 14px!important; } img[class=left] { width:195px!important; } img[class=right] { width:46px!important; } \t \t td[class=txtfont3] { font-size:8px!important;} \ttd[class=txtfont2] { font-size:6px!important; line-height:9px!important; } td[class=txtbold] { font-size: 21px!important; } img[class=gap] { width:92px!important; } img[class=gap1] { width: 20px!important; } table[class=social] { width: 99% !important; } img[class=fb] { width:20px!important; } img[class=in] { width:21px!important; } img[class=tw] { width:20px!important; } img[class=pin] { width:41px!important; } \t img[class=and] { width:81px!important; } img[class=my] { width: 44px!important; } \t img[class=you] { width:21px!important; } img[class=store] { width:65px!important; } \t \t img[class=snap] { width:24px!important; } td[class=textlen] { height:52px!important; } \ttd[class=tdlen] \t{ \theight:35px!important;font-size: 10px !important; \t} \t\t\timg[class=a] { width: 42px!important; } \t\t\timg[class=b] { width: 22px!important; } \t\t\timg[class=c] { width: 72px!important; } \t\t\timg[class=d] { width: 50px!important; } \t\t\timg[class=e] { width: 56px!important; } \t\t\timg[class=f] { width: 56px!important; } \t\t\t}\r\n\t</style>\r\n</head>\r\n<body>\r\n<table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"outerlayer\" style=\"width:650px\">\r\n\t<tbody>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t<table align=\"center\" bgcolor=\"#fff\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"outerlayer\" style=\"width:650px\">\r\n\t\t\t\t<tbody>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td class=\"txtfont2\" height=\"40\" style=\"font-family: Verdana, Geneva, sans-serif; text-align:center; font-size:11px; color:gray; line-height:13px;\" width=\"600\">Shop at Aster Pharmacy this month and You could be the next lucky winner!</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td><a href=\"#\" style=\"pointer-events:none;\"><img class=\"banner\" src=\"https://s3-eu-west-1.amazonaws.com/fs.capillary.eu/intouch_creative_assets/890bdffee3b2322d8ec7.jpg\" style=\"border:none; display:block\" /></a></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td class=\"txtfont2\" height=\"40\" style=\"font-family: Verdana, Geneva, sans-serif; text-align:center; font-size:11px; color:gray; line-height:13px;\" width=\"600\">To remove your email address from our mailing list , please click on {{unsubscribe}}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</tbody>\r\n\t\t\t</table>\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</tbody>\r\n</table>\r\n</body>\r\n</html>\r\n","secondary_template_id":"9584","is_base_template":1,"language_name":"English","language":"English","lang_id":"69"}, {"is_preview_generated":null,"preview_url":null,"is_favourite":null,"is_drag_drop":false,"drag_drop_id":null,"scope":null,"tag":null,"is_default":null,"html_content":"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <html> <head> \t<title>Scheduled Report</title> \t<meta http-equiv=\"Content-Type\" content=\"text/html charset=UTF-8\"/> \t<style type=\"text/css\">.container-main p{line-height: 1.6;}@media screen and (max-width: 480px){a.brand{font-size: 35px;}}@media screen and (max-width: 480px){.container-main a{text-align: center;}a.brand{text-align: center;}}a.brand img{vertical-align: middle; padding: 0 8px 0 0; width: 250px;}@media screen and (max-width: 480px){a.brand img{width: 220px !important;}}@media screen and (max-width: 480px){.container-content{padding: 15px 20px; font-size: 12px !important;} .email-footer{font-size: 12px !important;}}.container-content table{border-collapse: collapse;}.container-content table tr td p{margin: 5px;}.container-content table tr td p span{font-weight: bold; padding: 0 3px 0 0;}@media screen and (max-width: 480px){a.btn-view-reports{margin: 25px auto 10px;}}a.btn-view-reports:hover{background: grey; color: #fff;}.email-footer p{text-align: center; font-size: 12px; color: grey;}.email-footer p a{color: blue; cursor: pointer;}.email-footer p a:hover{color: grey;} \t</style> </head> <body><center>\n\t\t\t\t\t\t\t\t\t\tIf you have difficulties viewing this mail, click\n\t\t\t\t\t\t\t\t\t\t<a href=\"https://nightly.capillary.in/business_controller/campaigns/emails/links/view.php?utrack={{user_id_b64}}&mtrack={{outbox_id_b64}}\" style = \"text-decoration: underline;color: #369;\" target=\"_blank\">here</a><br/>\n\t\t\t\t\t\t\t\t\t</center> <table class=\"container-main\" style=\"background:#eeeeee; color:#000000; font-family:'Open Sans',sans-serif; font-size:16px; font-weight:400; margin:0 auto; max-width:978px; padding:15px; width:100%\"> \t<tbody> \t\t<tr> \t\t\t<td> \t\t\t<table class=\"email-header\" style=\"background:#ffffff; margin:0 0 5px; padding:17px 0; width:100%\"> \t\t\t\t<tbody> \t\t\t\t\t<tr> \t\t\t\t\t\t<td style=\"width:100%\"><a class=\"brand\" href=\"#\" style=\"display: table; margin: 0 auto; text-decoration: none; font-size: 37px; color: grey;\"><img alt=\"Capillary Technologies\" src=\"https://s3.amazonaws.com/fileservice.in/intouch_creative_assets/60221e2020ba572f6787.png\" /> </a></td> \t\t\t\t\t</tr> \t\t\t\t</tbody> \t\t\t</table> \t\t\t<div class=\"container-content\" style=\"background:#ffffff; padding:20px 35px\"> \t\t\t<p>Hi Ashish Karan,</p> \t\t\t<p>You've received a new scheduled report. {{unsubscribe}}</p> \t\t\t<table> \t\t\t\t<tbody> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Org Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>autotest1</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Scheduled Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>Schedule Test</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Time Period: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>1st Jan, 2017 to 24th Sep, 2017</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Report Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>redDart Report</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t</tbody> \t\t\t</table> \t\t\t<p style=\"font-size:15px; margin-top:25px\">By clicking "View Report" you will be redirected to Capillary Analytics to view the automated report.</p> \t\t\t<a href=\"https://nightly.capillary.in/analytics/v2/report/59c37820e626a10df78c8d91?snapshot=59c8bce750f4e75ec8b0d24c\" style=\"background: #009e0f; text-align: center; color: #fff; font-size: 16px; padding: 10px 25px; cursor: pointer; text-decoration: none; display: block; width: 120px; margin: 25px auto 15px;\" target=\"_blank\">View Report</a></div> \t\t\t<div class=\"email-footer\"> \t\t\t<p style=\"color:grey; font-size:12px; text-align:center\">You've received this mail because you subscribed to Schedule Test schedule of redDart Report. <a href=\"https://nightly.capillary.in/analytics/v2/report/59c37820e626a10df78c8d91/schedule/59c8bce750f4e75ec8b0d24c/unsubscribeSchedule\" style=\"color: blue; cursor: pointer;\" target=\"_blank\">Unsubscribe</a></p> \t\t\t<p><a href=\"http://capillarytech.com/privacy-policy/\" target=\"_blank\">Privacy Policy</a> | <a href=\"http://capillarytech.com/about-us/\" target=\"_blank\">About Capillary</a></p> \t\t\t</div> \t\t\t</td> \t\t</tr> \t</tbody> </table> </body> </html> ","secondary_template_id":"9500","is_base_template":false,"language_name":"Hindi","language":"Hindi","lang_id":"151"},{"is_preview_generated":null,"preview_url":null,"is_favourite":null,"is_drag_drop":1,"drag_drop_id":"55acf47048a85bbf7681a35a","scope":null,"tag":null,"is_default":null,"html_content":"","secondary_template_id":"9500","is_base_template":0,"language_name":"Japanese","language":"Japanese","lang_id":"100"}]};
|
|
2065
2467
|
console.log('Start template creation ', data);
|
|
2066
2468
|
if (data && data.edit) {
|
|
2067
2469
|
console.log('startTemplateCreation');
|
|
@@ -2071,20 +2473,27 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2071
2473
|
let tabKey;
|
|
2072
2474
|
if (this.props.location.query.type === 'embedded' && !this.props.location.query.isLanguageSupport) {
|
|
2073
2475
|
formData['template-subject'] = data.base.subject ? data.base.subject : '';
|
|
2074
|
-
const
|
|
2476
|
+
const baseLanguage = this.props.Global.currentOrgDetails.basic_details.base_language;
|
|
2477
|
+
let languageIndex = _.findIndex(this.supportedLanguages, {iso_code: baseLanguage});
|
|
2478
|
+
console.log("startTemplatecreation before index", languageIndex, this.supportedLanguages, baseLanguage, formData);
|
|
2479
|
+
if (languageIndex === -1) {
|
|
2480
|
+
languageIndex = 0;
|
|
2481
|
+
}
|
|
2075
2482
|
const tempData = {
|
|
2076
2483
|
"is_drag_drop": data.base.is_drag_drop,
|
|
2077
2484
|
"lang_id": this.supportedLanguages[languageIndex].lang_id,
|
|
2078
2485
|
"iso_code": this.supportedLanguages[languageIndex].iso_code,
|
|
2079
2486
|
"language": this.supportedLanguages[languageIndex].language,
|
|
2080
|
-
"template-content": data.base.html_content,
|
|
2487
|
+
"template-content": !data.base.is_drag_drop && data.base.is_drag_drop !== 1 ? data.base.html_content : "",
|
|
2081
2488
|
};
|
|
2082
2489
|
formData[0].base = true;
|
|
2083
2490
|
formData[0].selectedLanguages.push(this.supportedLanguages[languageIndex].iso_code);
|
|
2084
2491
|
formData[0][this.supportedLanguages[languageIndex].iso_code] = tempData;
|
|
2085
2492
|
formData[0].activeTab = this.supportedLanguages[languageIndex].iso_code;
|
|
2086
2493
|
tabKey = "2";
|
|
2494
|
+
console.log("start Template creation midway data", formData, languageIndex);
|
|
2087
2495
|
} else {
|
|
2496
|
+
const additionalLanguages = [];
|
|
2088
2497
|
_.forEach(data.secondary_templates, (templates) => {
|
|
2089
2498
|
console.log('creating form data', templates);
|
|
2090
2499
|
const id = "1";
|
|
@@ -2094,7 +2503,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2094
2503
|
languageIndex = 0;
|
|
2095
2504
|
}
|
|
2096
2505
|
const tempData = {
|
|
2097
|
-
"is_drag_drop": templates.is_drag_drop,
|
|
2506
|
+
"is_drag_drop": templates.is_drag_drop === "1" || false,
|
|
2098
2507
|
"lang_id": this.supportedLanguages[languageIndex].lang_id,
|
|
2099
2508
|
"iso_code": this.supportedLanguages[languageIndex].iso_code,
|
|
2100
2509
|
"language": this.supportedLanguages[languageIndex].language,
|
|
@@ -2102,6 +2511,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2102
2511
|
};
|
|
2103
2512
|
if (templates.drag_drop_id) {
|
|
2104
2513
|
tempData.drag_drop_id = templates.drag_drop_id;
|
|
2514
|
+
this.props.actions.getCmsSetting('edm', tempData.drag_drop_id, 'open', tempData.iso_code);
|
|
2105
2515
|
}
|
|
2106
2516
|
// formData.usingTabContainer = true;
|
|
2107
2517
|
// formData.tabCount = 1;
|
|
@@ -2112,16 +2522,24 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2112
2522
|
formData[0].base = true;
|
|
2113
2523
|
formData[0].selectedLanguages.push(this.supportedLanguages[languageIndex].iso_code);
|
|
2114
2524
|
formData[0][this.supportedLanguages[languageIndex].iso_code] = tempData;
|
|
2115
|
-
if (templates.is_base_template) {
|
|
2525
|
+
if (templates.is_base_template === 1) {
|
|
2116
2526
|
formData[0].activeTab = this.supportedLanguages[languageIndex].iso_code;
|
|
2117
2527
|
// formData.base = tempData;
|
|
2528
|
+
} else {
|
|
2529
|
+
additionalLanguages.push(this.supportedLanguages[languageIndex]);
|
|
2118
2530
|
}
|
|
2119
2531
|
});
|
|
2532
|
+
this.addLanguage(false, formData, false, additionalLanguages);
|
|
2120
2533
|
}
|
|
2121
2534
|
formData.base = _.cloneDeep(formData[0]);
|
|
2122
2535
|
console.log('startTemplateCreation final ', formData);
|
|
2123
2536
|
this.setState({formData, loading: false, injectedTags: data.tags, tabKey, isDragDrop: (data.base.is_drag_drop !== 0 )}, () => {
|
|
2124
2537
|
// this.setState({tabKey: ''});
|
|
2538
|
+
_.forEach(formData[0].selectedLanguages, (language) => {
|
|
2539
|
+
if (formData[0][language].is_drag_drop) {
|
|
2540
|
+
this.props.actions.getCmsSetting('edm', formData[0][language].drag_drop_id, 'open', language);
|
|
2541
|
+
}
|
|
2542
|
+
});
|
|
2125
2543
|
});
|
|
2126
2544
|
} else {
|
|
2127
2545
|
this.setState({injectedTags: data.tags});
|
|
@@ -2318,7 +2736,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2318
2736
|
// return;
|
|
2319
2737
|
// }
|
|
2320
2738
|
const formData = _.cloneDeep(passedData);
|
|
2321
|
-
console.log('Saving form data', formData, this.state.tabCount);
|
|
2739
|
+
console.log('Saving form data', JSON.stringify(formData), this.state.tabCount);
|
|
2322
2740
|
const obj = {};
|
|
2323
2741
|
obj.versions = {
|
|
2324
2742
|
base: {},
|
|
@@ -2383,22 +2801,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2383
2801
|
}
|
|
2384
2802
|
|
|
2385
2803
|
handleOk = () => {
|
|
2386
|
-
const
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
temp.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = {display: "none"};
|
|
2395
|
-
temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[3].cols[0].style = {display: "none"};
|
|
2396
|
-
}
|
|
2397
|
-
});
|
|
2398
|
-
|
|
2399
|
-
console.log('Handle OK ', schema);
|
|
2400
|
-
this.setState({ schema, showConfirmationModal: false, isSchemaChanged: true }, () => {
|
|
2401
|
-
this.injectEvents(schema);
|
|
2804
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
2805
|
+
const activeLangTab = formData[`${this.state.currentTab - 1}`].activeTab;
|
|
2806
|
+
const langIndex = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(activeLangTab);
|
|
2807
|
+
console.log('switching editor midway', activeLangTab, langIndex, formData);
|
|
2808
|
+
this.setState({mode: "switchEditor"}, () => {
|
|
2809
|
+
console.log('posting message for switching editor', `edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`);
|
|
2810
|
+
const win = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`).contentWindow;
|
|
2811
|
+
win.postMessage("saveProject", '*');
|
|
2402
2812
|
});
|
|
2403
2813
|
}
|
|
2404
2814
|
|
|
@@ -2507,7 +2917,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2507
2917
|
</div>
|
|
2508
2918
|
);
|
|
2509
2919
|
const schema = this.state.schema;
|
|
2510
|
-
const spinning = this.state.loading || (this.props.Email && "createTemplateInProgress" in this.props.Email && this.props.Email.createTemplateInProgress)
|
|
2920
|
+
const spinning = this.state.loading || (this.props.Email && "createTemplateInProgress" in this.props.Email && this.props.Email.createTemplateInProgress) || (this.props.Email.assetUploading !== undefined && this.props.Email.assetUploading);
|
|
2511
2921
|
const previewHeader = (<h3>Email Preview</h3>);
|
|
2512
2922
|
const imagePreviewHeader = (<h3>Image Selection</h3>);
|
|
2513
2923
|
const imagePreviewContent = (
|
|
@@ -2515,7 +2925,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2515
2925
|
<div>
|
|
2516
2926
|
<form encType="multipart/form-data" id="myForm">
|
|
2517
2927
|
<input style={{ display: 'none'}} id="fileName" type="file" onChange={(e) => this.uploadImages(e, {files: e.target.files})} accept="image/*" />
|
|
2518
|
-
<CapButton type={'secondary'} onClick={(e) => this.openFileDialog(e)} style={{float: 'right'}}>
|
|
2928
|
+
<CapButton type={'secondary'} onClick={(e) => this.openFileDialog(e)} style={{float: 'right', marginRight: '24px'}}>
|
|
2519
2929
|
<FormattedMessage {...messages.upload} />
|
|
2520
2930
|
</CapButton>
|
|
2521
2931
|
</form>
|
|
@@ -2537,7 +2947,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2537
2947
|
return (<div>Loading...</div>);
|
|
2538
2948
|
}
|
|
2539
2949
|
console.log('CMS Data ', this.props.Email.CmsSettings, this.props.Global.currentOrgDetails.basic_details.supported_languages);
|
|
2540
|
-
|
|
2950
|
+
let loaderText = this.props.Email.createTemplateInProgress ? this.props.intl.formatMessage(messages.saveTemplateLoader) : this.props.intl.formatMessage(messages.templateLoader);
|
|
2951
|
+
if (this.props.Email.assetUploading) {
|
|
2952
|
+
loaderText = this.props.intl.formatMessage(messages.uploadingImage);
|
|
2953
|
+
}
|
|
2541
2954
|
return (
|
|
2542
2955
|
<div className="email-container">
|
|
2543
2956
|
<Helmet
|
|
@@ -2606,6 +3019,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2606
3019
|
toggleEdmEmailTemplateSelection={this.toggleEdmEmailTemplateSelection}
|
|
2607
3020
|
handleEdmDefaultTemplateSelection={this.handleEdmDefaultTemplateSelection}
|
|
2608
3021
|
setModalContent={this.setModalContent}
|
|
3022
|
+
addLanguageType={this.state.addLanguageType}
|
|
2609
3023
|
/> : ''}
|
|
2610
3024
|
</Col>
|
|
2611
3025
|
</Row>
|
|
@@ -2643,7 +3057,8 @@ Email.propTypes = {
|
|
|
2643
3057
|
metaEntities: PropTypes.object,
|
|
2644
3058
|
Global: PropTypes.object,
|
|
2645
3059
|
templatesActions: PropTypes.object,
|
|
2646
|
-
|
|
3060
|
+
route: PropTypes.object,
|
|
3061
|
+
templateDate: PropTypes.object,
|
|
2647
3062
|
};
|
|
2648
3063
|
|
|
2649
3064
|
const mapStateToProps = createStructuredSelector({
|