@capillarytech/creatives-library 8.0.255-alpha.4 → 8.0.255

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 (278) hide show
  1. package/assets/Android.png +0 -0
  2. package/assets/iOS.png +0 -0
  3. package/constants/unified.js +2 -2
  4. package/initialReducer.js +2 -0
  5. package/package.json +1 -1
  6. package/services/api.js +10 -5
  7. package/services/tests/api.test.js +34 -0
  8. package/translations/en.json +3 -4
  9. package/utils/common.js +5 -6
  10. package/utils/commonUtils.js +28 -5
  11. package/utils/tests/commonUtil.test.js +224 -0
  12. package/utils/tests/transformerUtils.test.js +0 -297
  13. package/utils/transformTemplateConfig.js +0 -10
  14. package/utils/transformerUtils.js +0 -40
  15. package/v2Components/CapDeviceContent/index.js +61 -56
  16. package/v2Components/CapImageUpload/constants.js +0 -2
  17. package/v2Components/CapImageUpload/index.js +16 -65
  18. package/v2Components/CapImageUpload/index.scss +1 -4
  19. package/v2Components/CapImageUpload/messages.js +1 -5
  20. package/v2Components/CapTagList/index.js +6 -1
  21. package/v2Components/CapTagListWithInput/index.js +5 -1
  22. package/v2Components/CapTagListWithInput/messages.js +1 -1
  23. package/v2Components/CapWhatsappCTA/tests/index.test.js +5 -0
  24. package/v2Components/ErrorInfoNote/constants.js +1 -0
  25. package/v2Components/ErrorInfoNote/index.js +457 -72
  26. package/v2Components/ErrorInfoNote/messages.js +36 -6
  27. package/v2Components/ErrorInfoNote/style.scss +282 -6
  28. package/v2Components/FormBuilder/tests/index.test.js +13 -4
  29. package/v2Components/HtmlEditor/HTMLEditor.js +547 -94
  30. package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +874 -0
  31. package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +1441 -133
  32. package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +27 -16
  33. package/v2Components/HtmlEditor/_htmlEditor.scss +108 -45
  34. package/v2Components/HtmlEditor/_index.lazy.scss +0 -1
  35. package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +23 -102
  36. package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +148 -140
  37. package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +2 -1
  38. package/v2Components/HtmlEditor/components/DeviceToggle/index.js +3 -3
  39. package/v2Components/HtmlEditor/components/EditorToolbar/_editorToolbar.scss +9 -0
  40. package/v2Components/HtmlEditor/components/EditorToolbar/index.js +4 -4
  41. package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +22 -0
  42. package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +4 -7
  43. package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +35 -45
  44. package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +1 -3
  45. package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +33 -33
  46. package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +7 -6
  47. package/v2Components/HtmlEditor/components/PreviewPane/_previewPane.scss +3 -6
  48. package/v2Components/HtmlEditor/components/PreviewPane/index.js +22 -43
  49. package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +1 -1
  50. package/v2Components/HtmlEditor/components/ValidationErrorDisplay/_validationErrorDisplay.scss +1 -0
  51. package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +49 -31
  52. package/v2Components/HtmlEditor/components/ValidationPanel/_validationPanel.scss +50 -34
  53. package/v2Components/HtmlEditor/components/ValidationPanel/constants.js +6 -0
  54. package/v2Components/HtmlEditor/components/ValidationPanel/index.js +70 -41
  55. package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +255 -0
  56. package/v2Components/HtmlEditor/components/ValidationTabs/index.js +364 -0
  57. package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +51 -0
  58. package/v2Components/HtmlEditor/constants.js +42 -20
  59. package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +373 -16
  60. package/v2Components/HtmlEditor/hooks/__tests__/useValidation.test.js +103 -0
  61. package/v2Components/HtmlEditor/hooks/useEditorContent.js +5 -2
  62. package/v2Components/HtmlEditor/hooks/useInAppContent.js +88 -146
  63. package/v2Components/HtmlEditor/hooks/useValidation.js +189 -53
  64. package/v2Components/HtmlEditor/index.js +1 -1
  65. package/v2Components/HtmlEditor/messages.js +92 -94
  66. package/v2Components/HtmlEditor/utils/__tests__/htmlValidator.enhanced.test.js +94 -45
  67. package/v2Components/HtmlEditor/utils/__tests__/validationAdapter.test.js +134 -0
  68. package/v2Components/HtmlEditor/utils/contentSanitizer.js +40 -41
  69. package/v2Components/HtmlEditor/utils/htmlValidator.js +71 -72
  70. package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +134 -102
  71. package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +23 -25
  72. package/v2Components/HtmlEditor/utils/validationAdapter.js +66 -41
  73. package/v2Components/HtmlEditor/utils/validationConstants.js +40 -0
  74. package/v2Components/MobilePushPreviewV2/index.js +32 -7
  75. package/v2Components/TemplatePreview/_templatePreview.scss +55 -24
  76. package/v2Components/TemplatePreview/index.js +47 -32
  77. package/v2Components/TemplatePreview/messages.js +4 -0
  78. package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +1 -0
  79. package/v2Containers/App/constants.js +0 -5
  80. package/v2Containers/BeeEditor/index.js +172 -90
  81. package/v2Containers/BeePopupEditor/_beePopupEditor.scss +14 -0
  82. package/v2Containers/BeePopupEditor/constants.js +10 -0
  83. package/v2Containers/BeePopupEditor/index.js +194 -0
  84. package/v2Containers/BeePopupEditor/tests/index.test.js +627 -0
  85. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +3 -4
  86. package/v2Containers/CreativesContainer/SlideBoxContent.js +129 -107
  87. package/v2Containers/CreativesContainer/SlideBoxFooter.js +163 -13
  88. package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -2
  89. package/v2Containers/CreativesContainer/constants.js +1 -3
  90. package/v2Containers/CreativesContainer/index.js +239 -214
  91. package/v2Containers/CreativesContainer/messages.js +8 -4
  92. package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +0 -210
  93. package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +11 -2
  94. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +38 -354
  95. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +106 -0
  96. package/v2Containers/Email/actions.js +7 -0
  97. package/v2Containers/Email/constants.js +5 -1
  98. package/v2Containers/Email/index.js +234 -29
  99. package/v2Containers/Email/messages.js +32 -0
  100. package/v2Containers/Email/reducer.js +12 -1
  101. package/v2Containers/Email/sagas.js +61 -7
  102. package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +2 -0
  103. package/v2Containers/Email/tests/reducer.test.js +46 -0
  104. package/v2Containers/Email/tests/sagas.test.js +320 -29
  105. package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +1285 -0
  106. package/v2Containers/EmailWrapper/components/EmailWrapperView.js +211 -21
  107. package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +40 -74
  108. package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +1880 -0
  109. package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +520 -0
  110. package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +2 -67
  111. package/v2Containers/EmailWrapper/constants.js +2 -0
  112. package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +629 -77
  113. package/v2Containers/EmailWrapper/index.js +103 -23
  114. package/v2Containers/EmailWrapper/messages.js +65 -1
  115. package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +643 -0
  116. package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +594 -77
  117. package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +376 -0
  118. package/v2Containers/InApp/__tests__/sagas.test.js +363 -0
  119. package/v2Containers/InApp/actions.js +7 -0
  120. package/v2Containers/InApp/constants.js +20 -4
  121. package/v2Containers/InApp/index.js +802 -359
  122. package/v2Containers/InApp/index.scss +4 -3
  123. package/v2Containers/InApp/messages.js +7 -3
  124. package/v2Containers/InApp/reducer.js +21 -3
  125. package/v2Containers/InApp/sagas.js +29 -9
  126. package/v2Containers/InApp/selectors.js +25 -5
  127. package/v2Containers/InApp/tests/index.test.js +154 -50
  128. package/v2Containers/InApp/tests/reducer.test.js +34 -0
  129. package/v2Containers/InApp/tests/sagas.test.js +61 -9
  130. package/v2Containers/InApp/tests/selectors.test.js +612 -0
  131. package/v2Containers/InAppWrapper/components/InAppWrapperView.js +151 -0
  132. package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +267 -0
  133. package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +23 -0
  134. package/v2Containers/InAppWrapper/constants.js +16 -0
  135. package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +473 -0
  136. package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +198 -0
  137. package/v2Containers/InAppWrapper/index.js +148 -0
  138. package/v2Containers/InAppWrapper/messages.js +49 -0
  139. package/v2Containers/InappAdvance/index.js +1099 -0
  140. package/v2Containers/InappAdvance/index.scss +10 -0
  141. package/v2Containers/InappAdvance/tests/index.test.js +448 -0
  142. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +15 -36
  143. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +8 -8
  144. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +77 -100
  145. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +63 -72
  146. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +190 -250
  147. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +12 -16
  148. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +40 -48
  149. package/v2Containers/TagList/index.js +62 -19
  150. package/v2Containers/Templates/ChannelTypeIllustration.js +1 -13
  151. package/v2Containers/Templates/_templates.scss +56 -202
  152. package/v2Containers/Templates/actions.js +1 -2
  153. package/v2Containers/Templates/constants.js +0 -1
  154. package/v2Containers/Templates/index.js +123 -278
  155. package/v2Containers/Templates/messages.js +4 -24
  156. package/v2Containers/Templates/reducer.js +0 -2
  157. package/v2Containers/Templates/tests/index.test.js +0 -10
  158. package/v2Containers/TemplatesV2/index.js +7 -15
  159. package/v2Containers/TemplatesV2/messages.js +0 -4
  160. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +768 -1272
  161. package/utils/imageUrlUpload.js +0 -141
  162. package/v2Components/CapImageUrlUpload/constants.js +0 -26
  163. package/v2Components/CapImageUrlUpload/index.js +0 -365
  164. package/v2Components/CapImageUrlUpload/index.scss +0 -35
  165. package/v2Components/CapImageUrlUpload/messages.js +0 -47
  166. package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +0 -152
  167. package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +0 -214
  168. package/v2Containers/WebPush/Create/components/BrandIconSection.js +0 -108
  169. package/v2Containers/WebPush/Create/components/ButtonForm.js +0 -172
  170. package/v2Containers/WebPush/Create/components/ButtonItem.js +0 -101
  171. package/v2Containers/WebPush/Create/components/ButtonList.js +0 -145
  172. package/v2Containers/WebPush/Create/components/ButtonsLinksSection.js +0 -164
  173. package/v2Containers/WebPush/Create/components/ButtonsLinksSection.test.js +0 -463
  174. package/v2Containers/WebPush/Create/components/FormActions.js +0 -54
  175. package/v2Containers/WebPush/Create/components/FormActions.test.js +0 -163
  176. package/v2Containers/WebPush/Create/components/MediaSection.js +0 -142
  177. package/v2Containers/WebPush/Create/components/MediaSection.test.js +0 -341
  178. package/v2Containers/WebPush/Create/components/MessageSection.js +0 -103
  179. package/v2Containers/WebPush/Create/components/MessageSection.test.js +0 -268
  180. package/v2Containers/WebPush/Create/components/NotificationTitleSection.js +0 -87
  181. package/v2Containers/WebPush/Create/components/NotificationTitleSection.test.js +0 -210
  182. package/v2Containers/WebPush/Create/components/TemplateNameSection.js +0 -54
  183. package/v2Containers/WebPush/Create/components/TemplateNameSection.test.js +0 -143
  184. package/v2Containers/WebPush/Create/components/__snapshots__/ButtonsLinksSection.test.js.snap +0 -86
  185. package/v2Containers/WebPush/Create/components/__snapshots__/FormActions.test.js.snap +0 -16
  186. package/v2Containers/WebPush/Create/components/__snapshots__/MediaSection.test.js.snap +0 -41
  187. package/v2Containers/WebPush/Create/components/__snapshots__/MessageSection.test.js.snap +0 -54
  188. package/v2Containers/WebPush/Create/components/__snapshots__/NotificationTitleSection.test.js.snap +0 -37
  189. package/v2Containers/WebPush/Create/components/__snapshots__/TemplateNameSection.test.js.snap +0 -21
  190. package/v2Containers/WebPush/Create/components/_buttons.scss +0 -246
  191. package/v2Containers/WebPush/Create/components/tests/ButtonForm.test.js +0 -554
  192. package/v2Containers/WebPush/Create/components/tests/ButtonItem.test.js +0 -607
  193. package/v2Containers/WebPush/Create/components/tests/ButtonList.test.js +0 -633
  194. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonForm.test.js.snap +0 -666
  195. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonItem.test.js.snap +0 -74
  196. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonList.test.js.snap +0 -78
  197. package/v2Containers/WebPush/Create/hooks/useButtonManagement.js +0 -138
  198. package/v2Containers/WebPush/Create/hooks/useButtonManagement.test.js +0 -406
  199. package/v2Containers/WebPush/Create/hooks/useCharacterCount.js +0 -30
  200. package/v2Containers/WebPush/Create/hooks/useCharacterCount.test.js +0 -151
  201. package/v2Containers/WebPush/Create/hooks/useImageUpload.js +0 -104
  202. package/v2Containers/WebPush/Create/hooks/useImageUpload.test.js +0 -538
  203. package/v2Containers/WebPush/Create/hooks/useTagManagement.js +0 -122
  204. package/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +0 -633
  205. package/v2Containers/WebPush/Create/index.js +0 -1148
  206. package/v2Containers/WebPush/Create/index.scss +0 -134
  207. package/v2Containers/WebPush/Create/messages.js +0 -203
  208. package/v2Containers/WebPush/Create/preview/DevicePreviewContent.js +0 -228
  209. package/v2Containers/WebPush/Create/preview/NotificationContainer.js +0 -294
  210. package/v2Containers/WebPush/Create/preview/PreviewContent.js +0 -90
  211. package/v2Containers/WebPush/Create/preview/PreviewControls.js +0 -305
  212. package/v2Containers/WebPush/Create/preview/PreviewDisclaimer.js +0 -23
  213. package/v2Containers/WebPush/Create/preview/WebPushPreview.js +0 -155
  214. package/v2Containers/WebPush/Create/preview/assets/Light.svg +0 -53
  215. package/v2Containers/WebPush/Create/preview/assets/Top.svg +0 -5
  216. package/v2Containers/WebPush/Create/preview/assets/android-arrow-down.svg +0 -9
  217. package/v2Containers/WebPush/Create/preview/assets/android-arrow-up.svg +0 -9
  218. package/v2Containers/WebPush/Create/preview/assets/chrome-icon.png +0 -0
  219. package/v2Containers/WebPush/Create/preview/assets/edge-icon.png +0 -0
  220. package/v2Containers/WebPush/Create/preview/assets/firefox-icon.svg +0 -106
  221. package/v2Containers/WebPush/Create/preview/assets/iOS.svg +0 -26
  222. package/v2Containers/WebPush/Create/preview/assets/macos-arrow-down-icon.svg +0 -9
  223. package/v2Containers/WebPush/Create/preview/assets/macos-triple-dot-icon.svg +0 -9
  224. package/v2Containers/WebPush/Create/preview/assets/opera-icon.svg +0 -18
  225. package/v2Containers/WebPush/Create/preview/assets/safari-icon.svg +0 -29
  226. package/v2Containers/WebPush/Create/preview/assets/windows-close-icon.svg +0 -9
  227. package/v2Containers/WebPush/Create/preview/assets/windows-triple-dot-icon.svg +0 -9
  228. package/v2Containers/WebPush/Create/preview/components/AndroidMobileChromeHeader.js +0 -47
  229. package/v2Containers/WebPush/Create/preview/components/AndroidMobileExpanded.js +0 -141
  230. package/v2Containers/WebPush/Create/preview/components/IOSHeader.js +0 -45
  231. package/v2Containers/WebPush/Create/preview/components/NotificationExpandedContent.js +0 -68
  232. package/v2Containers/WebPush/Create/preview/components/NotificationHeader.js +0 -61
  233. package/v2Containers/WebPush/Create/preview/components/WindowsChromeExpanded.js +0 -99
  234. package/v2Containers/WebPush/Create/preview/components/tests/AndroidMobileExpanded.test.js +0 -733
  235. package/v2Containers/WebPush/Create/preview/components/tests/WindowsChromeExpanded.test.js +0 -571
  236. package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/AndroidMobileExpanded.test.js.snap +0 -81
  237. package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/WindowsChromeExpanded.test.js.snap +0 -81
  238. package/v2Containers/WebPush/Create/preview/config/notificationMappings.js +0 -50
  239. package/v2Containers/WebPush/Create/preview/constants.js +0 -637
  240. package/v2Containers/WebPush/Create/preview/notification-container.scss +0 -79
  241. package/v2Containers/WebPush/Create/preview/preview.scss +0 -351
  242. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-chrome.scss +0 -370
  243. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-edge.scss +0 -12
  244. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-firefox.scss +0 -12
  245. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-opera.scss +0 -12
  246. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-chrome.scss +0 -47
  247. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-edge.scss +0 -11
  248. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-firefox.scss +0 -11
  249. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-opera.scss +0 -11
  250. package/v2Containers/WebPush/Create/preview/styles/_base.scss +0 -207
  251. package/v2Containers/WebPush/Create/preview/styles/_ios.scss +0 -153
  252. package/v2Containers/WebPush/Create/preview/styles/_ipados.scss +0 -107
  253. package/v2Containers/WebPush/Create/preview/styles/_macos-chrome.scss +0 -101
  254. package/v2Containers/WebPush/Create/preview/styles/_windows-chrome.scss +0 -229
  255. package/v2Containers/WebPush/Create/preview/tests/DevicePreviewContent.test.js +0 -909
  256. package/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +0 -1081
  257. package/v2Containers/WebPush/Create/preview/tests/PreviewControls.test.js +0 -723
  258. package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +0 -1327
  259. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/DevicePreviewContent.test.js.snap +0 -131
  260. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/NotificationContainer.test.js.snap +0 -112
  261. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/PreviewControls.test.js.snap +0 -144
  262. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/WebPushPreview.test.js.snap +0 -129
  263. package/v2Containers/WebPush/Create/utils/payloadBuilder.js +0 -96
  264. package/v2Containers/WebPush/Create/utils/payloadBuilder.test.js +0 -396
  265. package/v2Containers/WebPush/Create/utils/previewUtils.js +0 -89
  266. package/v2Containers/WebPush/Create/utils/urlValidation.js +0 -115
  267. package/v2Containers/WebPush/Create/utils/urlValidation.test.js +0 -449
  268. package/v2Containers/WebPush/Create/utils/validation.js +0 -75
  269. package/v2Containers/WebPush/Create/utils/validation.test.js +0 -283
  270. package/v2Containers/WebPush/actions.js +0 -60
  271. package/v2Containers/WebPush/constants.js +0 -132
  272. package/v2Containers/WebPush/index.js +0 -2
  273. package/v2Containers/WebPush/reducer.js +0 -104
  274. package/v2Containers/WebPush/sagas.js +0 -119
  275. package/v2Containers/WebPush/selectors.js +0 -65
  276. package/v2Containers/WebPush/tests/reducer.test.js +0 -863
  277. package/v2Containers/WebPush/tests/sagas.test.js +0 -566
  278. package/v2Containers/WebPush/tests/selectors.test.js +0 -960
