@capillarytech/creatives-library 0.0.3 → 0.0.5

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.
@@ -27,7 +27,7 @@ class CardGrid extends React.Component { // eslint-disable-line react/prefer-sta
27
27
  return (
28
28
  <div className={this.props.className}>
29
29
  <div style={{ marginBottom: '16px' }}>{this.props.filterContent}</div>
30
- {this.props.listItem && this.props.listItem.length > 0 && <div className={this.props.enablePagination ? 'pagination-container' : ''}>
30
+ <div className={this.props.enablePagination ? 'pagination-container' : ''}>
31
31
  <Row gutter={this.props.gutterSize}>
32
32
  { this.props.listItem ? this.props.listItem.map( (item) => (
33
33
  <Col style={{ width: `${100 / this.props.colNumber}%`, paddingBottom: '16px'}} key={item.id} span={parseInt(24 / this.props.colNumber, 10)}>
@@ -35,7 +35,7 @@ class CardGrid extends React.Component { // eslint-disable-line react/prefer-sta
35
35
  </Col>
36
36
  )) : ''}
37
37
  </Row>
38
- </div>}
38
+ </div>
39
39
  </div>
40
40
  );
41
41
  }
@@ -77,6 +77,7 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
77
77
  },
78
78
  content: "",
79
79
  editorInstance: undefined,
80
+ setInitData: false,
80
81
  };
81
82
 
82
83
  this.delayTimer = 0;
@@ -86,10 +87,16 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
86
87
 
87
88
  componentWillMount() {
88
89
  let content = '';
90
+ this.id = this.props.id;
89
91
  if (this.props.content !== '') {
90
92
  content = this.props.content;
93
+ content = content.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/\\&quot;/g, "\"");
91
94
  }
92
- this.setState({content});
95
+ this.setState({content}, () => {
96
+ if (this.editorInstance) {
97
+ this.editorInstance.setData(content);
98
+ }
99
+ });
93
100
  }
94
101
 
95
102
  //load ckeditor script as soon as component mounts if not already loaded
@@ -98,22 +105,12 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
98
105
  }
99
106
 
100
107
  componentWillReceiveProps(nextProps) {
108
+ this.id = this.props.id;
101
109
  if (this.editorInstance && this.editorInstance.status === "ready") {
110
+ // setTimeout(() => {
111
+ // this.editorInstance.name = this.id;
112
+ // }, 5000);
102
113
  console.log('nextProps CKEditor', nextProps, this.state.content, this.props.id);
103
- // if (!_.isEqual(nextProps.content, this.state.content)) {
104
- if (nextProps.content !== this.state.content) {
105
- let html = nextProps.content;
106
- if (html && html !== "") {
107
- console.log('html ckeditor', html);
108
- html = html.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/\\&quot;/g, "\"");
109
- }
110
- console.log("New content", nextProps.content, this.state.content, html);
111
- this.setState({content: html}, () => {
112
- this.editorInstance.setData(html);
113
- // this.editorInstance.insertHtml(html);
114
- // this.editorInstance.content = html;
115
- });
116
- }
117
114
  }
118
115
  }
119
116
 
@@ -135,7 +132,7 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
135
132
 
136
133
  let html = this.props.content;
137
134
  html = html.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"");
138
- console.log("ckeditor loading 1", this.node);
135
+ console.log("ckeditor loading 1", this.node, html);
139
136
  this.editorInstance = window.CKEDITOR.appendTo(
140
137
  this.node,
141
138
  this.state.config,
@@ -144,8 +141,9 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
144
141
  console.log('2');
145
142
 
146
143
  if (this.props.getEditorInstanse) {
147
- this.props.getEditorInstanse(this.editorInstance);
144
+ this.props.getEditorInstanse(this.editorInstance, this.props.id);
148
145
  }
146
+ //this.editorInstance.name = this.id;
149
147
 
150
148
  //Register listener for custom events if any
151
149
  this.editorInstance.on('change', this.handleContentChange);
@@ -160,6 +158,10 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
160
158
  }
161
159
 
