@capillarytech/creatives-library 8.0.114-alpha.1 → 8.0.114

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.
Files changed (37) hide show
  1. package/package.json +1 -1
  2. package/utils/commonUtils.js +3 -359
  3. package/utils/tagValidations.js +5 -20
  4. package/utils/tests/commonUtil.test.js +171 -474
  5. package/utils/tests/tagValidations.test.js +2 -89
  6. package/v2Components/ErrorInfoNote/index.js +46 -114
  7. package/v2Components/ErrorInfoNote/messages.js +0 -25
  8. package/v2Components/ErrorInfoNote/style.scss +1 -14
  9. package/v2Components/FormBuilder/index.js +127 -204
  10. package/v2Components/FormBuilder/messages.js +1 -1
  11. package/v2Containers/Cap/reducer.js +4 -4
  12. package/v2Containers/CreativesContainer/SlideBoxContent.js +3 -23
  13. package/v2Containers/CreativesContainer/SlideBoxFooter.js +1 -3
  14. package/v2Containers/CreativesContainer/constants.js +1 -4
  15. package/v2Containers/CreativesContainer/index.js +19 -44
  16. package/v2Containers/CreativesContainer/messages.js +0 -4
  17. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +3 -21
  18. package/v2Containers/Ebill/index.js +3 -3
  19. package/v2Containers/EmailWrapper/components/EmailWrapperView.js +1 -1
  20. package/v2Containers/InApp/index.js +50 -123
  21. package/v2Containers/InApp/tests/index.test.js +1 -1
  22. package/v2Containers/InApp/tests/sagas.test.js +1 -1
  23. package/v2Containers/InApp/utils.js +0 -37
  24. package/v2Containers/MobilePush/Create/index.js +20 -24
  25. package/v2Containers/MobilePush/Edit/index.js +2 -6
  26. package/v2Containers/MobilepushWrapper/index.js +0 -2
  27. package/v2Containers/Sms/Create/index.js +0 -1
  28. package/v2Containers/Sms/Edit/index.js +0 -2
  29. package/v2Containers/SmsWrapper/index.js +0 -2
  30. package/v2Containers/Whatsapp/constants.js +1 -1
  31. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +57476 -0
  32. package/v2Containers/Whatsapp/tests/index.test.js +88 -0
  33. package/v2Components/ErrorInfoNote/ErrorTypeRenderer.js +0 -127
  34. package/v2Components/ErrorInfoNote/ErrorTypeRenderer.test.js +0 -147
  35. package/v2Components/ErrorInfoNote/utils.js +0 -38
  36. package/v2Components/ErrorInfoNote/utils.test.js +0 -156
  37. package/v2Containers/InApp/tests/utils.test.js +0 -41
@@ -49,10 +49,10 @@ import * as actions from "../../v2Containers/Cap/actions";
49
49
  import './_formBuilder.scss';
50
50
  import {updateCharCount, checkUnicode} from "../../utils/smsCharCountV2";
51
51
  import { checkSupport, extractNames, preprocessHtml, validateIfTagClosed } from '../../utils/tagValidations';
52
- import { SMS, MOBILE_PUSH, LINE, ENABLE_AI_SUGGESTIONS,AI_CONTENT_BOT_DISABLED, EMAIL, LIQUID_SUPPORTED_CHANNELS, INAPP } from '../../v2Containers/CreativesContainer/constants';
52
+ import { SMS, MOBILE_PUSH, LINE, ENABLE_AI_SUGGESTIONS,AI_CONTENT_BOT_DISABLED, EMAIL, LIQUID_SUPPORTED_CHANNELS } from '../../v2Containers/CreativesContainer/constants';
53
53
  import globalMessages from '../../v2Containers/Cap/messages';
54
54
  import { convert } from 'html-to-text';
55
- import { OUTBOUND } from './constants';
55
+ import { GLOBAL_CONVERT_OPTIONS, OUTBOUND } from './constants';
56
56
  import { GET_TRANSLATION_MAPPED } from '../../containers/TagList/constants';