@@ -79,7 +79,6 @@ import * as whatsappActions from '../Whatsapp/actions';
79
79
  import * as rcsActions from '../Rcs/actions';
80
80
  import * as zaloActions from '../Zalo/actions';
81
81
  import * as inAppActions from '../InApp/actions';
82
- import * as webpushActions from '../WebPush/actions';
83
82
  import * as globalActions from '../Cap/actions';
84
83
  import { makeSelectAuthenticated } from '../Cap/selectors';
85
84
  import { UserIsAuthenticated } from '../../utils/authWrapper';
@@ -128,17 +127,18 @@ import {
128
127
  VIDEO,
129
128
  GIF,
130
129
  } from '../Whatsapp/constants';
131
- import { INAPP_LAYOUT_DETAILS } from '../InApp/constants';
130
+ import { INAPP_LAYOUT_DETAILS, INAPP_MESSAGE_LAYOUT_TYPES, INAPP_MEDIA_TYPES, BIG_HTML, ANDROID, IOS } from '../InApp/constants';
132
131
  import { ZALO_STATUS_OPTIONS, ZALO_STATUSES } from '../Zalo/constants';
133
132
  import { getWhatsappContent, getWhatsappStatus, getWhatsappCategory, getWhatsappCta, getWhatsappQuickReply, getWhatsappAutoFill, getWhatsappCarouselButtonView } from '../Whatsapp/utils';
