@capillarytech/creatives-library 8.0.242-alpha.1 → 8.0.242-alpha.11

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 (255) hide show
  1. package/assets/Android.png +0 -0
  2. package/assets/iOS.png +0 -0
  3. package/config/app.js +1 -1
  4. package/constants/unified.js +2 -2
  5. package/initialReducer.js +0 -2
  6. package/package.json +1 -1
  7. package/services/api.js +5 -10
  8. package/services/tests/api.test.js +0 -18
  9. package/translations/en.json +4 -3
  10. package/utils/common.js +6 -5
  11. package/utils/commonUtils.js +1 -14
  12. package/utils/imageUrlUpload.js +141 -0
  13. package/utils/tests/commonUtil.test.js +0 -224
  14. package/utils/transformTemplateConfig.js +10 -0
  15. package/v2Components/CapDeviceContent/index.js +56 -61
  16. package/v2Components/CapImageUpload/constants.js +2 -0
  17. package/v2Components/CapImageUpload/index.js +65 -16
  18. package/v2Components/CapImageUpload/index.scss +4 -1
  19. package/v2Components/CapImageUpload/messages.js +5 -1
  20. package/v2Components/CapImageUrlUpload/constants.js +26 -0
  21. package/v2Components/CapImageUrlUpload/index.js +365 -0
  22. package/v2Components/CapImageUrlUpload/index.scss +35 -0
  23. package/v2Components/CapImageUrlUpload/messages.js +47 -0
  24. package/v2Components/CapTagList/index.js +1 -6
  25. package/v2Components/CapTagListWithInput/index.js +1 -5
  26. package/v2Components/CapTagListWithInput/messages.js +1 -1
  27. package/v2Components/CapWhatsappCTA/tests/index.test.js +0 -5
  28. package/v2Components/ErrorInfoNote/index.js +72 -412
  29. package/v2Components/ErrorInfoNote/messages.js +0 -22
  30. package/v2Components/ErrorInfoNote/style.scss +2 -279
  31. package/v2Components/HtmlEditor/HTMLEditor.js +89 -210
  32. package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +133 -1132
  33. package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +12 -17
  34. package/v2Components/HtmlEditor/_htmlEditor.scss +23 -8
  35. package/v2Components/HtmlEditor/_index.lazy.scss +1 -1
  36. package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +101 -13
  37. package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +139 -148
  38. package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +1 -2
  39. package/v2Components/HtmlEditor/components/DeviceToggle/index.js +3 -3
  40. package/v2Components/HtmlEditor/components/EditorToolbar/index.js +1 -1
  41. package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +0 -1
  42. package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +7 -4
  43. package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +45 -35
  44. package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +3 -1
  45. package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +33 -33
  46. package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +6 -7
  47. package/v2Components/HtmlEditor/components/PreviewPane/_previewPane.scss +6 -3
  48. package/v2Components/HtmlEditor/components/PreviewPane/index.js +11 -10
  49. package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +1 -1
  50. package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +62 -87
  51. package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +31 -49
  52. package/v2Components/HtmlEditor/constants.js +20 -29
  53. package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +16 -373
  54. package/v2Components/HtmlEditor/hooks/useEditorContent.js +2 -5
  55. package/v2Components/HtmlEditor/hooks/useInAppContent.js +146 -88
  56. package/v2Components/HtmlEditor/index.js +1 -1
  57. package/v2Components/HtmlEditor/messages.js +85 -95
  58. package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +101 -99
  59. package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +25 -23
  60. package/v2Components/HtmlEditor/utils/validationAdapter.js +41 -34
  61. package/v2Components/MobilePushPreviewV2/index.js +7 -32
  62. package/v2Components/TemplatePreview/_templatePreview.scss +24 -44
  63. package/v2Components/TemplatePreview/index.js +32 -47
  64. package/v2Components/TemplatePreview/messages.js +0 -4
  65. package/v2Components/TestAndPreviewSlidebox/index.js +25 -31
  66. package/v2Containers/App/constants.js +5 -0
  67. package/v2Containers/BeeEditor/index.js +80 -82
  68. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +4 -3
  69. package/v2Containers/CreativesContainer/SlideBoxContent.js +118 -148
  70. package/v2Containers/CreativesContainer/SlideBoxFooter.js +3 -9
  71. package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -2
  72. package/v2Containers/CreativesContainer/constants.js +2 -1
  73. package/v2Containers/CreativesContainer/index.js +41 -173
  74. package/v2Containers/CreativesContainer/messages.js +4 -4
  75. package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +210 -0
  76. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +354 -38
  77. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +0 -36
  78. package/v2Containers/Email/actions.js +0 -7
  79. package/v2Containers/Email/constants.js +1 -5
  80. package/v2Containers/Email/index.js +0 -13
  81. package/v2Containers/Email/messages.js +0 -32
  82. package/v2Containers/Email/reducer.js +1 -12
  83. package/v2Containers/Email/sagas.js +6 -41
  84. package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +0 -2
  85. package/v2Containers/EmailWrapper/components/EmailWrapperView.js +7 -193
  86. package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +74 -40
  87. package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +67 -2
  88. package/v2Containers/EmailWrapper/constants.js +0 -2
  89. package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +67 -436
  90. package/v2Containers/EmailWrapper/index.js +23 -99
  91. package/v2Containers/EmailWrapper/messages.js +1 -61
  92. package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +1 -26
  93. package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +77 -111
  94. package/v2Containers/InApp/actions.js +0 -7
  95. package/v2Containers/InApp/constants.js +4 -20
  96. package/v2Containers/InApp/index.js +357 -800
  97. package/v2Containers/InApp/index.scss +3 -4
  98. package/v2Containers/InApp/messages.js +3 -7
  99. package/v2Containers/InApp/reducer.js +3 -21
  100. package/v2Containers/InApp/sagas.js +9 -29
  101. package/v2Containers/InApp/selectors.js +5 -25
  102. package/v2Containers/InApp/tests/index.test.js +50 -154
  103. package/v2Containers/InApp/tests/reducer.test.js +0 -34
  104. package/v2Containers/InApp/tests/sagas.test.js +9 -61
  105. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +12 -12
  106. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +8 -8
  107. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +100 -77
  108. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +72 -63
  109. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +184 -150
  110. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +16 -12
  111. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +32 -28
  112. package/v2Containers/TagList/index.js +1 -67
  113. package/v2Containers/Templates/ChannelTypeIllustration.js +13 -1
  114. package/v2Containers/Templates/_templates.scss +202 -56
  115. package/v2Containers/Templates/actions.js +2 -1
  116. package/v2Containers/Templates/constants.js +1 -0
  117. package/v2Containers/Templates/index.js +278 -128
  118. package/v2Containers/Templates/messages.js +24 -4
  119. package/v2Containers/Templates/reducer.js +2 -0
  120. package/v2Containers/Templates/tests/index.test.js +10 -0
  121. package/v2Containers/TemplatesV2/index.js +8 -1
  122. package/v2Containers/TemplatesV2/messages.js +4 -0
  123. package/v2Containers/WebPush/Create/components/BrandIconSection.js +108 -0
  124. package/v2Containers/WebPush/Create/components/ButtonForm.js +172 -0
  125. package/v2Containers/WebPush/Create/components/ButtonItem.js +101 -0
  126. package/v2Containers/WebPush/Create/components/ButtonList.js +145 -0
  127. package/v2Containers/WebPush/Create/components/ButtonsLinksSection.js +164 -0
  128. package/v2Containers/WebPush/Create/components/ButtonsLinksSection.test.js +463 -0
  129. package/v2Containers/WebPush/Create/components/FormActions.js +54 -0
  130. package/v2Containers/WebPush/Create/components/FormActions.test.js +163 -0
  131. package/v2Containers/WebPush/Create/components/MediaSection.js +142 -0
  132. package/v2Containers/WebPush/Create/components/MediaSection.test.js +341 -0
  133. package/v2Containers/WebPush/Create/components/MessageSection.js +103 -0
  134. package/v2Containers/WebPush/Create/components/MessageSection.test.js +268 -0
  135. package/v2Containers/WebPush/Create/components/NotificationTitleSection.js +87 -0
  136. package/v2Containers/WebPush/Create/components/NotificationTitleSection.test.js +210 -0
  137. package/v2Containers/WebPush/Create/components/TemplateNameSection.js +54 -0
  138. package/v2Containers/WebPush/Create/components/TemplateNameSection.test.js +143 -0
  139. package/v2Containers/WebPush/Create/components/__snapshots__/ButtonsLinksSection.test.js.snap +86 -0
  140. package/v2Containers/WebPush/Create/components/__snapshots__/FormActions.test.js.snap +16 -0
  141. package/v2Containers/WebPush/Create/components/__snapshots__/MediaSection.test.js.snap +41 -0
  142. package/v2Containers/WebPush/Create/components/__snapshots__/MessageSection.test.js.snap +54 -0
  143. package/v2Containers/WebPush/Create/components/__snapshots__/NotificationTitleSection.test.js.snap +37 -0
  144. package/v2Containers/WebPush/Create/components/__snapshots__/TemplateNameSection.test.js.snap +21 -0
  145. package/v2Containers/WebPush/Create/components/_buttons.scss +246 -0
  146. package/v2Containers/WebPush/Create/components/tests/ButtonForm.test.js +554 -0
  147. package/v2Containers/WebPush/Create/components/tests/ButtonItem.test.js +607 -0
  148. package/v2Containers/WebPush/Create/components/tests/ButtonList.test.js +633 -0
  149. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonForm.test.js.snap +666 -0
  150. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonItem.test.js.snap +74 -0
  151. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonList.test.js.snap +78 -0
  152. package/v2Containers/WebPush/Create/hooks/useButtonManagement.js +138 -0
  153. package/v2Containers/WebPush/Create/hooks/useButtonManagement.test.js +406 -0
  154. package/v2Containers/WebPush/Create/hooks/useCharacterCount.js +30 -0
  155. package/v2Containers/WebPush/Create/hooks/useCharacterCount.test.js +151 -0
  156. package/v2Containers/WebPush/Create/hooks/useImageUpload.js +104 -0
  157. package/v2Containers/WebPush/Create/hooks/useImageUpload.test.js +538 -0
  158. package/v2Containers/WebPush/Create/hooks/useTagManagement.js +122 -0
  159. package/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +633 -0
  160. package/v2Containers/WebPush/Create/index.js +1056 -0
  161. package/v2Containers/WebPush/Create/index.scss +134 -0
  162. package/v2Containers/WebPush/Create/messages.js +203 -0
  163. package/v2Containers/WebPush/Create/preview/DevicePreviewContent.js +228 -0
  164. package/v2Containers/WebPush/Create/preview/NotificationContainer.js +294 -0
  165. package/v2Containers/WebPush/Create/preview/PreviewContent.js +90 -0
  166. package/v2Containers/WebPush/Create/preview/PreviewControls.js +305 -0
  167. package/v2Containers/WebPush/Create/preview/PreviewDisclaimer.js +23 -0
  168. package/v2Containers/WebPush/Create/preview/WebPushPreview.js +150 -0
  169. package/v2Containers/WebPush/Create/preview/assets/Light.svg +53 -0
  170. package/v2Containers/WebPush/Create/preview/assets/Top.svg +5 -0
  171. package/v2Containers/WebPush/Create/preview/assets/android-arrow-down.svg +9 -0
  172. package/v2Containers/WebPush/Create/preview/assets/android-arrow-up.svg +9 -0
  173. package/v2Containers/WebPush/Create/preview/assets/chrome-icon.png +0 -0
  174. package/v2Containers/WebPush/Create/preview/assets/edge-icon.png +0 -0
  175. package/v2Containers/WebPush/Create/preview/assets/firefox-icon.svg +106 -0
  176. package/v2Containers/WebPush/Create/preview/assets/iOS.svg +26 -0
  177. package/v2Containers/WebPush/Create/preview/assets/macos-arrow-down-icon.svg +9 -0
  178. package/v2Containers/WebPush/Create/preview/assets/macos-triple-dot-icon.svg +9 -0
  179. package/v2Containers/WebPush/Create/preview/assets/opera-icon.svg +18 -0
  180. package/v2Containers/WebPush/Create/preview/assets/safari-icon.svg +29 -0
  181. package/v2Containers/WebPush/Create/preview/assets/windows-close-icon.svg +9 -0
  182. package/v2Containers/WebPush/Create/preview/assets/windows-triple-dot-icon.svg +9 -0
  183. package/v2Containers/WebPush/Create/preview/components/AndroidMobileChromeHeader.js +47 -0
  184. package/v2Containers/WebPush/Create/preview/components/AndroidMobileExpanded.js +141 -0
  185. package/v2Containers/WebPush/Create/preview/components/IOSHeader.js +45 -0
  186. package/v2Containers/WebPush/Create/preview/components/NotificationExpandedContent.js +68 -0
  187. package/v2Containers/WebPush/Create/preview/components/NotificationHeader.js +61 -0
  188. package/v2Containers/WebPush/Create/preview/components/WindowsChromeExpanded.js +99 -0
  189. package/v2Containers/WebPush/Create/preview/components/tests/AndroidMobileExpanded.test.js +733 -0
  190. package/v2Containers/WebPush/Create/preview/components/tests/WindowsChromeExpanded.test.js +571 -0
  191. package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/AndroidMobileExpanded.test.js.snap +81 -0
  192. package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/WindowsChromeExpanded.test.js.snap +81 -0
  193. package/v2Containers/WebPush/Create/preview/config/notificationMappings.js +50 -0
  194. package/v2Containers/WebPush/Create/preview/constants.js +637 -0
  195. package/v2Containers/WebPush/Create/preview/notification-container.scss +79 -0
  196. package/v2Containers/WebPush/Create/preview/preview.scss +351 -0
  197. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-chrome.scss +370 -0
  198. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-edge.scss +12 -0
  199. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-firefox.scss +12 -0
  200. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-opera.scss +12 -0
  201. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-chrome.scss +47 -0
  202. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-edge.scss +11 -0
  203. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-firefox.scss +11 -0
  204. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-opera.scss +11 -0
  205. package/v2Containers/WebPush/Create/preview/styles/_base.scss +207 -0
  206. package/v2Containers/WebPush/Create/preview/styles/_ios.scss +153 -0
  207. package/v2Containers/WebPush/Create/preview/styles/_ipados.scss +107 -0
  208. package/v2Containers/WebPush/Create/preview/styles/_macos-chrome.scss +101 -0
  209. package/v2Containers/WebPush/Create/preview/styles/_windows-chrome.scss +229 -0
  210. package/v2Containers/WebPush/Create/preview/tests/DevicePreviewContent.test.js +909 -0
  211. package/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +1081 -0
  212. package/v2Containers/WebPush/Create/preview/tests/PreviewControls.test.js +723 -0
  213. package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +943 -0
  214. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/DevicePreviewContent.test.js.snap +131 -0
  215. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/NotificationContainer.test.js.snap +112 -0
  216. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/PreviewControls.test.js.snap +144 -0
  217. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/WebPushPreview.test.js.snap +129 -0
  218. package/v2Containers/WebPush/Create/utils/payloadBuilder.js +94 -0
  219. package/v2Containers/WebPush/Create/utils/payloadBuilder.test.js +390 -0
  220. package/v2Containers/WebPush/Create/utils/previewUtils.js +89 -0
  221. package/v2Containers/WebPush/Create/utils/urlValidation.js +115 -0
  222. package/v2Containers/WebPush/Create/utils/urlValidation.test.js +449 -0
  223. package/v2Containers/WebPush/Create/utils/validation.js +75 -0
  224. package/v2Containers/WebPush/Create/utils/validation.test.js +283 -0
  225. package/v2Containers/WebPush/actions.js +60 -0
  226. package/v2Containers/WebPush/constants.js +128 -0
  227. package/v2Containers/WebPush/index.js +2 -0
  228. package/v2Containers/WebPush/reducer.js +104 -0
  229. package/v2Containers/WebPush/sagas.js +119 -0
  230. package/v2Containers/WebPush/selectors.js +65 -0
  231. package/v2Containers/WebPush/tests/reducer.test.js +863 -0
  232. package/v2Containers/WebPush/tests/sagas.test.js +566 -0
  233. package/v2Containers/WebPush/tests/selectors.test.js +843 -0
  234. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +528 -431
  235. package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +0 -254
  236. package/v2Components/HtmlEditor/components/ValidationTabs/index.js +0 -362
  237. package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +0 -51
  238. package/v2Containers/BeePopupEditor/constants.js +0 -10
  239. package/v2Containers/BeePopupEditor/index.js +0 -193
  240. package/v2Containers/BeePopupEditor/tests/index.test.js +0 -627
  241. package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +0 -1045
  242. package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +0 -376
  243. package/v2Containers/InApp/__tests__/sagas.test.js +0 -363
  244. package/v2Containers/InApp/tests/selectors.test.js +0 -612
  245. package/v2Containers/InAppWrapper/components/InAppWrapperView.js +0 -162
  246. package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +0 -267
  247. package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +0 -9
  248. package/v2Containers/InAppWrapper/constants.js +0 -16
  249. package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +0 -473
  250. package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +0 -198
  251. package/v2Containers/InAppWrapper/index.js +0 -148
  252. package/v2Containers/InAppWrapper/messages.js +0 -49
  253. package/v2Containers/InappAdvance/index.js +0 -1099
  254. package/v2Containers/InappAdvance/index.scss +0 -10
  255. package/v2Containers/InappAdvance/tests/index.test.js +0 -448