57
57
  import moment from 'moment';
58
58
  import { CUSTOMER_BARCODE_TAG , COPY_OF, ENTRY_TRIGGER_TAG_REGEX} from '../../containers/App/constants';
@@ -60,7 +60,7 @@ import { REQUEST } from '../../v2Containers/Cap/constants'
60
60
  import { hasLiquidSupportFeature, isEmailUnsubscribeTagMandatory } from '../../utils/common';
61
61
  import { isUrl } from '../../v2Containers/Line/Container/Wrapper/utils';
62
62
  import { bindActionCreators } from 'redux';
63
- import { getChannelData, validateLiquidTemplateContent, validateMobilePushContent } from '../../utils/commonUtils';
63
+
64
64
  const TabPane = Tabs.TabPane;
65
65
  const {Column} = Table;
66
66
  const {TextArea} = CapInput;
@@ -135,12 +135,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
135
135
  this.handleSetRadioValue = this.handleSetRadioValue.bind(this);
136
136
  this.formElements = [];
137
137
  // Check if the liquid flow feature is supported and the channel is in the supported list.
138
- this.liquidFlow = this.isLiquidFlowSupported.bind(this);
139
- this.onSubmitWrapper = this.onSubmitWrapper.bind(this);
140
-
141
- }
142
- isLiquidFlowSupported = () => {
143
- return Boolean(LIQUID_SUPPORTED_CHANNELS.includes(this.props?.schema?.channel?.toUpperCase()) && hasLiquidSupportFeature());
138
+ this.liquidFlow = Boolean(LIQUID_SUPPORTED_CHANNELS.includes(props?.schema?.channel?.toUpperCase()) && hasLiquidSupportFeature());
144
139
  }
145
140
 
146
141
  componentWillMount() {
@@ -543,7 +538,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
543
538
  } else {
544
539
  errorData['template-name'] = false;
545
540
  }
546
- isLiquidValid = isValid;
547
541
  }
548
542
 
549
543
  //validation for LINE
@@ -659,21 +653,20 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
659
653
  let isOnlyAndroid = false, isOnlyIos = false;
660
654
  const { TAG_BRACKET_COUNT_MISMATCH_ERROR } = errorMessageForTags;
661
655
  const androidData = {};
662
- if (this.state.formData && this.state.formData[0]) {
663
- for(let data in this.state.formData[0]){
664
- if(!!this.state.formData[0][data] && data !== "tabKey" && data !== "base"){
665
- androidData[data] = this.state.formData[0][data];
666
- }
656
+ for(let data in this.state.formData[0]){
657
+ if(!!this.state.formData[0][data] && data !== "tabKey" && data !== "base"){
658
+ androidData[data] = this.state.formData[0][data];
667
659
  }
660
+ }
668
661
  if(_.isEmpty(androidData)){
669
662
  isOnlyIos = true;
670
663
  }
671
664
  const iosData = {};
672
- for(let data in this.state.formData[1]){
673
- if(!!this.state.formData[1][data] && data !== "tabKey" && data !== "base"){
674
- iosData[data] = this.state.formData[1][data];
675
- }
665
+ for(let data in this.state.formData[1]){
666
+ if(!!this.state.formData[1][data] && data !== "tabKey" && data !== "base"){
667
+ iosData[data] = this.state.formData[1][data];
676
668
  }
669
+ }
677
670
  if(_.isEmpty(iosData)){
678
671
  isOnlyAndroid = true;
679
672
  }
@@ -708,19 +701,17 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
708
701
  errorData[parseInt(index)]['invalid-tags'] = tagValidationResponse.unsupportedTags;
709
702
  errorData[parseInt(index)][`bracket-error`] = isBraceError && TAG_BRACKET_COUNT_MISMATCH_ERROR;
710
703
  isValid = false;
711
- isCurrentTabValid = false;
712
704
  }
713
705
  }
714
706
 
715
707
  } else {
716
-
717
- errorData[parseInt(index)][`message-editor${selector}`] = true;
718
- isValid = false;
719
- isCurrentTabValid = false;
708
+ errorData[parseInt(index)][`message-editor${selector}`] = true;
709
+ isValid = false;
710
+ isCurrentTabValid = false;
720
711
  }
