@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
@@ -8,7 +8,7 @@
8
8
  import PropTypes from 'prop-types';
9
9
 
10
10
  import React from 'react';
11
- import {bindActionCreators} from "redux";
11
+ import { bindActionCreators, compose } from "redux";
12
12
  import { connect } from 'react-redux';
13
13
  import { Row, Col, Spin, Breadcrumb, notification } from 'antd';
14
14
  import { createStructuredSelector } from 'reselect';
@@ -25,6 +25,13 @@ import {makeSelectTemplates} from "../../Templates/selectors";
25
25
  import messages from './messages';
26
26
  import './_mobilePushCreate.scss';
27
27
  import {makeSelectCreate} from "../Create/selectors";
28
+ import injectSaga from "../../../utils/injectSaga";
29
+ import injectReducer from '../../../utils/injectReducer';
30
+ import reducer from './reducer';
31
+ import { editMPushSaga } from './sagas';
32
+ import { templateSaga } from '../../Templates/sagas';
33
+ import { UserIsAuthenticated } from '../../../utils/authWrapper';
34
+
28
35
  const BreadcrumbItem = Breadcrumb.Item;
29
36
 
30
37
  export class Edit extends React.Component { // eslint-disable-line react/prefer-stateless-function
@@ -1779,7 +1786,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1779
1786
  temp.content.appName = this.props.Templates.selectedWeChatAccount.name;
1780
1787
  }
1781
1788
  _.forEach(col.supportedEvents, (event) => {
1782
- console.log('injected event for ', col, event, this.getMappedEvent(col.id, event));
1783
1789
  temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
1784
1790
  });
1785
1791
  return true;
@@ -2573,4 +2579,15 @@ function mapDispatchToProps(dispatch) {
2573
2579
  };
2574
2580
  }
2575
2581
 
2576
- export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(Edit));
2582
+ const withConnect = connect(mapStateToProps, mapDispatchToProps);
2583
+ const withReducer = injectReducer({ key: 'mobileEdit', reducer });
2584
+ const withSaga = injectSaga({ key: 'mobileEdit', saga: editMPushSaga });
2585
+ const withTemplatesSaga = injectSaga({ key: 'templates', saga: templateSaga });
2586
+
2587
+ export default compose(
2588
+ UserIsAuthenticated,
2589
+ withReducer,
2590
+ withSaga,
2591
+ withTemplatesSaga,
2592
+ withConnect,
2593
+ )(injectIntl(Edit));
@@ -1,5 +1,4 @@
1
- import { call, put, takeLatest, take, cancel } from 'redux-saga/effects';
2
- import { LOCATION_CHANGE } from 'react-router-redux';
1
+ import { call, put, takeLatest, take, cancel, all } from 'redux-saga/effects';
3
2
  // import { schema, normalize } from 'normalizr';
4
3
  import * as Api from '../../../services/api';
5
4
  import * as types from './constants';
@@ -78,36 +77,36 @@ export function* fetchWeCrmAccounts(action) {
78
77
  }
79
78
 
80
79
  function* watchFetchWeCrmAccounts() {
81
- const watcher = yield takeLatest(types.GET_WECRM_ACCOUNTS_REQUEST, fetchWeCrmAccounts);
82
- yield take(LOCATION_CHANGE);
83
- yield cancel(watcher);
80
+ yield takeLatest(types.GET_WECRM_ACCOUNTS_REQUEST, fetchWeCrmAccounts);
81
+
82
+
84
83
  }
85
84
 
86
85
  function* watchEditTemplate() {
87
- const watcher = yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
88
- yield take(LOCATION_CHANGE);
89
- yield cancel(watcher);
86
+ yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
87
+
88
+
90
89
  }
91
90
 
92
91
  function* watchGetTemplateDetails() {
93
- const watcher = yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
94
- yield take(LOCATION_CHANGE);
95
- yield cancel(watcher);
92
+ yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
93
+
94
+
96
95
  }
