@capillarytech/creatives-library 8.0.334 → 8.0.336

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 (47) hide show
  1. package/package.json +1 -1
  2. package/utils/tests/tagValidations.test.js +0 -20
  3. package/v2Components/CapTagList/index.js +23 -28
  4. package/v2Components/CapTagList/style.scss +0 -29
  5. package/v2Components/CapTagListWithInput/index.js +0 -4
  6. package/v2Components/CapWhatsappCTA/index.js +0 -2
  7. package/v2Components/FormBuilder/index.js +2 -7
  8. package/v2Components/HtmlEditor/HTMLEditor.js +1 -6
  9. package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +0 -1
  10. package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +2 -927
  11. package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +0 -3
  12. package/v2Containers/BeeEditor/index.js +16 -4
  13. package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -28
  14. package/v2Containers/CreativesContainer/index.js +0 -3
  15. package/v2Containers/Email/index.js +75 -39
  16. package/v2Containers/Email/reducer.js +2 -2
  17. package/v2Containers/Email/sagas.js +3 -1
  18. package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +2 -2
  19. package/v2Containers/Email/tests/sagas.test.js +230 -0
  20. package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +1 -6
  21. package/v2Containers/EmailWrapper/components/EmailWrapperView.js +0 -3
  22. package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +2 -20
  23. package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +1 -16
  24. package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +0 -4
  25. package/v2Containers/EmailWrapper/index.js +0 -4
  26. package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +0 -1
  27. package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +0 -9
  28. package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +0 -1
  29. package/v2Containers/MobilePush/Create/index.js +0 -2
  30. package/v2Containers/MobilePush/Edit/index.js +0 -2
  31. package/v2Containers/MobilepushWrapper/index.js +1 -3
  32. package/v2Containers/Rcs/index.js +0 -1
  33. package/v2Containers/Sms/Create/index.js +0 -2
  34. package/v2Containers/Sms/Edit/index.js +0 -2
  35. package/v2Containers/SmsTrai/Edit/index.js +0 -2
  36. package/v2Containers/SmsWrapper/index.js +0 -2
  37. package/v2Containers/TagList/index.js +5 -62
  38. package/v2Containers/TagList/messages.js +0 -4
  39. package/v2Containers/TagList/tests/TagList.test.js +20 -124
  40. package/v2Containers/TagList/tests/mockdata.js +0 -17
  41. package/v2Containers/Viber/index.js +0 -3
  42. package/v2Containers/WebPush/Create/hooks/useTagManagement.js +2 -0
  43. package/v2Containers/WebPush/Create/index.js +1 -9
  44. package/v2Containers/Whatsapp/index.js +0 -5
  45. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +0 -20
  46. package/v2Containers/Zalo/index.js +0 -2
  47. package/v2Components/CapTagListWithInput/__tests__/CapTagListWithInput.test.js +0 -63
