@capillarytech/creatives-library 2.0.87 → 2.0.89
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/package.json
CHANGED
|
@@ -24,6 +24,7 @@ import EDMEditor from "../Edmeditor";
|
|
|
24
24
|
import CustomPopOver from '../CustomPopOver';
|
|
25
25
|
import './_formBuilder.scss';
|
|
26
26
|
import {updateCharCount, checkUnicode} from "../../utils/smsCharCountV2";
|
|
27
|
+
import {SMS} from '../../v2Containers/CreativesContainer/constants';
|
|
27
28
|
const TabPane = Tabs.TabPane;
|
|
28
29
|
const {Column} = Table;
|
|
29
30
|
const {TextArea} = CapInput;
|
|
@@ -421,16 +422,28 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
421
422
|
}
|
|
422
423
|
return true;
|
|
423
424
|
}
|
|
425
|
+
errorFieldsPresent(errorData, channel) {
|
|
426
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
427
|
+
let isPresent = true;
|
|
428
|
+
if (channel === SMS) {
|
|
429
|
+
const formDataKeys = Object.keys(formData[0]);
|
|
430
|
+
const errorDataKeys = Object.keys(errorData[0]);
|
|
431
|
+
isPresent = _.isEqualWith(formDataKeys, errorDataKeys, (formDataKey, errorDataKey) => formDataKeys.includes(errorDataKey));
|
|
432
|
+
}
|
|
433
|
+
return isPresent;
|
|
434
|
+
}
|
|
424
435
|
/* eslint-disable */
|
|
425
436
|
validateForm(tags, injectedTags, isSave, showMessages) {
|
|
426
|
-
|
|
427
|
-
|
|
437
|
+
const channel = _.get(this, "props.schema.channel");
|
|
428
438
|
let isValid = true;
|
|
429
439
|
const type = (this.props.location && this.props.location.query.type) ? this.props.location.query.type : 'full';
|
|
430
440
|
const currentModule = (this.props.location && this.props.location.query.module) ? this.props.location.query.module : 'default';
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
441
|
+
let errorData = _.cloneDeep(this.state.errorData);
|
|
442
|
+
const stateFormData = _.cloneDeep(this.state.formData);
|
|
443
|
+
if (channel && channel.toUpperCase() === SMS) {
|
|
444
|
+
if(!this.errorFieldsPresent(errorData, SMS)){
|
|
445
|
+
errorData = this.initializeEditErrorData(stateFormData, 1, true);
|
|
446
|
+
}
|
|
434
447
|
for (let count = 0; count < this.state.tabCount; count += 1) {
|
|
435
448
|
if (_.isEmpty(errorData[count])) {
|
|
436
449
|
return;
|
|
@@ -1075,7 +1088,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1075
1088
|
return formData;
|
|
1076
1089
|
}
|
|
1077
1090
|
|
|
1078
|
-
initializeEditErrorData(formData, tabCount) {
|
|
1091
|
+
initializeEditErrorData(formData, tabCount, isReturnErrorData) {
|
|
1079
1092
|
const errorData = {};
|
|
1080
1093
|
for (let idx = 0; idx < tabCount; idx += 1 ) {
|
|
1081
1094
|
_.forEach(formData[0], (val, key) => {
|
|
@@ -1101,6 +1114,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1101
1114
|
return true;
|
|
1102
1115
|
});
|
|
1103
1116
|
}
|
|
1117
|
+
if (isReturnErrorData) {
|
|
1118
|
+
return errorData;
|
|
1119
|
+
}
|
|
1104
1120
|
this.setState({errorData});
|
|
1105
1121
|
}
|
|
1106
1122
|
|
|
@@ -1648,9 +1648,8 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1648
1648
|
}
|
|
1649
1649
|
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true});
|
|
1650
1650
|
this.injectEvents(schema);
|
|
1651
|
-
return schema;
|
|
1652
1651
|
}
|
|
1653
|
-
return
|
|
1652
|
+
return schema;
|
|
1654
1653
|
};
|
|
1655
1654
|
|
|
1656
1655
|
addSecondoryCtaIos = (flag, formData, schemaField) => {
|
|
@@ -39,7 +39,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
39
39
|
loading: false,
|
|
40
40
|
isFormValid: true,
|
|
41
41
|
injectedTags: {},
|
|
42
|
-
checkValidation: true,
|
|
43
42
|
tabKey: '',
|
|
44
43
|
showModal: false,
|
|
45
44
|
modalContent: {title: "Alert", body: "Do you really want to delete this version?", type: 'confirm', id: 'sms-version-modal'},
|
|
@@ -251,7 +250,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
251
250
|
validity: this.state.isFormValid,
|
|
252
251
|
type: 'SMS',
|
|
253
252
|
};
|
|
254
|
-
this.
|
|
253
|
+
this.setState({checkValidation: true}, this.showError);
|
|
255
254
|
|
|
256
255
|
if (e) {
|
|
257
256
|
e.source.postMessage(JSON.stringify(response), e.origin);
|