@capillarytech/creatives-library 8.0.242-alpha.0 → 8.0.242-alpha.10

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 (216) hide show
  1. package/assets/Android.png +0 -0
  2. package/assets/iOS.png +0 -0
  3. package/constants/unified.js +2 -1
  4. package/initialReducer.js +2 -0
  5. package/package.json +1 -1
  6. package/sagas/__tests__/assetPolling.test.js +74 -3
  7. package/sagas/assetPolling.js +8 -1
  8. package/services/api.js +10 -5
  9. package/services/tests/api.test.js +18 -0
  10. package/translations/en.json +0 -1
  11. package/utils/common.js +5 -0
  12. package/utils/commonUtils.js +14 -1
  13. package/utils/tests/commonUtil.test.js +224 -0
  14. package/utils/transformTemplateConfig.js +0 -10
  15. package/utils/transformerUtils.js +0 -42
  16. package/v2Components/CapDeviceContent/index.js +61 -56
  17. package/v2Components/CapImageUpload/constants.js +0 -2
  18. package/v2Components/CapImageUpload/index.js +14 -54
  19. package/v2Components/CapImageUpload/index.scss +1 -4
  20. package/v2Components/CapImageUpload/messages.js +0 -4
  21. package/v2Components/CapTagList/index.js +6 -1
  22. package/v2Components/CapTagListWithInput/index.js +5 -1
  23. package/v2Components/CapTagListWithInput/messages.js +1 -1
  24. package/v2Components/CapWhatsappCTA/tests/index.test.js +5 -0
  25. package/v2Components/ErrorInfoNote/index.js +412 -72
  26. package/v2Components/ErrorInfoNote/messages.js +22 -0
  27. package/v2Components/ErrorInfoNote/style.scss +279 -2
  28. package/v2Components/HtmlEditor/HTMLEditor.js +220 -91
  29. package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +1132 -133
  30. package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +17 -12
  31. package/v2Components/HtmlEditor/_htmlEditor.scss +107 -45
  32. package/v2Components/HtmlEditor/_index.lazy.scss +1 -1
  33. package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +13 -101
  34. package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +148 -139
  35. package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +2 -1
  36. package/v2Components/HtmlEditor/components/DeviceToggle/index.js +3 -3
  37. package/v2Components/HtmlEditor/components/EditorToolbar/_editorToolbar.scss +9 -0
  38. package/v2Components/HtmlEditor/components/EditorToolbar/index.js +1 -1
  39. package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +22 -0
  40. package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +4 -7
  41. package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +35 -45
  42. package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +1 -3
  43. package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +33 -33
  44. package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +7 -6
  45. package/v2Components/HtmlEditor/components/PreviewPane/_previewPane.scss +3 -6
  46. package/v2Components/HtmlEditor/components/PreviewPane/index.js +10 -11
  47. package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +1 -1
  48. package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +70 -72
  49. package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +49 -31
  50. package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +254 -0
  51. package/v2Components/HtmlEditor/components/ValidationTabs/index.js +362 -0
  52. package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +51 -0
  53. package/v2Components/HtmlEditor/constants.js +29 -20
  54. package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +373 -16
  55. package/v2Components/HtmlEditor/hooks/useEditorContent.js +5 -2
  56. package/v2Components/HtmlEditor/hooks/useInAppContent.js +88 -146
  57. package/v2Components/HtmlEditor/index.js +1 -1
  58. package/v2Components/HtmlEditor/messages.js +95 -85
  59. package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +99 -101
  60. package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +23 -25
  61. package/v2Components/HtmlEditor/utils/validationAdapter.js +34 -41
  62. package/v2Components/MobilePushPreviewV2/index.js +32 -7
  63. package/v2Components/TemplatePreview/_templatePreview.scss +44 -24
  64. package/v2Components/TemplatePreview/index.js +47 -32
  65. package/v2Components/TemplatePreview/messages.js +4 -0
  66. package/v2Components/TestAndPreviewSlidebox/index.js +31 -25
  67. package/v2Containers/App/constants.js +0 -5
  68. package/v2Containers/BeeEditor/index.js +82 -80
  69. package/v2Containers/BeePopupEditor/constants.js +10 -0
  70. package/v2Containers/BeePopupEditor/index.js +193 -0
  71. package/v2Containers/BeePopupEditor/tests/index.test.js +627 -0
  72. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +0 -1
  73. package/v2Containers/CreativesContainer/SlideBoxContent.js +148 -120
  74. package/v2Containers/CreativesContainer/SlideBoxFooter.js +9 -3
  75. package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -2
  76. package/v2Containers/CreativesContainer/constants.js +1 -2
  77. package/v2Containers/CreativesContainer/index.js +173 -193
  78. package/v2Containers/CreativesContainer/messages.js +4 -4
  79. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +38 -50
  80. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +36 -0
  81. package/v2Containers/Email/actions.js +7 -0
  82. package/v2Containers/Email/constants.js +5 -1
  83. package/v2Containers/Email/index.js +13 -0
  84. package/v2Containers/Email/messages.js +32 -0
  85. package/v2Containers/Email/reducer.js +12 -1
  86. package/v2Containers/Email/sagas.js +41 -6
  87. package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +2 -0
  88. package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +1046 -0
  89. package/v2Containers/EmailWrapper/components/EmailWrapperView.js +193 -7
  90. package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +40 -74
  91. package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +2 -67
  92. package/v2Containers/EmailWrapper/constants.js +2 -0
  93. package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +436 -67
  94. package/v2Containers/EmailWrapper/index.js +99 -23
  95. package/v2Containers/EmailWrapper/messages.js +61 -1
  96. package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +111 -77
  97. package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +376 -0
  98. package/v2Containers/InApp/__tests__/sagas.test.js +363 -0
  99. package/v2Containers/InApp/actions.js +7 -0
  100. package/v2Containers/InApp/constants.js +20 -4
  101. package/v2Containers/InApp/index.js +801 -357
  102. package/v2Containers/InApp/index.scss +4 -3
  103. package/v2Containers/InApp/messages.js +7 -3
  104. package/v2Containers/InApp/reducer.js +21 -3
  105. package/v2Containers/InApp/sagas.js +29 -9
  106. package/v2Containers/InApp/selectors.js +25 -5
  107. package/v2Containers/InApp/tests/index.test.js +154 -50
  108. package/v2Containers/InApp/tests/reducer.test.js +34 -0
  109. package/v2Containers/InApp/tests/sagas.test.js +61 -9
  110. package/v2Containers/InApp/tests/selectors.test.js +612 -0
  111. package/v2Containers/InAppWrapper/components/InAppWrapperView.js +162 -0
  112. package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +267 -0
  113. package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +9 -0
  114. package/v2Containers/InAppWrapper/constants.js +16 -0
  115. package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +473 -0
  116. package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +198 -0
  117. package/v2Containers/InAppWrapper/index.js +148 -0
  118. package/v2Containers/InAppWrapper/messages.js +49 -0
  119. package/v2Containers/InappAdvance/index.js +1099 -0
  120. package/v2Containers/InappAdvance/index.scss +10 -0
  121. package/v2Containers/InappAdvance/tests/index.test.js +448 -0
  122. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -3
  123. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -2
  124. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +2 -25
  125. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +9 -18
  126. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +12 -46
  127. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +0 -4
  128. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -8
  129. package/v2Containers/TagList/index.js +67 -1
  130. package/v2Containers/Templates/ChannelTypeIllustration.js +1 -13
  131. package/v2Containers/Templates/_templates.scss +56 -200
  132. package/v2Containers/Templates/actions.js +1 -2
  133. package/v2Containers/Templates/constants.js +0 -1
  134. package/v2Containers/Templates/index.js +124 -277
  135. package/v2Containers/Templates/messages.js +4 -24
  136. package/v2Containers/Templates/reducer.js +0 -2
  137. package/v2Containers/Templates/tests/index.test.js +0 -10
  138. package/v2Containers/TemplatesV2/index.js +2 -3
  139. package/v2Containers/TemplatesV2/messages.js +0 -4
  140. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +35 -132
  141. package/v2Components/CapImageUrlUpload/constants.js +0 -19
  142. package/v2Components/CapImageUrlUpload/index.js +0 -455
  143. package/v2Components/CapImageUrlUpload/index.scss +0 -35
  144. package/v2Components/CapImageUrlUpload/messages.js +0 -47
  145. package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +0 -214
  146. package/v2Containers/WebPush/Create/components/ButtonForm.js +0 -175
  147. package/v2Containers/WebPush/Create/components/ButtonItem.js +0 -101
  148. package/v2Containers/WebPush/Create/components/ButtonList.js +0 -144
  149. package/v2Containers/WebPush/Create/components/_buttons.scss +0 -246
  150. package/v2Containers/WebPush/Create/components/tests/ButtonForm.test.js +0 -554
  151. package/v2Containers/WebPush/Create/components/tests/ButtonItem.test.js +0 -607
  152. package/v2Containers/WebPush/Create/components/tests/ButtonList.test.js +0 -633
  153. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonForm.test.js.snap +0 -666
  154. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonItem.test.js.snap +0 -74
  155. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonList.test.js.snap +0 -80
  156. package/v2Containers/WebPush/Create/index.js +0 -1755
  157. package/v2Containers/WebPush/Create/index.scss +0 -123
  158. package/v2Containers/WebPush/Create/messages.js +0 -199
  159. package/v2Containers/WebPush/Create/preview/DevicePreviewContent.js +0 -241
  160. package/v2Containers/WebPush/Create/preview/NotificationContainer.js +0 -290
  161. package/v2Containers/WebPush/Create/preview/PreviewContent.js +0 -81
  162. package/v2Containers/WebPush/Create/preview/PreviewControls.js +0 -240
  163. package/v2Containers/WebPush/Create/preview/PreviewDisclaimer.js +0 -23
  164. package/v2Containers/WebPush/Create/preview/WebPushPreview.js +0 -144
  165. package/v2Containers/WebPush/Create/preview/assets/Light.svg +0 -53
  166. package/v2Containers/WebPush/Create/preview/assets/Top.svg +0 -5
  167. package/v2Containers/WebPush/Create/preview/assets/chrome-icon.png +0 -0
  168. package/v2Containers/WebPush/Create/preview/assets/edge-icon.png +0 -0
  169. package/v2Containers/WebPush/Create/preview/assets/firefox-icon.svg +0 -106
  170. package/v2Containers/WebPush/Create/preview/assets/iOS.svg +0 -26
  171. package/v2Containers/WebPush/Create/preview/assets/opera-icon.svg +0 -18
  172. package/v2Containers/WebPush/Create/preview/assets/safari-icon.svg +0 -29
  173. package/v2Containers/WebPush/Create/preview/components/AndroidMobileChromeHeader.js +0 -44
  174. package/v2Containers/WebPush/Create/preview/components/AndroidMobileExpanded.js +0 -110
  175. package/v2Containers/WebPush/Create/preview/components/IOSHeader.js +0 -45
  176. package/v2Containers/WebPush/Create/preview/components/NotificationExpandedContent.js +0 -72
  177. package/v2Containers/WebPush/Create/preview/components/NotificationHeader.js +0 -55
  178. package/v2Containers/WebPush/Create/preview/components/WindowsChromeExpanded.js +0 -70
  179. package/v2Containers/WebPush/Create/preview/components/tests/AndroidMobileExpanded.test.js +0 -512
  180. package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/AndroidMobileExpanded.test.js.snap +0 -77
  181. package/v2Containers/WebPush/Create/preview/config/notificationMappings.js +0 -527
  182. package/v2Containers/WebPush/Create/preview/constants.js +0 -162
  183. package/v2Containers/WebPush/Create/preview/notification-container.scss +0 -104
  184. package/v2Containers/WebPush/Create/preview/preview.scss +0 -409
  185. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-chrome.scss +0 -300
  186. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-edge.scss +0 -12
  187. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-firefox.scss +0 -12
  188. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-opera.scss +0 -12
  189. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-chrome.scss +0 -303
  190. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-edge.scss +0 -11
  191. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-firefox.scss +0 -11
  192. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-opera.scss +0 -11
  193. package/v2Containers/WebPush/Create/preview/styles/_base.scss +0 -188
  194. package/v2Containers/WebPush/Create/preview/styles/_ios.scss +0 -106
  195. package/v2Containers/WebPush/Create/preview/styles/_ipados.scss +0 -107
  196. package/v2Containers/WebPush/Create/preview/styles/_macos-chrome.scss +0 -75
  197. package/v2Containers/WebPush/Create/preview/styles/_windows-chrome.scss +0 -174
  198. package/v2Containers/WebPush/Create/preview/tests/DevicePreviewContent.test.js +0 -909
  199. package/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +0 -1077
  200. package/v2Containers/WebPush/Create/preview/tests/PreviewControls.test.js +0 -723
  201. package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +0 -943
  202. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/DevicePreviewContent.test.js.snap +0 -128
  203. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/NotificationContainer.test.js.snap +0 -121
  204. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/PreviewControls.test.js.snap +0 -144
  205. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/WebPushPreview.test.js.snap +0 -127
  206. package/v2Containers/WebPush/Create/utils/urlValidation.js +0 -116
  207. package/v2Containers/WebPush/Create/utils/urlValidation.test.js +0 -449
  208. package/v2Containers/WebPush/actions.js +0 -60
  209. package/v2Containers/WebPush/constants.js +0 -108
  210. package/v2Containers/WebPush/index.js +0 -2
  211. package/v2Containers/WebPush/reducer.js +0 -104
  212. package/v2Containers/WebPush/sagas.js +0 -119
  213. package/v2Containers/WebPush/selectors.js +0 -65
  214. package/v2Containers/WebPush/tests/reducer.test.js +0 -863
  215. package/v2Containers/WebPush/tests/sagas.test.js +0 -566
  216. package/v2Containers/WebPush/tests/selectors.test.js +0 -960
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useRef, useCallback } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { FormattedMessage } from 'react-intl';
4
4
  import styled from 'styled-components';
