@capillarytech/creatives-library 8.0.264 → 8.0.266-alpha.0

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 (292) 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/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +17 -35
  9. package/tests/integration/TemplateCreation/api-response.js +31 -1
  10. package/tests/integration/TemplateCreation/msw-handler.js +2 -0
  11. package/utils/common.js +5 -6
  12. package/utils/commonUtils.js +28 -5
  13. package/utils/tagValidations.js +1 -2
  14. package/utils/tests/commonUtil.test.js +224 -0
  15. package/utils/tests/transformerUtils.test.js +0 -297
  16. package/utils/transformTemplateConfig.js +0 -10
  17. package/utils/transformerUtils.js +0 -40
  18. package/v2Components/CapDeviceContent/index.js +61 -56
  19. package/v2Components/CapImageUpload/constants.js +0 -2
  20. package/v2Components/CapImageUpload/index.js +16 -65
  21. package/v2Components/CapImageUpload/index.scss +1 -4
  22. package/v2Components/CapImageUpload/messages.js +1 -5
  23. package/v2Components/CapTagList/index.js +6 -1
  24. package/v2Components/CapTagListWithInput/index.js +5 -1
  25. package/v2Components/CapTagListWithInput/messages.js +1 -1
  26. package/v2Components/CapWhatsappCTA/tests/index.test.js +5 -0
  27. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +2 -2
  28. package/v2Components/ErrorInfoNote/constants.js +1 -0
  29. package/v2Components/ErrorInfoNote/index.js +402 -72
  30. package/v2Components/ErrorInfoNote/messages.js +32 -6
  31. package/v2Components/ErrorInfoNote/style.scss +278 -6
  32. package/v2Components/FormBuilder/index.js +8 -8
  33. package/v2Components/FormBuilder/tests/index.test.js +13 -4
  34. package/v2Components/HtmlEditor/HTMLEditor.js +418 -99
  35. package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +870 -0
  36. package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +1882 -133
  37. package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +27 -16
  38. package/v2Components/HtmlEditor/_htmlEditor.scss +108 -45
  39. package/v2Components/HtmlEditor/_index.lazy.scss +0 -1
  40. package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +23 -102
  41. package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +148 -140
  42. package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +2 -1
  43. package/v2Components/HtmlEditor/components/DeviceToggle/index.js +3 -3
  44. package/v2Components/HtmlEditor/components/EditorToolbar/_editorToolbar.scss +9 -1
  45. package/v2Components/HtmlEditor/components/EditorToolbar/index.js +31 -6
  46. package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +22 -0
  47. package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +4 -7
  48. package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +35 -45
  49. package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +1 -3
  50. package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +33 -33
  51. package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +7 -6
  52. package/v2Components/HtmlEditor/components/PreviewPane/_previewPane.scss +7 -10
  53. package/v2Components/HtmlEditor/components/PreviewPane/index.js +22 -43
  54. package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +1 -1
  55. package/v2Components/HtmlEditor/components/ValidationErrorDisplay/_validationErrorDisplay.scss +18 -0
  56. package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +36 -31
  57. package/v2Components/HtmlEditor/components/ValidationPanel/_validationPanel.scss +46 -34
  58. package/v2Components/HtmlEditor/components/ValidationPanel/constants.js +6 -0
  59. package/v2Components/HtmlEditor/components/ValidationPanel/index.js +52 -46
  60. package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +277 -0
  61. package/v2Components/HtmlEditor/components/ValidationTabs/index.js +295 -0
  62. package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +51 -0
  63. package/v2Components/HtmlEditor/constants.js +45 -20
  64. package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +373 -16
  65. package/v2Components/HtmlEditor/hooks/__tests__/useValidation.test.js +351 -16
  66. package/v2Components/HtmlEditor/hooks/useEditorContent.js +5 -2
  67. package/v2Components/HtmlEditor/hooks/useInAppContent.js +88 -146
  68. package/v2Components/HtmlEditor/hooks/useValidation.js +213 -56
  69. package/v2Components/HtmlEditor/index.js +1 -1
  70. package/v2Components/HtmlEditor/messages.js +102 -94
  71. package/v2Components/HtmlEditor/utils/__tests__/htmlValidator.enhanced.test.js +214 -45
  72. package/v2Components/HtmlEditor/utils/__tests__/validationAdapter.test.js +134 -0
  73. package/v2Components/HtmlEditor/utils/contentSanitizer.js +40 -41
  74. package/v2Components/HtmlEditor/utils/htmlValidator.js +71 -72
  75. package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +158 -124
  76. package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +23 -25
  77. package/v2Components/HtmlEditor/utils/validationAdapter.js +66 -41
  78. package/v2Components/HtmlEditor/utils/validationConstants.js +38 -0
  79. package/v2Components/MobilePushPreviewV2/constants.js +6 -0
  80. package/v2Components/MobilePushPreviewV2/index.js +33 -7
  81. package/v2Components/TemplatePreview/_templatePreview.scss +55 -24
  82. package/v2Components/TemplatePreview/index.js +47 -32
  83. package/v2Components/TemplatePreview/messages.js +4 -0
  84. package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +1 -0
  85. package/v2Containers/App/constants.js +0 -5
  86. package/v2Containers/BeeEditor/index.js +172 -90
  87. package/v2Containers/BeePopupEditor/_beePopupEditor.scss +14 -0
  88. package/v2Containers/BeePopupEditor/constants.js +10 -0
  89. package/v2Containers/BeePopupEditor/index.js +194 -0
  90. package/v2Containers/BeePopupEditor/tests/index.test.js +627 -0
  91. package/v2Containers/CreativesContainer/SlideBoxContent.js +129 -108
  92. package/v2Containers/CreativesContainer/SlideBoxFooter.js +163 -13
  93. package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -2
  94. package/v2Containers/CreativesContainer/constants.js +1 -3
  95. package/v2Containers/CreativesContainer/index.js +240 -214
  96. package/v2Containers/CreativesContainer/messages.js +8 -4
  97. package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +0 -210
  98. package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +11 -2
  99. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +38 -354
  100. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +103 -0
  101. package/v2Containers/Email/actions.js +7 -0
  102. package/v2Containers/Email/constants.js +5 -1
  103. package/v2Containers/Email/index.js +241 -32
  104. package/v2Containers/Email/messages.js +32 -0
  105. package/v2Containers/Email/reducer.js +12 -1
  106. package/v2Containers/Email/sagas.js +61 -7
  107. package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +2 -0
  108. package/v2Containers/Email/tests/reducer.test.js +46 -0
  109. package/v2Containers/Email/tests/sagas.test.js +320 -29
  110. package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +1246 -0
  111. package/v2Containers/EmailWrapper/components/EmailWrapperView.js +211 -21
  112. package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +40 -74
  113. package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +2472 -0
  114. package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +520 -0
  115. package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +2 -67
  116. package/v2Containers/EmailWrapper/constants.js +2 -0
  117. package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +629 -77
  118. package/v2Containers/EmailWrapper/index.js +103 -23
  119. package/v2Containers/EmailWrapper/messages.js +65 -1
  120. package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +956 -0
  121. package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +594 -77
  122. package/v2Containers/FTP/index.js +1 -1
  123. package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +376 -0
  124. package/v2Containers/InApp/__tests__/sagas.test.js +363 -0
  125. package/v2Containers/InApp/actions.js +7 -0
  126. package/v2Containers/InApp/constants.js +20 -4
  127. package/v2Containers/InApp/index.js +802 -360
  128. package/v2Containers/InApp/index.scss +4 -3
  129. package/v2Containers/InApp/messages.js +7 -3
  130. package/v2Containers/InApp/reducer.js +21 -3
  131. package/v2Containers/InApp/sagas.js +29 -9
  132. package/v2Containers/InApp/selectors.js +25 -5
  133. package/v2Containers/InApp/tests/index.test.js +154 -50
  134. package/v2Containers/InApp/tests/reducer.test.js +34 -0
  135. package/v2Containers/InApp/tests/sagas.test.js +61 -9
  136. package/v2Containers/InApp/tests/selectors.test.js +612 -0
  137. package/v2Containers/InAppWrapper/components/InAppWrapperView.js +151 -0
  138. package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +267 -0
  139. package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +23 -0
  140. package/v2Containers/InAppWrapper/constants.js +16 -0
  141. package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +473 -0
  142. package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +198 -0
  143. package/v2Containers/InAppWrapper/index.js +148 -0
  144. package/v2Containers/InAppWrapper/messages.js +49 -0
  145. package/v2Containers/InappAdvance/index.js +1099 -0
  146. package/v2Containers/InappAdvance/index.scss +10 -0
  147. package/v2Containers/InappAdvance/tests/index.test.js +448 -0
  148. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -0
  149. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -0
  150. package/v2Containers/Line/Container/Text/index.js +0 -1
  151. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +2 -0
  152. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +9 -0
  153. package/v2Containers/MobilePushNew/index.js +0 -1
  154. package/v2Containers/Rcs/index.js +0 -3
  155. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +12 -0
  156. package/v2Containers/SmsTrai/Edit/index.js +0 -1
  157. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -0
  158. package/v2Containers/TagList/index.js +62 -19
  159. package/v2Containers/Templates/ChannelTypeIllustration.js +1 -13
  160. package/v2Containers/Templates/_templates.scss +56 -202
  161. package/v2Containers/Templates/actions.js +1 -2
  162. package/v2Containers/Templates/constants.js +0 -1
  163. package/v2Containers/Templates/index.js +123 -278
  164. package/v2Containers/Templates/messages.js +4 -24
  165. package/v2Containers/Templates/reducer.js +0 -2
  166. package/v2Containers/Templates/tests/index.test.js +0 -10
  167. package/v2Containers/TemplatesV2/TemplatesV2.style.js +4 -2
  168. package/v2Containers/TemplatesV2/index.js +7 -15
  169. package/v2Containers/TemplatesV2/messages.js +0 -4
  170. package/v2Containers/Viber/index.js +0 -1
  171. package/v2Containers/Whatsapp/index.js +0 -1
  172. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34 -0
  173. package/v2Containers/Zalo/index.js +0 -1
  174. package/v2Containers/Zalo/tests/index.test.js +5 -1
  175. package/utils/imageUrlUpload.js +0 -141
  176. package/v2Components/CapImageUrlUpload/constants.js +0 -26
  177. package/v2Components/CapImageUrlUpload/index.js +0 -365
  178. package/v2Components/CapImageUrlUpload/index.scss +0 -35
  179. package/v2Components/CapImageUrlUpload/messages.js +0 -47
  180. package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +0 -152
  181. package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +0 -214
  182. package/v2Containers/WebPush/Create/components/BrandIconSection.js +0 -108
  183. package/v2Containers/WebPush/Create/components/ButtonForm.js +0 -172
  184. package/v2Containers/WebPush/Create/components/ButtonItem.js +0 -101
  185. package/v2Containers/WebPush/Create/components/ButtonList.js +0 -145
  186. package/v2Containers/WebPush/Create/components/ButtonsLinksSection.js +0 -164
  187. package/v2Containers/WebPush/Create/components/ButtonsLinksSection.test.js +0 -463
  188. package/v2Containers/WebPush/Create/components/FormActions.js +0 -54
  189. package/v2Containers/WebPush/Create/components/FormActions.test.js +0 -163
  190. package/v2Containers/WebPush/Create/components/MediaSection.js +0 -142
  191. package/v2Containers/WebPush/Create/components/MediaSection.test.js +0 -341
  192. package/v2Containers/WebPush/Create/components/MessageSection.js +0 -103
  193. package/v2Containers/WebPush/Create/components/MessageSection.test.js +0 -268
  194. package/v2Containers/WebPush/Create/components/NotificationTitleSection.js +0 -87
  195. package/v2Containers/WebPush/Create/components/NotificationTitleSection.test.js +0 -210
  196. package/v2Containers/WebPush/Create/components/TemplateNameSection.js +0 -54
  197. package/v2Containers/WebPush/Create/components/TemplateNameSection.test.js +0 -143
  198. package/v2Containers/WebPush/Create/components/__snapshots__/ButtonsLinksSection.test.js.snap +0 -86
  199. package/v2Containers/WebPush/Create/components/__snapshots__/FormActions.test.js.snap +0 -16
  200. package/v2Containers/WebPush/Create/components/__snapshots__/MediaSection.test.js.snap +0 -41
  201. package/v2Containers/WebPush/Create/components/__snapshots__/MessageSection.test.js.snap +0 -54
  202. package/v2Containers/WebPush/Create/components/__snapshots__/NotificationTitleSection.test.js.snap +0 -37
  203. package/v2Containers/WebPush/Create/components/__snapshots__/TemplateNameSection.test.js.snap +0 -21
  204. package/v2Containers/WebPush/Create/components/_buttons.scss +0 -246
  205. package/v2Containers/WebPush/Create/components/tests/ButtonForm.test.js +0 -554
  206. package/v2Containers/WebPush/Create/components/tests/ButtonItem.test.js +0 -607
  207. package/v2Containers/WebPush/Create/components/tests/ButtonList.test.js +0 -633
  208. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonForm.test.js.snap +0 -666
  209. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonItem.test.js.snap +0 -74
  210. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonList.test.js.snap +0 -78
  211. package/v2Containers/WebPush/Create/hooks/useButtonManagement.js +0 -138
  212. package/v2Containers/WebPush/Create/hooks/useButtonManagement.test.js +0 -406
  213. package/v2Containers/WebPush/Create/hooks/useCharacterCount.js +0 -30
  214. package/v2Containers/WebPush/Create/hooks/useCharacterCount.test.js +0 -151
  215. package/v2Containers/WebPush/Create/hooks/useImageUpload.js +0 -104
  216. package/v2Containers/WebPush/Create/hooks/useImageUpload.test.js +0 -538
  217. package/v2Containers/WebPush/Create/hooks/useTagManagement.js +0 -122
  218. package/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +0 -633
  219. package/v2Containers/WebPush/Create/index.js +0 -1148
  220. package/v2Containers/WebPush/Create/index.scss +0 -134
  221. package/v2Containers/WebPush/Create/messages.js +0 -211
  222. package/v2Containers/WebPush/Create/preview/DevicePreviewContent.js +0 -228
  223. package/v2Containers/WebPush/Create/preview/NotificationContainer.js +0 -294
  224. package/v2Containers/WebPush/Create/preview/PreviewContent.js +0 -90
  225. package/v2Containers/WebPush/Create/preview/PreviewControls.js +0 -305
  226. package/v2Containers/WebPush/Create/preview/PreviewDisclaimer.js +0 -25
  227. package/v2Containers/WebPush/Create/preview/WebPushPreview.js +0 -155
  228. package/v2Containers/WebPush/Create/preview/assets/Light.svg +0 -53
  229. package/v2Containers/WebPush/Create/preview/assets/Top.svg +0 -5
  230. package/v2Containers/WebPush/Create/preview/assets/android-arrow-down.svg +0 -9
  231. package/v2Containers/WebPush/Create/preview/assets/android-arrow-up.svg +0 -9
  232. package/v2Containers/WebPush/Create/preview/assets/chrome-icon.png +0 -0
  233. package/v2Containers/WebPush/Create/preview/assets/edge-icon.png +0 -0
  234. package/v2Containers/WebPush/Create/preview/assets/firefox-icon.svg +0 -106
  235. package/v2Containers/WebPush/Create/preview/assets/iOS.svg +0 -26
  236. package/v2Containers/WebPush/Create/preview/assets/macos-arrow-down-icon.svg +0 -9
  237. package/v2Containers/WebPush/Create/preview/assets/macos-triple-dot-icon.svg +0 -9
  238. package/v2Containers/WebPush/Create/preview/assets/opera-icon.svg +0 -18
  239. package/v2Containers/WebPush/Create/preview/assets/safari-icon.svg +0 -29
  240. package/v2Containers/WebPush/Create/preview/assets/windows-close-icon.svg +0 -9
  241. package/v2Containers/WebPush/Create/preview/assets/windows-triple-dot-icon.svg +0 -9
  242. package/v2Containers/WebPush/Create/preview/components/AndroidMobileChromeHeader.js +0 -51
  243. package/v2Containers/WebPush/Create/preview/components/AndroidMobileExpanded.js +0 -145
  244. package/v2Containers/WebPush/Create/preview/components/IOSHeader.js +0 -45
  245. package/v2Containers/WebPush/Create/preview/components/NotificationExpandedContent.js +0 -68
  246. package/v2Containers/WebPush/Create/preview/components/NotificationHeader.js +0 -61
  247. package/v2Containers/WebPush/Create/preview/components/WindowsChromeExpanded.js +0 -99
  248. package/v2Containers/WebPush/Create/preview/components/tests/AndroidMobileExpanded.test.js +0 -733
  249. package/v2Containers/WebPush/Create/preview/components/tests/WindowsChromeExpanded.test.js +0 -571
  250. package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/AndroidMobileExpanded.test.js.snap +0 -85
  251. package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/WindowsChromeExpanded.test.js.snap +0 -81
  252. package/v2Containers/WebPush/Create/preview/config/notificationMappings.js +0 -50
  253. package/v2Containers/WebPush/Create/preview/constants.js +0 -637
  254. package/v2Containers/WebPush/Create/preview/notification-container.scss +0 -79
  255. package/v2Containers/WebPush/Create/preview/preview.scss +0 -358
  256. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-chrome.scss +0 -370
  257. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-edge.scss +0 -12
  258. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-firefox.scss +0 -12
  259. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-opera.scss +0 -12
  260. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-chrome.scss +0 -47
  261. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-edge.scss +0 -11
  262. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-firefox.scss +0 -11
  263. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-opera.scss +0 -11
  264. package/v2Containers/WebPush/Create/preview/styles/_base.scss +0 -207
  265. package/v2Containers/WebPush/Create/preview/styles/_ios.scss +0 -153
  266. package/v2Containers/WebPush/Create/preview/styles/_ipados.scss +0 -107
  267. package/v2Containers/WebPush/Create/preview/styles/_macos-chrome.scss +0 -101
  268. package/v2Containers/WebPush/Create/preview/styles/_windows-chrome.scss +0 -229
  269. package/v2Containers/WebPush/Create/preview/tests/DevicePreviewContent.test.js +0 -909
  270. package/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +0 -1081
  271. package/v2Containers/WebPush/Create/preview/tests/PreviewControls.test.js +0 -723
  272. package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +0 -1327
  273. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/DevicePreviewContent.test.js.snap +0 -131
  274. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/NotificationContainer.test.js.snap +0 -112
  275. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/PreviewControls.test.js.snap +0 -144
  276. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/WebPushPreview.test.js.snap +0 -129
  277. package/v2Containers/WebPush/Create/utils/payloadBuilder.js +0 -96
  278. package/v2Containers/WebPush/Create/utils/payloadBuilder.test.js +0 -396
  279. package/v2Containers/WebPush/Create/utils/previewUtils.js +0 -89
  280. package/v2Containers/WebPush/Create/utils/urlValidation.js +0 -115
  281. package/v2Containers/WebPush/Create/utils/urlValidation.test.js +0 -449
  282. package/v2Containers/WebPush/Create/utils/validation.js +0 -76
  283. package/v2Containers/WebPush/Create/utils/validation.test.js +0 -283
  284. package/v2Containers/WebPush/actions.js +0 -60
  285. package/v2Containers/WebPush/constants.js +0 -132
  286. package/v2Containers/WebPush/index.js +0 -2
  287. package/v2Containers/WebPush/reducer.js +0 -104
  288. package/v2Containers/WebPush/sagas.js +0 -119
  289. package/v2Containers/WebPush/selectors.js +0 -65
  290. package/v2Containers/WebPush/tests/reducer.test.js +0 -863
  291. package/v2Containers/WebPush/tests/sagas.test.js +0 -566
  292. package/v2Containers/WebPush/tests/selectors.test.js +0 -960