97
96
  function* watchUploadAsset() {
98
- const watcher = yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
99
- yield take(LOCATION_CHANGE);
100
- yield cancel(watcher);
97
+ yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
98
+
99
+
101
100
  }
102
101
  function* watchGetIosCtas() {
103
- const watcher = yield takeLatest(types.GET_IOS_CTAS, getIosCtas);
104
- yield take(LOCATION_CHANGE);
105
- yield cancel(watcher);
102
+ yield takeLatest(types.GET_IOS_CTAS, getIosCtas);
103
+
104
+
106
105
  }
107
106
  function* watchMobilepushTemplatesList() {
108
- const watcher = yield takeLatest(types.GET_MOBILEPUSH_TEMPLATES_LIST_REQUEST, getMobilepushTemplatesList);
109
- yield take(LOCATION_CHANGE);
110
- yield cancel(watcher);
107
+ yield takeLatest(types.GET_MOBILEPUSH_TEMPLATES_LIST_REQUEST, getMobilepushTemplatesList);
108
+
109
+
111
110
  }
112
111
 
113
112
  // All sagas to be loaded
@@ -116,3 +115,14 @@ export default [
116
115
  watchUploadAsset,
117
116
  watchGetIosCtas,
118
117
  ];
118
+
119
+ export function* editMPushSaga() {
120
+ yield all([
121
+ watchEditTemplate(),
122
+ watchGetTemplateDetails(),
123
+ watchFetchWeCrmAccounts(),
124
+ watchMobilepushTemplatesList(),
125
+ watchUploadAsset(),
126
+ watchGetIosCtas(),
127
+ ]);
128
+ }
@@ -12,7 +12,7 @@ import { Row, Col, Spin } from 'antd';
12
12
  import { injectIntl, intlShape } from 'react-intl';
13
13
  import { createStructuredSelector } from 'reselect';
14
14
  import _ from 'lodash';
15
- import { bindActionCreators } from 'redux';
15
+ import { bindActionCreators, compose} from 'redux';
16
16
  import { makeSelectCreate, makeSelectCreateResponse } from './selectors';
17
17
  import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
18
18
  import { UserIsAuthenticated } from '../../../utils/authWrapper';
@@ -23,6 +23,10 @@ import messages from './messages';
23
23
  import {checkUnicode, updateCharCount} from '../../../utils/smsCharCountV2';
24
24
  import * as globalActions from '../../../containers/Cap/actions';
25
25
  import {getMessageObject} from '../../../utils/messageUtils';
26
+ import injectSaga from '../../../utils/injectSaga';
27
+ import injectReducer from '../../../utils/injectReducer';
28
+ import reducer from './reducer';
29
+ import { createSmsSaga } from './sagas';
26
30
 
27
31
  export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
28
32
  constructor(props) {
@@ -1471,4 +1475,13 @@ function mapDispatchToProps(dispatch) {
1471
1475
  };
1472
1476
  }
1473
1477
 
1474
- export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(Create)));
1478
+ const withConnect = connect(mapStateToProps, mapDispatchToProps);
1479
+ const withReducer = injectReducer({ key: 'create', reducer });
1480
+ const withCreateSmsSaga = injectSaga({ key: 'create', saga: createSmsSaga });
1481
+
1482
+ export default compose(
1483
+ UserIsAuthenticated,
1484
+ withCreateSmsSaga,
1485
+ withReducer,
1486
+ withConnect,
1487
+ )(injectIntl(Create));
@@ -1,6 +1,4 @@
1
- import { take, cancel, call, put, takeLatest } from 'redux-saga/effects';
2
- import { LOCATION_CHANGE } from 'react-router-redux';
3
- // import { LOCATION_CHANGE } from 'react-router-redux';
1
+ import { take, cancel, call, put, takeLatest, all } from 'redux-saga/effects';
4
2
  // import { schema, normalize } from 'normalizr';
5
3
  import * as Api from '../../../services/api';
6
4
  import * as types from './constants';