721
712
 
722
-
723
713
 
714
+
724
715
  let title = tab[`message-title${selector}`]
725
716
  if(title){
726
717
  title = title.trim();
@@ -739,7 +730,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
739
730
  errorData[parseInt(index)][`message-title${selector}`] = isBraceError ? TAG_BRACKET_COUNT_MISMATCH_ERROR : true;
740
731
  errorData[parseInt(index)][`bracket-error`] = isBraceError && TAG_BRACKET_COUNT_MISMATCH_ERROR;
741
732
  isValid = false;
742
- isCurrentTabValid = false;
743
733
  }
744
734
  }
745
735
  } else {
@@ -868,9 +858,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
868
858
  isCurrentTabValid = false;
869
859
  }else {
870
860
  errorData[parseInt(index)][key] = false;
871
- }
872
- }
873
- });
861
+ }
862
+ }
863
+ });
874
864
  }
875
865
  }
876
866
  if(index == 0){
@@ -883,7 +873,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
883
873
  errorData['template-name'] = true;
884
874
  isValid = false;
885
875
  androidValid = false;
886
- iosValid = false;
876
+ iosValid = false
887
877
  } else {
888
878
  errorData['template-name'] = false;
889
879
  }
@@ -903,7 +893,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
903
893
  // modal.body = "Android template is not configured. Save without Android template";
904
894
  // modal.id = "ios";
905
895
  // modal.type = 'confirm';
906
- return; //returning from here will not call the liquid middleware
896
+ return;
907
897
  }
908
898
  const iosData = {};
909
899
  for(let data in this.state.formData[1]){
@@ -919,7 +909,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
919
909
  // modal.id = 'android';
920
910
  // modal.type = 'confirm';
921
911
  // this.setState({modal, showModal: true, androidValid, iosValid});
922
- return; //returning from here will not call the liquid middleware
912
+ return;
923
913
  }
924
914
  }
925
915
  if (!androidValid || !iosValid) {
@@ -932,9 +922,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
932
922
  } else if (!isOnlyIos && !isOnlyAndroid && androidValid && iosValid) {
933
923
  isValid = isValid && true;
934
924
  }
935
- isLiquidValid = isValid;
936
925
  }
937
- }
938
926
 
939
927
  // Form Data Validation for Email Channel