@@ -46,10 +46,6 @@ export default defineMessages({
46
46
  id: `${scope}.mobilepushHeader`,
47
47
  defaultMessage: `Mobile Push`,
48
48
  },
49
- "webpushHeader": {
50
- id: `${scope}.webpushHeader`,
51
- defaultMessage: `Web Push`,
52
- },
53
49
  "ebillHeader": {
54
50
  id: `${scope}.ebillHeader`,
55
51
  defaultMessage: `Ebill`,
@@ -346,10 +342,6 @@ export default defineMessages({
346
342
  id: `${scope}.newWhatsappTemplate`,
347
343
  defaultMessage: 'Add new Whatsapp {template}',
348
344
  },
349
- "newWebPushTemplate": {
350
- id: `${scope}.newWebPushTemplate`,
351
- defaultMessage: 'Add new Web push {template}',
352
- },
353
345
  "newInAppMessageTemplate": {
354
346
  id: `${scope}.newInAppMessageTemplate`,
355
347
  defaultMessage: 'Add new In app message {template}',
@@ -386,14 +378,6 @@ export default defineMessages({
386
378
  id: `${scope}.whatsappDescIllustration`,
387
379
  defaultMessage: 'These templates can be reused when creating a\nnew message content.',
388
380
  },
389
- "webPushTitleIllustration": {
390
- id: `${scope}.webPushTitleIllustration`,
391
- defaultMessage: 'Add a new Web push creative {template}',
392
- },
393
- "webPushDescIllustration": {
394
- id: `${scope}.webPushDescIllustration`,
395
- defaultMessage: 'These templates can be reused when creating a new message content.',
396
- },
397
381
  "whatsappAccountNotConfiguredTitle": {
398
382
  id: `${scope}.whatsappAccountNotConfiguredTitle`,
399
383
  defaultMessage: 'Whatsapp account is not configured',
@@ -478,10 +462,6 @@ export default defineMessages({
478
462
  id: `${scope}.zaloAccount`,
479
463
  defaultMessage: 'Zalo account',
480
464
  },
481
- "webpushAccount": {
482
- id: `${scope}.webpushAccount`,
483
- defaultMessage: 'Web push account',
484
- },
485
465
  "rcsAccount": {
486
466
  id: `${scope}.rcsAccount`,
487
467
  defaultMessage: 'RCS account',
@@ -518,10 +498,6 @@ export default defineMessages({
518
498
  id: `${scope}.noAccountsPresentZalo`,
519
499
  defaultMessage: "Zalo accounts are not setup for your brand",
520
500
  },
521
- "noAccountsPresentWebpush": {
522
- id: `${scope}.noAccountsPresentWebpush`,
523
- defaultMessage: "Web push accounts are not setup for your brand",
524
- },
525
501
  "noAccountsPresentRcs": {
526
502
  id: `${scope}.noAccountsPresentRcs`,
527
503
  defaultMessage: "RCS accounts are not setup for your brand",
@@ -558,6 +534,10 @@ export default defineMessages({
558
534
  id: `${scope}.rcsOnlyApprovedTemplates`,
559
535
  defaultMessage: 'Only "Approved" templates are available here, as you can use those templates to create a message.',
560
536
  },
537
+ "layout": {
538
+ id: `${scope}.layout`,
539
+ defaultMessage: `Layout`,
540
+ },
561
541
  "status": {
562
542
  id: `${scope}.status`,
563
543
  defaultMessage: 'Status',
@@ -124,8 +124,6 @@ function templatesReducer(state = initialState, action) {
124
124
  return state
125
125
  .set('selectedFacebookAccount', fromJS(action.faceBookAccount))
126
126
  .set('templates', []);
127
- case types.SET_WEBPUSH_ACCOUNT:
128
- return state.set('selectedWebPushAccount', fromJS(action.account));
129
127
  case types.RESET_ACCOUNT:
130
128
  return state
131
129
  .remove('selectedWeChatAccount')
@@ -22,7 +22,6 @@ describe('Test Templates container', () => {
22
22
  const getAllTemplates = jest.fn();
23
23
  const getUserList = jest.fn();
24
24
  const getSenderDetails = jest.fn();
25
- const resetTemplate = jest.fn();
26
25
  let renderedComponent;
27
26
 
28
27
  beforeEach(() => {
@@ -55,7 +54,6 @@ describe('Test Templates container', () => {
55
54
  getAllTemplates,
56
55
  getUserList,
57
56
  getSenderDetails,
58
- resetTemplate,
59
57
  }}
60
58
  location={{
61
59
  pathname: `/${channel}`,
@@ -81,8 +79,6 @@ describe('Test Templates container', () => {
81
79
  channel: 'WHATSAPP',
82
80
  orgUnitId: -1,
83
81
  });
84
- // resetTemplate should be called when entering account selection mode
85
- expect(resetTemplate).toHaveBeenCalled();
86
82
  });
87
83
 
88
84
  it('Should render temlates when whatsapp templates are passed', () => {
@@ -107,8 +103,6 @@ describe('Test Templates container', () => {
107
103
  Templates: {},
108
104
  });
109
105
  expect(renderedComponent).toMatchSnapshot();
110
- // SMS doesn't enter account selection mode, so resetTemplate shouldn't be called on mount
111
- expect(resetTemplate).not.toHaveBeenCalled();
112
106
  });
113
107
 
114
108
  it('Should render temlates when whatsapp templates are passed in full mode', () => {
@@ -129,8 +123,6 @@ describe('Test Templates container', () => {
129
123
  it('Should render correct component for zalo channel', () => {
130
124
  RenderFunctionFor('zalo');
131
125
  expect(renderedComponent).toMatchSnapshot();
132
- // resetTemplate should be called when entering account selection mode
133
- expect(resetTemplate).toHaveBeenCalled();
134
126
  });
135
127
  it('Should render temlates when zalo templates are passed', () => {
136
128
  RenderFunctionFor('zalo');
@@ -209,8 +201,6 @@ describe('Test Templates container', () => {
209
201
  channel: 'RCS',
210
202
  orgUnitId: -1,
211
203
  });
212
- // resetTemplate should be called when entering account selection mode
213
- expect(resetTemplate).toHaveBeenCalled();
214
204
  });
215
205
 
216
206
  it('Should render templates when RCS templates are passed', () => {
@@ -14,8 +14,10 @@ export default css`
14
14
  margin: 0 auto;
15
15
  width: 100%;
16
16
  padding: ${CAP_SPACE_24} 0;
17
- .ant-tabs-content{
18
- margin-top: ${CAP_SPACE_16}
17
+ /* Only main channel tabs content, not HTML Editor validation panel tabs */
18
+ > .cap-tab-v2 > .ant-tabs-content-holder > .ant-tabs-content,
19
+ > .cap-tab-v2 > .ant-tabs-content {
20
+ margin-top: ${CAP_SPACE_16};
19
21
  }
20
22
  ` : `.cap-tab-v2 {
21
23
  height: calc(100vh - 11.25rem);
@@ -30,11 +30,11 @@ import FTP from '../FTP';
30
30
  import Gallery from '../Assets/Gallery';
31
31
  import withStyles from '../../hoc/withStyles';
32
32
  import styles, { CapTabStyle } from './TemplatesV2.style';
33
- import { CREATIVES_UI_VIEW, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS, JP_LOCALE_HIDE_FEATURE, ZALO, INAPP, WEBPUSH } from '../App/constants';
33
+ import { CREATIVES_UI_VIEW, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS, JP_LOCALE_HIDE_FEATURE, ZALO, INAPP } from '../App/constants';
34
34
  import AccessForbidden from '../../v2Components/AccessForbidden';
35
35
  import { getObjFromQueryParams } from '../../utils/v2common';
36
36
  import { makeSelectAuthenticated, selectCurrentOrgDetails } from "../../v2Containers/Cap/selectors";
37
- import { LOYALTY_SUPPORTED_ACTION, COMMON_CHANNELS } from "../CreativesContainer/constants";
37
+ import { LOYALTY_SUPPORTED_ACTION } from "../CreativesContainer/constants";
38
38
 
39
39
  const {CapCustomCardList} = CapCustomCard;
40
40
 
@@ -65,13 +65,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
65
65
  email: {content: <></>, tab: intl.formatMessage(messages.email), key: 'email'},
66
66
  //'wechat': {content: this.getTemplatesComponent('wechat'), tab: 'Wechat', key: 'wechat'},
67
67
  mPush: {content: <></>, tab: intl.formatMessage(messages.pushNotification), key: 'mobilepush'},
68
- ...(commonUtil.hasWebPushFeatureEnabled() ? {
69
- webpush: {
70
- content: <div></div>,
71
- tab: intl.formatMessage(messages.webPush),
72
- key: WEBPUSH,
73
- }
74
- } : {}),
75
68
  viber: {content: <></>, tab: intl.formatMessage(messages.viber), key: 'viber'},
76
69
  whatsapp: { content: <></>, tab: intl.formatMessage(messages.whatsapp), key: WHATSAPP },
77
70
  zalo: { content: <div></div>, tab: intl.formatMessage(messages.zalo), key: ZALO },
@@ -95,7 +88,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
95
88
  return obj;
96
89
  }, []);
97
90
 
98
- if (isFullMode ) {
91
+ if (isFullMode ) {
99
92
  filteredPanes.push({content: <div></div>, tab: intl.formatMessage(messages.gallery), key: 'assets'});
100
93
  } else {
101
94
  if (!channelsToHide.includes('callTask')) {
@@ -105,19 +98,18 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
105
98
  filteredPanes.push({content: <></>, tab: intl.formatMessage(messages.FTP), key: 'ftp'});
106
99
  defaultChannel = 'FTP';
107
100
  }
101
+ const commonChannels = ['sms', 'email', 'wechat', 'mobilepush', 'line', 'viber', 'facebook', 'call_task', 'ftp', 'assets'];
108
102
 
109
- // Create a local copy of COMMON_CHANNELS to avoid mutating the imported array
110
- const channels = [...COMMON_CHANNELS];
111
103
  const { actionName = ''} = loyaltyMetaData;
112
104
  if (isLoyaltyModule && actionName === LOYALTY_SUPPORTED_ACTION) {
113
- channels.push(WHATSAPP, ZALO);
105
+ commonChannels.push(WHATSAPP, ZALO);
114
106
  }
115
107
 
116
- // we only show channels which other than COMMON_CHANNELS
108
+ // we only show channels which other than commonChannels
117
109
  // if it is coming in enableNewChannels array
118
110
  filteredPanes = filteredPanes.filter((item) => {
119
111
  const channel = item.key;
120
- if (!channels.includes(channel)) {
112
+ if (!commonChannels.includes(channel)) {
121
113
  return enableNewChannels.includes(channel.toUpperCase());
122
114
  }
123
115
  return true;
@@ -86,8 +86,4 @@ export default defineMessages({
86
86
  id: `creatives.containersV2.TemplatesV2.inapp`,
87
87
  defaultMessage: 'In app message',
88
88
  },
89
- webPush: {
90
- id: `creatives.containersV2.TemplatesV2.webPush`,
91
- defaultMessage: 'Web Push',
92
- },
93
89
  });
@@ -237,7 +237,6 @@ export const Viber = (props) => {
237
237
  injectedTagsParams: injectedTags,
238
238
  location,
239
239
  tagModule: 'outbound',
240
- isFullMode,
241
240
  }) || {};
242
241
  if (value.trim() === '') {
243
242
  errorMessage = formatMessage(messages.emptyContentErrorMessage);
@@ -641,7 +641,6 @@ export const Whatsapp = (props) => {
641
641
  location,
642
642
  tagModule: getDefaultTags,
643
643
  eventContextTags,
644
- isFullMode,
645
644
  }) || {};
646
645
  const unsupportedTagsLengthCheck =
647
646
  validationResponse?.unsupportedTags?.length > 0;
@@ -2281,6 +2281,7 @@ new message content.",
2281
2281
  "email": [Function],
2282
2282
  "facebookPreview": [Function],
2283
2283
  "gallery": [Function],
2284
+ "inApp": [Function],
2284
2285
  "language": [Function],
2285
2286
  "navigationConfig": [Function],
2286
2287
  "previewAndTest": [Function],
@@ -23689,6 +23690,7 @@ new message content.",
23689
23690
  "email": [Function],
23690
23691
  "facebookPreview": [Function],
23691
23692
  "gallery": [Function],
23693
+ "inApp": [Function],
23692
23694
  "language": [Function],
23693
23695
  "navigationConfig": [Function],
23694
23696
  "previewAndTest": [Function],
@@ -47213,6 +47215,7 @@ new message content.",
47213
47215
  "email": [Function],
47214
47216
  "facebookPreview": [Function],
47215
47217
  "gallery": [Function],
47218
+ "inApp": [Function],
47216
47219
  "language": [Function],
47217
47220
  "navigationConfig": [Function],
47218
47221
  "previewAndTest": [Function],
@@ -71725,6 +71728,7 @@ new message content.",
71725
71728
  "email": [Function],
71726
71729
  "facebookPreview": [Function],
71727
71730
  "gallery": [Function],
71731
+ "inApp": [Function],
71728
71732
  "language": [Function],
71729
71733
  "navigationConfig": [Function],
71730
71734
  "previewAndTest": [Function],
@@ -98534,6 +98538,7 @@ new message content.",
98534
98538
  "email": [Function],
98535
98539
  "facebookPreview": [Function],
98536
98540
  "gallery": [Function],
98541
+ "inApp": [Function],
98537
98542
  "language": [Function],
98538
98543
  "navigationConfig": [Function],
98539
98544
  "previewAndTest": [Function],
@@ -119972,6 +119977,7 @@ new message content.",
119972
119977
  "email": [Function],
119973
119978
  "facebookPreview": [Function],
119974
119979
  "gallery": [Function],
119980
+ "inApp": [Function],
119975
119981
  "language": [Function],
119976
119982
  "navigationConfig": [Function],
119977
119983
  "previewAndTest": [Function],
@@ -141380,6 +141386,7 @@ new message content.",
141380
141386
  "email": [Function],
141381
141387
  "facebookPreview": [Function],
141382
141388
  "gallery": [Function],
141389
+ "inApp": [Function],
141383
141390
  "language": [Function],
141384
141391
  "navigationConfig": [Function],
141385
141392
  "previewAndTest": [Function],
@@ -166800,6 +166807,7 @@ new message content.",
166800
166807
  "email": [Function],
166801
166808
  "facebookPreview": [Function],
166802
166809
  "gallery": [Function],
166810
+ "inApp": [Function],
166803
166811
  "language": [Function],
166804
166812
  "navigationConfig": [Function],
166805
166813
  "previewAndTest": [Function],
@@ -193208,6 +193216,7 @@ new message content.",
193208
193216
  "email": [Function],
193209
193217
  "facebookPreview": [Function],
193210
193218
  "gallery": [Function],
193219
+ "inApp": [Function],
193211
193220
  "language": [Function],
193212
193221
  "navigationConfig": [Function],
193213
193222
  "previewAndTest": [Function],
@@ -221913,6 +221922,7 @@ new message content.",
221913
221922
  "email": [Function],
221914
221923
  "facebookPreview": [Function],
221915
221924
  "gallery": [Function],
221925
+ "inApp": [Function],
221916
221926
  "language": [Function],
221917
221927
  "navigationConfig": [Function],
221918
221928
  "previewAndTest": [Function],
@@ -251600,6 +251610,7 @@ new message content.",
251600
251610
  "email": [Function],
251601
251611
  "facebookPreview": [Function],
251602
251612
  "gallery": [Function],
251613
+ "inApp": [Function],
251603
251614
  "language": [Function],
251604
251615
  "navigationConfig": [Function],
251605
251616
  "previewAndTest": [Function],
@@ -267353,6 +267364,7 @@ new message content.",
267353
267364
  "email": [Function],
267354
267365
  "facebookPreview": [Function],
267355
267366
  "gallery": [Function],
267367
+ "inApp": [Function],
267356
267368
  "language": [Function],
267357
267369
  "navigationConfig": [Function],
267358
267370
  "previewAndTest": [Function],
@@ -281957,6 +281969,7 @@ new message content.",
281957
281969
  "email": [Function],
281958
281970
  "facebookPreview": [Function],
281959
281971
  "gallery": [Function],
281972
+ "inApp": [Function],
281960
281973
  "language": [Function],
281961
281974
  "navigationConfig": [Function],
281962
281975
  "previewAndTest": [Function],
@@ -298668,6 +298681,7 @@ new message content.",
298668
298681
  "email": [Function],
298669
298682
  "facebookPreview": [Function],
298670
298683
  "gallery": [Function],
298684
+ "inApp": [Function],
298671
298685
  "language": [Function],
298672
298686
  "navigationConfig": [Function],
298673
298687
  "previewAndTest": [Function],
@@ -322716,6 +322730,7 @@ new message content.",
322716
322730
  "email": [Function],
322717
322731
  "facebookPreview": [Function],
322718
322732
  "gallery": [Function],
322733
+ "inApp": [Function],
322719
322734
  "language": [Function],
322720
322735
  "navigationConfig": [Function],
322721
322736
  "previewAndTest": [Function],
@@ -350354,6 +350369,7 @@ new message content.",
350354
350369
  "email": [Function],
350355
350370
  "facebookPreview": [Function],
350356
350371
  "gallery": [Function],
350372
+ "inApp": [Function],
350357
350373
  "language": [Function],
350358
350374
  "navigationConfig": [Function],
350359
350375
  "previewAndTest": [Function],
@@ -366678,6 +366694,7 @@ new message content.",
366678
366694
  "email": [Function],
366679
366695
  "facebookPreview": [Function],
366680
366696
  "gallery": [Function],
366697
+ "inApp": [Function],
366681
366698
  "language": [Function],
366682
366699
  "navigationConfig": [Function],
366683
366700
  "previewAndTest": [Function],
@@ -388086,6 +388103,7 @@ new message content.",
388086
388103
  "email": [Function],
388087
388104
  "facebookPreview": [Function],
388088
388105
  "gallery": [Function],
388106
+ "inApp": [Function],
388089
388107
  "language": [Function],
388090
388108
  "navigationConfig": [Function],
388091
388109
  "previewAndTest": [Function],
@@ -413506,6 +413524,7 @@ new message content.",
413506
413524
  "email": [Function],
413507
413525
  "facebookPreview": [Function],
413508
413526
  "gallery": [Function],
413527
+ "inApp": [Function],
413509
413528
  "language": [Function],
413510
413529
  "navigationConfig": [Function],
413511
413530
  "previewAndTest": [Function],
@@ -434914,6 +434933,7 @@ new message content.",
434914
434933
  "email": [Function],
434915
434934
  "facebookPreview": [Function],
434916
434935
  "gallery": [Function],
434936
+ "inApp": [Function],
434917
434937
  "language": [Function],
434918
434938
  "navigationConfig": [Function],
434919
434939
  "previewAndTest": [Function],
@@ -457142,6 +457162,7 @@ new message content.",
457142
457162
  "email": [Function],
457143
457163
  "facebookPreview": [Function],
457144
457164
  "gallery": [Function],
457165
+ "inApp": [Function],
457145
457166
  "language": [Function],
457146
457167
  "navigationConfig": [Function],
457147
457168
  "previewAndTest": [Function],
@@ -480193,6 +480214,7 @@ new message content.",
480193
480214
  "email": [Function],
480194
480215
  "facebookPreview": [Function],
480195
480216
  "gallery": [Function],
480217
+ "inApp": [Function],
480196
480218
  "language": [Function],
480197
480219
  "navigationConfig": [Function],
480198
480220
  "previewAndTest": [Function],
@@ -504064,6 +504086,7 @@ new message content.",
504064
504086
  "email": [Function],
504065
504087
  "facebookPreview": [Function],
504066
504088
  "gallery": [Function],
504089
+ "inApp": [Function],
504067
504090
  "language": [Function],
504068
504091
  "navigationConfig": [Function],
504069
504092
  "previewAndTest": [Function],
@@ -528778,6 +528801,7 @@ new message content.",
528778
528801
  "email": [Function],
528779
528802
  "facebookPreview": [Function],
528780
528803
  "gallery": [Function],
528804
+ "inApp": [Function],
528781
528805
  "language": [Function],
528782
528806
  "navigationConfig": [Function],
528783
528807
  "previewAndTest": [Function],
@@ -554332,6 +554356,7 @@ new message content.",
554332
554356
  "email": [Function],
554333
554357
  "facebookPreview": [Function],
554334
554358
  "gallery": [Function],
554359
+ "inApp": [Function],
554335
554360
  "language": [Function],
554336
554361
  "navigationConfig": [Function],
554337
554362
  "previewAndTest": [Function],
@@ -580717,6 +580742,7 @@ new message content.",
580717
580742
  "email": [Function],
580718
580743
  "facebookPreview": [Function],
580719
580744
  "gallery": [Function],
580745
+ "inApp": [Function],
580720
580746
  "language": [Function],
580721
580747
  "navigationConfig": [Function],
580722
580748
  "previewAndTest": [Function],
@@ -607933,6 +607959,7 @@ new message content.",
607933
607959
  "email": [Function],
607934
607960
  "facebookPreview": [Function],
607935
607961
  "gallery": [Function],
607962
+ "inApp": [Function],
607936
607963
  "language": [Function],
607937
607964
  "navigationConfig": [Function],
607938
607965
  "previewAndTest": [Function],
@@ -635961,6 +635988,7 @@ new message content.",
635961
635988
  "email": [Function],
635962
635989
  "facebookPreview": [Function],
635963
635990
  "gallery": [Function],
635991
+ "inApp": [Function],
635964
635992
  "language": [Function],
635965
635993
  "navigationConfig": [Function],
635966
635994
  "previewAndTest": [Function],
@@ -658230,6 +658258,7 @@ new message content.",
658230
658258
  "email": [Function],
658231
658259
  "facebookPreview": [Function],
658232
658260
  "gallery": [Function],
658261
+ "inApp": [Function],
658233
658262
  "language": [Function],
658234
658263
  "navigationConfig": [Function],
658235
658264
  "previewAndTest": [Function],
@@ -681326,6 +681355,7 @@ new message content.",
681326
681355
  "email": [Function],
681327
681356
  "facebookPreview": [Function],
681328
681357
  "gallery": [Function],
681358
+ "inApp": [Function],
681329
681359
  "language": [Function],
681330
681360
  "navigationConfig": [Function],
681331
681361
  "previewAndTest": [Function],
@@ -705313,6 +705343,7 @@ new message content.",
705313
705343
  "email": [Function],
705314
705344
  "facebookPreview": [Function],
705315
705345
  "gallery": [Function],
705346
+ "inApp": [Function],
705316
705347
  "language": [Function],
705317
705348
  "navigationConfig": [Function],
705318
705349
  "previewAndTest": [Function],
@@ -726721,6 +726752,7 @@ new message content.",
726721
726752
  "email": [Function],
726722
726753
  "facebookPreview": [Function],
726723
726754
  "gallery": [Function],
726755
+ "inApp": [Function],
726724
726756
  "language": [Function],
726725
726757
  "navigationConfig": [Function],
726726
726758
  "previewAndTest": [Function],
@@ -751456,6 +751488,7 @@ new message content.",
751456
751488
  "email": [Function],
751457
751489
  "facebookPreview": [Function],
751458
751490
  "gallery": [Function],
751491
+ "inApp": [Function],
751459
751492
  "language": [Function],
751460
751493
  "navigationConfig": [Function],
751461
751494
  "previewAndTest": [Function],
@@ -776299,6 +776332,7 @@ new message content.",
776299
776332
  "email": [Function],
776300
776333
  "facebookPreview": [Function],
776301
776334
  "gallery": [Function],
776335
+ "inApp": [Function],
776302
776336
  "language": [Function],
776303
776337
  "navigationConfig": [Function],
776304
776338
  "previewAndTest": [Function],
@@ -274,7 +274,6 @@ export const Zalo = (props) => {
274
274
  location,
275
275
  tagModule: getDefaultTags,
276
276
  eventContextTags,
277
- isFullMode,
278
277
  }) || {};
279
278
  const { unsupportedTags = [], isBraceError } = tagValidationResponse;
280
279
  let tagError = '';
@@ -117,7 +117,11 @@ describe('Test activity zalo container', () => {
117
117
  target: { value: 'Hello, welcome {{fsdaf}}' },
118
118
  });
119
119
  inputBox[0].focus();
120
- expect(inputBox[0].value).toBe('Hello, welcome {{fsdaf}}');
120
+ expect(
121
+ screen.getByText(
122
+ 'Unsupported tags: fsdaf. Please remove them from this message.',
123
+ ),
124
+ ).toBeInTheDocument();
121
125
  });
122
126
 
123
127
  it('test case for set template data', async () => {
@@ -1,141 +0,0 @@
1
- /**
2
- * Utility functions for uploading images from URLs
3
- *
4
- * NOTE: CORS-limited; will be replaced with backend implementation.
5
- * Flow currently hidden (not removed) from frontend.
6
- */
7
-
8
- import {
9
- DEFAULT_ALLOWED_CONTENT_TYPES,
10
- MIME_TYPE_TO_EXTENSION,
11
- DEFAULT_IMAGE_EXTENSION,
12
- } from '../v2Components/CapImageUrlUpload/constants';
13
-
14
- /**
15
- * Fetches an image from a URL
16
- *
17
- * @param {string} url - The image URL to fetch
18
- * @returns {Promise<Response>} - The fetch response object
19
- * @throws {Error} - If the fetch fails (network/CORS error)
20
- */
21
- export const fetchImageFromUrl = async (url) => {
22
- const trimmedUrl = url?.trim() || '';
23
-
24
- if (!trimmedUrl) {
25
- throw new Error('URL is required');
26
- }
27
-
28
- // CORS-limited: fails for images without proper CORS headers
29
- const response = await fetch(trimmedUrl, {
30
- method: 'GET',
31
- redirect: 'follow',
32
- mode: 'cors',
33
- });
34
-
35
- if (!response.ok) {
36
- throw new Error(`Failed to fetch image: ${response.status} ${response.statusText}`);
37
- }
38
-
39
- return response;
40
- };
41
-
42
- /**
43
- * Helper function to upload image from URL
44
- * Fetches image, validates content type and size, converts to File, and uploads via uploadAsset
45
- *
46
- * @param {string} url - The image URL to upload
47
- * @param {Function} formatMessage - React Intl formatMessage function
48
- * @param {Object} messages - React Intl messages object
49
- * @param {Function} uploadAssetFn - Function to upload the asset (file, type, fileParams)
50
- * @param {string} fileNamePrefix - Prefix for the generated file name
51
- * @param {number} maxSize - Maximum file size in bytes
52
- * @param {string[]} allowedContentTypes - Array of allowed MIME types (defaults to DEFAULT_ALLOWED_CONTENT_TYPES)
53
- * @returns {Promise<{success: boolean, error: string}>} - Result object with success status and error message
54
- *
55
- * @example
56
- * const result = await uploadImageFromUrlHelper(
57
- * 'https://example.com/image.jpg',
58
- * formatMessage,
59
- * messages,
60
- * uploadAsset,
61
- * 'my-image',
62
- * 5000000,
63
- * ['image/jpeg', 'image/png']
64
- * );
65
- */
66
- export const uploadImageFromUrlHelper = async (
67
- url,
68
- formatMessage,
69
- messages,
70
- uploadAssetFn,
71
- fileNamePrefix,
72
- maxSize,
73
- allowedContentTypes = DEFAULT_ALLOWED_CONTENT_TYPES,
74
- ) => {
75
- const trimmedUrl = url?.trim() || '';
76
-
77
- try {
78
- const response = await fetchImageFromUrl(trimmedUrl);
79
-
80
- // Validate Content-Type
81
- const contentType = response.headers?.get('Content-Type') || '';
82
- const normalizedContentType = contentType.split(';')[0].toLowerCase().trim();
83
-
84
- if (!allowedContentTypes.includes(normalizedContentType)) {
85
- return {
86
- success: false,
87
- error: formatMessage(messages.imageTypeInvalid),
88
- };
89
- }
90
-
91
- const blob = await response.blob();
92
-
93
- if (blob.size > maxSize) {
94
- return {
95
- success: false,
96
- error: formatMessage(messages.imageSizeInvalid),
97
- };
98
- }
99
-
100
- // Load image to get dimensions and verify validity
101
- return new Promise((resolve) => {
102
- const img = new Image();
103
- const objectUrl = URL.createObjectURL(blob);
104
-
105
- img.onload = () => {
106
- const extension = MIME_TYPE_TO_EXTENSION[normalizedContentType] || DEFAULT_IMAGE_EXTENSION;
107
- const fileName = `${fileNamePrefix}.${extension}`;
108
- const file = new File([blob], fileName, { type: blob.type });
109
- const fileParams = {
110
- width: img.width,
111
- height: img.height,
112
- error: false,
113
- };
114
-
115
- uploadAssetFn(file, 'image', fileParams);
116
- URL.revokeObjectURL(objectUrl);
117
-
118
- resolve({
119
- success: true,
120
- error: '',
121
- });
122
- };
123
-
124
- img.onerror = () => {
125
- URL.revokeObjectURL(objectUrl);
126
- resolve({
127
- success: false,
128
- error: formatMessage(messages.imageLoadError),
129
- });
130
- };
131
-
132
- img.src = objectUrl;
133
- });
134
- } catch (error) {
135
- return {
136
- success: false,
137
- error: formatMessage(messages.imageLoadError),
138
- };
139
- }
140
- };
141
-