@capillarytech/creatives-library 7.18.0-beta.0 → 8.0.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 (334) hide show
  1. package/app.js +27 -54
  2. package/assets/Line_Preview_English.svg +24 -0
  3. package/assets/Line_Preview_Japanese.svg +24 -0
  4. package/components/CapTagList/index.js +2 -2
  5. package/components/CapTagList/messages.js +8 -0
  6. package/components/Ckeditor/index.js +4 -2
  7. package/components/Ckeditor/style.scss +3 -0
  8. package/components/FormBuilder/_formBuilder.scss +4 -16
  9. package/components/FormBuilder/index.js +4 -3
  10. package/components/FormBuilder/messages.js +4 -0
  11. package/components/Sidebar/index.js +4 -4
  12. package/config/path.js +1 -1
  13. package/containers/App/constants.js +95 -0
  14. package/containers/App/index.js +52 -0
  15. package/containers/App/sagas.js +8 -3
  16. package/containers/Assets/Gallery/index.js +17 -3
  17. package/containers/Assets/Gallery/messages.js +4 -0
  18. package/containers/Assets/Gallery/sagas.js +14 -14
  19. package/containers/Cap/index.js +84 -50
  20. package/containers/Cap/sagas.js +20 -12
  21. package/containers/Cap/selectors.js +13 -13
  22. package/containers/Cap/tests/__snapshots__/index.test.js.snap +1 -1
  23. package/containers/Cap/tests/saga.test.js +81 -1
  24. package/containers/Dashboard/index.js +34 -17
  25. package/containers/Dashboard/sagas.js +7 -1
  26. package/containers/Ebill/index.js +16 -3
  27. package/containers/Ebill/sagas.js +18 -11
  28. package/containers/Email/index.js +20 -3
  29. package/containers/Email/sagas.js +34 -23
  30. package/containers/LanguageProvider/index.js +49 -31
  31. package/containers/LanguageProvider/tests/index.test.js +5 -3
  32. package/containers/Line/Create/index.js +15 -2
  33. package/containers/Line/Create/sagas.js +26 -17
  34. package/containers/Line/Edit/sagas.js +12 -13
  35. package/containers/Login/index.js +36 -11
  36. package/containers/MobilePush/Create/index.js +17 -2
  37. package/containers/MobilePush/Create/sagas.js +18 -12
  38. package/containers/MobilePush/Edit/index.js +20 -3
  39. package/containers/MobilePush/Edit/sagas.js +30 -20
  40. package/containers/Sms/Create/index.js +15 -2
  41. package/containers/Sms/Create/sagas.js +8 -6
  42. package/containers/Sms/Edit/index.js +15 -3
  43. package/containers/Sms/Edit/sagas.js +14 -8
  44. package/containers/TagList/constants.js +23 -0
  45. package/containers/Templates/actions.js +0 -5
  46. package/containers/Templates/index.js +47 -14
  47. package/containers/Templates/sagas.js +20 -23
  48. package/containers/WeChat/MapTemplates/index.js +19 -2
  49. package/containers/WeChat/MapTemplates/sagas.js +17 -17
  50. package/containers/WeChat/RichmediaTemplates/Create/index.js +18 -2
  51. package/containers/WeChat/RichmediaTemplates/Create/sagas.js +11 -8
  52. package/containers/WeChat/RichmediaTemplates/Edit/index.js +21 -2
  53. package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +9 -5
  54. package/entry.js +2 -0
  55. package/global-styles.js +2 -2
  56. package/gtm/eventDefinitionsMap.js +1 -1
  57. package/helpers/intl-enzym-test-helpers.js +1 -1
  58. package/hoc/withReactRouterV3Compatibility.js +66 -0
  59. package/index.js +12 -0
  60. package/initialReducer.js +32 -0
  61. package/initialState.js +1 -0
  62. package/mfe-exposed-components.js +8 -0
  63. package/package.json +16 -11
  64. package/routes.js +206 -749
  65. package/services/api.js +62 -17
  66. package/services/tests/api.test.js +248 -1
  67. package/styles/components/navigation/_leftnav.scss +13 -0
  68. package/styles/containers/layout/_layoutPage.scss +14 -0
  69. package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +21 -16
  70. package/tests/store.test.js +5 -3
  71. package/translations/en.json +1 -9
  72. package/translations/ja-JP.json +0 -8
  73. package/translations/zh.json +0 -8
  74. package/utils/authWrapper.js +43 -17
  75. package/utils/cdnTransformation.js +73 -44
  76. package/utils/checkStore.js +21 -0
  77. package/utils/common.js +198 -8
  78. package/utils/commonUtils.js +17 -1
  79. package/utils/customAuthWrapper.js +62 -0
  80. package/utils/customConnectedAuthWrapper.js +26 -0
  81. package/utils/history.js +8 -0
  82. package/utils/injectReducer.js +2 -0
  83. package/utils/injectSaga.js +2 -0
  84. package/utils/tagValidations.js +2 -2
  85. package/utils/tests/cdnTransformation.test.js +6 -4
  86. package/utils/tests/common.mockdata.js +623 -0
  87. package/utils/tests/common.test.js +273 -0
  88. package/utils/tests/commonUtil.test.js +79 -0
  89. package/v2Components/CapDeviceContent/index.js +330 -0
  90. package/v2Components/CapDeviceContent/index.scss +115 -0
  91. package/v2Components/CapDeviceContent/messages.js +94 -0
  92. package/v2Components/CapDeviceContent/tests/index.test.js +89 -0
  93. package/v2Components/CapImageUpload/constants.js +6 -0
  94. package/v2Components/CapImageUpload/index.js +23 -15
  95. package/v2Components/CapImageUpload/index.scss +6 -0
  96. package/v2Components/CapImageUpload/messages.js +7 -7
  97. package/v2Components/CapInAppCTA/constants.js +25 -0
  98. package/v2Components/CapInAppCTA/index.js +279 -0
  99. package/v2Components/CapInAppCTA/index.scss +99 -0
  100. package/v2Components/CapInAppCTA/messages.js +85 -0
  101. package/v2Components/CapTagList/index.js +149 -26
  102. package/v2Components/CapTagList/messages.js +12 -0
  103. package/v2Components/CapTagList/style.scss +26 -0
  104. package/v2Components/CapVideoUpload/constants.js +6 -0
  105. package/v2Components/CapVideoUpload/index.js +48 -22
  106. package/v2Components/CapVideoUpload/index.scss +4 -2
  107. package/v2Components/CapVideoUpload/messages.js +10 -6
  108. package/v2Components/CapWhatsappQuickReply/index.js +255 -0
  109. package/v2Components/CapWhatsappQuickReply/index.scss +54 -0
  110. package/v2Components/CapWhatsappQuickReply/messages.js +32 -0
  111. package/v2Components/Ckeditor/index.js +56 -22
  112. package/v2Components/Ckeditor/style.scss +3 -0
  113. package/v2Components/Ckeditor/tests/index.test.js +44 -0
  114. package/v2Components/CmsTemplatesComponent/index.js +1 -0
  115. package/v2Components/CmsTemplatesComponent/messages.js +4 -0
  116. package/v2Components/EmailMobilePreview/index.js +4 -2
  117. package/v2Components/EmailPreviewV2/index.js +6 -4
  118. package/v2Components/EmailPreviewV2/tests/__snapshots__/index.test.js.snap +0 -3
  119. package/v2Components/FormBuilder/_formBuilder.scss +1 -0
  120. package/v2Components/FormBuilder/constants.js +1 -1
  121. package/v2Components/FormBuilder/index.js +111 -29
  122. package/v2Components/FormBuilder/messages.js +4 -0
  123. package/v2Components/FormBuilder/tests/index.test.js +5 -2
  124. package/v2Components/MobilePushPreviewV2/index.js +57 -22
  125. package/v2Components/NavigationBar/constants.js +1 -0
  126. package/v2Components/NavigationBar/index.js +84 -113
  127. package/v2Components/NavigationBar/messages.js +8 -0
  128. package/v2Components/NavigationBar/style.js +9 -0
  129. package/v2Components/NavigationBar/tests/index.test.js +32 -9
  130. package/v2Components/NavigationBar/tests/mockData.js +1 -0
  131. package/v2Components/NewCallTask/tests/index.test.js +5 -3
  132. package/v2Components/Pagination/index.js +2 -1
  133. package/v2Components/RenderRoute/RenderRoute.js +11 -0
  134. package/v2Components/RenderRoute/index.js +1 -0
  135. package/v2Components/TemplatePreview/_templatePreview.scss +535 -0
  136. package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_bottom.svg +11 -0
  137. package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_full.svg +11 -0
  138. package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_modal.svg +11 -0
  139. package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_top.svg +11 -0
  140. package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_bottom.svg +6 -0
  141. package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_full.svg +18 -0
  142. package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_modal.svg +7 -0
  143. package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_top.svg +13 -0
  144. package/v2Components/TemplatePreview/index.js +745 -362
  145. package/v2Components/TemplatePreview/messages.js +8 -0
  146. package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +47 -14
  147. package/v2Components/TemplatePreview/tests/index.test.js +9 -0
  148. package/v2Components/WhatsappStatusContainer/_whatsappStatusContainer.scss +8 -1
  149. package/v2Containers/App/constants.js +12 -6
  150. package/v2Containers/App/sagas.js +0 -1
  151. package/v2Containers/Assets/Gallery/index.js +1 -0
  152. package/v2Containers/Assets/Gallery/sagas.js +15 -14
  153. package/v2Containers/BeeEditor/index.js +3 -1
  154. package/v2Containers/BeeEditor/sagas.js +8 -5
  155. package/v2Containers/CallTask/sagas.js +7 -1
  156. package/v2Containers/Cap/actions.js +4 -0
  157. package/v2Containers/Cap/constants.js +20 -1
  158. package/v2Containers/Cap/index.js +116 -17
  159. package/v2Containers/Cap/messages.js +8 -0
  160. package/v2Containers/Cap/reducer.js +18 -3
  161. package/v2Containers/Cap/sagas.js +64 -9
  162. package/v2Containers/Cap/selectors.js +27 -13
  163. package/v2Containers/Cap/tests/Cap.test.js +164 -0
  164. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +2 -1
  165. package/v2Containers/Cap/tests/actions.test.js +11 -0
  166. package/v2Containers/Cap/tests/reducer.test.js +59 -0
  167. package/v2Containers/Cap/tests/saga.test.js +181 -2
  168. package/v2Containers/Cap/tests/selectors.test.js +42 -18
  169. package/v2Containers/CapFacebookPreview/sagas.js +7 -5
  170. package/v2Containers/CreativesContainer/SlideBoxContent.js +86 -4
  171. package/v2Containers/CreativesContainer/SlideBoxFooter.js +4 -3
  172. package/v2Containers/CreativesContainer/SlideBoxHeader.js +30 -14
  173. package/v2Containers/CreativesContainer/constants.js +5 -0
  174. package/v2Containers/CreativesContainer/index.js +157 -38
  175. package/v2Containers/CreativesContainer/index.scss +12 -0
  176. package/v2Containers/CreativesContainer/messages.js +33 -1
  177. package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +11 -0
  178. package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +5 -2
  179. package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +7 -1
  180. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +227 -0
  181. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +73 -0
  182. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +80 -0
  183. package/v2Containers/CreativesContainer/tests/index.test.js +16 -0
  184. package/v2Containers/Ebill/sagas.js +3 -10
  185. package/v2Containers/Email/index.js +38 -19
  186. package/v2Containers/Email/initialSchema.js +1 -1
  187. package/v2Containers/Email/sagas.js +22 -26
  188. package/v2Containers/EmailWrapper/index.js +18 -8
  189. package/v2Containers/FTP/index.js +2 -2
  190. package/v2Containers/FTP/sagas.js +3 -4
  191. package/v2Containers/Facebook/sagas.js +26 -17
  192. package/v2Containers/InApp/actions.js +64 -0
  193. package/v2Containers/InApp/constants.js +160 -0
  194. package/v2Containers/InApp/index.js +792 -0
  195. package/v2Containers/InApp/index.scss +50 -0
  196. package/v2Containers/InApp/messages.js +114 -0
  197. package/v2Containers/InApp/reducer.js +109 -0
  198. package/v2Containers/InApp/sagas.js +151 -0
  199. package/v2Containers/InApp/selectors.js +12 -0
  200. package/v2Containers/InApp/tests/action.test.js +53 -0
  201. package/v2Containers/InApp/tests/index.test.js +165 -0
  202. package/v2Containers/InApp/tests/mockData.js +898 -0
  203. package/v2Containers/InApp/tests/reducer.test.js +177 -0
  204. package/v2Containers/InApp/tests/sagas.test.js +391 -0
  205. package/v2Containers/InApp/utils.js +12 -0
  206. package/v2Containers/LanguageProvider/index.js +17 -5
  207. package/v2Containers/LanguageProvider/reducer.js +3 -2
  208. package/v2Containers/LanguageProvider/sagas.js +7 -8
  209. package/v2Containers/LanguageProvider/selectors.js +2 -1
  210. package/v2Containers/LanguageProvider/tests/index.test.js +5 -2
  211. package/v2Containers/LanguageProvider/tests/reducer.test.js +6 -3
  212. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +28 -16
  213. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -2
  214. package/v2Containers/Line/Container/ImageCarousel/tests/content.test.js +5 -3
  215. package/v2Containers/Line/Container/ImageCarousel/tests/index.test.js +5 -3
  216. package/v2Containers/Line/Container/ImageMap/index.js +1 -1
  217. package/v2Containers/Line/Container/Text/index.js +16 -1
  218. package/v2Containers/Line/Container/Video/index.js +2 -1
  219. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +18134 -107
  220. package/v2Containers/Line/Container/Wrapper/tests/index.test.js +5 -3
  221. package/v2Containers/Line/Container/Wrapper/utils.js +1 -1
  222. package/v2Containers/Line/Container/index.js +4 -0
  223. package/v2Containers/Line/Container/sagas.js +30 -20
  224. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +123 -81
  225. package/v2Containers/Line/Container/tests/index.test.js +5 -2
  226. package/v2Containers/Login/index.js +1 -2
  227. package/v2Containers/MobilePush/Create/index.js +40 -17
  228. package/v2Containers/MobilePush/Create/sagas.js +18 -12
  229. package/v2Containers/MobilePush/Edit/index.js +16 -7
  230. package/v2Containers/MobilePush/Edit/sagas.js +30 -20
  231. package/v2Containers/MobilepushWrapper/index.js +3 -0
  232. package/v2Containers/Rcs/sagas.js +14 -14
  233. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +123 -87
  234. package/v2Containers/Rcs/tests/index.test.js +5 -3
  235. package/v2Containers/Sms/Create/sagas.js +10 -6
  236. package/v2Containers/Sms/Edit/sagas.js +14 -8
  237. package/v2Containers/SmsTrai/Create/sagas.js +9 -10
  238. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +4 -4
  239. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +12 -8
  240. package/v2Containers/SmsTrai/Edit/tests/index.test.js +5 -3
  241. package/v2Containers/TagList/_tagList.scss +18 -0
  242. package/v2Containers/TagList/index.js +81 -42
  243. package/v2Containers/TagList/tests/TagList.test.js +6 -7
  244. package/v2Containers/TagList/tests/mockdata.js +10 -166
  245. package/v2Containers/TagList/tests/utils.test.js +17 -0
  246. package/v2Containers/TagList/utils.js +15 -0
  247. package/v2Containers/Templates/_templates.scss +60 -5
  248. package/v2Containers/Templates/actions.js +6 -5
  249. package/v2Containers/Templates/constants.js +2 -1
  250. package/v2Containers/Templates/index.js +576 -181
  251. package/v2Containers/Templates/messages.js +52 -8
  252. package/v2Containers/Templates/reducer.js +3 -1
  253. package/v2Containers/Templates/sagas.js +54 -38
  254. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +669 -43
  255. package/v2Containers/Templates/tests/actions.test.js +19 -0
  256. package/v2Containers/Templates/tests/index.test.js +53 -1
  257. package/v2Containers/Templates/tests/mockData.js +45 -1
  258. package/v2Containers/Templates/tests/reducer.test.js +50 -0
  259. package/v2Containers/Templates/tests/sagas.test.js +116 -3
  260. package/v2Containers/Templates/tests/selector.test.js +17 -0
  261. package/v2Containers/TemplatesV2/index.js +180 -8
  262. package/v2Containers/TemplatesV2/messages.js +8 -0
  263. package/v2Containers/TemplatesV2/tests/index.test.js +104 -0
  264. package/v2Containers/TemplatesV2/tests/mockData.js +685 -0
  265. package/v2Containers/Viber/constants.js +58 -0
  266. package/v2Containers/Viber/index.js +404 -421
  267. package/v2Containers/Viber/index.scss +107 -0
  268. package/v2Containers/Viber/messages.js +70 -2
  269. package/v2Containers/Viber/sagas.js +22 -14
  270. package/v2Containers/Viber/style.js +20 -0
  271. package/v2Containers/Viber/tests/index.test.js +299 -0
  272. package/v2Containers/Viber/tests/mockData.js +134 -0
  273. package/v2Containers/WeChat/MapTemplates/sagas.js +22 -14
  274. package/v2Containers/WeChat/RichmediaTemplates/Create/sagas.js +12 -11
  275. package/v2Containers/WeChat/RichmediaTemplates/Edit/sagas.js +9 -5
  276. package/v2Containers/Whatsapp/actions.js +16 -0
  277. package/v2Containers/Whatsapp/constants.js +24 -0
  278. package/v2Containers/Whatsapp/index.js +892 -222
  279. package/v2Containers/Whatsapp/index.scss +91 -1
  280. package/v2Containers/Whatsapp/messages.js +98 -1
  281. package/v2Containers/Whatsapp/reducer.js +19 -0
  282. package/v2Containers/Whatsapp/sagas.js +67 -12
  283. package/v2Containers/Whatsapp/styles.scss +35 -0
  284. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34983 -24886
  285. package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +12 -0
  286. package/v2Containers/Whatsapp/tests/actions.test.js +21 -0
  287. package/v2Containers/Whatsapp/tests/index.test.js +17 -4
  288. package/v2Containers/Whatsapp/tests/mockData.js +77 -0
  289. package/v2Containers/Whatsapp/tests/reducer.test.js +67 -0
  290. package/v2Containers/Whatsapp/tests/saga.test.js +201 -0
  291. package/v2Containers/Whatsapp/tests/utils.test.js +18 -0
  292. package/v2Containers/Whatsapp/utils.js +65 -4
  293. package/v2Containers/Zalo/actions.js +24 -0
  294. package/v2Containers/Zalo/constants.js +59 -0
  295. package/v2Containers/Zalo/index.js +548 -0
  296. package/v2Containers/Zalo/index.scss +75 -0
  297. package/v2Containers/Zalo/messages.js +86 -0
  298. package/v2Containers/Zalo/reducer.js +63 -0
  299. package/v2Containers/Zalo/saga.js +45 -0
  300. package/v2Containers/Zalo/selectors.js +19 -0
  301. package/v2Containers/Zalo/tests/actions.test.js +26 -0
  302. package/v2Containers/Zalo/tests/index.test.js +149 -0
  303. package/v2Containers/Zalo/tests/mockData.js +11527 -0
  304. package/v2Containers/Zalo/tests/reducer.test.js +96 -0
  305. package/v2Containers/Zalo/tests/saga.test.js +118 -0
  306. package/v2Containers/Zalo/tests/selector.test.js +51 -0
  307. package/v2Containers/mockdata.js +1531 -680
  308. package/containers/TestPage/constants.js +0 -7
  309. package/containers/TestPage/index.js +0 -31
  310. package/containers/TestPage/messages.js +0 -13
  311. package/containers/TestPage/reducer.js +0 -21
  312. package/containers/TestPage/sagas.js +0 -11
  313. package/containers/Testv2/actions.js +0 -15
  314. package/containers/Testv2/constants.js +0 -7
  315. package/containers/Testv2/index.js +0 -47
  316. package/containers/Testv2/messages.js +0 -21
  317. package/containers/Testv2/reducer.js +0 -23
  318. package/containers/Testv2/sagas.js +0 -11
  319. package/containers/Testv2/selectors.js +0 -25
  320. package/reducers.js +0 -73
  321. package/store.js +0 -61
  322. package/utils/tests/asyncInjectors.test.js +0 -173
  323. package/v2Containers/TestPage/constants.js +0 -7
  324. package/v2Containers/TestPage/index.js +0 -31
  325. package/v2Containers/TestPage/messages.js +0 -13
  326. package/v2Containers/TestPage/reducer.js +0 -21
  327. package/v2Containers/TestPage/sagas.js +0 -11
  328. package/v2Containers/Testv2/actions.js +0 -15
  329. package/v2Containers/Testv2/constants.js +0 -7
  330. package/v2Containers/Testv2/index.js +0 -47
  331. package/v2Containers/Testv2/messages.js +0 -21
  332. package/v2Containers/Testv2/reducer.js +0 -23
  333. package/v2Containers/Testv2/sagas.js +0 -11
  334. package/v2Containers/Testv2/selectors.js +0 -25
