@capillarytech/creatives-library 2.0.34 → 2.0.35
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/components/CapTagList/index.js +1 -3
- package/components/CustomPopOver/index.js +1 -1
- package/components/FormBuilder/index.js +190 -190
- package/components/PreviewSideBar/index.js +1 -1
- package/components/TemplatePreview/index.js +1 -1
- package/containers/Assets/Gallery/index.js +1 -1
- package/containers/CreativesContainer/SlideBoxContent.js +6 -4
- package/containers/CreativesContainer/SlideBoxHeader.js +4 -3
- package/containers/CreativesContainer/actions.js +12 -0
- package/containers/CreativesContainer/constants.js +2 -0
- package/containers/CreativesContainer/index.js +13 -4
- package/containers/CreativesContainer/reducer.js +7 -1
- package/containers/CreativesContainer/selectors.js +5 -0
- package/containers/Email/index.js +30 -24
- package/containers/EmailWrapper/index.js +5 -4
- package/containers/Login/components/LoginForm/index.js +1 -1
- package/containers/Sms/Create/index.js +36 -60
- package/containers/Sms/Edit/index.js +30 -46
- package/containers/Templates/index.js +15 -63
- package/containers/Templates/reducer.js +1 -0
- package/containers/TemplatesV2/_templatesV2.scss +5 -0
- package/containers/TemplatesV2/index.js +58 -17
- package/containers/TemplatesV2/messages.js +8 -0
- package/containers/WeChat/index.js +15 -5
- package/package.json +13 -13
- package/routes.js +4 -1
|
@@ -11,14 +11,12 @@ import React from 'react';
|
|
|
11
11
|
import { Label } from 'semantic-ui-react';
|
|
12
12
|
import _ from 'lodash';
|
|
13
13
|
import { Tabs, Row, Col, Table, Modal, notification} from 'antd';
|
|
14
|
-
import { CapButton, CapInput, CapPopover,
|
|
14
|
+
import { CapButton, CapInput, CapPopover, CapCheckbox, CapRadio, CapSelect, CapTable, CapColumn} from '@capillarytech/cap-ui-library';
|
|
15
15
|
import TemplatePreview from '../../components/TemplatePreview';
|
|
16
|
-
// import { CapCheckbox } from '@capillarytech/cap-react-ui-library/basic/checkbox';
|
|
17
16
|
import TagList from '../../containers/TagList';
|
|
18
17
|
import SmsEditor from '../SmsEditor';
|
|
19
18
|
import SlideBox from '../SlideBox';
|
|
20
19
|
import CardGrid from '../CardGrid';
|
|
21
|
-
import * as charCount from '../../utils/smsCharCount';
|
|
22
20
|
import CKEditor from "../../components/Ckeditor/";
|
|
23
21
|
import EDMEditor from "../../components/Edmeditor";
|
|
24
22
|
import CustomPopOver from '../../components/CustomPopOver';
|
|
@@ -26,6 +24,8 @@ import './_formBuilder.scss';
|
|
|
26
24
|
import {updateCharCount, checkUnicode} from "../../utils/smsCharCountV2";
|
|
27
25
|
const TabPane = Tabs.TabPane;
|
|
28
26
|
const {Column} = Table;
|
|
27
|
+
const {TextArea} = CapInput;
|
|
28
|
+
const {CapRadioGroup} = CapRadio;
|
|
29
29
|
// import styled from 'styled-components';
|
|
30
30
|
|
|
31
31
|
// import { FormattedMessage } from 'react-intl';
|
|
@@ -83,23 +83,22 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
componentWillMount() {
|
|
86
|
-
console.log('FOrm builder Mounting ', this.props, this.state);
|
|
87
86
|
this.setState({usingTabContainer: this.props.usingTabContainer ? this.props.usingTabContainer : false});
|
|
88
87
|
if (this.props.formData && (this.props.isEdit || (!this.props.isEdit && !_.isEmpty(this.props.formData)))) {
|
|
89
|
-
|
|
88
|
+
|
|
90
89
|
this.setState({formData: this.props.formData}, () => {
|
|
91
90
|
// if (!this.props.isNewVersionFlow) {
|
|
92
91
|
this.initialiseForm(this.props.schema, false, true);
|
|
93
92
|
// }
|
|
94
93
|
});
|
|
95
94
|
} else {
|
|
96
|
-
|
|
95
|
+
|
|
97
96
|
this.initialiseForm(this.props.schema, true);
|
|
98
97
|
}
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
componentWillReceiveProps(nextProps) {
|
|
102
|
-
|
|
101
|
+
|
|
103
102
|
const type = this.props.location.query.type;
|
|
104
103
|
if (this.state.usingTabContainer && nextProps.tabCount !== this.props.tabCount) {
|
|
105
104
|
this.setState({tabCount: nextProps.tabCount});
|
|
@@ -107,7 +106,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
107
106
|
if (nextProps.startValidation && nextProps.startValidation !== false && this.props.startValidation !== nextProps.startValidation) {
|
|
108
107
|
this.setState({checkValidation: true});
|
|
109
108
|
const ifValid = this.validateForm(null, null, null, true);
|
|
110
|
-
|
|
109
|
+
|
|
111
110
|
if (ifValid) {
|
|
112
111
|
this.saveForm(true);
|
|
113
112
|
} else {
|
|
@@ -118,9 +117,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
118
117
|
// this.saveForm(saveForm);
|
|
119
118
|
// }
|
|
120
119
|
if (nextProps.isEdit) {
|
|
121
|
-
|
|
120
|
+
|
|
122
121
|
if (!_.isEqual(nextProps.formData, this.state.formData) && !_.isEmpty(nextProps.formData)) {
|
|
123
|
-
|
|
122
|
+
|
|
124
123
|
if (type === 'embedded') { //TODO: has to be checked and changed.
|
|
125
124
|
this.setState({checkValidation: true, formData: nextProps.formData}, () => {
|
|
126
125
|
this.validateForm();
|
|
@@ -138,11 +137,11 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
138
137
|
} else if (this.props.schema && this.props.schema.channel && this.props.schema.channel.toUpperCase() === 'EMAIL') {
|
|
139
138
|
this.setState({formData: nextProps.formData});
|
|
140
139
|
}
|
|
141
|
-
|
|
140
|
+
|
|
142
141
|
if (this.state.usingTabContainer && this.state.tabKey === '') {
|
|
143
142
|
//this.setState({formData: nextProps.formData});
|
|
144
143
|
if (nextProps.isNewVersionFlow && !_.isEqual(this.state.tabKey, nextProps.tabKey)) {
|
|
145
|
-
|
|
144
|
+
|
|
146
145
|
this.setState({tabKey: nextProps.tabKey});
|
|
147
146
|
} else if (!nextProps.isNewVersionFlow) {
|
|
148
147
|
this.resetTabKeys(nextProps.formData, nextProps.tabCount);
|
|
@@ -151,18 +150,18 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
151
150
|
}
|
|
152
151
|
}
|
|
153
152
|
if (_.isEmpty(this.props.formData) && !_.isEmpty(nextProps.formData)) {
|
|
154
|
-
|
|
153
|
+
|
|
155
154
|
if (this.state.usingTabContainer) {
|
|
156
155
|
this.resetTabKeys(nextProps.formData, nextProps.tabCount);
|
|
157
156
|
}
|
|
158
157
|
this.initializeEditErrorData(nextProps.formData, nextProps.tabCount);
|
|
159
158
|
}
|
|
160
159
|
if (!_.isEmpty(this.props.formData) && this.props.formData !== this.state.formData && _.isEmpty(this.state.formData) && this.state.usingTabContainer) {
|
|
161
|
-
|
|
160
|
+
|
|
162
161
|
this.resetTabKeys(this.props.formData, nextProps.tabCount);
|
|
163
162
|
}
|
|
164
163
|
if ( this.state.usingTabContainer && nextProps.formData && !_.isEmpty(nextProps.formData) && _.isEmpty(this.props.formData) && nextProps.tabCount && this.state.tabCount !== nextProps.tabCount) {
|
|
165
|
-
|
|
164
|
+
|
|
166
165
|
this.setState({ formData: nextProps.formData, tabCount: nextProps.tabCount }, () => {
|
|
167
166
|
this.initializeEditErrorData(nextProps.formData, nextProps.tabCount);
|
|
168
167
|
if (this.state.usingTabContainer) {
|
|
@@ -180,16 +179,16 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
180
179
|
( !this.state.usingTabContainer || (this.state.usingTabContainer && nextProps.tabKey !== ''))
|
|
181
180
|
&& !_.isEqual(nextProps.formData, this.state.formData) &&
|
|
182
181
|
!_.isEqual(nextProps.formData, this.props.formData)) {
|
|
183
|
-
|
|
182
|
+
|
|
184
183
|
this.setState({formData: nextProps.formData, tabKey: nextProps.tabKey}, () => {
|
|
185
184
|
this.validateForm();
|
|
186
185
|
});
|
|
187
186
|
//this.resetTabKeys(nextProps.formData, nextProps.tabCount);
|
|
188
187
|
} else if ((_.isEmpty(this.props.formData) || !this.props.formData) && _.isEmpty(this.state.formData)) {
|
|
189
|
-
|
|
188
|
+
|
|
190
189
|
this.initialiseForm(nextProps.schema, true);
|
|
191
190
|
} else if (_.isEmpty(this.props.formData) && !_.isEmpty(nextProps.formData)) {
|
|
192
|
-
|
|
191
|
+
|
|
193
192
|
this.setState({formData: nextProps.formData});
|
|
194
193
|
}
|
|
195
194
|
|
|
@@ -203,16 +202,16 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
203
202
|
}
|
|
204
203
|
|
|
205
204
|
if (!_.isEmpty(nextProps.formData) && !_.isEqual(this.state.formData, nextProps.formData)) {
|
|
206
|
-
|
|
205
|
+
|
|
207
206
|
if (nextProps.isNewVersionFlow) {
|
|
208
|
-
|
|
207
|
+
|
|
209
208
|
const tabKey = (this.state.tabKey !== nextProps.formData[nextProps.currentTab - 1].tabKey) ? nextProps.formData[nextProps.currentTab - 1].tabKey : this.state.tabKey;
|
|
210
|
-
|
|
209
|
+
|
|
211
210
|
this.setState({tabKey});
|
|
212
211
|
}
|
|
213
212
|
this.setState({formData: nextProps.formData, currentLangTab}, () => {
|
|
214
213
|
if (nextProps.isNewVersionFlow && !this.state.formData[this.state.currentTab - 1][this.state.formData[this.state.currentTab - 1].activeTab].tabKey) {
|
|
215
|
-
|
|
214
|
+
|
|
216
215
|
this.resetTabKeys(nextProps.formData, nextProps.tabCount, false, true);
|
|
217
216
|
}
|
|
218
217
|
if (type === 'embedded' || this.props.schema.channel.toUpperCase() === 'EMAIL') {
|
|
@@ -224,29 +223,29 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
224
223
|
});
|
|
225
224
|
}
|
|
226
225
|
|
|
227
|
-
|
|
226
|
+
|
|
228
227
|
if (!_.isEqual(nextProps.schema, this.props.schema)) {
|
|
229
|
-
|
|
228
|
+
|
|
230
229
|
this.setState({ isFormValid: (this.props.isEdit ? this.props.isEdit : true) }, () => {
|
|
231
|
-
|
|
230
|
+
|
|
232
231
|
if (!this.props.isEdit || (this.props.isEdit && !_.isEmpty(nextProps.formData))) {
|
|
233
|
-
|
|
232
|
+
|
|
234
233
|
let resetTabKeys = (this.state.formData.tabKey === undefined);
|
|
235
234
|
if ((this.props.schema && this.props.schema.channel && this.props.schema.channel.toUpperCase() === 'MOBILEPUSH')) {
|
|
236
235
|
resetTabKeys = false;
|
|
237
|
-
|
|
236
|
+
|
|
238
237
|
}
|
|
239
238
|
if (this.props.isNewVersionFlow) {
|
|
240
239
|
resetTabKeys = false;
|
|
241
240
|
}
|
|
242
|
-
|
|
241
|
+
|
|
243
242
|
this.initialiseForm(nextProps.schema, false, resetTabKeys);
|
|
244
243
|
this.validateForm();
|
|
245
244
|
}
|
|
246
245
|
});
|
|
247
246
|
}
|
|
248
247
|
if (!_.isEqual(nextProps.checkValidation, this.props.checkValidation)) {
|
|
249
|
-
|
|
248
|
+
|
|
250
249
|
this.setState({ checkValidation: nextProps.checkValidation });
|
|
251
250
|
}
|
|
252
251
|
|
|
@@ -255,32 +254,32 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
255
254
|
}
|
|
256
255
|
|
|
257
256
|
if (!_.isEmpty(nextProps.injectedTags) && !_.isEqual(nextProps.injectedTags, this.props.injectedTags)) {
|
|
258
|
-
|
|
257
|
+
|
|
259
258
|
this.validateForm(nextProps.tags, nextProps.injectedTags);
|
|
260
259
|
}
|
|
261
260
|
if (!_.isEmpty(nextProps.tags) && !_.isEqual(nextProps.tags, this.props.tags)) {
|
|
262
|
-
|
|
261
|
+
|
|
263
262
|
this.validateForm(nextProps.tags, nextProps.injectedTags);
|
|
264
263
|
}
|
|
265
264
|
if (!_.isEqual(nextProps.showModal, this.props.showModal)) {
|
|
266
|
-
|
|
265
|
+
|
|
267
266
|
this.setState({showModal: nextProps.showModal});
|
|
268
267
|
}
|
|
269
268
|
if (nextProps.modal && (!_.isEqual(nextProps.modal, this.props.modal) || _.isEmpty(this.state.modal))) {
|
|
270
|
-
|
|
269
|
+
|
|
271
270
|
this.setState({modal: nextProps.modal});
|
|
272
271
|
}
|
|
273
272
|
}
|
|
274
273
|
|
|
275
274
|
onEdit(data, e) {
|
|
276
|
-
|
|
275
|
+
|
|
277
276
|
}
|
|
278
277
|
|
|
279
278
|
getModal = () => {
|
|
280
279
|
let modal;
|
|
281
280
|
if (this.state.modal) {
|
|
282
281
|
if (this.state.modal.type === 'confirm') {
|
|
283
|
-
|
|
282
|
+
|
|
284
283
|
modal = (<Modal
|
|
285
284
|
visible={this.state.showModal}
|
|
286
285
|
title={this.state.modal.title}
|
|
@@ -334,7 +333,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
334
333
|
}
|
|
335
334
|
|
|
336
335
|
handleCloseModal = (data, e) => {
|
|
337
|
-
|
|
336
|
+
|
|
338
337
|
const event = this.state.currentEvent;
|
|
339
338
|
if (!_.isEmpty(this.state.currentEvent)) {
|
|
340
339
|
switch (event) {
|
|
@@ -357,8 +356,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
357
356
|
|
|
358
357
|
resetTabKeys(form, count, changeDefaultTab, setFormTabKey) {
|
|
359
358
|
const tabCount = count || this.state.tabCount;
|
|
360
|
-
|
|
361
|
-
|
|
359
|
+
|
|
360
|
+
|
|
362
361
|
const formData = _.cloneDeep(form);
|
|
363
362
|
let baseIndex = 0;
|
|
364
363
|
for (let idx = 0; idx < tabCount; idx += 1) {
|
|
@@ -377,34 +376,34 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
377
376
|
if (setFormTabKey) {
|
|
378
377
|
if (!formData[idx].activeTab) {
|
|
379
378
|
const baseLanguage = this.props.baseLanguage;
|
|
380
|
-
|
|
379
|
+
|
|
381
380
|
formData[idx].tabKey = formData[idx][baseLanguage].tabKey;
|
|
382
381
|
} else {
|
|
383
|
-
|
|
382
|
+
|
|
384
383
|
formData[idx].tabKey = formData[idx][formData[idx].activeTab].tabKey;
|
|
385
384
|
}
|
|
386
385
|
if (formData[idx].base) {
|
|
387
386
|
if (!formData.base.activeTab) {
|
|
388
|
-
|
|
387
|
+
|
|
389
388
|
const baseLanguage = this.props.baseLanguage;
|
|
390
389
|
formData.base.tabKey = formData.base[baseLanguage].tabKey;
|
|
391
390
|
} else {
|
|
392
|
-
|
|
391
|
+
|
|
393
392
|
formData.base.tabKey = formData.base[formData[idx].activeTab].tabKey;
|
|
394
393
|
}
|
|
395
394
|
}
|
|
396
395
|
}
|
|
397
|
-
|
|
396
|
+
|
|
398
397
|
if (formData[idx].base && formData.base.activeTab) {
|
|
399
|
-
|
|
398
|
+
|
|
400
399
|
// if (!formData.base.tabKey) {
|
|
401
|
-
|
|
400
|
+
|
|
402
401
|
formData.base.tabKey = formData[idx][formData[idx].activeTab].tabKey;
|
|
403
402
|
//}
|
|
404
403
|
baseIndex = idx;
|
|
405
404
|
}
|
|
406
405
|
} else {
|
|
407
|
-
|
|
406
|
+
|
|
408
407
|
if (formData[idx]) {
|
|
409
408
|
if (!formData[idx].tabKey) {
|
|
410
409
|
formData[idx].tabKey = _.uniqueId();
|
|
@@ -416,25 +415,25 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
416
415
|
}
|
|
417
416
|
}
|
|
418
417
|
}
|
|
419
|
-
|
|
418
|
+
|
|
420
419
|
if ((formData.base && formData.base.tabKey && formData.base.tabKey !== '' && !changeDefaultTab) || (formData.base && this.state.tabKey !== formData.base.tabKey)) {
|
|
421
|
-
|
|
420
|
+
|
|
422
421
|
if (this.state.currentTab === 1 && !this.props.isNewVersionFlow) {
|
|
423
422
|
this.setState({tabKey: formData.base.tabKey});
|
|
424
423
|
} else if (this.props.isNewVersionFlow && this.state.tabKey !== formData[this.state.currentTab - 1].tabKey) {
|
|
425
|
-
|
|
424
|
+
|
|
426
425
|
this.setState({tabKey: formData[this.state.currentTab - 1].tabKey});
|
|
427
426
|
}
|
|
428
427
|
}
|
|
429
428
|
if (setFormTabKey) {
|
|
430
|
-
|
|
429
|
+
|
|
431
430
|
this.setState({tabKey: formData.base.tabKey});
|
|
432
431
|
}
|
|
433
|
-
|
|
434
|
-
|
|
432
|
+
|
|
433
|
+
|
|
435
434
|
if (changeDefaultTab) {
|
|
436
435
|
this.setState({formData}, () => {
|
|
437
|
-
|
|
436
|
+
|
|
438
437
|
this.props.onChange(formData, this.state.tabCount);
|
|
439
438
|
this.validateForm();
|
|
440
439
|
});
|
|
@@ -448,14 +447,14 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
448
447
|
|
|
449
448
|
/* eslint-disable */
|
|
450
449
|
validateForm(tags, injectedTags, isSave, showMessages) {
|
|
451
|
-
|
|
452
|
-
|
|
450
|
+
|
|
451
|
+
|
|
453
452
|
let isValid = true;
|
|
454
453
|
const type = (this.props.location && this.props.location.query.type) ? this.props.location.query.type : 'full';
|
|
455
454
|
const currentModule = (this.props.location && this.props.location.query.module) ? this.props.location.query.module : 'default';
|
|
456
455
|
const errorData = _.cloneDeep(this.state.errorData);
|
|
457
456
|
if (this.props.schema.channel === 'SMS') {
|
|
458
|
-
|
|
457
|
+
|
|
459
458
|
for (let count = 0; count < this.state.tabCount; count += 1) {
|
|
460
459
|
if (_.isEmpty(errorData[count])) {
|
|
461
460
|
return;
|
|
@@ -467,13 +466,13 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
467
466
|
const content = this.state.formData[count][`sms-editor${index > 1 ? index : ''}`];
|
|
468
467
|
const unicodeCheck = this.state.formData[count][`unicode-validity${index > 1 ? index : ''}`];
|
|
469
468
|
const ifUnicode = content && content !== '' ? checkUnicode(content) : false;
|
|
470
|
-
|
|
469
|
+
|
|
471
470
|
const tagValidationResponse = this.validateTags(content, tags, injectedTags);
|
|
472
|
-
|
|
471
|
+
|
|
473
472
|
if (tagValidationResponse.valid) {
|
|
474
473
|
errorData[count][`sms-editor${index > 1 ? index : ''}`] = false;
|
|
475
474
|
} else {
|
|
476
|
-
|
|
475
|
+
|
|
477
476
|
errorData[count][`sms-editor${index > 1 ? index : ''}`] = true;
|
|
478
477
|
isValid = false;
|
|
479
478
|
}
|
|
@@ -481,7 +480,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
481
480
|
errorData[count][`unicode-validity${index > 1 ? index : ''}`] = true;
|
|
482
481
|
isValid = false;
|
|
483
482
|
} else if (content === '') {
|
|
484
|
-
|
|
483
|
+
|
|
485
484
|
errorData[count][`sms-editor${index > 1 ? index : ''}`] = true;
|
|
486
485
|
isValid = false;
|
|
487
486
|
} else {
|
|
@@ -498,21 +497,21 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
498
497
|
|
|
499
498
|
//validation for LINE
|
|
500
499
|
if (this.props.schema.channel === 'LINE') {
|
|
501
|
-
|
|
500
|
+
|
|
502
501
|
if (this.state.formData['0']['message-editor'] !== undefined ) {
|
|
503
502
|
const content = this.state.formData['0']['message-editor'];
|
|
504
|
-
|
|
503
|
+
|
|
505
504
|
const tagValidationResponse = this.validateTags(content, tags, injectedTags);
|
|
506
|
-
|
|
505
|
+
|
|
507
506
|
if (tagValidationResponse.valid) {
|
|
508
507
|
errorData['0']['message-editor'] = false;
|
|
509
508
|
} else {
|
|
510
|
-
|
|
509
|
+
|
|
511
510
|
errorData['0']['message-editor'] = true;
|
|
512
511
|
isValid = false;
|
|
513
512
|
}
|
|
514
513
|
if (content.trim() === '') {
|
|
515
|
-
|
|
514
|
+
|
|
516
515
|
errorData['0']['message-editor'] = true;
|
|
517
516
|
isValid = false;
|
|
518
517
|
}
|
|
@@ -522,7 +521,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
522
521
|
const imgContentLength = this.state.formData['0'].image.length;
|
|
523
522
|
const imgContentLengthPreview = this.state.formData['0'].imagePreview.length;
|
|
524
523
|
if ( (imgContentLength < 1) && (imgContentLengthPreview < 1) ) {
|
|
525
|
-
|
|
524
|
+
|
|
526
525
|
errorData['0'].image = true;
|
|
527
526
|
errorData['0'].imagePreview = true;
|
|
528
527
|
isValid = false;
|
|
@@ -540,9 +539,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
540
539
|
}
|
|
541
540
|
|
|
542
541
|
if (this.props.schema && this.props.schema.channel && this.props.schema.channel.toUpperCase() === 'WECHAT') {
|
|
543
|
-
|
|
542
|
+
|
|
544
543
|
_.forEach(this.state.formData, (val, index) => {
|
|
545
|
-
|
|
544
|
+
|
|
546
545
|
if (index.indexOf('template') > -1 && this.state.formData[index] !== undefined) {
|
|
547
546
|
const content = this.state.formData[index];
|
|
548
547
|
if (content.trim() === '') {
|
|
@@ -550,7 +549,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
550
549
|
isValid = false;
|
|
551
550
|
} else {
|
|
552
551
|
const tagValidationResponse = this.validateTags(content, tags, injectedTags);
|
|
553
|
-
|
|
552
|
+
|
|
554
553
|
if (tagValidationResponse.valid) {
|
|
555
554
|
errorData[index] = false;
|
|
556
555
|
} else {
|
|
@@ -566,7 +565,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
566
565
|
}
|
|
567
566
|
}
|
|
568
567
|
});
|
|
569
|
-
|
|
568
|
+
|
|
570
569
|
}
|
|
571
570
|
if(this.props.schema && this.props.schema.channel && this.props.schema.channel.toUpperCase() === "MOBILEPUSH"){
|
|
572
571
|
let androidValid = true, iosValid = true;
|
|
@@ -610,7 +609,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
610
609
|
} else {
|
|
611
610
|
errorData[parseInt(index)][`message-editor${selector}`] = false;
|
|
612
611
|
const tagValidationResponse = this.validateTags(message, tags, injectedTags);
|
|
613
|
-
|
|
612
|
+
|
|
614
613
|
if (tagValidationResponse.valid) {
|
|
615
614
|
errorData[parseInt(index)][`message-editor${selector}`] = false;
|
|
616
615
|
} else {
|
|
@@ -628,7 +627,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
628
627
|
} else {
|
|
629
628
|
errorData[parseInt(index)][`message-title${selector}`] = false;
|
|
630
629
|
const tagValidationResponse = this.validateTags(title, tags, injectedTags);
|
|
631
|
-
|
|
630
|
+
|
|
632
631
|
if (tagValidationResponse.valid) {
|
|
633
632
|
errorData[parseInt(index)][`message-title${selector}`] = false;
|
|
634
633
|
} else {
|
|
@@ -824,7 +823,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
824
823
|
if (this.props.schema && this.props.schema.channel && this.props.schema.channel.toUpperCase() === "EMAIL") {
|
|
825
824
|
// Validating Email By iterating all elements of FormBuilder
|
|
826
825
|
_.forEach(this.state.formData, (data, index) => {
|
|
827
|
-
|
|
826
|
+
|
|
828
827
|
if (!this.state.formData["template-subject"] && type.toLowerCase() === 'embedded' && (currentModule.toLowerCase() === 'loyalty' || currentModule.toLowerCase() === 'dvs' || currentModule.toLowerCase() === 'timeline' || currentModule.toLowerCase() === 'library')) {
|
|
829
828
|
errorData["template-subject"] = true;
|
|
830
829
|
isValid = false;
|
|
@@ -868,7 +867,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
868
867
|
if (errorData[index][currentLang] === undefined) {
|
|
869
868
|
errorData[index][currentLang] = {};
|
|
870
869
|
}
|
|
871
|
-
|
|
870
|
+
|
|
872
871
|
if (tagValidationResponse.valid) {
|
|
873
872
|
errorData[index][currentLang]['template-content'] = false;
|
|
874
873
|
} else {
|
|
@@ -901,7 +900,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
901
900
|
// const index = count + 1;
|
|
902
901
|
// // const content = this.state.formData[count][`template-content${index > 1 ? index : ''}`];
|
|
903
902
|
// // const tagValidationResponse = this.validateTags(content, tags, injectedTags);
|
|
904
|
-
// //
|
|
903
|
+
// //
|
|
905
904
|
// // if (tagValidationResponse.valid) {
|
|
906
905
|
// // errorData[count][`template-content${index > 1 ? index : ''}`] = false;
|
|
907
906
|
// // } else {
|
|
@@ -923,7 +922,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
923
922
|
// }
|
|
924
923
|
}
|
|
925
924
|
this.setState({isFormValid : isValid, errorData});
|
|
926
|
-
|
|
925
|
+
|
|
927
926
|
this.props.onFormValidityChange(isValid);
|
|
928
927
|
return isValid;
|
|
929
928
|
}
|
|
@@ -936,7 +935,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
936
935
|
|
|
937
936
|
};
|
|
938
937
|
saveForm(saveForm) {
|
|
939
|
-
|
|
938
|
+
|
|
940
939
|
if (this.props.isNewVersionFlow && !saveForm) {
|
|
941
940
|
this.props.getValidationData();
|
|
942
941
|
return;
|
|
@@ -982,7 +981,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
982
981
|
result = true;
|
|
983
982
|
}
|
|
984
983
|
});
|
|
985
|
-
|
|
984
|
+
|
|
986
985
|
return result;
|
|
987
986
|
}
|
|
988
987
|
|
|
@@ -1013,8 +1012,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1013
1012
|
const tags = tagsParam ? tagsParam : this.props.tags;
|
|
1014
1013
|
const injectedTags = this.transformInjectedTags(injectedTagsParams ? injectedTagsParams : this.props.injectedTags);
|
|
1015
1014
|
const excludedTags = ['user_id_b64', 'outbox_id_b64'];
|
|
1016
|
-
|
|
1017
|
-
|
|
1015
|
+
|
|
1016
|
+
|
|
1018
1017
|
const response = {};
|
|
1019
1018
|
response.valid = true;
|
|
1020
1019
|
response.missingTags = [];
|
|
@@ -1107,14 +1106,14 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1107
1106
|
}
|
|
1108
1107
|
|
|
1109
1108
|
initializeMultiColSection(section, formDataObj, isContainer, index, ifError, paneIndex) {
|
|
1110
|
-
|
|
1109
|
+
|
|
1111
1110
|
const formData = _.cloneDeep(formDataObj);
|
|
1112
1111
|
const newFormData = {};
|
|
1113
1112
|
newFormData[index] = {};
|
|
1114
1113
|
_.forEach(section.inputFields, (inputField) => {
|
|
1115
|
-
|
|
1114
|
+
|
|
1116
1115
|
_.forEach(inputField.cols, (col) => {
|
|
1117
|
-
|
|
1116
|
+
|
|
1118
1117
|
if (isContainer && !formData[index]) {
|
|
1119
1118
|
formData[index] = {};
|
|
1120
1119
|
}
|
|
@@ -1155,7 +1154,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1155
1154
|
formData[col.id] = '';
|
|
1156
1155
|
}
|
|
1157
1156
|
} else {
|
|
1158
|
-
|
|
1157
|
+
|
|
1159
1158
|
if (!(col.id.indexOf('template-content') > -1 && col.id !== 'template-content')) {
|
|
1160
1159
|
if (isContainer && formData[index] && formData[index][this.props.baseLanguage] && formData[index][this.props.baseLanguage][col.id] === undefined) {
|
|
1161
1160
|
if (ifError) {
|
|
@@ -1171,7 +1170,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1171
1170
|
formData[col.id] = '';
|
|
1172
1171
|
}
|
|
1173
1172
|
}
|
|
1174
|
-
|
|
1173
|
+
|
|
1175
1174
|
}
|
|
1176
1175
|
}
|
|
1177
1176
|
if (col.type === 'checkbox') {
|
|
@@ -1248,12 +1247,12 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1248
1247
|
if (this.props.isNewVersionFlow) {
|
|
1249
1248
|
_.forEach(schema.containers, (val, index) => {
|
|
1250
1249
|
if (val.type === 'tabs') {
|
|
1251
|
-
|
|
1250
|
+
|
|
1252
1251
|
this.setState({usingTabContainer: true});
|
|
1253
1252
|
_.forEach(val.panes, (pane, paneIndex) => {
|
|
1254
1253
|
_.forEach(pane.sections, (section) => {
|
|
1255
1254
|
if (section.type === 'multicols') {
|
|
1256
|
-
|
|
1255
|
+
|
|
1257
1256
|
formData = this.initializeMultiColSection(section, formData, true, index, ifError, paneIndex);
|
|
1258
1257
|
} else if (section.type === 'col-label') {
|
|
1259
1258
|
formData = this.initializeColLabelSection(section, formData, true, index, ifError);
|
|
@@ -1274,12 +1273,12 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1274
1273
|
} else {
|
|
1275
1274
|
_.forEach(schema.containers, (val) => {
|
|
1276
1275
|
if (val.type === 'tabs') {
|
|
1277
|
-
|
|
1276
|
+
|
|
1278
1277
|
this.setState({usingTabContainer: true});
|
|
1279
1278
|
_.forEach(val.panes, (pane, index) => {
|
|
1280
1279
|
_.forEach(pane.sections, (section) => {
|
|
1281
1280
|
if (section.type === 'multicols') {
|
|
1282
|
-
|
|
1281
|
+
|
|
1283
1282
|
formData = this.initializeMultiColSection(section, formData, true, index, ifError);
|
|
1284
1283
|
} else if (section.type === 'col-label') {
|
|
1285
1284
|
formData = this.initializeColLabelSection(section, formData, true, index, ifError);
|
|
@@ -1302,8 +1301,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1302
1301
|
}
|
|
1303
1302
|
|
|
1304
1303
|
initialiseForm(schema, makeFormEmpty, resetTabKeys) {
|
|
1305
|
-
|
|
1306
|
-
|
|
1304
|
+
|
|
1305
|
+
|
|
1307
1306
|
let formData = makeFormEmpty ? {} : _.cloneDeep(this.state.formData);
|
|
1308
1307
|
let errorData = {};
|
|
1309
1308
|
this.formElements = [];
|
|
@@ -1315,7 +1314,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1315
1314
|
formData = this.initializeContainers(schema, formData);
|
|
1316
1315
|
errorData = this.initializeContainers(schema, errorData, true);
|
|
1317
1316
|
|
|
1318
|
-
|
|
1317
|
+
|
|
1319
1318
|
if (!this.props.isEdit) {
|
|
1320
1319
|
if (!formData[0]) {
|
|
1321
1320
|
formData[0] = {};
|
|
@@ -1355,7 +1354,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1355
1354
|
}
|
|
1356
1355
|
|
|
1357
1356
|
cloneVersionData(ifError) {
|
|
1358
|
-
|
|
1357
|
+
|
|
1359
1358
|
if (this.state.tabCount === 0) {
|
|
1360
1359
|
this.initialiseForm(this.props.schema, true);
|
|
1361
1360
|
return;
|
|
@@ -1373,10 +1372,10 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1373
1372
|
newTabIndex = this.state.tabCount;
|
|
1374
1373
|
}
|
|
1375
1374
|
formData[newTabIndex] = {};
|
|
1376
|
-
|
|
1375
|
+
|
|
1377
1376
|
const newTabCount = newTabIndex + 1;
|
|
1378
1377
|
_.forEach(formData[0], (val, key) => {
|
|
1379
|
-
|
|
1378
|
+
|
|
1380
1379
|
if (key === 'base') {
|
|
1381
1380
|
return true;
|
|
1382
1381
|
}
|
|
@@ -1387,7 +1386,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1387
1386
|
if (ifError) {
|
|
1388
1387
|
formData[newTabIndex][`${key}${newTabCount}`] = false;
|
|
1389
1388
|
} else {
|
|
1390
|
-
|
|
1389
|
+
|
|
1391
1390
|
if (this.props.isNewVersionFlow) {
|
|
1392
1391
|
if (key.indexOf('activeTab') > -1) {
|
|
1393
1392
|
formData[newTabIndex][`${key}`] = this.props.baseLanguage;
|
|
@@ -1405,13 +1404,13 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1405
1404
|
if (key.indexOf('selectedLanguages') > -1) {
|
|
1406
1405
|
formData[newTabIndex][key] = [this.props.baseLanguage];
|
|
1407
1406
|
} else {
|
|
1408
|
-
|
|
1407
|
+
|
|
1409
1408
|
if (key === this.props.baseLanguage) {
|
|
1410
1409
|
formData[newTabIndex][key] = {};
|
|
1411
1410
|
_.forEach(val, (subVal, index) => {
|
|
1412
|
-
|
|
1411
|
+
|
|
1413
1412
|
// if (subVal === 'is_drag_drop' || subVal === 'lang_id' || subVal === 'iso_code' === 'language') {
|
|
1414
|
-
//
|
|
1413
|
+
//
|
|
1415
1414
|
// formData[newTabIndex][key][index] = formData[0][this.props.baseLanguage][subVal];
|
|
1416
1415
|
// } else {
|
|
1417
1416
|
if (index === 'tabKey') {
|
|
@@ -1428,7 +1427,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1428
1427
|
} else {
|
|
1429
1428
|
formData[newTabIndex][key] = {};
|
|
1430
1429
|
_.forEach(val, (subVal, index) => {
|
|
1431
|
-
|
|
1430
|
+
|
|
1432
1431
|
formData[newTabIndex][key][index] = '';
|
|
1433
1432
|
});
|
|
1434
1433
|
}
|
|
@@ -1436,7 +1435,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1436
1435
|
return true;
|
|
1437
1436
|
});
|
|
1438
1437
|
let id = (this.props.isNewVersionFlow && formData[newTabIndex][this.props.baseLanguage].tabKey) ? formData[newTabIndex][this.props.baseLanguage].tabKey : _.uniqueId();
|
|
1439
|
-
|
|
1438
|
+
|
|
1440
1439
|
if (!ifError) {
|
|
1441
1440
|
let validId = false;
|
|
1442
1441
|
while (!validId) {
|
|
@@ -1455,12 +1454,12 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1455
1454
|
}
|
|
1456
1455
|
// if (!this.props.isEdit) {
|
|
1457
1456
|
if (ifError) {
|
|
1458
|
-
|
|
1457
|
+
|
|
1459
1458
|
this.setState({errorData: formData});
|
|
1460
1459
|
} else {
|
|
1461
|
-
|
|
1460
|
+
|
|
1462
1461
|
this.props.onChange(formData, newTabCount, newTabIndex + 1);
|
|
1463
|
-
|
|
1462
|
+
|
|
1464
1463
|
this.setState({tabCount: newTabCount, formData, currentTab: newTabIndex + 1, tabKey: id}, () => {
|
|
1465
1464
|
this.cloneVersionData(true);
|
|
1466
1465
|
});
|
|
@@ -1478,7 +1477,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1478
1477
|
markFinalTabVersion() {
|
|
1479
1478
|
const formData = _.cloneDeep(this.state.formData);
|
|
1480
1479
|
if (this.state.usingTabContainer) {
|
|
1481
|
-
|
|
1480
|
+
|
|
1482
1481
|
for (let count = 0; count < this.state.tabCount; count += 1) {
|
|
1483
1482
|
if (parseInt(this.state.currentTab - 1, 10) !== count) {
|
|
1484
1483
|
formData[count].base = false;
|
|
@@ -1503,7 +1502,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1503
1502
|
tabKey: '',
|
|
1504
1503
|
}, () => {
|
|
1505
1504
|
if (!isEdit) {
|
|
1506
|
-
|
|
1505
|
+
|
|
1507
1506
|
this.initialiseForm(this.props.schema, true);
|
|
1508
1507
|
}
|
|
1509
1508
|
});
|
|
@@ -1579,9 +1578,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1579
1578
|
}
|
|
1580
1579
|
|
|
1581
1580
|
deleteVersion(ifError, currentTab) {
|
|
1582
|
-
|
|
1581
|
+
|
|
1583
1582
|
if (!ifError && this.state.tabCount === 1) {
|
|
1584
|
-
|
|
1583
|
+
|
|
1585
1584
|
return;
|
|
1586
1585
|
}
|
|
1587
1586
|
let formData = {};
|
|
@@ -1601,7 +1600,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1601
1600
|
if (tabCount > 1 && currentTab !== tabCount) {
|
|
1602
1601
|
finalActiveTabKey = formData[currentTab].tabKey;
|
|
1603
1602
|
}
|
|
1604
|
-
|
|
1603
|
+
|
|
1605
1604
|
if (tabCount > 1 && currentTab === tabCount) {
|
|
1606
1605
|
finalActiveTabKey = formData[currentTab - 2].tabKey;
|
|
1607
1606
|
finalCurrentTab = currentTab - 1;
|
|
@@ -1650,14 +1649,14 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1650
1649
|
|
|
1651
1650
|
deleteLanguage = () => {
|
|
1652
1651
|
if (this.state.formData[`${this.state.currentTab - 1}`].activeTab === this.props.baseLanguage) {
|
|
1653
|
-
|
|
1652
|
+
|
|
1654
1653
|
} else {
|
|
1655
1654
|
const formData = _.cloneDeep(this.state.formData);
|
|
1656
1655
|
const currentTab = `${this.state.currentTab - 1}`;
|
|
1657
1656
|
const currentLang = formData[`${this.state.currentTab - 1}`].activeTab;
|
|
1658
1657
|
const deleteLanguageIndex = formData[currentTab].selectedLanguages.indexOf(currentLang);
|
|
1659
1658
|
const baseLangTabKey = formData[currentTab][this.props.baseLanguage].tabKey;
|
|
1660
|
-
|
|
1659
|
+
|
|
1661
1660
|
delete formData[currentTab][currentLang];
|
|
1662
1661
|
formData[currentTab].activeTab = this.props.baseLanguage;
|
|
1663
1662
|
formData[currentTab].selectedLanguages.splice(deleteLanguageIndex, 1);
|
|
@@ -1668,7 +1667,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1668
1667
|
formData.base.tabKey = baseLangTabKey;
|
|
1669
1668
|
formData.base.activeTab = this.props.baseLanguage;
|
|
1670
1669
|
}
|
|
1671
|
-
|
|
1670
|
+
|
|
1672
1671
|
this.setState({formData, currentLangTab: this.props.baseLanguage, tabKey: baseLangTabKey}, () => {
|
|
1673
1672
|
this.state.currentEvent.call(this.props.parent, formData, deleteLanguageIndex);
|
|
1674
1673
|
this.setState({currentEvent: {}, currentEventData: {}});
|
|
@@ -1677,18 +1676,18 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1677
1676
|
};
|
|
1678
1677
|
|
|
1679
1678
|
renameVersion(currentTab) {
|
|
1680
|
-
|
|
1679
|
+
|
|
1681
1680
|
document.getElementById(`tab-header${currentTab > 1 ? currentTab : ''}`).contentEditable = "true";
|
|
1682
1681
|
document.getElementById(`tab-header${currentTab > 1 ? currentTab : ''}`).focus();
|
|
1683
1682
|
}
|
|
1684
1683
|
|
|
1685
1684
|
updateFormData(data, val, event) {
|
|
1686
|
-
|
|
1685
|
+
|
|
1687
1686
|
const formData = _.cloneDeep(this.state.formData);
|
|
1688
|
-
|
|
1687
|
+
|
|
1689
1688
|
const tabIndex = this.state.currentTab - 1;
|
|
1690
1689
|
let currentTab = _.cloneDeep(this.state.currentTab);
|
|
1691
|
-
|
|
1690
|
+
|
|
1692
1691
|
if (this.state.usingTabContainer && !val.standalone) {
|
|
1693
1692
|
const data1 = data;
|
|
1694
1693
|
if (event === "addLanguage") {
|
|
@@ -1703,7 +1702,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1703
1702
|
switch (addLanguageType) {
|
|
1704
1703
|
case "upload":
|
|
1705
1704
|
baseTab = _.cloneDeep(formData[tabIndex][currentLang]);
|
|
1706
|
-
|
|
1705
|
+
|
|
1707
1706
|
baseTab.iso_code = data.iso_code;
|
|
1708
1707
|
baseTab.lang_id = data.lang_id;
|
|
1709
1708
|
baseTab.language = data.language;
|
|
@@ -1713,7 +1712,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1713
1712
|
if (!formData[tabIndex]) {
|
|
1714
1713
|
continue;
|
|
1715
1714
|
}
|
|
1716
|
-
|
|
1715
|
+
|
|
1717
1716
|
if (id === formData[tabIndex][formData[tabIndex].selectedLanguages[idx]].tabKey) {
|
|
1718
1717
|
validId = false;
|
|
1719
1718
|
}
|
|
@@ -1726,14 +1725,14 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1726
1725
|
baseTab.tabKey = id;
|
|
1727
1726
|
//formData[tabIndex].selectedLanguages.push(data.iso_code);
|
|
1728
1727
|
formData[tabIndex][data.iso_code] = baseTab;
|
|
1729
|
-
|
|
1728
|
+
|
|
1730
1729
|
formData[tabIndex].activeTab = data.iso_code;
|
|
1731
1730
|
formData[tabIndex].tabKey = baseTab.tabKey;
|
|
1732
1731
|
break;
|
|
1733
1732
|
case "copyPrimaryLanguage":
|
|
1734
1733
|
case "useEditor":
|
|
1735
1734
|
baseTab = _.cloneDeep(formData[tabIndex][this.props.baseLanguage]);
|
|
1736
|
-
|
|
1735
|
+
|
|
1737
1736
|
//baseTab['template-content'] = '';
|
|
1738
1737
|
baseTab.iso_code = data.iso_code;
|
|
1739
1738
|
baseTab.lang_id = data.lang_id;
|
|
@@ -1757,7 +1756,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1757
1756
|
baseTab.tabKey = id;
|
|
1758
1757
|
formData[tabIndex].selectedLanguages.push(data.iso_code);
|
|
1759
1758
|
formData[tabIndex][data.iso_code] = baseTab;
|
|
1760
|
-
|
|
1759
|
+
|
|
1761
1760
|
formData[tabIndex].activeTab = data.iso_code;
|
|
1762
1761
|
formData[tabIndex].tabKey = baseTab.tabKey;
|
|
1763
1762
|
break;
|
|
@@ -1771,13 +1770,13 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1771
1770
|
that.setState({tabKey: baseTab.tabKey});
|
|
1772
1771
|
}, 0);
|
|
1773
1772
|
}
|
|
1774
|
-
|
|
1773
|
+
|
|
1775
1774
|
if (!this.props.isNewVersionFlow) {
|
|
1776
1775
|
formData[tabIndex][val.id] = data1;
|
|
1777
1776
|
} else if (this.props.isNewVersionFlow && event !== "addLanguage" && event !== "onContentChange") {
|
|
1778
1777
|
formData[tabIndex][this.props.baseLanguage][val.id] = data1;
|
|
1779
1778
|
}
|
|
1780
|
-
|
|
1779
|
+
|
|
1781
1780
|
if (formData[tabIndex].base) {
|
|
1782
1781
|
if (!this.props.isNewVersionFlow) {
|
|
1783
1782
|
formData.base[val.id] = data1;
|
|
@@ -1788,35 +1787,35 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1788
1787
|
formData.base.selectedLanguages = formData[tabIndex].selectedLanguages;
|
|
1789
1788
|
}
|
|
1790
1789
|
}
|
|
1791
|
-
|
|
1790
|
+
|
|
1792
1791
|
} else {
|
|
1793
1792
|
formData[val.id] = data;
|
|
1794
1793
|
}
|
|
1795
|
-
|
|
1794
|
+
|
|
1796
1795
|
if (this.props.isNewVersionFlow) {
|
|
1797
|
-
|
|
1796
|
+
|
|
1798
1797
|
if (event === 'onSelect' && data === 'New Version') {
|
|
1799
1798
|
this.callChildEvent(data, val, 'addVersion', event);
|
|
1800
1799
|
} else if (event === 'onSelect' && data !== 'New Version') {
|
|
1801
|
-
|
|
1802
|
-
|
|
1800
|
+
|
|
1801
|
+
|
|
1803
1802
|
currentTab = _.findIndex(this.state.formData['template-version-options'], { key: data}) + 1;
|
|
1804
1803
|
this.setState({currentTab, tabKey: formData[`${currentTab - 1}`].tabKey}, () => {
|
|
1805
|
-
|
|
1804
|
+
|
|
1806
1805
|
val.injectedEvents[event].call(this, this.state.formData['template-version-options'][currentTab - 1].key, formData, val);
|
|
1807
1806
|
});
|
|
1808
1807
|
}
|
|
1809
|
-
|
|
1808
|
+
|
|
1810
1809
|
if (event === 'onContentChange') {
|
|
1811
|
-
|
|
1810
|
+
|
|
1812
1811
|
// formData[`${this.state.currentTab - 1}`][formData[`${this.state.currentTab - 1}`].activeTab]['template-content'] = data.editor.getData();
|
|
1813
1812
|
// if (formData[`${this.state.currentTab - 1}`].tabKey === formData.base.tabKey) {
|
|
1814
1813
|
// formData.base[formData[`${this.state.currentTab - 1}`].activeTab][`template-content`] = data.editor.getData();
|
|
1815
1814
|
//}
|
|
1816
1815
|
}
|
|
1817
1816
|
}
|
|
1818
|
-
|
|
1819
|
-
|
|
1817
|
+
|
|
1818
|
+
|
|
1820
1819
|
this.setState({formData}, () => {
|
|
1821
1820
|
this.validateForm();
|
|
1822
1821
|
});
|
|
@@ -1831,7 +1830,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1831
1830
|
val.injectedEvents[event].call(this, true, formData, val);
|
|
1832
1831
|
}
|
|
1833
1832
|
} else if (!this.props.isNewVersionFlow) {
|
|
1834
|
-
|
|
1833
|
+
|
|
1835
1834
|
val.injectedEvents[event].call(this, true, formData, val);
|
|
1836
1835
|
}
|
|
1837
1836
|
} else if (val.injectedEvents && val.injectedEvents.onChange) {
|
|
@@ -1839,7 +1838,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1839
1838
|
}
|
|
1840
1839
|
|
|
1841
1840
|
if (!((event === 'onSelect' && data === 'New Version') || event === 'onContentChange')) {
|
|
1842
|
-
|
|
1841
|
+
|
|
1843
1842
|
this.props.onChange(formData, this.state.tabCount, currentTab);
|
|
1844
1843
|
}
|
|
1845
1844
|
}
|
|
@@ -1879,14 +1878,14 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1879
1878
|
return true;
|
|
1880
1879
|
};
|
|
1881
1880
|
callChildEvent(data, val, event, e) {
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1881
|
+
|
|
1882
|
+
|
|
1883
|
+
|
|
1885
1884
|
if (!event) {
|
|
1886
|
-
|
|
1885
|
+
|
|
1887
1886
|
return;
|
|
1888
1887
|
}
|
|
1889
|
-
|
|
1888
|
+
|
|
1890
1889
|
const tab = this.state.tabCount;
|
|
1891
1890
|
// const parent = this._reactInternalInstance._currentElement._owner._instance;
|
|
1892
1891
|
if (event === 'onTabChange') {
|
|
@@ -1897,35 +1896,35 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1897
1896
|
const formData = _.cloneDeep(this.state.formData);
|
|
1898
1897
|
let activeTabIndex = '1';
|
|
1899
1898
|
const elems = document.getElementsByClassName("ant-tabs-tab");
|
|
1900
|
-
|
|
1899
|
+
|
|
1901
1900
|
for (let i = 0; i < elems.length; i += 1) {
|
|
1902
|
-
|
|
1901
|
+
|
|
1903
1902
|
if (elems.item(i).classList.contains("ant-tabs-tab-active")) {
|
|
1904
1903
|
activeTabIndex = i + 1;
|
|
1905
1904
|
}
|
|
1906
1905
|
}
|
|
1907
|
-
|
|
1906
|
+
|
|
1908
1907
|
formData[(this.state.currentTab - 1)].activeTab = formData[(this.state.currentTab - 1)].selectedLanguages[activeTabIndex - 1];
|
|
1909
1908
|
formData[(this.state.currentTab - 1)].tabKey = `${data}`;
|
|
1910
1909
|
if (formData[(this.state.currentTab - 1)].base) {
|
|
1911
1910
|
formData.base.activeTab = formData[(this.state.currentTab - 1)].selectedLanguages[activeTabIndex - 1];
|
|
1912
1911
|
formData.base.tabKey = `${data}`;
|
|
1913
1912
|
}
|
|
1914
|
-
|
|
1913
|
+
|
|
1915
1914
|
that.setState({formData, currentLangTab: formData[(this.state.currentTab - 1)].activeTab, tabKey: formData[(this.state.currentTab - 1)][formData[(this.state.currentTab - 1)].activeTab].tabKey}, () => {
|
|
1916
1915
|
val.injectedEvents[event].call(that.props.parent, this.state.currentTab, formData);
|
|
1917
1916
|
});
|
|
1918
1917
|
} else {
|
|
1919
1918
|
let activeTabIndex = '1';
|
|
1920
1919
|
const elems = document.getElementsByClassName("ant-tabs-tab");
|
|
1921
|
-
|
|
1920
|
+
|
|
1922
1921
|
for (let i = 0; i < elems.length; i += 1) {
|
|
1923
|
-
|
|
1922
|
+
|
|
1924
1923
|
if (elems.item(i).classList.contains("ant-tabs-tab-active")) {
|
|
1925
1924
|
activeTabIndex = i + 1;
|
|
1926
1925
|
}
|
|
1927
1926
|
}
|
|
1928
|
-
|
|
1927
|
+
|
|
1929
1928
|
that.setState({currentTab: activeTabIndex});
|
|
1930
1929
|
val.injectedEvents[event].call(that.props.parent, activeTabIndex);
|
|
1931
1930
|
}
|
|
@@ -1936,7 +1935,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1936
1935
|
this.setState({ popoverVisible: false });
|
|
1937
1936
|
const that = this;
|
|
1938
1937
|
setTimeout(() => {
|
|
1939
|
-
|
|
1938
|
+
|
|
1940
1939
|
val.injectedEvents[event].call(that.props.parent, tab);
|
|
1941
1940
|
}, 0);
|
|
1942
1941
|
return;
|
|
@@ -1962,14 +1961,14 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1962
1961
|
_.forEach(formData[this.state.tabCount].selectedLanguages, (lang) => {
|
|
1963
1962
|
const tmptabData = formData[this.state.tabCount][lang];
|
|
1964
1963
|
_.forEach(formData[this.state.tabCount][lang], (tabData, index) => {
|
|
1965
|
-
|
|
1964
|
+
|
|
1966
1965
|
if (index === 'tabKey') {
|
|
1967
1966
|
tmptabData.tabKey = _.uniqueId();
|
|
1968
1967
|
}
|
|
1969
1968
|
});
|
|
1970
1969
|
});
|
|
1971
1970
|
formData[this.state.tabCount].tabKey = formData[this.state.tabCount][formData[this.state.tabCount].activeTab].tabKey;
|
|
1972
|
-
|
|
1971
|
+
|
|
1973
1972
|
this.setState({formData, tabKey: formData[this.state.tabCount].tabKey}, () => {
|
|
1974
1973
|
val.injectedEvents[event].call(this.props.parent, formData, this.state.currentTab);
|
|
1975
1974
|
});
|
|
@@ -2022,24 +2021,24 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2022
2021
|
// };
|
|
2023
2022
|
// debugger;
|
|
2024
2023
|
// if (this.state.formData[`${this.state.currentTab - 1}`].activeTab === this.props.baseLanguage) {
|
|
2025
|
-
//
|
|
2024
|
+
//
|
|
2026
2025
|
// } else {
|
|
2027
2026
|
// const formData = _.cloneDeep(this.state.formData);
|
|
2028
2027
|
// const currentTab = `${this.state.currentTab - 1}`;
|
|
2029
2028
|
// const currentLang = formData[`${this.state.currentTab - 1}`].activeTab;
|
|
2030
2029
|
// const deleteLanguageIndex = formData[currentTab].selectedLanguages.indexOf(currentLang);
|
|
2031
|
-
//
|
|
2030
|
+
//
|
|
2032
2031
|
// delete formData[currentTab][currentLang];
|
|
2033
2032
|
// formData[currentTab].activeTab = this.props.baseLanguage;
|
|
2034
2033
|
// formData[currentTab].selectedLanguages.splice(deleteLanguageIndex, 1);
|
|
2035
|
-
//
|
|
2034
|
+
//
|
|
2036
2035
|
// this.setState({formData, currentLangTab: this.props.baseLanguage}, () => {
|
|
2037
2036
|
// val.injectedEvents[event].call(this.props.parent, formData, deleteLanguageIndex);
|
|
2038
2037
|
// });
|
|
2039
2038
|
// }
|
|
2040
2039
|
return;
|
|
2041
2040
|
}
|
|
2042
|
-
|
|
2041
|
+
|
|
2043
2042
|
val.injectedEvents[event].call(this.props.parent, data);
|
|
2044
2043
|
}
|
|
2045
2044
|
openFileDialog = () => {
|
|
@@ -2047,14 +2046,14 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2047
2046
|
};
|
|
2048
2047
|
handleOk = (ev) => {
|
|
2049
2048
|
const id = ev.target.id;
|
|
2050
|
-
|
|
2049
|
+
|
|
2051
2050
|
this.setState({showModal: false});
|
|
2052
2051
|
if (id === "android" && this.state.androidValid) {
|
|
2053
2052
|
this.props.onSubmit(this.state.formData);
|
|
2054
2053
|
} else if (id === "ios" && this.state.iosValid) {
|
|
2055
2054
|
this.props.onSubmit(this.state.formData);
|
|
2056
2055
|
} else if (id === "sms-version-modal") {
|
|
2057
|
-
|
|
2056
|
+
|
|
2058
2057
|
this.state.currentEvent.call(this.props.parent, this.state.currentEventData, this.state.currentTab);
|
|
2059
2058
|
this.setState({currentEvent: {}, currentEventData: {}});
|
|
2060
2059
|
this.deleteVersion(false, this.state.currentTab);
|
|
@@ -2073,7 +2072,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2073
2072
|
query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module, isLanguageSupport, isEdmSupport},
|
|
2074
2073
|
});
|
|
2075
2074
|
} else if (id === "email-language-delete-modal") {
|
|
2076
|
-
|
|
2075
|
+
|
|
2077
2076
|
this.deleteLanguage();
|
|
2078
2077
|
this.props.handleCancelModal();
|
|
2079
2078
|
// this.setState({currentEvent: {}, currentEventData: {}});
|
|
@@ -2096,7 +2095,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2096
2095
|
}
|
|
2097
2096
|
};
|
|
2098
2097
|
handleConfirmations = () => {
|
|
2099
|
-
|
|
2098
|
+
|
|
2100
2099
|
this.setState({showModal: true});
|
|
2101
2100
|
};
|
|
2102
2101
|
|
|
@@ -2127,7 +2126,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2127
2126
|
baseTab = i;
|
|
2128
2127
|
}
|
|
2129
2128
|
}
|
|
2130
|
-
|
|
2129
|
+
|
|
2131
2130
|
return baseTab;
|
|
2132
2131
|
};
|
|
2133
2132
|
|
|
@@ -2149,15 +2148,15 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2149
2148
|
}
|
|
2150
2149
|
const items = [];
|
|
2151
2150
|
data.map( (template) => {
|
|
2152
|
-
//
|
|
2151
|
+
//
|
|
2153
2152
|
const temp = {};
|
|
2154
2153
|
temp.id = template._id;
|
|
2155
2154
|
if (this.props.schema.channel.toLowerCase() === 'email') {
|
|
2156
|
-
//
|
|
2155
|
+
//
|
|
2157
2156
|
const imgSrc = template && template.versions && template.versions.base ? template.versions.base.preview_http_url : '';
|
|
2158
2157
|
const ifPreviewGenerated = template && template.versions && template.versions.base ? template.versions.base.isPreviewGenerated : 0;
|
|
2159
2158
|
const content = <img src={imgSrc || ''} alt="" />;
|
|
2160
|
-
|
|
2159
|
+
|
|
2161
2160
|
temp.content = (
|
|
2162
2161
|
<div
|
|
2163
2162
|
className="sms-template-content">
|
|
@@ -2207,7 +2206,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2207
2206
|
if (!val.onlyDisplay && !val.standalone && (!this.state.errorData[`${this.state.currentTab - 1}`] || (!this.state.errorData[`${this.state.currentTab - 1}`][val.id] && this.state.errorData[`${this.state.currentTab - 1}`][val.id] === null))) {
|
|
2208
2207
|
return true;
|
|
2209
2208
|
}
|
|
2210
|
-
//
|
|
2209
|
+
//
|
|
2211
2210
|
columns.push(
|
|
2212
2211
|
<Col key="label" span={4}>
|
|
2213
2212
|
<Label style={val.labelStyle ? val.labelStyle : {}}>{val.label}</Label>
|
|
@@ -2233,7 +2232,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2233
2232
|
case "input":
|
|
2234
2233
|
if (styling === 'semantic') {
|
|
2235
2234
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2236
|
-
|
|
2235
|
+
|
|
2237
2236
|
columns.push(
|
|
2238
2237
|
<Col key={val.id} span={val.width}>
|
|
2239
2238
|
<CapInput
|
|
@@ -2268,7 +2267,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2268
2267
|
if (styling === 'semantic') {
|
|
2269
2268
|
columns.push(
|
|
2270
2269
|
<Col key="input" span={val.width}>
|
|
2271
|
-
<
|
|
2270
|
+
<TextArea
|
|
2272
2271
|
id={val.id}
|
|
2273
2272
|
className={`${ifError ? 'error' : ''}`}
|
|
2274
2273
|
errorMessage={val.errorMessage ? val.errorMessage : ''}
|
|
@@ -2291,6 +2290,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2291
2290
|
columns.push(<CapColumn id={val.id} className={"preview-chars"} span={val.width}>
|
|
2292
2291
|
{charList.map((char) => char)}
|
|
2293
2292
|
</CapColumn>);
|
|
2293
|
+
break;
|
|
2294
2294
|
case "checkbox":
|
|
2295
2295
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2296
2296
|
if (styling === 'semantic') {
|
|
@@ -2396,7 +2396,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2396
2396
|
}
|
|
2397
2397
|
break;
|
|
2398
2398
|
case "ckeditor":
|
|
2399
|
-
|
|
2399
|
+
|
|
2400
2400
|
columns.push(
|
|
2401
2401
|
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
2402
2402
|
<CKEditor
|
|
@@ -2421,11 +2421,11 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2421
2421
|
}
|
|
2422
2422
|
}
|
|
2423
2423
|
const edmSrc = this.state.formData[`${this.state.currentTab - 1}`][this.state.currentLangTab][`edmeditor${langTab > 1 ? langTab : ''}src`];
|
|
2424
|
-
|
|
2424
|
+
|
|
2425
2425
|
if (!edmSrc) {
|
|
2426
2426
|
return false;
|
|
2427
2427
|
}
|
|
2428
|
-
|
|
2428
|
+
|
|
2429
2429
|
columns.push(
|
|
2430
2430
|
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
2431
2431
|
<EDMEditor
|
|
@@ -2552,10 +2552,10 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2552
2552
|
const styling = val.styling;
|
|
2553
2553
|
const isVersionEnable = (this.state.usingTabContainer && !val.standalone);
|
|
2554
2554
|
if (val.id.match(/edmeditor/g)) {
|
|
2555
|
-
|
|
2555
|
+
|
|
2556
2556
|
}
|
|
2557
|
-
|
|
2558
|
-
|
|
2557
|
+
|
|
2558
|
+
|
|
2559
2559
|
if (!this.props.isNewVersionFlow && !val.standalone && !val.onlyDisplay && isVersionEnable && !this.state.formData[`${this.state.currentTab - 1}`]) {
|
|
2560
2560
|
return true;
|
|
2561
2561
|
}
|
|
@@ -2573,7 +2573,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2573
2573
|
this.state.errorData[`${this.state.currentTab - 1}`][val.id] === null)))) {
|
|
2574
2574
|
return true;
|
|
2575
2575
|
}
|
|
2576
|
-
|
|
2576
|
+
|
|
2577
2577
|
let ifError = false;
|
|
2578
2578
|
if (val.primitive) {
|
|
2579
2579
|
if (val.id === "mark-final-version-label") {
|
|
@@ -2589,11 +2589,11 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2589
2589
|
);
|
|
2590
2590
|
return true;
|
|
2591
2591
|
}
|
|
2592
|
-
|
|
2592
|
+
|
|
2593
2593
|
switch (type) {
|
|
2594
2594
|
case "input":
|
|
2595
2595
|
ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
|
|
2596
|
-
|
|
2596
|
+
|
|
2597
2597
|
if (styling === 'semantic') {
|
|
2598
2598
|
columns.push(
|
|
2599
2599
|
<Col key={val.id} span={val.width}>
|
|
@@ -2629,7 +2629,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2629
2629
|
if (styling === 'semantic') {
|
|
2630
2630
|
columns.push(
|
|
2631
2631
|
<Col key="input" span={val.width} offset={val.offset}>
|
|
2632
|
-
<
|
|
2632
|
+
<TextArea
|
|
2633
2633
|
id={val.id}
|
|
2634
2634
|
placeholder={val.placeholder ? val.placeholder : ''}
|
|
2635
2635
|
disabled={val.disabled}
|
|
@@ -2806,7 +2806,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2806
2806
|
}
|
|
2807
2807
|
break;
|
|
2808
2808
|
case "line-preview": {
|
|
2809
|
-
|
|
2809
|
+
|
|
2810
2810
|
const content = {
|
|
2811
2811
|
bodyText: isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][`message-editor${this.state.currentTab > 1 ? this.state.currentTab : ''}`] : this.state.formData[val.id],
|
|
2812
2812
|
bodyImage: this.state.formData[`${this.state.currentTab - 1}`].imagePreview,
|
|
@@ -2814,7 +2814,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2814
2814
|
if (!this.state.formData[`${this.state.currentTab - 1}`]) {
|
|
2815
2815
|
return true;
|
|
2816
2816
|
}
|
|
2817
|
-
|
|
2817
|
+
|
|
2818
2818
|
columns.push(
|
|
2819
2819
|
<Col key="input" span={23} offset={1}>
|
|
2820
2820
|
<TemplatePreview
|
|
@@ -2942,10 +2942,10 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2942
2942
|
if (val.id.indexOf('template-content') > -1 && val.id !== 'template-content') {
|
|
2943
2943
|
langIndex = parseInt(val.id.replace('template-content', ''), 10) - 1;
|
|
2944
2944
|
}
|
|
2945
|
-
|
|
2945
|
+
|
|
2946
2946
|
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;
|
|
2947
2947
|
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'] : '');
|
|
2948
|
-
|
|
2948
|
+
|
|
2949
2949
|
if (this.state.formData[`${this.state.currentTab - 1}`][currentLang].is_drag_drop) {
|
|
2950
2950
|
// content = "";
|
|
2951
2951
|
}
|
|
@@ -2968,9 +2968,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2968
2968
|
// }
|
|
2969
2969
|
let langTab = 1;
|
|
2970
2970
|
if (val.id.match(/edmeditor/g)) {
|
|
2971
|
-
|
|
2971
|
+
|
|
2972
2972
|
if (val.id.length > 9 && val.id.charAt(9)) {
|
|
2973
|
-
|
|
2973
|
+
|
|
2974
2974
|
langTab = val.id.charAt(9);
|
|
2975
2975
|
}
|
|
2976
2976
|
}
|
|
@@ -2983,13 +2983,13 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2983
2983
|
// 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;
|
|
2984
2984
|
const currentLang = supportedLanguages[langTab - 1];
|
|
2985
2985
|
const edmSrc = this.state.formData[`${this.state.currentTab - 1}`][currentLang] && this.state.formData[`${this.state.currentTab - 1}`][currentLang][`edmeditor${this.state.currentTab > 1 ? this.state.currentTab : ''}src`];
|
|
2986
|
-
|
|
2987
|
-
|
|
2986
|
+
|
|
2987
|
+
|
|
2988
2988
|
if (!edmSrc) {
|
|
2989
2989
|
return false;
|
|
2990
2990
|
}
|
|
2991
|
-
|
|
2992
|
-
|
|
2991
|
+
|
|
2992
|
+
|
|
2993
2993
|
columns.push(
|
|
2994
2994
|
<Col style={val.colStyle ? val.colStyle : {}} span={val.width}>
|
|
2995
2995
|
<EDMEditor
|
|
@@ -3101,7 +3101,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3101
3101
|
result = this.renderSection(section, paneIndex);
|
|
3102
3102
|
return result;
|
|
3103
3103
|
});
|
|
3104
|
-
|
|
3104
|
+
|
|
3105
3105
|
const sectionHeadeers = pane.sectionsHeaders ? pane.sectionsHeaders : container.tabContent && container.tabContent.sections;
|
|
3106
3106
|
renderedContentSections = sectionHeadeers.map( (tabContentSection) => {
|
|
3107
3107
|
result = this.renderSection(tabContentSection, paneIndex);
|
|
@@ -3120,7 +3120,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3120
3120
|
const currentLang = this.state.formData[this.state.currentTab - 1].selectedLanguages[index];
|
|
3121
3121
|
paneTabKey = this.state.formData[this.state.currentTab - 1] && this.state.formData[this.state.currentTab - 1][currentLang] && this.state.formData[this.state.currentTab - 1][currentLang].tabKey;
|
|
3122
3122
|
}
|
|
3123
|
-
|
|
3123
|
+
|
|
3124
3124
|
renderedPanes.push(
|
|
3125
3125
|
<TabPane
|
|
3126
3126
|
forceRender
|
|
@@ -3209,9 +3209,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3209
3209
|
}
|
|
3210
3210
|
return null;
|
|
3211
3211
|
});
|
|
3212
|
-
|
|
3212
|
+
|
|
3213
3213
|
allElements.push(renderedContainers);
|
|
3214
|
-
|
|
3214
|
+
|
|
3215
3215
|
const modal = this.getModal();
|
|
3216
3216
|
allElements.push(modal);
|
|
3217
3217
|
}
|
|
@@ -3231,7 +3231,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3231
3231
|
</CardGrid>
|
|
3232
3232
|
);
|
|
3233
3233
|
|
|
3234
|
-
|
|
3234
|
+
|
|
3235
3235
|
return (
|
|
3236
3236
|
<Row>
|
|
3237
3237
|
{
|