@capillarytech/creatives-library 6.9.1 → 6.9.5

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