@@ -59,7 +59,6 @@ const CodeEditorPaneComponent = ({
59
59
  injectedTags = {},
60
60
  location,
61
61
  eventContextTags = [],
62
- waitEventContextTags = {},
63
62
  selectedOfferDetails = [],
64
63
  channel,
65
64
  userLocale = 'en',
@@ -290,7 +289,6 @@ const CodeEditorPaneComponent = ({
290
289
  location={location}
291
290
  selectedOfferDetails={selectedOfferDetails}
292
291
  eventContextTags={eventContextTags}
293
- waitEventContextTags={waitEventContextTags}
294
292
  popoverPlacement="rightTop"
295
293
  />
296
294
  </CapRow>
@@ -329,7 +327,6 @@ CodeEditorPane.propTypes = {
329
327
  injectedTags: PropTypes.object,
330
328
  location: PropTypes.object,
331
329
  eventContextTags: PropTypes.array,
332
- waitEventContextTags: PropTypes.object,
333
330
  selectedOfferDetails: PropTypes.array,
334
331
  channel: PropTypes.string,
335
332
  userLocale: PropTypes.string,
@@ -53,12 +53,14 @@ function BeeEditor(props) {
53
53
  BEESelect,
54
54
  currentOrgDetails,
55
55
  eventContextTags,
56
- waitEventContextTags,
56
+ isGetBeeData,
57
+ getBEEData,
57
58
  } = props;
58
59
  const { saveRowRequest } = BEESelect;
59
60
  const {formatMessage} = intl;
60
61
  const UNSUBSCRIBE = 'unsubscribe';
61
62
  let beePluginInstance = null;
63
+ const isGetBeeDataRef = useRef(isGetBeeData);
62
64
  const categoryOptions = [{key: 'cta', value: 'cta', label: formatMessage(messages.cta)},
63
65
  {key: 'footer', value: 'footer', label: formatMessage(messages.footer)},
64
66
  {key: 'header', value: 'header', label: formatMessage(messages.header)},
@@ -112,6 +114,10 @@ function BeeEditor(props) {
112
114
  tokenDataRef.current = tokenData;
113
115
  }, [tokenData]);
114
116
 
117
+ useEffect(() => {
118
+ isGetBeeDataRef.current = isGetBeeData;
119
+ }, [isGetBeeData]);
120
+
115
121
  useEffect(() => {
116
122
  // Only initialize if we have both tokenData and beeJson
117
123
  const currentTokenData = tokenDataRef.current;
@@ -221,7 +227,13 @@ function BeeEditor(props) {
221
227
  },
222
228
  },
223
229
  onSave: (jsonFile, htmlFile) => {
224
- saveBeeData(jsonFile, htmlFile);
230
+ if (isGetBeeDataRef.current && typeof getBEEData === 'function') {
231
+ getBEEData(jsonFile, htmlFile);
232
+ return;
233
+ }
234
+ if (typeof saveBeeData === 'function') {
235
+ saveBeeData(jsonFile, htmlFile);
236
+ }
225
237
  },
226
238
  onSaveRow: (rowJSON) => {
227
239
  actions.createCustomRow(JSON.parse(rowJSON), callbackSaveRow);
@@ -369,7 +381,6 @@ function BeeEditor(props) {
369
381
  }}
370
382
  onContextChange={onContextChange}
371
383
  eventContextTags={eventContextTags}
372
- waitEventContextTags={waitEventContextTags}
373
384
  />
374
385
  <CapModal
375
386
  className="custom-row-modal"
@@ -416,7 +427,8 @@ BeeEditor.propTypes = {
416
427
  onContextChange: PropTypes.func,
417
428
  userLocale: PropTypes.string,
418
429
  eventContextTags: PropTypes.array,
419
- waitEventContextTags: PropTypes.object,
430
+ isGetBeeData: PropTypes.bool,
431
+ getBEEData: PropTypes.func,
420
432
  };
421
433
 
422
434
  const mapStateToProps = () => createStructuredSelector({
@@ -168,7 +168,6 @@ export function SlideBoxContent(props) {
168
168
  creativesMode,
169
169
  hostName = '',
170
170
  eventContextTags,
171
- waitEventContextTags = {},
172
171
  isLoyaltyModule,
173
172
  loyaltyMetaData = {},
174
173
  showTestAndPreviewSlidebox,
@@ -425,7 +424,6 @@ export function SlideBoxContent(props) {
425
424
  selectedOfferDetails,
426
425
  getFormData,
427
426
  eventContextTags,
428
- waitEventContextTags,
429
427
  };
430
428
 
431
429
  return (
@@ -460,7 +458,6 @@ export function SlideBoxContent(props) {
460
458
  enableNewChannels={enableNewChannels}
461
459
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
462
460
  eventContextTags={eventContextTags}
463
- waitEventContextTags={waitEventContextTags}
464
461
  loyaltyMetaData={loyaltyMetaData}
465
462
  isLoyaltyModule={isLoyaltyModule}
466
463
  />
@@ -564,7 +561,6 @@ export function SlideBoxContent(props) {
564
561
  onCreateComplete={onCreateComplete}
565
562
  smsRegister={smsRegister}
566
563
  eventContextTags={eventContextTags}
567
- waitEventContextTags={waitEventContextTags}
568
564
  getLiquidTags={getLiquidTags}
569
565
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
570
566
  handleTestAndPreview={handleTestAndPreview}
@@ -608,7 +604,6 @@ export function SlideBoxContent(props) {
608
604
  }}
609
605
  hostName={hostName}
610
606
  eventContextTags={eventContextTags}
611
- waitEventContextTags={waitEventContextTags}
612
607
  showLiquidErrorInFooter={showLiquidErrorInFooter}
613
608
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
614
609
  handleTestAndPreview={handleTestAndPreview}
@@ -649,7 +644,6 @@ export function SlideBoxContent(props) {
649
644
  eventContextTags={eventContextTags}
650
645
  restrictPersonalization={restrictPersonalization}
651
646
  isAnonymousType={isAnonymousType}
652
- waitEventContextTags={waitEventContextTags}
653
647
  />
654
648
  )}
655
649
 
@@ -683,7 +677,6 @@ export function SlideBoxContent(props) {
683
677
  moduleType={moduleType}
684
678
  showLiquidErrorInFooter={showLiquidErrorInFooter}
685
679
  eventContextTags={eventContextTags}
686
- waitEventContextTags={waitEventContextTags}
687
680
  isLoyaltyModule={isLoyaltyModule}
688
681
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
689
682
  handleTestAndPreview={handleTestAndPreview}
@@ -728,7 +721,6 @@ export function SlideBoxContent(props) {
728
721
  moduleType={moduleType}
729
722
  showLiquidErrorInFooter={showLiquidErrorInFooter}
730
723
  eventContextTags={eventContextTags}
731
- waitEventContextTags={waitEventContextTags}
732
724
  isLoyaltyModule={isLoyaltyModule}
733
725
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
734
726
  handleTestAndPreview={handleTestAndPreview}
@@ -768,7 +760,6 @@ export function SlideBoxContent(props) {
768
760
  moduleType={moduleType}
769
761
  showLiquidErrorInFooter={showLiquidErrorInFooter}
770
762
  eventContextTags={eventContextTags}
771
- waitEventContextTags={waitEventContextTags}
772
763
  isLoyaltyModule={isLoyaltyModule}
773
764
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
774
765
  handleTestAndPreview={handleTestAndPreview}
@@ -812,7 +803,6 @@ export function SlideBoxContent(props) {
812
803
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
813
804
  creativesMode={creativesMode}
814
805
  eventContextTags={eventContextTags}
815
- waitEventContextTags={waitEventContextTags}
816
806
  showLiquidErrorInFooter={showLiquidErrorInFooter}
817
807
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
818
808
  handleTestAndPreview={handleTestAndPreview}
@@ -845,7 +835,6 @@ export function SlideBoxContent(props) {
845
835
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
846
836
  creativesMode={creativesMode}
847
837
  eventContextTags={eventContextTags}
848
- waitEventContextTags={waitEventContextTags}
849
838
  showLiquidErrorInFooter={showLiquidErrorInFooter}
850
839
  handleClose={handleClose}
851
840
  restrictPersonalization={restrictPersonalization}
@@ -885,7 +874,6 @@ export function SlideBoxContent(props) {
885
874
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
886
875
  onTestContentClicked={onTestContentClicked}
887
876
  eventContextTags={eventContextTags}
888
- waitEventContextTags={waitEventContextTags}
889
877
  showLiquidErrorInFooter={showLiquidErrorInFooter}
890
878
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
891
879
  handleTestAndPreview={handleTestAndPreview}
@@ -924,7 +912,6 @@ export function SlideBoxContent(props) {
924
912
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
925
913
  onTestContentClicked={onTestContentClicked}
926
914
  eventContextTags={eventContextTags}
927
- waitEventContextTags={waitEventContextTags}
928
915
  showLiquidErrorInFooter={showLiquidErrorInFooter}
929
916
  onCreateComplete={onCreateComplete}
930
917
  creativesMode={creativesMode}
@@ -950,7 +937,6 @@ export function SlideBoxContent(props) {
950
937
  onSelectTemplate={onSelectTemplate}
951
938
  orgUnitId={orgUnitId}
952
939
  eventContextTags={eventContextTags}
953
- waitEventContextTags={waitEventContextTags}
954
940
  showLiquidErrorInFooter={showLiquidErrorInFooter}
955
941
  />
956
942
  )
@@ -972,7 +958,6 @@ export function SlideBoxContent(props) {
972
958
  fbAdManager={fbAdManager}
973
959
  onSelectTemplate={onSelectTemplate}
974
960
  eventContextTags={eventContextTags}
975
- waitEventContextTags={waitEventContextTags}
976
961
  showLiquidErrorInFooter={showLiquidErrorInFooter}
977
962
  />
978
963
  )
@@ -996,7 +981,6 @@ export function SlideBoxContent(props) {
996
981
  handleClose={handleClose}
997
982
  selectedOfferDetails={selectedOfferDetails}
998
983
  eventContextTags={eventContextTags}
999
- waitEventContextTags={waitEventContextTags}
1000
984
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1001
985
  />
1002
986
  )
@@ -1017,7 +1001,6 @@ export function SlideBoxContent(props) {
1017
1001
  handleClose={handleClose}
1018
1002
  selectedOfferDetails={selectedOfferDetails}
1019
1003
  eventContextTags={eventContextTags}
1020
- waitEventContextTags={waitEventContextTags}
1021
1004
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1022
1005
  />
1023
1006
  )
@@ -1034,7 +1017,6 @@ export function SlideBoxContent(props) {
1034
1017
  templateData={templateData}
1035
1018
  selectedOfferDetails={selectedOfferDetails}
1036
1019
  eventContextTags={eventContextTags}
1037
- waitEventContextTags={waitEventContextTags}
1038
1020
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1039
1021
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
1040
1022
  handleTestAndPreview={handleTestAndPreview}
@@ -1059,7 +1041,6 @@ export function SlideBoxContent(props) {
1059
1041
  handleTestAndPreview={handleTestAndPreview}
1060
1042
  handleCloseTestAndPreview={handleCloseTestAndPreview}
1061
1043
  eventContextTags={eventContextTags}
1062
- waitEventContextTags={waitEventContextTags}
1063
1044
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1064
1045
  createNew/> }
1065
1046
 
@@ -1067,7 +1048,6 @@ export function SlideBoxContent(props) {
1067
1048
  isFullMode={isFullMode}
1068
1049
  onCreateComplete={onCreateComplete}
1069
1050
  eventContextTags={eventContextTags}
1070
- waitEventContextTags={waitEventContextTags}
1071
1051
  handleClose={handleClose}
1072
1052
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1073
1053
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
@@ -1085,7 +1065,6 @@ export function SlideBoxContent(props) {
1085
1065
  forwardedTags={forwardedTags}
1086
1066
  selectedOfferDetails={selectedOfferDetails}
1087
1067
  eventContextTags={eventContextTags}
1088
- waitEventContextTags={waitEventContextTags}
1089
1068
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
1090
1069
  handleTestAndPreview={handleTestAndPreview}
1091
1070
  handleCloseTestAndPreview={handleCloseTestAndPreview}
@@ -1124,7 +1103,6 @@ export function SlideBoxContent(props) {
1124
1103
  onPreviewContentClicked={onPreviewContentClicked}
1125
1104
  onTestContentClicked={onTestContentClicked}
1126
1105
  eventContextTags={eventContextTags}
1127
- waitEventContextTags={waitEventContextTags}
1128
1106
  onCreateComplete={onCreateComplete}
1129
1107
  handleClose={handleClose}
1130
1108
  moduleType={moduleType}
@@ -1160,7 +1138,6 @@ export function SlideBoxContent(props) {
1160
1138
  moduleType={moduleType}
1161
1139
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1162
1140
  eventContextTags={eventContextTags}
1163
- waitEventContextTags={waitEventContextTags}
1164
1141
  onCreateComplete={onCreateComplete}
1165
1142
  handleClose={handleClose}
1166
1143
  getDefaultTags={type}
@@ -1184,7 +1161,6 @@ export function SlideBoxContent(props) {
1184
1161
  onCreateComplete={onCreateComplete}
1185
1162
  selectedOfferDetails={selectedOfferDetails}
1186
1163
  eventContextTags={eventContextTags}
1187
- waitEventContextTags={waitEventContextTags}
1188
1164
  params={{
1189
1165
  id: templateData._id,
1190
1166
  }}
@@ -1223,7 +1199,6 @@ export function SlideBoxContent(props) {
1223
1199
  eventContextTags={eventContextTags}
1224
1200
  restrictPersonalization={restrictPersonalization}
1225
1201
  isAnonymousType={isAnonymousType}
1226
- waitEventContextTags={waitEventContextTags}
1227
1202
  />
1228
1203
  )}
1229
1204
  {isCreateRcs && (<Rcs
@@ -1317,8 +1292,6 @@ SlideBoxContent.propTypes = {
1317
1292
  showTestAndPreviewSlidebox: PropTypes.bool,
1318
1293
  handleTestAndPreview: PropTypes.func,
1319
1294
  handleCloseTestAndPreview: PropTypes.func,
1320
- isTestAndPreviewMode: PropTypes.bool,
1321
- waitEventContextTags: PropTypes.object,
1322
- eventContextTags: PropTypes.array,
1295
+ isTestAndPreviewMode: PropTypes.bool
1323
1296
  };
1324
1297
  export default SlideBoxContent;
@@ -1949,7 +1949,6 @@ export class Creatives extends React.Component {
1949
1949
  smsRegister,
1950
1950
  enableNewChannels,
1951
1951
  eventContextTags,
1952
- waitEventContextTags = {},
1953
1952
  isLoyaltyModule,
1954
1953
  loyaltyMetaData = {},
1955
1954
  } = this.props;
@@ -2117,7 +2116,6 @@ export class Creatives extends React.Component {
2117
2116
  creativesMode={creativesMode} // An existing prop that we're using here. Required to ensure correct account details in Edit or Preview in case of Embedded mode.
2118
2117
  hostName={this.props?.hostName || ''}
2119
2118
  eventContextTags={eventContextTags}
2120
- waitEventContextTags={waitEventContextTags}
2121
2119
  isLoyaltyModule={isLoyaltyModule}
2122
2120
  loyaltyMetaData={loyaltyMetaData}
2123
2121
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
@@ -2210,7 +2208,6 @@ Creatives.propTypes = {
2210
2208
  orgUnitId: PropTypes.number,
2211
2209
  hostName: PropTypes.string,
2212
2210
  eventContextTags: PropTypes.array,
2213
- waitEventContextTags: PropTypes.object,
2214
2211
  loyaltyTagFetchingDependencies: PropTypes.object,
2215
2212
  customerType: PropTypes.string,
2216
2213
  intl: PropTypes.shape({
@@ -91,6 +91,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
91
91
  saveForm: false,
92
92
  showTestAndPreviewSlidebox: false,
93
93
  isTestAndPreviewMode: false, // Add flag to prevent validation during Test & Preview
94
+ isGetBeeData: false,
94
95
  };
95
96
 
96
97
  this.isTagLoaded = false;
@@ -509,6 +510,39 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
509
510
  const formData = _.cloneDeep(this.state.formData);
510
511
 
511
512
  const schema = _.cloneDeep(this.state.schema);
513
+
514
+ // Apply BEE/CK visibility synchronously into the schema before setState so that
515
+ // the committed state already has the correct display values — this prevents the
516
+ // race condition where hideEdmOptions (setTimeout) could be overwritten by a
517
+ // concurrent prop-triggered setState that clones the schema before it commits.
518
+ const isDragDropForHide = nextProps.Email.CmsSettings.isDragDrop && this.checkBeeEditorAllowedForLibrary();
519
+ _.forEach(schema.containers, (container) => {
520
+ if (container.isActive) {
521
+ _.forEach(container.tabBarExtraContent.sections[0].inputFields[0].cols, (col) => {
522
+ if (col.id === 'insert-image') {
523
+ col.style.display = isDragDropForHide ? 'none' : '';
524
+ }
525
+ if (col.id === 'tab-options-popover') {
526
+ col.colStyle.display = isDragDropForHide ? 'flex' : 'none';
527
+ _.forEach(col.content.sections[0].inputFields, (tabPopoverSection) => {
528
+ if (tabPopoverSection.cols[0].id === 'switch-editor-label') {
529
+ tabPopoverSection.cols[0].style.display = isDragDropForHide ? '' : 'none';
530
+ }
531
+ });
532
+ if (col.value && col.value.sections) {
533
+ _.forEach(col.value.sections[0].inputFields, (valueInputField) => {
534
+ _.forEach(valueInputField.cols, (valueCol) => {
535
+ if (valueCol.id === 'tab-option-icon') {
536
+ valueCol.colStyle = { ...valueCol.colStyle, display: hasSupportCKEditor() ? 'flex' : 'none' };
537
+ }
538
+ });
539
+ });
540
+ }
541
+ }
542
+ });
543
+ }
544
+ });
545
+
512
546
  const langIndex = formData[this.state.currentTab - 1]?.selectedLanguages?.indexOf(langId);
513
547
 
514
548
  const temp = (schema.containers || {})[this.state.currentTab - 1];
@@ -1957,7 +1991,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1957
1991
  }
1958
1992
 
1959
1993
  switchEditor = () => {
1960
- this.setState({showConfirmationModal: true});
1994
+ this.setState({showConfirmationModal: true, isGetBeeData: true});
1961
1995
  }
1962
1996
 
1963
1997
  renameVersion = () => {
@@ -2791,43 +2825,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2791
2825
  // }
2792
2826
  }
2793
2827
  handleOk = () => {
2794
- const formData = _.cloneDeep(this.state.formData);
2795
- const activeLangTab = formData[`${this.state.currentTab - 1}`].activeTab;
2796
- const langIndex = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(activeLangTab);
2797
-
2798
- // Store current content before switching
2799
- const currentContent = formData[`${this.state.currentTab - 1}`][activeLangTab]['template-content'];
2800
-
2801
- // Update formData to mark as not drag-drop
2802
- formData[`${this.state.currentTab - 1}`][activeLangTab].is_drag_drop = false;
2803
- if (formData[`${this.state.currentTab - 1}`].base) {
2804
- formData.base[activeLangTab].is_drag_drop = false;
2828
+ if (this.beeInstance) {
2829
+ this.beeInstance.save()
2805
2830
  }
2806
-
2807
- this.setState({
2808
- mode: "switchEditor",
2809
- formData
2810
- }, () => {
2811
- // No need to call handleEdmSave as we're switching to CKEditor
2812
- let schema = _.cloneDeep(this.state.schema);
2813
- _.forEach(schema.containers, (container, index) => {
2814
- if (parseInt(index, 10) === (this.state.currentTab - 1)) {
2815
- const temp = container;
2816
- const langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(activeLangTab);
2817
-
2818
- temp.panes[langTab].sections[0].inputFields[0].cols[0].colStyle = {display: ""};
2819
- temp.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = {display: "none"};
2820
- temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].colStyle.display = "none";
2821
- }
2822
- });
2823
- schema = this.showInsertImageButton(schema);
2824
-
2825
- this.setState({
2826
- schema,
2827
- showConfirmationModal: false,
2828
- isSchemaChanged: true
2829
- });
2830
- });
2831
2831
  }
2832
2832
 
2833
2833
  handleCancel = () => {
@@ -3034,6 +3034,42 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
3034
3034
  saveBeeInstance = (instance) => {
3035
3035
  this.beeInstance = instance;
3036
3036
  }
3037
+
3038
+ getBEEData = (json, html) => {
3039
+ this.setState((prevState) => {
3040
+ const formData = _.cloneDeep(prevState.formData);
3041
+ const activeLangTab = formData[`${prevState.currentTab - 1}`].activeTab;
3042
+
3043
+ // Mark as not drag-drop and capture BEE content in one pass
3044
+ formData[`${prevState.currentTab - 1}`][activeLangTab].is_drag_drop = false;
3045
+ formData[`${prevState.currentTab - 1}`][activeLangTab]['template-content'] = html;
3046
+ formData[`${prevState.currentTab - 1}`][activeLangTab]['json-content'] = json;
3047
+ formData.base[activeLangTab].is_drag_drop = false;
3048
+ formData.base[activeLangTab]['template-content'] = html;
3049
+ formData.base[activeLangTab]['json-content'] = json;
3050
+
3051
+ return { mode: "switchEditor", formData };
3052
+ }, () => {
3053
+ const { formData, currentTab } = this.state;
3054
+ const activeLangTab = formData[`${currentTab - 1}`].activeTab;
3055
+ let schema = _.cloneDeep(this.state.schema);
3056
+
3057
+ _.forEach(schema.containers, (container, index) => {
3058
+ if (parseInt(index, 10) === (currentTab - 1)) {
3059
+ const langTab = formData[`${currentTab - 1}`].selectedLanguages.indexOf(activeLangTab);
3060
+ container.panes[langTab].sections[0].inputFields[0].cols[0].colStyle = { display: "" };
3061
+ container.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = { display: "none" };
3062
+ container.tabBarExtraContent.sections[0].inputFields[0].cols[4].colStyle.display = "none";
3063
+ }
3064
+ });
3065
+
3066
+ schema = this.showInsertImageButton(schema);
3067
+ this.setState({ schema, showConfirmationModal: false, isSchemaChanged: true, isGetBeeData: false }, () => {
3068
+ this.injectEvents(schema);
3069
+ });
3070
+ });
3071
+ }
3072
+
3037
3073
  saveBeeData = (json, html) => {
3038
3074
  // Update state with new content
3039
3075
  this.setState((prevState) => {
@@ -3045,7 +3081,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
3045
3081
  formData[currentTab - 1][activeTab]['json-content'] = json;
3046
3082
  formData.base[activeTab]['template-content'] = html;
3047
3083
  formData.base[activeTab]['json-content'] = json;
3048
-
3049
3084
  return {
3050
3085
  ...prevState,
3051
3086
  formData,
@@ -3134,9 +3169,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
3134
3169
  moduleType={moduleType}
3135
3170
  showLiquidErrorInFooter={this.props.showLiquidErrorInFooter}
3136
3171
  eventContextTags={this.props?.eventContextTags}
3137
- waitEventContextTags={this.props?.waitEventContextTags}
3138
3172
  forwardedTags={this.props?.forwardedTags}
3139
3173
  isLoyaltyModule={this.props?.isLoyaltyModule}
3174
+ isGetBeeData={this.state.isGetBeeData}
3175
+ getBEEData={this.getBEEData}
3140
3176
  isTestAndPreviewMode={this.state.isTestAndPreviewMode} // Add flag to prevent validation
3141
3177
  /> : ''}
3142
3178
  </Col>
@@ -11,7 +11,7 @@ import * as types from './constants';
11
11
  const initialState = fromJS({
12
12
  createTemplateInProgress: false,
13
13
  createResponse: {},
14
- isBeeEnabled: false,
14
+ isBeeEnabled: null,
15
15
  });
16
16
 
17
17
  function emailReducer(state = initialState, action) {
@@ -150,7 +150,7 @@ function emailReducer(state = initialState, action) {
150
150
  .set('fetchingCmsData', false)
151
151
  .set('duplicateResponse', fromJS({}))
152
152
  .set('cmsData', '')
153
- .set('isBeeEnabled', false);
153
+ .set('isBeeEnabled', null);
154
154
  case types.TRANSFORM_EMAIL_TEMPLATE_REQUEST:
155
155
  return state.set("createTemplateInProgress", true);
156
156
  default:
@@ -107,7 +107,9 @@ export function* getCmsSetting({
107
107
  }) {
108
108
  try {
109
109
  const result = yield call(Api.getCmsTemplateSettingsV2, cmsType, projectId, cmsMode, langId, isEdmSupport, isBEEAppEnable);
110
-
110
+ const cmsAccountDetail = result.data?.response.cmsDetails || {};
111
+ const isBeeEnabled = cmsAccountDetail?.type === cmsType;
112
+ yield put({ type: types.GET_CMS_ACCOUNTS_SUCCESS, isBeeEnabled });
111
113
  yield put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: result.data.response.cmsDetails });
112
114
  } catch (error) {
113
115
  yield put({ type: types.GET_CMS_EDITOR_DETAILS_FAILURE, error });
@@ -4,7 +4,7 @@ exports[` 1`] = `
4
4
  Immutable.Map {
5
5
  "createTemplateInProgress": false,
6
6
  "createResponse": Immutable.Map {},
7
- "isBeeEnabled": false,
7
+ "isBeeEnabled": null,
8
8
  }
9
9
  `;
10
10
 
@@ -12,6 +12,6 @@ exports[` 2`] = `
12
12
  Immutable.Map {
13
13
  "createTemplateInProgress": true,
14
14
  "createResponse": Immutable.Map {},
15
- "isBeeEnabled": false,
15
+ "isBeeEnabled": null,
16
16
  }
17
17
  `;