162
160
  handleContentChange = (evt) => {
161
+ // this.setState({content: this.editorInstance.getData()}, () => {
162
+ // this.props.handleContentChange(evt);
163
+ // // evt.setData(this.editorInstance.getData());
164
+ // });
163
165
  this.delay(() => {
164
166
  this.setState({content: this.editorInstance.getData()}, () => {
165
167
  this.props.handleContentChange(evt);
@@ -168,6 +170,7 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
168
170
  };
169
171
 
170
172
  render() {
173
+ console.log('ckeditor loading render', this.props);
171
174
  return (
172
175
  <div id={this.props.id} style={{borderRight: "1px solid #000 !important"}}>
173
176
  <div className={this.props.activeClass} ref={(node) => (this.node = node)}/>
@@ -35,7 +35,6 @@ class CustomPopOver extends React.Component { // eslint-disable-line react/prefe
35
35
  }
36
36
 
37
37
  render() {
38
- console.log('Test Custom popover', this.props.popOverList.length, this.props.excludeList.length);
39
38
  return (
40
39
  <div>
41
40
  <CapPopover
@@ -43,6 +42,8 @@ class CustomPopOver extends React.Component { // eslint-disable-line react/prefe
43
42
  className={this.props.className}
44
43
  trigger={this.props.trigger}
45
44
  placement={this.props.placement}
45
+ visible={this.props.visible}
46
+ onVisibleChange={this.props.onVisibleChange}
46
47
  style={{height: '100%'}}
47
48
  content={
48
49
  this.renderPopoverContent()
@@ -71,6 +72,8 @@ CustomPopOver.propTypes = {
71
72
  excludeList: PropTypes.array,
72
73
  trigger: PropTypes.string,
73
74
  placement: PropTypes.string,
75
+ visible: PropTypes.bool,
76
+ onVisibleChange: PropTypes.func,
74
77
  handlePopOverClick: PropTypes.func,
75
78
  };
76
79
 
@@ -46,6 +46,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
46
46
  currentEvent: {},
47
47
  currentEventData: {},
48
48
  popoverVisible: false,
49
+ customPopoverVisible: false,
49
50
  };
50
51
  this.renderForm = this.renderForm.bind(this);
51
52
  this.updateFormData = this.updateFormData.bind(this);
@@ -95,7 +96,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
95
96
  }
96
97
 
97
98
  componentWillReceiveProps(nextProps) {
98
- console.log('nextprops', nextProps, this.state.formData);
99
+ console.log('outgoing nextprops', nextProps, this.state.formData);
99
100
  const type = this.props.location.query.type;
100
101
  if (this.state.usingTabContainer && nextProps.tabCount !== this.props.tabCount) {
101
102
  this.setState({tabCount: nextProps.tabCount});
@@ -163,16 +164,16 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
163
164
  ( !this.state.usingTabContainer || (this.state.usingTabContainer && nextProps.tabKey !== ''))
164
165
  && !_.isEqual(nextProps.formData, this.state.formData) &&
165
166
  !_.isEqual(nextProps.formData, this.props.formData)) {
166
- console.log('hahaha', nextProps.tabKey);
167
+ console.log('outgoing hahaha', nextProps.tabKey);
167
168
  this.setState({formData: nextProps.formData, tabKey: nextProps.tabKey}, () => {
168
169
  this.validateForm();
169
170
  });
170
171
  //this.resetTabKeys(nextProps.formData, nextProps.tabCount);
171
172
  } else if ((_.isEmpty(this.props.formData) || !this.props.formData) && _.isEmpty(this.state.formData)) {
172
- console.log('init when empty');
173
+ console.log('outgoing init when empty');
173
174
  this.initialiseForm(nextProps.schema, true);
174
175
  } else if (_.isEmpty(this.props.formData) && !_.isEmpty(nextProps.formData)) {
175
- console.log('clean form data');
176
+ console.log('outgoing clean form data');
176
177
  this.setState({formData: nextProps.formData});
177
178
  }
178
179
 
@@ -186,12 +187,18 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
186
187
  }
187
188
 
188
189
  if (!_.isEmpty(nextProps.formData) && !_.isEqual(this.state.formData, nextProps.formData)) {
190
+ console.log('outgoing always', nextProps.formData);
189
191
  if (nextProps.isNewVersionFlow) {
192
+ console.log('outgoing new flow');
190
193
  const tabKey = (this.state.tabKey !== nextProps.formData[nextProps.currentTab - 1].tabKey) ? nextProps.formData[nextProps.currentTab - 1].tabKey : this.state.tabKey;
191
- console.log('tab key form builder', this.state.tabKey, nextProps.formData[nextProps.currentTab - 1].tabKey, nextProps.formData, this.state.formData);
194
+ console.log('outgoing tab key form builder', this.state.tabKey, nextProps.formData[nextProps.currentTab - 1].tabKey, nextProps.formData, this.state.formData);
192
195
  this.setState({tabKey});
193
196
  }
194
197
  this.setState({formData: nextProps.formData, currentLangTab}, () => {
198
+ if (nextProps.isNewVersionFlow && !this.state.formData[this.state.currentTab - 1][this.state.formData[this.state.currentTab - 1].activeTab].tabKey) {
199
+ console.log('outgoing have to reset tab keys');
200
+ this.resetTabKeys(nextProps.formData, nextProps.tabCount, false, true);
201
+ }
195
202
  if (type === 'embedded') {
196
203
  this.validateForm();
197
204
  }
@@ -201,15 +208,22 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
201
208
  });
202
209
  }
203
210
 
204
- console.log('Next prop schema ', nextProps.schema);
211
+ console.log('outgoing Next prop schema ', nextProps.schema);
205
212
  if (!_.isEqual(nextProps.schema, this.props.schema)) {
206
- console.log('Reinitializing form ', nextProps.schema, this.props.schema);
213
+ console.log('outgoing Reinitializing form ', nextProps.schema, this.props.schema);
207
214
  this.setState({ isFormValid: (this.props.isEdit ? this.props.isEdit : true) }, () => {
215
+ console.log('outgoing set validity');
208
216
  if (!this.props.isEdit || (this.props.isEdit && !_.isEmpty(nextProps.formData))) {
217
+ console.log('outgoing 1', this.state.formData, nextProps.formData);
209
218
  let resetTabKeys = (this.state.formData.tabKey === undefined);
210
219
  if ((this.props.schema && this.props.schema.channel && this.props.schema.channel.toUpperCase() === 'MOBILEPUSH')) {
211
220
  resetTabKeys = false;
221
+ console.log('outgoing 2');
212
222
  }
223
+ if (this.props.isNewVersionFlow) {
224
+ resetTabKeys = false;
225
+ }
226
+ console.log('outgoing 3', resetTabKeys);
213
227
  this.initialiseForm(nextProps.schema, false, resetTabKeys);
214
228
  this.validateForm();
215
229
  }
@@ -312,17 +326,46 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
312
326
  this.setState({ popoverVisible });
313
327
  };
314
328
 
315
- resetTabKeys(form, count, changeDefaultTab) {
329
+ handleCustomPopoverVisibleChange = (customPopoverVisible) => {
330
+ this.setState({ customPopoverVisible });
331
+ };
332
+
333
+ resetTabKeys(form, count, changeDefaultTab, setFormTabKey) {
316
334
  const tabCount = count || this.state.tabCount;
335
+ console.log('outgoing reset', form, count, changeDefaultTab);
317
336
  console.log('incoming reset', form, tabCount);
318
337
  const formData = _.cloneDeep(form);
319
338
  let baseIndex = 0;
320
339
  for (let idx = 0; idx < tabCount; idx += 1) {
321
340
  if (this.props.isNewVersionFlow && formData[idx].selectedLanguages.length > 0) {
322
341
  for (let langIndex = 0; langIndex < formData[idx].selectedLanguages.length; langIndex += 1 ) {
342
+ const id = _.uniqueId();
323
343
  if (formData[idx][formData[idx].selectedLanguages[langIndex]]) {
324
344
  if (!formData[idx][formData[idx].selectedLanguages[langIndex]].tabKey) {
325
- formData[idx][formData[idx].selectedLanguages[langIndex]].tabKey = _.uniqueId();
345
+ formData[idx][formData[idx].selectedLanguages[langIndex]].tabKey = id;
346
+ }
347
+ if (formData[idx].base) {
348
+ formData.base[formData.base.selectedLanguages[langIndex]].tabKey = id;
349
+ }
350
+ }
351
+ }
352
+ if (setFormTabKey) {
353
+ if (!formData[idx].activeTab) {
354
+ const baseLanguage = this.props.baseLanguage;
355
+ console.log('outgoing reset do not have active tab');
356
+ formData[idx].tabKey = formData[idx][baseLanguage].tabKey;
357
+ } else {
358
+ console.log('outgoing reset have active tab');
359
+ formData[idx].tabKey = formData[idx][formData[idx].activeTab].tabKey;
360
+ }
361
+ if (formData[idx].base) {
362
+ if (!formData.base.activeTab) {
363
+ console.log('outgoing reset do not have active tab base');
364
+ const baseLanguage = this.props.baseLanguage;
365
+ formData.base.tabKey = formData.base[baseLanguage].tabKey;
366
+ } else {
367
+ console.log('outgoing reset have active tab base');
368
+ formData.base.tabKey = formData.base[formData[idx].activeTab].tabKey;
326
369
  }
327
370
  }
328
371
  }
@@ -353,11 +396,19 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
353
396
  console.log('setting tab key', formData.base.tabKey, this.state.tabKey);
354
397
  if (this.state.currentTab === 1 && !this.props.isNewVersionFlow) {
355
398
  this.setState({tabKey: formData.base.tabKey});
399
+ } else if (this.props.isNewVersionFlow && this.state.tabKey !== formData[this.state.currentTab - 1].tabKey) {
400
+ this.setState({tabKey: formData[this.state.currentTab - 1].tabKey});
356
401
  }
357
402
  }
403
+ if (setFormTabKey) {
404
+ console.log('outgoing reset form builder tab key', formData.base.tabKey, formData[0].tabKey, formData);
405
+ this.setState({tabKey: formData.base.tabKey});
406
+ }
358
407
  console.log('form data before adding key', formData);
408
+ console.log('outgoing reset final before set', formData);
359
409
  if (changeDefaultTab) {
360
410
  this.setState({formData}, () => {
411
+ console.log('outgoing reset set data', formData);
361
412
  this.props.onChange(formData, this.state.tabCount);
362
413
  this.validateForm();
363
414
  });
@@ -701,7 +752,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
701
752
  // isValid = false;
702
753
  // }
703
754
  }
704
- if (type.toLowerCase() === 'embedded' && (currentModule.toLowerCase() === 'loyalty' || currentModule.toLowerCase() === 'dvs' || currentModule.toLowerCase() === 'subscription')) {
755
+ if (type.toLowerCase() === 'embedded' && (currentModule.toLowerCase() === 'loyalty' || currentModule.toLowerCase() === 'dvs' || currentModule.toLowerCase() === 'timeline' || currentModule.toLowerCase() === 'library')) {
705
756
  if (this.state.formData['template-subject'] && this.state.formData['template-subject'].trim() === '') {
706
757
  errorData['template-subject'] = true;
707
758
  isValid = false;
@@ -1056,6 +1107,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1056
1107
  }
1057
1108
 
1058
1109
  initialiseForm(schema, makeFormEmpty, resetTabKeys) {
1110
+ console.log('outgoing init form xxx', schema, makeFormEmpty, this.state.formData, resetTabKeys);
1059
1111
  console.log('init form xxx', schema, makeFormEmpty, this.state.formData, resetTabKeys);
1060
1112
  let formData = makeFormEmpty ? {} : _.cloneDeep(this.state.formData);
1061
1113
  let errorData = {};
@@ -1436,14 +1488,19 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1436
1488
  }
1437
1489
 
1438
1490
  updateFormData(data, val, event) {
1439
- console.log('updating data', data, val, event);
1491
+ console.log('updating data', data, val, event, this.props.addLanguageType);
1440
1492
  const formData = _.cloneDeep(this.state.formData);
1493
+ console.log('oform data before updating', JSON.stringify(formData));
1441
1494
  const tabIndex = this.state.currentTab - 1;
1442
1495
  let currentTab = _.cloneDeep(this.state.currentTab);
1496
+ console.log('setting form data1', JSON.stringify(formData));
1443
1497
  if (this.state.usingTabContainer && !val.standalone) {
1444
1498
  const data1 = data;
1445
1499
  if (event === "addLanguage") {
1446
1500
  const addLanguageType = this.props.addLanguageType;
1501
+ if (addLanguageType === '') {
1502
+ return;
1503
+ }
1447
1504
  const currentLang = formData[tabIndex].activeTab;
1448
1505
  let baseTab = _.cloneDeep(formData[tabIndex][currentLang]);
1449
1506
  let id = _.uniqueId();
@@ -1458,10 +1515,11 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1458
1515
  while (!validId) {
1459
1516
  validId = true;
1460
1517
  for (let idx = 0; idx < formData[tabIndex].selectedLanguages.length; idx += 1) {
1461
- if (!formData[idx]) {
1518
+ if (!formData[tabIndex]) {
1462
1519
  continue;
1463
1520
  }
1464
- if (id === formData[idx].tabKey) {
1521
+ console.log('comparing tab keys', id, formData, formData[tabIndex][formData[tabIndex].selectedLanguages[idx]].tabKey);
1522
+ if (id === formData[tabIndex][formData[tabIndex].selectedLanguages[idx]].tabKey) {
1465
1523
  validId = false;
1466
1524
  }
1467
1525
  }
@@ -1492,7 +1550,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1492
1550
  if (!formData[idx]) {
1493
1551
  continue;
1494
1552
  }
1495
- if (id === formData[idx].tabKey) {
1553
+ if (id === formData[tabIndex][formData[tabIndex].selectedLanguages[idx]].tabKey) {
1496
1554
  validId = false;
1497
1555
  }
1498
1556
  }
@@ -1508,6 +1566,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1508
1566
  formData[tabIndex].activeTab = data.iso_code;
1509
1567
  formData[tabIndex].tabKey = baseTab.tabKey;
1510
1568
  break;
1569
+ case '':
1570
+ return;
1511
1571
  default:
1512
1572
  break;
1513
1573
  }
@@ -1516,11 +1576,13 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1516
1576
  that.setState({tabKey: baseTab.tabKey});
1517
1577
  }, 0);
1518
1578
  }
1579
+ console.log('setting form data2', JSON.stringify(formData));
1519
1580
  if (!this.props.isNewVersionFlow) {
1520
1581
  formData[tabIndex][val.id] = data1;
1521
- } else if (event !== "addLanguage") {
1582
+ } else if (this.props.isNewVersionFlow && event !== "addLanguage" && event !== "onContentChange") {
1522
1583
  formData[tabIndex][this.props.baseLanguage][val.id] = data1;
1523
1584
  }
1585
+ console.log('setting form data3', JSON.stringify(formData));
1524
1586
  if (formData[tabIndex].base) {
1525
1587
  if (!this.props.isNewVersionFlow) {
1526
1588
  formData.base[val.id] = data1;
@@ -1531,9 +1593,11 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1531
1593
  formData.base.selectedLanguages = formData[tabIndex].selectedLanguages;
1532
1594
  }
1533
1595
  }
1596
+ console.log('setting form data4', JSON.stringify(formData));
1534
1597
  } else {
1535
1598
  formData[val.id] = data;
1536
1599
  }
1600
+ console.log('setting form data5', JSON.stringify(formData));
1537
1601
  if (this.props.isNewVersionFlow) {
1538
1602
  console.log('Version Select ', data, val, event);
1539
1603
  if (event === 'onSelect' && data === 'New Version') {
@@ -1547,6 +1611,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1547
1611
  val.injectedEvents[event].call(this, this.state.formData['template-version-options'][currentTab - 1].key, formData, val);
1548
1612
  });
1549
1613
  }
1614
+ console.log('setting form data6', JSON.stringify(formData));
1550
1615
  if (event === 'onContentChange') {
1551
1616
  console.log('onContentChange ', data, val, event, data.editor.getData());
1552
1617
  // formData[`${this.state.currentTab - 1}`][formData[`${this.state.currentTab - 1}`].activeTab]['template-content'] = data.editor.getData();
@@ -1555,6 +1620,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1555
1620
  //}
1556
1621
  }
1557
1622
  }
1623
+ console.log('setting form data7', JSON.stringify(formData));
1558
1624
  console.log('setting form data', formData);
1559
1625
  this.setState({formData}, () => {
1560
1626
  this.validateForm();
@@ -1742,6 +1808,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1742
1808
  if (!this.allowAddSecondaryCta(val)) {
1743
1809
  return;
1744
1810
  }
1811
+ } else if (event === "onContentChange") {
1812
+ val.injectedEvents[event].call(this.props.parent, data, val.id);
1745
1813
  } else if (event === 'deleteLanguage') {
1746
1814
  this.setState({currentEvent: val.injectedEvents[event], currentEventData: data }, () => {
1747
1815
  this.props.setModalContent('delete-language');
@@ -1797,14 +1865,16 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1797
1865
  value: 'ok',
1798
1866
  };
1799
1867
  this.props.iframeParent.postMessage(JSON.stringify(response), '*');
1868
+ const isLanguageSupport = this.props.location.query.isLanguageSupport || false;
1800
1869
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
1801
1870
  this.props.router.push({
1802
1871
  pathname: `/${this.props.schema.channel.toLowerCase()}/`,
1803
- query: type === 'embedded' ? {type: 'embedded', module} : {module},
1872
+ query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport} : {module, isLanguageSupport},
1804
1873
  });
1805
1874
  } else if (id === "email-language-delete-modal") {
1806
1875
  console.log('Delete languages ');
1807
1876
  this.deleteLanguage();
1877
+ this.props.handleCancelModal();
1808
1878
  // this.setState({currentEvent: {}, currentEventData: {}});
1809
1879
  } else if (id === 'email-version-delete-modal') {
1810
1880
  this.deleteVersion(false, this.state.currentTab);
@@ -1866,11 +1936,11 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1866
1936
  } else {
1867
1937
  this.setState({hoveredItem: ''});
1868
1938
  }
1869
- };
1939
+ }
1870
1940
 
1871
1941
  handleOnItemClick = (isClicked, id) => {
1872
1942
  this.setState({clickedItem: id});
1873
- };
1943
+ }
1874
1944
 
1875
1945
  populateTemplatesList(data) {
1876
1946
  if (!data) {
@@ -1910,7 +1980,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1910
1980
  }
1911
1981
 
1912
1982
  handleAddLanguageFlow(data, val, event) {
1913
- this.setState({currentEventData: data, currentEventVal: val, currentEvent: event}, () => {
1983
+ this.setState({currentEventData: data, currentEventVal: val, currentEvent: event, customPopoverVisible: false}, () => {
1914
1984
  this.props.setModalContent('add-language', data);
1915
1985
  });
1916
1986
  }
@@ -2122,7 +2192,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2122
2192
  content={(this.state.formData[`${this.state.currentTab - 1}`][val.id] ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : '')}
2123
2193
  events={val.events}
2124
2194
  getEditorInstanse={val.getEditorInstanse}
2125
- handleContentChange={(event) => this.updateFormData(event, val, 'onContentChange')}
2195
+ // this.callChildEvent(data, val, 'addVersion', event);
2196
+ handleContentChange={(event) => this.callChildEvent(event, val, 'onContentChange')}
2126
2197
  />
2127
2198
  </Col>
2128
2199
  );
@@ -2271,25 +2342,25 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2271
2342
  if (val.id.match(/edmeditor/g)) {
2272
2343
  console.log('current language first', val.id);
2273
2344
  }
2274
- // console.log('Multi col Render 1', val.id, !val.standalone, !val.onlyDisplay, (!this.state.formData[`${this.state.currentTab - 1}`] || (!this.state.formData[`${this.state.currentTab - 1}`] && this.state.errorData[`${this.state.currentTab - 1}`][val.id] === null)), this.state.formData[`${this.state.currentTab - 1}`], this.state.currentTab);
2275
- // console.log('Multi col render ', val, this.state.formData, this.state.errorData, this.state.currentTab);
2276
- // if (!this.props.isNewVersionFlow && !val.standalone && !val.onlyDisplay && isVersionEnable && !this.state.formData[`${this.state.currentTab - 1}`]) {
2277
- // return true;
2278
- // }
2279
- // if (!val.standalone && !val.onlyDisplay &&
2280
- // (!this.state.formData[`${this.state.currentTab - 1}`] ||
2281
- // (!this.props.isNewVersionFlow && !this.state.formData[`${this.state.currentTab - 1}`] &&
2282
- // this.state.errorData[`${this.state.currentTab - 1}`][val.id] === null)) &&
2283
- // (this.props.isNewVersionFlow && !this.state.formData[`${this.state.currentTab - 1}`] &&
2284
- // this.state.errorData[`${this.state.currentTab - 1}`] && this.state.errorData[`${this.state.currentTab - 1}`][val.id] === null)) {
2285
- // return true;
2286
- // }
2287
- // if (!val.onlyDisplay && !val.standalone &&
2288
- // (!this.props.isNewVersionFlow && (!this.state.errorData[`${this.state.currentTab - 1}`] ||
2289
- // (!this.state.errorData[`${this.state.currentTab - 1}`] &&
2290
- // this.state.errorData[`${this.state.currentTab - 1}`][val.id] === null)))) {
2291
- // return true;
2292
- // }
2345
+ console.log('Multi col Render 1', val.id, !val.standalone, !val.onlyDisplay, (!this.state.formData[`${this.state.currentTab - 1}`] || (!this.state.formData[`${this.state.currentTab - 1}`] && this.state.errorData[`${this.state.currentTab - 1}`][val.id] === null)), this.state.formData[`${this.state.currentTab - 1}`], this.state.currentTab);
2346
+ console.log('Multi col render ', val, this.state.formData, this.state.errorData, this.state.currentTab);
2347
+ if (!this.props.isNewVersionFlow && !val.standalone && !val.onlyDisplay && isVersionEnable && !this.state.formData[`${this.state.currentTab - 1}`]) {
2348
+ return true;
2349
+ }
2350
+ if (!val.standalone && !val.onlyDisplay &&
2351
+ (!this.state.formData[`${this.state.currentTab - 1}`] ||
2352
+ (!this.props.isNewVersionFlow && !this.state.formData[`${this.state.currentTab - 1}`] &&
2353
+ this.state.errorData[`${this.state.currentTab - 1}`][val.id] === null)) &&
2354
+ (this.props.isNewVersionFlow && !this.state.formData[`${this.state.currentTab - 1}`] &&
2355
+ this.state.errorData[`${this.state.currentTab - 1}`] && this.state.errorData[`${this.state.currentTab - 1}`][val.id] === null)) {
2356
+ return true;
2357
+ }
2358
+ if (!val.onlyDisplay && !val.standalone &&
2359
+ (!this.props.isNewVersionFlow && (!this.state.errorData[`${this.state.currentTab - 1}`] ||
2360
+ (!this.state.errorData[`${this.state.currentTab - 1}`] &&
2361
+ this.state.errorData[`${this.state.currentTab - 1}`][val.id] === null)))) {
2362
+ return true;
2363
+ }
2293
2364
  console.log('Render 3');
2294
2365
  let ifError = false;
2295
2366
  if (val.primitive) {
@@ -2300,7 +2371,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2300
2371
  }
2301
2372
  }
2302
2373
  columns.push(
2303
- <Col style={val.colStyle ? val.colStyle : {}} key={val.id} span={val.width}>
2374
+ <Col style={val.colStyle ? val.colStyle : {}} offset={val.offset} key={val.id} span={val.width}>
2304
2375
  {this.renderPrimitiveElement(val, childIndex)}
2305
2376
  </Col>
2306
2377
  );
@@ -2647,8 +2718,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2647
2718
  id={val.id}
2648
2719
  content={content}
2649
2720
  events={val.events}
2650
- getEditorInstanse={(evt) => val.injectedEvents.getEditorInstanse.call(this, evt)}
2651
- handleContentChange={(event) => this.updateFormData(event, val, 'onContentChange')}
2721
+ getEditorInstanse={(evt, id) => val.injectedEvents.getEditorInstanse.call(this, evt, id)}
2722
+ handleContentChange={(event) => this.callChildEvent(event, val, 'onContentChange')}
2652
2723
  />
2653
2724
  </Col>
2654
2725
  );
@@ -2704,6 +2775,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2704
2775
  popOverList={this.props.supportedLanguages}
2705
2776
  excludeList={this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages}
2706
2777
  handlePopOverClick={(data) => this.handleAddLanguageFlow(data, val, "addLanguage")}
2778
+ visible={this.state.customPopoverVisible}
2779
+ onVisibleChange={this.handleCustomPopoverVisibleChange}
2707
2780
  />
2708
2781
  </Col>
2709
2782
  );
@@ -2961,14 +3034,14 @@ FormBuilder.propTypes = {
2961
3034
  onFormValidityChange: PropTypes.func,
2962
3035
  checkValidation: PropTypes.bool,
2963
3036
  onContextChange: PropTypes.func,
2964
- tabCount: PropTypes.Number,
3037
+ tabCount: PropTypes.number,
2965
3038
  isSchemaChanged: PropTypes.bool,
2966
3039
  modal: PropTypes.object,
2967
3040
  isNewVersionFlow: PropTypes.bool,
2968
3041
  baseLanguage: PropTypes.string,
2969
3042
  supportedLanguages: PropTypes.array,
2970
3043
  router: PropTypes.object,
2971
- currentTab: PropTypes.Number,
3044
+ currentTab: PropTypes.number,
2972
3045
  showModal: PropTypes.bool,
2973
3046
  handleCancelModal: PropTypes.func,
2974
3047
  cmsTemplates: PropTypes.func,
@@ -13,7 +13,7 @@ const StyledMessageContainer = styled.div`
13
13
  font-family: open-sans,sans-serif;
14
14
  margin-top: 64px;
15
15
  margin-right: 32px;
16
- z-index: 9999;
16
+ z-index: 10005;
17
17
  `;
18
18
 
19
19
  class Toastr extends React.Component { // eslint-disable-line react/prefer-stateless-function
@@ -75,9 +75,22 @@ export function* fetchUserInfo() {
75
75
  const userData = result.user;
76
76
  // const orgId = yield select(makeSelectOrgId());
77
77
  // yield put({type: types.GET_ORG_DETAILS_REQUEST, orgId});
78
+ const currentOrgDetails = result.currentOrgDetails;
79
+ if (!(currentOrgDetails && currentOrgDetails.basic_details && currentOrgDetails.basic_details.base_language && (currentOrgDetails.basic_details.base_language !== "" || currentOrgDetails.basic_details.base_language === null))) {
80
+ currentOrgDetails.basic_details.base_language = 'en';
81
+ }
82
+ if (!(currentOrgDetails && currentOrgDetails.basic_details && currentOrgDetails.basic_details.supported_languages && currentOrgDetails.basic_details.supported_languages.length > 0)) {
83
+ currentOrgDetails.basic_details.supported_languages = [
84
+ {
85
+ lang_id: 69,
86
+ language: "English",
87
+ iso_code: "en",
88
+ },
89
+ ];
90
+ }
78
91
  yield call(LocalStorage.saveItem, 'orgID', result.currentOrgId);
79
92
  yield call(LocalStorage.saveItem, 'user', userData);
80
- yield put({type: types.GET_USER_DATA_SUCCESS, userData, currentOrgId: result.currentOrgId, currentOrgDetails: result.currentOrgDetails});
93
+ yield put({type: types.GET_USER_DATA_SUCCESS, userData, currentOrgId: result.currentOrgId, currentOrgDetails});
81
94
  } catch (error) {
82
95
  yield call(LocalStorage.clearItem, 'user');
83
96
  yield put({
@@ -7,7 +7,10 @@
7
7
  import { fromJS } from 'immutable';
8
8
  import * as types from './constants';
9
9
 
10
- const initialState = fromJS({});
10
+ const initialState = fromJS({
11
+ createTemplateInProgress: false,
12
+ createResponse: {},
13
+ });
11
14
 
12
15
  function ebillReducer(state = initialState, action) {
13
16
  switch (action.type) {
@@ -21,5 +21,5 @@ const makeSelectEbill = () => createSelector(
21
21
 
22
22
  export default makeSelectEbill;
23
23
  export {
24
- selectEbillDomain,
24
+ makeSelectEbill,
25
25
  };