@@ -7,16 +7,40 @@
7
7
  import PropTypes from 'prop-types';
8
8
  import React from 'react';
9
9
  import { connect } from 'react-redux';
10
+ import moment from 'moment';
11
+ import { FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
10
12
  // import styled from 'styled-components';
11
- import { CapSpin, CapModal, CapButton, CapPopover, CapInput, CapTree, CapSelect, CapTooltip } from '@capillarytech/cap-ui-library';
12
-
13
+ import {
14
+ CapSpin,
15
+ CapModal,
16
+ CapButton,
17
+ CapPopover,
18
+ CapInput,
19
+ CapTree,
20
+ CapSelect,
21
+ CapTooltip,
22
+ CapLink,
23
+ CapIcon,
24
+ CapRow,
25
+ CapLabel,
26
+ } from "@capillarytech/cap-ui-library";
27
+ import './style.scss';
13
28
  import _ from 'lodash';
14
29
  import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
15
30
  import { createStructuredSelector } from 'reselect';
16
31
  import messages from './messages';
17
32
  import { makeSelectLoyaltyPromotionDisplay } from '../../v2Containers/Cap/selectors';
18
- import { CARD_RELATED_TAGS } from '../../containers/App/constants';
19
- import { hasCardBasedScope } from '../../utils/common';
33
+ import { CARD_RELATED_TAGS, HOSPITALITY_RELATED_TAGS, CUSTOMER_BARCODE_TAG } from '../../containers/App/constants';
34
+ import { hasCardBasedScope, hasCustomerBarcodeFeatureEnabled, hasHospitalityBasedScope } from '../../utils/common';
35
+
36
+ import {
37
+ GET_TRANSLATION_MAPPED,
38
+ JAPANESE_HELP_TEXT,
39
+ TAG_TRANSLATION_DOC,
40
+ } from "../../containers/TagList/constants";
41
+ import { EMAIL, JP_LOCALE_HIDE_FEATURE } from '../../v2Containers/App/constants';
42
+ import { hidingDateTagsForJpLocale } from '../../v2Containers/TagList/utils';
43
+
20
44
 
21
45
  const {Search} = CapInput;
22
46
  const {CapTreeNode} = CapTree;
@@ -32,10 +56,36 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
32
56
  visible: false,
33
57
  dynamicDateValue: '',
34
58
  showModal: false,
59
+ translationLang: '',
60
+ tagsList: []
35
61
  };
