@capillarytech/creatives-library 7.7.18 → 7.7.19

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.
@@ -214,7 +214,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
214
214
  if (nextProps.isNewVersionFlow && !this.state.formData[this.state.currentTab - 1][this.state.formData[this.state.currentTab - 1].activeTab].tabKey) {
215
215
  this.resetTabKeys(nextProps.formData, nextProps.tabCount, false, true);
216
216
  }
217
- if (type === 'embedded' || this.props.schema.channel.toUpperCase() === 'EMAIL') {
217
+ if (type === 'embedded' || (this.props?.schema?.channel || "").toUpperCase() === 'EMAIL') {
218
218
  this.validateForm();
219
219
  }
220
220
  if ((this.props.schema && this.props.schema.channel && this.props.schema.channel.toUpperCase() === 'MOBILEPUSH')) {
@@ -2917,7 +2917,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2917
2917
  }
2918
2918
 
2919
2919
  const currentLang = ((!_.isEmpty(this.state.formData) && !_.isEmpty(this.state.formData[`${this.state.currentTab - 1}`]) && !_.isEmpty(this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages) && this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages[langIndex]) ? this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages[langIndex] : this.props.baseLanguage) || 'en';
2920
- const content = (!_.isEmpty(this.state.formData) && this.state.formData[`${this.state.currentTab - 1}`][currentLang]['template-content'] ? this.state.formData[`${this.state.currentTab - 1}`][currentLang]['template-content'] : '');
2920
+ const content = this.state?.formData?.[`${this.state.currentTab - 1}`]?.[currentLang]?.['template-content'] || "";
2921
2921
 
2922
2922
  if (this.state.formData[`${this.state.currentTab - 1}`][currentLang].is_drag_drop) {
2923
2923
  // content = "";
@@ -872,10 +872,15 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
872
872
  const langIndex = formData[this.state.currentTab - 1].selectedLanguages.indexOf(langId);
873
873
 
874
874
  const temp = (schema.containers || {})[this.state.currentTab - 1];
875
+ const isStyleExists= temp?.tabBarExtraContent?.sections?.[0]?.inputFields?.[0]?.cols?.[4]?.content?.sections?.[0]?.inputFields?.[2]?.cols?.[0]?.style;
875
876
  if (baseLanguage === langId && (apiLangId === "undefined" || apiLangId === formData[this.state.currentTab - 1].activeTab)) {
876
- temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: "none"};
877
+ if(isStyleExists){
878
+ temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: "none"};
879
+ }
877
880
  } else if (apiLangId === "undefined" || apiLangId === formData[this.state.currentTab - 1].activeTab) {
878
- temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: ""};
881
+ if(isStyleExists){
882
+ temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: ""};
883
+ }
879
884
  }
880
885
 
881
886
  if (nextProps.Email.CmsSettings.isDragDrop) {
@@ -2717,7 +2722,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2717
2722
  }
2718
2723
  formData.base = _.cloneDeep(formData[0]);
2719
2724
 
2720
- this.setState({formData, loading: false, injectedTags: data.tags, tabKey, isDragDrop: (data.base.is_drag_drop !== 0 )}, () => {
2725
+ this.setState({formData, loading: false, injectedTags: data.tags, tabKey, isDragDrop: (data?.base?.is_drag_drop !== 0 )}, () => {
2721
2726
  // this.setState({tabKey: ''});
2722
2727
  _.forEach(formData[0].selectedLanguages, (language) => {
2723
2728
  if (formData[0][language].is_drag_drop) {
@@ -517,13 +517,13 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
517
517
  mode: this.props.params.mode,
518
518
  };
519
519
  const android = {};
520
- Object.keys(formData[0]).forEach((data) => {
520
+ Object.keys((formData[0] || {})).forEach((data) => {
521
521
  if (!!formData[0][data] && data !== "tabKey") {
522
522
  android[data] = formData[0][data];
523
523
  }
524
524
  });
525
525
  const ios = {};
526
- Object.keys(formData[1]).forEach((data) => {
526
+ Object.keys((formData[1] || {})).forEach((data) => {
527
527
  if (!!formData[1][data] && data !== "tabKey") {
528
528
  ios[data] = formData[1][data];
529
529
  }
@@ -611,7 +611,9 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
611
611
  setSelectedTemplateData(weChatData) {
612
612
  let schema = _.cloneDeep(this.state.baseSchema);
613
613
  const { intl: {formatMessage}} = this.props;
614
- schema.standalone.sections[0].childSections[1].childSections[0].childSections[1].inputFields = [];
614
+ if(schema?.standalone?.sections?.[0]?.childSections?.[1]?.childSections?.[0]?.childSections?.[1]?.inputFields){
615
+ schema.standalone.sections[0].childSections[1].childSections[0].childSections[1].inputFields = []
616
+ };
615
617
  if (_.isEmpty(weChatData)) {
616
618
  // schema.standalone.sections[0].childSections[1].childSections[0].childSections[1].inputFields = [];
617
619
  const formData=_.cloneDeep(this.state.formData);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.7.18",
4
+ "version": "7.7.19",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -31,8 +31,12 @@ const creativeDetails = ({
31
31
 
32
32
  const isLabelsUsed = (content = '') => {
33
33
  const tagRegex = /{{[(A-Z\w+(\s\w+)*$\(\)@!#$%^&*~.,/\\]+}}/g; // eslint-disable-line no-useless-escape
34
- content = content.replaceAll('{{optout}}', '');
35
- content = content.replaceAll('{{unsubscribe}}', '');
34
+ const isContentString= typeof content === "string";
35
+ if(isContentString){
36
+ content = content.replaceAll('{{optout}}', '');
37
+ content = content.replaceAll('{{unsubscribe}}', '');
38
+ }
39
+
36
40
  const tags = [...content.matchAll(tagRegex)];
37
41
  return !!tags.length;
38
42
  };
@@ -5,13 +5,17 @@ const gtmEvents = require.context('./gtmEvents', true, /\.js$/, 'lazy');
5
5
  export const gtmPush = (eventType, eventObject) => {
6
6
  try {
7
7
  gtmEvents(`./${eventType}.js`)
8
- .then(event => {
8
+ .then((event) => {
9
9
  event.default(eventObject);
10
10
  })
11
- .catch(err => {
12
- Bugsnag.notify(err);
11
+ .catch((err) => {
12
+ if (err) {
13
+ Bugsnag.notify(err);
14
+ }
13
15
  });
14
16
  } catch (e) {
15
- Bugsnag.notify(e);
17
+ if (e) {
18
+ Bugsnag.notify(e);
19
+ }
16
20
  }
17
21
  };