@capillarytech/creatives-library 7.17.205 → 7.17.206-alpha.0

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.17.205",
4
+ "version": "7.17.206-alpha.0",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -18,9 +18,9 @@ import './style.scss';
18
18
  // import messages from './messages';
19
19
  const loadScript = require('load-script');
20
20
 
21
- const defaultScriptUrl = `${window.location.origin}/arya/ui/library/ckeditor/ckeditor.js`;
22
- /*const defaultScriptUrl = 'https://nightly.intouch.capillarytech.com/arya/ui/library/ckeditor/ckeditor.js';
23
- *Uncomment the above line to use CKEDITOR in local
21
+ // const defaultScriptUrl = `${window.location.origin}/arya/ui/library/ckeditor/ckeditor.js`;
22
+ const defaultScriptUrl = 'https://nightly.intouch.capillarytech.com/arya/ui/library/ckeditor/ckeditor.js';
23
+ /*Uncomment the above line to use CKEDITOR in local
24
24
  */
25
25
  const user = localStorage.getItem('user');
26
26
  let locale = 'en';
@@ -187,6 +187,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
187
187
  this.setState({formData: nextProps.formData, tabCount: nextProps.tabCount});
188
188
  // this.resetTabKeys(nextProps.formData, nextProps.tabCount);
189
189
  } else if (this.props.schema && this.props.schema.channel && this.props.schema.channel.toUpperCase() === 'EMAIL') {
190
+ console.log('EMAIL isEdit', this.state.formData);
190
191
  this.setState({formData: nextProps.formData});
191
192
  }
192
193
 
@@ -1062,6 +1063,27 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1062
1063
  continueSaveForm = (id) => {
1063
1064
 
1064
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)
1076
+ }
1077
+ }
1078
+ }
1079
+ };
1080
+ }, () => {
1081
+ console.log('BC FORMDATA', this.state.formData);
1082
+ if (this.props.onSubmit) {
1083
+ this.props.onSubmit(this.state.formData);
1084
+ }
1085
+ });}
1086
+ }
1065
1087
  saveForm(saveForm) {
1066
1088
  if (this.props.isNewVersionFlow && !saveForm) {
1067
1089
  this.props.getValidationData();
@@ -1069,9 +1091,10 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1069
1091
  }
1070
1092
  if ( this.state.isFormValid ) {
1071
1093
  if (this.liquidFlow) {
1094
+ const templateContent = this.state.formData?.base?.en?.["template-content"] || "";
1072
1095
  //Converts given HTML content to plain text string.
1073
1096
  const content = convert(
1074
- this.state.formData?.base?.en?.["template-content"]
1097
+ templateContent
1075
1098
  );
1076
1099
  /*
1077
1100
  The `handleResult` function is used as a callback for `getLiquidTags` to handle the results post-processing.
@@ -1124,7 +1147,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1124
1147
  this.props.stopValidation();
1125
1148
  return;
1126
1149
  }
1127
- this.props.onSubmit(this.state.formData);
1150
+ this.handleLiquidTemplateSubmit(templateContent);
1128
1151
  }
1129
1152
  };
1130
1153
  this.props.actions.getLiquidTags(preprocessHtml(content), handleResult);