@@ -25,12 +23,16 @@ export function* createTemplate(template) {
25
23
 
26
24
  function* watchCreateTemplate() {
27
25
 
28
- const watcher = yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
29
- yield take(LOCATION_CHANGE);
30
- yield cancel(watcher);
26
+ yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
31
27
  }
32
28
 
33
29
  // All sagas to be loaded
34
30
  export default [
35
31
  watchCreateTemplate,
36
32
  ];
33
+
34
+ export function* createSmsSaga() {
35
+ yield all([
36
+ watchCreateTemplate(),
37
+ ]);
38
+ }
@@ -13,7 +13,7 @@ import { Row, Col, Spin } from 'antd';
13
13
  import { injectIntl, intlShape } from 'react-intl';
14
14
  import { createStructuredSelector } from 'reselect';
15
15
  import _ from 'lodash';
16
- import { bindActionCreators } from 'redux';
16
+ import { bindActionCreators, compose } from 'redux';
17
17
  import { makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse } from './selectors';
18
18
  import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
19
19
  import { UserIsAuthenticated } from '../../../utils/authWrapper';
@@ -24,7 +24,10 @@ import '../Create/_smsCreate.scss';
24
24
  import messages from './messages';
25
25
  import * as globalActions from '../../../containers/Cap/actions';
26
26
  import {getMessageObject} from '../../../utils/messageUtils';
27
-
27
+ import injectSaga from '../../../utils/injectSaga';
28
+ import injectReducer from '../../../utils/injectReducer';
29
+ import reducer from './reducer';
30
+ import { editSmsSaga } from './sagas';
28
31
  export class Edit extends React.Component { // eslint-disable-line react/prefer-stateless-function
29
32
  constructor(props) {
30
33
  super(props);
@@ -1456,4 +1459,13 @@ function mapDispatchToProps(dispatch) {
1456
1459
  };
1457
1460
  }
1458
1461
 
1459
- export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(Edit)));
1462
+ const withConnect = connect(mapStateToProps, mapDispatchToProps);
1463
+ const withReducer = injectReducer({ key: 'edit', reducer });
1464
+ const withEditSmsSaga = injectSaga({ key: 'edit', saga: editSmsSaga });
1465
+
1466
+ export default compose(
1467
+ UserIsAuthenticated,
1468
+ withEditSmsSaga,
1469
+ withReducer,
1470
+ withConnect,
1471
+ )(injectIntl(Edit));
@@ -1,5 +1,4 @@
1
- import { call, put, takeLatest, take, cancel } from 'redux-saga/effects';
2
- import { LOCATION_CHANGE } from 'react-router-redux';
1
+ import { call, put, takeLatest, take, cancel, all } from 'redux-saga/effects';
3
2
  // import { schema, normalize } from 'normalizr';
4
3
  import * as Api from '../../../services/api';
5
4
  import * as types from './constants';