134
133
  import { getRCSContent } from '../Rcs/utils';
135
134
  import {RCS_STATUSES} from '../Rcs/constants';
136
135
  import zaloMessages from '../Zalo/messages';
137
136
  import rcsMessages from '../Rcs/messages';
137
+ import inAppMessages from '../InApp/messages';
138
138
  import globalMessages from '../../v2Containers/Cap/messages';
139
139
  import { handlePreviewInNewTab } from '../../utils/common';
140
140
 
141
- import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER, FACEBOOK, WHATSAPP, RCS, ZALO, INAPP, WEBPUSH } from '../CreativesContainer/constants';
141
+ import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER, FACEBOOK, WHATSAPP, RCS, ZALO, INAPP } from '../CreativesContainer/constants';
142
142
 
143
143
  import {CREATIVE} from '../Facebook/constants';
144
144
  import videoPlay from '../../assets/videoPlay.svg';
@@ -156,13 +156,10 @@ import { DAEMON } from '@capillarytech/vulcan-react-sdk/utils/sagaInjectorTypes'
156
156
  import { Rcs } from '../Rcs';
157
157
  import { makeSelectRcs } from '../Rcs/selectors';
158
158
  import { getRcsStatusType } from '../Rcs/utils';
159
- import { makeSelectWebPush } from '../WebPush/selectors';
160
159
  import { v2MobilePushSagas } from '../MobilePushNew/sagas';
161
160
  import { AUTO_CAROUSEL, BIG_PICTURE, FILMSTRIP_CAROUSEL, MANUAL_CAROUSEL } from '../MobilePushNew/constants';
162
161
  import CapPageSpinner from '../../v2Components/CapPageSpinner';
163
- import webPushSagas from '../WebPush/sagas';
164
162
  const withMobilePushNewSaga = injectSaga({ key: 'mobilePushNew', saga: v2MobilePushSagas, mode: DAEMON });
165
- const withWebPushSaga = injectSaga({ key: 'webPush', saga: webPushSagas, mode: DAEMON });
166
163
 
167
164
  const { timeTracker } = GA;
168
165
  const {CapCustomCardList} = CapCustomCard;
@@ -204,6 +201,29 @@ const SMS_FILTERS = {
204
201
  SERVICE_IMPLICIT: 'implicit',
205
202
  };
206
203
 
204
+ const INAPP_LAYOUT_OPTIONS = [
205
+ {
206
+ key: 'popup',
207
+ value: INAPP_MESSAGE_LAYOUT_TYPES.MODAL,
208
+ label: <FormattedMessage {...inAppMessages.layoutModal} />,
209
+ },
210
+ {
211
+ key: 'topBanner',
212
+ value: INAPP_MESSAGE_LAYOUT_TYPES.TOPBANNER,
213
+ label: <FormattedMessage {...inAppMessages.layoutTopBanner} />,
214
+ },
215
+ {
216
+ key: 'bottomBanner',
217
+ value: INAPP_MESSAGE_LAYOUT_TYPES.BOTTOMBANNER,
218
+ label: <FormattedMessage {...inAppMessages.layoutBottomBanner} />,
219
+ },
220
+ {
221
+ key: 'fullScreen',
222
+ value: INAPP_MESSAGE_LAYOUT_TYPES.FULLSCREEN,
223
+ label: <FormattedMessage {...inAppMessages.layoutFullScreen} />,
224
+ },
225
+ ];
226
+
207
227
  const WHATSAPP_LOWERCASE = WHATSAPP.toLowerCase();