36
62
  this.renderTags = this.renderTags.bind(this);
37
63
  this.getSearchedExpandedKeys = this.getSearchedExpandedKeys.bind(this);
38
64
  }
65
+ getTranslationMappedLocale(locale) {
66
+ return GET_TRANSLATION_MAPPED?.[locale];
67
+ }
68
+ componentDidMount() {
69
+ const user = localStorage.getItem('user');
70
+ let locale = 'en';
71
+ moment.locale(locale);
72
+ if (user) {
73
+ locale = JSON.parse(user).lang || locale;
74
+ }
75
+ locale = this.getTranslationMappedLocale(locale);
76
+ this.setState({
77
+ translationLang: locale,
78
+ });
79
+ }
80
+
81
+ componentDidUpdate(prevProps, prevState){
82
+ if (this.props.tags !== prevProps.tags || this.state.searchValue !== prevState.searchValue) {
83
+ let temp = this.renderTags(this.props.tags, this.state.searchValue);
84
+ this.setState({
85
+ tagsList: temp
86
+ });
87
+ }
88
+ }
39
89
 
40
90
  onChange = (e) => {
41
91
  const value = e.target.value;
@@ -57,12 +107,12 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
57
107
  let list = [];
58
108
  _.forEach(tags, (val = {}, key) => {
59
109
  if (_.has(val, 'subtags')) {
60
- if ((val.name || '').toLowerCase().indexOf(value.toLowerCase()) !== -1) {
110
+ if (val.name && typeof val.name === 'string' && (val.name || '').toLowerCase().indexOf(value.toLowerCase()) !== -1) {
61
111
  list.push(key);
62
112
  }
63
113
  const temp = this.getSearchedExpandedKeys(val.subtags, value);
64
114
  list = list.concat(temp);
65
- } else if ((val.name || '').toLowerCase().indexOf(value.toLowerCase()) !== -1) {
115
+ } else if (val.name && typeof val.name === 'string' && (val.name || '').toLowerCase().indexOf(value.toLowerCase()) !== -1) {
66
116
  list.push(key);
67
117
  }
68
118
  });
@@ -136,54 +186,76 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
136
186
  };
137
187
 
138
188
  renderTags(tags, searchString = '') {
139
- const { disableRelatedTags, childTagsToDisable, parentTagstoDisable, showCardsRelatedTags} = this.props.disableTagsDetails;
189
+ const { disableRelatedTags, childTagsToDisable, parentTagstoDisable, showCardsRelatedTags } = this?.props?.disableTagsDetails;
190
+ const { accessibleFeatures = [] } = this?.props?.currentOrgDetails || {};
191
+ const hideDateTagsForJpLocale = accessibleFeatures.includes(JP_LOCALE_HIDE_FEATURE);
140
192
  const list = [];
141
193
  const loyaltyAttrDisableText = <FormattedMessage {...messages.loyaltyAttributeDisable} />;
194
+ const customerBarcodeDisableText = <FormattedMessage {...messages.customerBarcodeDisable} />;
142
195
  let clonedTags = _.cloneDeep(tags);
143
196
  if (!hasCardBasedScope()) {
144
197
  clonedTags = _.omit(clonedTags, CARD_RELATED_TAGS);
145
198
  }
199
+ if (!hasHospitalityBasedScope()) {
200
+ //filtering HOSPITALITY_RELATED_TAGS if org does not have HOSPITALITY_BASED_SCOPE feature enabled
201
+ clonedTags = _.omit(clonedTags, HOSPITALITY_RELATED_TAGS);
202
+ }
203
+ if (!hasCustomerBarcodeFeatureEnabled()) {
204
+ //filtering CUSTOMER_BARCODE_TAG if org does not have CUSTOMER_BARCODE_TAG feature enabled
205
+ clonedTags = _.omit(clonedTags, CUSTOMER_BARCODE_TAG);
206
+ }
146
207
  _.forEach(clonedTags, (val = '', key) => {
147
208
  let supportedTagsString = '';
148
209
  _.forEach(val.supportedTags, (supportedTag) => {
149
210
  supportedTagsString += `${supportedTag} ,`;
150
211
  });
151
212
  supportedTagsString = supportedTagsString.replace(/,\s*$/, "");
213
+ const tagDescriptionOrName = _.toLower(String(_.get(val, 'desc', '') || _.get(val, 'name', '')));
214
+ const searchStringLower = _.toLower(searchString);
215
+ const tagContainsSearchedString = tagDescriptionOrName.includes(searchStringLower);
152
216
  if (_.has(val, 'subtags')) {
153
217
  const disabled = disableRelatedTags ? parentTagstoDisable.includes(key) : false;
154
218
  const temp = this.renderTags(val.subtags, '', disabled);
155
- list.push((
219
+ const tagValue = (
156
220
  <CapTreeNode
157
- title={disabled ? <CapTooltip title={loyaltyAttrDisableText}>{val.name}</CapTooltip> : val.name}
221
+ title={disabled ? <CapTooltip title={loyaltyAttrDisableText}>{val?.name}</CapTooltip> : val?.name}
158
222
  tag={val}
159
- key={val.couponSeriesId ? `${key}(${val.couponSeriesId})` : `${key}`}
223
+ key={val?.incentiveSeriesId ? `${key}(${val?.incentiveSeriesId})` : `${key}`}
160
224
  disabled={disabled}
161
225
  >
162
226
  {temp}
163
227
  </CapTreeNode>
164
- ));
165
- } else if (searchString === '' || !searchString || ((val.name || '').toLowerCase().indexOf(searchString.toLowerCase()) !== -1)) {
166
- const childDisabled = disableRelatedTags ? childTagsToDisable.includes(key) : false;
228
+ );
229
+ hidingDateTagsForJpLocale(hideDateTagsForJpLocale, val, list, tagValue);
230
+ } else if (searchString === '' || !searchString || tagContainsSearchedString) {
231
+ let childDisabled = true;
232
+ if (key === CUSTOMER_BARCODE_TAG && !hasCustomerBarcodeFeatureEnabled()) {
233
+ childDisabled = true;
234
+ } else {
235
+ childDisabled = disableRelatedTags ? childTagsToDisable.includes(key) : false;
236
+ }
167
237
  const tempNode = (
168
238
  <CapTreeNode
169
- title={childDisabled ? <CapTooltip title={loyaltyAttrDisableText}>{val.desc || val.name}</CapTooltip> : (val.desc || val.name)}
239
+ title={childDisabled ? <CapTooltip title={key === CUSTOMER_BARCODE_TAG ? customerBarcodeDisableText : loyaltyAttrDisableText}>{val.desc || val.name}</CapTooltip> : (val.desc || val.name)}
170
240
  tag={val}
171
241
  isLeaf
172
- key={val.couponSeriesId ? `${key}(${val.couponSeriesId})` : `${key}`}
242
+ key={val?.incentiveSeriesId ? `${key}(${val?.incentiveSeriesId})` : `${key}`}
173
243
  disabled={childDisabled}
174
244
  >
175
245
  </CapTreeNode>);
176
- list.push(tempNode);
246
+ hidingDateTagsForJpLocale(hideDateTagsForJpLocale, val, list, tempNode);
177
247
  }
178
248
  });
179
249
  return list;
180
250
  }
181
-
251
+ openTranslationLink = () => {
252
+ window.open(TAG_TRANSLATION_DOC, '_blank');
253
+ }
182
254
  render() {
183
- const { hidePopover = false, tags = {}, intl = {}, moduleFilterEnabled, label, modalProps } = this.props;
255
+ const { hidePopover = false, tags = {}, intl = {}, moduleFilterEnabled, label, modalProps, channel, fetchingSchemaError = false } = this.props;
184
256
  const tg = tags;
185
257
  const {formatMessage} = intl;
186
- const { tagValue, expandedKeys, autoExpandParent, searchValue, visible } = this.state;
258
+ const { tagValue, expandedKeys, autoExpandParent, searchValue, visible, translationLang } = this.state;
187
259
  const options = [
188
260
  {
189
261
  value: "All",
@@ -222,9 +294,31 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
222
294
  expandedKeys={expandedKeys}
223
295
  autoExpandParent={autoExpandParent}
224
296
  onExpand={this.onExpand}
225
- >
226
- {this.renderTags(tg, searchValue)}
297
+ >
298
+ {/* {this.renderTags(tg, searchValue)} */}
299
+ {this.state.tagsList}
227
300
  </CapTree>
301
+ {translationLang === "ja-JP" &&
302
+ <div className="tag-list-footer">
303
+ <CapIcon
304
+ type="help"
305
+ size="s"
306
+ />
307
+ <CapLink>
308
+ <CapButton id="translationtagfooter" type="flat" onClick={this.openTranslationLink} >
309
+ <div className="tag-list-footer-icon">
310
+ <div>{JAPANESE_HELP_TEXT}</div>
311
+ <CapIcon
312
+ type="open-in-new-light"
313
+ size="s"
314
+ svgProps={{ color: FONT_COLOR_05 }}
315
+ />
316
+ </div>
317
+ </CapButton>
318
+ </CapLink>
319
+ </div>
320
+ }
321
+
228
322
  </CapSpin>
229
323
  </div>);
230
324
  return (
@@ -233,17 +327,43 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
233
327
  visible={this.props.visibleTaglist}
234
328
  footer={[]}
235
329
  {...modalProps}
236
- >
330
+ >
237
331
  {contentSection}
238
332
  </CapModal> :
239
333
  <CapPopover
240
- visible={visible}
334
+ visible={fetchingSchemaError ? false : visible}
241
335
  onVisibleChange={this.togglePopoverVisibility}
242
336
  content={contentSection}
243
337
  trigger="click"
244
- placement="rightTop"
338
+ placement={channel === EMAIL.toUpperCase() ? "leftTop" : "rightTop"}
339
+ >
340
+ <CapTooltip
341
+ title={
342
+ fetchingSchemaError && (
343
+ <CapRow className="tooltip-text-container">
344
+ <CapLabel className="tooltip-text1">
345
+ {formatMessage(messages.somethingWentWrong)}
346
+ </CapLabel>
347
+ <CapLabel className="tooltip-text2">
348
+ {formatMessage(messages.labelFetchErrorMsg)}
349
+ </CapLabel>
350
+ </CapRow>
351
+ )
352
+ }
353
+ placement="right"
245
354
  >
246
- <CapButton isAddBtn type="flat">{label || ''}</CapButton>
355
+ <CapRow className="tooltip-add-label-container">
356
+ <CapButton
357
+ disabled={
358
+ this?.props?.disabled || fetchingSchemaError
359
+ }
360
+ isAddBtn
361
+ type="flat"
362
+ >
363
+ {label || ""}
364
+ </CapButton>
365
+ </CapRow>
366
+ </CapTooltip>
247
367
  </CapPopover>
248
368
  }
249
369
  <CapModal
@@ -278,6 +398,10 @@ CapTagList.propTypes = {
278
398
  hidePopover: PropTypes.bool,
279
399
  modalProps: PropTypes.any,
280
400
  disableTagsDetails: PropTypes.object,
401
+ currentOrgDetails: PropTypes.object,
402
+ channel: PropTypes.string,
403
+ disabled: PropTypes.bool,
404
+ fetchingSchemaError: PropTypes.bool,
281
405
  };
282
406
 
283
407
  CapTagList.defaultValue = {
@@ -295,4 +419,3 @@ const mapStateToProps = createStructuredSelector({
295
419
 
296
420
 
297
421
  export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(CapTagList));
298
-
@@ -46,4 +46,16 @@ export default defineMessages({
46
46
  id: `creatives.componentsV2.CapTagList.loyaltyAttributeDisable`,
47
47
  defaultMessage: 'You won’t be able to add loyalty related attributes since the loyalty program/ card series is None.',
48
48
  },
49
+ "customerBarcodeDisable": {
50
+ id: `creatives.componentsV2.CapTagList.customerBarcodeDisable`,
51
+ defaultMessage: 'This label is not enabled for your organization. Please connect with your Capillary POC',
52
+ },
53
+ "somethingWentWrong": {
54
+ id: `creatives.componentsV2.CapTagList.somethingWentWrong`,
55
+ defaultMessage: 'Something went wrong',
56
+ },
57
+ 'labelFetchErrorMsg': {
58
+ id: `creatives.componentsV2.CapTagList.labelFetchErrorMsg`,
59
+ defaultMessage: 'Unable to fetch the labels. Please try again later'
60
+ },
49
61
  });
@@ -0,0 +1,26 @@
1
+ @import "~@capillarytech/cap-ui-library/styles/_variables";
2
+
3
+ @media (max-height: 25rem) {
4
+ .ant-tree.cap-tree-v2.ant-tree-icon-hide {
5
+ height: 8.5714rem;
6
+ }
7
+ }
8
+
9
+ .tooltip-add-label-container {
10
+ float: right;
11
+ }
12
+
13
+ .tooltip-text-container {
14
+ margin: $CAP_SPACE_12 $CAP_SPACE_20;
15
+ .tooltip-text1 {
16
+ margin-bottom: $CAP_SPACE_08;
17
+ font-weight: $FONT_WEIGHT_MEDIUM;
18
+ color: $FONT_COLOR_06;
19
+ font-size: $FONT_SIZE_L;
20
+ }
21
+ .tooltip-text2 {
22
+ font-weight: $FONT_WEIGHT_REGULAR;
23
+ color: $FONT_COLOR_06;
24
+ font-size: $FONT_SIZE_M;
25
+ }
26
+ }
@@ -1 +1,7 @@
1
1
  export const WHATSAPP = 'WHATSAPP';
2
+ export const DEFAULT = 'DEFAULT';
3
+ export const SUPPORTED_FILE_FORMATS = {
4
+ VIBER: '3GP, MP4, MOV, M4V',
5
+ DEFAULT: 'MP4',
6
+ };
7
+ export const VIBER_MAX_DURATION = 600; // seconds
@@ -18,9 +18,10 @@ import {
18
18
  CapSpin,
19
19
  } from '@capillarytech/cap-ui-library';
20
20
  import messages from './messages';
21
- import {bytes2Size} from '../../utils/common';
22
- import { WHATSAPP } from './constants';
21
+ import {bytes2Size, getDecodedFileName} from '../../utils/common';
22
+ import { SUPPORTED_FILE_FORMATS, WHATSAPP, DEFAULT, VIBER_MAX_DURATION } from './constants';
23
23
  import './index.scss';
24
+ import { VIBER } from '../../v2Containers/CreativesContainer/constants';
24
25
 
25
26
  function CapVideoUpload(props) {
26
27
  const {
@@ -41,7 +42,7 @@ function CapVideoUpload(props) {
41
42
  } = props;
42
43
  const [isVideoError, updateVideoErrorMessage] = useState(false);
43
44
  const [isVideo, updateVideoStatus] = useState(false);
44
- const [videoDuration, updateVideoDuration] = useState('');
45
+ const [videoDuration, updateVideoDuration] = useState(null);
45
46
  const [isPlaying, updateIsPlaying] = useState(false);
46
47
  const [isSpinning, setSpinning] = useState(false);
47
48
 
@@ -99,6 +100,7 @@ function CapVideoUpload(props) {
99
100
  videoName: metaVideoName,
100
101
  videoId: metaVideoId,
101
102
  fileHandle: karixFileHandle,
103
+ videoDuration: null,
102
104
  },
103
105
  );
104
106
  }
@@ -199,6 +201,7 @@ function CapVideoUpload(props) {
199
201
  }
200
202
  const onReUpload = () => {
201
203
  updateVideoStatus(false);
204
+ updateVideoDuration(null);
202
205
  onVideoUploadUpdateAssestList(
203
206
  index,
204
207
  {
@@ -207,7 +210,7 @@ function CapVideoUpload(props) {
207
210
  videoHeight: "",
208
211
  videoWidth: "",
209
212
  videoSrc: "",
210
- videoDuration: "",
213
+ videoDuration: null,
211
214
  videoId: "",
212
215
  fileHandle: "",
213
216
  }
@@ -217,12 +220,13 @@ function CapVideoUpload(props) {
217
220
  const updateMetadataLoaded = () => {
218
221
  const { current: { duration, videoHeight: metaVideoHeight, videoWidth: metaVideoWidth } = {} } = videoEl;
219
222
  if (duration) {
220
- const value = moment('1900-01-01 00:00:00').add(duration, 'seconds').format("HH.mm.ss"); // to get the duration of video
221
- updateVideoDuration(value);
223
+ updateVideoDuration(duration);
222
224
  if (videoWidth === undefined && videoHeight === undefined) {
223
- onVideoUploadUpdateAssestList(
224
- index,
225
- {
225
+ if (
226
+ channel !== VIBER ||
227
+ (channel === VIBER && duration <= VIBER_MAX_DURATION)
228
+ ) {
229
+ onVideoUploadUpdateAssestList(index, {
226
230
  videoSrc,
227
231
  videoId,
228
232
  videoName,
@@ -230,12 +234,16 @@ function CapVideoUpload(props) {
230
234
  videoWidth: metaVideoWidth,
231
235
  previewUrl,
232
236
  fileHandle,
233
- }
234
- );
237
+ videoDuration: duration,
238
+ });
239
+ } else {
240
+ onReUpload();
241
+ updateVideoErrorMessage(formatMessage(messages.videoDurationError));
242
+ }
235
243
  }
236
244
  }
237
245
  };
238
-
246
+ const videoDurationValue = moment('1900-01-01 00:00:00').add(videoDuration, 'seconds').format("HH.mm.ss"); // to get the duration of video
239
247
  return (
240
248
  <Fragment key={videoSrc}>
241
249
  <div style={{ overflow: 'hidden' }}>
@@ -264,11 +272,11 @@ function CapVideoUpload(props) {
264
272
  </video>
265
273
  {showVideoNameAndDuration &&
266
274
  <div className="video-info">
267
- <CapHeading type="h6">
268
- {videoName}
275
+ <CapHeading type="h4">
276
+ {getDecodedFileName(videoName)}
269
277
  </CapHeading>
270
278
  <CapHeading type="h6">
271
- {videoDuration}
279
+ {videoDurationValue}
272
280
  </CapHeading>
273
281
  </div>
274
282
  }
@@ -276,6 +284,16 @@ function CapVideoUpload(props) {
276
284
  </Fragment>
277
285
  );
278
286
  };
287
+
288
+ const getVideoSizeDescription = () => (
289
+ <CapHeading.CapHeadingSpan type="label2">
290
+ <FormattedMessage
291
+ {...messages.videoSizeDescription}
292
+ values={{ size: bytes2Size(videoSize) }}
293
+ />
294
+ </CapHeading.CapHeadingSpan>
295
+ );
296
+
279
297
  return (
280
298
  <CapSpin spinning={isSpinning}>
281
299
  <div style={style} className="cap-custom-video-upload">
@@ -295,26 +313,34 @@ function CapVideoUpload(props) {
295
313
  onClose={() => updateTemplateDrawerRequirement(false)}
296
314
  />
297
315
  </form>
298
- {channel !== WHATSAPP ?
316
+ {![WHATSAPP, VIBER].includes(channel) &&
299
317
  <>
300
318
  <CapHeading.CapHeadingSpan type="h6" className="video-description">
301
319
  <FormattedMessage {...messages.videoRatioDescription} />
302
320
  </CapHeading.CapHeadingSpan>
303
321
  {' '}
304
322
  <CapHeading.CapHeadingSpan type="h6" className="video-description file-format">
305
- <FormattedMessage {...messages.fileFormat} />
306
-
323
+ <FormattedMessage {...messages.channelFileFormat} values={{ format: SUPPORTED_FILE_FORMATS[DEFAULT] }} />
307
324
  </CapHeading.CapHeadingSpan>
308
325
  <CapHeading.CapHeadingSpan type="h6" className="video-description video-details">
309
326
  <FormattedMessage {...messages.videoSizeDescription} values={{size: bytes2Size(videoSize)}} />
310
327
  </CapHeading.CapHeadingSpan>
311
- </> :
328
+ </>}
329
+ {channel === WHATSAPP &&
312
330
  <>
313
- <CapHeading.CapHeadingSpan type="label2" className="">
314
- <FormattedMessage {...messages.videoSizeDescription} values={{size: bytes2Size(videoSize)}} />
331
+ {getVideoSizeDescription()}
332
+ <CapHeading.CapHeadingSpan type="label2" className="whatsapp-format">
333
+ <FormattedMessage {...messages.channelFileFormat} values={{ format: SUPPORTED_FILE_FORMATS[DEFAULT] }} />
315
334
  </CapHeading.CapHeadingSpan>
335
+ </>}
336
+ {channel === VIBER &&
337
+ <>
338
+ {getVideoSizeDescription()}
316
339
  <CapHeading.CapHeadingSpan type="label2" className="whatsapp-format">
317
- <FormattedMessage {...messages.whatsappFileFormat} />
340
+ <FormattedMessage {...messages.channelFileFormat} values={{ format: SUPPORTED_FILE_FORMATS.VIBER }} />
341
+ </CapHeading.CapHeadingSpan>
342
+ <CapHeading.CapHeadingSpan type="label2" className="video-duration">
343
+ <FormattedMessage {...messages.viberMaxDuration} />
318
344
  </CapHeading.CapHeadingSpan>
319
345
  </>}
320
346
  </div>
@@ -12,7 +12,6 @@ $classPrefix: cap-custom-video-upload;
12
12
  .video-reupload{
13
13
  float: right;
14
14
  color: $FONT_COLOR_05;
15
- padding: 0px;
16
15
  right: 40px;
17
16
  }
18
17
  .video-info{
@@ -46,4 +45,7 @@ $classPrefix: cap-custom-video-upload;
46
45
  }
47
46
  .video-panel {
48
47
  display: flex;
49
- }
48
+ }
49
+ .video-duration {
50
+ margin-left: 8rem;
51
+ }
@@ -55,12 +55,16 @@ export default defineMessages({
55
55
  id: `${scope}.imageReUpload`,
56
56
  defaultMessage: 'Re upload',
57
57
  },
58
- fileFormat: {
59
- id: `${scope}.fileFormat`,
60
- defaultMessage: 'Format: MP4',
58
+ channelFileFormat: {
59
+ id: `${scope}.channelFileFormat`,
60
+ defaultMessage: 'Format: {format}',
61
61
  },
62
- whatsappFileFormat: {
63
- id: `${scope}.whatsappFileFormat`,
64
- defaultMessage: 'Format: MP4',
62
+ viberMaxDuration: {
63
+ id: `${scope}.viberMaxDuration`,
64
+ defaultMessage: 'Max Duration: 600 seconds',
65
+ },
66
+ videoDurationError: {
67
+ id: `${scope}.videoDurationError`,
68
+ defaultMessage: 'Video duration should not exceed 600 seconds',
65
69
  },
66
70
  });