@@ -35,18 +34,25 @@ export function* getTemplateDetails(id) {
35
34
 
36
35
 
37
36
  function* watchEditTemplate() {
38
- const watcher = yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
39
- yield take(LOCATION_CHANGE);
40
- yield cancel(watcher);
37
+ yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
38
+
39
+
41
40
  }
42
41
 
43
42
  function* watchGetTemplateDetails() {
44
- const watcher = yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
45
- yield take(LOCATION_CHANGE);
46
- yield cancel(watcher);
43
+ yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
44
+
45
+
47
46
  }
48
47
 
49
48
  // All sagas to be loaded
50
49
  export default [
51
50
  watchEditTemplate, watchGetTemplateDetails,
52
51
  ];
52
+
53
+ export function* editSmsSaga() {
54
+ yield all([
55
+ watchEditTemplate(),
56
+ watchGetTemplateDetails(),
57
+ ]);
58
+ }
@@ -5,3 +5,26 @@
5
5
  */
6
6
 
7
7
  export const DEFAULT_ACTION = 'app/TagList/DEFAULT_ACTION';
8
+
9
+ export const JAPANESE_HELP_TEXT = 'ヘルプ :トークンの定義';
10
+
11
+ export const TAG_TRANSLATION_DOC = 'https://docs.capillarytech.com/docs/tags-translation';
12
+
13
+ export const GET_TRANSLATION_MAPPED = {
14
+ 'en': 'en-US',
15
+ 'zh-cn': 'zh',
16
+ 'zh': 'zh',
17
+ 'en-US': 'en-US',
18
+ 'ja-JP': 'ja-JP',
19
+ };
20
+
21
+ export const JAPANESE_HIDE_DATE_TAGS = [
22
+ "mm/dd/yyyy",
23
+ "dd/mm/yyyy",
24
+ "mm/dd/yy",
25
+ "dd Mon yyyy",
26
+ "Day, Mon dd, yy",
27
+ "dd.mm.yy",
28
+ "dd Mon",
29
+ "dd/m/yyyy",
30
+ ];
@@ -7,7 +7,6 @@
7
7
  import * as types from './constants';
8
8
 
9
9
  export function getAllTemplates(channel, queryParams) {
10
-
11
10
  return {
12
11
  type: types.GET_ALL_TEMPLATES_REQUEST, channel, queryParams,
13
12
  };
@@ -26,7 +25,6 @@
26
25
  }
27
26
 
28
27
  export function deleteTemplate(channel, id) {
29
-
30
28
  return {
31
29
  type: types.DELETE_TEMPLATE_REQUEST, channel, id,
32
30
  };
@@ -45,7 +43,6 @@
45
43
  }
46
44
 
47
45
  export function setWeChatAccount(weChatAccount) {
48
-
49
46
  return {
50
47
  type: types.SET_WECHAT_ACCOUNT,
51
48
  weChatAccount,
@@ -80,7 +77,6 @@
80
77
  }
81
78
 
82
79
  export function getTemplateDetails(id, channel) {
83
-
84
80
  return {
85
81
  type: types.GET_TEMPLATE_DETAILS_REQUEST,
86
82
  id,
@@ -95,7 +91,6 @@
95
91
  }
96
92
 
97
93
  export function resetUploadData() {
98
-
99
94
  return {
100
95
  type: types.RESET_UPLOAD_DATA,
101
96
  };
@@ -13,7 +13,7 @@ import { injectIntl, intlShape } from 'react-intl';
13
13
  import { createStructuredSelector } from 'reselect';
14
14
  import moment from "moment";
15
15
  import _ from 'lodash';
16
- import { bindActionCreators } from 'redux';
16
+ import { bindActionCreators, compose } from 'redux';
17
17
  import { Row, Select, Spin, Dropdown, Col, Breadcrumb, Menu, Modal} from 'antd';
18
18
  import { CapInput, CapButton, CapPopover, CapSelect } from '@capillarytech/cap-react-ui-library/';
19
19
  import { makeSelectTemplates, makeSelectTemplatesResponse } from './selectors';
@@ -44,6 +44,18 @@ import SlideBox from '../../components/SlideBox';
44
44
  import Pagination from '../../components/Pagination';
45
45
  import EmailPreview from '../../components/EmailPreview';
46
46
  import WechatRichmediaTemplatePreview from '../../components/TemplatePreview/WechatRichmediaTemplatePreview';
47
+ import { EMAIL } from '../../v2Containers/App/constants';
48
+ import injectSaga from '../../utils/injectSaga';
49
+ import injectReducer from '../../utils/injectReducer';
50
+ import { templateSaga } from './sagas';
51
+ import { createSmsSaga } from '../Sms/Create/sagas';
52
+ import { editSmsSaga } from '../Sms/Edit/sagas';
53
+ import { emailSaga } from '../Email/sagas';
54
+ import reducer from './reducer';
55
+ import mobilePushCreateReducer from '../MobilePush/Create/reducer';
56
+ import lineCreateReducer from '../Line/Create/reducer';
57
+ import { ebillSaga } from '../Ebill/sagas';
58
+ import { lineCreateSaga } from '../Line/Create/sagas';
47
59
 
48
60
  const MenuItem = Menu.Item;
49
61
  const Option = Select.Option;
@@ -232,7 +244,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
232
244
  this.getAllTemplates({params});
233
245
  });
234
246
  }
235
- } else if (this.state.channel.toLowerCase() === 'mobilepush' && (nextProps.location.query.account_id || nextProps.location.query.source_account_id)) {
247
+ } else if (this.state.channel.toLowerCase() === 'mobilepush' && (nextProps.location.query.account_id || nextProps.location.query.source_account_id)) {
236
248
  _.forEach(nextProps.Templates.weCrmAccounts, (account) => {
237
249
  if ((nextProps.location.query.account_id && account.id === Number(nextProps.location.query.account_id)) || (nextProps.location.query.source_account_id && account.sourceAccountIdentifier && account.sourceAccountIdentifier === nextProps.location.query.source_account_id)) {
238
250
  selectedAccount = account;
@@ -308,9 +320,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
308
320
  if (!nextProps.Templates.sendingFile && !_.isEqual(this.props.Templates.sendingFile, nextProps.Templates.sendingFile) && !nextProps.Templates.errorSendingFile) {
309
321
 
310
322
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
311
- const isLanguageSupport = (this.props.location.query.isLanguageSupport) ? this.props.location.query.isLanguageSupport : true;
312
- const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
313
- const type = this.props.location.query.type;
323
+ const isLanguageSupport = searchParams.get('isLanguageSupport') ? searchParams.get('isLanguageSupport') : true;
324
+ const isEdmSupport = (searchParams.get('isEdmSupport') !== "false") || false;
325
+ const type = searchParams.get('type');
314
326
  if (this.isEnabledInLibraryModule("callCreateFromProps")) {
315
327
  this.props.createNew();
316
328
  return;
@@ -456,7 +468,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
456
468
  };
457
469
  parent.postMessage(JSON.stringify(response), '*');
458
470
  }
459
-
471
+
460
472
  skipTemplateSelection = (e) => {
461
473
 
462
474
  const type = this.props.location.query.type;
@@ -538,7 +550,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
538
550
  const fileExtension = files[0].name.split('.').pop();
539
551
  const supportedZipFormats = ['zip'];
540
552
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
541
- const isLanguageSupport = (this.props.location.query.isLanguageSupport) ? this.props.location.query.isLanguageSupport : true;
553
+ const isLanguageSupport = this.props.location.query.isLanguageSupport ? this.props.location.query.isLanguageSupport : true;
542
554
  const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
543
555
 
544
556
  if (supportedZipFormats.indexOf(fileExtension.toLowerCase()) !== -1) {
@@ -756,7 +768,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
756
768
 
757
769
  menuOnClickEvent(ev) {
758
770
  let type = this.props.location.query.type;
759
- // const module = this.props.location.query.module ? this.props.location.query.module : 'default';
760
771
  const channel = this.state.channel.toLowerCase();
761
772
  switch (channel) {
762
773
  case 'wechat':
@@ -866,7 +877,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
866
877
  duplicateTemplate(template) {
867
878
 
868
879
  const duplicateObj = _.cloneDeep(template);
869
- duplicateObj.name = `Copy of ${template.name} ${moment().format('MM-DD-YYYY HH:mm:ss')}`;
880
+ duplicateObj.name = `${this.props.intl.formatMessage(messages.copyOf)} ${template.name} ${moment().format('MM-DD-YYYY HH:mm:ss')}`;
870
881
  delete duplicateObj._id;
871
882
  if (this.state.channel.toLowerCase() === "sms") {
872
883
  this.props.smsActions.createTemplate(duplicateObj);
@@ -899,9 +910,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
899
910
  handleEdmDefaultTemplateSelection = (isSelected, id) => {
900
911
  if (isSelected) {
901
912
  const data = _.find(this.props.Templates.cmsTemplates, {_id: id});
902
- const type = this.props.location.query.type;
913
+ const type = this.props.location.query.type
903
914
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
904
- const isLanguageSupport = (this.props.location.query.isLanguageSupport) ? this.props.location.query.isLanguageSupport : true;
915
+ const isLanguageSupport = this.props.location.query.isLanguageSupport ? this.props.location.query.isLanguageSupport : true;
905
916
  const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
906
917
  let getQuery = '';
907
918
 
@@ -984,7 +995,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
984
995
  templateInfo.appName = this.props.Templates.selectedWeChatAccount.name;
985
996
  } else if (this.state.channel.toLowerCase() === "email") {
986
997
 
987
- this.props.actions.getTemplateDetails(template._id);
998
+ this.props.actions.getTemplateDetails(template._id, EMAIL);
988
999
  } else if (this.state.channel.toLowerCase() === 'ebill') {
989
1000
  this.props.actions.getTemplateDetails(template._id);
990
1001
  }
@@ -1613,7 +1624,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1613
1624
  location={this.props.location}
1614
1625
  >
1615
1626
  </PreviewSideBar>
1616
-
1617
1627
  }
1618
1628
  {(this.state.channel.toLowerCase() === 'ebill' || this.state.channel.toLowerCase() === 'email') && htmlPreviewContent && <EmailPreview
1619
1629
  header={previewHeader}
@@ -1688,4 +1698,27 @@ function mapDispatchToProps(dispatch) {
1688
1698
  };
1689
1699
  }
1690
1700
 
1691
- export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(Templates)));
1701
+ const withSaga = injectSaga({ key: 'templates', saga: templateSaga });
1702
+ const withCreateSmsSaga = injectSaga({ key: 'create', saga: createSmsSaga });
1703
+ const withEditSmsSaga = injectSaga({ key: 'edit', saga: editSmsSaga });
1704
+ const withEmailSaga = injectSaga({ key: 'email', saga: emailSaga });
1705
+ const withEbillSaga = injectSaga({ key: 'ebill', saga: ebillSaga });
1706
+ const withLineCreateSaga = injectSaga({ key: 'line', saga: lineCreateSaga });
1707
+ const withReducer = injectReducer({ key: 'templates', reducer });
1708
+ const withMPushCreateReducer = injectReducer({ key: 'mobileCreate', reducer: mobilePushCreateReducer });
1709
+ const withLineCreateReducer = injectReducer({ key: 'lineTemplates', reducer: lineCreateReducer});
1710
+ const withConnect = connect(mapStateToProps, mapDispatchToProps);
1711
+
1712
+ export default compose(
1713
+ UserIsAuthenticated,
1714
+ withSaga,
1715
+ withCreateSmsSaga,
1716
+ withEditSmsSaga,
1717
+ withEmailSaga,
1718
+ withEbillSaga,
1719
+ withLineCreateSaga,
1720
+ withReducer,
1721
+ withMPushCreateReducer,
1722
+ withLineCreateReducer,
1723
+ withConnect,
1724
+ )(injectIntl(Templates));
@@ -1,5 +1,4 @@
1
- import { call, put, takeLatest, take, cancel } from 'redux-saga/effects';
2
- import { LOCATION_CHANGE } from 'react-router-redux';
1
+ import { call, put, takeLatest, take, cancel, all } from 'redux-saga/effects';
3
2
  // import { schema, normalize } from 'normalizr';
4
3
  import * as Api from '../../services/api';
5
4
  import * as types from './constants';
@@ -122,46 +121,32 @@ export function* getTemplateDetails(id, channel) {
122
121
  }
123
122
 
124
123
  function* watchGetAllTemplates() {
125
- const watcher = yield takeLatest(types.GET_ALL_TEMPLATES_REQUEST, getAllTemplates);
126
- yield take(LOCATION_CHANGE);
127
- yield cancel(watcher);
124
+ yield takeLatest(types.GET_ALL_TEMPLATES_REQUEST, getAllTemplates);
128
125
  }
129
126
 
130
127
  function* watchDeleteTemplate() {
131
- const watcher = yield takeLatest(types.DELETE_TEMPLATE_REQUEST, deleteTemplate);
132
- yield take(LOCATION_CHANGE);
133
- yield cancel(watcher);
128
+ yield takeLatest(types.DELETE_TEMPLATE_REQUEST, deleteTemplate);
134
129
  }
135
130
 
136
131
  function* watchGetUserList() {
137
- const watcher = yield takeLatest(types.GET_USER_LIST_REQUEST, fetchUserList);
138
- yield take(LOCATION_CHANGE);
139
- yield cancel(watcher);
132
+ yield takeLatest(types.GET_USER_LIST_REQUEST, fetchUserList);
140
133
  }
141
134
 
142
135
  function* watchFetchWeCrmAccounts() {
143
136
 
144
- const watcher = yield takeLatest(types.GET_WECRM_ACCOUNTS_REQUEST, fetchWeCrmAccounts);
145
- yield take(LOCATION_CHANGE);
146
- yield cancel(watcher);
137
+ yield takeLatest(types.GET_WECRM_ACCOUNTS_REQUEST, fetchWeCrmAccounts);
147
138
  }
148
139
 
149
140
  function* watchSendingFile() {
150
- const watcher = yield takeLatest(types.SEND_ZIPPED_FILE_REQUEST, sendZippedFile);
151
- yield take(LOCATION_CHANGE);
152
- yield cancel(watcher);
141
+ yield takeLatest(types.SEND_ZIPPED_FILE_REQUEST, sendZippedFile);
153
142
  }
154
143
 
155
144
  function* watchGetEdmDefaultTemplates() {
156
- const watcher = yield takeLatest(types.GET_EDM_DEAFULT_TEMPLATES_REQUEST, getEdmTemplates);
157
- yield take(LOCATION_CHANGE);
158
- yield cancel(watcher);
145
+ yield takeLatest(types.GET_EDM_DEAFULT_TEMPLATES_REQUEST, getEdmTemplates);
159
146
  }
160
147
 
161
148
  function* watchGetTemplateDetails() {
162
- const watcher = yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
163
- yield take(LOCATION_CHANGE);
164
- yield cancel(watcher);
149
+ yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
165
150
  }
166
151
 
167
152
  // All sagas to be loaded
@@ -174,3 +159,15 @@ export default [
174
159
  watchGetEdmDefaultTemplates,
175
160
  watchGetTemplateDetails,
176
161
  ];
162
+
163
+ export function* templateSaga() {
164
+ yield all([
165
+ watchGetAllTemplates(),
166
+ watchDeleteTemplate(),
167
+ watchGetUserList(),
168
+ watchFetchWeCrmAccounts(),
169
+ watchSendingFile(),
170
+ watchGetEdmDefaultTemplates(),
171
+ watchGetTemplateDetails(),
172
+ ]);
173
+ }
@@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
8
8
 
9
9
  import React from 'react';
10
10
  import { connect } from 'react-redux';
11
- import { bindActionCreators } from 'redux';
11
+ import { bindActionCreators, compose } from 'redux';
12
12
  import Helmet from 'react-helmet';
13
13
  import { injectIntl, intlShape } from 'react-intl';
14
14
  import { createStructuredSelector } from 'reselect';
@@ -28,6 +28,12 @@ import * as templateActions from '../../Templates/actions';
28
28
  // import SlideBox from '../../components/SlideBox';
29
29
  // import PageHeader from '../../components/PageHeader';
30
30
  import './_mapTemplates.scss';
31
+ import injectSaga from '../../../utils/injectSaga';
32
+ import injectReducer from '../../../utils/injectReducer';
33
+ import reducer from './reducer';
34
+ import { mapTemplatesSaga } from './sagas';
35
+ import { templateSaga } from '../../Templates/sagas';
36
+
31
37
  // const Option = Select.Option;
32
38
  const URL = "URL";
33
39
  const MINI_PROGRAM = "Mini-Program";
@@ -1589,4 +1595,15 @@ function mapDispatchToProps(dispatch) {
1589
1595
  };
1590
1596
  }
1591
1597
 
1592
- export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(MapTemplates)));
1598
+ const withConnect = connect(mapStateToProps, mapDispatchToProps);
1599
+ const withReducer = injectReducer({ key: 'weChat', reducer });
1600
+ const withSaga = injectSaga({ key: 'weChat', saga: mapTemplatesSaga });
1601
+ const withTemplateSaga = injectSaga({ key: 'template', saga: templateSaga });
1602
+
1603
+ export default compose(
1604
+ UserIsAuthenticated,
1605
+ withReducer,
1606
+ withSaga,
1607
+ withTemplateSaga,
1608
+ withConnect,
1609
+ )(injectIntl(MapTemplates));
@@ -1,13 +1,12 @@
1
- import { take, call, put, takeLatest, cancel } from 'redux-saga/effects';
2
- import { LOCATION_CHANGE } from 'react-router-redux';
1
+ import { take, call, put, takeLatest, cancel, all } from 'redux-saga/effects';
3
2
  import * as Api from '../../../services/api';
4
3
  import * as types from './constants';
5
4
 
6
5
  export function* getDefaultWeChatTemplates(params) {
7
6
  try {
8
-
9
- const result = yield call(Api.getAllTemplates, {channel: params.channel, queryParams: params.queryParams});
10
- yield put({ type: types.GET_WECHAT_DEFAULT_TEMPLATES_SUCCESS, data: result.response.unMapped, templateData: result.response.mapped});
7
+
8
+ const result = yield call(Api.getAllTemplates, { channel: params.channel, queryParams: params.queryParams });
9
+ yield put({ type: types.GET_WECHAT_DEFAULT_TEMPLATES_SUCCESS, data: result.response.unMapped, templateData: result.response.mapped });
11
10
  } catch (error) {
12
11
  yield put({ type: types.GET_WECHAT_DEFAULT_TEMPLATES_FAILURE, error });
13
12
  }
@@ -54,27 +53,19 @@ export function* getTemplateDetails(id) {
54
53
  }
55
54
 
56
55
  function* watchGetDefaultWechatTemplates() {
57
- const watcher = yield takeLatest(types.GET_WECHAT_DEFAULT_TEMPLATES_REQUEST, getDefaultWeChatTemplates);
58
- yield take(LOCATION_CHANGE);
59
- yield cancel(watcher);
56
+ yield takeLatest(types.GET_WECHAT_DEFAULT_TEMPLATES_REQUEST, getDefaultWeChatTemplates);
60
57
  }
61
58
 
62
59
  function* watchCreateTemplate() {
63
- const watcher = yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
64
- yield take(LOCATION_CHANGE);
65
- yield cancel(watcher);
60
+ yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
66
61
  }
67
62
 
68
63
  function* watchFetchWeCrmAccounts() {
69
- const watcher = yield takeLatest(types.GET_WECRM_ACCOUNTS_REQUEST, fetchWeCrmAccounts);
70
- yield take(LOCATION_CHANGE);
71
- yield cancel(watcher);
64
+ yield takeLatest(types.GET_WECRM_ACCOUNTS_REQUEST, fetchWeCrmAccounts);
72
65
  }
73
66
 
74
67
  function* watchGetTemplateDetails() {
75
- const watcher = yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
76
- yield take(LOCATION_CHANGE);
77
- yield cancel(watcher);
68
+ yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
78
69
  }
79
70
 
80
71
  // All sagas to be loaded
@@ -84,3 +75,12 @@ export default [
84
75
  watchFetchWeCrmAccounts,
85
76
  watchGetTemplateDetails,
86
77
  ];
78
+
79
+ export function* mapTemplatesSaga() {
80
+ yield all([
81
+ watchGetDefaultWechatTemplates(),
82
+ watchCreateTemplate(),
83
+ watchFetchWeCrmAccounts(),
84
+ watchGetTemplateDetails(),
85
+ ]);
86
+ }