@capillarytech/creatives-library 7.17.202-alpha.0 → 7.17.202
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
|
@@ -98,7 +98,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
98
98
|
customPopoverVisible: false,
|
|
99
99
|
isDrawerVisible: false,
|
|
100
100
|
translationLang: 'en',
|
|
101
|
-
showLiquidValidation: false,
|
|
102
101
|
liquidErrorMessage: {
|
|
103
102
|
STANDARD_ERROR_MSG: [],
|
|
104
103
|
LIQUID_ERROR_MSG: [],
|
|
@@ -494,7 +493,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
494
493
|
const type = (this.props.location && this.props.location.query.type) ? this.props.location.query.type : 'full';
|
|
495
494
|
const currentModule = (this.props.location && this.props.location.query.module) ? this.props.location.query.module : 'default';
|
|
496
495
|
let errorData = _.cloneDeep(this.state.errorData);
|
|
497
|
-
const stateFormData = _.cloneDeep(this.state.formData);
|
|
498
496
|
if (channel && channel.toUpperCase() === SMS) {
|
|
499
497
|
for (let count = 0; count < this.state.tabCount; count += 1) {
|
|
500
498
|
if (_.isEmpty(errorData[count])) {
|
|
@@ -961,7 +959,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
961
959
|
} else if(index === 'template-version' && data !== '') {
|
|
962
960
|
errorData[index] = false;
|
|
963
961
|
}
|
|
964
|
-
|
|
962
|
+
isLiquidValid = isValid; // Existing validations support for liquid enabled orgs
|
|
965
963
|
// Check error for the versions
|
|
966
964
|
if (!isNaN(index) || index === 'base') {
|
|
967
965
|
if (errorData[index] === undefined) {
|
|
@@ -990,9 +988,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
990
988
|
}
|
|
991
989
|
if (tagValidationResponse?.missingTags?.length > 0) {
|
|
992
990
|
errorString += `${this.props.intl.formatMessage(messages.missingTags)} ${tagValidationResponse.missingTags.toString()}\n`;
|
|
993
|
-
if(this.liquidFlow && this.props.isEdit){
|
|
994
|
-
isLiquidValid = true;
|
|
995
|
-
}
|
|
996
991
|
}
|
|
997
992
|
if (tagValidationResponse?.unsupportedTags?.length > 0) {
|
|
998
993
|
errorString += `${this.props.intl.formatMessage(messages.unsupportedTags)} ${tagValidationResponse.unsupportedTags.toString()}\n`;
|
|
@@ -1005,7 +1000,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1005
1000
|
// Adds a bypass for cases where content is initially empty in the creation flow.
|
|
1006
1001
|
if(this.liquidFlow && !this.props.isEdit){
|
|
1007
1002
|
errorString = "";
|
|
1008
|
-
isValid = true;
|
|
1009
1003
|
isLiquidValid = true;
|
|
1010
1004
|
}
|
|
1011
1005
|
}
|
|
@@ -1016,7 +1010,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1016
1010
|
if (this.liquidFlow) {
|
|
1017
1011
|
this.setState(
|
|
1018
1012
|
(prevState) => ({
|
|
1019
|
-
showLiquidValidation: true,
|
|
1020
1013
|
liquidErrorMessage: {
|
|
1021
1014
|
...prevState.liquidErrorMessage,
|
|
1022
1015
|
STANDARD_ERROR_MSG: [errorString],
|
|
@@ -1040,16 +1033,15 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1040
1033
|
});
|
|
1041
1034
|
}
|
|
1042
1035
|
|
|
1043
|
-
const
|
|
1036
|
+
const isTemplateValid = this.liquidFlow ? isLiquidValid : isValid;
|
|
1044
1037
|
//Updating the state with the error data
|
|
1045
1038
|
this.setState((prevState) => ({
|
|
1046
|
-
isFormValid:
|
|
1047
|
-
showLiquidValidation: prevState.liquidErrorMessage?.LIQUID_ERROR_MSG?.length > 0 ? true : !isLiquidValid,
|
|
1039
|
+
isFormValid: isTemplateValid,
|
|
1048
1040
|
liquidErrorMessage: {
|
|
1049
1041
|
//Do not update the LIQUID_ERROR_MSG validation error message
|
|
1050
1042
|
...prevState.liquidErrorMessage,
|
|
1051
1043
|
//update Standard error message based on the updated content
|
|
1052
|
-
STANDARD_ERROR_MSG:
|
|
1044
|
+
STANDARD_ERROR_MSG: isTemplateValid ? [] : prevState.liquidErrorMessage?.STANDARD_ERROR_MSG,
|
|
1053
1045
|
},
|
|
1054
1046
|
errorData,
|
|
1055
1047
|
}), () => {
|
|
@@ -1059,8 +1051,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1059
1051
|
}
|
|
1060
1052
|
});
|
|
1061
1053
|
|
|
1062
|
-
this.props.onFormValidityChange(
|
|
1063
|
-
return
|
|
1054
|
+
this.props.onFormValidityChange(isTemplateValid, errorData);
|
|
1055
|
+
return isTemplateValid;
|
|
1064
1056
|
}
|
|
1065
1057
|
|
|
1066
1058
|
indexOfEnd(targetString, string) {
|
|
@@ -1088,9 +1080,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1088
1080
|
*/
|
|
1089
1081
|
const handleResult = (result) => {
|
|
1090
1082
|
const {formatMessage} = this.props.intl;
|
|
1083
|
+
// Checks for errors in the result and displays them if any are found.
|
|
1091
1084
|
if (result?.errors?.length > 0) {
|
|
1092
1085
|
this.setState((prevState) => ({
|
|
1093
|
-
showLiquidValidation: true,
|
|
1094
1086
|
liquidErrorMessage: {
|
|
1095
1087
|
...prevState.liquidErrorMessage,
|
|
1096
1088
|
LIQUID_ERROR_MSG: result?.errors?.map(error => error?.message) ?? [formatMessage(messages.somethingWentWrong)],
|
|
@@ -1101,6 +1093,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1101
1093
|
this.props.stopValidation();
|
|
1102
1094
|
return;
|
|
1103
1095
|
}
|
|
1096
|
+
// Extracts the supported liquid tags from the given content and do the necessary checks.
|
|
1104
1097
|
else {
|
|
1105
1098
|
const extractedLiquidTags = extractNames(result?.data || []);
|
|
1106
1099
|
// Extracts the supported liquid tags from the given content.
|
|
@@ -1108,7 +1101,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1108
1101
|
result,
|
|
1109
1102
|
this.props?.metaEntities?.tagLookupMap
|
|
1110
1103
|
);
|
|
1111
|
-
|
|
1112
1104
|
const unsupportedLiquidTags = extractedLiquidTags?.filter(
|
|
1113
1105
|
(tag) => !supportedLiquidTags?.includes(tag)
|
|
1114
1106
|
);
|
|
@@ -1117,7 +1109,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1117
1109
|
) {
|
|
1118
1110
|
this.setState(
|
|
1119
1111
|
(prevState) => ({
|
|
1120
|
-
showLiquidValidation: true,
|
|
1121
1112
|
liquidErrorMessage: {
|
|
1122
1113
|
...prevState.liquidErrorMessage,
|
|
1123
1114
|
LIQUID_ERROR_MSG: [formatMessage(messages.unsupportedTagsValidationError, {
|
|
@@ -3431,7 +3422,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3431
3422
|
<CapColumn
|
|
3432
3423
|
style={val.colStyle ? val.colStyle : {border : ""}}
|
|
3433
3424
|
span={val.width}
|
|
3434
|
-
className={`${this.state.
|
|
3425
|
+
className={`${(this.state.liquidErrorMessage?.LIQUID_ERROR_MSG?.length || this.state.liquidErrorMessage?.STANDARD_ERROR_MSG?.length) && this.liquidFlow && "error-boundary"} `}
|
|
3435
3426
|
>
|
|
3436
3427
|
<CKEditor
|
|
3437
3428
|
id={val.id}
|
|
@@ -3475,7 +3466,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3475
3466
|
isModuleFilterEnabled = this.props.isFullMode;
|
|
3476
3467
|
}
|
|
3477
3468
|
columns.push(
|
|
3478
|
-
<CapColumn style={val.colStyle ? val.colStyle : {}} span={val.width} className={`${this.state.
|
|
3469
|
+
<CapColumn style={val.colStyle ? val.colStyle : {}} span={val.width} className={`${(this.state.liquidErrorMessage?.LIQUID_ERROR_MSG?.length || this.state.liquidErrorMessage?.STANDARD_ERROR_MSG?.length) && this.liquidFlow && "error-boundary"}`}>
|
|
3479
3470
|
<BeeEditor
|
|
3480
3471
|
uid={uuid}
|
|
3481
3472
|
tokenData={beeToken}
|