@@ -1,19 +1,16 @@
1
- import React, {
2
- useState, useEffect, useMemo, useCallback, useRef,
3
- } from 'react';
1
+ import { useState, useEffect, useMemo, useCallback } from 'react';
4
2
  import isEmpty from 'lodash/isEmpty';
5
- import find from 'lodash/find';
6
3
  import get from 'lodash/get';
4
+ import find from 'lodash/find';
7
5
  import { GA } from '@capillarytech/cap-ui-utils';
8
6
  import CapNotification from '@capillarytech/cap-ui-library/CapNotification';
9
- import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
10
7
  import { CHANNEL_CREATE_TRACK_MAPPING } from '../../App/constants';
11
8
  import { gtmPush } from '../../../utils/gtmTrackers';
12
9
  import { EMAIL } from '../../CreativesContainer/constants';
13
10
  import messages from '../messages';
14
- import { STEPS, EMAIL_CREATE_MODES } from '../constants';
11
+ import { STEPS } from '../constants';
12
+ import { EMAIL_CREATE_MODES } from '../constants';
15
13
  import { containsBase64Images } from '../../../utils/content';
16
- import { hasSupportCKEditor } from '../../../utils/common';
17
14
 
18
15
  /**
19
16
  * Custom hook to handle EmailWrapper component business logic
@@ -59,21 +56,12 @@ const useEmailWrapper = ({
59
56
  handleTestAndPreview,
60
57
  handleCloseTestAndPreview,
61
58
  isTestAndPreviewMode,
62
- // Props for BEE enabled check
63
- location,
64
- emailActions,
65
- Email,
66
- templateData,
67
- params,
68
59
  }) => {
69
60
  // State management
70
61
  const [templateName, setTemplateName] = useState('');
71
62
  const [isTemplateNameEmpty, setIsTemplateNameEmpty] = useState(true);
72
63
  const [selectedCreateMode, setSelectedCreateMode] = useState('');
73
64
  const [modeContent, setModeContent] = useState({});
74
- const [isBeeEditorEnabled, setIsBeeEditorEnabled] = useState(null); // null = not checked yet, true/false = checked
75
- const beeStatusCheckRef = useRef(false); // Track if we've made the API call for current step
76
- const defaultTemplatesFetchedRef = useRef(false);
77
65
  const [routeParams] = useState({
78
66
  pathname: `/email/create`,
79
67
  query: { module: 'library', type: 'embedded' },
@@ -88,7 +76,7 @@ const useEmailWrapper = ({
88
76
  }, [onResetStep, templatesActions]);
89
77
 
90
78
  // Event handlers
91
- const onTemplateNameChange = useCallback(({ target: { value } }) => {
79
+ const onTemplateNameChange = useCallback(({target: {value}}) => {
92
80
  const isEmptyTemplateName = !value?.trim();
93
81
  setTemplateName(value);
94
82
  setIsTemplateNameEmpty(isEmptyTemplateName);
@@ -100,123 +88,9 @@ const useEmailWrapper = ({
100
88
  }
101
89
  }, [onEnterTemplateName, onRemoveTemplateName]);
102
90
 
103
- // Check BEE enabled status from API response
104
- // BEE is enabled if isDragDrop is true in the API response
105
- // This should work for both full mode and library mode
106
- const checkBeeEditorEnabled = useCallback(() => {
107
- // If we have checked the API and got a response, use that
108
- if (isBeeEditorEnabled !== null) {
109
- return isBeeEditorEnabled;
110
- }
111
- // If we haven't checked yet, return false (disabled) until API responds
112
- return false;
113
- }, [isBeeEditorEnabled]);
114
-
115
- // Helper function to convert numeric templateStep to string step
116
- const getStepFromTemplateStep = useCallback((templateStepValue) => {
117
- // templateStep is numeric: 1 = modeSelection, 2 = templateSelection, 3 = createTemplateContent
118
- if (typeof templateStepValue === 'number') {
119
- switch (templateStepValue) {
120
- case 1:
121
- return STEPS.MODE_SELECTION;
122
- case 2:
123
- return STEPS.TEMPLATE_SELECTION;
124
- case 3:
125
- return STEPS.CREATE_TEMPLATE_CONTENT;
126
- default:
127
- return STEPS.MODE_SELECTION;
128
- }
129
- }
130
- // If it's already a string, return as-is
131
- return templateStepValue || STEPS.MODE_SELECTION;
132
- }, []);
133
-
134
- // Convert step to string format if it's numeric
135
- const currentStep = useMemo(() => getStepFromTemplateStep(step), [step, getStepFromTemplateStep]);
136
-
137
- // Effect to check BEE enabled status via new API when entering MODE_SELECTION step
138
- useEffect(() => {
139
- const supportCKEditor = hasSupportCKEditor();
140
- // Only check BEE enabled status for new flow (when supportCKEditor is false)
141
- // Reset the ref when step changes to MODE_SELECTION to allow API call
142
- if (currentStep === STEPS.MODE_SELECTION) {
143
- beeStatusCheckRef.current = false;
144
- }
145
-
146
- // Only check BEE enabled status for new flow (when supportCKEditor is false)
147
- // Check all conditions
148
- const shouldMakeCall = !supportCKEditor
149
- && currentStep === STEPS.MODE_SELECTION
150
- && !beeStatusCheckRef.current
151
- && emailActions;
152
-
153
- if (shouldMakeCall) {
154
- // Mark that we've made the API call
155
- beeStatusCheckRef.current = true;
156
-
157
- // Make API call to check BEE enabled status using new endpoint
158
- emailActions.getCmsAccounts('BEE_PLUGIN');
159
- }
160
- }, [currentStep, emailActions]);
161
-
162
- // Effect to update isBeeEditorEnabled based on new API response
163
- // This effect watches for isBeeEnabled from the new API response
164
- useEffect(() => {
165
- // Only process if we're in MODE_SELECTION step (when we're checking BEE status)
166
- // Also check if we've made the API call (beeStatusCheckRef.current === true)
167
- if (currentStep === STEPS.MODE_SELECTION && beeStatusCheckRef.current) {
168
- // Use isBeeEnabled from the new API response
169
- if (Email?.isBeeEnabled !== undefined) {
170
- setIsBeeEditorEnabled(Email.isBeeEnabled);
171
- }
172
- }
173
- // If API call fails, treat as disabled
174
- if (Email?.fetchingCmsAccountsError && beeStatusCheckRef.current) {
175
- setIsBeeEditorEnabled(false);
176
- }
177
- }, [Email?.isBeeEnabled, Email?.fetchingCmsAccountsError, currentStep]);
178
-
179
91
  const onChange = useCallback((e) => {
180
- const { target: { value } } = e;
181
- // Prevent selection if Drag & Drop is selected but BEE editor is not enabled
182
- if (value === EMAIL_CREATE_MODES.DRAG_DROP && !checkBeeEditorEnabled()) {
183
- return; // Ignore selection if BEE editor is disabled
184
- }
185
-
186
- // CRITICAL: When DRAG_DROP is selected, set selectedCreateMode to DRAG_DROP
187
- // This ensures emailProps will have editor: 'BEE' and selectedEditorMode: null
188
- if (value === EMAIL_CREATE_MODES.DRAG_DROP) {
189
- setSelectedCreateMode(EMAIL_CREATE_MODES.DRAG_DROP);
190
- } else {
191
- setSelectedCreateMode(value);
192
- }
193
-
194
- const supportCKEditor = hasSupportCKEditor();
195
-
196
- // Map new modes to existing modes for backwards compatibility
197
- let mappedValue = value;
198
-
199
- if (!supportCKEditor) {
200
- // New flow: Handle HTML Editor, Drag & Drop, and Upload Zip
201
- // Don't auto-navigate - wait for Next button click
202
- if (value === EMAIL_CREATE_MODES.HTML_EDITOR) {
203
- // HTML Editor: Map to EDITOR but skip template selection
204
- mappedValue = EMAIL_CREATE_MODES.EDITOR;
205
- setModeContent({ skipTemplateSelection: true });
206
- } else if (value === EMAIL_CREATE_MODES.DRAG_DROP) {
207
- // Drag & Drop: Map to EDITOR and show template selection
208
- mappedValue = EMAIL_CREATE_MODES.EDITOR;
209
- } else if (value === EMAIL_CREATE_MODES.UPLOAD) {
210
- // Upload Zip: Keep as UPLOAD
211
- mappedValue = EMAIL_CREATE_MODES.UPLOAD;
212
- }
213
- } else if (value === EMAIL_CREATE_MODES.EDITOR && showNextStep) {
214
- // Legacy flow: Auto-navigate immediately (existing behavior)
215
- showNextStep();
216
- }
217
-
218
- onEmailModeChange(mappedValue, value); // Pass both mapped value and original selected mode
219
- }, [onEmailModeChange, showNextStep, checkBeeEditorEnabled]);
92
+ onEmailModeChange(e.target.value);
93
+ }, [onEmailModeChange]);
220
94
 
221
95
  const handleZipUploadError = useCallback(() => {
222
96
  const message = {
@@ -320,12 +194,8 @@ const useEmailWrapper = ({
320
194
  const data = find(CmsTemplates, { _id: id });
321
195
  templatesActions.setEdmTemplate(data);
322
196
  templatesActions.setBEETemplate(data);
323
- // Don't override selectedCreateMode - preserve DRAG_DROP or EDITOR mode
324
- // Only set if not already set
325
- if (!selectedCreateMode) {
326
- setSelectedCreateMode(EMAIL_CREATE_MODES.EDITOR);
327
- }
328
- }, [CmsTemplates, templatesActions, selectedCreateMode]);
197
+ setSelectedCreateMode(EMAIL_CREATE_MODES.EDITOR);
198
+ }, [CmsTemplates, templatesActions]);
329
199
 
330
200
  const useFileUpload = useCallback(({ file }) => {
331
201
  setModeContent({});
@@ -339,73 +209,41 @@ const useEmailWrapper = ({
339
209
 
340
210
  // Main logic effect - MOVED AFTER function declarations
341
211
  useEffect(() => {
342
- const supportCKEditor = hasSupportCKEditor();
212
+ // Skip if user has already made a selection
213
+ if (selectedCreateMode) return;
343
214
 
344
215
  // Handle different steps
345
- switch (currentStep) {
216
+ switch (step) {
346
217
  case STEPS.MODE_SELECTION:
347
218
  if (emailCreateMode === EMAIL_CREATE_MODES.UPLOAD && !EmailLayout) {
348
219
  // Commented out: document.getElementById('upload-email-template').click();
349
220
  }
350
221
  break;
351
222
 
352
- case STEPS.TEMPLATE_SELECTION: {
353
- // Template selection is needed for:
354
- // 1. Legacy EDITOR mode (when supportCKEditor is true)
355
- // 2. New DRAG_DROP mode (when supportCKEditor is false)
356
- // NOT needed for HTML_EDITOR (goes directly to editor)
357
-
358
- let needsTemplates = false;
359
- if (supportCKEditor) {
360
- // Legacy flow: only for EDITOR mode
361
- needsTemplates = emailCreateMode === EMAIL_CREATE_MODES.EDITOR
362
- && !CmsTemplates
363
- && !getCmsTemplatesInProgress;
364
- } else {
365
- // New flow: for DRAG_DROP only (not HTML_EDITOR)
366
- needsTemplates = selectedCreateMode === EMAIL_CREATE_MODES.DRAG_DROP
367
- && !CmsTemplates
368
- && !getCmsTemplatesInProgress;
369
- }
223
+ case STEPS.TEMPLATE_SELECTION:
224
+ const needsTemplates = emailCreateMode === EMAIL_CREATE_MODES.EDITOR
225
+ && !CmsTemplates
226
+ && !getCmsTemplatesInProgress;
370
227
 
371
- if (needsTemplates && !defaultTemplatesFetchedRef.current) {
228
+ if (needsTemplates) {
372
229
  templatesActions.getDefaultBeeTemplates();
373
- defaultTemplatesFetchedRef.current = true;
374
230
  }
375
231
  break;
376
- }
377
232
 
378
- case STEPS.CREATE_TEMPLATE_CONTENT: {
233
+ case STEPS.CREATE_TEMPLATE_CONTENT:
379
234
  if (emailCreateMode === EMAIL_CREATE_MODES.UPLOAD && !isEmpty(EmailLayout)) {
380
235
  setSelectedCreateMode(EMAIL_CREATE_MODES.UPLOAD);
381
- } else if (emailCreateMode === EMAIL_CREATE_MODES.EDITOR
382
- || emailCreateMode === EMAIL_CREATE_MODES.DRAG_DROP
383
- || selectedCreateMode === EMAIL_CREATE_MODES.EDITOR
384
- || selectedCreateMode === EMAIL_CREATE_MODES.DRAG_DROP) {
385
- if (!supportCKEditor && selectedCreateMode === EMAIL_CREATE_MODES.HTML_EDITOR) {
386
- // HTML Editor mode: Skip template selection, go directly to editor
387
- setSelectedCreateMode(EMAIL_CREATE_MODES.HTML_EDITOR);
388
- } else if (isEmpty(SelectedEdmDefaultTemplate) && modeContent.id) {
389
- // Legacy EDITOR or DRAG_DROP: Need template selection
390
- handleEdmDefaultTemplateSelection(modeContent.id);
391
- } else if (!supportCKEditor && selectedCreateMode === EMAIL_CREATE_MODES.DRAG_DROP) {
392
- // CRITICAL: Template already selected for DRAG_DROP - ensure selectedCreateMode is DRAG_DROP
393
- // This ensures emailProps will have editor: 'BEE' and selectedEditorMode: null
394
- setSelectedCreateMode(EMAIL_CREATE_MODES.DRAG_DROP);
395
- } else {
396
- // Template already selected for legacy EDITOR
397
- setSelectedCreateMode(EMAIL_CREATE_MODES.EDITOR);
398
- }
236
+ } else if (emailCreateMode === EMAIL_CREATE_MODES.EDITOR && isEmpty(SelectedEdmDefaultTemplate)) {
237
+ handleEdmDefaultTemplateSelection(modeContent.id);
399
238
  }
400
239
  break;
401
- }
402
240
 
403
241
  default:
404
242
  // No operation for other steps
405
243
  break;
406
244
  }
407
245
  }, [
408
- currentStep,
246
+ step,
409
247
  selectedCreateMode,
410
248
  emailCreateMode,
411
249
  EmailLayout,
@@ -414,155 +252,58 @@ const useEmailWrapper = ({
414
252
  modeContent.id,
415
253
  SelectedEdmDefaultTemplate,
416
254
  templatesActions,
417
- handleEdmDefaultTemplateSelection,
255
+ handleEdmDefaultTemplateSelection
418
256
  ]);
419
257
 
420
- // CRITICAL: Reset selectedCreateMode when templateData is cleared (new template creation)
421
- // This ensures that when user creates a new template after editing, selectedCreateMode is reset
422
- useEffect(() => {
423
- // If templateData is cleared/null and we're not in edit mode, reset selectedCreateMode
424
- const hasParamsId = params?.id
425
- || location?.query?.id
426
- || location?.params?.id
427
- || location?.pathname?.includes('/edit/');
428
- const hasTemplateData = templateData && !isEmpty(templateData);
429
- const isEditMode = hasParamsId || hasTemplateData;
430
-
431
- // If we're creating a new template (no templateData and no params.id), reset selectedCreateMode
432
- // BUT only if we're in MODE_SELECTION step (navigating back to start)
433
- // DO NOT reset in CREATE_TEMPLATE_CONTENT - that's where we need selectedCreateMode to render the editor!
434
- // Also DO NOT reset if emailCreateMode is set - it means user has made a selection
435
- if (!isEditMode && !hasTemplateData && selectedCreateMode && currentStep === STEPS.MODE_SELECTION && !emailCreateMode) {
436
- // Reset only when returning to MODE_SELECTION step
437
- // This preserves user selection while in content creation
438
- setSelectedCreateMode('');
439
- }
440
- }, [templateData, params?.id, location?.query?.id, location?.params?.id, location?.pathname, selectedCreateMode, templateName, currentStep, emailCreateMode]);
441
-
442
258
  // Derived state
443
- const supportCKEditorFlag = hasSupportCKEditor();
444
-
445
- // Prepare props for Email component - MOVED BEFORE isShowEmailCreate to avoid circular dependency
446
- const emailProps = useMemo(() => {
447
- // Determine editor type and mode based on selectedCreateMode
448
- let editorType = editor;
449
- let selectedEditorMode = null;
450
-
451
- if (!supportCKEditorFlag) {
452
- // CRITICAL: Check selectedCreateMode FIRST to prioritize user's explicit selection
453
- // This ensures DRAG_DROP selection takes precedence over edit mode detection
454
- // even if templateDetails persists from a previous template
455
- if (selectedCreateMode === EMAIL_CREATE_MODES.DRAG_DROP) {
456
- // CRITICAL: DRAG_DROP mode always uses BEE editor
457
- // This takes precedence over edit mode detection
458
- editorType = 'BEE';
459
- selectedEditorMode = null; // BEE uses existing flow (null indicates BEE editor)
460
- } else if (selectedCreateMode === EMAIL_CREATE_MODES.HTML_EDITOR) {
461
- // HTML_EDITOR mode: Always use HTML editor
462
- editorType = 'HTML';
463
- selectedEditorMode = EMAIL_CREATE_MODES.HTML_EDITOR;
464
- } else {
465
- // Check if we're editing an existing template
466
- // CRITICAL: Only treat as edit mode if we have params.id (actual edit URL)
467
- // Don't use templateDetails existence alone, as it might persist from previous template
468
- const hasParamsId = params?.id || location?.query?.id || location?.params?.id || location?.pathname?.includes('/edit/');
469
- const hasTemplateDetails = Email?.templateDetails && !isEmpty(Email.templateDetails);
470
- const hasBEETemplate = Email?.BEETemplate && !isEmpty(Email.BEETemplate);
471
- // CRITICAL: Only consider it edit mode if we have params.id (actual edit URL)
472
- // This prevents false edit mode detection when templateDetails persists in Redux from previous template
473
- const isEditMode = hasParamsId && (hasTemplateDetails || hasBEETemplate);
474
-
475
- if (isEditMode) {
476
- // Edit mode: Determine editor based on template data
477
- // Check if template was created in BEE editor
478
- const editTemplateData = Email?.templateDetails || Email?.BEETemplate || templateData;
479
- const isDragDrop = get(editTemplateData, 'versions.base.is_drag_drop', false)
480
- || get(editTemplateData, 'base.is_drag_drop', false)
481
- || get(editTemplateData, 'is_drag_drop', false)
482
- || get(editTemplateData, 'versions.base[0].is_drag_drop', false);
483
-
484
- // Check if BEE is enabled for org (equivalent to checkBeeEditorAllowedForLibrary)
485
- // For library mode: BEE is enabled if editor prop is "BEE"
486
- // For full mode: BEE is always enabled
487
- const isBeeEnabled = isFullMode || (editor === "BEE" && !isFullMode) || checkBeeEditorEnabled();
488
-
489
- // If template was created in BEE AND BEE is enabled → open in BEE editor
490
- // Otherwise → open in HTML editor (fallback)
491
- // IMPORTANT: When supportCKEditor is false, default to HTML editor unless explicitly BEE
492
- if (isDragDrop && isBeeEnabled) {
493
- editorType = 'BEE';
494
- selectedEditorMode = null; // BEE uses existing flow
495
- } else {
496
- // Fallback to HTML editor if BEE not enabled or template not created in BEE
497
- // This ensures HTML editor is used when supportCKEditor is false
498
- editorType = 'HTML';
499
- selectedEditorMode = EMAIL_CREATE_MODES.HTML_EDITOR;
500
- }
501
- } else if (selectedCreateMode === EMAIL_CREATE_MODES.EDITOR) {
502
- // EDITOR mode: Check if selected template is a BEE template
503
- // When a default template is selected, it's stored in Templates.BEETemplate
504
- const beeTemplate = Email?.BEETemplate || SelectedEdmDefaultTemplate;
505
- const isBEETemplate = beeTemplate && (
506
- get(beeTemplate, 'versions.base.is_drag_drop') === true
507
- || get(beeTemplate, 'base.is_drag_drop') === true
508
- || beeTemplate.is_drag_drop === true
509
- );
510
-
511
- if (isBEETemplate && checkBeeEditorEnabled()) {
512
- // Template is BEE and BEE is enabled → use BEE editor
513
- editorType = 'BEE';
514
- selectedEditorMode = null; // BEE uses existing flow
515
- } else {
516
- // Template is not BEE or BEE is disabled → use HTML editor
517
- editorType = 'HTML';
518
- selectedEditorMode = EMAIL_CREATE_MODES.HTML_EDITOR;
519
- }
520
- } else {
521
- // Default: When supportCKEditor is false and no mode selected, use HTML editor
522
- editorType = 'HTML';
523
- selectedEditorMode = EMAIL_CREATE_MODES.HTML_EDITOR;
524
- }
525
- }
526
- // UPLOAD mode uses existing editor prop
527
- }
528
- // Legacy flow (supportCKEditor is true): Use existing editor prop as-is - no changes
259
+ const isShowEmailCreate = !isEmpty(selectedCreateMode) && (!isEmpty(EmailLayout) || SelectedEdmDefaultTemplate);
529
260
 
530
- return {
531
- setIsLoadingContent,
532
- key: "email-create-template",
533
- location: routeParams,
534
- route: { name: 'email' },
535
- params: {},
536
- isGetFormData,
537
- getFormdata,
538
- getFormSubscriptionData: getFormdata,
539
- getDefaultTags: type,
540
- isFullMode,
541
- defaultData: { 'template-name': templateName },
542
- cap,
543
- showTemplateName,
544
- showLiquidErrorInFooter,
545
- onValidationFail,
546
- forwardedTags,
547
- selectedOfferDetails,
548
- onPreviewContentClicked,
549
- onTestContentClicked,
550
- editor: editorType,
551
- selectedEditorMode, // Pass selected mode to Email component (only for HTML_EDITOR)
552
- moduleType,
553
- eventContextTags,
554
- isLoyaltyModule,
555
- showTestAndPreviewSlidebox,
556
- handleTestAndPreview,
557
- handleCloseTestAndPreview,
558
- isTestAndPreviewMode,
559
- };
560
- }, [
261
+ // Memoize static data
262
+ const modes = useMemo(() => [
263
+ {
264
+ title: formatMessage(messages.zipUpload),
265
+ content: formatMessage(messages.zipUploadDesc),
266
+ value: EMAIL_CREATE_MODES.UPLOAD,
267
+ },
268
+ {
269
+ title: formatMessage(messages.useEditor),
270
+ content: formatMessage(messages.useEditorDesc),
271
+ value: EMAIL_CREATE_MODES.EDITOR,
272
+ },
273
+ ], [formatMessage]);
274
+
275
+ // Prepare props for Email component
276
+ const emailProps = useMemo(() => ({
277
+ setIsLoadingContent,
278
+ key: "email-create-template",
279
+ location: routeParams,
280
+ route: { name: 'email' },
281
+ params: {},
282
+ isGetFormData,
283
+ getFormdata,
284
+ getFormSubscriptionData: getFormdata,
285
+ getDefaultTags: type,
286
+ isFullMode,
287
+ defaultData: { 'template-name': templateName },
288
+ cap,
289
+ showTemplateName,
290
+ showLiquidErrorInFooter,
291
+ onValidationFail,
292
+ forwardedTags,
293
+ selectedOfferDetails,
294
+ onPreviewContentClicked,
295
+ onTestContentClicked,
296
+ editor,
297
+ moduleType,
298
+ eventContextTags,
299
+ isLoyaltyModule,
300
+ showTestAndPreviewSlidebox,
301
+ handleTestAndPreview,
302
+ handleCloseTestAndPreview,
303
+ isTestAndPreviewMode,
304
+ }), [
561
305
  setIsLoadingContent,
562
306
  routeParams,
563
- Email?.BEETemplate,
564
- SelectedEdmDefaultTemplate,
565
- checkBeeEditorEnabled,
566
307
  isGetFormData,
567
308
  getFormdata,
568
309
  type,
@@ -584,118 +325,8 @@ const useEmailWrapper = ({
584
325
  handleTestAndPreview,
585
326
  handleCloseTestAndPreview,
586
327
  isTestAndPreviewMode,
587
- selectedCreateMode,
588
- supportCKEditorFlag,
589
- checkBeeEditorEnabled,
590
- Email,
591
- location,
592
- params,
593
- editor,
594
- isFullMode,
595
- templateData,
596
328
  ]);
597
329
 
598
- const isShowEmailCreate = useMemo(() => {
599
- // Check if we're in edit mode (templateDetails or BEETemplate exists, or params.id exists)
600
- const hasTemplateDetails = Email?.templateDetails && !isEmpty(Email.templateDetails);
601
- const hasBEETemplate = Email?.BEETemplate && !isEmpty(Email.BEETemplate);
602
- const hasParamsId = params?.id || location?.query?.id || location?.params?.id || location?.pathname?.includes('/edit/');
603
- const isEditMode = hasTemplateDetails || hasBEETemplate || hasParamsId;
604
-
605
- // In edit mode with HTML editor (when supportCKEditor is false), always show editor
606
- if (!supportCKEditorFlag && isEditMode) {
607
- // Check if it's explicitly BEE editor
608
- const isExplicitlyBEE = emailCreateMode === EMAIL_CREATE_MODES.DRAG_DROP
609
- || (emailProps?.editor === 'BEE' && emailProps?.selectedEditorMode === null);
610
- // If not BEE, show HTML editor
611
- if (!isExplicitlyBEE) {
612
- return true;
613
- }
614
- }
615
-
616
- if (!selectedCreateMode) return false;
617
-
618
- // For HTML Editor (new flow): Always show editor directly without template selection
619
- // This takes precedence over step check to ensure HTML Editor is shown even if step is temporarily TEMPLATE_SELECTION
620
- if (!supportCKEditorFlag && selectedCreateMode === EMAIL_CREATE_MODES.HTML_EDITOR) {
621
- return true;
622
- }
623
-
624
- // CRITICAL: For DRAG_DROP mode, show template selection first (CmsTemplatesComponent)
625
- // Only show editor (Email component with BEE) after template is selected
626
- if (emailCreateMode === EMAIL_CREATE_MODES.DRAG_DROP || selectedCreateMode === EMAIL_CREATE_MODES.DRAG_DROP) {
627
- // If we're in TEMPLATE_SELECTION step, show template selection (not email editor)
628
- if (currentStep === STEPS.TEMPLATE_SELECTION) {
629
- return false;
630
- }
631
- // After template selection, show editor when template is selected
632
- return !isEmpty(SelectedEdmDefaultTemplate);
633
- }
634
-
635
- // If we're in TEMPLATE_SELECTION step, show template selection (not email editor)
636
- // This applies to legacy Editor modes
637
- if (currentStep === STEPS.TEMPLATE_SELECTION) {
638
- return false;
639
- }
640
-
641
- // For Upload: Show editor when EmailLayout exists
642
- if (emailCreateMode === EMAIL_CREATE_MODES.UPLOAD) {
643
- return !isEmpty(EmailLayout);
644
- }
645
-
646
- // For Editor: Show editor when template is selected
647
- return !isEmpty(SelectedEdmDefaultTemplate);
648
- }, [currentStep, selectedCreateMode, supportCKEditorFlag, emailCreateMode, EmailLayout, SelectedEdmDefaultTemplate, Email?.templateDetails, Email?.BEETemplate, params?.id, location?.query?.id, location?.params?.id, location?.pathname, emailProps?.editor, emailProps?.selectedEditorMode]);
649
-
650
- // Memoize static data
651
- const modes = useMemo(() => {
652
- const supportCKEditor = hasSupportCKEditor();
653
- const isBeeEditorEnabledValue = checkBeeEditorEnabled();
654
-
655
- if (supportCKEditor) {
656
- // Legacy flow: Show only 2 options (Upload Zip, Use Editor)
657
- return [
658
- {
659
- title: formatMessage(messages.zipUpload),
660
- content: formatMessage(messages.zipUploadDesc),
661
- value: EMAIL_CREATE_MODES.UPLOAD,
662
- },
663
- {
664
- title: formatMessage(messages.useEditor),
665
- content: formatMessage(messages.useEditorDesc),
666
- value: EMAIL_CREATE_MODES.EDITOR,
667
- },
668
- ];
669
- }
670
-
671
- // New flow: Show 3 options (HTML Editor, Drag & Drop, Upload Zip)
672
- return [
673
- {
674
- title: formatMessage(messages.htmlEditorTitle),
675
- content: formatMessage(messages.htmlEditorDesc),
676
- value: EMAIL_CREATE_MODES.HTML_EDITOR,
677
- icon: <CapIcon type="code" />,
678
- },
679
- {
680
- title: formatMessage(messages.dragDropEditorTitle),
681
- content: formatMessage(messages.dragDropEditorDesc),
682
- value: EMAIL_CREATE_MODES.DRAG_DROP,
683
- icon: <CapIcon type="draggable" svgProps={{ fill: 'currentColor' }} />,
684
- disabled: !isBeeEditorEnabledValue,
685
- tooltipProps: !isBeeEditorEnabledValue ? {
686
- title: formatMessage(messages.beeEditorDisabledTooltip),
687
- placement: 'top',
688
- } : undefined,
689
- },
690
- {
691
- title: formatMessage(messages.uploadZipTitle),
692
- content: formatMessage(messages.uploadZipDesc),
693
- value: EMAIL_CREATE_MODES.UPLOAD,
694
- icon: <CapIcon type="file" />,
695
- },
696
- ];
697
- }, [formatMessage, checkBeeEditorEnabled]);
698
-
699
330
  // Prepare props for CmsTemplatesComponent
700
331
  const cmsTemplatesProps = useMemo(() => ({
701
332
  cmsTemplates: CmsTemplates,