208
228
  const RCS_LOWERCASE = RCS.toLowerCase();
209
229
  const SMS_LOWERCASE = SMS.toLowerCase();
@@ -216,7 +236,6 @@ const EBILL_LOWERCASE = EBILL.toLowerCase();
216
236
  const LINE_LOWERCASE = LINE.toLowerCase();
217
237
  const ZALO_LOWERCASE = ZALO.toLowerCase();
218
238
  const WECHAT_LOWERCASE = WECHAT.toLowerCase();
219
- const WEBPUSH_LOWERCASE = WEBPUSH.toLowerCase();
220
239
  const duplicateEnum = {
221
240
  sms: "smsActions",
222
241
  line: "lineActions",
@@ -255,6 +274,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
255
274
  selectedWhatsappStatus: '',
256
275
  selectedWhatsappCategory: '',
257
276
  selectedZaloStatus: '',
277
+ selectedInAppLayout: '',
258
278
  hostName: '',
259
279
  searchedZaloTemplates: [],
260
280
  searchingZaloTemplate: false,
@@ -275,9 +295,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
275
295
  // Phase 18: EMAIL API call flag
276
296
  isWaitingForEmailTemplateDetails: false,
277
297
  };
278
- // Timeout IDs for cleanup
279
- this._clearEditTimeout = null;
280
- this._clearCreateTimeout = null;
281
298
  this.getAllTemplates = this.getAllTemplates.bind(this);
282
299
  this.createTemplate = this.createTemplate.bind(this);
283
300
  this.searchTemplate = this.searchTemplate.bind(this);
@@ -403,19 +420,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
403
420
  orgUnitId: -1,
404
421
  });
405
422
  break;
406
- case WEBPUSH:
407
- channel = 'Webpush';
408
- activeMode = ACCOUNT_SELECTION_MODE;
409
- this.props.actions.getWeCrmAccounts('WebPush');
410
- break;
411
423
  default:
412
424
  channel = '';
413
425
  }
414
426
  this.setState({ channel, activeMode });
415
- // Clear templates when entering account selection mode to prevent showing old channel templates
416
- if (activeMode === ACCOUNT_SELECTION_MODE) {
417
- this.props.actions.resetTemplate();
418
- }
419
427
  if (isEmpty(this.props.Templates?.userList)) {
420
428
  this.props.actions.getUserList();
421
429
  }
@@ -513,10 +521,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
513
521
  channel = 'Facebook';
514
522
  this.setState({defaultAccount: true});
515
523
  nextProps.actions.getAccountsSettings();
516
- } else if (nextProps.route.name.toLowerCase() === WEBPUSH_LOWERCASE) {
517
- this.setState({defaultAccount: true});
518
- channel = 'Webpush';
519
- nextProps.actions.getWeCrmAccounts('WebPush');
520
524
  }
521
525
 
522
526
  // Phase 14: Reset Test and Preview state on channel change
@@ -668,50 +672,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
668
672
  }, 1000);
669
673
  }
670
674
 
671
- // Check for WebPush edit response - prevent duplicate calls
672
- if (selectedChannel === WEBPUSH_LOWERCASE && nextProps.WebPush?.editResponse && (nextProps.WebPush.editResponse.templateId || nextProps.WebPush.editResponse._id) && !isEqual(nextProps.WebPush.editResponse, this.props.WebPush?.editResponse)) {
673
- const channelLabel = this.props.intl.formatMessage(messages.webpushHeader);
674
- const message = `${channelLabel} ${this.props.intl.formatMessage(messages.templateUpdateSuccess)}`;
675
- CapNotification.success({
676
- key: 'webpushEditSuccess',
677
- message
678
- });
679
- // Clear previous state before loading newer templates
680
- this.props.actions.resetTemplate();
681
- this.getAllTemplates({params, resetPage: true});
682
- // Delay clearing to allow drawer to close first
683
- // Clear any existing timeout before setting a new one
684
- if (this._clearEditTimeout) {
685
- clearTimeout(this._clearEditTimeout);
686
- }
687
- this._clearEditTimeout = setTimeout(() => {
688
- this.props.webpushActions.clearEditResponse();
689
- this._clearEditTimeout = null;
690
- }, 200);
691
- }
692
-
693
- // Check for WebPush create response (for new template creation)
694
- if (selectedChannel === WEBPUSH_LOWERCASE && nextProps.WebPush?.response && (nextProps.WebPush.response?.templateId || nextProps.WebPush.response?._id) && !isEqual(nextProps.WebPush.response, this.props.WebPush?.response)) {
695
- // Skip showing generic "created" toast when this is a duplicate operation
696
- if (!nextProps.WebPush.response.meta?.isDuplicate) {
697
- const channelLabel = this.props.intl.formatMessage(messages.webpushHeader);
698
- const message = `${channelLabel} ${this.props.intl.formatMessage(messages.templateCreateSuccess)}`;
699
- CapNotification.success({key: 'webpushCreateSuccess', message});
700
- // Clear previous state before loading newer templates
701
- this.props.actions.resetTemplate();
702
- this.getAllTemplates({params, resetPage: true});
703
- // Delay clearing to allow drawer to close first
704
- // Clear any existing timeout before setting a new one
705
- if (this._clearCreateTimeout) {
706
- clearTimeout(this._clearCreateTimeout);
707
- }
708
- this._clearCreateTimeout = setTimeout(() => {
709
- this.props.webpushActions.clearCreateResponse();
710
- this._clearCreateTimeout = null;
711
- }, 200);
712
- }
713
- }
714
-
715
675
 
716
676
 
717
677
  if (nextProps.Create && this.props.Create && nextProps.Create.createTemplateError && !isEqual(nextProps.Create.createTemplateError, this.props.Create.createTemplateError)) {
@@ -719,7 +679,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
719
679
  if ((this.state.channel || '').toLowerCase() !== "sms") {
720
680
  CapNotification.error({key: 'somethingWrong', message});
721
681
  }
722
- const { smsActions, mobilepushActions, ebillActions, lineActions, viberActions, facebookActions, whatsappActions, inAppActions, rcsActions, webpushActions } = this.props;
682
+ const { smsActions, mobilepushActions, ebillActions, lineActions, viberActions, facebookActions, whatsappActions, inAppActions, rcsActions } = this.props;
723
683
  switch (selectedChannel) {
724
684
  case SMS_LOWERCASE:
725
685
  smsActions.clearCreateResponse();
@@ -748,9 +708,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
748
708
  case inAppActions:
749
709
  inAppActions.clearCreateResponse();
750
710
  break;
751
- case WEBPUSH_LOWERCASE:
752
- webpushActions.clearCreateResponse();
753
- break;
754
711
  default:
755
712
  break;
756
713
  }
@@ -763,10 +720,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
763
720
  nextProps.Templates.deleteResponse) {
764
721
  const message = `${this.state.channel} ${this.props.intl.formatMessage(messages['Template deleted successfully'])}`;
765
722
  CapNotification.success({key: 'deleteSucess', message});
766
- // Clear previous state before loading newer templates for web push channel
767
- if (selectedChannel === WEBPUSH_LOWERCASE) {
768
- this.props.actions.resetTemplate();
769
- }
770
723
  this.getAllTemplates({params, resetPage: true});
771
724
  }
772
725
 
@@ -879,7 +832,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
879
832
  this.setState({ previewTemplate: nextProps.Templates.templateDetails });
