@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,14 +1,16 @@
1
- import _, { isEmpty, find } from 'lodash';
2
- import { renderHook, waitFor, act as reactAct } from '@testing-library/react';
1
+ import React from 'react';
3
2
  import useEmailWrapper from '../hooks/useEmailWrapper';
4
3
  import { EmailWrapperMockData } from '../mockdata/mockdata';
4
+ import _, { isEmpty, find } from 'lodash';
5
+ import { renderHook, waitFor, act as reactAct } from '@testing-library/react';
5
6
  import { EMAIL_CREATE_MODES, STEPS } from '../constants';
7
+ import { GA } from '@capillarytech/cap-ui-utils';
6
8
  import { gtmPush } from '../../../utils/gtmTrackers';
7
9
 
8
10
  // Mock dependencies
9
11
  jest.mock('lodash', () => ({
10
12
  ...jest.requireActual('lodash'),
11
- isEmpty: jest.fn().mockImplementation((val) => {
13
+ isEmpty: jest.fn().mockImplementation(val => {
12
14
  if (val === null || val === undefined) return true;
13
15
  if (typeof val === 'object') return Object.keys(val).length === 0;
14
16
  if (typeof val === 'string') return val.trim().length === 0;
@@ -29,10 +31,6 @@ jest.mock('../../../utils/gtmTrackers', () => ({
29
31
  gtmPush: jest.fn(),
30
32
  }));
31
33
 
32
- jest.mock('../../../utils/common', () => ({
33
- hasSupportCKEditor: jest.fn(() => true), // Default to legacy flow
34
- }));
35
-
36
34
  const mockStopTimer = jest.fn();
37
35
 
38
36
  jest.mock('@capillarytech/cap-ui-utils', () => ({
@@ -41,8 +39,8 @@ jest.mock('@capillarytech/cap-ui-utils', () => ({
41
39
  timeTracker: {
42
40
  startTimer: jest.fn(),
43
41
  stopTimer: jest.fn(),
44
- },
45
- },
42
+ }
43
+ }
46
44
  }));
47
45
 
48
46
  describe('useEmailWrapper', () => {
@@ -56,12 +54,12 @@ describe('useEmailWrapper', () => {
56
54
  gtmPush.mockClear();
57
55
  mockStopTimer.mockClear();
58
56
 
59
- isEmpty.mockImplementation((val) => {
60
- if (val === null || val === undefined) return true;
61
- if (typeof val === 'object') return Object.keys(val).length === 0;
62
- if (typeof val === 'string') return val.trim().length === 0;
63
- return !val;
64
- });
57
+ isEmpty.mockImplementation(val => {
58
+ if (val === null || val === undefined) return true;
59
+ if (typeof val === 'object') return Object.keys(val).length === 0;
60
+ if (typeof val === 'string') return val.trim().length === 0;
61
+ return !val;
62
+ });
65
63
 
66
64
  mockProps = {
67
65
  ...EmailWrapperMockData,
@@ -151,8 +149,7 @@ describe('useEmailWrapper', () => {
151
149
  result.current.onChange({ target: { value: EMAIL_CREATE_MODES.UPLOAD } });
152
150
  });
153
151
 
154
- // onEmailModeChange is called with (mappedValue, value) - both are UPLOAD in this case
155
- expect(mockProps.onEmailModeChange).toHaveBeenCalledWith(EMAIL_CREATE_MODES.UPLOAD, EMAIL_CREATE_MODES.UPLOAD);
152
+ expect(mockProps.onEmailModeChange).toHaveBeenCalledWith(EMAIL_CREATE_MODES.UPLOAD);
156
153
  });
157
154
 
158
155
  it('handles zip file upload correctly and calls success callbacks', () => {
@@ -171,7 +168,7 @@ describe('useEmailWrapper', () => {
171
168
  const mockFile = {
172
169
  name: 'test.zip',
173
170
  size: 1024 * 1024,
174
- originFileObj: new Blob(['test data'], { type: 'application/zip' }),
171
+ originFileObj: new Blob(['test data'], { type: 'application/zip' })
175
172
  };
176
173
 
177
174
  reactAct(() => {
@@ -204,7 +201,7 @@ describe('useEmailWrapper', () => {
204
201
  const mockFile = {
205
202
  name: 'test.zip',
206
203
  size: 1024 * 1024,
207
- originFileObj: new Blob(['test data'], { type: 'application/zip' }),
204
+ originFileObj: new Blob(['test data'], { type: 'application/zip' })
208
205
  };
209
206
 
210
207
  reactAct(() => {
@@ -221,13 +218,13 @@ describe('useEmailWrapper', () => {
221
218
  const mockFile = {
222
219
  name: 'test.html',
223
220
  size: 1024,
224
- originFileObj: new Blob([mockHtmlContent], { type: 'text/html' }),
221
+ originFileObj: new Blob([mockHtmlContent], { type: 'text/html' })
225
222
  };
226
223
 
227
224
  const mockReader = {
228
225
  onload: null,
229
226
  onerror: null,
230
- readAsText: jest.fn(function () {
227
+ readAsText: jest.fn(function() {
231
228
  this.result = mockHtmlContent;
232
229
  if (this.onload) {
233
230
  this.onload();
@@ -260,13 +257,13 @@ describe('useEmailWrapper', () => {
260
257
  it('shows error for invalid file type during upload', () => {
261
258
  const { result } = renderHook(() => useEmailWrapper({
262
259
  ...mockProps,
263
- isUploading: false,
260
+ isUploading: false
264
261
  }));
265
262
 
266
263
  const mockFile = {
267
264
  name: 'test.txt',
268
265
  size: 1024,
269
- originFileObj: new Blob(['test data'], { type: 'text/plain' }),
266
+ originFileObj: new Blob(['test data'], { type: 'text/plain' })
270
267
  };
271
268
 
272
269
  reactAct(() => {
@@ -283,13 +280,13 @@ describe('useEmailWrapper', () => {
283
280
  it('shows error for oversized file during upload', () => {
284
281
  const { result } = renderHook(() => useEmailWrapper({
285
282
  ...mockProps,
286
- isUploading: false,
283
+ isUploading: false
287
284
  }));
288
285
 
289
286
  const mockFile = {
290
287
  name: 'large_file.zip',
291
288
  size: 6 * 1024 * 1024,
292
- originFileObj: new Blob(['large data'], { type: 'application/zip' }),
289
+ originFileObj: new Blob(['large data'], { type: 'application/zip' })
293
290
  };
294
291
 
295
292
  reactAct(() => {
@@ -297,7 +294,7 @@ describe('useEmailWrapper', () => {
297
294
  });
298
295
 
299
296
  expect(mockCapNotificationError).toHaveBeenCalledWith(expect.objectContaining({
300
- key: "email-upload-error",
297
+ key: "email-upload-error",
301
298
  }));
302
299
  expect(mockProps.templatesActions.handleZipUpload).not.toHaveBeenCalled();
303
300
  });
@@ -305,21 +302,21 @@ describe('useEmailWrapper', () => {
305
302
  it('shows error if no file or originFileObj is provided for upload', () => {
306
303
  const { result } = renderHook(() => useEmailWrapper({
307
304
  ...mockProps,
308
- isUploading: false,
305
+ isUploading: false
309
306
  }));
310
307
 
311
308
  reactAct(() => {
312
309
  result.current.useFileUpload({ file: null });
313
310
  });
314
311
  expect(mockCapNotificationError).toHaveBeenCalledTimes(1);
315
- expect(mockCapNotificationError).toHaveBeenCalledWith(expect.objectContaining({ key: "email-upload-error" }));
312
+ expect(mockCapNotificationError).toHaveBeenCalledWith(expect.objectContaining({ key: "email-upload-error"}));
316
313
 
317
314
  mockCapNotificationError.mockClear();
318
315
  reactAct(() => {
319
- result.current.useFileUpload({ file: { name: 'test.zip', size: 100 } });
316
+ result.current.useFileUpload({ file: { name: 'test.zip', size: 100 } });
320
317
  });
321
318
  expect(mockCapNotificationError).toHaveBeenCalledTimes(1);
322
- expect(mockCapNotificationError).toHaveBeenCalledWith(expect.objectContaining({ key: "email-upload-error" }));
319
+ expect(mockCapNotificationError).toHaveBeenCalledWith(expect.objectContaining({ key: "email-upload-error"}));
323
320
 
324
321
  expect(mockProps.templatesActions.handleZipUpload).not.toHaveBeenCalled();
325
322
  expect(mockProps.templatesActions.handleHtmlUpload).not.toHaveBeenCalled();
@@ -338,10 +335,6 @@ describe('useEmailWrapper', () => {
338
335
  });
339
336
 
340
337
  it('calls getDefaultBeeTemplates in useEffect when in EDITOR mode, TEMPLATE_SELECTION step, and no templates', () => {
341
- // Ensure hasSupportCKEditor returns true for legacy flow
342
- const { hasSupportCKEditor } = require('../../../utils/common');
343
- hasSupportCKEditor.mockReturnValue(true);
344
-
345
338
  renderHook(() => useEmailWrapper({
346
339
  ...mockProps,
347
340
  step: STEPS.TEMPLATE_SELECTION,
@@ -374,9 +367,6 @@ describe('useEmailWrapper', () => {
374
367
  });
375
368
 
376
369
  it('calls setEdmTemplate/setBEETemplate in useEffect when in EDITOR mode and CREATE_TEMPLATE_CONTENT step', async () => {
377
- // Ensure hasSupportCKEditor returns true for legacy flow
378
- const { hasSupportCKEditor } = require('../../../utils/common');
379
- hasSupportCKEditor.mockReturnValue(true);
380
370
  // 1. Setup
381
371
  const templateId = 'editorTemplate456';
382
372
  const mockTemplateData = { _id: templateId, name: 'Selected Editor Template' };
@@ -407,7 +397,7 @@ describe('useEmailWrapper', () => {
407
397
  // selectedCreateMode is initially '' from hook's useState
408
398
  };
409
399
  const { result, rerender } = renderHook((props) => useEmailWrapper(props), {
410
- initialProps,
400
+ initialProps: initialProps
411
401
  });
412
402
 
413
403
  // 4. Simulate user selecting a template ID via the exposed callback (useEditor)
@@ -419,21 +409,17 @@ describe('useEmailWrapper', () => {
419
409
  expect(result.current.modeContent).toEqual({ id: templateId }); // State updated
420
410
  expect(mockProps.showNextStep).toHaveBeenCalledTimes(1); // User action effect
421
411
 
422
- // Clear mocks after user action to isolate effect calls
423
- mockProps.templatesActions.setEdmTemplate.mockClear();
424
- mockProps.templatesActions.setBEETemplate.mockClear();
425
-
426
412
  // 5. Rerender with step changed to CREATE_TEMPLATE_CONTENT
427
413
  const createContentProps = {
428
414
  ...initialProps, // Base props
429
415
  step: STEPS.CREATE_TEMPLATE_CONTENT, // *** Change step ***
430
- SelectedEdmDefaultTemplate: null, // *** Ensure this is null ***
416
+ SelectedEdmDefaultTemplate: null // *** Ensure this is null ***
431
417
  // The internal state `modeContent = { id: templateId }` persists
432
418
  // The internal state `selectedCreateMode = ''` also persists (not changed yet)
433
419
  };
434
420
 
435
421
  // Mock isEmpty just before rerender for the specific check inside the effect
436
- isEmpty.mockImplementation((val) => {
422
+ isEmpty.mockImplementation(val => {
437
423
  // console.log('DEBUG: isEmpty called with', JSON.stringify(val)); // Optional debug
438
424
  // Return true ONLY for the 'SelectedEdmDefaultTemplate' check (which is null)
439
425
  if (val === null) return true;
@@ -448,48 +434,28 @@ describe('useEmailWrapper', () => {
448
434
 
449
435
  // 6. Wait for effects triggered by the rerender
450
436
  await reactAct(async () => {
451
- // Allow React to process the rerender and run effects
452
- await new Promise((resolve) => setTimeout(resolve, 10));
437
+ // Short pause allows React's scheduler to run effects
438
+ await new Promise(resolve => setTimeout(resolve, 0));
453
439
  });
454
440
 
441
+
455
442
  // Assert that the template setting actions were called as a result of the effect
456
- // Note: The effect may run multiple times in React 18+ StrictMode or due to dependency changes
457
- // We verify that it was called at least once with the correct data after clearing mocks
458
- const setEdmTemplateCalls = mockProps.templatesActions.setEdmTemplate.mock.calls;
459
- const setBEETemplateCalls = mockProps.templatesActions.setBEETemplate.mock.calls;
460
-
461
- // The effect should call handleEdmDefaultTemplateSelection, which calls both functions
462
- // We expect at least 1 call each after clearing mocks (the effect call)
463
- expect(setEdmTemplateCalls.length).toBeGreaterThanOrEqual(1);
464
- expect(setBEETemplateCalls.length).toBeGreaterThanOrEqual(1);
465
-
466
- // Verify the first call after clearing was with the correct data
467
- expect(setEdmTemplateCalls[0]).toEqual([mockTemplateData]);
468
- expect(setBEETemplateCalls[0]).toEqual([mockTemplateData]);
469
-
470
- // If there are multiple calls (due to effect running twice), verify all are correct
471
- if (setEdmTemplateCalls.length > 1) {
472
- setEdmTemplateCalls.forEach((call) => {
473
- expect(call).toEqual([mockTemplateData]);
474
- });
475
- }
476
- if (setBEETemplateCalls.length > 1) {
477
- setBEETemplateCalls.forEach((call) => {
478
- expect(call).toEqual([mockTemplateData]);
479
- });
480
- }
443
+ expect(mockProps.templatesActions.setEdmTemplate).toHaveBeenCalledTimes(1);
444
+ expect(mockProps.templatesActions.setEdmTemplate).toHaveBeenCalledWith(mockTemplateData);
445
+ expect(mockProps.templatesActions.setBEETemplate).toHaveBeenCalledTimes(1);
446
+ expect(mockProps.templatesActions.setBEETemplate).toHaveBeenCalledWith(mockTemplateData);
481
447
  });
482
448
 
483
449
  it('sets selectedCreateMode in useEffect when in UPLOAD mode and CREATE_TEMPLATE_CONTENT step with EmailLayout', async () => {
484
450
  const initialRenderProps = {
485
- ...mockProps,
486
- step: STEPS.MODE_SELECTION,
487
- emailCreateMode: EMAIL_CREATE_MODES.UPLOAD,
488
- EmailLayout: null,
489
- };
451
+ ...mockProps,
452
+ step: STEPS.MODE_SELECTION,
453
+ emailCreateMode: EMAIL_CREATE_MODES.UPLOAD,
454
+ EmailLayout: null,
455
+ };
490
456
 
491
457
  const { result, rerender } = renderHook((props) => useEmailWrapper(props), {
492
- initialProps: initialRenderProps,
458
+ initialProps: initialRenderProps
493
459
  });
494
460
 
495
461
  const rerenderProps = {
@@ -501,11 +467,11 @@ describe('useEmailWrapper', () => {
501
467
 
502
468
  // Reset isEmpty to default before setting the specific mock for the effect
503
469
  isEmpty.mockImplementation((val) => {
504
- if (val === null || val === undefined) return true;
505
- if (typeof val === 'object') return Object.keys(val).length === 0;
506
- if (typeof val === 'string') return val.trim().length === 0;
507
- return !val;
508
- });
470
+ if (val === null || val === undefined) return true;
471
+ if (typeof val === 'object') return Object.keys(val).length === 0;
472
+ if (typeof val === 'string') return val.trim().length === 0;
473
+ return !val;
474
+ });
509
475
  // Mock isEmpty specifically for the EmailLayout check inside the useEffect
510
476
  isEmpty.mockImplementationOnce(() => false); // Mock !isEmpty(EmailLayout) to be true
511
477
 
@@ -513,16 +479,16 @@ describe('useEmailWrapper', () => {
513
479
 
514
480
  // Wait for the effect to run, set selectedCreateMode, and isShowEmailCreate to update
515
481
  await waitFor(() => {
516
- expect(result.current.isShowEmailCreate).toBe(true);
482
+ expect(result.current.isShowEmailCreate).toBe(true);
517
483
  });
518
484
 
519
485
  // Restore default isEmpty behavior after the specific mock is used
520
486
  isEmpty.mockImplementation((val) => {
521
- if (val === null || val === undefined) return true;
522
- if (typeof val === 'object') return Object.keys(val).length === 0;
523
- if (typeof val === 'string') return val.trim().length === 0;
524
- return !val;
525
- });
487
+ if (val === null || val === undefined) return true;
488
+ if (typeof val === 'object') return Object.keys(val).length === 0;
489
+ if (typeof val === 'string') return val.trim().length === 0;
490
+ return !val;
491
+ });
526
492
  isEmpty.mockClear(); // Clear any remaining mock state if needed
527
493
 
528
494
  expect(mockProps.templatesActions.setEdmTemplate).not.toHaveBeenCalled();
@@ -567,11 +533,11 @@ describe('useEmailWrapper', () => {
567
533
 
568
534
  // Reset isEmpty to default before setting the specific mock for the effect
569
535
  isEmpty.mockImplementation((val) => {
570
- if (val === null || val === undefined) return true;
571
- if (typeof val === 'object') return Object.keys(val).length === 0;
572
- if (typeof val === 'string') return val.trim().length === 0;
573
- return !val;
574
- });
536
+ if (val === null || val === undefined) return true;
537
+ if (typeof val === 'object') return Object.keys(val).length === 0;
538
+ if (typeof val === 'string') return val.trim().length === 0;
539
+ return !val;
540
+ });
575
541
  // Mock isEmpty specifically for the EmailLayout check inside the useEffect
576
542
  isEmpty.mockImplementationOnce(() => false); // Mock !isEmpty(EmailLayout) to be true
577
543
 
@@ -579,16 +545,16 @@ describe('useEmailWrapper', () => {
579
545
 
580
546
  // Wait for the effect to run, set selectedCreateMode, and isShowEmailCreate to update
581
547
  await waitFor(() => {
582
- expect(result.current.isShowEmailCreate).toBe(true);
548
+ expect(result.current.isShowEmailCreate).toBe(true);
583
549
  });
584
550
 
585
551
  // Restore default isEmpty behavior after the specific mock is used
586
552
  isEmpty.mockImplementation((val) => {
587
- if (val === null || val === undefined) return true;
588
- if (typeof val === 'object') return Object.keys(val).length === 0;
589
- if (typeof val === 'string') return val.trim().length === 0;
590
- return !val;
591
- });
553
+ if (val === null || val === undefined) return true;
554
+ if (typeof val === 'object') return Object.keys(val).length === 0;
555
+ if (typeof val === 'string') return val.trim().length === 0;
556
+ return !val;
557
+ });
592
558
  isEmpty.mockClear(); // Clear any remaining mock state if needed
593
559
 
594
560
  // --- Case 3: EDITOR mode selected, Template becomes available -> true (via effect) ---
@@ -597,11 +563,11 @@ describe('useEmailWrapper', () => {
597
563
  find.mockReturnValue(mockTemplate); // Ensure find is mocked for this case
598
564
 
599
565
  const editorPropsInitial = {
600
- ...mockProps,
601
- step: STEPS.TEMPLATE_SELECTION,
602
- emailCreateMode: EMAIL_CREATE_MODES.EDITOR,
603
- CmsTemplates: [mockTemplate],
604
- SelectedEdmDefaultTemplate: null,
566
+ ...mockProps,
567
+ step: STEPS.TEMPLATE_SELECTION,
568
+ emailCreateMode: EMAIL_CREATE_MODES.EDITOR,
569
+ CmsTemplates: [mockTemplate],
570
+ SelectedEdmDefaultTemplate: null,
605
571
  };
606
572
  rerender(editorPropsInitial);
607
573
 
@@ -613,12 +579,12 @@ describe('useEmailWrapper', () => {
613
579
  expect(result.current.modeContent).toEqual({ id: templateId });
614
580
 
615
581
  const editorPropsFinal = {
616
- ...mockProps, // Use fresh props base
617
- step: STEPS.CREATE_TEMPLATE_CONTENT, // Move to the create step
618
- emailCreateMode: EMAIL_CREATE_MODES.EDITOR,
619
- CmsTemplates: [mockTemplate],
620
- SelectedEdmDefaultTemplate: null, // Template not yet selected in props
621
- // modeContent state ({id: templateId}) should persist internally from the reactAct call
582
+ ...mockProps, // Use fresh props base
583
+ step: STEPS.CREATE_TEMPLATE_CONTENT, // Move to the create step
584
+ emailCreateMode: EMAIL_CREATE_MODES.EDITOR,
585
+ CmsTemplates: [mockTemplate],
586
+ SelectedEdmDefaultTemplate: null, // Template not yet selected in props
587
+ // modeContent state ({id: templateId}) should persist internally from the reactAct call
622
588
  };
623
589
 
624
590
  // Mock isEmpty specifically for the check within the useEffect triggered by rerender
@@ -632,4 +598,4 @@ describe('useEmailWrapper', () => {
632
598
  find.mockClear();
633
599
  isEmpty.mockClear();
634
600
  });
635
- });
601
+ });
@@ -7,7 +7,6 @@ import {
7
7
  UPLOAD_INAPP_ASSET_REQUEST,
8
8
  CLEAR_INAPP_ASSET,
9
9
  INAPP_EDIT_TEMPLATE_REQUEST,
10
- GET_BEE_POPUP_BUILDER_TOKEN_REQUEST,
11
10
  } from "./constants";
12
11
 
13
12
  export function createInAppTemplate(payload, callback) {
@@ -63,9 +62,3 @@ export const clearInAppAsset = (templateType) => ({
63
62
  type: CLEAR_INAPP_ASSET,
64
63
  templateType,
65
64
  });
66
-
67
- export function getBeePopupBuilderToken() {
68
- return {
69
- type: GET_BEE_POPUP_BUILDER_TOKEN_REQUEST,
70
- };
71
- }
@@ -34,18 +34,12 @@ export const UPLOAD_INAPP_ASSET_SUCCESS = `${prefix}/UPLOAD_INAPP_ASSET_SUCCESS`
34
34
  export const UPLOAD_INAPP_ASSET_FAILURE = `${prefix}/UPLOAD_INAPP_ASSET_FAILURE`;
35
35
  export const CLEAR_INAPP_ASSET = `${prefix}/CLEAR_INAPP_ASSET`;
36
36
 
37
- export const GET_BEE_POPUP_BUILDER_TOKEN_REQUEST = `${prefix}/GET_BEE_POPUP_BUILDER_TOKEN_REQUEST`;
38
- export const GET_BEE_POPUP_BUILDER_TOKEN_SUCCESS = `${prefix}/GET_BEE_POPUP_BUILDER_TOKEN_SUCCESS`;
39
- export const GET_BEE_POPUP_BUILDER_TOKEN_FAILURE = `${prefix}/GET_BEE_POPUP_BUILDER_TOKEN_FAILURE`;
40
-
41
37
  export const INAPP_MEDIA_TYPES = {
42
38
  TEXT: "TEXT",
43
39
  IMAGE: "IMAGE",
44
- HTML: "HTML",
45
40
  };
46
41
  export const BIG_TEXT = 'BIG_TEXT';
47
42
  export const BIG_PICTURE = 'BIG_PICTURE';
48
- export const BIG_HTML = 'BIG_HTML';
49
43
  export const NONE = "NONE";
50
44
  export const CTA = "CTA";
51
45
  export const MAPP_SDK = "MAPP_SDK";
@@ -76,16 +70,14 @@ export const INAPP_IMG_SIZE = 5000000; // 5MB
76
70
  export const TEMPLATE_MESSAGE_MAX_LENGTH = 1024;
77
71
 
78
72
  export const INAPP_MESSAGE_LAYOUT_TYPES = {
79
- MODAL: "MODAL",
73
+ MODAL: "POPUP",
80
74
  TOPBANNER: "HEADER",
81
75
  BOTTOMBANNER: "FOOTER",
82
76
  FULLSCREEN: "FULLSCREEN",
83
- POPUP: "POPUP",
84
77
  };
85
78
 
86
79
  export const ANDROID = "ANDROID";
87
80
  export const IOS = "iOS";
88
- export const IOS_CAPITAL = "IOS";
89
81
  export const LAYOUT_RADIO_OPTIONS = [
90
82
  {
91
83
  value: INAPP_MESSAGE_LAYOUT_TYPES.MODAL,
@@ -144,11 +136,6 @@ export const BUTTON_RADIO_OPTIONS = [
144
136
  ];
145
137
 
146
138
  export const INAPP_LAYOUT_DETAILS = {
147
- MODAL: {
148
- tagColor: CAP_ORANGE01,
149
- tagTextColor: CAP_ORANGE,
150
- text: <FormattedMessage {...messages.layoutModal} />,
151
- },
152
139
  POPUP: {
153
140
  tagColor: CAP_ORANGE01,
154
141
  tagTextColor: CAP_ORANGE,
@@ -157,12 +144,12 @@ export const INAPP_LAYOUT_DETAILS = {
157
144
  HEADER: {
158
145
  tagColor: CAP_PURPLE03,
159
146
  tagTextColor: CAP_PURPLE02,
160
- text: <FormattedMessage {...messages.layoutTopBanner} />,
147
+ text: <FormattedMessage {...messages.header} />,
161
148
  },
162
149
  FOOTER: {
163
150
  tagColor: CAP_PALE_GREY,
164
151
  tagTextColor: FONT_COLOR_05,
165
- text: <FormattedMessage {...messages.layoutBottomBanner} />,
152
+ text: <FormattedMessage {...messages.footer} />,
166
153
  },
167
154
  FULLSCREEN: {
168
155
  tagColor: CAP_GREEN02,
@@ -172,7 +159,4 @@ export const INAPP_LAYOUT_DETAILS = {
172
159
  };
173
160
 
174
161
  export const DEVICE_SUPPORTED = '1';
175
- export const AI_CONTENT_BOT_DISABLED = "AI_CONTENT_BOT_DISABLED";
176
- export const MODE_SELECTION = "modeSelection";
177
- export const BASIC_EDITOR = "basicEditor";
178
- export const BEE_EDITOR = "beeEditor";
162
+ export const AI_CONTENT_BOT_DISABLED = "AI_CONTENT_BOT_DISABLED";