940
928
  if (this.props?.schema?.channel?.toUpperCase() === EMAIL) {
@@ -995,7 +983,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
995
983
  errorData[index][currentLang]['template-content'] = true;
996
984
  isValid = false;
997
985
  isLiquidValid = false;
998
- if ((showMessages && !isNaN(index)) || this.liquidFlow()) {
986
+ if ((showMessages && !isNaN(index)) || this.liquidFlow) {
999
987
  if (tagValidationResponse?.missingTags?.length > 0 || tagValidationResponse?.unsupportedTags?.length > 0) {
1000
988
  errorString += `${this.props.intl.formatMessage(messages.contentNotValidLanguage)} ${currentLang}\n`;
1001
989
  }
@@ -1011,7 +999,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1011
999
  if (tagValidationResponse?.isContentEmpty) {
1012
1000
  errorString += this.props.intl.formatMessage(messages.emailBodyEmptyError);
1013
1001
  // Adds a bypass for cases where content is initially empty in the creation flow.
1014
- if(this.liquidFlow()){
1002
+ if(this.liquidFlow){
1015
1003
  errorString = "";
1016
1004
  isLiquidValid = true;
1017
1005
  }
@@ -1019,8 +1007,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1019
1007
  }
1020
1008
  }
1021
1009
  }
1022
- if (errorString) {
1023
- if (this.liquidFlow()) {
1010
+ if (errorString !== "") {
1011
+ if (this.liquidFlow) {
1024
1012
  this.setState(
1025
1013
  (prevState) => ({
1026
1014
  liquidErrorMessage: {
@@ -1030,7 +1018,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1030
1018
  }),
1031
1019
  () => {
1032
1020
  // Callback after the state is updated
1033
- this.props.showLiquidErrorInFooter(this.state.liquidErrorMessage, this.props.channel === SMS? null: this.state.currentTab);
1021
+ this.props.showLiquidErrorInFooter(this.state.liquidErrorMessage);
1034
1022
  }
1035
1023
  );
1036
1024
  } else {
@@ -1046,7 +1034,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1046
1034
  });
1047
1035
  }
1048
1036
 
1049
- const isTemplateValid = this.liquidFlow() ? isLiquidValid : isValid;
1037
+ const isTemplateValid = this.liquidFlow ? isLiquidValid : isValid;
1050
1038
  //Updating the state with the error data
1051
1039
  this.setState((prevState) => ({
1052
1040
  isFormValid: isTemplateValid,
@@ -1058,175 +1046,126 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1058
1046
  },
1059
1047
  errorData,
1060
1048
  }), () => {
1061
- this.props.showLiquidErrorInFooter(this.state.liquidErrorMessage, this.props.channel === SMS? null: this.state.currentTab);
1062
-
1049
+ this.props.showLiquidErrorInFooter(this.state.liquidErrorMessage);
1063
1050
  if (onValidationComplete) {
1064
-
1065
1051
  onValidationComplete();
1066
1052
  }
1067
1053
  });
1068
1054
 
1069
-
1070
1055
  this.props.onFormValidityChange(isTemplateValid, errorData);
1071
1056
  return isTemplateValid;
1072
- }
1057
+ }
1073
1058
 
1074
1059
  indexOfEnd(targetString, string) {
1075
1060
  var io = targetString.indexOf(string);
1076
1061
  return io == -1 ? -1 : io + string.length;
1077
1062
  }
1063
+ continueSaveForm = (id) => {
1078
1064
 
1079
- handleLiquidTemplateSubmit = (templateContent) => {
1080
- const channel = this.props.channel || this.props?.schema?.channel?.toUpperCase();
1081
-
1082
- if (templateContent && channel === EMAIL) {
1083
- this.setState((prevState) => {
1084
- return {
1085
- formData: {
1086
- ...prevState?.formData,
1087
- base: {
1088
- ...prevState?.formData?.base,
1089
- [this.props.baseLanguage]: {
1090
- ...prevState?.formData?.base?.[this.props.baseLanguage],
1091
- "template-content": preprocessHtml(templateContent)
1092
- }
1065
+ };
1066
+ handleLiquidTemplateSubmit =(templateContent) => {
1067
+ if(templateContent){this.setState((prevState) => {
1068
+ return {
1069
+ formData: {
1070
+ ...prevState?.formData,
1071
+ base: {
1072
+ ...prevState?.formData?.base,
1073
+ en: {
1074
+ ...prevState?.formData?.base?.en,
1075
+ "template-content": preprocessHtml(templateContent)
1093
1076
  }
1094
1077
  }
1095
- };
1096
- }, () => {
1097
- if (this.props.onSubmit) {
1098
- this.props.onSubmit(this.state.formData);
1099
1078
  }
1100
- });
1101
- } else {
1102
- // For all other channels
1103
- this.props.onSubmit(this.state.formData);
1104
- }
1105
- }
1106
- onSubmitWrapper = (props) => {
1107
- const {singleTab = null} = props || {};
1108
- if (this.liquidFlow()) {
1109
- // For MPUSH, we need to validate both Android and iOS content separately
1110
- if (this.props.channel === MOBILE_PUSH || this.props?.schema?.channel?.toUpperCase() === MOBILE_PUSH) {
1111
- this.validateFormBuilderMPush(this.state.formData, singleTab);
1112
- return;
1113
- }
1114
-
1115
- // For other channels (EMAIL, SMS, INAPP)
1116
- const content = getChannelData(this.props.schema.channel || this.props.channel, this.state.formData,this.props.baseLanguage);
1117
-
1118
- // Set up callbacks for error and success handling
1119
- const onError = ({ standardErrors, liquidErrors }) => {
1120
- this.setState(
1121
- (prevState) => ({
1122
- liquidErrorMessage: {
1123
- ...prevState.liquidErrorMessage,
1124
- STANDARD_ERROR_MSG: standardErrors,
1125
- LIQUID_ERROR_MSG: liquidErrors,
1126
- },
1127
- }),
1128
- () => {
1129
- this.props.showLiquidErrorInFooter(this.state.liquidErrorMessage);
1130
- this.props.stopValidation();
1131
- }
1132
- );
1133
1079
  };
1134
-
1135
- const onSuccess = (contentToSubmit) => {
1136
- this.handleLiquidTemplateSubmit(contentToSubmit);
1137
- };
1138
-
1139
- // Call the common validation function
1140
- validateLiquidTemplateContent(content, this.props.schema.channel || this.props.channel, {
1141
- getLiquidTags: this.props.actions.getLiquidTags,
1142
- formatMessage: this.props.intl.formatMessage,
1143
- messages,
1144
- onError,
1145
- onSuccess,
1146
- tagLookupMap: this.props?.metaEntities?.tagLookupMap,
1147
- eventContextTags: this.props?.eventContextTags,
1148
- isLiquidFlow: this.liquidFlow(),
1149
- forwardedTags: this.props?.isLoyaltyModule ? this.props?.forwardedTags : {},
1150
- skipTags: this.skipTags.bind(this)
1151
- });
1152
- } else {
1153
- this.props.onSubmit(this.state.formData);
1154
- }
1080
+ }, () => {
1081
+ if (this.props.onSubmit) {
1082
+ this.props.onSubmit(this.state.formData);
1083
+ }
1084
+ });}
1155
1085
  }
1156
-
1086
+
1157
1087
  saveForm(saveForm) {
1158
1088
  if (this.props.isNewVersionFlow && !saveForm) {
1159
1089
  this.props.getValidationData();
1160
1090
  return;
1161
1091
  }
1162
1092
  if ( this.state.isFormValid ) {
1163
- this.onSubmitWrapper();
1164
-
1093
+ if (this.liquidFlow) {
1094
+ const templateContent = this.state.formData?.base?.en?.["template-content"] || "";
1095
+ //Converts given HTML content to plain text string.
1096
+ const content = convert(
1097
+ templateContent, GLOBAL_CONVERT_OPTIONS
1098
+ );
1099
+ /*
1100
+ The `handleResult` function is used as a callback for `getLiquidTags` to handle the results post-processing.
1101
+ It checks for errors and unsupported tags in the fetched liquid tags, displays any necessary validation messages,
1102
+ and proceeds with form submission if all checks pass.
1103
+ */
1104
+ const handleResult = (result) => {
1105
+ const {formatMessage} = this.props.intl;
1106
+ // Checks for errors in the result and displays them if any are found.
1107
+ const validString = /\S/.test(content);
1108
+ // If the content is empty or there are errors in the result, display the necessary validation messages.
1109
+ if (result?.errors?.length > 0 || !validString) {
1110
+ this.setState((prevState) => ({
1111
+ liquidErrorMessage: {
1112
+ ...prevState.liquidErrorMessage,
1113
+ STANDARD_ERROR_MSG: !validString ? [...(prevState.liquidErrorMessage?.STANDARD_ERROR_MSG || []), formatMessage(messages.emailBodyEmptyError)] : prevState.liquidErrorMessage?.STANDARD_ERROR_MSG,
1114
+ LIQUID_ERROR_MSG: result?.errors?.map(error => error?.message) ?? [formatMessage(messages.somethingWentWrong)],
1115
+ }
1116
+ }), () => {
1117
+ this.props.showLiquidErrorInFooter(this.state.liquidErrorMessage);
1118
+ });
1119
+ this.props.stopValidation();
1120
+ return;
1121
+ }
1122
+ // Extracts the supported liquid tags from the given content and do the necessary checks.
1123
+ else {
1124
+ const extractedLiquidTags = extractNames(result?.data || []);
1125
+ // Extracts the supported liquid tags from the given content.
1126
+ const supportedLiquidTags = checkSupport(
1127
+ result,
1128
+ this.props?.metaEntities?.tagLookupMap,
1129
+ this.props?.eventContextTags,
1130
+ this.liquidFlow,
1131
+ this.props?.isLoyaltyModule ? this.props?.forwardedTags : {}
1132
+ );
1133
+ const unsupportedLiquidTags = extractedLiquidTags?.filter(
1134
+ (tag) => !supportedLiquidTags?.includes(tag) && !this.skipTags(tag)
1135
+ );
1136
+ if (
1137
+ unsupportedLiquidTags?.length > 0
1138
+ ) {
1139
+ this.setState(
1140
+ (prevState) => ({
1141
+ liquidErrorMessage: {
1142
+ ...prevState.liquidErrorMessage,
1143
+ LIQUID_ERROR_MSG: [formatMessage(messages.unsupportedTagsValidationError, {
1144
+ unsupportedTags: unsupportedLiquidTags.join(", ")})],
1145
+ },
1146
+ }),
1147
+ () => {
1148
+ this.props.showLiquidErrorInFooter(
1149
+ this.state.liquidErrorMessage
1150
+ );
1151
+ }
1152
+ );
1153
+ this.props.stopValidation();
1154
+ return;
1155
+ }
1156
+ this.handleLiquidTemplateSubmit(templateContent);
1157
+ }
1158
+ };
1159
+ this.props.actions.getLiquidTags(preprocessHtml(content), handleResult);
1160
+ } else {
1161
+ this.props.onSubmit(this.state.formData);
1162
+ }
1165
1163
  } else {
1166
1164
  this.setState({checkValidation: true});
1167
1165
  this.validateForm(null, null, true);
1168
1166
  }
1169
1167
  }
1170
1168
 
1171
-
1172
- // New function to handle MPUSH content validation for both Android and iOS
1173
- validateFormBuilderMPush = (formData,singleTab) => {
1174
- const currentTab = this.state.currentTab;
1175
-
1176
- // Set up callbacks for error and success handling
1177
- const onLiquidError = ({ standardErrors, liquidErrors }) => {
1178
- console.log("onLiquidError.....", standardErrors, liquidErrors);
1179
- this.setState(
1180
- (prevState) => ({
1181
- liquidErrorMessage: {
1182
- ...prevState.liquidErrorMessage,
1183
- STANDARD_ERROR_MSG: standardErrors,
1184
- LIQUID_ERROR_MSG: liquidErrors,
1185
- },
1186
- }),
1187
- () => {
1188
- this.props.showLiquidErrorInFooter(this.state.liquidErrorMessage, this.state.currentTab);
1189
- this.props.stopValidation();
1190
- }
1191
- );
1192
- };
1193
-
1194
- const onSuccess = (contentToSubmit) => {
1195
- // Clear any previous errors
1196
- this.setState(
1197
- (prevState) => ({
1198
- liquidErrorMessage: {
1199
- ...prevState.liquidErrorMessage,
1200
- STANDARD_ERROR_MSG: [],
1201
- LIQUID_ERROR_MSG: [],
1202
- },
1203
- }),
1204
- () => {
1205
- // Format depends on the tabType
1206
- this.handleLiquidTemplateSubmit(contentToSubmit);
1207
- }
1208
- );
1209
- };
1210
-
1211
- // Call the utility function with our callbacks
1212
- validateMobilePushContent(formData, {
1213
- currentTab,
1214
- onError: onLiquidError,
1215
- onSuccess,
1216
- getLiquidTags: this.props.actions.getLiquidTags,
1217
- formatMessage: this.props.intl.formatMessage,
1218
- messages: messages,
1219
- tagLookupMap: this.props?.metaEntities?.tagLookupMap,
1220
- eventContextTags: this.props?.eventContextTags,
1221
- isLiquidFlow: this.liquidFlow(), // Use the method instead of props
1222
- forwardedTags: this.props?.isLoyaltyModule ? this.props?.forwardedTags : {},
1223
- skipTags: this.skipTags.bind(this),
1224
- extractNames,
1225
- checkSupport,
1226
- singleTab: singleTab?.toUpperCase(),
1227
- });
1228
- }
1229
-
1230
1169
  transformInjectedTags(tags) {
1231
1170
  _.forEach(tags, (tag) => {
1232
1171
  const temp = tag;
@@ -1365,7 +1304,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1365
1304
  });
1366
1305
 
1367
1306
  ifSupported = ifSupported || this.checkIfSupportedTag(tagValue, injectedTags);
1368
- if (!ifSupported && !this.liquidFlow()) {
1307
+ if (!ifSupported && !this.liquidFlow) {
1369
1308
  response.unsupportedTags.push(tagValue);
1370
1309
  response.valid = false;
1371
1310
  }
@@ -2339,11 +2278,12 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2339
2278
  };
2340
2279
  handleOk = (ev) => {
2341
2280
  const id = ev.target.id;
2281
+
2342
2282
  this.setState({showModal: false});
2343
2283
  if (id === "android" && this.state.androidValid) {
2344
- this.onSubmitWrapper({singleTab: id});
2284
+ this.props.onSubmit(this.state.formData);
2345
2285
  } else if (id === "ios" && this.state.iosValid) {
2346
- this.onSubmitWrapper({singleTab: id});
2286
+ this.props.onSubmit(this.state.formData);
2347
2287
  } else if (id === "sms-version-modal") {
2348
2288
  this.state.currentEvent.call(this.props.parent, this.state.currentEventData, this.state.currentTab);
2349
2289
  this.setState({currentEvent: {}, currentEventData: {}});
@@ -2543,19 +2483,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2543
2483
  default:
2544
2484
  break;
2545
2485
  }
2546
- const prevErrorMessage = this.state.liquidErrorMessage?.STANDARD_ERROR_MSG?.[0];
2547
- if (prevErrorMessage !== errorMessageText && errorMessageText && this.liquidFlow()) {
2548
- this.setState((prevState) => ({
2549
- liquidErrorMessage: {
2550
- ...prevState.liquidErrorMessage,
2551
- STANDARD_ERROR_MSG: [errorMessageText],
2552
- }
2553
- }), () => {
2554
-
2555
- this.props.showLiquidErrorInFooter(this.state.liquidErrorMessage, this.props.channel === SMS? null: this.state.currentTab);
2556
- });
2557
- }
2558
- else{
2559
2486
  if (styling === 'semantic') {
2560
2487
  columns.push(
2561
2488
  <CapColumn key="input" span={val.width} offset={offset}>
@@ -2563,7 +2490,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2563
2490
  id={val.id}
2564
2491
  placeholder={val.placeholder ? val.placeholder : ''}
2565
2492
  className={`${ifError ? 'error-form-builder' : ''}`}
2566
- errorMessage={errorMessageText && !this.liquidFlow() ? errorMessageText : ''}
2493
+ errorMessage={errorMessageText}
2567
2494
  label={val.label}
2568
2495
  autosize={val.autosize ? val.autosizeParams : false}
2569
2496
  onChange={(e) => this.updateFormData(e.target.value, val)}
@@ -2593,10 +2520,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2593
2520
  </CapColumn>
2594
2521
  );
2595
2522
  }
2596
- }
2597
2523
  };
2598
2524
 
2599
-
2600
2525
  renderColLabelSection(section, childIndex) {
2601
2526
  // const schema = this.props.schema
2602
2527
  const fields = [];
@@ -3540,7 +3465,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3540
3465
  <CapColumn
3541
3466
  style={val.colStyle ? val.colStyle : {border : ""}}
3542
3467
  span={val.width}
3543
- className={`${(this.state.liquidErrorMessage?.LIQUID_ERROR_MSG?.length || this.state.liquidErrorMessage?.STANDARD_ERROR_MSG?.length) && this.liquidFlow() && "error-boundary"} `}
3468
+ className={`${(this.state.liquidErrorMessage?.LIQUID_ERROR_MSG?.length || this.state.liquidErrorMessage?.STANDARD_ERROR_MSG?.length) && this.liquidFlow && "error-boundary"} `}
3544
3469
  >
3545
3470
  <CKEditor
3546
3471
  id={val.id}
@@ -3584,7 +3509,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3584
3509
  isModuleFilterEnabled = this.props.isFullMode;
3585
3510
  }
3586
3511
  columns.push(
3587
- <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"}`}>
3512
+ <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"}`}>
3588
3513
  <BeeEditor
3589
3514
  uid={uuid}
3590
3515
  tokenData={beeToken}
@@ -3870,7 +3795,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3870
3795
 
3871
3796
 
3872
3797
  return (
3873
- <CapSpin spinning={Boolean((this.liquidFlow() && this.props.liquidExtractionInProgress) || this.props.metaDataStatus === REQUEST)} tip={this.props.intl.formatMessage(messages.liquidSpinText)} >
3798
+ <CapSpin spinning={Boolean((this.liquidFlow && this.props.liquidExtractionInProgress) || this.props.metaDataStatus === REQUEST)} tip={this.props.intl.formatMessage(messages.liquidSpinText)} >
3874
3799
  <CapRow>
3875
3800
  {this.props.schema && this.renderForm()}
3876
3801
  <SlideBox
@@ -3952,8 +3877,7 @@ FormBuilder.propTypes = {
3952
3877
  isFullMode: PropTypes.bool,
3953
3878
  currentOrgDetails: PropTypes.object,
3954
3879
  liquidExtractionInProgress: PropTypes.bool,
3955
- showLiquidErrorInFooter: PropTypes.func,
3956
- channel: PropTypes.string,
3880
+ showLiquidErrorInFooter: PropTypes.func
3957
3881
  };
3958
3882
 
3959
3883
  const mapStateToProps = createStructuredSelector({
@@ -3970,4 +3894,3 @@ function mapDispatchToProps(dispatch) {
3970
3894
  }
3971
3895
 
3972
3896
  export default connect(mapStateToProps,mapDispatchToProps)(injectIntl(FormBuilder));
3973
-
@@ -94,7 +94,7 @@ export default defineMessages({
94
94
  id: 'creatives.componentsV2.FormBuilder.somethingWentWrong',
95
95
  defaultMessage: 'Something went wrong while validating content, please try again later',
96
96
  },
97
- liquidSpinText: {
97
+ liquidSpinText:{
98
98
  id: 'creatives.componentsV2.FormBuilder.liquidSpinText',
99
99
  defaultMessage: 'Validating the template, it might take a few seconds',
100
100
  },
@@ -90,13 +90,13 @@ function capReducer(state = fromJS(initialState.cap), action) {
90
90
  .set('fetchingSchemaError', true);
91
91
  case types.GET_LIQUID_TAGS_REQUEST:
92
92
  return state
93
- .set('fetchingLiquidTags', true);
93
+ .set('fetchingLiquidTags', true)
94
94
  case types.GET_LIQUID_TAGS_FAILURE:
95
95
  return state
96
- .set('fetchingLiquidTags', false);
97
- case types.GET_LIQUID_TAGS_SUCCESS:
96
+ .set('fetchingLiquidTags', false)
97
+ case types.GET_LIQUID_TAGS_SUCCESS:
98
98
  return state
99
- .set('fetchingLiquidTags', false);
99
+ .set('fetchingLiquidTags', false)
100
100
  case types.GET_SCHEMA_FOR_ENTITY_SUCCESS: {
101
101
  //Process standard tags
102
102
  const standardTagMapInitial = _.keyBy(