880
833
  }
881
834
  const { weCrmAccounts: weCrmAccountsList = [], senderDetails = {} } = get(nextProps, 'Templates', {});
882
- const weCrmChannels = [WHATSAPP_LOWERCASE, ZALO_LOWERCASE, RCS_LOWERCASE, WEBPUSH_LOWERCASE];
835
+ const weCrmChannels = [WHATSAPP_LOWERCASE, ZALO_LOWERCASE, RCS_LOWERCASE];
883
836
 
884
837
  // Keeping the wechat flow separate as it has different logic for setting the account. Currently we don't support wechat but still keeping the flow.
885
838
  if (weCrmAccountsList?.length === 1 && this.state?.defaultAccount && selectedChannel === WECHAT_LOWERCASE && !isEmpty(senderDetails?.hostName)) {
@@ -906,9 +859,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
906
859
  const isSingleAccount = weCrmAccountsList?.length === 1;
907
860
  const selectedAccount = this.props.Templates[ACCOUNT_MAPPING_ON_CHANNEL[selectedChannel]] || {};
908
861
  const hostName = this.getHostName(isSingleAccount ? weCrmAccountsList[0]?.sourceAccountIdentifier : selectedAccount?.sourceAccountIdentifier, senderDetails?.domainProperties);
909
- if (!isEmpty(hostName) || selectedChannel === WEBPUSH_LOWERCASE) {
862
+ if (!isEmpty(hostName)) {
910
863
  const paramsDefault = {};
911
- const {name, sourceAccountIdentifier, configs, id } = weCrmAccountsList?.[0] || {};
864
+ const {name, sourceAccountIdentifier, configs } = weCrmAccountsList?.[0] || {};
912
865
  if (isSingleAccount) {
913
866
  weCrmAccountsList[0].hostName = hostName;
914
867
  this.setState({ selectedAccount: name });
@@ -933,9 +886,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
933
886
  paramsDefault.accessToken = configs?.accessToken;
934
887
  paramsDefault.host = hostName || this.props.Templates?.selectedRcsAccount?.hostName;
935
888
  }
936
- if (selectedChannel === WEBPUSH_LOWERCASE) {
937
- paramsDefault.accountId = id;
938
- }
939
889
  this.setState({ defaultAccount: false });
940
890
  /**
941
891
  * Incase of multiple accounts, getAllTemplates is called on selecting the account. It's handled in onAccountSelect function.
@@ -958,15 +908,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
958
908
  window.removeEventListener("message", this.handleFrameTasks);
959
909
  this.props.actions.resetTemplateStoreData();
960
910
  this.props.globalActions.clearMetaEntities();
961
- // Clear any pending timeouts to prevent memory leaks
962
- if (this._clearEditTimeout) {
963
- clearTimeout(this._clearEditTimeout);
964
- this._clearEditTimeout = null;
965
- }
966
- if (this._clearCreateTimeout) {
967
- clearTimeout(this._clearCreateTimeout);
968
- this._clearCreateTimeout = null;
969
- }
970
911
  // this.props.actions.resetAccount();
971
912
  // this.setState({defaultAccount: false});
972
913
  // Phase 14: Cleanup Test and Preview state
@@ -977,10 +918,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
977
918
  });
978
919
  }
979
920
 
980
- onAccountSelect(e) {
921
+ onAccountSelect(e) {
981
922
  const value = e.target.value;
982
- // Clear templates immediately when account is selected to prevent showing old channel templates
983
- this.props.actions.resetTemplate();
984
923
  this.setState({selectedAccount: value}, () => {
985
924
  const params = {};
986
925
  if (this.state.channel.toLowerCase() !== ZALO_LOWERCASE) {
@@ -1008,7 +947,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1008
947
  } else {
1009
948
  this.setState({ selectedAccountError: false });
1010
949
  }
1011
- } else if ([LINE.toLowerCase(), RCS_LOWERCASE, ZALO_LOWERCASE, WHATSAPP_LOWERCASE, WEBPUSH_LOWERCASE].includes(selectedChannel)) {
950
+ } else if ([LINE.toLowerCase(), RCS_LOWERCASE, ZALO_LOWERCASE, WHATSAPP_LOWERCASE].includes(selectedChannel)) {
1012
951
  const setAcc = this.props?.Templates?.weCrmAccounts?.find((item) => item?.name === this.state.selectedAccount);
1013
952
  const { domainProperties = [] } = this.props?.Templates?.senderDetails || {};
1014
953
  let hostName = '';
@@ -1035,9 +974,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1035
974
  params.accountId = sourceAccountIdentifier;
1036
975
  params.host = hostName;
1037
976
  }
1038
- if (selectedChannel === WEBPUSH_LOWERCASE && setAcc) {
1039
- params.accountId = setAcc.accountId || setAcc.id;
1040
- }
1041
977
  if (selectedChannel === RCS_LOWERCASE && hostName) {
1042
978
  const { configs: { accessToken = "" } = {} } = setAcc || {};
1043
979
  params.accountId = sourceAccountIdentifier;
@@ -1491,41 +1427,32 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1491
1427
  let creativesParams = {mode: ''};
1492
1428
  if (!isEmpty(routeParams)) {
1493
1429
  const { pathname } = routeParams;
1494
- if (pathname) {
1495
- if (pathname.includes('create')) {
1496
- creativesParams.mode = 'create';
1497
- } else if (pathname.includes('edit') || pathname.includes('overview')) {
1498
- creativesParams.mode = 'edit';
1499
- if (pathname.includes('richmedia')) {
1500
- creativesParams._id = pathname.split('/')[4];
1501
- creativesParams.definition = {
1502
- msgcontent: "RICH_MEDIA_WECHAT",
1503
- };
1504
- } else {
1505
- creativesParams._id = pathname.split('/')[3];
1506
- creativesParams.modeType = pathname.split('/')[4];
1507
- creativesParams.account = pathname.split('/')[5];
1508
- if (this.state.channel.toLowerCase() === WHATSAPP_LOWERCASE) {
1509
- const whatsappSelectedTemplateData = this.selectTemplate(creativesParams._id) || {};
1510
- const { name = '', versions = {} } = whatsappSelectedTemplateData;
1511
- creativesParams.whatsappTemplateName = name;
1512
- creativesParams.whatsappTemplateCategory = get(versions, `base.content.whatsapp.category`, '');
1513
- creativesParams.whatsappTemplateLanguageCode = get(versions, `base.content.whatsapp.languages[0].language`, '');
1514
- } else if (this.state.channel.toLocaleLowerCase() === ZALO_LOWERCASE) {
1515
- const zaloSelectedTemplateData = this.selectTemplate(parseInt(creativesParams._id, 10)) || {};
1516
- const { name = '' } = zaloSelectedTemplateData;
1517
- creativesParams.name = name
1518
- } else if (this.state.channel.toLowerCase() === WEBPUSH_LOWERCASE) {
1519
- // For WebPush, extract only the fields the component uses
1520
- const webpushSelectedTemplateData = this.selectTemplate(creativesParams._id) || {};
1521
- const { name = '', definition = {}, versions = {} } = webpushSelectedTemplateData;
1522
- creativesParams.name = name;
1523
- creativesParams.definition = definition;
1524
- creativesParams.versions = versions;
1525
- }
1430
+ if (pathname.includes('create')) {
1431
+ creativesParams.mode = 'create';
1432
+ } else if (pathname.includes('edit') || pathname.includes('overview')) {
1433
+ creativesParams.mode = 'edit';
1434
+ if (pathname.includes('richmedia')) {
1435
+ creativesParams._id = pathname.split('/')[4];
1436
+ creativesParams.definition = {
1437
+ msgcontent: "RICH_MEDIA_WECHAT",
1438
+ };
1439
+ } else {
1440
+ creativesParams._id = pathname.split('/')[3];
1441
+ creativesParams.modeType = pathname.split('/')[4];
1442
+ creativesParams.account = pathname.split('/')[5];
1443
+ if (this.state.channel.toLowerCase() === WHATSAPP_LOWERCASE) {
1444
+ const whatsappSelectedTemplateData = this.selectTemplate(creativesParams._id) || {};
1445
+ const { name = '', versions = {} } = whatsappSelectedTemplateData;
1446
+ creativesParams.whatsappTemplateName = name;
1447
+ creativesParams.whatsappTemplateCategory = get(versions, `base.content.whatsapp.category`, '');
1448
+ creativesParams.whatsappTemplateLanguageCode = get(versions, `base.content.whatsapp.languages[0].language`, '');
1449
+ } else if (this.state.channel.toLocaleLowerCase() === ZALO_LOWERCASE) {
1450
+ const zaloSelectedTemplateData = this.selectTemplate(parseInt(creativesParams._id, 10)) || {};
1451
+ const { name = '' } = zaloSelectedTemplateData;
1452
+ creativesParams.name = name
1526
1453
  }
1527
- creativesParams.type = this.state.channel.toUpperCase();
1528
1454
  }
1455
+ creativesParams.type = this.state.channel.toUpperCase();
1529
1456
  }
1530
1457
  }
1531
1458
  if (this.state.previewOpen) {
@@ -1559,13 +1486,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1559
1486
  queryParams.host = params?.host || this.state?.hostName;
1560
1487
  };
1561
1488
 
1562
- setWebpushQueryParams = (queryParams, params) => {
1563
- const selectedAccount = this.props.Templates?.selectedWebPushAccount;
1564
- queryParams.accountId = params?.accountId
1565
- || selectedAccount?.accountId
1566
- || selectedAccount?.id;
1567
- };
1568
-
1569
1489
  getAllTemplates = ({params, getNextPage, resetPage}, resetTemplates) => {
1570
1490
  let queryParams = params || {};
1571
1491
  let page = this.state.page;
@@ -1597,9 +1517,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1597
1517
  if (this.state?.channel?.toLowerCase() === WHATSAPP_LOWERCASE) {
1598
1518
  this.setWhatsappQueryParams(queryParams, params);
1599
1519
  }
1600
- if (this.state?.channel?.toLowerCase() === WEBPUSH_LOWERCASE) {
1601
- this.setWebpushQueryParams(queryParams, params);
1602
- }
1603
1520
  if (this.state?.channel?.toLowerCase() === RCS_LOWERCASE && !isEmpty(this.props.Templates?.selectedRcsAccount)) {
1604
1521
  const { sourceAccountIdentifier = '', configs: { accessToken = '' } = {}, hostName = '' } = this.props.Templates.selectedRcsAccount;
1605
1522
  if (sourceAccountIdentifier) {
@@ -1664,9 +1581,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1664
1581
  if (this.state?.channel?.toLowerCase() === WHATSAPP_LOWERCASE) {
1665
1582
  this.setWhatsappQueryParams(queryParams, params);
1666
1583
  }
1667
- if (this.state?.channel?.toLowerCase() === WEBPUSH_LOWERCASE) {
1668
- this.setWebpushQueryParams(queryParams, params);
1669
- }
1670
1584
  if (this.state?.channel?.toLowerCase() === RCS_LOWERCASE && !isEmpty(this.props.Templates?.selectedRcsAccount)) {
1671
1585
  const { sourceAccountIdentifier = '', configs: { accessToken = '' } = {}, hostName = '' } = this.props.Templates.selectedRcsAccount;
1672
1586
  if (sourceAccountIdentifier) {
@@ -1759,6 +1673,19 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1759
1673
  return templates;
1760
1674
  }
1761
1675
 
1676
+ filterInAppTemplates = (templates) => {
1677
+ const { selectedInAppLayout } = this.state;
1678
+ if (!selectedInAppLayout) {
1679
+ return templates;
1680
+ }
1681
+ return templates.filter((template) => {
1682
+ const androidBodyType = get(template, 'versions.base.content.ANDROID.bodyType');
1683
+ const iosBodyType = get(template, 'versions.base.content.IOS.bodyType');
1684
+ const inappBodyType = androidBodyType || iosBodyType;
1685
+ return inappBodyType === selectedInAppLayout;
1686
+ });
1687
+ }
1688
+
1762
1689
  filterSMSTemplates = (templates) => {
1763
1690
  const { smsFilter } = this.state;
1764
1691
  if (SMS_FILTERS.ALL === smsFilter) {
@@ -1845,6 +1772,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1845
1772
  case ZALO:
1846
1773
  filteredTemplates = this.filterZaloTemplates(templates);
1847
1774
  break;
1775
+ case INAPP:
1776
+ filteredTemplates = this.filterInAppTemplates(templates);
1777
+ break;
1848
1778
  default:
1849
1779
  break;
1850
1780
  }
@@ -2134,9 +2064,12 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2134
2064
  templateData.isNewMobilePush = commonUtil.hasNewMobilePushFeatureEnabled();
2135
2065
  }
2136
2066
  break;
2137
- case INAPP:
2067
+ case INAPP: {
2068
+ // Pass the full template object to CapCustomCard so getInAppContent can extract the data
2069
+ // Similar to how MOBILE_PUSH passes the full template when new feature is enabled
2138
2070
  templateData.content = template;
2139
2071
  break;
2072
+ }
2140
2073
  case WECHAT:
2141
2074
  templateData.content = this.prepareWeChatPreviewData(template);
2142
2075
  break;
@@ -2413,70 +2346,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2413
2346
  templateData.content = <CapLabel type="label19" className="zalo-listing-content desc">{template.name}</CapLabel>;
2414
2347
  break;
2415
2348
  }
2416
- case WEBPUSH: {
2417
- const webpushContent = get(template, 'versions.base.content.webpush', {});
2418
- const notificationTitle = webpushContent?.title || '';
2419
- const notificationMessage = webpushContent?.message || '';
2420
- const brandIcon = webpushContent?.brandIcon || '';
2421
- const mediaImage = webpushContent?.image || '';
2422
- const ctaButtons = Array.isArray(webpushContent?.ctas)
2423
- ? webpushContent.ctas.filter(
2424
- (cta) => typeof cta?.actionText === 'string' && cta.actionText.trim()
2425
- )
2426
- : [];
2427
- const visibleCtas = ctaButtons.slice(0, 2);
2428
- templateData.content = (
2429
- <div className="sms-template-content webpush-template-content">
2430
- <div className="webpush-template-card">
2431
- <div className="webpush-template-meta">
2432
- {brandIcon ? (
2433
- <img
2434
- src={brandIcon}
2435
- alt="Brand Icon"
2436
- className="webpush-brand-icon"
2437
- />
2438
- ) : (
2439
- <span className="webpush-brand-icon-placeholder" />
2440
- )}
2441
- <div className="webpush-template-text">
2442
- <div className="webpush-template-header">
2443
- <div className="webpush-template-title">
2444
- {notificationTitle}
2445
- </div>
2446
- <div className="webpush-template-time">2:29 PM</div>
2447
- </div>
2448
- {notificationMessage ? (
2449
- <div className="webpush-template-message">
2450
- {notificationMessage}
2451
- </div>
2452
- ) : null}
2453
- {mediaImage ? (
2454
- <img
2455
- src={mediaImage}
2456
- alt="Media"
2457
- className="webpush-media-image"
2458
- />
2459
- ) : null}
2460
- </div>
2461
- </div>
2462
- {visibleCtas.length ? (
2463
- <div
2464
- className={`webpush-template-cta-section${
2465
- visibleCtas.length === 1 ? ' single-cta' : ''
2466
- }`}
2467
- >
2468
- {visibleCtas.map((cta, index) => (
2469
- <div className="webpush-template-cta-item" key={`webpush-cta-${index}`}>
2470
- <span className="webpush-template-cta-text">{cta.actionText}</span>
2471
- </div>
2472
- ))}
2473
- </div>
2474
- ) : null}
2475
- </div>
2476
- </div>
2477
- );
2478
- break;
2479
- }
2480
2349
  default:
2481
2350
  templateData.content = "";
2482
2351
  }
@@ -2512,9 +2381,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2512
2381
  const noLoaderAndSearchText = isEmpty(this.state.searchText) && !isLoading;
2513
2382
 
2514
2383
  return (<div>
2515
- {[WECHAT, MOBILE_PUSH, WEBPUSH, INAPP, WHATSAPP, ZALO, RCS].includes(currentChannel) && this.showAccountName()}
2384
+ {[WECHAT, MOBILE_PUSH, INAPP, WHATSAPP, ZALO,RCS].includes(currentChannel) && this.showAccountName()}
2516
2385
  {filterContent}
2517
- {[WHATSAPP, ZALO,RCS].includes(currentChannel) && this.selectedFilters()}
2386
+ {[WHATSAPP, ZALO, INAPP,RCS].includes(currentChannel) && this.selectedFilters()}
2518
2387
  {<div>
2519
2388
  {!isEmpty(filteredTemplates) || !isEmpty(this.state.searchText) || !isEmpty(this.props.Templates.templateError) ? (
2520
2389
  <div className={!isEmpty(this.state.searchText) && isEmpty(cardDataList) ? '' : this.isFullMode() ? "v2-pagination-container" : "v2-pagination-container-half"}>
@@ -2586,11 +2455,6 @@ return (<div>
2586
2455
  <ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel}/>
2587
2456
  </div>
2588
2457
  }
2589
- {showIllustrationForChannel(WEBPUSH_LOWERCASE) &&
2590
- <div style={this.isFullMode() ? { height: "calc(100vh - 20.3125rem)", overflow: 'auto' } : {}}>
2591
- <ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel} hostName={this.state?.hostName}/>
2592
- </div>
2593
- }
2594
2458
  {<CapCustomSkeleton loader={isInitialLoading && (isLoading || getAllTemplatesInProgress)} />}
2595
2459
  {<CapPageSpinner spinning={!isInitialLoading && (isLoading || getAllTemplatesInProgress)} />}
2596
2460
  </div>
@@ -2729,6 +2593,9 @@ return (<div>
2729
2593
 
2730
2594
  prepareWeChatMappedPreviewData(content, templateTags, tagData) {
2731
2595
  let formattedContent = cloneDeep(content);
2596
+ if (!formattedContent || typeof formattedContent !== 'string') {
2597
+ return formattedContent || '';
2598
+ }
2732
2599
  forEach(templateTags, (tag) => {
2733
2600
  if (tagData[tag].value !== undefined) {
2734
2601
  formattedContent = formattedContent.replace(`{{${tag}.DATA}}`, tagData[tag].value);
@@ -2984,10 +2851,6 @@ return (<div>
2984
2851
  params.host = this.state?.hostName;
2985
2852
  }
2986
2853
  this.delay(() => {
2987
- // Clear previous state before loading newer templates for web push channel
2988
- if (this.state.channel.toLowerCase() === WEBPUSH_LOWERCASE) {
2989
- this.props.actions.resetTemplate();
2990
- }
2991
2854
  this.getAllTemplates({params, resetPage: true});
2992
2855
  }, 500);
2993
2856
  });
@@ -3151,32 +3014,6 @@ return (<div>
3151
3014
  this.getAllTemplates({params: {}}, true);
3152
3015
  this.props.inAppActions.clearCreateResponse();
3153
3016
  });
3154
- } else if (this.state.channel.toLowerCase() === "webpush") {
3155
- const params = {
3156
- name: this.state.searchText,
3157
- sortBy: this.state.sortBy,
3158
- };
3159
-
3160
- // Get the selected WebPush account
3161
- const selectedAccount = this.props.Templates?.selectedWebPushAccount;
3162
-
3163
- // Set the accountId in the duplicate object
3164
- if (duplicateObj.definition) {
3165
- duplicateObj.definition.accountId = selectedAccount?.accountId || selectedAccount?.id;
3166
- }
3167
-
3168
- const channelLabel = this.props.intl.formatMessage(messages.webpushHeader);
3169
- this.props.webpushActions.createTemplate(duplicateObj, (response) => {
3170
- if (response && (response.templateId || response._id)) {
3171
- // Clear response immediately to prevent componentWillReceiveProps from showing "created" notification
3172
- this.props.webpushActions.clearCreateResponse();
3173
- // Clear previous state before loading newer templates
3174
- this.props.actions.resetTemplate();
3175
- const message = `${channelLabel} ${this.props.intl.formatMessage(messages.templateDuplicateSuccess)}`;
3176
- CapNotification.success({key: 'duplicateSuccess', message});
3177
- this.getAllTemplates({params, resetPage: true});
3178
- }
3179
- }, { isDuplicate: true });
3180
3017
  } else if (this.state.channel.toLowerCase() === "ebill") {
3181
3018
  this.props.ebillActions.createTemplate(duplicateObj);
3182
3019
  } else if (this.state.channel.toLowerCase() === "email") {
@@ -3311,10 +3148,6 @@ return (<div>
3311
3148
  pathName = `/inapp/edit/${id}/`;
3312
3149
  break;
3313
3150
  }
3314
- case WEBPUSH: {
3315
- pathName = `/webpush/edit/${id}`;
3316
- break;
3317
- }
3318
3151
  default:
3319
3152
  break;
3320
3153
  }
@@ -3662,14 +3495,6 @@ return (<div>
3662
3495
  fetchingWeCrmAccounts,
3663
3496
  sendingFile,
3664
3497
  } = Templates;
3665
-
3666
- // Show loading when in account selection or account change mode
3667
- const isAccountSelectionMode = this.state.activeMode === ACCOUNT_SELECTION_MODE ||
3668
- this.state.activeMode === ACCOUNT_CHANGE_MODE;
3669
- if (isAccountSelectionMode) {
3670
- return false;
3671
- }
3672
-
3673
3498
  const lineLoader = this.checkLoader('line');
3674
3499
  const smsLoader = this.checkLoader('sms');
3675
3500
  const viberLoader = this.checkLoader(VIBER_CHANNEL);
@@ -3692,10 +3517,6 @@ return (<div>
3692
3517
  fetchingWeCrmAccounts ) &&
3693
3518
  this.state.channel.toLowerCase() === ZALO_LOWERCASE;
3694
3519
  const mobilePushLoader = (((getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'mobilepush');
3695
- const webpushLoader = (
3696
- (getAllTemplatesInProgress && this.state.channel.toLowerCase() === WEBPUSH_LOWERCASE) ||
3697
- (fetchingWeCrmAccounts && this.state.channel.toLowerCase() === WEBPUSH_LOWERCASE)
3698
- );
3699
3520
  const inAppLoader = (((this.state.selectedAccount !== '' && getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === INAPP_LOWERCASE);
3700
3521
  const emailLoader = (
3701
3522
  (getAllTemplatesInProgress ||
@@ -3710,7 +3531,6 @@ return (<div>
3710
3531
  (emailLoader !== undefined ? emailLoader : false) ||
3711
3532
  (ebillLoader !== undefined ? ebillLoader : false) ||
3712
3533
  (mobilePushLoader !== undefined ? mobilePushLoader : false) ||
3713
- (webpushLoader !== undefined ? webpushLoader : false) ||
3714
3534
  (lineLoader !== undefined ? lineLoader : false) ||
3715
3535
  (facebookLoader !== undefined ? facebookLoader : false) ||
3716
3536
  (viberLoader !== undefined ? viberLoader : false) ||
@@ -3781,9 +3601,9 @@ return (<div>
3781
3601
  const isMobilePushChannel = channel === MOBILE_PUSH;
3782
3602
  const isInAppChannel = channel === INAPP;
3783
3603
  const isFacebookChannel = channel === FACEBOOK;
3784
- if ([WECHAT, MOBILE_PUSH, INAPP, LINE, ZALO, WHATSAPP, WEBPUSH, RCS].includes(channel) && !isEmpty(weCrmAccounts) && !isFacebookChannel) {
3604
+ if ([WECHAT, MOBILE_PUSH, INAPP, LINE, ZALO, WHATSAPP, RCS].includes(channel) && !isEmpty(weCrmAccounts) && !isFacebookChannel) {
3785
3605
  forEach(weCrmAccounts, (account) => {
3786
- if ((isWechatChannel && account.configs && account.configs.is_wecrm_enabled) || [MOBILE_PUSH, INAPP, LINE, ZALO, WHATSAPP, WEBPUSH, RCS].includes(channel)) {
3606
+ if ((isWechatChannel && account.configs && account.configs.is_wecrm_enabled) || [MOBILE_PUSH, INAPP, LINE, ZALO, WHATSAPP, RCS].includes(channel)) {
3787
3607
  if (query.type === 'embedded' && (!query.module || (query.module && query.module !== 'library'))) {
3788
3608
  if (query.source_account_id && account.sourceAccountIdentifier === query.source_account_id) {
3789
3609
  accountOptions.push(
@@ -3862,11 +3682,6 @@ return (<div>
3862
3682
  noAccountHeader = messages.noAccountsPresentZalo;
3863
3683
  break;
3864
3684
  }
3865
- case WEBPUSH: {
3866
- accountHeader = formatMessage(messages.webpushAccount);
3867
- noAccountHeader = messages.noAccountsPresentWebpush;
3868
- break;
3869
- }
3870
3685
  case RCS: {
3871
3686
  accountHeader = formatMessage(messages.rcsAccount);
3872
3687
  noAccountHeader = messages.noAccountsPresentRcs;
@@ -3923,12 +3738,10 @@ return (<div>
3923
3738
  };
3924
3739
 
3925
3740
  setAccountSelectionMode = () => {
3926
- this.props.actions.resetTemplate();
3927
3741
  this.setState({activeMode: ACCOUNT_SELECTION_MODE});
3928
3742
  }
3929
3743
 
3930
3744
  setAccountChangeMode = () => {
3931
- this.props.actions.resetTemplate();
3932
3745
  this.setState({activeMode: ACCOUNT_CHANGE_MODE});
3933
3746
  }
3934
3747
 
@@ -3945,7 +3758,6 @@ return (<div>
3945
3758
 
3946
3759
  const channelObj = {
3947
3760
  [MOBILE_PUSH]: 'mobilepushAccount',
3948
- [WEBPUSH]: 'webpushAccount',
3949
3761
  [WECHAT]: 'wechatAccount',
3950
3762
  [WHATSAPP]: 'whatsappAccount',
3951
3763
  [INAPP]: 'inappAccount',
@@ -3981,14 +3793,19 @@ return (<div>
3981
3793
  }
3982
3794
 
3983
3795
  removeZaloFilter = () => this.setState({ selectedZaloStatus: null });
3796
+ removeInAppLayoutFilter = () => this.setState({ selectedInAppLayout: '' });
3984
3797
 
3985
3798
  selectedFilters = () => {
3986
- const { selectedWhatsappStatus, selectedWhatsappCategory, selectedZaloStatus } = this.state;
3799
+ const { selectedWhatsappStatus, selectedWhatsappCategory, selectedZaloStatus, selectedInAppLayout } = this.state;
3987
3800
  const {
3988
3801
  intl: {
3989
3802
  formatMessage,
3990
3803
  },
3991
3804
  } = this.props;
3805
+ const getInAppLayoutLabel = (layoutValue) => {
3806
+ const layoutOption = INAPP_LAYOUT_OPTIONS.find(opt => opt.value === layoutValue);
3807
+ return layoutOption ? layoutOption.label : layoutValue;
3808
+ };
3992
3809
  return (
3993
3810
  <CapRow type="flex" align="middle" className="selected-whatsapp-filters">
3994
3811
  {
@@ -4023,6 +3840,23 @@ return (<div>
4023
3840
  </CapTag>
4024
3841
  ) : null
4025
3842
  }
3843
+ {
3844
+ selectedInAppLayout ? (
3845
+ <CapTag closable onClose={this.removeInAppLayoutFilter}>
3846
+ {formatMessage(messages.layout)}: {getInAppLayoutLabel(selectedInAppLayout)}
3847
+ </CapTag>
3848
+ ) : null
3849
+ }
3850
+ {
3851
+ selectedInAppLayout ? (
3852
+ <CapLink
3853
+ onClick={() => {
3854
+ this.removeInAppLayoutFilter();
3855
+ }}
3856
+ title={this.props.intl.formatMessage(messages.clearAll)}
3857
+ />
3858
+ ) : null
3859
+ }
4026
3860
  </CapRow>
4027
3861
  );
4028
3862
  }
@@ -4033,6 +3867,7 @@ return (<div>
4033
3867
  setLineFilter = (e) => this.setState({lineFilter: e.target.value});
4034
3868
  setSMSFilter = (e) => this.setState({smsFilter: e.target.value});
4035
3869
  setZaloStatus = (value) => this.setState({selectedZaloStatus: value?.item?.props?.value});
3870
+ setInAppLayout = (value) => this.setState({selectedInAppLayout: value?.item?.props?.value});
4036
3871
 
4037
3872
  openCreativesFullMode = () => {
4038
3873
  const channelLowerCase = this.state.channel.toLowerCase();
@@ -4285,6 +4120,21 @@ return (<div>
4285
4120
  )
4286
4121
  : () => null
4287
4122
  }
4123
+ {
4124
+ channel.toUpperCase() === INAPP && (
4125
+ <div className="inapp-filters">
4126
+ <CapSelectFilter
4127
+ placement="bottomLeft"
4128
+ data={INAPP_LAYOUT_OPTIONS}
4129
+ onSelect={this.setInAppLayout}
4130
+ selectedValue={this.state.selectedInAppLayout}
4131
+ placeholder="Layout"
4132
+ showBadge
4133
+ width="120px"
4134
+ />
4135
+ </div>
4136
+ )
4137
+ }
4288
4138
  <div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
4289
4139
  {
4290
4140
  this.state?.channel?.toLowerCase() === WHATSAPP_LOWERCASE && (isWhatsappCountExeeded)? (
@@ -4564,8 +4414,6 @@ Templates.propTypes = {
4564
4414
  rcsActions: PropTypes.object,
4565
4415
  zaloActions: PropTypes.object,
4566
4416
  inAppActions: PropTypes.object,
4567
- webpushActions: PropTypes.object,
4568
- WebPush: PropTypes.object,
4569
4417
  smsRegister: PropTypes.any,
4570
4418
  isDltFromRcs: PropTypes.bool,
4571
4419
  };
@@ -4585,7 +4433,6 @@ const mapStateToProps = createStructuredSelector({
4585
4433
  Rcs: makeSelectRcs(),
4586
4434
  Zalo: makeSelectZalo(),
4587
4435
  InApp: makeSelectInApp(),
4588
- WebPush: makeSelectWebPush(),
4589
4436
  });
4590
4437
 
4591
4438
  function mapDispatchToProps(dispatch) {
@@ -4605,7 +4452,6 @@ function mapDispatchToProps(dispatch) {
4605
4452
  whatsappActions: bindActionCreators(whatsappActions, dispatch),
4606
4453
  rcsActions: bindActionCreators(rcsActions, dispatch),
4607
4454
  zaloActions: bindActionCreators(zaloActions, dispatch),
4608
- webpushActions: bindActionCreators(webpushActions, dispatch),
4609
4455
  };
4610
4456
  }
4611
4457
 
@@ -4619,7 +4465,6 @@ export default compose(
4619
4465
  UserIsAuthenticated,
4620
4466
  withSaga,
4621
4467
  withMobilePushNewSaga,
4622
- withWebPushSaga,
4623
4468
  withReducer,
4624
4469
  withConnect,
4625
4470
  )(injectIntl(Templates));