@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
@@ -8,43 +8,33 @@
8
8
  * - Theme support with proper styling
9
9
  */
10
10
 
11
- import React, {
12
- forwardRef, useImperativeHandle, useRef, useEffect, useCallback,
13
- } from 'react';
11
+ import React, { forwardRef, useImperativeHandle, useRef, useEffect, useState } from 'react';
14
12
  import PropTypes from 'prop-types';
15
13
 
16
14
  // CodeMirror 6 imports
17
15
  import { EditorState } from '@codemirror/state';
18
- import {
19
- EditorView, lineNumbers, highlightActiveLine, placeholder,
20
- } from '@codemirror/view';
16
+ import { EditorView, lineNumbers, highlightActiveLine } from '@codemirror/view';
21
17
 
22
- // Define Theme and Highlighting inline to avoid "multiple instances of @codemirror/state" error
18
+ // Import our comprehensive syntax highlighting solution
19
+ import { createRobustExtensions } from '../../utils/properSyntaxHighlighting';
23
20
 
24
21
 
25
22
  import { injectIntl, intlShape } from 'react-intl';
26
23
 
27
24
  // Messages
28
- import CapRow from '@capillarytech/cap-ui-library/CapRow';
29
25
  import messages from '../../messages';
30
26
 
31
27
  // Cap UI Components
28
+ import CapRow from '@capillarytech/cap-ui-library/CapRow';
32
29
 
33
30
  // Components
34
31
  import TagList from '../../../../v2Containers/TagList';
35
- import ValidationErrorDisplay from '../ValidationErrorDisplay';
36
-
37
- // Constants - removed unused imports since tag fetching is handled by parent
38
32
 
39
33
  // Context
40
34
  import { useEditorContext } from '../common/EditorContext';
41
35
 
42
36
  // Styles
43
37
  import './_codeEditorPane.scss';
44
- import { INAPP } from '../../../../constants/unified';
45
-
46
- // Define Theme and Highlighting inline to avoid "multiple instances of @codemirror/state" error
47
-
48
38
 
49
39
  // Legacy CodeMirrorEditor removed - using enhanced implementation only
50
40
 
