@capillarytech/creatives-library 2.0.51 → 2.0.52
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/containers/EmailWrapper/index.js +26 -26
- package/package.json +1 -1
|
@@ -93,36 +93,36 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
93
93
|
CapNotification.error(message);
|
|
94
94
|
}
|
|
95
95
|
handleFileUpload = (file) => {
|
|
96
|
-
const { templatesActions, intl, showNextStep } = this.props;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
const { templatesActions, intl, showNextStep, isUploading } = this.props;
|
|
97
|
+
if (!isUploading) {
|
|
98
|
+
const fileExtension = file.name.split('.').pop();
|
|
99
|
+
const supportedZipFormats = ['zip'];
|
|
100
100
|
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
102
|
+
if (supportedZipFormats.indexOf(fileExtension.toLowerCase()) !== -1) {
|
|
103
|
+
templatesActions.handleZipUpload(file.originFileObj, () => { //handle upload success
|
|
104
|
+
this.setState({modeContent: { file}}, showNextStep);
|
|
105
|
+
}, this.handleZipUploadError);
|
|
106
|
+
} else if (fileExtension === 'html' || fileExtension === 'htm') {
|
|
107
|
+
const reader = new FileReader();
|
|
108
|
+
reader.onload = () => {
|
|
109
|
+
const text = reader.result;
|
|
110
|
+
this.setState({modeContent: { file}}, () => {
|
|
111
|
+
templatesActions.handleHtmlUpload(text);
|
|
112
|
+
});
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
114
|
+
// showNextStep();
|
|
115
|
+
};
|
|
116
|
+
reader.readAsText(file.originFileObj);
|
|
117
|
+
} else {
|
|
118
|
+
const message = {
|
|
119
|
+
key: "email-upload-error",
|
|
120
|
+
message: intl.formatMessage(messages.invalidUploadFileError),
|
|
121
|
+
description: intl.formatMessage(messages.invalidUploadFileErrorDesc),
|
|
122
|
+
};
|
|
123
|
+
CapNotification.error(message);
|
|
124
|
+
}
|
|
124
125
|
}
|
|
125
|
-
return validUpload;
|
|
126
126
|
};
|
|
127
127
|
|
|
128
128
|
handleEdmDefaultTemplateSelection = (id) => {
|