@capillarytech/creatives-library 8.0.329 → 8.0.330-alpha.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.
Files changed (89) hide show
  1. package/constants/unified.js +4 -0
  2. package/package.json +1 -1
  3. package/utils/commonUtils.js +19 -1
  4. package/utils/templateVarUtils.js +35 -6
  5. package/utils/tests/tagValidations.test.js +20 -0
  6. package/utils/tests/templateVarUtils.test.js +44 -0
  7. package/v2Components/CapActionButton/constants.js +7 -0
  8. package/v2Components/CapActionButton/index.js +167 -109
  9. package/v2Components/CapActionButton/index.scss +157 -6
  10. package/v2Components/CapActionButton/messages.js +19 -3
  11. package/v2Components/CapActionButton/tests/index.test.js +41 -17
  12. package/v2Components/CapTagList/index.js +28 -23
  13. package/v2Components/CapTagList/style.scss +29 -0
  14. package/v2Components/CapTagListWithInput/__tests__/CapTagListWithInput.test.js +63 -0
  15. package/v2Components/CapTagListWithInput/index.js +4 -0
  16. package/v2Components/CapWhatsappCTA/index.js +2 -0
  17. package/v2Components/CommonTestAndPreview/ExistingCustomerModal.js +1 -0
  18. package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +160 -15
  19. package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js.rej +18 -0
  20. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +323 -77
  21. package/v2Components/CommonTestAndPreview/index.js +49 -57
  22. package/v2Components/CommonTestAndPreview/messages.js +8 -0
  23. package/v2Components/CommonTestAndPreview/reducer.js +3 -1
  24. package/v2Components/CommonTestAndPreview/sagas.js +2 -1
  25. package/v2Components/CommonTestAndPreview/tests/PreviewSection.test.js +8 -1
  26. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +281 -283
  27. package/v2Components/FormBuilder/index.js +1 -0
  28. package/v2Components/HtmlEditor/HTMLEditor.js +6 -1
  29. package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -0
  30. package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +927 -2
  31. package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +3 -0
  32. package/v2Components/SmsFallback/smsFallbackUtils.js +14 -3
  33. package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +16 -0
  34. package/v2Components/TemplatePreview/_templatePreview.scss +33 -23
  35. package/v2Components/TemplatePreview/constants.js +2 -0
  36. package/v2Components/TemplatePreview/index.js +143 -28
  37. package/v2Components/TemplatePreview/tests/index.test.js +142 -0
  38. package/v2Components/TestAndPreviewSlidebox/index.js +5 -0
  39. package/v2Components/mockdata.js +1 -0
  40. package/v2Containers/BeeEditor/index.js +19 -1
  41. package/v2Containers/CreativesContainer/SlideBoxContent.js +28 -1
  42. package/v2Containers/CreativesContainer/index.js +9 -3
  43. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +5 -0
  44. package/v2Containers/Email/index.js +78 -39
  45. package/v2Containers/Email/reducer.js +2 -2
  46. package/v2Containers/Email/sagas.js +3 -1
  47. package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +2 -2
  48. package/v2Containers/Email/tests/sagas.test.js +230 -0
  49. package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +6 -1
  50. package/v2Containers/EmailWrapper/components/EmailWrapperView.js +3 -0
  51. package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +20 -2
  52. package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +16 -1
  53. package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +3 -1
  54. package/v2Containers/EmailWrapper/index.js +4 -0
  55. package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +1 -0
  56. package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +9 -0
  57. package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +1 -0
  58. package/v2Containers/MobilePush/Create/index.js +2 -0
  59. package/v2Containers/MobilePush/Edit/index.js +2 -0
  60. package/v2Containers/MobilepushWrapper/index.js +3 -1
  61. package/v2Containers/Rcs/constants.js +85 -7
  62. package/v2Containers/Rcs/index.js +1592 -156
  63. package/v2Containers/Rcs/index.js.rej +1336 -0
  64. package/v2Containers/Rcs/index.scss +191 -0
  65. package/v2Containers/Rcs/index.scss.rej +74 -0
  66. package/v2Containers/Rcs/messages.js +28 -2
  67. package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +20 -0
  68. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +69178 -117691
  69. package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap.rej +128 -0
  70. package/v2Containers/Rcs/tests/index.test.js +132 -94
  71. package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +67 -0
  72. package/v2Containers/Rcs/tests/utils.test.js +276 -38
  73. package/v2Containers/Rcs/utils.js +130 -7
  74. package/v2Containers/Sms/Edit/index.js +2 -0
  75. package/v2Containers/SmsTrai/Edit/index.js +27 -0
  76. package/v2Containers/SmsTrai/Edit/messages.js +5 -0
  77. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +6 -6
  78. package/v2Containers/SmsWrapper/index.js +2 -0
  79. package/v2Containers/TagList/index.js +73 -20
  80. package/v2Containers/TagList/messages.js +4 -0
  81. package/v2Containers/TagList/tests/TagList.test.js +124 -20
  82. package/v2Containers/TagList/tests/mockdata.js +17 -0
  83. package/v2Containers/Templates/_templates.scss +99 -0
  84. package/v2Containers/Templates/index.js +29 -14
  85. package/v2Containers/Viber/index.js +3 -0
  86. package/v2Containers/WebPush/Create/hooks/useTagManagement.js +0 -2
  87. package/v2Containers/WebPush/Create/index.js +10 -2
  88. package/v2Containers/Whatsapp/index.js +5 -0
  89. package/v2Containers/Zalo/index.js +2 -0
