@capillarytech/creatives-library 2.0.29 → 2.0.30
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.
|
@@ -1234,7 +1234,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1234
1234
|
const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
|
|
1235
1235
|
const formData = _.cloneDeep(this.state.formData);
|
|
1236
1236
|
|
|
1237
|
-
const schema = (this.props.location.query.type === 'embedded') ? this.removeStandAlone() : _.cloneDeep(this.state.schema);
|
|
1237
|
+
const schema = (this.props.location.query.type === 'embedded') ? this.removeStandAlone(this.state.schema) : _.cloneDeep(this.state.schema);
|
|
1238
1238
|
const containers = _.cloneDeep(schema.containers.slice());
|
|
1239
1239
|
let tabKey = "";
|
|
1240
1240
|
let currentTab = _.cloneDeep(this.state.currentTab);
|
|
@@ -2398,7 +2398,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2398
2398
|
injectEvents = (schema) => {
|
|
2399
2399
|
const type = this.props.location.query.type;
|
|
2400
2400
|
|
|
2401
|
-
|
|
2401
|
+
let temp = _.cloneDeep(schema);
|
|
2402
2402
|
temp.standalone.sections = this.injectSections(temp.standalone.sections);
|
|
2403
2403
|
_.forEach(temp.containers, (container) => {
|
|
2404
2404
|
let tempContainer = container;
|
|
@@ -2468,11 +2468,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2468
2468
|
}
|
|
2469
2469
|
});
|
|
2470
2470
|
//}
|
|
2471
|
-
|
|
2472
|
-
this.setState({schema, isSchemaChanged: true}, () => {
|
|
2473
|
-
if (type === 'embedded') {
|
|
2474
|
-
this.removeStandAlone();
|
|
2475
|
-
}
|
|
2471
|
+
temp = type === 'embedded' ? this.removeStandAlone(temp) : temp;
|
|
2472
|
+
this.setState({schema: temp, isSchemaChanged: true}, () => {
|
|
2476
2473
|
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() === 'coupon_expiry' || this.props.location.query.module.toLowerCase() === 'timeline')))) {
|
|
2477
2474
|
if ((this.props.route.name === "EmailEdit" || this.props.route.name === "EmailCreate") && (this.props.location.query.module === "dvs" || this.props.location.query.module.toLowerCase() === 'coupon_expiry')) {
|
|
2478
2475
|
return;
|
|
@@ -2496,17 +2493,17 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2496
2493
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
2497
2494
|
}
|
|
2498
2495
|
|
|
2499
|
-
removeStandAlone() {
|
|
2500
|
-
const
|
|
2501
|
-
delete
|
|
2502
|
-
|
|
2503
|
-
|
|
2496
|
+
removeStandAlone(schema) {
|
|
2497
|
+
const newSchema = _.cloneDeep(schema);
|
|
2498
|
+
delete newSchema.standalone;
|
|
2499
|
+
newSchema.standalone = {};
|
|
2500
|
+
newSchema.standalone.sections = [];
|
|
2504
2501
|
if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "coupon_expiry" || this.props.location.query.module === "timeline" ||
|
|
2505
2502
|
this.props.location.query.module === "library")) {
|
|
2506
|
-
|
|
2503
|
+
newSchema.standalone.sections.push(_.cloneDeep(schema.standalone.sections[0]));
|
|
2507
2504
|
}
|
|
2508
2505
|
|
|
2509
|
-
_.forEach(
|
|
2506
|
+
_.forEach(newSchema.containers, (container) => {
|
|
2510
2507
|
const temp = container;
|
|
2511
2508
|
if (temp.type === 'tabs') {
|
|
2512
2509
|
// temp.tabBarExtraContent = {};
|
|
@@ -2542,8 +2539,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2542
2539
|
temp.panes.push(basePane);
|
|
2543
2540
|
}
|
|
2544
2541
|
});
|
|
2545
|
-
|
|
2546
|
-
return schema;
|
|
2542
|
+
return newSchema;
|
|
2547
2543
|
}
|
|
2548
2544
|
|
|
2549
2545
|
startTemplateCreation(data) {
|
|
@@ -2832,6 +2828,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2832
2828
|
postAction: this.state.getFormDataValue || 'next',
|
|
2833
2829
|
value: this.transformFormData(passedData),
|
|
2834
2830
|
validity: this.state.isFormValid,
|
|
2831
|
+
type: 'EMAIL',
|
|
2835
2832
|
};
|
|
2836
2833
|
|
|
2837
2834
|
this.setState({checkValidation: true});
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { connect } from 'react-redux';
|
|
9
|
-
import { FormattedMessage, injectIntl } from 'react-intl';
|
|
9
|
+
import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
|
|
10
10
|
import { createStructuredSelector } from 'reselect';
|
|
11
11
|
import { bindActionCreators } from 'redux';
|
|
12
12
|
import _ from 'lodash';
|
|
13
|
-
import { CapRadioCard, CapHeader} from '@capillarytech/cap-ui-library';
|
|
13
|
+
import { CapRadioCard, CapHeader, CapNotification} from '@capillarytech/cap-ui-library';
|
|
14
14
|
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
15
15
|
import {selectEmailLayout, selectCmsTemplates, selectEdmEditor} from '../Templates/selectors';
|
|
16
16
|
import * as templatesActionsCreators from '../Templates/actions';
|
|
@@ -49,12 +49,12 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
49
49
|
componentDidUpdate() {
|
|
50
50
|
const {modeContent} = this.state;
|
|
51
51
|
// const isValid = this.isValid();
|
|
52
|
-
const {emailCreateMode, EmailLayout, CmsTemplates, step, SelectedEdmDefaultTemplate} = this.props;
|
|
52
|
+
const {emailCreateMode, EmailLayout, CmsTemplates, step, SelectedEdmDefaultTemplate, templatesActions} = this.props;
|
|
53
53
|
if (step === "modeSelection" && !this.state.selectedCreateMode && emailCreateMode === 'upload' && !EmailLayout) {
|
|
54
54
|
document.getElementById('upload-email-template').click();
|
|
55
55
|
} else if (step === "templateSelection" && !this.state.selectedCreateMode) {
|
|
56
56
|
if (emailCreateMode === "editor" && !CmsTemplates) {
|
|
57
|
-
|
|
57
|
+
templatesActions.getEdmDefaultTemplates();
|
|
58
58
|
}
|
|
59
59
|
} else if (step === "createTemplate" && !this.state.selectedCreateMode) {
|
|
60
60
|
if (emailCreateMode === 'upload' && !EmailLayout) {
|
|
@@ -75,7 +75,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
75
75
|
this.setState({selectedCreateMode: emailCreateMode});
|
|
76
76
|
}
|
|
77
77
|
handleFileUpload = (e, files) => {
|
|
78
|
-
const { templatesActions } = this.props;
|
|
78
|
+
const { templatesActions, intl } = this.props;
|
|
79
79
|
if (files.length === 0) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
@@ -97,8 +97,11 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
97
97
|
};
|
|
98
98
|
reader.readAsText(files[0]);
|
|
99
99
|
} else {
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
const message = {
|
|
101
|
+
message: intl.formatMessage(messages.invalidUploadFileError),
|
|
102
|
+
description: intl.formatMessage(messages.invalidUploadFileErrorDesc),
|
|
103
|
+
};
|
|
104
|
+
CapNotification.error(message);
|
|
102
105
|
}
|
|
103
106
|
};
|
|
104
107
|
|
|
@@ -175,6 +178,7 @@ EmailWrapper.propTypes = {
|
|
|
175
178
|
step: PropTypes.string,
|
|
176
179
|
showNextStep: PropTypes.func,
|
|
177
180
|
getFormdata: PropTypes.func,
|
|
181
|
+
intl: intlShape,
|
|
178
182
|
};
|
|
179
183
|
|
|
180
184
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -34,4 +34,12 @@ export default defineMessages({
|
|
|
34
34
|
id: 'app.containers.EmailWrapper.createMode',
|
|
35
35
|
defaultMessage: 'How do you want to create ?',
|
|
36
36
|
},
|
|
37
|
+
invalidUploadFileError: {
|
|
38
|
+
id: `app.containers.EmailWrapper.invalidUploadFileError`,
|
|
39
|
+
defaultMessage: `File cannot be uploaded.`,
|
|
40
|
+
},
|
|
41
|
+
invalidUploadFileErrorDesc: {
|
|
42
|
+
id: `app.containers.EmailWrapper.invalidUploadFileDesc`,
|
|
43
|
+
defaultMessage: `Please select another file with valid file format.`,
|
|
44
|
+
},
|
|
37
45
|
});
|
|
@@ -297,6 +297,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
297
297
|
value: result,
|
|
298
298
|
postAction: value || 'next',
|
|
299
299
|
validity: this.state.isFormValid,
|
|
300
|
+
type: 'SMS',
|
|
300
301
|
};
|
|
301
302
|
this.setState({checkValidation: true});
|
|
302
303
|
console.log('posting final result internal', response);
|