@capillarytech/creatives-library 0.0.4 → 0.0.6
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 +11 -3
- package/components/Ckeditor/index.js +20 -17
- package/components/CustomPopOver/index.js +4 -1
- package/components/EmailPreview/index.js +1 -1
- package/components/FormBuilder/index.js +225 -71
- package/components/TemplatePreview/index.js +3 -0
- 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 +595 -158
- package/containers/Email/messages.js +12 -0
- package/containers/Email/reducer.js +4 -1
- package/containers/Email/selectors.js +7 -1
- package/containers/Sms/Create/index.js +3 -3
- package/containers/Templates/actions.js +13 -0
- package/containers/Templates/constants.js +2 -1
- package/containers/Templates/index.js +57 -57
- package/containers/Templates/messages.js +1 -1
- package/containers/Templates/reducer.js +9 -2
- package/initialState.js +6 -0
- package/package.json +2 -1
- package/reducers.js +4 -0
- package/routes.js +24 -2
- 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 === 'library' && 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 && apiLangId !== "undefined") {
|
|
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, ' '));
|
|
@@ -1109,7 +1197,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1109
1197
|
e.source.postMessage(JSON.stringify(response), e.origin);
|
|
1110
1198
|
}
|
|
1111
1199
|
return response;
|
|
1112
|
-
}
|
|
1200
|
+
}
|
|
1113
1201
|
|
|
1114
1202
|
setFormValidity = (isFormValid) => {
|
|
1115
1203
|
this.setState({isFormValid});
|
|
@@ -1120,10 +1208,12 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1120
1208
|
const formData = _.cloneDeep(this.state.formData);
|
|
1121
1209
|
|
|
1122
1210
|
const tabIndex = this.state.currentTab + 1;
|
|
1123
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
1211
|
+
const schema = (this.props.location.query.type === 'embedded') ? this.removeStandAlone() : _.cloneDeep(this.state.schema);
|
|
1124
1212
|
const containers = _.cloneDeep(schema.containers.slice());
|
|
1125
1213
|
let tabKey = "";
|
|
1126
1214
|
let currentTab = _.cloneDeep(this.state.currentTab);
|
|
1215
|
+
const isLanguageSupport = this.props.location.query.isLanguageSupport;
|
|
1216
|
+
const type = this.props.location.query.type;
|
|
1127
1217
|
|
|
1128
1218
|
formData['template-name'] = editData.name;
|
|
1129
1219
|
formData.base = editData.versions.base;
|
|
@@ -1131,7 +1221,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1131
1221
|
_.forEach(editData.versions.history, (data1, index) => {
|
|
1132
1222
|
const data = _.cloneDeep(data1);
|
|
1133
1223
|
if (data !== null) {
|
|
1134
|
-
if (index > 0) {
|
|
1224
|
+
if (index > 0 && (isLanguageSupport || this.props.location.query.type !== 'embedded')) {
|
|
1135
1225
|
const firstPane = _.cloneDeep(containers[0].panes[0]);
|
|
1136
1226
|
// schema.containers[this.state.currentTab - 1].isActive = false;
|
|
1137
1227
|
const sections = [];
|
|
@@ -1193,11 +1283,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1193
1283
|
schema.containers[index].isActive = false;
|
|
1194
1284
|
console.log('Dummy Random ', schema.containers[index].isActive, index);
|
|
1195
1285
|
}
|
|
1196
|
-
|
|
1286
|
+
// const isLanguageSupport = this.props.location.query.isLanguageSupport;
|
|
1197
1287
|
console.log('Schema Test ', schema, schema.containers[index]);
|
|
1198
1288
|
_.forEach(data.selectedLanguages, (lang, langIndex) => {
|
|
1199
1289
|
console.log('Language ', lang, langIndex);
|
|
1200
|
-
if (lang !== this.props.Global.currentOrgDetails.basic_details.base_language) {
|
|
1290
|
+
if ((type !== 'embedded' || (type === 'embedded' && isLanguageSupport === 'true')) && lang !== this.props.Global.currentOrgDetails.basic_details.base_language) {
|
|
1201
1291
|
const tabContent = _.cloneDeep(containers[0].tabContent.sections[0]);
|
|
1202
1292
|
const tabContentSection = tabContent.inputFields[0].cols[0];
|
|
1203
1293
|
const panes = containers[0].panes.slice();
|
|
@@ -1229,14 +1319,20 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1229
1319
|
// panes.push(firstPane);
|
|
1230
1320
|
console.log('initial panes', JSON.stringify(this.state.schema.containers));
|
|
1231
1321
|
schema.containers[index].panes.push(firstPane);
|
|
1322
|
+
} else if (lang !== this.props.Global.currentOrgDetails.basic_details.base_language) {
|
|
1323
|
+
delete data[lang];
|
|
1324
|
+
data.selectedLanguages.splice(langIndex, 1);
|
|
1232
1325
|
}
|
|
1233
1326
|
});
|
|
1234
1327
|
}
|
|
1328
|
+
if (data.base) {
|
|
1329
|
+
formData.base = data;
|
|
1330
|
+
}
|
|
1235
1331
|
formData[index] = data;
|
|
1236
1332
|
}
|
|
1237
1333
|
});
|
|
1238
1334
|
|
|
1239
|
-
_.forEach(
|
|
1335
|
+
_.forEach(formData.base.selectedLanguages, (language) => {
|
|
1240
1336
|
if (formData.base.tabKey === formData.base[language].tabKey) {
|
|
1241
1337
|
formData.base.activeTab = language;
|
|
1242
1338
|
}
|
|
@@ -1258,6 +1354,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1258
1354
|
}
|
|
1259
1355
|
});
|
|
1260
1356
|
console.log('final form data edit', formData);
|
|
1357
|
+
// this.resetCkEditorInstance(this.state.currentTab - 1, formData);
|
|
1261
1358
|
// this.setState({formData});
|
|
1262
1359
|
});
|
|
1263
1360
|
}
|
|
@@ -1277,35 +1374,207 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1277
1374
|
parent.postMessage(JSON.stringify(response), '*');
|
|
1278
1375
|
}
|
|
1279
1376
|
|
|
1280
|
-
getEditorInstanse = (instance) => {
|
|
1281
|
-
console.log('Got editor Instance ', instance);
|
|
1282
|
-
this.setState({editorInstanse: instance});
|
|
1377
|
+
getEditorInstanse = (instance, id) => {
|
|
1378
|
+
console.log('Got editor Instance ', instance, id);
|
|
1379
|
+
//this.setState({editorInstanse: instance});
|
|
1283
1380
|
}
|
|
1284
1381
|
|
|
1285
|
-
setModalContent = (type) => {
|
|
1382
|
+
setModalContent = (type, data) => {
|
|
1383
|
+
let modalContent = {};
|
|
1286
1384
|
if (type === 'delete-version') {
|
|
1287
|
-
|
|
1385
|
+
modalContent = {
|
|
1288
1386
|
title: "Alert",
|
|
1289
1387
|
body: "Do you really want to delete this version?",
|
|
1290
1388
|
type: 'confirm',
|
|
1291
1389
|
id: 'email-version-delete-modal',
|
|
1292
1390
|
};
|
|
1293
|
-
this.setState({modalContent, showModal: true});
|
|
1294
1391
|
} else if (type === 'delete-language') {
|
|
1295
|
-
|
|
1392
|
+
modalContent = {
|
|
1296
1393
|
title: "Alert",
|
|
1297
1394
|
body: "Do you really want to delete this language?",
|
|
1298
1395
|
type: 'confirm',
|
|
1299
1396
|
id: 'email-language-delete-modal',
|
|
1300
1397
|
};
|
|
1301
|
-
|
|
1398
|
+
} else if (type === 'add-language') {
|
|
1399
|
+
const jsx = (
|
|
1400
|
+
<div>
|
|
1401
|
+
<div><CapButton type="secondary" style={{width: "100%", marginBottom: "8px"}} onClick={this.uploadFile}>Upload File</CapButton>
|
|
1402
|
+
<input type="file" id="filename" style={{ display: 'none'}} accept=".zip, .html, .htm" onChange={(event) => this.handleFileUpload(event, {files: event.target.files})} />
|
|
1403
|
+
</div>
|
|
1404
|
+
<div><CapButton type="secondary" style={{width: "100%", marginBottom: "8px"}} onClick={this.useEditor}>Use Editor</CapButton></div>
|
|
1405
|
+
<div><CapButton type="secondary" style={{width: "100%", marginBottom: "8px"}} onClick={this.copyPrimaryLanguage}>Copy primary Language</CapButton></div>
|
|
1406
|
+
</div>);
|
|
1407
|
+
modalContent = {
|
|
1408
|
+
title: "New Language",
|
|
1409
|
+
type: "action",
|
|
1410
|
+
jsx,
|
|
1411
|
+
id: 'email-add-language-options',
|
|
1412
|
+
};
|
|
1413
|
+
this.setState({settingLanguage: data});
|
|
1302
1414
|
}
|
|
1415
|
+
this.setState({ modalContent, showModal: true});
|
|
1416
|
+
};
|
|
1417
|
+
|
|
1418
|
+
resetStateValue = () => {
|
|
1419
|
+
this.setState({
|
|
1420
|
+
formData: {},
|
|
1421
|
+
tabCount: 1,
|
|
1422
|
+
currentTab: 1,
|
|
1423
|
+
isEdit: false,
|
|
1424
|
+
schema: {},
|
|
1425
|
+
loading: false,
|
|
1426
|
+
isFormValid: true,
|
|
1427
|
+
injectedTags: {},
|
|
1428
|
+
checkValidation: false,
|
|
1429
|
+
tabKey: '',
|
|
1430
|
+
showEmailPreview: false,
|
|
1431
|
+
device: "desktop",
|
|
1432
|
+
editorInstanse: undefined,
|
|
1433
|
+
showImageSelectionBox: false,
|
|
1434
|
+
isDragDrop: false,
|
|
1435
|
+
showConfirmationModal: false,
|
|
1436
|
+
modalContent: {title: "Alert", body: "Do you really want to delete this language?", type: 'confirm', id: 'email-language-delete-modal'},
|
|
1437
|
+
showModal: false,
|
|
1438
|
+
page: 1,
|
|
1439
|
+
perPageLimit: 25,
|
|
1440
|
+
totalCount: 0,
|
|
1441
|
+
searchText: '',
|
|
1442
|
+
saveCount: 0,
|
|
1443
|
+
targetSaveCount: 0,
|
|
1444
|
+
saveObj: {},
|
|
1445
|
+
showEdmEmailTemplates: false,
|
|
1446
|
+
editDataSet: false,
|
|
1447
|
+
}, () => {
|
|
1448
|
+
console.log('Unmount value cleared', this.state);
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
resetCkEditorInstance = (data, formData, onInsert, value, isImage) => {
|
|
1453
|
+
const currentLang = formData[`${data - 1}`].selectedLanguages.indexOf(formData[`${data - 1}`].activeTab);
|
|
1454
|
+
const langIndex = formData[`${data - 1}`].selectedLanguages.indexOf(formData[`${data - 1}`].activeTab);
|
|
1455
|
+
let instance1 = window.CKEDITOR.instances[`editor${currentLang + 1}`];
|
|
1456
|
+
const instanceCount = 0;
|
|
1457
|
+
const instanceArray = [];
|
|
1458
|
+
_.forEach(window.CKEDITOR.instances, (instance, index) => {
|
|
1459
|
+
console.log('all ck instances ', instance, index, instanceCount, langIndex);
|
|
1460
|
+
const name = instance.name;
|
|
1461
|
+
if (instance.status === "destroyed") {
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1464
|
+
let instanceIdx = 0;
|
|
1465
|
+
if (name.indexOf('template-content') > -1 && name !== 'template-content') {
|
|
1466
|
+
instanceIdx = parseInt(name.replace('template-content', ''), 10) - 1;
|
|
1467
|
+
const obj = {
|
|
1468
|
+
idx: instanceIdx,
|
|
1469
|
+
instance,
|
|
1470
|
+
};
|
|
1471
|
+
instanceArray.push(obj);
|
|
1472
|
+
} else {
|
|
1473
|
+
const obj = {
|
|
1474
|
+
idx: 0,
|
|
1475
|
+
instance,
|
|
1476
|
+
};
|
|
1477
|
+
instanceArray.push(obj);
|
|
1478
|
+
}
|
|
1479
|
+
});
|
|
1480
|
+
console.log('sorted instance array before sort', instanceArray);
|
|
1481
|
+
instanceArray.sort( (a, b) => {
|
|
1482
|
+
const idxA = a.idx;
|
|
1483
|
+
const idxB = b.idx;
|
|
1484
|
+
if (idxA < idxB) {
|
|
1485
|
+
return -1;
|
|
1486
|
+
} else if (idxA > idxB) {
|
|
1487
|
+
return 1;
|
|
1488
|
+
}
|
|
1489
|
+
return 0;
|
|
1490
|
+
});
|
|
1491
|
+
console.log('sorted instance array after sort', instanceArray);
|
|
1492
|
+
//instanceCount += 1;
|
|
1493
|
+
// if (instanceIdx === langIndex) {
|
|
1494
|
+
const instance = instanceArray[langIndex].instance;
|
|
1495
|
+
console.log('setting instance as ', instance, instance.name);
|
|
1496
|
+
instance1 = instance;
|
|
1497
|
+
this.setState({editorInstanse: instance1}, () => {
|
|
1498
|
+
if (onInsert && !isImage) {
|
|
1499
|
+
this.state.editorInstanse.insertHtml(`{{${value}}}`);
|
|
1500
|
+
} else if (onInsert) {
|
|
1501
|
+
this.state.editorInstanse.insertHtml(`<img src='${value.metaInfo.secure_file_path}' alt='Capillary Image'>`);
|
|
1502
|
+
}
|
|
1503
|
+
});
|
|
1303
1504
|
}
|
|
1304
1505
|
|
|
1506
|
+
uploadFile = () => {
|
|
1507
|
+
console.log('uploadFile');
|
|
1508
|
+
document.getElementById('filename').click();
|
|
1509
|
+
console.log('Upload File initiated');
|
|
1510
|
+
};
|
|
1511
|
+
|
|
1512
|
+
useEditor = () => {
|
|
1513
|
+
console.log('useEditor');
|
|
1514
|
+
//this.toggleEdmEmailTemplateSelection();
|
|
1515
|
+
this.setState({addLanguageType: "useEditor"}, () => {
|
|
1516
|
+
this.setState({showModal: false}, () => {
|
|
1517
|
+
this.toggleEdmEmailTemplateSelection();
|
|
1518
|
+
});
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
copyPrimaryLanguage = () => {
|
|
1523
|
+
console.log('copy primary language');
|
|
1524
|
+
this.setState({addLanguageType: "copyPrimaryLanguage"}, () => {
|
|
1525
|
+
this.setState({showModal: false});
|
|
1526
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
1527
|
+
const currentTab = this.state.currentTab - 1;
|
|
1528
|
+
const baseLanguage = this.props.Global.currentOrgDetails.basic_details.base_language ? this.props.Global.currentOrgDetails.basic_details.base_language : 'en';
|
|
1529
|
+
if (formData[currentTab][baseLanguage].is_drag_drop) {
|
|
1530
|
+
this.props.actions.getCmsSetting('edm', formData[currentTab][baseLanguage].drag_drop_id, 'duplicate', baseLanguage);
|
|
1531
|
+
}
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
handleFileUpload = (e, {files}) => {
|
|
1536
|
+
if (files.length === 0) {
|
|
1537
|
+
return;
|
|
1538
|
+
}
|
|
1539
|
+
const fileExtension = files[0].name.split('.').pop();
|
|
1540
|
+
const supportedZipFormats = ['zip'];
|
|
1541
|
+
console.log('File Params ', fileExtension);
|
|
1542
|
+
if (supportedZipFormats.indexOf(fileExtension.toLowerCase()) !== -1) {
|
|
1543
|
+
this.setState({ addLanguageType: "upload"}, () => {
|
|
1544
|
+
console.log('Zip Format got');
|
|
1545
|
+
this.props.templatesActions.handleZipUpload(files[0]);
|
|
1546
|
+
document.getElementById("filename").value = "";
|
|
1547
|
+
this.setState({showModal: false});
|
|
1548
|
+
});
|
|
1549
|
+
} else if (fileExtension === 'html' || fileExtension === 'htm') {
|
|
1550
|
+
console.log('html Format got');
|
|
1551
|
+
const reader = new FileReader();
|
|
1552
|
+
reader.onload = () => {
|
|
1553
|
+
this.setState({ addLanguageType: "upload"}, () => {
|
|
1554
|
+
const text = reader.result;
|
|
1555
|
+
this.props.templatesActions.handleHtmlUpload(text);
|
|
1556
|
+
document.getElementById("filename").value = "";
|
|
1557
|
+
this.setState({showModal: false});
|
|
1558
|
+
});
|
|
1559
|
+
};
|
|
1560
|
+
reader.readAsText(files[0]);
|
|
1561
|
+
} else {
|
|
1562
|
+
alert('Invalid file type added! Please Give a proper zip/html file');
|
|
1563
|
+
console.log('Invalid file type added! Please Give a proper zip/html file');
|
|
1564
|
+
}
|
|
1565
|
+
};
|
|
1566
|
+
|
|
1305
1567
|
uploadImages(e, {files}) {
|
|
1306
1568
|
e.preventDefault();
|
|
1307
1569
|
const _URL = window.URL || window.webkitURL;
|
|
1308
1570
|
const file = files[0];
|
|
1571
|
+
const fileSize = (file.size / ( 1024 * 1024 ));
|
|
1572
|
+
if (fileSize > 5) {
|
|
1573
|
+
const message = getMessageObject('error', this.props.intl.formatMessage(messages.uploadSizeError), true);
|
|
1574
|
+
this.props.globalActions.addMessageToQueue(message);
|
|
1575
|
+
document.getElementById("fileName").value = "";
|
|
1576
|
+
return;
|
|
1577
|
+
}
|
|
1309
1578
|
const img = new Image();
|
|
1310
1579
|
const that = this;
|
|
1311
1580
|
img.src = _URL.createObjectURL(file);
|
|
@@ -1315,6 +1584,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1315
1584
|
height: this.height,
|
|
1316
1585
|
};
|
|
1317
1586
|
that.props.actions.uploadAsset(file, 'image', fileParams);
|
|
1587
|
+
that.handleImagePreviewClose();
|
|
1318
1588
|
};
|
|
1319
1589
|
}
|
|
1320
1590
|
|
|
@@ -1365,10 +1635,13 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1365
1635
|
this.delayTimer = setTimeout(callback, ms);
|
|
1366
1636
|
}
|
|
1367
1637
|
|
|
1368
|
-
deleteLanguage = (
|
|
1638
|
+
deleteLanguage = (passedData, val) => {
|
|
1639
|
+
const formData = _.cloneDeep(passedData);
|
|
1369
1640
|
console.log('Delete Language ', formData, val);
|
|
1370
1641
|
const schema = _.cloneDeep(this.state.schema);
|
|
1371
|
-
schema.containers[
|
|
1642
|
+
schema.containers[this.state.currentTab - 1].panes.splice(val, 1);
|
|
1643
|
+
schema.containers[this.state.currentTab - 1].tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: "none"};
|
|
1644
|
+
this.resetCkEditorInstance(this.state.currentTab, formData);
|
|
1372
1645
|
this.setState({schema, formData, showModal: false});
|
|
1373
1646
|
console.log('Schema ', schema, formData, val);
|
|
1374
1647
|
}
|
|
@@ -1400,7 +1673,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1400
1673
|
baseData.selectedLanguages = [baseLanguage];
|
|
1401
1674
|
newFormData.base = baseData;
|
|
1402
1675
|
newFormData[0] = baseData;
|
|
1676
|
+
newFormData[0].base = true;
|
|
1403
1677
|
}
|
|
1678
|
+
this.props.templatesActions.resetUploadData();
|
|
1404
1679
|
return newFormData;
|
|
1405
1680
|
}
|
|
1406
1681
|
|
|
@@ -1415,6 +1690,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1415
1690
|
console.log('Type test ', content.constructor);
|
|
1416
1691
|
if (content.constructor === Object) {
|
|
1417
1692
|
const tmpData = {};
|
|
1693
|
+
if (_.isEmpty(content)) {
|
|
1694
|
+
return;
|
|
1695
|
+
}
|
|
1418
1696
|
tmpData.html_content = content['template-content'];
|
|
1419
1697
|
tmpData.is_drag_drop = content.is_drag_drop;
|
|
1420
1698
|
tmpData.lang_id = content.lang_id;
|
|
@@ -1431,7 +1709,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1431
1709
|
console.log('Tranforming data for embedded mode', tmpData);
|
|
1432
1710
|
}
|
|
1433
1711
|
});
|
|
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 === "
|
|
1712
|
+
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" || this.props.location.query.module === "library")) {
|
|
1435
1713
|
newFormData.base.subject = formData['template-subject'];
|
|
1436
1714
|
}
|
|
1437
1715
|
|
|
@@ -1467,6 +1745,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1467
1745
|
case "create":
|
|
1468
1746
|
this.edmEvent = e;
|
|
1469
1747
|
break;
|
|
1748
|
+
case "select":
|
|
1749
|
+
this.edmEvent = e;
|
|
1750
|
+
break;
|
|
1470
1751
|
case "startLoading":
|
|
1471
1752
|
this.startLoading(type.edit);
|
|
1472
1753
|
break;
|
|
@@ -1527,6 +1808,27 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1527
1808
|
this.props.actions.createTemplate(this.state.saveObj);
|
|
1528
1809
|
}
|
|
1529
1810
|
});
|
|
1811
|
+
} else if (this.state.mode === 'preview' || this.state.mode === 'switchEditor') {
|
|
1812
|
+
this.props.actions.getCmsData('edm', this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].drag_drop_id);
|
|
1813
|
+
if (this.state.mode === 'switchEditor') {
|
|
1814
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
1815
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
1816
|
+
_.forEach(schema.containers, (container, index) => {
|
|
1817
|
+
if (parseInt(index, 10) === (this.state.currentTab - 1)) {
|
|
1818
|
+
const temp = container;
|
|
1819
|
+
const langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(formData[`${this.state.currentTab - 1}`].activeTab);
|
|
1820
|
+
console.log('switch language Tab ', langTab, formData[`${this.state.currentTab - 1}`].selectedLanguages, formData[`${this.state.currentTab - 1}`].activeTab);
|
|
1821
|
+
temp.panes[langTab].sections[0].inputFields[0].cols[0].colStyle = {display: ""};
|
|
1822
|
+
temp.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = {display: "none"};
|
|
1823
|
+
temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[3].cols[0].style = {display: "none"};
|
|
1824
|
+
}
|
|
1825
|
+
});
|
|
1826
|
+
|
|
1827
|
+
console.log('Handle OK ', schema);
|
|
1828
|
+
this.setState({ schema, showConfirmationModal: false, isSchemaChanged: true }, () => {
|
|
1829
|
+
this.injectEvents(schema);
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1530
1832
|
}
|
|
1531
1833
|
}
|
|
1532
1834
|
|
|
@@ -1541,15 +1843,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1541
1843
|
this.setState({formData});
|
|
1542
1844
|
}
|
|
1543
1845
|
|
|
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
1846
|
handleOnHoverItem = (isHovering, id) => {
|
|
1554
1847
|
console.log('Card Howering ', isHovering, id);
|
|
1555
1848
|
if (!isHovering) {
|
|
@@ -1570,6 +1863,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1570
1863
|
_.forEach(schema.containers, (container) => {
|
|
1571
1864
|
if (container.isActive) {
|
|
1572
1865
|
_.forEach(container.tabBarExtraContent.sections[0].inputFields[0].cols, (containerInputFieldCol) => {
|
|
1866
|
+
if (containerInputFieldCol.id === 'insert-image') {
|
|
1867
|
+
const newContainerInputFieldCol = containerInputFieldCol;
|
|
1868
|
+
newContainerInputFieldCol.style.display = isDragDrop ? "none" : '';
|
|
1869
|
+
}
|
|
1573
1870
|
if (containerInputFieldCol.id === 'tab-options-popover') {
|
|
1574
1871
|
_.forEach(containerInputFieldCol.content.sections[0].inputFields, (tabPopoverSection) => {
|
|
1575
1872
|
if (tabPopoverSection.cols[0].id === 'switch-editor-label') {
|
|
@@ -1585,6 +1882,32 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1585
1882
|
this.setState({schema, isSchemaChanged: true});
|
|
1586
1883
|
}
|
|
1587
1884
|
|
|
1885
|
+
hideMarkAsFinalButton = () => {
|
|
1886
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
1887
|
+
_.forEach(schema.containers, (container) => {
|
|
1888
|
+
if (container.isActive) {
|
|
1889
|
+
_.forEach(container.tabBarExtraContent.sections[0].inputFields[0].cols, (containerInputFieldCol) => {
|
|
1890
|
+
if (containerInputFieldCol.id === 'mark-final-version-label') {
|
|
1891
|
+
const newContainerInputFieldCol = containerInputFieldCol;
|
|
1892
|
+
newContainerInputFieldCol.style.display = "none";
|
|
1893
|
+
}
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
});
|
|
1897
|
+
console.log('HandleHideMarkAsFinal ', JSON.stringify(schema));
|
|
1898
|
+
this.setState({schema, isSchemaChanged: true});
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
showSubject = () => {
|
|
1902
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
1903
|
+
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" ||
|
|
1904
|
+
this.props.location.query.module === "library")) {
|
|
1905
|
+
schema.standalone.sections[0].inputFields[0].style.display = "";
|
|
1906
|
+
schema.standalone.sections[0].inputFields[0].labelStyle.display = "";
|
|
1907
|
+
}
|
|
1908
|
+
this.setState({schema});
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1588
1911
|
handleOnItemClick = (isSelected, id) => {
|
|
1589
1912
|
console.log('Dummy ', isSelected, id, event);
|
|
1590
1913
|
const isDragDrop = this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop;
|
|
@@ -1618,7 +1941,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1618
1941
|
}
|
|
1619
1942
|
this.edmEvent = undefined;
|
|
1620
1943
|
} else {
|
|
1621
|
-
this.state.
|
|
1944
|
+
this.resetCkEditorInstance(this.state.currentTab, this.state.formData, true, data, true);
|
|
1622
1945
|
}
|
|
1623
1946
|
}
|
|
1624
1947
|
this.setState({ showImageSelectionBox: false });
|
|
@@ -1628,9 +1951,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1628
1951
|
toggleEmailPreview = () => {
|
|
1629
1952
|
const isDragDrop = this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop;
|
|
1630
1953
|
if (isDragDrop && !this.state.showEmailPreview) {
|
|
1631
|
-
this.
|
|
1632
|
-
|
|
1633
|
-
});
|
|
1954
|
+
const activeLangTab = this.state.formData[`${this.state.currentTab - 1}`].activeTab;
|
|
1955
|
+
const langIndex = this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(activeLangTab);
|
|
1956
|
+
const win = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`).contentWindow;
|
|
1957
|
+
win.postMessage("saveProject", '*');
|
|
1958
|
+
this.setState({mode: "preview", gettingPreviewData: true});
|
|
1959
|
+
// this.setState({gettingPreviewData: true}, () => {
|
|
1960
|
+
// this.props.actions.getCmsData('edm', this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].drag_drop_id);
|
|
1961
|
+
// });
|
|
1634
1962
|
} else if (this.state.showEmailPreview) {
|
|
1635
1963
|
const formData = _.cloneDeep(this.state.formData);
|
|
1636
1964
|
formData[`${this.state.currentTab - 1}`][formData[`${this.state.currentTab - 1}`].activeTab]['template-content'] = "";
|
|
@@ -1771,58 +2099,106 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1771
2099
|
}
|
|
1772
2100
|
}
|
|
1773
2101
|
|
|
1774
|
-
addLanguage = (
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
2102
|
+
addLanguage = (tempLang, passedData, val, asyncLanguages) => {
|
|
2103
|
+
if (this.state.addLanguageType === "upload") {
|
|
2104
|
+
this.setState({languageDataSet: true}, () => {
|
|
2105
|
+
console.log('adding from add language 1', this.props.Templates);
|
|
2106
|
+
if (this.props.Templates.selectedEmailLayout && this.props.Templates.selectedEmailLayout !== '') {
|
|
2107
|
+
console.log('adding from add language 2');
|
|
2108
|
+
this.setNewLanguageContent(this.props.Templates.selectedEmailLayout);
|
|
2109
|
+
}
|
|
2110
|
+
});
|
|
2111
|
+
}
|
|
2112
|
+
let addLanguageLength = 1;
|
|
2113
|
+
if (asyncLanguages) {
|
|
2114
|
+
addLanguageLength = asyncLanguages.length;
|
|
2115
|
+
}
|
|
2116
|
+
let data = tempLang;
|
|
2117
|
+
let tabKey = '';
|
|
2118
|
+
let langTab = 0;
|
|
1779
2119
|
const schema = _.cloneDeep(this.state.schema);
|
|
1780
|
-
const
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
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);
|
|
2120
|
+
const formData = _.cloneDeep(passedData);
|
|
2121
|
+
for (let idx = 0; idx < addLanguageLength; idx += 1) {
|
|
2122
|
+
let newActiveTab = this.state.settingLanguage ? this.state.settingLanguage.iso_code : 'en';
|
|
2123
|
+
if (asyncLanguages) {
|
|
2124
|
+
newActiveTab = asyncLanguages[idx].iso_code;
|
|
2125
|
+
data = asyncLanguages[idx];
|
|
1795
2126
|
}
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
console.log('tabContent.inputFields[0].cols[0]', tabContentSection, this.state.currentTab);
|
|
1801
|
-
tabContentSection.id = `${tabContentSection.id}${tabIndex}`;
|
|
1802
|
-
tabContentSection.value = `${data.language}`;
|
|
1803
|
-
console.log('cloned final sections', sections, tabContent);
|
|
1804
|
-
_.forEach(sections[0].inputFields[0].cols, (inputField) => {
|
|
1805
|
-
if (this.map[inputField.id] === undefined) {
|
|
1806
|
-
if (inputField.id.indexOf('template-content') > -1) {
|
|
1807
|
-
this.map[inputField.id] = this.map['template-content'];
|
|
1808
|
-
} else if (inputField.id.indexOf('edmeditor2') > -1) {
|
|
1809
|
-
this.map[inputField.id] = this.map.edmeditor2;
|
|
1810
|
-
}
|
|
2127
|
+
langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(newActiveTab);
|
|
2128
|
+
if (langTab === -1) {
|
|
2129
|
+
formData[`${this.state.currentTab - 1}`].selectedLanguages.push(newActiveTab);
|
|
2130
|
+
langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(newActiveTab);
|
|
1811
2131
|
}
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
2132
|
+
const selectedLanguage = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(data.iso_code);
|
|
2133
|
+
tabKey = formData[`${this.state.currentTab - 1}`][data.iso_code].tabKey;
|
|
2134
|
+
console.log('adding language', data, formData, val, selectedLanguage, formData[`${this.state.currentTab - 1}`]);
|
|
2135
|
+
const tabIndex = (selectedLanguage) + 1;
|
|
2136
|
+
const containers = schema.containers.slice();
|
|
2137
|
+
const tabContent = _.cloneDeep(containers[0].tabContent.sections[0]);
|
|
2138
|
+
const tabContentSection = tabContent.inputFields[0].cols[0];
|
|
2139
|
+
const panes = containers[`${this.state.currentTab - 1}`].panes.slice();
|
|
2140
|
+
const firstPane = _.cloneDeep(panes[0]);
|
|
2141
|
+
const sections = [];
|
|
2142
|
+
_.forEach(firstPane.sections, (section) => {
|
|
2143
|
+
let sect = _.cloneDeep(section);
|
|
2144
|
+
console.log('trying to clone in add version', JSON.stringify(sect), tabIndex);
|
|
2145
|
+
if (sect.type === 'col-label') {
|
|
2146
|
+
sect = this.cloneColLabel(sect, tabIndex);
|
|
2147
|
+
} else if (sect.type === 'multicols') {
|
|
2148
|
+
sect = this.cloneMultiCol(sect, tabIndex);
|
|
2149
|
+
} else if (sect.type === 'parent') {
|
|
2150
|
+
sect = this.cloneParent(sect, tabIndex);
|
|
2151
|
+
}
|
|
2152
|
+
console.log('returning section', sect);
|
|
2153
|
+
sections.push(sect);
|
|
2154
|
+
return true;
|
|
2155
|
+
});
|
|
2156
|
+
console.log('tabContent.inputFields[0].cols[0]', tabContentSection, this.state.currentTab);
|
|
2157
|
+
tabContentSection.id = `${tabContentSection.id}${tabIndex}`;
|
|
2158
|
+
tabContentSection.value = `${data.language}`;
|
|
2159
|
+
console.log('cloned final sections', sections, tabContent);
|
|
2160
|
+
_.forEach(sections[0].inputFields[0].cols, (inputField) => {
|
|
2161
|
+
if (this.map[inputField.id] === undefined) {
|
|
2162
|
+
if (inputField.id.indexOf('template-content') > -1) {
|
|
2163
|
+
this.map[inputField.id] = this.map['template-content'];
|
|
2164
|
+
} else if (inputField.id.indexOf('edmeditor2') > -1) {
|
|
2165
|
+
this.map[inputField.id] = this.map.edmeditor2;
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
});
|
|
2169
|
+
firstPane.sections = sections;
|
|
2170
|
+
firstPane.sectionsHeaders = [tabContent];
|
|
2171
|
+
console.log('firstPane final version', JSON.stringify(firstPane));
|
|
2172
|
+
// panes.push(firstPane);
|
|
2173
|
+
console.log('initial panes', JSON.stringify(this.state.schema.containers));
|
|
2174
|
+
schema.containers[`${this.state.currentTab - 1}`].panes.push(firstPane);
|
|
2175
|
+
// schema.containers[0].tabContent.sections.push(tabContent);
|
|
2176
|
+
console.log('final schema after adding version', firstPane, schema);
|
|
2177
|
+
}
|
|
1821
2178
|
//this.props.templatesActions.getEdmDefaultTemplates();
|
|
2179
|
+
const container = schema.containers[this.state.currentTab - 1];
|
|
2180
|
+
const temp = container;
|
|
2181
|
+
console.log('switch language Tab ', langTab, formData[`${this.state.currentTab - 1}`].selectedLanguages, this.state.formData[`${this.state.currentTab - 1}`].activeTab);
|
|
2182
|
+
if (this.state.addLanguageType === "upload") {
|
|
2183
|
+
temp.panes[langTab].sections[0].inputFields[0].cols[0].colStyle = {display: ""};
|
|
2184
|
+
temp.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = {display: "none"};
|
|
2185
|
+
temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[3].cols[0].style = {display: "none"};
|
|
2186
|
+
}
|
|
2187
|
+
temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: ""};
|
|
1822
2188
|
if (schema) {
|
|
1823
2189
|
this.setState({schema, isSchemaChanged: true, tabKey});
|
|
1824
|
-
this.
|
|
2190
|
+
if (this.state.addLanguageType !== "upload") {
|
|
2191
|
+
this.setState({addLanguageType: ''});
|
|
2192
|
+
}
|
|
2193
|
+
//this.toggleEdmEmailTemplateSelection();
|
|
1825
2194
|
}
|
|
2195
|
+
// const mode = this.state.addLanguageMode;
|
|
2196
|
+
// switch (mode) {
|
|
2197
|
+
// case "upload":
|
|
2198
|
+
//
|
|
2199
|
+
// default:
|
|
2200
|
+
// break;
|
|
2201
|
+
// }
|
|
1826
2202
|
}
|
|
1827
2203
|
|
|
1828
2204
|
openPreviewMode = (selectedAsset) => {
|
|
@@ -1930,9 +2306,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1930
2306
|
cancelTemplate = () => {
|
|
1931
2307
|
const type = this.props.location.query.type;
|
|
1932
2308
|
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
2309
|
+
const isLanguageSupport = this.props.location.query.isLanguageSupport || false;
|
|
1933
2310
|
this.props.router.push({
|
|
1934
2311
|
pathname: `/email/`,
|
|
1935
|
-
query: type === 'embedded' ? {type: 'embedded', module} : {module},
|
|
2312
|
+
query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport} : {module, isLanguageSupport},
|
|
1936
2313
|
});
|
|
1937
2314
|
}
|
|
1938
2315
|
|
|
@@ -1998,12 +2375,56 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1998
2375
|
tempContainer = this.injectContainer(tempContainer);
|
|
1999
2376
|
return tempContainer;
|
|
2000
2377
|
});
|
|
2378
|
+
console.log("Lang Test ", this.props.location.query.isLanguageSupport, (this.props.location.query.isLanguageSupport === false));
|
|
2379
|
+
if ( this.props.location.query.type === 'embedded' && ((this.props.location.query.isLanguageSupport === "false" || this.props.location.query.isLanguageSupport === undefined) || this.props.location.query.isLanguageSupport === "true")) {
|
|
2380
|
+
const ifLangSupported = this.props.location.query.isLanguageSupport === "true";
|
|
2381
|
+
_.forEach(temp.containers, (container) => {
|
|
2382
|
+
if (container.isActive) {
|
|
2383
|
+
let hideLang = false;
|
|
2384
|
+
_.forEach(container.tabBarExtraContent.sections[0].inputFields[0].cols, (containerInputFieldCol) => {
|
|
2385
|
+
if (hideLang && !ifLangSupported) {
|
|
2386
|
+
const newContainerInputFieldCol = containerInputFieldCol;
|
|
2387
|
+
hideLang = false;
|
|
2388
|
+
newContainerInputFieldCol.offset = 18;
|
|
2389
|
+
} else if (hideLang) {
|
|
2390
|
+
const newContainerInputFieldCol = containerInputFieldCol;
|
|
2391
|
+
hideLang = false;
|
|
2392
|
+
newContainerInputFieldCol.offset = 14;
|
|
2393
|
+
}
|
|
2394
|
+
if (containerInputFieldCol.id === 'add-language-button' && !ifLangSupported) {
|
|
2395
|
+
const newContainerInputFieldCol = containerInputFieldCol;
|
|
2396
|
+
newContainerInputFieldCol.colStyle.display = "none";
|
|
2397
|
+
hideLang = true;
|
|
2398
|
+
} else if (containerInputFieldCol.id === 'add-language-button') {
|
|
2399
|
+
hideLang = true;
|
|
2400
|
+
}
|
|
2401
|
+
if (containerInputFieldCol.id === "mark-final-version-label") {
|
|
2402
|
+
const newContainerInputFieldCol = containerInputFieldCol;
|
|
2403
|
+
newContainerInputFieldCol.colStyle.display = "none";
|
|
2404
|
+
}
|
|
2405
|
+
if (containerInputFieldCol.id === "tab-options-popover") {
|
|
2406
|
+
const newContainerInputFieldCol = containerInputFieldCol;
|
|
2407
|
+
newContainerInputFieldCol.colStyle.display = "none";
|
|
2408
|
+
}
|
|
2409
|
+
});
|
|
2410
|
+
}
|
|
2411
|
+
});
|
|
2412
|
+
}
|
|
2001
2413
|
console.log('final injected schema', schema);
|
|
2002
2414
|
this.setState({schema, isSchemaChanged: true}, () => {
|
|
2003
2415
|
const type = this.props.location.query.type;
|
|
2004
2416
|
if (type === 'embedded') {
|
|
2005
2417
|
this.removeStandAlone();
|
|
2006
2418
|
}
|
|
2419
|
+
if (type === 'embedded' && (this.props.route.name === 'EmailView' || (this.props.location.query.module && (this.props.location.query.module.toLowerCase() === 'loyalty' || this.props.location.query.module.toLowerCase() === 'dvs' || this.props.location.query.module.toLowerCase() === 'timeline')))) {
|
|
2420
|
+
if (this.props.route.name === "EmailEdit" && this.props.location.query.module === "dvs") {
|
|
2421
|
+
return;
|
|
2422
|
+
}
|
|
2423
|
+
const response = {
|
|
2424
|
+
action: 'startTemplateCreation',
|
|
2425
|
+
};
|
|
2426
|
+
parent.postMessage(JSON.stringify(response), '*');
|
|
2427
|
+
}
|
|
2007
2428
|
});
|
|
2008
2429
|
return schema;
|
|
2009
2430
|
}
|
|
@@ -2024,7 +2445,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2024
2445
|
delete schema.standalone;
|
|
2025
2446
|
schema.standalone = {};
|
|
2026
2447
|
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 === "
|
|
2448
|
+
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" ||
|
|
2449
|
+
this.props.location.query.module === "library")) {
|
|
2028
2450
|
schema.standalone.sections.push(_.cloneDeep(this.state.schema.standalone.sections[0]));
|
|
2029
2451
|
}
|
|
2030
2452
|
|
|
@@ -2053,38 +2475,47 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2053
2475
|
}
|
|
2054
2476
|
});
|
|
2055
2477
|
this.setState({ schema, isSchemaChanged: true });
|
|
2478
|
+
return schema;
|
|
2056
2479
|
}
|
|
2057
2480
|
|
|
2058
2481
|
startTemplateCreation(data) {
|
|
2482
|
+
console.log('startTemplatecreations', data);
|
|
2059
2483
|
if (_.isEmpty(data)) {
|
|
2060
2484
|
return;
|
|
2061
2485
|
}
|
|
2062
2486
|
|
|
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"}]};
|
|
2065
|
-
console.log('Start template creation ', data);
|
|
2487
|
+
//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":[]};
|
|
2488
|
+
// 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"}]};
|
|
2489
|
+
console.log('Start template creation ', data, this.props.location.query.isLanguageSupport, this.props.location.query.type === 'embedded', this.props.location.query.type === 'embedded' && !this.props.location.query.isLanguageSupport);
|
|
2066
2490
|
if (data && data.edit) {
|
|
2067
2491
|
console.log('startTemplateCreation');
|
|
2068
2492
|
// const formData = {'0': {}};
|
|
2069
2493
|
const formData = _.cloneDeep(this.state.formData);
|
|
2070
2494
|
formData[0].selectedLanguages = [];
|
|
2071
2495
|
let tabKey;
|
|
2072
|
-
if (this.props.location.query.type === 'embedded' &&
|
|
2496
|
+
if (this.props.location.query.type === 'embedded' && (this.props.location.query.isLanguageSupport === undefined || this.props.location.query.isLanguageSupport === 'false')) {
|
|
2073
2497
|
formData['template-subject'] = data.base.subject ? data.base.subject : '';
|
|
2074
|
-
const
|
|
2498
|
+
const baseLanguage = this.props.Global.currentOrgDetails.basic_details.base_language;
|
|
2499
|
+
let languageIndex = _.findIndex(this.supportedLanguages, {iso_code: baseLanguage});
|
|
2500
|
+
console.log("startTemplatecreation before index", languageIndex, this.supportedLanguages, baseLanguage, formData);
|
|
2501
|
+
if (languageIndex === -1) {
|
|
2502
|
+
languageIndex = 0;
|
|
2503
|
+
}
|
|
2075
2504
|
const tempData = {
|
|
2076
2505
|
"is_drag_drop": data.base.is_drag_drop,
|
|
2077
2506
|
"lang_id": this.supportedLanguages[languageIndex].lang_id,
|
|
2078
2507
|
"iso_code": this.supportedLanguages[languageIndex].iso_code,
|
|
2079
2508
|
"language": this.supportedLanguages[languageIndex].language,
|
|
2080
|
-
"template-content": data.base.html_content,
|
|
2509
|
+
"template-content": !data.base.is_drag_drop && data.base.is_drag_drop !== 1 ? data.base.html_content : "",
|
|
2081
2510
|
};
|
|
2082
2511
|
formData[0].base = true;
|
|
2083
2512
|
formData[0].selectedLanguages.push(this.supportedLanguages[languageIndex].iso_code);
|
|
2084
2513
|
formData[0][this.supportedLanguages[languageIndex].iso_code] = tempData;
|
|
2085
2514
|
formData[0].activeTab = this.supportedLanguages[languageIndex].iso_code;
|
|
2086
2515
|
tabKey = "2";
|
|
2516
|
+
console.log("start Template creation midway data", formData, languageIndex);
|
|
2087
2517
|
} else {
|
|
2518
|
+
const additionalLanguages = [];
|
|
2088
2519
|
_.forEach(data.secondary_templates, (templates) => {
|
|
2089
2520
|
console.log('creating form data', templates);
|
|
2090
2521
|
const id = "1";
|
|
@@ -2094,7 +2525,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2094
2525
|
languageIndex = 0;
|
|
2095
2526
|
}
|
|
2096
2527
|
const tempData = {
|
|
2097
|
-
"is_drag_drop": templates.is_drag_drop,
|
|
2528
|
+
"is_drag_drop": templates.is_drag_drop === "1" || false,
|
|
2098
2529
|
"lang_id": this.supportedLanguages[languageIndex].lang_id,
|
|
2099
2530
|
"iso_code": this.supportedLanguages[languageIndex].iso_code,
|
|
2100
2531
|
"language": this.supportedLanguages[languageIndex].language,
|
|
@@ -2102,6 +2533,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2102
2533
|
};
|
|
2103
2534
|
if (templates.drag_drop_id) {
|
|
2104
2535
|
tempData.drag_drop_id = templates.drag_drop_id;
|
|
2536
|
+
this.props.actions.getCmsSetting('edm', tempData.drag_drop_id, 'open', tempData.iso_code);
|
|
2105
2537
|
}
|
|
2106
2538
|
// formData.usingTabContainer = true;
|
|
2107
2539
|
// formData.tabCount = 1;
|
|
@@ -2112,16 +2544,24 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2112
2544
|
formData[0].base = true;
|
|
2113
2545
|
formData[0].selectedLanguages.push(this.supportedLanguages[languageIndex].iso_code);
|
|
2114
2546
|
formData[0][this.supportedLanguages[languageIndex].iso_code] = tempData;
|
|
2115
|
-
if (templates.is_base_template) {
|
|
2547
|
+
if (templates.is_base_template === 1) {
|
|
2116
2548
|
formData[0].activeTab = this.supportedLanguages[languageIndex].iso_code;
|
|
2117
2549
|
// formData.base = tempData;
|
|
2550
|
+
} else {
|
|
2551
|
+
additionalLanguages.push(this.supportedLanguages[languageIndex]);
|
|
2118
2552
|
}
|
|
2119
2553
|
});
|
|
2554
|
+
this.addLanguage(false, formData, false, additionalLanguages);
|
|
2120
2555
|
}
|
|
2121
2556
|
formData.base = _.cloneDeep(formData[0]);
|
|
2122
2557
|
console.log('startTemplateCreation final ', formData);
|
|
2123
2558
|
this.setState({formData, loading: false, injectedTags: data.tags, tabKey, isDragDrop: (data.base.is_drag_drop !== 0 )}, () => {
|
|
2124
2559
|
// this.setState({tabKey: ''});
|
|
2560
|
+
_.forEach(formData[0].selectedLanguages, (language) => {
|
|
2561
|
+
if (formData[0][language].is_drag_drop) {
|
|
2562
|
+
this.props.actions.getCmsSetting('edm', formData[0][language].drag_drop_id, 'open', language);
|
|
2563
|
+
}
|
|
2564
|
+
});
|
|
2125
2565
|
});
|
|
2126
2566
|
} else {
|
|
2127
2567
|
this.setState({injectedTags: data.tags});
|
|
@@ -2318,7 +2758,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2318
2758
|
// return;
|
|
2319
2759
|
// }
|
|
2320
2760
|
const formData = _.cloneDeep(passedData);
|
|
2321
|
-
console.log('Saving form data', formData, this.state.tabCount);
|
|
2761
|
+
console.log('Saving form data', JSON.stringify(formData), this.state.tabCount);
|
|
2322
2762
|
const obj = {};
|
|
2323
2763
|
obj.versions = {
|
|
2324
2764
|
base: {},
|
|
@@ -2383,22 +2823,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2383
2823
|
}
|
|
2384
2824
|
|
|
2385
2825
|
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);
|
|
2826
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
2827
|
+
const activeLangTab = formData[`${this.state.currentTab - 1}`].activeTab;
|
|
2828
|
+
const langIndex = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(activeLangTab);
|
|
2829
|
+
console.log('switching editor midway', activeLangTab, langIndex, formData);
|
|
2830
|
+
this.setState({mode: "switchEditor"}, () => {
|
|
2831
|
+
console.log('posting message for switching editor', `edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`);
|
|
2832
|
+
const win = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`).contentWindow;
|
|
2833
|
+
win.postMessage("saveProject", '*');
|
|
2402
2834
|
});
|
|
2403
2835
|
}
|
|
2404
2836
|
|
|
@@ -2507,7 +2939,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2507
2939
|
</div>
|
|
2508
2940
|
);
|
|
2509
2941
|
const schema = this.state.schema;
|
|
2510
|
-
const spinning = this.state.loading || (this.props.Email && "createTemplateInProgress" in this.props.Email && this.props.Email.createTemplateInProgress)
|
|
2942
|
+
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
2943
|
const previewHeader = (<h3>Email Preview</h3>);
|
|
2512
2944
|
const imagePreviewHeader = (<h3>Image Selection</h3>);
|
|
2513
2945
|
const imagePreviewContent = (
|
|
@@ -2515,7 +2947,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2515
2947
|
<div>
|
|
2516
2948
|
<form encType="multipart/form-data" id="myForm">
|
|
2517
2949
|
<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'}}>
|
|
2950
|
+
<CapButton type={'secondary'} onClick={(e) => this.openFileDialog(e)} style={{float: 'right', marginRight: '24px'}}>
|
|
2519
2951
|
<FormattedMessage {...messages.upload} />
|
|
2520
2952
|
</CapButton>
|
|
2521
2953
|
</form>
|
|
@@ -2532,12 +2964,15 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2532
2964
|
</Pagination>
|
|
2533
2965
|
</div>
|
|
2534
2966
|
);
|
|
2535
|
-
console.log('Render Form Data ', this.state.formData, this.supportedLanguages);
|
|
2967
|
+
console.log('Render Form Data ', this.state.formData, this.supportedLanguages, this.state);
|
|
2536
2968
|
if (!this.props.Global.currentOrgDetails || !this.props.Global.currentOrgDetails.basic_details) {
|
|
2537
2969
|
return (<div>Loading...</div>);
|
|
2538
2970
|
}
|
|
2539
2971
|
console.log('CMS Data ', this.props.Email.CmsSettings, this.props.Global.currentOrgDetails.basic_details.supported_languages);
|
|
2540
|
-
|
|
2972
|
+
let loaderText = this.props.Email.createTemplateInProgress ? this.props.intl.formatMessage(messages.saveTemplateLoader) : this.props.intl.formatMessage(messages.templateLoader);
|
|
2973
|
+
if (this.props.Email.assetUploading) {
|
|
2974
|
+
loaderText = this.props.intl.formatMessage(messages.uploadingImage);
|
|
2975
|
+
}
|
|
2541
2976
|
return (
|
|
2542
2977
|
<div className="email-container">
|
|
2543
2978
|
<Helmet
|
|
@@ -2606,13 +3041,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2606
3041
|
toggleEdmEmailTemplateSelection={this.toggleEdmEmailTemplateSelection}
|
|
2607
3042
|
handleEdmDefaultTemplateSelection={this.handleEdmDefaultTemplateSelection}
|
|
2608
3043
|
setModalContent={this.setModalContent}
|
|
3044
|
+
addLanguageType={this.state.addLanguageType}
|
|
2609
3045
|
/> : ''}
|
|
2610
3046
|
</Col>
|
|
2611
3047
|
</Row>
|
|
2612
3048
|
</Spin>
|
|
2613
3049
|
{!_.isEmpty(this.state.formData[(this.state.currentTab - 1)]) && <EmailPreview
|
|
2614
3050
|
header={previewHeader}
|
|
2615
|
-
content={this.state.formData[(this.state.currentTab - 1)][this.state.formData[(this.state.currentTab - 1)].activeTab][`template-content`]}
|
|
3051
|
+
content={this.state.formData[(this.state.currentTab - 1)][this.state.formData[(this.state.currentTab - 1)].activeTab] ? this.state.formData[(this.state.currentTab - 1)][this.state.formData[(this.state.currentTab - 1)].activeTab][`template-content`] : ''}
|
|
2616
3052
|
show={this.state.showEmailPreview}
|
|
2617
3053
|
device={this.state.device}
|
|
2618
3054
|
handleClose={this.toggleEmailPreview}
|
|
@@ -2643,7 +3079,8 @@ Email.propTypes = {
|
|
|
2643
3079
|
metaEntities: PropTypes.object,
|
|
2644
3080
|
Global: PropTypes.object,
|
|
2645
3081
|
templatesActions: PropTypes.object,
|
|
2646
|
-
|
|
3082
|
+
route: PropTypes.object,
|
|
3083
|
+
templateData: PropTypes.object,
|
|
2647
3084
|
};
|
|
2648
3085
|
|
|
2649
3086
|
const mapStateToProps = createStructuredSelector({
|