@@ -11,10 +11,15 @@ import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
11
11
  import CapButton from '@capillarytech/cap-ui-library/CapButton';
12
12
  import CapError from '@capillarytech/cap-ui-library/CapError';
13
13
  import ComponentWithLabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
14
- import Email from '../../Email';
14
+ import { CAP_COLOR_06, CAP_WHITE } from '@capillarytech/cap-ui-library/styled/variables';
15
+ import { EmailWithoutSaga } from '../../Email';
15
16
  import CmsTemplatesComponent from '../../../v2Components/CmsTemplatesComponent';
17
+ import EmailHTMLEditor from './EmailHTMLEditor';
18
+ import TestAndPreviewSlidebox from '../../../v2Components/TestAndPreviewSlidebox';
19
+ import { EMAIL } from '../../CreativesContainer/constants';
16
20
  import messages from '../messages';
17
21
  import { EMAIL_CREATE_MODES, STEPS } from '../constants';
22
+ import { hasSupportCKEditor } from '../../../utils/common';
18
23
 
19
24
  const CapRadioCardWithLabel = ComponentWithLabelHOC(CapRadioCard);
20
25
 
@@ -27,9 +32,23 @@ const CardContainer = styled.div`
27
32
  }
28
33
  }
29
34
  }
35
+
36
+ .ant-radio-group.cap-radioCard-v2 {
37
+ .ant-radio-button-wrapper {
38
+ &.ant-radio-button-wrapper-checked {
39
+ .icon-container {
40
+ background-color: ${CAP_COLOR_06};
41
+ .anticon,
42
+ .cap-icon {
43
+ color: ${CAP_WHITE};
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
30
49
  `;
