@capillarytech/creatives-library 2.0.50 → 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/components/FormBuilder/index.js +3 -1
- package/containers/CreativesContainer/SlideBoxContent.js +3 -1
- package/containers/CreativesContainer/SlideBoxHeader.js +4 -3
- package/containers/CreativesContainer/index.js +4 -2
- package/containers/Email/actions.js +6 -0
- package/containers/Email/constants.js +1 -0
- package/containers/Email/index.js +7 -2
- package/containers/Email/reducer.js +3 -0
- package/containers/EmailWrapper/index.js +27 -26
- package/package.json +1 -1
|
@@ -1746,7 +1746,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1746
1746
|
|
|
1747
1747
|
|
|
1748
1748
|
this.setState({formData}, () => {
|
|
1749
|
-
this.
|
|
1749
|
+
if (this.props.startValidation) {
|
|
1750
|
+
this.validateForm();
|
|
1751
|
+
}
|
|
1750
1752
|
});
|
|
1751
1753
|
if (event && val.injectedEvents[event]) {
|
|
1752
1754
|
if (event === "onRowClick") {
|
|
@@ -39,7 +39,7 @@ function SlideBoxContent(props) {
|
|
|
39
39
|
setIsLoadingContent,
|
|
40
40
|
} = props;
|
|
41
41
|
const type = messageDetails.type.toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
42
|
-
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'defualt' : 'library'
|
|
42
|
+
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'defualt' : 'library'};
|
|
43
43
|
const creativesLocationProps = {
|
|
44
44
|
pathname: `/sms/edit`,
|
|
45
45
|
query,
|
|
@@ -117,6 +117,8 @@ function SlideBoxContent(props) {
|
|
|
117
117
|
)}
|
|
118
118
|
{isEmailCreate && (
|
|
119
119
|
<EmailWrapper
|
|
120
|
+
key="creatives-email-wrapper"
|
|
121
|
+
date={new Date().getMilliseconds()}
|
|
120
122
|
setIsLoadingContent={setIsLoadingContent}
|
|
121
123
|
onEmailModeChange={onEmailModeChange}
|
|
122
124
|
emailCreateMode={emailCreateMode}
|
|
@@ -8,7 +8,7 @@ const PrefixWrapper = styled.div`
|
|
|
8
8
|
margin-right: 16px;
|
|
9
9
|
`;
|
|
10
10
|
function SlideBoxHeader(props) {
|
|
11
|
-
const { slidBoxContent, messages, templateData, onShowTemplates, creativesMode, isFullMode } = props;
|
|
11
|
+
const { slidBoxContent, messages, templateData, onShowTemplates, creativesMode, isFullMode, showPrefix } = props;
|
|
12
12
|
return (
|
|
13
13
|
<div>
|
|
14
14
|
{slidBoxContent === 'templates' && (
|
|
@@ -33,7 +33,7 @@ function SlideBoxHeader(props) {
|
|
|
33
33
|
{slidBoxContent === 'editTemplate' && (
|
|
34
34
|
<CapHeader
|
|
35
35
|
title={<FormattedMessage {...messages.editMessageContent} />}
|
|
36
|
-
prefix={creativesMode !== 'edit' && !isFullMode &&
|
|
36
|
+
prefix={creativesMode !== 'edit' && !isFullMode && showPrefix &&
|
|
37
37
|
<PrefixWrapper>
|
|
38
38
|
<CapIcons.backIcon onClick={onShowTemplates} />
|
|
39
39
|
</PrefixWrapper>
|
|
@@ -43,7 +43,7 @@ function SlideBoxHeader(props) {
|
|
|
43
43
|
{slidBoxContent === 'createTemplate' && (
|
|
44
44
|
<CapHeader
|
|
45
45
|
title={<FormattedMessage {...messages.createMessageContent} />}
|
|
46
|
-
prefix={!isFullMode &&
|
|
46
|
+
prefix={!isFullMode && showPrefix &&
|
|
47
47
|
<PrefixWrapper>
|
|
48
48
|
<CapIcons.backIcon onClick={onShowTemplates} />
|
|
49
49
|
</PrefixWrapper>
|
|
@@ -60,5 +60,6 @@ SlideBoxHeader.propTypes = {
|
|
|
60
60
|
onShowTemplates: PropTypes.func,
|
|
61
61
|
creativesMode: PropTypes.string,
|
|
62
62
|
isFullMode: PropTypes.bool,
|
|
63
|
+
showPrefix: PropTypes.bool,
|
|
63
64
|
};
|
|
64
65
|
export default SlideBoxHeader;
|
|
@@ -224,8 +224,8 @@ class Creatives extends React.Component {
|
|
|
224
224
|
return isShowContinueFooter;
|
|
225
225
|
}
|
|
226
226
|
render() {
|
|
227
|
-
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep} = this.state;
|
|
228
|
-
const {isFullMode, creativesMode, cap} = this.props;
|
|
227
|
+
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent} = this.state;
|
|
228
|
+
const {isFullMode, creativesMode, cap, isUploading} = this.props;
|
|
229
229
|
return (
|
|
230
230
|
<div className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'}`)}>
|
|
231
231
|
<CapSlideBox
|
|
@@ -237,6 +237,8 @@ class Creatives extends React.Component {
|
|
|
237
237
|
onShowTemplates={this.onShowTemplates}
|
|
238
238
|
creativesMode={creativesMode}
|
|
239
239
|
isFullMode={isFullMode}
|
|
240
|
+
isLoadingContent={isLoadingContent}
|
|
241
|
+
showPrefix={!isUploading} // not show back button when email template is being uploaded
|
|
240
242
|
/>
|
|
241
243
|
}
|
|
242
244
|
content={
|
|
@@ -23,6 +23,7 @@ export const GET_CMS_EDITOR_DETAILS_FAILURE = 'app/containers/Email/GET_CMS_EDIT
|
|
|
23
23
|
export const GET_CMS_EDITOR_DATA_REQUEST = 'app/containers/Email/GET_CMS_EDITOR_DATA_REQUEST';
|
|
24
24
|
export const GET_CMS_EDITOR_DATA_SUCCESS = 'app/containers/Email/GET_CMS_EDITOR_DATA_SUCCESS';
|
|
25
25
|
export const GET_CMS_EDITOR_DATA_FAILURE = 'app/containers/Email/GET_CMS_EDITOR_DATA_FAILURE';
|
|
26
|
+
export const RESET_CMS_EDITOR_DATA = 'app/containers/Email/RESET_CMS_EDITOR_DATA';
|
|
26
27
|
|
|
27
28
|
export const UPLOAD_ASSET_REQUEST = 'app/containers/Email/UPLOAD_ASSET_REQUEST';
|
|
28
29
|
export const UPLOAD_ASSET_SUCCESS = 'app/containers/Email/UPLOAD_ASSET_SUCCESS';
|
|
@@ -310,6 +310,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
310
310
|
this.startTemplateCreation(nextProps.templateData);
|
|
311
311
|
}
|
|
312
312
|
if (nextProps.location.query.module === 'library' && nextProps.isGetFormData) {
|
|
313
|
+
if (!_.isEmpty(this.props.Email.cmsData)) {
|
|
314
|
+
this.props.actions.resetCmsData();
|
|
315
|
+
}
|
|
313
316
|
this.getFormData();
|
|
314
317
|
}
|
|
315
318
|
|
|
@@ -1315,7 +1318,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1315
1318
|
this.validateContent(e);
|
|
1316
1319
|
break;
|
|
1317
1320
|
case "Save result: success":
|
|
1318
|
-
this.
|
|
1321
|
+
if (_.isEmpty(this.props.Email.cmsData)) {
|
|
1322
|
+
this.handleEdmSave();
|
|
1323
|
+
}
|
|
1319
1324
|
break;
|
|
1320
1325
|
case "JsonChanged":
|
|
1321
1326
|
this.edmEvent = e;
|
|
@@ -2666,4 +2671,4 @@ function mapDispatchToProps(dispatch) {
|
|
|
2666
2671
|
};
|
|
2667
2672
|
}
|
|
2668
2673
|
|
|
2669
|
-
export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(Email)));
|
|
2674
|
+
export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(Email)));
|
|
@@ -95,6 +95,9 @@ function emailReducer(state = initialState, action) {
|
|
|
95
95
|
.set('cmsData', '')
|
|
96
96
|
.set('langId', undefined)
|
|
97
97
|
.set('fetchingCmsDataFailed', false);
|
|
98
|
+
case types.RESET_CMS_EDITOR_DATA:
|
|
99
|
+
return state
|
|
100
|
+
.set('cmsData', '');
|
|
98
101
|
case types.GET_CMS_EDITOR_DATA_SUCCESS:
|
|
99
102
|
return state
|
|
100
103
|
.set('fetchingCmsData', false)
|
|
@@ -25,7 +25,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
25
25
|
templateName: '',
|
|
26
26
|
routeParams: {
|
|
27
27
|
pathname: `/email/create`,
|
|
28
|
-
query: { module: 'library', type: 'embedded'
|
|
28
|
+
query: { module: 'library', type: 'embedded'},
|
|
29
29
|
},
|
|
30
30
|
modeContent: {
|
|
31
31
|
|
|
@@ -93,35 +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
|
-
|
|
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
|
+
}
|
|
123
125
|
}
|
|
124
|
-
return validUpload;
|
|
125
126
|
};
|
|
126
127
|
|
|
127
128
|
handleEdmDefaultTemplateSelection = (id) => {
|