@@ -53,11 +53,15 @@ function BeeEditor(props) {
53
53
  BEESelect,
54
54
  currentOrgDetails,
55
55
  eventContextTags,
56
+ waitEventContextTags,
57
+ isGetBeeData,
58
+ getBEEData,
56
59
  } = props;
57
60
  const { saveRowRequest } = BEESelect;
58
61
  const {formatMessage} = intl;
59
62
  const UNSUBSCRIBE = 'unsubscribe';
60
63
  let beePluginInstance = null;
64
+ const isGetBeeDataRef = useRef(isGetBeeData);
61
65
  const categoryOptions = [{key: 'cta', value: 'cta', label: formatMessage(messages.cta)},
62
66
  {key: 'footer', value: 'footer', label: formatMessage(messages.footer)},
63
67
  {key: 'header', value: 'header', label: formatMessage(messages.header)},
@@ -111,6 +115,10 @@ function BeeEditor(props) {
111
115
  tokenDataRef.current = tokenData;
112
116
  }, [tokenData]);
113
117
 
118
+ useEffect(() => {
119
+ isGetBeeDataRef.current = isGetBeeData;
120
+ }, [isGetBeeData]);
121
+
114
122
  useEffect(() => {
115
123
  // Only initialize if we have both tokenData and beeJson
116
124
  const currentTokenData = tokenDataRef.current;
@@ -220,7 +228,13 @@ function BeeEditor(props) {
220
228
  },
221
229
  },
222
230
  onSave: (jsonFile, htmlFile) => {
223
- saveBeeData(jsonFile, htmlFile);
231
+ if (isGetBeeDataRef.current && typeof getBEEData === 'function') {
232
+ getBEEData(jsonFile, htmlFile);
233
+ return;
234
+ }
235
+ if (typeof saveBeeData === 'function') {
236
+ saveBeeData(jsonFile, htmlFile);
237
+ }
224
238
  },
225
239
  onSaveRow: (rowJSON) => {
226
240
  actions.createCustomRow(JSON.parse(rowJSON), callbackSaveRow);
@@ -368,6 +382,7 @@ function BeeEditor(props) {
368
382
  }}
369
383
  onContextChange={onContextChange}
370
384
  eventContextTags={eventContextTags}
385
+ waitEventContextTags={waitEventContextTags}
371
386
  />
372
387
  <CapModal
373
388
  className="custom-row-modal"
@@ -414,6 +429,9 @@ BeeEditor.propTypes = {
414
429
  onContextChange: PropTypes.func,
415
430
  userLocale: PropTypes.string,
416
431
  eventContextTags: PropTypes.array,
432
+ waitEventContextTags: PropTypes.object,
433
+ isGetBeeData: PropTypes.bool,
434
+ getBEEData: PropTypes.func,
417
435
  };
418
436
 
419
437
  const mapStateToProps = () => createStructuredSelector({
@@ -170,6 +170,7 @@ export function SlideBoxContent(props) {
170
170
  creativesMode,
171
171
  hostName = '',
172
172
  eventContextTags,
173
+ waitEventContextTags = {},
173
174
  isLoyaltyModule,
174
175
  loyaltyMetaData = {},
175
176
  showTestAndPreviewSlidebox,
@@ -453,6 +454,7 @@ export function SlideBoxContent(props) {
453
454
  selectedOfferDetails,
454
455
  getFormData,
455
456
  eventContextTags,
457
+ waitEventContextTags,
456
458
  };
457
459
 
458
460
  return (
@@ -487,6 +489,7 @@ export function SlideBoxContent(props) {
487
489
  enableNewChannels={enableNewChannels}
488
490
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
489
491
  eventContextTags={eventContextTags}
492
+ waitEventContextTags={waitEventContextTags}
490
493
  loyaltyMetaData={loyaltyMetaData}
491
494
  isLoyaltyModule={isLoyaltyModule}
492
495
  localTemplatesConfig={localTemplatesConfig}
@@ -591,6 +594,7 @@ export function SlideBoxContent(props) {
591
594
  onCreateComplete={onCreateComplete}
592
595
  smsRegister={smsRegister}
593
596
  eventContextTags={eventContextTags}
597
+ waitEventContextTags={waitEventContextTags}
594
598
  getLiquidTags={getLiquidTags}
595
599
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
596
600
  handleTestAndPreview={handleTestAndPreview}
@@ -634,6 +638,7 @@ export function SlideBoxContent(props) {
634
638
  }}
635
639
  hostName={hostName}
636
640
  eventContextTags={eventContextTags}
641
+ waitEventContextTags={waitEventContextTags}
637
642
  showLiquidErrorInFooter={showLiquidErrorInFooter}
638
643
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
639
644
  handleTestAndPreview={handleTestAndPreview}
@@ -675,6 +680,7 @@ export function SlideBoxContent(props) {
675
680
  eventContextTags={eventContextTags}
676
681
  restrictPersonalization={restrictPersonalization}
677
682
  isAnonymousType={isAnonymousType}
683
+ waitEventContextTags={waitEventContextTags}
678
684
  />
679
685
  )}
680
686
 
@@ -708,6 +714,7 @@ export function SlideBoxContent(props) {
708
714
  moduleType={moduleType}
709
715
  showLiquidErrorInFooter={showLiquidErrorInFooter}
710
716
  eventContextTags={eventContextTags}
717
+ waitEventContextTags={waitEventContextTags}
711
718
  isLoyaltyModule={isLoyaltyModule}
712
719
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
713
720
  handleTestAndPreview={handleTestAndPreview}
@@ -752,6 +759,7 @@ export function SlideBoxContent(props) {
752
759
  moduleType={moduleType}
753
760
  showLiquidErrorInFooter={showLiquidErrorInFooter}
754
761
  eventContextTags={eventContextTags}
762
+ waitEventContextTags={waitEventContextTags}
755
763
  isLoyaltyModule={isLoyaltyModule}
756
764
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
757
765
  handleTestAndPreview={handleTestAndPreview}
@@ -791,6 +799,7 @@ export function SlideBoxContent(props) {
791
799
  moduleType={moduleType}
792
800
  showLiquidErrorInFooter={showLiquidErrorInFooter}
793
801
  eventContextTags={eventContextTags}
802
+ waitEventContextTags={waitEventContextTags}
794
803
  isLoyaltyModule={isLoyaltyModule}
795
804
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
796
805
  handleTestAndPreview={handleTestAndPreview}
@@ -834,6 +843,7 @@ export function SlideBoxContent(props) {
834
843
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
835
844
  creativesMode={creativesMode}
836
845
  eventContextTags={eventContextTags}
846
+ waitEventContextTags={waitEventContextTags}
837
847
  showLiquidErrorInFooter={showLiquidErrorInFooter}
838
848
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
839
849
  handleTestAndPreview={handleTestAndPreview}
@@ -866,6 +876,7 @@ export function SlideBoxContent(props) {
866
876
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
867
877
  creativesMode={creativesMode}
868
878
  eventContextTags={eventContextTags}
879
+ waitEventContextTags={waitEventContextTags}
869
880
  showLiquidErrorInFooter={showLiquidErrorInFooter}
870
881
  handleClose={handleClose}
871
882
  restrictPersonalization={restrictPersonalization}
@@ -905,6 +916,7 @@ export function SlideBoxContent(props) {
905
916
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
906
917
  onTestContentClicked={onTestContentClicked}
907
918
  eventContextTags={eventContextTags}
919
+ waitEventContextTags={waitEventContextTags}
908
920
  showLiquidErrorInFooter={showLiquidErrorInFooter}
909
921
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
910
922
  handleTestAndPreview={handleTestAndPreview}
@@ -943,6 +955,7 @@ export function SlideBoxContent(props) {
943
955
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
944
956
  onTestContentClicked={onTestContentClicked}
945
957
  eventContextTags={eventContextTags}
958
+ waitEventContextTags={waitEventContextTags}
946
959
  showLiquidErrorInFooter={showLiquidErrorInFooter}
947
960
  onCreateComplete={onCreateComplete}
948
961
  creativesMode={creativesMode}
@@ -968,6 +981,7 @@ export function SlideBoxContent(props) {
968
981
  onSelectTemplate={onSelectTemplate}
969
982
  orgUnitId={orgUnitId}
970
983
  eventContextTags={eventContextTags}
984
+ waitEventContextTags={waitEventContextTags}
971
985
  showLiquidErrorInFooter={showLiquidErrorInFooter}
972
986
  />
973
987
  )
@@ -989,6 +1003,7 @@ export function SlideBoxContent(props) {
989
1003
  fbAdManager={fbAdManager}
990
1004
  onSelectTemplate={onSelectTemplate}
991
1005
  eventContextTags={eventContextTags}
1006
+ waitEventContextTags={waitEventContextTags}
992
1007
  showLiquidErrorInFooter={showLiquidErrorInFooter}
993
1008
  />
994
1009
  )
@@ -1012,6 +1027,7 @@ export function SlideBoxContent(props) {
1012
1027
  handleClose={handleClose}
1013
1028
  selectedOfferDetails={selectedOfferDetails}
1014
1029
  eventContextTags={eventContextTags}
1030
+ waitEventContextTags={waitEventContextTags}
1015
1031
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1016
1032
  />
1017
1033
  )
@@ -1032,6 +1048,7 @@ export function SlideBoxContent(props) {
1032
1048
  handleClose={handleClose}
1033
1049
  selectedOfferDetails={selectedOfferDetails}
1034
1050
  eventContextTags={eventContextTags}
1051
+ waitEventContextTags={waitEventContextTags}
1035
1052
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1036
1053
  />
1037
1054
  )
@@ -1048,6 +1065,7 @@ export function SlideBoxContent(props) {
1048
1065
  templateData={templateData}
1049
1066
  selectedOfferDetails={selectedOfferDetails}
1050
1067
  eventContextTags={eventContextTags}
1068
+ waitEventContextTags={waitEventContextTags}
1051
1069
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1052
1070
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
1053
1071
  handleTestAndPreview={handleTestAndPreview}
@@ -1072,6 +1090,7 @@ export function SlideBoxContent(props) {
1072
1090
  handleTestAndPreview={handleTestAndPreview}
1073
1091
  handleCloseTestAndPreview={handleCloseTestAndPreview}
1074
1092
  eventContextTags={eventContextTags}
1093
+ waitEventContextTags={waitEventContextTags}
1075
1094
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1076
1095
  createNew/> }
1077
1096
 
@@ -1079,6 +1098,7 @@ export function SlideBoxContent(props) {
1079
1098
  isFullMode={isFullMode}
1080
1099
  onCreateComplete={onCreateComplete}
1081
1100
  eventContextTags={eventContextTags}
1101
+ waitEventContextTags={waitEventContextTags}
1082
1102
  handleClose={handleClose}
1083
1103
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1084
1104
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
@@ -1096,6 +1116,7 @@ export function SlideBoxContent(props) {
1096
1116
  forwardedTags={forwardedTags}
1097
1117
  selectedOfferDetails={selectedOfferDetails}
1098
1118
  eventContextTags={eventContextTags}
1119
+ waitEventContextTags={waitEventContextTags}
1099
1120
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
1100
1121
  handleTestAndPreview={handleTestAndPreview}
1101
1122
  handleCloseTestAndPreview={handleCloseTestAndPreview}
@@ -1134,6 +1155,7 @@ export function SlideBoxContent(props) {
1134
1155
  onPreviewContentClicked={onPreviewContentClicked}
1135
1156
  onTestContentClicked={onTestContentClicked}
1136
1157
  eventContextTags={eventContextTags}
1158
+ waitEventContextTags={waitEventContextTags}
1137
1159
  onCreateComplete={onCreateComplete}
1138
1160
  handleClose={handleClose}
1139
1161
  moduleType={moduleType}
@@ -1169,6 +1191,7 @@ export function SlideBoxContent(props) {
1169
1191
  moduleType={moduleType}
1170
1192
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1171
1193
  eventContextTags={eventContextTags}
1194
+ waitEventContextTags={waitEventContextTags}
1172
1195
  onCreateComplete={onCreateComplete}
1173
1196
  handleClose={handleClose}
1174
1197
  getDefaultTags={type}
@@ -1192,6 +1215,7 @@ export function SlideBoxContent(props) {
1192
1215
  onCreateComplete={onCreateComplete}
1193
1216
  selectedOfferDetails={selectedOfferDetails}
1194
1217
  eventContextTags={eventContextTags}
1218
+ waitEventContextTags={waitEventContextTags}
1195
1219
  params={{
1196
1220
  id: templateData._id,
1197
1221
  }}
@@ -1230,6 +1254,7 @@ export function SlideBoxContent(props) {
1230
1254
  eventContextTags={eventContextTags}
1231
1255
  restrictPersonalization={restrictPersonalization}
1232
1256
  isAnonymousType={isAnonymousType}
1257
+ waitEventContextTags={waitEventContextTags}
1233
1258
  />
1234
1259
  )}
1235
1260
  {isCreateRcs && (<Rcs
@@ -1324,6 +1349,8 @@ SlideBoxContent.propTypes = {
1324
1349
  showTestAndPreviewSlidebox: PropTypes.bool,
1325
1350
  handleTestAndPreview: PropTypes.func,
1326
1351
  handleCloseTestAndPreview: PropTypes.func,
1327
- isTestAndPreviewMode: PropTypes.bool
1352
+ isTestAndPreviewMode: PropTypes.bool,
1353
+ waitEventContextTags: PropTypes.object,
1354
+ eventContextTags: PropTypes.array,
1328
1355
  };
1329
1356
  export default SlideBoxContent;
@@ -43,6 +43,7 @@ import {EXTERNAL_URL, SITE_URL, WEBPUSH_MEDIA_TYPES} from '../WebPush/constants'
43
43
  import { IMAGE, VIDEO } from '../Facebook/Advertisement/constant';
44
44
  import { RCS_STATUSES } from '../Rcs/constants';
45
45
  import { mapRcsCardContentForConsumerWithResolvedTags } from '../Rcs/utils';
46
+ import { pickRcsCardVarMappedEntries } from '../Rcs/rcsLibraryHydrationUtils';
46
47
  import { RCS_SMS_FALLBACK_VAR_MAPPED_PROP } from '../../v2Components/CommonTestAndPreview/constants';
47
48
  import { CREATIVE } from '../Facebook/constants';
48
49
  import { LOYALTY } from '../App/constants';
@@ -764,8 +765,13 @@ export class Creatives extends React.Component {
764
765
  rootMirrorCardVarMapped != null && typeof rootMirrorCardVarMapped === 'object'
765
766
  ? rootMirrorCardVarMapped
766
767
  : {};
767
- const mergedFromRootAndNested = { ...rootRecord, ...nestedRecord };
768
- return Object.keys(mergedFromRootAndNested).length > 0 ? mergedFromRootAndNested : null;
768
+ const mergedFromRootAndNested = {
769
+ ...pickRcsCardVarMappedEntries(rootRecord),
770
+ ...pickRcsCardVarMappedEntries(nestedRecord),
771
+ };
772
+ return Object.keys(mergedFromRootAndNested).length > 0
773
+ ? mergedFromRootAndNested
774
+ : null;
769
775
  })();
770
776
  // Campaigns (embedded): do not duplicate `cardVarMapped` as root `rcsCardVarMapped` on send —
771
777
  // slot map stays on `versions…cardContent[0].cardVarMapped` only. Library full mode keeps root mirror.
@@ -1348,7 +1354,7 @@ export class Creatives extends React.Component {
1348
1354
  const cardVarMappedFromFirstRcsCard =
1349
1355
  firstCardFromSubmit?.cardVarMapped != null
1350
1356
  && typeof firstCardFromSubmit.cardVarMapped === 'object'
1351
- ? firstCardFromSubmit.cardVarMapped
1357
+ ? pickRcsCardVarMappedEntries(firstCardFromSubmit.cardVarMapped)
1352
1358
  : null;
1353
1359
  const includeRootRcsCardVarMappedOnConsumerPayload =
1354
1360
  cardVarMappedFromFirstRcsCard
@@ -64,6 +64,7 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
64
64
  }
65
65
  }
66
66
  templateStep="modeSelection"
67
+ waitEventContextTags={Object {}}
67
68
  weChatMaptemplateStep={0}
68
69
  weChatTemplateType=""
69
70
  />
@@ -162,6 +163,7 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
162
163
  }
163
164
  }
164
165
  templateStep="modeSelection"
166
+ waitEventContextTags={Object {}}
165
167
  weChatMaptemplateStep={0}
166
168
  weChatTemplateType=""
167
169
  />
@@ -255,6 +257,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
255
257
  showTestAndPreviewSlidebox={false}
256
258
  slidBoxContent="editTemplate"
257
259
  templateStep="modeSelection"
260
+ waitEventContextTags={Object {}}
258
261
  weChatMaptemplateStep={0}
259
262
  weChatTemplateType=""
260
263
  />
@@ -395,6 +398,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
395
398
  showTestAndPreviewSlidebox={false}
396
399
  slidBoxContent="editTemplate"
397
400
  templateStep="modeSelection"
401
+ waitEventContextTags={Object {}}
398
402
  weChatMaptemplateStep={0}
399
403
  weChatTemplateType=""
400
404
  />
@@ -535,6 +539,7 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
535
539
  showTestAndPreviewSlidebox={false}
536
540
  slidBoxContent="editTemplate"
537
541
  templateStep="modeSelection"
542
+ waitEventContextTags={Object {}}
538
543
  weChatMaptemplateStep={0}
539
544
  weChatTemplateType=""
540
545
  />
@@ -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];
@@ -1345,6 +1379,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1345
1379
  saveObj: {},
1346
1380
  showEdmEmailTemplates: false,
1347
1381
  editDataSet: false,
1382
+ isGetBeeData: false,
1348
1383
  }, () => {
1349
1384
 
1350
1385
  });
@@ -1957,7 +1992,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1957
1992
  }
1958
1993
 
1959
1994
  switchEditor = () => {
1960
- this.setState({showConfirmationModal: true});
1995
+ this.setState({showConfirmationModal: true, isGetBeeData: true});
1961
1996
  }
1962
1997
 
1963
1998
  renameVersion = () => {
@@ -2791,47 +2826,13 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2791
2826
  // }
2792
2827
  }
2793
2828
  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;
2829
+ if (this.beeInstance) {
2830
+ this.beeInstance.save()
2805
2831
  }
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
2832
  }
2832
2833
 
2833
2834
  handleCancel = () => {
2834
- this.setState({ showConfirmationModal: false });
2835
+ this.setState({ showConfirmationModal: false, editDataSet: false, isGetBeeData: false });
2835
2836
  }
2836
2837
 
2837
2838
  handleCancelModal = () => {
@@ -3034,6 +3035,42 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
3034
3035
  saveBeeInstance = (instance) => {
3035
3036
  this.beeInstance = instance;
3036
3037
  }
3038
+
3039
+ getBEEData = (json, html) => {
3040
+ this.setState((prevState) => {
3041
+ const formData = _.cloneDeep(prevState.formData);
3042
+ const activeLangTab = formData[`${prevState.currentTab - 1}`].activeTab;
3043
+
3044
+ // Mark as not drag-drop and capture BEE content in one pass
3045
+ formData[`${prevState.currentTab - 1}`][activeLangTab].is_drag_drop = false;
3046
+ formData[`${prevState.currentTab - 1}`][activeLangTab]['template-content'] = html;
3047
+ formData[`${prevState.currentTab - 1}`][activeLangTab]['json-content'] = json;
3048
+ formData.base[activeLangTab].is_drag_drop = false;
3049
+ formData.base[activeLangTab]['template-content'] = html;
3050
+ formData.base[activeLangTab]['json-content'] = json;
3051
+
3052
+ return { mode: "switchEditor", formData };
3053
+ }, () => {
3054
+ const { formData, currentTab } = this.state;
3055
+ const activeLangTab = formData[`${currentTab - 1}`].activeTab;
3056
+ let schema = _.cloneDeep(this.state.schema);
3057
+
3058
+ _.forEach(schema.containers, (container, index) => {
3059
+ if (parseInt(index, 10) === (currentTab - 1)) {
3060
+ const langTab = formData[`${currentTab - 1}`].selectedLanguages.indexOf(activeLangTab);
3061
+ container.panes[langTab].sections[0].inputFields[0].cols[0].colStyle = { display: "" };
3062
+ container.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = { display: "none" };
3063
+ container.tabBarExtraContent.sections[0].inputFields[0].cols[4].colStyle.display = "none";
3064
+ }
3065
+ });
3066
+
3067
+ schema = this.showInsertImageButton(schema);
3068
+ this.setState({ schema, showConfirmationModal: false, isSchemaChanged: true, isGetBeeData: false }, () => {
3069
+ this.injectEvents(schema);
3070
+ });
3071
+ });
3072
+ }
3073
+
3037
3074
  saveBeeData = (json, html) => {
3038
3075
  // Update state with new content
3039
3076
  this.setState((prevState) => {
@@ -3045,7 +3082,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
3045
3082
  formData[currentTab - 1][activeTab]['json-content'] = json;
3046
3083
  formData.base[activeTab]['template-content'] = html;
3047
3084
  formData.base[activeTab]['json-content'] = json;
3048
-
3049
3085
  return {
3050
3086
  ...prevState,
3051
3087
  formData,
@@ -3134,8 +3170,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
3134
3170
  moduleType={moduleType}
3135
3171
  showLiquidErrorInFooter={this.props.showLiquidErrorInFooter}
3136
3172
  eventContextTags={this.props?.eventContextTags}
3173
+ waitEventContextTags={this.props?.waitEventContextTags}
3137
3174
  forwardedTags={this.props?.forwardedTags}
3138
3175
  isLoyaltyModule={this.props?.isLoyaltyModule}
3176
+ isGetBeeData={this.state.isGetBeeData}
3177
+ getBEEData={this.getBEEData}
3139
3178
  isTestAndPreviewMode={this.state.isTestAndPreviewMode} // Add flag to prevent validation
3140
3179
  /> : ''}
3141
3180
  </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
  `;