31
50
 
32
- // Mode selection component that handles the creation mode selection UI
51
+ // Mode selection component
33
52
  const ModeSelectionUI = ({
34
53
  isFullMode,
35
54
  templateName,
@@ -51,7 +70,7 @@ const ModeSelectionUI = ({
51
70
  value={templateName}
52
71
  labelPosition="top"
53
72
  size="default"
54
- style={{ width: '68%'}}
73
+ style={{ width: '68%' }}
55
74
  />
56
75
  )}
57
76
  <CardContainer>
@@ -98,15 +117,21 @@ ModeSelectionUI.propTypes = {
98
117
  uploadButtonLabel: PropTypes.node.isRequired,
99
118
  };
100
119
 
101
- // Content creation component that handles the email or template selection UI
120
+ // Content creation component
102
121
  const ContentCreationUI = ({
103
122
  isShowEmailCreate,
104
123
  emailProps,
105
124
  cmsTemplatesProps,
125
+ isHTMLEditorMode,
126
+ htmlEditorProps,
106
127
  }) => (
107
128
  <>
108
129
  {isShowEmailCreate ? (
109
- <Email {...emailProps} />
130
+ isHTMLEditorMode ? (
131
+ <EmailHTMLEditor {...htmlEditorProps} />
132
+ ) : (
133
+ <EmailWithoutSaga {...emailProps} />
134
+ )
110
135
  ) : (
111
136
  <CmsTemplatesComponent {...cmsTemplatesProps} />
112
137
  )}
@@ -117,6 +142,8 @@ ContentCreationUI.propTypes = {
117
142
  isShowEmailCreate: PropTypes.bool.isRequired,
118
143
  emailProps: PropTypes.object.isRequired,
119
144
  cmsTemplatesProps: PropTypes.object.isRequired,
145
+ isHTMLEditorMode: PropTypes.bool,
146
+ htmlEditorProps: PropTypes.object,
120
147
  };
121
148
 
122
149
  // Main EmailWrapper presentational component
@@ -137,9 +164,130 @@ const EmailWrapperView = ({
137
164
  isShowEmailCreate,
138
165
  emailProps,
139
166
  cmsTemplatesProps,
167
+ metaEntities,
168
+ loadingTags,
169
+ injectedTags,
170
+ globalActions,
171
+ supportedTags,
172
+ getDefaultTags,
173
+ location,
174
+ currentOrgDetails,
175
+ forwardedTags,
176
+ selectedOfferDetails,
177
+ eventContextTags,
178
+ getFormdata,
179
+ isGetFormData,
180
+ getLiquidTags,
181
+ showLiquidErrorInFooter,
182
+ onValidationFail,
183
+ emailActions,
184
+ Email,
185
+ templateData: templateDataProp,
186
+ params,
187
+ fetchingLiquidTags,
188
+ createTemplateInProgress,
189
+ fetchingCmsData,
190
+ setIsLoadingContent,
191
+ showTestAndPreviewSlidebox,
192
+ handleCloseTestAndPreview,
193
+ showTemplateName,
140
194
  }) => {
195
+ const htmlEditorRef = useRef(null);
196
+ const supportCKEditor = hasSupportCKEditor();
197
+ const hasParamsIdForEditor = params?.id || location?.query?.id || location?.params?.id || location?.pathname?.includes('/edit/');
198
+ const isEditModeForEditor = hasParamsIdForEditor;
199
+ const isBEEFromProps = emailProps?.editor === 'BEE' && emailProps?.selectedEditorMode === null;
200
+ const isDragDropFromCreateMode = emailCreateMode === EMAIL_CREATE_MODES.DRAG_DROP;
201
+ const isExplicitlyBEEEditor = isBEEFromProps || isDragDropFromCreateMode;
202
+ let isHTMLEditorMode = false;
141
203
 
142
- const isShowTemplateSelection = step === STEPS.MODE_SELECTION || (step === STEPS.TEMPLATE_SELECTION && emailCreateMode === EMAIL_CREATE_MODES.UPLOAD);
204
+ if (supportCKEditor) {
205
+ isHTMLEditorMode = false; // Legacy flow: use Email component
206
+ } else if (isEditModeForEditor) {
207
+ isHTMLEditorMode = !isExplicitlyBEEEditor;
208
+ } else {
209
+ if (isExplicitlyBEEEditor || isBEEFromProps || isDragDropFromCreateMode) {
210
+ isHTMLEditorMode = false;
211
+ } else {
212
+ isHTMLEditorMode = emailProps?.selectedEditorMode === EMAIL_CREATE_MODES.HTML_EDITOR ||
213
+ emailCreateMode === EMAIL_CREATE_MODES.HTML_EDITOR;
214
+ }
215
+ }
216
+
217
+ const isShowTemplateSelection = step === STEPS.MODE_SELECTION;
218
+
219
+ // Create onFormDataChange callback for template name updates (similar to Email component)
220
+ // This allows CreativesContainer to update the template name when user clicks "Edit name"
221
+ // When user edits the name in CreativesContainer header, it calls this callback
222
+ // which updates the template name in EmailWrapper, and then CreativesContainer
223
+ // will call showTemplateName again with the updated formData
224
+ const handleFormDataChange = useCallback((updatedFormData) => {
225
+ const newTemplateName = updatedFormData?.['template-name'] || templateName;
226
+ if (newTemplateName !== templateName && onTemplateNameChange) {
227
+ // Update template name in parent (useEmailWrapper hook)
228
+ onTemplateNameChange({ target: { value: newTemplateName } });
229
+ }
230
+ // Note: CreativesContainer will call showTemplateName again after this callback
231
+ // (it stores the callback in templateContainerDetails and calls it after state updates)
232
+ }, [templateName, onTemplateNameChange]);
233
+
234
+ const htmlEditorProps = isHTMLEditorMode ? {
235
+ // Location and params
236
+ location,
237
+ params,
238
+ // Tag-related props
239
+ getDefaultTags,
240
+ supportedTags,
241
+ metaEntities,
242
+ injectedTags,
243
+ globalActions,
244
+ loadingTags,
245
+ eventContextTags,
246
+ forwardedTags,
247
+ selectedOfferDetails,
248
+ currentOrgDetails,
249
+ // Email Redux state and actions
250
+ Email,
251
+ emailActions,
252
+ // Full mode props
253
+ isFullMode,
254
+ templateName,
255
+ isGetFormData,
256
+ getFormdata,
257
+ // Library mode props
258
+ templateData: templateDataProp,
259
+ // Uploaded content from zip file
260
+ EmailLayout,
261
+ // Liquid validation
262
+ getLiquidTags,
263
+ showLiquidErrorInFooter,
264
+ onValidationFail,
265
+ // Template name
266
+ showTemplateName,
267
+ onFormDataChange: handleFormDataChange,
268
+ // Loading states
269
+ fetchingLiquidTags: fetchingLiquidTags || false,
270
+ createTemplateInProgress: createTemplateInProgress || false,
271
+ fetchingCmsData: fetchingCmsData || false,
272
+ // Parent loading control
273
+ setIsLoadingContent,
274
+ ref: htmlEditorRef,
275
+ } : {};
276
+
277
+ // Get formData for TestAndPreviewSlidebox when needed
278
+ const getFormDataForPreview = () => {
279
+ if (htmlEditorRef.current && htmlEditorRef.current.getFormDataForPreview) {
280
+ return htmlEditorRef.current.getFormDataForPreview();
281
+ }
282
+ return {};
283
+ };
284
+
285
+ const getContentForPreview = () => {
286
+ if (htmlEditorRef.current && htmlEditorRef.current.getContentForPreview) {
287
+ return htmlEditorRef.current.getContentForPreview();
288
+ }
289
+ return '';
290
+ };
143
291
 
144
292
  return (
145
293
  <>
@@ -163,9 +311,22 @@ const EmailWrapperView = ({
163
311
  isShowEmailCreate={isShowEmailCreate}
164
312
  emailProps={emailProps}
165
313
  cmsTemplatesProps={cmsTemplatesProps}
314
+ isHTMLEditorMode={isHTMLEditorMode}
315
+ htmlEditorProps={htmlEditorProps}
166
316
  />
167
317
  )}
168
318
  </CapSpin>
319
+ {/* Render TestAndPreviewSlidebox for HTML Editor (similar to legacy Email component) */}
320
+ {isHTMLEditorMode && showTestAndPreviewSlidebox && (
321
+ <TestAndPreviewSlidebox
322
+ show={showTestAndPreviewSlidebox}
323
+ onClose={handleCloseTestAndPreview}
324
+ formData={getFormDataForPreview()}
325
+ content={getContentForPreview()}
326
+ currentChannel={EMAIL}
327
+ currentTab={1}
328
+ />
329
+ )}
169
330
  </>
170
331
  );
171
332
  };
@@ -175,6 +336,10 @@ EmailWrapperView.propTypes = {
175
336
  emailCreateMode: PropTypes.string,
176
337
  step: PropTypes.string,
177
338
  isFullMode: PropTypes.bool,
339
+ getFormdata: PropTypes.func,
340
+ isGetFormData: PropTypes.bool,
341
+ getLiquidTags: PropTypes.func,
342
+ showLiquidErrorInFooter: PropTypes.func,
178
343
  templateName: PropTypes.string,
179
344
  onTemplateNameChange: PropTypes.func.isRequired,
180
345
  isTemplateNameEmpty: PropTypes.bool,
@@ -187,6 +352,27 @@ EmailWrapperView.propTypes = {
187
352
  isShowEmailCreate: PropTypes.bool.isRequired,
188
353
  emailProps: PropTypes.object.isRequired,
189
354
  cmsTemplatesProps: PropTypes.object.isRequired,
355
+ metaEntities: PropTypes.object,
356
+ loadingTags: PropTypes.bool,
357
+ injectedTags: PropTypes.object,
358
+ globalActions: PropTypes.object,
359
+ supportedTags: PropTypes.array,
360
+ getDefaultTags: PropTypes.string,
361
+ location: PropTypes.object,
362
+ currentOrgDetails: PropTypes.object,
363
+ forwardedTags: PropTypes.object,
364
+ selectedOfferDetails: PropTypes.array,
365
+ eventContextTags: PropTypes.array,
366
+ emailActions: PropTypes.object,
367
+ Email: PropTypes.object,
368
+ templateData: PropTypes.object,
369
+ params: PropTypes.object,
370
+ fetchingLiquidTags: PropTypes.bool,
371
+ createTemplateInProgress: PropTypes.bool,
372
+ fetchingCmsData: PropTypes.bool,
373
+ setIsLoadingContent: PropTypes.func,
374
+ showTestAndPreviewSlidebox: PropTypes.bool,
375
+ handleCloseTestAndPreview: PropTypes.func,
190
376
  };
191
377
 
192
378
  export default EmailWrapperView;
@@ -24,24 +24,20 @@ const HTMLEditorTesting = () => {
24
24
  // Show/Hide editor
25
25
  show: () => {
26
26
  setIsVisible(true);
27
- console.log('✅ HTMLEditor test mode activated');
28
27
  },
29
28
 
30
29
  hide: () => {
31
30
  setIsVisible(false);
32
- console.log('✅ HTMLEditor test mode deactivated');
33
31
  },
34
32
 
35
33
  toggle: () => {
36
- setIsVisible(prev => !prev);
37
- console.log(`✅ HTMLEditor test mode ${!isVisible ? 'activated' : 'deactivated'}`);
34
+ setIsVisible((prev) => !prev);
38
35
  },
39
36
 
40
37
  // Variant control
41
38
  setVariant: (newVariant) => {
42
39
  if (['email', 'inapp'].includes(newVariant)) {
43
40
  setVariant(newVariant);
44
- console.log(`✅ Variant set to: ${newVariant}`);
45
41
  } else {
46
42
  console.error('❌ Invalid variant. Use: "email" or "inapp"');
47
43
  }
@@ -52,7 +48,6 @@ const HTMLEditorTesting = () => {
52
48
  const validLayouts = Object.values(LAYOUT_TYPES);
53
49
  if (validLayouts.includes(layout)) {
54
50
  setLayoutType(layout);
55
- console.log(`✅ Layout set to: ${layout}`);
56
51
  } else {
57
52
  console.error(`❌ Invalid layout. Use: ${validLayouts.join(', ')}`);
58
53
  }
@@ -61,58 +56,22 @@ const HTMLEditorTesting = () => {
61
56
  // Content control
62
57
  setContent: (newContent) => {
63
58
  setContent(newContent);
64
- console.log('✅ Content updated');
65
59
  },
66
60
 
67
61
  getContent: () => {
68
- console.log('Current content:', content);
69
62
  return content;
70
63
  },
71
64
 
72
65
  // Status
73
66
  status: () => {
74
- console.log('📊 HTMLEditor Test Status:');
75
- console.log(` Visible: ${isVisible}`);
76
- console.log(` Variant: ${variant}`);
77
- console.log(` Layout: ${layoutType}`);
78
- console.log(` Content size: ${content.length} chars`);
79
67
  },
80
68
 
81
69
  // Help
82
70
  help: () => {
83
- console.log(`
84
- 🚀 HTMLEditor Testing Console Commands:
85
-
86
- 📱 Basic Controls:
87
- htmlEditorTest.show() - Show the editor
88
- htmlEditorTest.hide() - Hide the editor
89
- htmlEditorTest.toggle() - Toggle editor visibility
90
-
91
- ⚙️ Configuration:
92
- htmlEditorTest.setVariant('email') - Set to email variant
93
- htmlEditorTest.setVariant('inapp') - Set to inapp variant
94
- htmlEditorTest.setLayout('POPUP') - Set layout (inapp only)
95
- - Valid: POPUP, HEADER, FOOTER, FULLSCREEN
96
-
97
- 📝 Content:
98
- htmlEditorTest.setContent('<h1>Test</h1>') - Set editor content
99
- htmlEditorTest.getContent() - Get current content
100
-
101
- 📊 Status:
102
- htmlEditorTest.status() - Show current status
103
- htmlEditorTest.help() - Show this help
104
-
105
- 💡 Example Usage:
106
- htmlEditorTest.show()
107
- htmlEditorTest.setVariant('inapp')
108
- htmlEditorTest.setLayout('HEADER') // Top banner
109
- htmlEditorTest.setLayout('FOOTER') // Bottom banner
110
- `);
111
- }
71
+ },
112
72
  };
113
73
 
114
74
  // Show help on first load
115
- console.log('🚀 HTMLEditor Testing Ready! Type htmlEditorTest.help() for commands');
116
75
 
117
76
  // Cleanup on unmount
118
77
  return () => {
@@ -128,32 +87,40 @@ const HTMLEditorTesting = () => {
128
87
  }
129
88
 
130
89
  return (
131
- <div style={{
132
- position: 'fixed',
133
- top: 0,
134
- left: 0,
135
- right: 0,
136
- bottom: 0,
137
- backgroundColor: 'rgba(0, 0, 0, 0.8)',
138
- zIndex: 9999,
139
- display: 'flex',
140
- flexDirection: 'column',
141
- padding: '20px'
142
- }}>
143
- {/* Header */}
144
- <div style={{
145
- backgroundColor: '#fff',
146
- padding: '10px 20px',
147
- borderRadius: '8px 8px 0 0',
90
+ <div
91
+ style={{
92
+ position: 'fixed',
93
+ top: 0,
94
+ left: 0,
95
+ right: 0,
96
+ bottom: 0,
97
+ backgroundColor: 'rgba(0, 0, 0, 0.8)',
98
+ zIndex: 9999,
148
99
  display: 'flex',
149
- justifyContent: 'space-between',
150
- alignItems: 'center',
151
- borderBottom: '1px solid #ddd'
100
+ flexDirection: 'column',
101
+ padding: '20px',
152
102
  }}>
103
+ {/* Header */}
104
+ <div
105
+ style={{
106
+ backgroundColor: '#fff',
107
+ padding: '10px 20px',
108
+ borderRadius: '8px 8px 0 0',
109
+ display: 'flex',
110
+ justifyContent: 'space-between',
111
+ alignItems: 'center',
112
+ borderBottom: '1px solid #ddd',
113
+ }}>
153
114
  <div>
154
115
  <strong>HTMLEditor Testing Mode</strong>
155
116
  <span style={{ marginLeft: '20px', color: '#666' }}>
156
- Variant: {variant} | Layout: {layoutType}
117
+ Variant:
118
+ {' '}
119
+ {variant}
120
+ {' '}
121
+ | Layout:
122
+ {' '}
123
+ {layoutType}
157
124
  </span>
158
125
  </div>
159
126
  <button
@@ -164,7 +131,7 @@ const HTMLEditorTesting = () => {
164
131
  border: 'none',
165
132
  padding: '5px 15px',
166
133
  borderRadius: '4px',
167
- cursor: 'pointer'
134
+ cursor: 'pointer',
168
135
  }}
169
136
  >
170
137
  Close
@@ -172,12 +139,13 @@ const HTMLEditorTesting = () => {
172
139
  </div>
173
140
 
174
141
  {/* Editor Container */}
175
- <div style={{
176
- flex: 1,
177
- backgroundColor: '#fff',
178
- borderRadius: '0 0 8px 8px',
179
- overflow: 'hidden'
180
- }}>
142
+ <div
143
+ style={{
144
+ flex: 1,
145
+ backgroundColor: '#fff',
146
+ borderRadius: '0 0 8px 8px',
147
+ overflow: 'hidden',
148
+ }}>
181
149
  <IntlProvider locale="en" messages={{}}>
182
150
  <HTMLEditor
183
151
  variant={variant}
@@ -185,10 +153,8 @@ const HTMLEditorTesting = () => {
185
153
  initialContent={content}
186
154
  onContentChange={(newContent) => {
187
155
  setContent(newContent);
188
- console.log('📝 Content changed:', newContent.substring(0, 100) + '...');
189
156
  }}
190
- onSave={(savedContent) => {
191
- console.log('💾 Content saved:', savedContent);
157
+ onSave={() => {
192
158
  }}
193
159
  />
194
160
  </IntlProvider>
@@ -47,8 +47,8 @@ describe('HTMLEditorTesting', () => {
47
47
  beforeEach(() => {
48
48
  // Mock console methods
49
49
  consoleSpy = {
50
- log: jest.spyOn(console, 'log').mockImplementation(() => {}),
51
- error: jest.spyOn(console, 'error').mockImplementation(() => {})
50
+ log: jest.spyOn(console, 'log').mockImplementation(() => { }),
51
+ error: jest.spyOn(console, 'error').mockImplementation(() => { })
52
52
  };
53
53
 
54
54
  // Clear any existing window.htmlEditorTest
@@ -88,14 +88,6 @@ describe('HTMLEditorTesting', () => {
88
88
  expect(typeof window.htmlEditorTest.status).toBe('function');
89
89
  expect(typeof window.htmlEditorTest.help).toBe('function');
90
90
  });
91
-
92
- it('logs help message on initial load', () => {
93
- render(<HTMLEditorTesting />);
94
-
95
- expect(consoleSpy.log).toHaveBeenCalledWith(
96
- '🚀 HTMLEditor Testing Ready! Type htmlEditorTest.help() for commands'
97
- );
98
- });
99
91
  });
100
92
 
101
93
  describe('Visibility Control', () => {
@@ -107,7 +99,6 @@ describe('HTMLEditorTesting', () => {
107
99
  });
108
100
 
109
101
  expect(screen.getByTestId('mock-html-editor')).toBeInTheDocument();
110
- expect(consoleSpy.log).toHaveBeenCalledWith('✅ HTMLEditor test mode activated');
111
102
  });
112
103
 
113
104
  it('hides editor when hide() is called', () => {
@@ -124,7 +115,6 @@ describe('HTMLEditorTesting', () => {
124
115
  window.htmlEditorTest.hide();
125
116
  });
126
117
  expect(screen.queryByTestId('mock-html-editor')).not.toBeInTheDocument();
127
- expect(consoleSpy.log).toHaveBeenCalledWith('✅ HTMLEditor test mode deactivated');
128
118
  });
129
119
 
130
120
  it('toggles editor visibility with toggle()', () => {
@@ -135,14 +125,11 @@ describe('HTMLEditorTesting', () => {
135
125
  window.htmlEditorTest.toggle();
136
126
  });
137
127
  expect(screen.getByTestId('mock-html-editor')).toBeInTheDocument();
138
- expect(consoleSpy.log).toHaveBeenCalledWith('✅ HTMLEditor test mode activated');
139
-
140
128
  // Toggle to hide
141
129
  act(() => {
142
130
  window.htmlEditorTest.toggle();
143
131
  });
144
132
  expect(screen.queryByTestId('mock-html-editor')).not.toBeInTheDocument();
145
- expect(consoleSpy.log).toHaveBeenCalledWith('✅ HTMLEditor test mode deactivated');
146
133
  });
147
134
 
148
135
  it('closes editor when close button is clicked', () => {
@@ -169,7 +156,6 @@ describe('HTMLEditorTesting', () => {
169
156
  });
170
157
 
171
158
  expect(screen.getByTestId('editor-variant')).toHaveTextContent('email');
172
- expect(consoleSpy.log).toHaveBeenCalledWith('✅ Variant set to: email');
173
159
  });
174
160
 
175
161
  it('sets variant to inapp', () => {
@@ -181,7 +167,6 @@ describe('HTMLEditorTesting', () => {
181
167
  });
182
168
 
183
169
  expect(screen.getByTestId('editor-variant')).toHaveTextContent('inapp');
184
- expect(consoleSpy.log).toHaveBeenCalledWith('✅ Variant set to: inapp');
185
170
  });
186
171
 
187
172
  it('rejects invalid variant', () => {
@@ -215,7 +200,6 @@ describe('HTMLEditorTesting', () => {
215
200
  });
216
201
 
217
202
  expect(screen.getByTestId('editor-layout')).toHaveTextContent(LAYOUT_TYPES.MODAL);
218
- expect(consoleSpy.log).toHaveBeenCalledWith(`✅ Layout set to: ${LAYOUT_TYPES.MODAL}`);
219
203
  });
220
204
 
221
205
  it('sets layout to HEADER', () => {
@@ -227,7 +211,6 @@ describe('HTMLEditorTesting', () => {
227
211
  });
228
212
 
229
213
  expect(screen.getByTestId('editor-layout')).toHaveTextContent(LAYOUT_TYPES.HEADER);
230
- expect(consoleSpy.log).toHaveBeenCalledWith(`✅ Layout set to: ${LAYOUT_TYPES.HEADER}`);
231
214
  });
232
215
 
233
216
  it('sets layout to FOOTER', () => {
@@ -239,7 +222,6 @@ describe('HTMLEditorTesting', () => {
239
222
  });
240
223
 
241
224
  expect(screen.getByTestId('editor-layout')).toHaveTextContent(LAYOUT_TYPES.FOOTER);
242
- expect(consoleSpy.log).toHaveBeenCalledWith(`✅ Layout set to: ${LAYOUT_TYPES.FOOTER}`);
243
225
  });
244
226
 
245
227
  it('sets layout to FULLSCREEN', () => {
@@ -251,7 +233,6 @@ describe('HTMLEditorTesting', () => {
251
233
  });
252
234
 
253
235
  expect(screen.getByTestId('editor-layout')).toHaveTextContent(LAYOUT_TYPES.FULLSCREEN);
254
- expect(consoleSpy.log).toHaveBeenCalledWith(`✅ Layout set to: ${LAYOUT_TYPES.FULLSCREEN}`);
255
236
  });
256
237
 
257
238
  it('rejects invalid layout', () => {
@@ -289,7 +270,6 @@ describe('HTMLEditorTesting', () => {
289
270
  });
290
271
 
291
272
  expect(screen.getByTestId('editor-content')).toHaveTextContent(newContent);
292
- expect(consoleSpy.log).toHaveBeenCalledWith('✅ Content updated');
293
273
  });
294
274
 
295
275
  it('gets current content', () => {
@@ -298,7 +278,6 @@ describe('HTMLEditorTesting', () => {
298
278
  const result = window.htmlEditorTest.getContent();
299
279
 
300
280
  expect(result).toBe('<h1>Test HTML Editor</h1><p>This is a test integration.</p>');
301
- expect(consoleSpy.log).toHaveBeenCalledWith('Current content:', result);
302
281
  });
303
282
 
304
283
  it('starts with default content', () => {
@@ -322,8 +301,6 @@ describe('HTMLEditorTesting', () => {
322
301
 
323
302
  const changeButton = screen.getByTestId('trigger-content-change');
324
303
  fireEvent.click(changeButton);
325
-
326
- expect(consoleSpy.log).toHaveBeenCalledWith('📝 Content changed:', '<p>Changed content</p>...');
327
304
  });
328
305
 
329
306
  it('handles save callback', () => {
@@ -335,46 +312,6 @@ describe('HTMLEditorTesting', () => {
335
312
 
336
313
  const saveButton = screen.getByTestId('trigger-save');
337
314
  fireEvent.click(saveButton);
338
-
339
- expect(consoleSpy.log).toHaveBeenCalledWith('💾 Content saved:', '<p>Saved content</p>');
340
- });
341
- });
342
-
343
- describe('Status and Help', () => {
344
- it('shows status information', () => {
345
- render(<HTMLEditorTesting />);
346
-
347
- act(() => {
348
- window.htmlEditorTest.show();
349
- window.htmlEditorTest.setVariant('inapp');
350
- window.htmlEditorTest.setLayout(LAYOUT_TYPES.HEADER);
351
- });
352
-
353
- // Clear previous console calls
354
- consoleSpy.log.mockClear();
355
-
356
- act(() => {
357
- window.htmlEditorTest.status();
358
- });
359
-
360
- expect(consoleSpy.log).toHaveBeenCalledWith('📊 HTMLEditor Test Status:');
361
- expect(consoleSpy.log).toHaveBeenCalledWith(' Visible: true');
362
- expect(consoleSpy.log).toHaveBeenCalledWith(' Variant: inapp');
363
- expect(consoleSpy.log).toHaveBeenCalledWith(' Layout: HEADER');
364
- expect(consoleSpy.log).toHaveBeenCalledWith(' Content size: 59 chars');
365
- });
366
-
367
- it('shows help information', () => {
368
- render(<HTMLEditorTesting />);
369
-
370
- act(() => {
371
- window.htmlEditorTest.help();
372
- });
373
-
374
- expect(consoleSpy.log).toHaveBeenCalledWith(expect.stringContaining('🚀 HTMLEditor Testing Console Commands:'));
375
- expect(consoleSpy.log).toHaveBeenCalledWith(expect.stringContaining('htmlEditorTest.show()'));
376
- expect(consoleSpy.log).toHaveBeenCalledWith(expect.stringContaining('htmlEditorTest.setVariant(\'email\')'));
377
- expect(consoleSpy.log).toHaveBeenCalledWith(expect.stringContaining('htmlEditorTest.setLayout(\'POPUP\')'));
378
315
  });
379
316
  });
380
317
 
@@ -470,8 +407,6 @@ describe('HTMLEditorTesting', () => {
470
407
  act(() => {
471
408
  window.htmlEditorTest.status();
472
409
  });
473
-
474
- expect(consoleSpy.log).toHaveBeenCalledWith(` Content size: ${customContent.length} chars`);
475
410
  });
476
411
 
477
412
  it('handles multiple rapid operations', () => {
@@ -8,6 +8,8 @@ export const DEFAULT_ACTION = "app/EmailWrapper/DEFAULT_ACTION";
8
8
  export const EMAIL_CREATE_MODES = {
9
9
  UPLOAD: "upload",
10
10
  EDITOR: "editor",
11
+ HTML_EDITOR: "html_editor",
12
+ DRAG_DROP: "drag_drop",
11
13
  };
12
14
 
13
15
  export const STEPS = {