@@ -52,25 +42,12 @@ const CodeEditorPaneComponent = ({
52
42
  intl,
53
43
  readOnly = false,
54
44
  className = '',
55
- forwardedRef,
56
- // Tag-related props - tags are fetched and managed by parent component
57
- tags = [],
58
- injectedTags = {},
59
- location,
60
- eventContextTags = [],
61
- selectedOfferDetails = [],
62
- channel,
63
- userLocale = 'en',
64
- moduleFilterEnabled = true,
65
- onTagContextChange,
66
- // Validation props
67
- onErrorClick,
45
+ isFullscreenMode = false,
46
+ onLabelInsert,
47
+ forwardedRef
68
48
  }) => {
69
- const context = useEditorContext();
70
- const {
71
- content, validation, variant, isLiquidEnabled,
72
- } = context || {};
73
- const { content: contentValue, updateContent } = content || {};
49
+ const { content, validation } = useEditorContext();
50
+ const { content: contentValue, updateContent } = content;
74
51
  const editorRef = useRef(null);
75
52
  const viewRef = useRef(null);
76
53
 
@@ -84,7 +61,7 @@ const CodeEditorPaneComponent = ({
84
61
  get view() {
85
62
  return viewRef.current;
86
63
  },
87
- viewRef, // For compatibility with existing code
64
+ viewRef: viewRef, // For compatibility with existing code
88
65
 
89
66
  focus: () => {
90
67
  if (viewRef.current) {
@@ -98,7 +75,7 @@ const CodeEditorPaneComponent = ({
98
75
  const pos = position !== undefined ? position : head;
99
76
  view.dispatch({
100
77
  changes: { from: pos, insert: text },
101
- selection: { anchor: pos + text.length },
78
+ selection: { anchor: pos + text.length }
102
79
  });
103
80
  } else {
104
81
  throw new Error('CodeMirror view not initialized');
@@ -111,7 +88,9 @@ const CodeEditorPaneComponent = ({
111
88
  }
112
89
  return 0;
113
90
  },
114
- getValue: () => contentValue || '',
91
+ getValue: () => {
92
+ return contentValue || '';
93
+ },
115
94
  setValue: (value) => {
116
95
  updateContent(value);
117
96
  },
@@ -128,7 +107,7 @@ const CodeEditorPaneComponent = ({
128
107
 
129
108
  view.dispatch({
130
109
  selection: { anchor: pos },
131
- effects: EditorView.scrollIntoView(pos, { y: 'center' }),
110
+ effects: EditorView.scrollIntoView(pos, { y: 'center' })
132
111
  });
133
112
  view.focus();
134
113
  } catch (error) {
@@ -138,7 +117,7 @@ const CodeEditorPaneComponent = ({
138
117
  }
139
118
  }
140
119
  }
141
- },
120
+ }
142
121
  }), [contentValue]);
143
122
 
144
123
  // Note: handleContentChange removed - using updateContentRef directly in CodeMirror
@@ -154,9 +133,7 @@ const CodeEditorPaneComponent = ({
154
133
  if (typeof tagData === 'string') {
155
134
  tagText = tagData;
156
135
  } else if (tagData) {
157
- const {
158
- text, name, label, value,
159
- } = tagData;
136
+ const { text, name, label, value } = tagData;
160
137
  tagText = text || name || label || value;
161
138
  if (!tagText) {
162
139
  console.warn('Invalid tag data:', tagData);
@@ -170,67 +147,49 @@ const CodeEditorPaneComponent = ({
170
147
  // For unified HTML editor, insert as template variable
171
148
  const formattedTag = `{{${tagText}}}`;
172
149
 
173
- // Insert the tag at cursor position directly
150
+ // Insert the tag at cursor position
174
151
  view.dispatch({
175
152
  changes: { from: pos, insert: formattedTag },
176
- selection: { anchor: pos + formattedTag.length },
153
+ selection: { anchor: pos + formattedTag.length }
177
154
  });
178
155
 
179
156
  // Focus back to editor
180
157
  view.focus();
181
158
 
182
- // Note: We don't call onLabelInsert here because:
183
- // 1. The tag is already inserted directly into the editor
184
- // 2. onLabelInsert (handleLabelInsert from HTMLEditor) would try to insert again
185
- // 3. This causes "Editor method not available" error
186
- // The direct insertion via view.dispatch is sufficient
159
+ // Call the parent's handleLabelInsert if available
160
+ if (onLabelInsert) {
161
+ onLabelInsert(formattedTag, pos);
162
+ }
187
163
  }
188
164
  };
189
165
 
190
- // Handle tag context change - delegate to parent component
191
- // Tags are fetched in parent components (EmailHTMLEditor, INAPP, etc.)
192
- // This component just passes the context change event up
193
- const handleTagContextChange = useCallback((data) => {
194
- if (onTagContextChange) {
195
- // Parent component handles tag fetching and updates
196
- onTagContextChange(data);
197
- }
198
- // No fallback - tags must be managed by parent component
199
- }, [onTagContextChange]);
200
-
201
166
  // Initialize CodeMirror effect
202
167
  useEffect(() => {
203
168
  if (editorRef.current && !viewRef.current) {
204
- // Determine placeholder text based on channel
205
- let placeholderText = intl.formatMessage(messages.editorPlaceholderEmail); // Default to email
206
- if (channel === INAPP || channel === INAPP.toUpperCase()) {
207
- placeholderText = intl.formatMessage(messages.editorPlaceholderInapp);
208
- }
209
-
210
- // Add additional extensions for line numbers, active line, placeholder, line wrapping, and update listener
211
- const extensions = [
212
- lineNumbers(),
213
- highlightActiveLine(),
214
- placeholder(placeholderText),
215
- EditorView.lineWrapping, // Enable soft-wrapping of long lines
216
- // html(), // 1. HTML language support - TEMPORARILY DISABLED due to version conflict
217
- // syntaxHighlighting(comprehensiveVSCodeTheme), // 2. Syntax highlighting - TEMPORARILY DISABLED
218
- // cleanEditorTheme, // 3. Theme - TEMPORARILY DISABLED
219
- EditorView.updateListener.of((update) => {
220
- if (update.docChanged) {
221
- updateContentRef.current(update.state.doc.toString());
222
- }
223
- }),
224
- ];
169
+ // Use the comprehensive extensions from properSyntaxHighlighting.js
170
+ // This includes: html(), syntaxHighlighting(comprehensiveVSCodeTheme), cleanEditorTheme
171
+ const robustExtensions = createRobustExtensions();
172
+
173
+ // Add additional extensions for line numbers, active line, and update listener
174
+ const extensions = [
175
+ lineNumbers(),
176
+ highlightActiveLine(),
177
+ ...robustExtensions, // Spread the robust extensions (html, syntax highlighting, theme)
178
+ EditorView.updateListener.of((update) => {
179
+ if (update.docChanged) {
180
+ updateContentRef.current(update.state.doc.toString());
181
+ }
182
+ })
183
+ ];
225
184
 
226
185
  const state = EditorState.create({
227
186
  doc: contentValue || '',
228
- extensions,
187
+ extensions
229
188
  });
230
189
 
231
190
  viewRef.current = new EditorView({
232
191
  state,
233
- parent: editorRef.current,
192
+ parent: editorRef.current
234
193
  });
235
194
  }
236
195
 
@@ -245,74 +204,116 @@ const CodeEditorPaneComponent = ({
245
204
  viewRef.current = null;
246
205
  }
247
206
  };
248
- }, [channel, intl]);
207
+ }, []);
249
208
 
250
209
  // Update editor content when content changes
251
210
  useEffect(() => {
252
- if (viewRef.current && contentValue && contentValue !== viewRef.current.state.doc.toString()) {
211
+ if (viewRef.current && contentValue !== viewRef.current.state.doc.toString()) {
253
212
  const { current: view } = viewRef;
254
213
  const { state: { doc: { length } } } = view;
255
214
  view.dispatch({
256
215
  changes: {
257
216
  from: 0,
258
217
  to: length,
259
- insert: contentValue || '',
260
- },
218
+ insert: contentValue || ''
219
+ }
261
220
  });
262
221
  }
263
222
  }, [contentValue]);
264
223
 
265
- return (
266
- <CapRow className={`code-editor-pane ${className}`}>
267
- {/* Code Editor Content - Stacked vertically with validation */}
268
- <div
269
- className="code-editor-pane__wrapper"
270
- style={{
271
- display: 'flex', flexDirection: 'column', height: '100%', width: '100%',
272
- }}>
273
- {/* Code Editor with Floating Add Label Button */}
274
- <div className="codemirror-wrapper" style={{ flex: '1 1 auto', minHeight: 0 }}>
275
- <div ref={editorRef} className="codemirror-editor" />
276
- {/* Floating Add Label Button */}
277
- <CapRow className="code-editor-pane__actions">
278
- <TagList
279
- key="html-editor-taglist"
280
- label={intl.formatMessage(messages.addLabel)}
281
- onTagSelect={handleTagSelect}
282
- onContextChange={handleTagContextChange}
283
- className="tag-list-trigger"
284
- tags={tags}
285
- injectedTags={injectedTags}
286
- moduleFilterEnabled={moduleFilterEnabled}
287
- userLocale={userLocale}
288
- channel={channel}
289
- disabled={readOnly}
290
- location={location}
291
- selectedOfferDetails={selectedOfferDetails}
292
- eventContextTags={eventContextTags}
293
- popoverPlacement="rightTop"
294
- />
295
- </CapRow>
296
- </div>
297
-
298
- {/* Validation Error Display - Below editor, always visible */}
299
- <ValidationErrorDisplay
300
- validation={validation}
301
- onErrorClick={onErrorClick}
302
- isLiquidEnabled={isLiquidEnabled}
303
- className="code-editor-pane__validation"
304
- />
305
- </div>
306
- </CapRow>
307
- );
224
+ return (
225
+ <CapRow className={`code-editor-pane ${className}`}>
226
+ {/* Unified Code Editor with Floating Add Label Button */}
227
+ <CapRow className="code-editor-pane__content">
228
+ <div className="codemirror-wrapper">
229
+ <div ref={editorRef} className="codemirror-editor" />
230
+ {/* Floating Add Label Button */}
231
+ <CapRow className="code-editor-pane__actions">
232
+ <TagList
233
+ key="html-editor-taglist"
234
+ label={intl.formatMessage(messages.addLabel)}
235
+ onTagSelect={handleTagSelect}
236
+ onContextChange={(context) => {
237
+ }}
238
+ className="tag-list-trigger"
239
+ tags={[]} // Empty initially - TagList will fetch from API
240
+ injectedTags={{
241
+ // Add common HTML/Email specific tags as fallback
242
+ 'Customer Info': {
243
+ name: 'Customer Info',
244
+ desc: 'Customer information tags',
245
+ resolved: true,
246
+ 'tag-header': true,
247
+ subtags: {
248
+ 'customer.firstName': {
249
+ name: 'First Name',
250
+ desc: 'Customer first name',
251
+ resolved: true
252
+ },
253
+ 'customer.lastName': {
254
+ name: 'Last Name',
255
+ desc: 'Customer last name',
256
+ resolved: true
257
+ },
258
+ 'customer.email': {
259
+ name: 'Email',
260
+ desc: 'Customer email address',
261
+ resolved: true
262
+ },
263
+ 'customer.phone': {
264
+ name: 'Phone',
265
+ desc: 'Customer phone number',
266
+ resolved: true
267
+ }
268
+ }
269
+ },
270
+ 'Common Tags': {
271
+ name: 'Common Tags',
272
+ desc: 'Commonly used template tags',
273
+ resolved: true,
274
+ 'tag-header': true,
275
+ subtags: {
276
+ 'organization.name': {
277
+ name: 'Organization Name',
278
+ desc: 'Organization name',
279
+ resolved: true
280
+ },
281
+ 'currentDate': {
282
+ name: 'Current Date',
283
+ desc: 'Current date',
284
+ resolved: true
285
+ },
286
+ 'unsubscribeLink': {
287
+ name: 'Unsubscribe Link',
288
+ desc: 'Unsubscribe link',
289
+ resolved: true
290
+ }
291
+ }
292
+ }
293
+ }}
294
+ moduleFilterEnabled={true}
295
+ userLocale="en"
296
+ channel="email"
297
+ disabled={readOnly}
298
+ location={{
299
+ query: {
300
+ type: 'html-editor' // Identify the context
301
+ }
302
+ }}
303
+ selectedOfferDetails={[]}
304
+ eventContextTags={[]}
305
+ />
306
+ </CapRow>
307
+ </div>
308
+ </CapRow>
309
+
310
+ </CapRow>
311
+ );
308
312
  };
309
313
 
310
- // Apply injectIntl to the component first, then wrap with forwardRef
311
- const CodeEditorPaneWithIntl = injectIntl(CodeEditorPaneComponent);
312
-
313
- // Create the forwardRef wrapper that forwards ref to the intl-wrapped component
314
+ // Create the forwardRef wrapper
314
315
  const CodeEditorPane = forwardRef((props, ref) => (
315
- <CodeEditorPaneWithIntl {...props} forwardedRef={ref} />
316
+ <CodeEditorPaneComponent {...props} forwardedRef={ref} />
316
317
  ));
317
318
 
318
319
  CodeEditorPane.displayName = 'CodeEditorPane';
@@ -322,19 +323,9 @@ CodeEditorPane.propTypes = {
322
323
  readOnly: PropTypes.bool,
323
324
  className: PropTypes.string,
324
325
  isFullscreenMode: PropTypes.bool,
325
- onLabelInsert: PropTypes.func,
326
- onErrorClick: PropTypes.func,
327
- // Tag-related props - tags are fetched and managed by parent component
328
- tags: PropTypes.array,
329
- injectedTags: PropTypes.object,
330
- location: PropTypes.object,
331
- eventContextTags: PropTypes.array,
332
- selectedOfferDetails: PropTypes.array,
333
- channel: PropTypes.string,
334
- userLocale: PropTypes.string,
335
- moduleFilterEnabled: PropTypes.bool,
336
- onTagContextChange: PropTypes.func, // Required - parent must handle tag fetching
326
+ onLabelInsert: PropTypes.func
337
327
  };
338
328
 
339
- // Export the forwardRef-wrapped component
340
- export default CodeEditorPane;
329
+ // Export with injectIntl - ref forwarding is handled by forwardRef wrapper
330
+ export default injectIntl(CodeEditorPane);
331
+
@@ -9,7 +9,7 @@
9
9
  .html-editor .device-toggle {
10
10
  display: flex;
11
11
  align-items: center;
12
- margin-left: 2.5rem;
12
+ gap: 1rem;
13
13
  padding: 0;
14
14
  background-color: $CAP_G10;
15
15
  border-radius: 0.25rem 0.25rem 0 0;
@@ -220,7 +220,6 @@
220
220
 
221
221
  // Integration with editor toolbar
222
222
  .html-editor.html-editor--inapp {
223
- margin-top: 4%;
224
223
  .editor-toolbar {
225
224
  padding: 0 1rem 0 0; // Remove left padding to align with device toggle
226
225
  background-color: $CAP_G10;
@@ -32,7 +32,7 @@ const DeviceToggle = ({
32
32
  onDeviceChange,
33
33
  keepContentSame = false,
34
34
  onKeepContentSameChange,
35
- className = '',
35
+ className = ''
36
36
  }) => {
37
37
  const handleDeviceClick = (device) => {
38
38
  if (onDeviceChange && device !== activeDevice) {
@@ -97,7 +97,7 @@ DeviceToggle.propTypes = {
97
97
  onDeviceChange: PropTypes.func,
98
98
  keepContentSame: PropTypes.bool,
99
99
  onKeepContentSameChange: PropTypes.func,
100
- className: PropTypes.string,
100
+ className: PropTypes.string
101
101
  };
102
102
 
103
103
  DeviceToggle.defaultProps = {
@@ -105,7 +105,7 @@ DeviceToggle.defaultProps = {
105
105
  onDeviceChange: null,
106
106
  keepContentSame: false,
107
107
  onKeepContentSameChange: null,
108
- className: '',
108
+ className: ''
109
109
  };
110
110
 
111
111
  export default injectIntl(DeviceToggle);
@@ -81,7 +81,7 @@ const EditorToolbar = ({
81
81
  )}
82
82
  aria-pressed={isFullscreenMode}
83
83
  >
84
- <CapIcon type={isFullscreenMode ? "collapse2" : "expander"} size="m" />
84
+ <CapIcon type={isFullscreenMode ? "minimizer" : "expander"} size="m" />
85
85
  </CapButton>
86
86
  )}
87
87
  </CapRow>
@@ -49,7 +49,6 @@ body .ant-modal-mask+.ant-modal-wrap .ant-modal.html-editor-fullscreen-modal .an
49
49
  padding: 0;
50
50
  min-height: 3.25rem;
51
51
  height: 3.25rem;
52
- position: relative;
53
52
 
54
53
  &__right {
55
54
  margin-left: auto;
@@ -14,7 +14,9 @@ const DeviceFrame = ({
14
14
  className = '',
15
15
  ...props
16
16
  }) => {
17
- const getFrameAsset = () => device === DEVICE_TYPES.IOS ? iosFrame : androidFrame;
17
+ const getFrameAsset = () => {
18
+ return device === DEVICE_TYPES.IOS ? iosFrame : androidFrame;
19
+ };
18
20
 
19
21
  const getFrameStyles = () => {
20
22
  const baseStyles = {
@@ -24,13 +26,14 @@ const DeviceFrame = ({
24
26
  backgroundRepeat: 'no-repeat',
25
27
  backgroundPosition: 'center',
26
28
  backgroundSize: 'contain',
29
+ filter: 'drop-shadow(0 12px 48px rgba(0, 0, 0, 0.25)) brightness(1.05) contrast(1.1)'
27
30
  };
28
31
 
29
32
  // Unified dimensions - both devices use the same size since assets are identical
30
33
  return {
31
34
  ...baseStyles,
32
35
  width: '450px',
33
- height: '920px',
36
+ height: '920px'
34
37
  };
35
38
  };
36
39
 
@@ -42,7 +45,7 @@ const DeviceFrame = ({
42
45
  {...props}
43
46
  >
44
47
 
45
- {children}
48
+ {children}
46
49
 
47
50
  </div>
48
51
  );
@@ -51,7 +54,7 @@ const DeviceFrame = ({
51
54
  DeviceFrame.propTypes = {
52
55
  device: PropTypes.oneOf(Object.values(DEVICE_TYPES)),
53
56
  children: PropTypes.node,
54
- className: PropTypes.string,
57
+ className: PropTypes.string
55
58
  };
56
59
 
57
60
  export default DeviceFrame;