@capillarytech/creatives-library 6.8.8 → 6.9.1
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 -1
- package/components/Edmeditor/index.js +1 -1
- package/components/FormBuilder/index.js +0 -1
- package/components/TemplatePreview/_templatePreview.scss +0 -6
- package/components/TemplatePreview/index.js +28 -35
- package/config/app.js +1 -1
- package/containers/TagList/index.js +3 -3
- package/index.html +5 -0
- package/package.json +2 -1
- package/services/api.js +16 -1
- package/v2Components/BeeEditor/index.js +278 -0
- package/v2Components/BeeEditor/index.scss +11 -0
- package/v2Components/BeeEditor/messages.js +47 -0
- package/v2Components/BeeEditor/tests/index.test.js +10 -0
- package/v2Components/CapTagList/index.js +55 -26
- package/v2Components/CmsTemplatesComponent/index.js +4 -4
- package/v2Components/Edmeditor/index.js +1 -1
- package/v2Components/EmailPreview/_emailPreview.scss +2 -2
- package/v2Components/FormBuilder/index.js +117 -43
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +151 -151
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +33 -33
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -10
- package/v2Components/TemplatePreview/_templatePreview.scss +0 -1
- package/v2Components/TemplatePreview/assets/images/androidPushMessage.svg +44 -44
- package/v2Components/TemplatePreview/assets/images/home-screen-android.svg +21 -21
- package/v2Components/TemplatePreview/assets/images/home-screen-ios.svg +16 -16
- package/v2Components/TemplatePreview/assets/images/iPhonePushMessage.svg +134 -134
- package/v2Components/TemplatePreview/assets/images/mobile.svg +23 -23
- package/v2Components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -22
- package/v2Components/TemplatePreview/assets/images/user-icon.svg +18 -18
- package/v2Components/TemplatePreview/assets/images/wechat-home-screen-android.svg +21 -21
- package/v2Components/TemplatePreview/assets/images/wechat-mobile.svg +77 -77
- package/v2Components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -20
- package/v2Components/TemplatePreview/index.js +29 -36
- package/v2Components/TemplatePreview/tests/index.test.js +10 -10
- package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -7
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +51 -51
- package/v2Containers/CreativesContainer/actions.js +27 -27
- package/v2Containers/CreativesContainer/constants.js +17 -17
- package/v2Containers/CreativesContainer/index.js +7 -2
- package/v2Containers/CreativesContainer/index.scss +44 -44
- package/v2Containers/CreativesContainer/messages.js +305 -305
- package/v2Containers/CreativesContainer/reducer.js +29 -29
- package/v2Containers/CreativesContainer/sagas.js +11 -11
- package/v2Containers/CreativesContainer/selectors.js +30 -30
- package/v2Containers/CreativesContainer/tests/actions.test.js +18 -18
- package/v2Containers/CreativesContainer/tests/index.test.js +10 -10
- package/v2Containers/CreativesContainer/tests/reducer.test.js +9 -9
- package/v2Containers/CreativesContainer/tests/sagas.test.js +15 -15
- package/v2Containers/CreativesContainer/tests/selectors.test.js +10 -10
- package/v2Containers/Email/constants.js +1 -0
- package/v2Containers/Email/index.js +210 -108
- package/v2Containers/Email/initialSchema.js +18 -3
- package/v2Containers/Email/sagas.js +2 -2
- package/v2Containers/Email/selectors.js +5 -0
- package/v2Containers/EmailWrapper/index.js +19 -3
- package/v2Containers/Line/Container/Image/index.js +19 -21
- package/v2Containers/Line/Container/ImageMap/constants.js +1 -2
- package/v2Containers/Line/Container/ImageMap/index.js +6 -31
- package/v2Containers/Line/Container/ImageMap/messages.js +0 -12
- package/v2Containers/Line/Container/Wrapper/index.js +1 -5
- package/v2Containers/Line/Container/Wrapper/messages.js +0 -4
- package/v2Containers/Line/Container/Wrapper/utils.js +16 -15
- package/v2Containers/Line/Container/_lineCreate.scss +2 -2
- package/v2Containers/Line/Container/actions.js +2 -4
- package/v2Containers/Line/Container/constants.js +0 -3
- package/v2Containers/Line/Container/index.js +11 -49
- package/v2Containers/Line/Container/reducer.js +2 -2
- package/v2Containers/Line/Container/sagas.js +2 -2
- package/v2Containers/Line/Container/style.js +1 -2
- package/v2Containers/TagList/index.js +6 -0
- package/v2Containers/Templates/_templates.scss +0 -9
- package/v2Containers/Templates/actions.js +122 -117
- package/v2Containers/Templates/constants.js +49 -47
- package/v2Containers/Templates/index.js +34 -42
- package/v2Containers/Templates/messages.js +8 -4
- package/v2Containers/Templates/reducer.js +153 -145
- package/v2Containers/Templates/sagas.js +179 -179
- package/v2Containers/Templates/selectors.js +19 -1
- package/v2Containers/Templates/tests/actions.test.js +18 -18
- package/v2Containers/Templates/tests/index.test.js +10 -10
- package/v2Containers/Templates/tests/reducer.test.js +9 -9
- package/v2Containers/Templates/tests/sagas.test.js +15 -15
- package/v2Containers/Templates/tests/selectors.test.js +10 -10
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +29 -29
- package/v2Containers/TemplatesV2/actions.js +16 -16
- package/v2Containers/TemplatesV2/constants.js +10 -10
- package/v2Containers/TemplatesV2/messages.js +61 -61
- package/v2Containers/TemplatesV2/selectors.js +25 -25
- package/v2Containers/TemplatesV2/tests/actions.test.js +18 -18
- package/v2Containers/TemplatesV2/tests/index.test.js +10 -10
- package/v2Containers/TemplatesV2/tests/reducer.test.js +9 -9
- package/v2Containers/TemplatesV2/tests/sagas.test.js +15 -15
- package/v2Containers/TemplatesV2/tests/selectors.test.js +10 -10
- package/v2Components/Carousel/index.js +0 -120
- package/v2Components/Carousel/style.scss +0 -40
- package/v2Containers/Line/Container/ImageCarousel/Content.js +0 -554
- package/v2Containers/Line/Container/ImageCarousel/constants.js +0 -10
- package/v2Containers/Line/Container/ImageCarousel/index.js +0 -526
- package/v2Containers/Line/Container/ImageCarousel/messages.js +0 -178
- package/v2Containers/Line/Container/ImageCarousel/style.js +0 -61
|
@@ -33,7 +33,6 @@ import { EMAIL } from '../CreativesContainer/constants';
|
|
|
33
33
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
34
34
|
import { TRACK_CREATE_EMAIL, TRACK_EDIT_EMAIL } from '../App/constants';
|
|
35
35
|
import { FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
36
|
-
|
|
37
36
|
const {CapCustomCardList} = CapCustomCard;
|
|
38
37
|
export class Email extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
39
38
|
constructor(props) {
|
|
@@ -179,24 +178,36 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
179
178
|
// "template-content": (this.props.Templates.selectedEmailLayout ? this.props.Templates.selectedEmailLayout : ''),
|
|
180
179
|
// };
|
|
181
180
|
// if (this.props.Templates.CmsSettings) {}
|
|
182
|
-
|
|
181
|
+
|
|
183
182
|
if (this.props.location.query.module === "library" && this.props.templateData) {
|
|
184
183
|
this.props.templatesActions.resetTemplateData();
|
|
185
184
|
}
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
// const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
|
|
186
|
+
const isBEESupport = (this.props.location.query.isBEESupport !== "false") || false;
|
|
187
|
+
|
|
188
|
+
//----------------commented by sakshi------------------------
|
|
189
|
+
// if (!_.isEmpty(this.props.Templates.edmTemplate)) {
|
|
190
|
+
// if (this.props.Templates.edmTemplate.versions.base.is_drag_drop) {
|
|
191
|
+
// this.setState({isDragDrop: true});
|
|
192
|
+
// }
|
|
193
|
+
// if (this.props.params.id) {
|
|
194
|
+
// this.props.actions.getCmsSetting('edm', this.props.Templates.edmTemplate.versions.base.drag_drop_id, 'open', undefined, isEdmSupport);
|
|
195
|
+
// } else if (this.props.location.query.module !== "library" || (this.props.location.query.module === "library" && !this.props.templateData)) {
|
|
196
|
+
// this.props.actions.getCmsSetting('edm', this.props.Templates.edmTemplate.versions.base.drag_drop_id, 'create', undefined, isEdmSupport);
|
|
197
|
+
// }
|
|
198
|
+
// }
|
|
199
|
+
// --------till here commented by sakshi------------------------
|
|
200
|
+
if (!_.isEmpty(this.props.Templates.BEETemplate) ) {
|
|
201
|
+
if (this.props.Templates.BEETemplate.versions.base.is_drag_drop) {
|
|
188
202
|
this.setState({isDragDrop: true});
|
|
189
203
|
}
|
|
190
204
|
if (this.props.params.id) {
|
|
191
|
-
this.props.actions.getCmsSetting('
|
|
205
|
+
this.props.actions.getCmsSetting('BEE', this.props.Templates.BEETemplate._id, 'open', undefined, isBEESupport);
|
|
192
206
|
} else if (this.props.location.query.module !== "library" || (this.props.location.query.module === "library" && !this.props.templateData)) {
|
|
193
|
-
this.props.actions.getCmsSetting('
|
|
207
|
+
this.props.actions.getCmsSetting('BEE', this.props.Templates.BEETemplate._id, 'create', undefined, isBEESupport);
|
|
194
208
|
}
|
|
195
209
|
}
|
|
196
|
-
|
|
197
|
-
this.setState({ content: (this.props.Templates.selectedEmailLayout ? this.props.Templates.selectedEmailLayout : ''), formData}, () => {
|
|
198
|
-
// this.injectEvents(this.state.schema);
|
|
199
|
-
});
|
|
210
|
+
this.setState({ content: (this.props.Templates.selectedEmailLayout ? this.props.Templates.selectedEmailLayout : ''), formData});
|
|
200
211
|
|
|
201
212
|
// setTimeout(() => {
|
|
202
213
|
// // this.getFormData();
|
|
@@ -216,7 +227,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
216
227
|
this.showNext();
|
|
217
228
|
}
|
|
218
229
|
}
|
|
219
|
-
|
|
220
230
|
componentWillReceiveProps(nextProps) {
|
|
221
231
|
// if (this.props.location.query.type === 'embedded') {
|
|
222
232
|
// this.showNext();
|
|
@@ -316,16 +326,16 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
316
326
|
this.startTemplateCreation(nextProps.templateData);
|
|
317
327
|
}
|
|
318
328
|
if (nextProps.location.query.module === 'library' && nextProps.isGetFormData) {
|
|
329
|
+
const formData = this.state.formData;
|
|
330
|
+
let isBeeEditor = false;
|
|
331
|
+
_.forEach(formData[0].selectedLanguages, (language) => {
|
|
332
|
+
if (formData[0][language].is_drag_drop) {
|
|
333
|
+
isBeeEditor = true;
|
|
334
|
+
}
|
|
335
|
+
});
|
|
319
336
|
if (this.props.isFullMode) {
|
|
320
337
|
let triggerGetFormData = true;
|
|
321
|
-
|
|
322
|
-
const formData = this.state.formData;
|
|
323
|
-
_.forEach(formData[0].selectedLanguages, (language) => {
|
|
324
|
-
if (formData[0][language].is_drag_drop) {
|
|
325
|
-
isEdmEditor = true;
|
|
326
|
-
}
|
|
327
|
-
});
|
|
328
|
-
triggerGetFormData = isEdmEditor ? (!nextProps.Email.fetchingCmsData && _.isEmpty(nextProps.Email.cmsData)) : !nextProps.Email.createTemplateInProgress && _.isEmpty(nextProps.Email.createResponse); // if edm editor selected check for getCmsData call in progress or not before triggering save
|
|
338
|
+
triggerGetFormData = isBeeEditor ? (!nextProps.Email.fetchingCmsData && _.isEmpty(nextProps.Email.cmsData)) : !nextProps.Email.createTemplateInProgress && _.isEmpty(nextProps.Email.createResponse); // if edm editor selected check for getCmsData call in progress or not before triggering save
|
|
329
339
|
if (triggerGetFormData) {
|
|
330
340
|
this.getFormData();
|
|
331
341
|
}
|
|
@@ -335,6 +345,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
335
345
|
}
|
|
336
346
|
this.getFormData();
|
|
337
347
|
}
|
|
348
|
+
if (!nextProps.Email.createTemplateInProgress && isBeeEditor) {
|
|
349
|
+
this.beeInstance && this.beeInstance.save();
|
|
350
|
+
}
|
|
338
351
|
}
|
|
339
352
|
|
|
340
353
|
if (!_.isEmpty(nextProps.Email.CmsSettings) && !_.isEqual(this.props.Email.CmsSettings, nextProps.Email.CmsSettings) && !_.isEmpty(this.state.schema)) {
|
|
@@ -348,16 +361,26 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
348
361
|
|
|
349
362
|
const temp = schema.containers[this.state.currentTab - 1];
|
|
350
363
|
|
|
351
|
-
|
|
364
|
+
const { currentTab } = this.state;
|
|
352
365
|
if (nextProps.Email.CmsSettings.isDragDrop) {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
366
|
+
const beeJson = `BEEeditor${currentTab > 1 ? currentTab : ''}json`;
|
|
367
|
+
const beeToken = `BEEeditor${currentTab > 1 ? currentTab : ''}token`;
|
|
368
|
+
let beeJsonValue = _.get(nextProps, 'Templates.BEETemplate.versions.base.json-content', '');
|
|
369
|
+
const selectedId = _.get(this.props, 'Email.templateDetails._id', '') || _.get(this.props, 'Templates.BEETemplate._id', '')
|
|
370
|
+
if (this.state.isEdit) {
|
|
371
|
+
if (this.props.location.query.module === "library") {
|
|
372
|
+
beeJsonValue = _.get(this.state, `formData[${currentTab - 1}][${langId}].json-content`, '');
|
|
373
|
+
} else {
|
|
374
|
+
beeJsonValue = _.get(nextProps, `Email.templateDetails.versions.base[${langId}].json-content`, '');
|
|
375
|
+
}
|
|
360
376
|
}
|
|
377
|
+
formData[`${currentTab - 1}`][langId] = {
|
|
378
|
+
...formData[`${currentTab - 1}`][langId],
|
|
379
|
+
is_drag_drop: true,
|
|
380
|
+
[beeJson]: beeJsonValue,
|
|
381
|
+
[beeToken]: nextProps.Email.CmsSettings.tokenData,
|
|
382
|
+
id: selectedId,
|
|
383
|
+
};
|
|
361
384
|
_.forEach(temp.panes, (pane, index) => {
|
|
362
385
|
const tempPane = pane;
|
|
363
386
|
//
|
|
@@ -367,7 +390,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
367
390
|
tempPane.sections[0].inputFields[0].cols[0].colStyle = {display: "none"};
|
|
368
391
|
}
|
|
369
392
|
});
|
|
370
|
-
|
|
371
393
|
this.setState({schema, isSchemaChanged: true, loadingStatus: this.state.loadingStatus + 1});
|
|
372
394
|
} else {
|
|
373
395
|
_.forEach(temp.panes, (pane, index) => {
|
|
@@ -384,7 +406,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
384
406
|
html = html.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\\"/g, '"');
|
|
385
407
|
|
|
386
408
|
formData[this.state.currentTab - 1][langId]["template-content"] = html;
|
|
387
|
-
if (window.CKEDITOR && apiLangId !== "undefined") {
|
|
409
|
+
if (window.CKEDITOR && apiLangId !== "undefined" && !this.props.Email.fetchingCmsSettings && !this.props.Email.getTemplateDetailsInProgress) {
|
|
388
410
|
const instanceName = `template-content${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`;
|
|
389
411
|
|
|
390
412
|
_.forEach(window.CKEDITOR.instances, (winInstance) => {
|
|
@@ -422,23 +444,26 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
422
444
|
if (formData[`${this.state.currentTab - 1}`].base) {
|
|
423
445
|
formData.base[formData.base.activeTab]['template-content'] = decodeURIComponent(nextProps.Email.cmsData);
|
|
424
446
|
}
|
|
425
|
-
} else {
|
|
447
|
+
} else if (!nextProps.Email.getTemplateDetailsInProgress) {
|
|
426
448
|
const langIndex = formData[this.state.currentTab - 1].selectedLanguages.indexOf(formData[this.state.currentTab - 1].activeTab);
|
|
427
449
|
const instanceName = `template-content${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`;
|
|
428
450
|
|
|
429
|
-
|
|
430
|
-
|
|
451
|
+
if (window.CKEDITOR) {
|
|
452
|
+
_.forEach(window.CKEDITOR.instances, (winInstance) => {
|
|
453
|
+
const temp = winInstance;
|
|
431
454
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
455
|
+
if (winInstance.name === instanceName) {
|
|
456
|
+
temp.setData(decodeURIComponent(nextProps.Email.cmsData));
|
|
457
|
+
} else if (winInstance.name.indexOf('editor') !== -1) {
|
|
458
|
+
temp.setData(decodeURIComponent(nextProps.Email.cmsData));
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
}
|
|
438
462
|
formData[`${this.state.currentTab - 1}`][formData[`${this.state.currentTab - 1}`].activeTab]['template-content'] = decodeURIComponent(nextProps.Email.cmsData);
|
|
439
463
|
formData[`${this.state.currentTab - 1}`][formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop = false;
|
|
440
464
|
formData[`${this.state.currentTab - 1}`][formData[`${this.state.currentTab - 1}`].activeTab].drag_drop_id = "";
|
|
441
465
|
delete formData[`${this.state.currentTab - 1}`][formData[`${this.state.currentTab - 1}`].activeTab].edmeditorsrc;
|
|
466
|
+
// from edm to ck editor
|
|
442
467
|
if (formData[`${this.state.currentTab - 1}`].base) {
|
|
443
468
|
formData.base[formData.base.activeTab]['template-content'] = decodeURIComponent(nextProps.Email.cmsData);
|
|
444
469
|
formData.base[formData.base.activeTab].is_drag_drop = false;
|
|
@@ -456,8 +481,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
456
481
|
|
|
457
482
|
if ( !_.isEqual(nextProps.Email.uploadAssetSuccess, this.props.Email.uploadAssetSuccess) && nextProps.Email.uploadAssetSuccess) {
|
|
458
483
|
const isDragDrop = this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop;
|
|
459
|
-
const
|
|
460
|
-
if (isDragDrop &&
|
|
484
|
+
const isBEESupport = (this.props.location.query.isBEESupport !== "false") || false;
|
|
485
|
+
if (isDragDrop && isBEESupport) {
|
|
461
486
|
const evtData = JSON.parse(this.edmEvent.data);
|
|
462
487
|
if (evtData.action === 'editBackground') {
|
|
463
488
|
this.edmEvent.source.postMessage(JSON.stringify({
|
|
@@ -501,6 +526,12 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
501
526
|
this.setState({totalCount: nextProps.Email.assetList[0].totalCount});
|
|
502
527
|
}
|
|
503
528
|
}
|
|
529
|
+
if (!_.isEmpty(nextProps.Email.templateDetails) && _.isEmpty(this.props.Email.templateDetails) ) {
|
|
530
|
+
const base = nextProps.Email.templateDetails.versions.base;
|
|
531
|
+
if (nextProps.Email.templateDetails.versions.base[base.activeTab].is_drag_drop) {
|
|
532
|
+
this.setState({isDragDrop: true});
|
|
533
|
+
}
|
|
534
|
+
}
|
|
504
535
|
}
|
|
505
536
|
|
|
506
537
|
componentWillUnmount() {
|
|
@@ -585,9 +616,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
585
616
|
onTagSelect = (data) => {
|
|
586
617
|
const isDragDrop = this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop;
|
|
587
618
|
const formData = _.cloneDeep(this.state.formData);
|
|
588
|
-
const
|
|
619
|
+
const isBEESupport = (this.props.location.query.isBEESupport !== "false") || false;
|
|
589
620
|
|
|
590
|
-
if (isDragDrop &&
|
|
621
|
+
if (isDragDrop && isBEESupport) {
|
|
591
622
|
let msg = {};
|
|
592
623
|
if (data === "unsubscribe") {
|
|
593
624
|
const anchor = `<a href='{{${data}}}'>${data}</a>`;
|
|
@@ -628,10 +659,12 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
628
659
|
onUpdateTemplateComplete = (createResponse) => {
|
|
629
660
|
const {isEdit, formData = {} } = this.state || {};
|
|
630
661
|
const base = formData.base || {};
|
|
631
|
-
const isDragDrop = _.get(base[base.activeTab], 'is_drag_drop'
|
|
632
|
-
let editorType = '
|
|
633
|
-
if ( isDragDrop ) {
|
|
662
|
+
const isDragDrop = _.get(base[base.activeTab], 'is_drag_drop');
|
|
663
|
+
let editorType = '';
|
|
664
|
+
if ( isDragDrop === true) {
|
|
634
665
|
editorType = 'edmEditor';
|
|
666
|
+
} else if (isDragDrop === false) {
|
|
667
|
+
editorType = 'ckEditor';
|
|
635
668
|
}
|
|
636
669
|
GA.timeTracker.stopTimer(isEdit ? TRACK_EDIT_EMAIL : TRACK_CREATE_EMAIL, {
|
|
637
670
|
category: 'Creatives',
|
|
@@ -650,14 +683,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
650
683
|
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
651
684
|
const type = this.props.location.query.type;
|
|
652
685
|
const isLanguageSupport = this.props.location.query.isLanguageSupport || false;
|
|
653
|
-
const
|
|
686
|
+
const isBEESupport = (this.props.location.query.isBEESupport !== "false") || false;
|
|
654
687
|
if (this.props.isFullMode) {
|
|
655
688
|
const {versions, ...rest} = createResponse.templateId;
|
|
656
689
|
this.props.getFormSubscriptionData({ value: versions, ...rest, validity: true});
|
|
657
690
|
} else {
|
|
658
691
|
this.props.router.push({
|
|
659
692
|
pathname: `/email`,
|
|
660
|
-
query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport,
|
|
693
|
+
query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isBEESupport} : {module, isLanguageSupport, isBEESupport},
|
|
661
694
|
});
|
|
662
695
|
}
|
|
663
696
|
}
|
|
@@ -675,6 +708,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
675
708
|
}
|
|
676
709
|
getValidationData = () => {
|
|
677
710
|
const that = this;
|
|
711
|
+
let id = _.get(this.props, 'Email.templateDetails._id', '') || _.get(this.props, 'Templates.BEETemplate._id', '');
|
|
712
|
+
if(!id){
|
|
713
|
+
id = _.get(formData,`base[${formData.base.activeTab}].id`,'')
|
|
714
|
+
}
|
|
678
715
|
const formData = _.cloneDeep(this.state.formData);
|
|
679
716
|
if (!this.props.Email.fetchingCmsData) {
|
|
680
717
|
// checking wheather getCmsData in progress or not cuz getValidationData gets called multiple times from handleEdmSave
|
|
@@ -682,7 +719,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
682
719
|
if (!isNaN(index)) {
|
|
683
720
|
_.forEach(val.selectedLanguages, (language) => {
|
|
684
721
|
if (val[language].is_drag_drop) {
|
|
685
|
-
that.props.actions.getCmsData('
|
|
722
|
+
that.props.actions.getCmsData('BEE', id, language);
|
|
686
723
|
}
|
|
687
724
|
});
|
|
688
725
|
}
|
|
@@ -747,7 +784,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
747
784
|
}
|
|
748
785
|
|
|
749
786
|
setEditData(editData) {
|
|
750
|
-
const
|
|
787
|
+
const isBEESupport = (this.props.location.query.isBEESupport !== "false") || false;
|
|
751
788
|
const formData = _.cloneDeep(this.state.formData);
|
|
752
789
|
|
|
753
790
|
const schema = (this.props.location.query.type === 'embedded') ? this.removeStandAlone(this.state.schema) : _.cloneDeep(this.state.schema);
|
|
@@ -890,7 +927,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
890
927
|
// formData.base.activeTab = language;
|
|
891
928
|
// }
|
|
892
929
|
if (language && editData.versions.base[language].is_drag_drop) {
|
|
893
|
-
this.props.actions.getCmsSetting('
|
|
930
|
+
this.props.actions.getCmsSetting('BEE', editData._id, 'open', language, isBEESupport);
|
|
894
931
|
}
|
|
895
932
|
});
|
|
896
933
|
|
|
@@ -907,7 +944,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
907
944
|
value: 'edit',
|
|
908
945
|
direction: e.value,
|
|
909
946
|
};
|
|
910
|
-
parent.postMessage(JSON.stringify(response), '*');
|
|
911
947
|
}
|
|
912
948
|
|
|
913
949
|
getEditorInstanse = () => {
|
|
@@ -987,16 +1023,18 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
987
1023
|
if (saveCount === 0) {
|
|
988
1024
|
//gets exicuted when ck editor is used
|
|
989
1025
|
this.startValidation(true);
|
|
990
|
-
return;
|
|
991
1026
|
}
|
|
992
1027
|
this.setState({targetSaveCount: saveCount, mode: "save", saveCount: 0, cmsDataCount: 0}, () => {
|
|
993
1028
|
const data = this.state.formData[this.state.currentTab - 1];
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1029
|
+
// will remove once bee gets tested end to end
|
|
1030
|
+
// _.forEach(data.selectedLanguages, (language, langIndex) => {
|
|
1031
|
+
// if (data[language].is_drag_drop) {
|
|
1032
|
+
// const win = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`).contentWindow;
|
|
1033
|
+
// win.postMessage("saveProject", '*');
|
|
1034
|
+
// }
|
|
1035
|
+
// if (data[language].is_drag_drop) {
|
|
1036
|
+
// }
|
|
1037
|
+
// });
|
|
1000
1038
|
});
|
|
1001
1039
|
});
|
|
1002
1040
|
}
|
|
@@ -1111,7 +1149,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1111
1149
|
const currentTab = this.state.currentTab - 1;
|
|
1112
1150
|
const baseLanguage = this.props.currentOrgDetails.basic_details.base_language ? this.props.currentOrgDetails.basic_details.base_language : 'en';
|
|
1113
1151
|
if (formData[currentTab][baseLanguage].is_drag_drop) {
|
|
1114
|
-
this.props.actions.getCmsSetting('
|
|
1152
|
+
this.props.actions.getCmsSetting('BEE', formData[currentTab][baseLanguage].drag_drop_id, 'duplicate', baseLanguage, isEdmSupport);
|
|
1115
1153
|
}
|
|
1116
1154
|
});
|
|
1117
1155
|
}
|
|
@@ -1240,7 +1278,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1240
1278
|
const languageObject = this.supportedLanguages[_.findIndex(this.supportedLanguages, {iso_code: baseLanguage})] || {iso_code: baseLanguage || 'en', lang_id: -1, language: baseLanguage || "English"};
|
|
1241
1279
|
baseData.activeTab = baseLanguage;
|
|
1242
1280
|
baseData[languageObject.iso_code] = {};
|
|
1243
|
-
baseData[languageObject.iso_code].is_drag_drop =
|
|
1281
|
+
baseData[languageObject.iso_code].is_drag_drop = undefined;
|
|
1244
1282
|
baseData[languageObject.iso_code].lang_id = languageObject.lang_id;
|
|
1245
1283
|
baseData[languageObject.iso_code].iso_code = languageObject.iso_code;
|
|
1246
1284
|
baseData[languageObject.iso_code].language = languageObject.language;
|
|
@@ -1270,12 +1308,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1270
1308
|
return;
|
|
1271
1309
|
}
|
|
1272
1310
|
tmpData.html_content = content['template-content'];
|
|
1311
|
+
tmpData.json_content = content['json-content'];
|
|
1273
1312
|
tmpData.is_drag_drop = content.is_drag_drop;
|
|
1274
1313
|
tmpData.lang_id = content.lang_id;
|
|
1275
1314
|
tmpData.iso_code = content.iso_code;
|
|
1276
1315
|
tmpData.language = content.language;
|
|
1277
1316
|
if (content.is_drag_drop) {
|
|
1278
|
-
tmpData.drag_drop_id = (content.drag_drop_id ? content.drag_drop_id : "");
|
|
1317
|
+
// tmpData.drag_drop_id = (content.drag_drop_id ? content.drag_drop_id : "");
|
|
1318
|
+
tmpData.id = content.id;
|
|
1279
1319
|
}
|
|
1280
1320
|
|
|
1281
1321
|
if (index === this.props.currentOrgDetails.basic_details.base_language) {
|
|
@@ -1313,9 +1353,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1313
1353
|
this.onImageSelect();
|
|
1314
1354
|
}
|
|
1315
1355
|
break;
|
|
1316
|
-
case "create":
|
|
1356
|
+
case "create": {
|
|
1317
1357
|
this.edmEvent = e;
|
|
1318
1358
|
break;
|
|
1359
|
+
}
|
|
1319
1360
|
case "select":
|
|
1320
1361
|
//this.edmEvent = e;
|
|
1321
1362
|
break;
|
|
@@ -1383,10 +1424,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1383
1424
|
}
|
|
1384
1425
|
});
|
|
1385
1426
|
} else if (this.state.mode === 'preview' || this.state.mode === 'switchEditor') {
|
|
1386
|
-
this.props.
|
|
1427
|
+
let id = _.get(this.props, 'Email.templateDetails._id', '') || _.get(this.props, 'Templates.BEETemplate._id', '');
|
|
1428
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
1429
|
+
if (!id) {
|
|
1430
|
+
id = _.get(formData, `base[${formData.base.activeTab}].id`, '');
|
|
1431
|
+
}
|
|
1432
|
+
this.props.actions.getCmsData('BEE', id);
|
|
1387
1433
|
if (this.state.mode === 'switchEditor') {
|
|
1388
1434
|
let schema = _.cloneDeep(this.state.schema);
|
|
1389
|
-
const formData = _.cloneDeep(this.state.formData);
|
|
1390
1435
|
_.forEach(schema.containers, (container, index) => {
|
|
1391
1436
|
if (parseInt(index, 10) === (this.state.currentTab - 1)) {
|
|
1392
1437
|
const temp = container;
|
|
@@ -1528,10 +1573,12 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1528
1573
|
toggleEmailPreview = () => {
|
|
1529
1574
|
const isDragDrop = this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop;
|
|
1530
1575
|
if (isDragDrop && !this.state.showEmailPreview) {
|
|
1531
|
-
|
|
1532
|
-
const
|
|
1533
|
-
const
|
|
1534
|
-
win.
|
|
1576
|
+
// will remove once bee gets tested end to end
|
|
1577
|
+
// const activeLangTab = this.state.formData[`${this.state.currentTab - 1}`].activeTab;
|
|
1578
|
+
// const langIndex = this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(activeLangTab);
|
|
1579
|
+
// const win = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`).contentWindow;
|
|
1580
|
+
// win && win.postMessage("saveProject", '*');
|
|
1581
|
+
this.handleEdmSave();
|
|
1535
1582
|
this.setState({mode: "preview", gettingPreviewData: true});
|
|
1536
1583
|
// this.setState({gettingPreviewData: true}, () => {
|
|
1537
1584
|
// this.props.actions.getCmsData('edm', this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].drag_drop_id);
|
|
@@ -1737,7 +1784,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1737
1784
|
schema.containers[`${this.state.currentTab - 1}`].panes.push(firstPane);
|
|
1738
1785
|
// schema.containers[0].tabContent.sections.push(tabContent);
|
|
1739
1786
|
}
|
|
1740
|
-
//this.props.templatesActions.
|
|
1787
|
+
//this.props.templatesActions.getDefaultBeeTemplates();
|
|
1741
1788
|
const container = schema.containers[this.state.currentTab - 1];
|
|
1742
1789
|
const temp = container;
|
|
1743
1790
|
if (this.state.addLanguageType === "upload") {
|
|
@@ -1838,7 +1885,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1838
1885
|
action: "showNext",
|
|
1839
1886
|
value: true,
|
|
1840
1887
|
};
|
|
1841
|
-
|
|
1888
|
+
// will remove once bee gets tested end to end
|
|
1889
|
+
// parent && parent.postMessage(JSON.stringify(response), '*');
|
|
1842
1890
|
}
|
|
1843
1891
|
|
|
1844
1892
|
moveToTemplates = () => {
|
|
@@ -1993,7 +2041,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1993
2041
|
const response = {
|
|
1994
2042
|
action: 'startTemplateCreation',
|
|
1995
2043
|
};
|
|
1996
|
-
parent.postMessage(JSON.stringify(response), '*');
|
|
2044
|
+
parent && parent.postMessage(JSON.stringify(response), '*');
|
|
1997
2045
|
}
|
|
1998
2046
|
});
|
|
1999
2047
|
return temp;
|
|
@@ -2086,6 +2134,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2086
2134
|
"iso_code": this.supportedLanguages[languageIndex].iso_code,
|
|
2087
2135
|
"language": this.supportedLanguages[languageIndex].language,
|
|
2088
2136
|
"template-content": !data.base.is_drag_drop && data.base.is_drag_drop !== 1 ? data.base.html_content : "",
|
|
2137
|
+
"json-content": data.base.json_content,
|
|
2138
|
+
"id": data.base.id,
|
|
2089
2139
|
};
|
|
2090
2140
|
const dragDropId = _.get(data, 'base.drag_drop_id');
|
|
2091
2141
|
if (dragDropId) {
|
|
@@ -2114,7 +2164,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2114
2164
|
};
|
|
2115
2165
|
if (templates.drag_drop_id) {
|
|
2116
2166
|
tempData.drag_drop_id = templates.drag_drop_id;
|
|
2117
|
-
this.props.actions.getCmsSetting('
|
|
2167
|
+
this.props.actions.getCmsSetting('BEE', tempData._id, 'open', tempData.iso_code, isEdmSupport);
|
|
2118
2168
|
}
|
|
2119
2169
|
// formData.usingTabContainer = true;
|
|
2120
2170
|
// formData.tabCount = 1;
|
|
@@ -2140,7 +2190,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2140
2190
|
// this.setState({tabKey: ''});
|
|
2141
2191
|
_.forEach(formData[0].selectedLanguages, (language) => {
|
|
2142
2192
|
if (formData[0][language].is_drag_drop) {
|
|
2143
|
-
this.props.actions.getCmsSetting('
|
|
2193
|
+
this.props.actions.getCmsSetting('BEE', formData[0][language].drag_drop_id, 'open', language, isEdmSupport);
|
|
2144
2194
|
}
|
|
2145
2195
|
});
|
|
2146
2196
|
});
|
|
@@ -2332,8 +2382,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2332
2382
|
}
|
|
2333
2383
|
|
|
2334
2384
|
saveFormData = (passedData) => {
|
|
2335
|
-
//saveFormData gets called only when validation result is true
|
|
2336
2385
|
|
|
2386
|
+
//saveFormData gets called only when validation result is true
|
|
2337
2387
|
if (this.state.gettingFormData && !this.props.isFullMode) {
|
|
2338
2388
|
const response = {
|
|
2339
2389
|
action: "getFormData",
|
|
@@ -2347,12 +2397,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2347
2397
|
if (this.props.location.query.module === 'library' && this.props.isGetFormData) {
|
|
2348
2398
|
this.props.getFormSubscriptionData(response);
|
|
2349
2399
|
}
|
|
2350
|
-
parent.postMessage(JSON.stringify(response), "*");
|
|
2400
|
+
// parent && parent.postMessage(JSON.stringify(response), "*");
|
|
2351
2401
|
this.setState({gettingFormData: false, startValidation: false, loading: true});
|
|
2352
2402
|
return;
|
|
2353
2403
|
}
|
|
2354
2404
|
const formData = _.cloneDeep(passedData);
|
|
2355
|
-
|
|
2405
|
+
const { currentTab } = _.cloneDeep(this.state);
|
|
2406
|
+
delete formData[currentTab - 1][formData[currentTab - 1].activeTab][`BEEeditor${currentTab > 1 ? currentTab : ''}json`];
|
|
2407
|
+
delete formData[currentTab - 1][formData[currentTab - 1].activeTab][`BEEeditor${currentTab > 1 ? currentTab : ''}token`];
|
|
2356
2408
|
const obj = {};
|
|
2357
2409
|
obj.versions = {
|
|
2358
2410
|
base: {},
|
|
@@ -2422,8 +2474,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2422
2474
|
const langIndex = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(activeLangTab);
|
|
2423
2475
|
|
|
2424
2476
|
this.setState({mode: "switchEditor"}, () => {
|
|
2425
|
-
|
|
2426
|
-
win.
|
|
2477
|
+
this.handleEdmSave();
|
|
2478
|
+
// const win = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`).contentWindow;
|
|
2479
|
+
// win && win.postMessage("saveProject", '*');
|
|
2427
2480
|
});
|
|
2428
2481
|
}
|
|
2429
2482
|
|
|
@@ -2465,7 +2518,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2465
2518
|
this.setState( (prevState) => ({
|
|
2466
2519
|
showEdmEmailTemplates: !prevState.showEdmEmailTemplates}), () => {
|
|
2467
2520
|
if (this.state.showEdmEmailTemplates) {
|
|
2468
|
-
this.props.templatesActions.
|
|
2521
|
+
this.props.templatesActions.getDefaultBeeTemplates();
|
|
2469
2522
|
}
|
|
2470
2523
|
});
|
|
2471
2524
|
};
|
|
@@ -2479,7 +2532,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2479
2532
|
// let getQuery = '';
|
|
2480
2533
|
const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
|
|
2481
2534
|
|
|
2482
|
-
this.props.actions.getCmsSetting('
|
|
2535
|
+
this.props.actions.getCmsSetting('BEE', data._id, 'create', this.state.formData[this.state.currentTab - 1].activeTab, isEdmSupport);
|
|
2483
2536
|
// this.props.templatesActions.setEdmTemplate(data);
|
|
2484
2537
|
this.toggleEdmEmailTemplateSelection();
|
|
2485
2538
|
// if (type && type.toLowerCase() === 'email') {
|
|
@@ -2495,7 +2548,22 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2495
2548
|
};
|
|
2496
2549
|
isEmailLoading = () => {
|
|
2497
2550
|
//let {isLoading} = this.props;
|
|
2498
|
-
|
|
2551
|
+
const { Email, isLoadingMetaEntities, setIsLoadingContent } = this.props;
|
|
2552
|
+
const {
|
|
2553
|
+
fetchingCmsData,
|
|
2554
|
+
getTemplateDetailsInProgress,
|
|
2555
|
+
assetUploading,
|
|
2556
|
+
createTemplateInProgress,
|
|
2557
|
+
} = this.props.Email;
|
|
2558
|
+
let isLoading =
|
|
2559
|
+
isLoadingMetaEntities ||
|
|
2560
|
+
this.state.loading || (
|
|
2561
|
+
Email && "createTemplateInProgress" in Email && createTemplateInProgress
|
|
2562
|
+
) || (
|
|
2563
|
+
assetUploading !== undefined && assetUploading
|
|
2564
|
+
) || (
|
|
2565
|
+
Email && (fetchingCmsData || getTemplateDetailsInProgress)
|
|
2566
|
+
);
|
|
2499
2567
|
|
|
2500
2568
|
if (!isLoading) {
|
|
2501
2569
|
isLoading = this.state.loadingStatus < 2;
|
|
@@ -2503,7 +2571,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2503
2571
|
// if (isLoading) {
|
|
2504
2572
|
// this.props.creativesContainerActions.hideCreativesContanerLoader();
|
|
2505
2573
|
// }
|
|
2506
|
-
if (!isLoading &&
|
|
2574
|
+
if (!isLoading && setIsLoadingContent) {
|
|
2507
2575
|
this.props.setIsLoadingContent(isLoading);
|
|
2508
2576
|
}
|
|
2509
2577
|
return isLoading;
|
|
@@ -2552,30 +2620,35 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2552
2620
|
</div>
|
|
2553
2621
|
</div>
|
|
2554
2622
|
);
|
|
2555
|
-
getImagePreviewContent = () =>
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
<
|
|
2559
|
-
{
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2623
|
+
getImagePreviewContent = () => {
|
|
2624
|
+
const { assetList = [], fetchingAllAssets, fetchAllAssetSuccess } = this.props.Email || {};
|
|
2625
|
+
return (
|
|
2626
|
+
<div key="creatives-email-add-image-container">
|
|
2627
|
+
{this.getFilterContent()}
|
|
2628
|
+
<Pagination onPageChange={() => { this.fetchAllAssets({getNextPage: true}); }} paginationSelector="pagination-container">
|
|
2629
|
+
{/* <CardGrid
|
|
2630
|
+
listItem={this.prepareImageData()}
|
|
2631
|
+
filterContent={filterContent}
|
|
2632
|
+
onHoverItem={this.handleOnHoverItem}
|
|
2633
|
+
onItemClick={this.handleOnItemClick}
|
|
2634
|
+
colNumber={2}
|
|
2635
|
+
enablePagination
|
|
2636
|
+
isLoading={}
|
|
2637
|
+
/> */}
|
|
2638
|
+
{(!fetchingAllAssets && (!fetchAllAssetSuccess || (fetchAllAssetSuccess && !assetList.length))) ? (
|
|
2639
|
+
<FormattedMessage {...messages.noImgInGallery}/>
|
|
2640
|
+
) : this.getTemplateDataForGrid({
|
|
2641
|
+
isLoading: fetchingAllAssets,
|
|
2642
|
+
loadingTip: <FormattedMessage {...messages.loadingImages}/>,
|
|
2643
|
+
channel: this.state.channel,
|
|
2644
|
+
templates: assetList,
|
|
2645
|
+
handlers: {onItemClick: this.handleOnItemClick}})
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
</Pagination>
|
|
2649
|
+
</div>
|
|
2650
|
+
);
|
|
2651
|
+
};
|
|
2579
2652
|
|
|
2580
2653
|
showTestAndPreviewIcons = (action) => {
|
|
2581
2654
|
const { formData = [] } = this.state;
|
|
@@ -2602,6 +2675,29 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2602
2675
|
</CapButton>
|
|
2603
2676
|
);
|
|
2604
2677
|
};
|
|
2678
|
+
saveBeeInstance = (instance) => {
|
|
2679
|
+
this.beeInstance = instance;
|
|
2680
|
+
}
|
|
2681
|
+
saveBeeData = (json, html) => {
|
|
2682
|
+
this.setState((prevState) => {
|
|
2683
|
+
const { currentTab, formData } = _.cloneDeep(prevState);
|
|
2684
|
+
const activeTab = formData[currentTab - 1].activeTab;
|
|
2685
|
+
formData[currentTab - 1][activeTab]['template-content'] = html;
|
|
2686
|
+
formData[currentTab - 1][activeTab]['json-content'] = json;
|
|
2687
|
+
|
|
2688
|
+
formData.base[activeTab]['template-content'] = html;
|
|
2689
|
+
formData.base[activeTab]['json-content'] = json;
|
|
2690
|
+
|
|
2691
|
+
return {
|
|
2692
|
+
...prevState,
|
|
2693
|
+
formData,
|
|
2694
|
+
};
|
|
2695
|
+
}, () => {
|
|
2696
|
+
this.setState({
|
|
2697
|
+
startValidation: true,
|
|
2698
|
+
});
|
|
2699
|
+
});
|
|
2700
|
+
}
|
|
2605
2701
|
|
|
2606
2702
|
render() {
|
|
2607
2703
|
// const pageHeading = (this.state.isEdit) ? this.props.intl.formatMessage(messages.editHeading) : this.props.intl.formatMessage(messages.createHeading);
|
|
@@ -2611,7 +2707,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2611
2707
|
const previewHeader = (<h3>{this.props.intl.formatMessage(messages.h3emailPreview)}</h3>);
|
|
2612
2708
|
const imagePreviewHeader = (<h3>{this.props.intl.formatMessage(messages.h3imageSelection)}</h3>);
|
|
2613
2709
|
const imagePreviewContent = this.getImagePreviewContent();
|
|
2614
|
-
const { selectedOfferDetails, getDefaultTags } = this.props;
|
|
2710
|
+
const { selectedOfferDetails, getDefaultTags, Email: { CmsSettings = {} } = {} } = this.props;
|
|
2615
2711
|
if (!this.props.currentOrgDetails || !this.props.currentOrgDetails.basic_details) {
|
|
2616
2712
|
return (<div>Loading...</div>);
|
|
2617
2713
|
}
|
|
@@ -2672,6 +2768,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2672
2768
|
saveForm={this.state.saveForm}
|
|
2673
2769
|
stopValidation={this.stopValidation}
|
|
2674
2770
|
selectedOfferDetails={selectedOfferDetails}
|
|
2771
|
+
saveBeeInstance={this.saveBeeInstance}
|
|
2772
|
+
saveBeeData={this.saveBeeData}
|
|
2773
|
+
uuid={CmsSettings.uuid}
|
|
2774
|
+
type={CmsSettings.type}
|
|
2775
|
+
isEmailLoading={isLoading}
|
|
2675
2776
|
/> : ''}
|
|
2676
2777
|
</Col>
|
|
2677
2778
|
</Row>
|
|
@@ -2690,8 +2791,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2690
2791
|
show={this.state.showImageSelectionBox}
|
|
2691
2792
|
handleClose={this.handleImagePreviewClose}
|
|
2692
2793
|
isLoading={this.props.Email.fetchingAllAssets}
|
|
2693
|
-
size="size-
|
|
2794
|
+
size="size-xl"
|
|
2694
2795
|
/>
|
|
2796
|
+
{/* <div id="bee-plugin-container" style={{ height: '600px'}}></div> */}
|
|
2695
2797
|
{this.state.showConfirmationModal && this.renderConfirmationModal()}
|
|
2696
2798
|
</div>
|
|
2697
2799
|
);
|