@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
@@ -1,5 +1,4 @@
1
- import { take, cancel, call, put, takeLatest } from 'redux-saga/effects';
2
- import { LOCATION_CHANGE } from 'react-router-redux';
1
+ import { take, cancel, call, put, takeLatest, all } from 'redux-saga/effects';
3
2
  import * as Api from '../../services/api';
4
3
  import * as types from './constants';
5
4
 
@@ -40,21 +39,21 @@ export function* getCmsData({cmsType, projectId}) {
40
39
  }
41
40
 
42
41
  function* watchCreateTemplate() {
43
- const watcher = yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
44
- yield take(LOCATION_CHANGE);
45
- yield cancel(watcher);
42
+ yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
43
+
44
+
46
45
  }
47
46
 
48
47
  function* watchGetTemplateDetails() {
49
- const watcher = yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
50
- yield take(LOCATION_CHANGE);
51
- yield cancel(watcher);
48
+ yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
49
+
50
+
52
51
  }
53
52
 
54
53
  function* watchGetCmsData() {
55
- const watcher = yield takeLatest(types.GET_CMS_EDITOR_DATA_REQUEST, getCmsData);
56
- yield take(LOCATION_CHANGE);
57
- yield cancel(watcher);
54
+ yield takeLatest(types.GET_CMS_EDITOR_DATA_REQUEST, getCmsData);
55
+
56
+
58
57
  }
59
58
 
60
59
  // All sagas to be loaded
@@ -63,3 +62,11 @@ export default [
63
62
  watchGetTemplateDetails,
64
63
  watchGetCmsData,
65
64
  ];
65
+
66
+ export function* ebillSaga() {
67
+ yield all([
68
+ watchCreateTemplate(),
69
+ watchGetTemplateDetails(),
70
+ watchGetCmsData(),
71
+ ]);
72
+ }
@@ -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 { Row, Col, Spin, Breadcrumb, Popover, Modal, Select } from 'antd';
14
14
  import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
@@ -32,6 +32,12 @@ import EmailPreview from '../../components/EmailPreview';
32
32
  import ImagePreview from '../../components/ImagePreview';
33
33
  import CardGrid from '../../components/CardGrid';
34
34
  import Pagination from '../../components/Pagination';
35
+ import injectSaga from '../../utils/injectSaga';
36
+ import injectReducer from '../../utils/injectReducer';
37
+ import reducer from './reducer';
38
+ import { emailSaga } from './sagas';
39
+ import { templateSaga } from '../Templates/sagas';
40
+
35
41
  const BreadcrumbItem = Breadcrumb.Item;
36
42
 
37
43
  export class Email extends React.Component { // eslint-disable-line react/prefer-stateless-function
@@ -3104,7 +3110,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
3104
3110
  <CapInput
3105
3111
  className="search-text"
3106
3112
  style={{width: '210px'}}
3107
- placeholder="Search"
3113
+ placeholder={this.props.intl.formatMessage(messages.searchText)}
3108
3114
  prefix={<i className="material-icons" style={{color: '#707070', fontSize: '16px'}}>search</i>}
3109
3115
  value={this.state.searchText}
3110
3116
  onChange={(e) => this.searchAsset(e.target.value)}
@@ -3307,4 +3313,15 @@ function mapDispatchToProps(dispatch) {
3307
3313
  };
3308
3314
  }
3309
3315
 
3310
- export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(Email)));
3316
+ const withConnect = connect(mapStateToProps, mapDispatchToProps);
3317
+ const withReducer = injectReducer({ key: 'email', reducer });
3318
+ const withSaga = injectSaga({ key: 'email', saga: emailSaga });
3319
+ const withTemplateSaga = injectSaga({ key: 'templates', saga: templateSaga });
3320
+
3321
+ export default compose(
3322
+ UserIsAuthenticated,
3323
+ withReducer,
3324
+ withSaga,
3325
+ withTemplateSaga,
3326
+ withConnect,
3327
+ )(injectIntl(Email));
@@ -1,5 +1,4 @@
1
- import { take, cancel, call, put, takeLatest, takeEvery } from 'redux-saga/effects';
2
- import { LOCATION_CHANGE } from 'react-router-redux';
1
+ import { take, cancel, call, put, takeLatest, takeEvery, all } from 'redux-saga/effects';
3
2
  import * as Api from '../../services/api';
4
3
  import * as types from './constants';
5
4
 
@@ -83,45 +82,45 @@ export function* uploadAsset(file, assetType, fileParams) {
83
82
  }
84
83
 
85
84
  function* watchCreateTemplate() {
86
- const watcher = yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
87
- yield take(LOCATION_CHANGE);
88
- yield cancel(watcher);
85
+ yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
86
+
87
+
89
88
  }
90
89
 
91
90
  function* watchGetTemplateDetails() {
92
- const watcher = yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
93
- yield take(LOCATION_CHANGE);
94
- yield cancel(watcher);
91
+ yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
92
+
93
+
95
94
  }
96
95
 
97
96
  function* watchGetAllAssets() {
98
- const watcher = yield takeLatest(types.GET_ALL_ASSETS_REQUEST, getAllAssets);
99
- yield take(LOCATION_CHANGE);
100
- yield cancel(watcher);
97
+ yield takeLatest(types.GET_ALL_ASSETS_REQUEST, getAllAssets);
98
+
99
+
101
100
  }
102
101
 
103
102
  function* watchGetCmsSetting() {
104
- const watcher = yield takeEvery(types.GET_CMS_EDITOR_DETAILS_REQUEST, getCmsSetting);
105
- yield take(LOCATION_CHANGE);
106
- yield cancel(watcher);
103
+ yield takeEvery(types.GET_CMS_EDITOR_DETAILS_REQUEST, getCmsSetting);
104
+
105
+
107
106
  }
108
107
 
109
108
  function* watchGetCmsData() {
110
- const watcher = yield takeEvery(types.GET_CMS_EDITOR_DATA_REQUEST, getCmsData);
111
- yield take(LOCATION_CHANGE);
112
- yield cancel(watcher);
109
+ yield takeEvery(types.GET_CMS_EDITOR_DATA_REQUEST, getCmsData);
110
+
111
+
113
112
  }
114
113
 
115
114
  function* watchUploadAsset() {
116
- const watcher = yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
117
- yield take(LOCATION_CHANGE);
118
- yield cancel(watcher);
115
+ yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
116
+
117
+
119
118
  }
120
119
 
121
120
  function* watchDuplicateTemplate() {
122
- const watcher = yield takeLatest(types.DUPLICATE_TEMPLATE_REQUEST, duplicateTemplate);
123
- yield take(LOCATION_CHANGE);
124
- yield cancel(watcher);
121
+ yield takeLatest(types.DUPLICATE_TEMPLATE_REQUEST, duplicateTemplate);
122
+
123
+
125
124
  }
126
125
 
127
126
  // All sagas to be loaded
@@ -134,3 +133,15 @@ export default [
134
133
  watchUploadAsset,
135
134
  watchDuplicateTemplate,
136
135
  ];
136
+
137
+ export function* emailSaga() {
138
+ yield all([
139
+ watchCreateTemplate(),
140
+ watchGetTemplateDetails(),
141
+ watchGetAllAssets(),
142
+ watchGetCmsSetting(),
143
+ watchGetCmsData(),
144
+ watchUploadAsset(),
145
+ watchDuplicateTemplate(),
146
+ ]);
147
+ }
@@ -6,37 +6,50 @@
6
6
  * IntlProvider component and i18n messages (loaded from `app/translations`)
7
7
  */
8
8
 
9
- import PropTypes from 'prop-types';
10
-
11
9
  import React from 'react';
12
- import { ConfigProvider } from 'antd';
13
- import enUS from 'antd/es/locale-provider/en_US';
14
- import zhCN from 'antd/es/locale-provider/zh_CN';
15
- import jaJP from 'antd/es/locale-provider/ja_JP';
10
+ import PropTypes from 'prop-types';
11
+ import moment from 'moment';
16
12
  import { connect } from 'react-redux';
17
- import { createSelector } from 'reselect';
18
13
  import { IntlProvider } from 'react-intl';
19
- import moment from 'moment';
14
+ import { createStructuredSelector } from 'reselect';
15
+ import { bindActionCreators } from 'redux';
16
+ import { DEFAULT_LOCALE } from '../Cap/constants';
20
17
  import { makeSelectLocale } from './selectors';
18
+ import makeSelectApp from '../App/selectors';
19
+ import * as appActions from '../App/actions';
20
+ import { getLocale } from '../../utils/ApiCaller';
21
+ export class LanguageProvider extends React.PureComponent {
22
+ // eslint-disable-line react/prefer-stateless-function
21
23
 
22
- export class LanguageProvider extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
23
- render() {
24
- const mappedLocale = {
25
- 'en': enUS,
26
- 'zh-cn': zhCN,
27
- 'en-US': enUS,
28
- 'zh': zhCN,
29
- 'ja-JP': jaJP,
24
+ componentDidMount() {
25
+ const jlocale = getLocale() || DEFAULT_LOCALE;
26
+ const locale = this.getReversedMappedLocale(jlocale);
27
+ this.props.actions.getLocizMessage(locale);
28
+ moment.locale(jlocale);
29
+ }
30
+
31
+ getReversedMappedLocale = locale => {
32
+ const map = {
33
+ en: 'en-US',
34
+ 'zh-cn': 'zh',
35
+ hi: 'hi',
36
+ vi: 'vi',
37
+ tr: 'tr',
38
+ 'ja-JP': 'ja-JP',
30
39
  };
31
- const jLocale = localStorage.getItem('jlocale') || 'en';
32
- moment.locale(jLocale);
33
- const file = mappedLocale[jLocale];
40
+ return map[locale];
41
+ };
42
+
43
+ render() {
44
+ const { messagesData } = this.props.messages;
34
45
  return (
35
- <ConfigProvider locale={file}>
36
- <IntlProvider locale={this.props.locale} key={this.props.locale} messages={this.props.messages[this.props.locale]}>
37
- {React.Children.only(this.props.children)}
38
- </IntlProvider>
39
- </ConfigProvider>
46
+ <IntlProvider
47
+ locale={this.props.locale}
48
+ key={this.props.locale}
49
+ messages={messagesData}
50
+ >
51
+ {React.Children.only(this.props.children)}
52
+ </IntlProvider>
40
53
  );
41
54
  }
42
55
  }
@@ -45,18 +58,23 @@ LanguageProvider.propTypes = {
45
58
  locale: PropTypes.string,
46
59
  messages: PropTypes.object,
47
60
  children: PropTypes.element.isRequired,
61
+ actions: PropTypes.object,
48
62
  };
49
63
 
50
-
51
- const mapStateToProps = createSelector(
52
- makeSelectLocale(),
53
- (locale) => ({ locale })
54
- );
64
+ const mapStateToProps = createStructuredSelector({
65
+ messages: makeSelectApp(),
66
+ locale: makeSelectLocale(),
67
+ });
55
68
 
56
69
  function mapDispatchToProps(dispatch) {
57
70
  return {
58
- dispatch,
71
+ actions: bindActionCreators(appActions, dispatch),
59
72
  };
60
73
  }
61
74
 
62
- export default connect(mapStateToProps, mapDispatchToProps)(LanguageProvider);
75
+ const withConnect = connect(
76
+ mapStateToProps,
77
+ mapDispatchToProps,
78
+ );
79
+
80
+ export default withConnect(LanguageProvider);
@@ -2,10 +2,11 @@ import React from 'react';
2
2
  import { shallow, mount } from 'enzyme';
3
3
  import { FormattedMessage, defineMessages } from 'react-intl';
4
4
  import { Provider } from 'react-redux';
5
- import { browserHistory } from 'react-router';
5
+ import { createBrowserHistory } from 'history';
6
6
 
7
7
  import ConnectedLanguageProvider, { LanguageProvider } from '../index';
8
- import configureStore from '../../../store';
8
+ import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
9
+ import { initialReducer } from '../../../initialReducer';
9
10
 
10
11
  import { translationMessages } from '../../../i18n';
11
12
 
@@ -36,9 +37,10 @@ describe('<LanguageProvider />', () => {
36
37
 
37
38
  describe('<ConnectedLanguageProvider />', () => {
38
39
  let store;
40
+ let browserHistory = createBrowserHistory();
39
41
 
40
42
  beforeAll(() => {
41
- store = configureStore({}, browserHistory);
43
+ store = configureStore({}, initialReducer, browserHistory);
42
44
  });
43
45
 
44
46
  it('should render the default language messages', () => {
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { Component } from 'react';
3
3
  import {connect} from 'react-redux';
4
- import { bindActionCreators } from 'redux';
4
+ import { bindActionCreators, compose } from 'redux';
5
5
  import { injectIntl, intlShape } from 'react-intl';
6
6
  import { createStructuredSelector } from 'reselect';
7
7
  import { Row, Col, Spin, Breadcrumb } from 'antd';
@@ -17,6 +17,10 @@ import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
17
17
  import {getMessageObject} from '../../../utils/messageUtils';
18
18
  import { makeSelectTemplates } from '../../Templates/selectors';
19
19
  import './_lineCreate.scss';
20
+ import injectSaga from '../../../utils/injectSaga';
21
+ import injectReducer from '../../../utils/injectReducer';
22
+ import reducer from './reducer';
23
+ import { lineCreateSaga } from './sagas';
20
24
 
21
25
  const BreadcrumbItem = Breadcrumb.Item;
22
26
 
@@ -819,4 +823,13 @@ function mapDispatchToProps(dispatch) {
819
823
  };
820
824
  }
821
825
 
822
- export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(Line)));
826
+ const withConnect = connect(mapStateToProps, mapDispatchToProps);
827
+ const withReducer = injectReducer({ key: 'line', reducer });
828
+ const withSaga = injectSaga({ key: 'line', saga: lineCreateSaga});
829
+
830
+ export default compose(
831
+ UserIsAuthenticated,
832
+ withReducer,
833
+ withSaga,
834
+ withConnect,
835
+ )(injectIntl(Line));
@@ -1,7 +1,6 @@
1
1
  // Line Sagas
2
2
 
3
- import { take, cancel, call, put, takeLatest } from 'redux-saga/effects';
4
- import { LOCATION_CHANGE } from 'react-router-redux';
3
+ import { take, cancel, call, put, takeLatest, all } from 'redux-saga/effects';
5
4
  import * as Api from '../../../services/api';
6
5
  import * as types from './constants';
7
6
 
@@ -30,15 +29,15 @@ export function* uploadAsset(file, assetType, fileParams) {
30
29
 
31
30
  function* watchCreateTemplate() {
32
31
 
33
- const watcher = yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
34
- yield take(LOCATION_CHANGE);
35
- yield cancel(watcher);
32
+ yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
33
+
34
+
36
35
  }
37
36
  function* watchUploadAsset() {
38
37
 
39
- const watcher = yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
40
- yield take(LOCATION_CHANGE);
41
- yield cancel(watcher);
38
+ yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
39
+
40
+
42
41
  }
43
42
 
44
43
  // edit
@@ -80,21 +79,21 @@ export function* getLineTemplatesList(params) {
80
79
  }
81
80
 
82
81
  function* watchEditTemplate() {
83
- const watcher = yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
84
- yield take(LOCATION_CHANGE);
85
- yield cancel(watcher);
82
+ yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
83
+
84
+
86
85
  }
87
86
 
88
87
  function* watchGetTemplateDetails() {
89
- const watcher = yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
90
- yield take(LOCATION_CHANGE);
91
- yield cancel(watcher);
88
+ yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
89
+
90
+
92
91
  }
93
92
 
94
93
  function* watchLineTemplatesList() {
95
- const watcher = yield takeLatest(types.GET_LINE_TEMPLATES_LIST_REQUEST, getLineTemplatesList);
96
- yield take(LOCATION_CHANGE);
97
- yield cancel(watcher);
94
+ yield takeLatest(types.GET_LINE_TEMPLATES_LIST_REQUEST, getLineTemplatesList);
95
+
96
+
98
97
  }
99
98
 
100
99
  // All sagas to be loaded
@@ -105,3 +104,13 @@ export default [
105
104
  watchGetTemplateDetails,
106
105
  watchLineTemplatesList,
107
106
  ];
107
+
108
+ export function* lineCreateSaga() {
109
+ yield all([
110
+ watchCreateTemplate(),
111
+ watchUploadAsset(),
112
+ watchEditTemplate(),
113
+ watchGetTemplateDetails(),
114
+ watchLineTemplatesList(),
115
+ ]);
116
+ }
@@ -1,5 +1,4 @@
1
1
  import { call, put, takeLatest, take, cancel } from 'redux-saga/effects';
2
- import { LOCATION_CHANGE } from 'react-router-redux';
3
2
  // import { schema, normalize } from 'normalizr';
4
3
  import * as Api from '../../../services/api';
5
4
  import * as types from './constants';
@@ -51,27 +50,27 @@ export function* getLineTemplatesList(params) {
51
50
  }
52
51
 
53
52
  function* watchEditTemplate() {
54
- const watcher = yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
55
- yield take(LOCATION_CHANGE);
56
- yield cancel(watcher);
53
+ yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
54
+
55
+
57
56
  }
58
57
 
59
58
  function* watchGetTemplateDetails() {
60
- const watcher = yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
61
- yield take(LOCATION_CHANGE);
62
- yield cancel(watcher);
59
+ yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
60
+
61
+
63
62
  }
64
63
 
65
64
  function* watchUploadAsset() {
66
- const watcher = yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
67
- yield take(LOCATION_CHANGE);
68
- yield cancel(watcher);
65
+ yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
66
+
67
+
69
68
  }
70
69
 
71
70
  function* watchLineTemplatesList() {
72
- const watcher = yield takeLatest(types.GET_LINE_TEMPLATES_LIST_REQUEST, getLineTemplatesList);
73
- yield take(LOCATION_CHANGE);
74
- yield cancel(watcher);
71
+ yield takeLatest(types.GET_LINE_TEMPLATES_LIST_REQUEST, getLineTemplatesList);
72
+
73
+
75
74
  }
76
75
 
77
76
  // All sagas to be loaded
@@ -1,17 +1,20 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import { connect } from 'react-redux';
4
+ import { withRouter } from 'react-router-dom';
4
5
  import Helmet from 'react-helmet';
5
6
  import { FormattedMessage } from 'react-intl';
6
- import { routerActions } from 'react-router-redux';
7
+ import { routerActions } from 'connected-react-router';
7
8
  import { Row, Col } from 'antd';
8
- import { bindActionCreators } from 'redux';
9
+ import { compose, bindActionCreators } from 'redux';
9
10
  import { createStructuredSelector } from 'reselect';
10
11
  import makeSelectLogin from './selectors';
11
12
  import messages from './messages';
12
13
  import config from '../../config/app';
13
14
  import LoginForm from './components/LoginForm';
14
15
  import * as actions from '../../containers/Cap/actions';
16
+ import { capSaga } from '../Cap/sagas';
17
+ import injectSaga from '../../utils/injectSaga';
15
18
  import { UserIsNotAuthenticated } from '../../utils/authWrapper';
16
19
  import loaderGif from '../../assets/loading_img.gif';
17
20
  const logo = require('./assets/images/capillary_logo.png');
@@ -27,15 +30,25 @@ export class Login extends React.Component { // eslint-disable-line react/prefer
27
30
 
28
31
  componentWillMount() {
29
32
  const isAuthenticated = this.props.Login.token !== '';
30
- const replace = this.props.replace;
31
- if ((this.props.Login.login_progress === false) && (this.props.Login.fetching_userdata === false) && isAuthenticated) {
32
- replace(process.env.NODE_ENV === 'production' ? config.production.dashboard_url : config.development.dashboard_url);
33
+ const { replace } = this.props;
34
+ if (
35
+ this.props.Login.login_progress === false &&
36
+ this.props.Login.fetching_userdata === false &&
37
+ isAuthenticated
38
+ ) {
39
+ replace(
40
+ process.env.NODE_ENV === 'production'
41
+ ? config.production.dashboard_url
42
+ : config.development.dashboard_url,
43
+ );
33
44
  }
34
45
  }
35
46
 
36
47
  componentWillReceiveProps(nextProps) {
37
- const isAuthenticated = nextProps.Login.token !== undefined && nextProps.Login.token !== '';
38
- const wasAuthenticated = this.props.Login.token !== undefined && this.props.Login.token !== '';
48
+ const isAuthenticated =
49
+ nextProps.Login.token !== undefined && nextProps.Login.token !== '';
50
+ const wasAuthenticated =
51
+ this.props.Login.token !== undefined && this.props.Login.token !== '';
39
52
  if (this.props.Login && this.props.Login.isError) {
40
53
  this.setState({ isLoginError: true });
41
54
  } else {
@@ -43,10 +56,14 @@ export class Login extends React.Component { // eslint-disable-line react/prefer
43
56
  }
44
57
 
45
58
  if (!wasAuthenticated && isAuthenticated) {
46
- let redirectUrl = process.env.NODE_ENV === 'production' ? config.production.dashboard_url : config.development.dashboard_url;
47
- if (this.props.location.query.redirect) redirectUrl = this.props.location.query.redirect;
59
+ let redirectUrl =
60
+ process.env.NODE_ENV === 'production'
61
+ ? config.production.dashboard_url
62
+ : config.development.dashboard_url;
63
+ if (this.props.location.query.redirect)
64
+ redirectUrl = this.props.location.query.redirect;
48
65
  this.props.router.push({ pathname: redirectUrl, state: {} });
49
- this.props.router.go(redirectUrl);
66
+ this.props.router.go(); // reload the page
50
67
  }
51
68
  }
52
69
 
@@ -103,4 +120,12 @@ function mapDispatchToProps(dispatch) {
103
120
  };
104
121
  }
105
122
 
106
- export default UserIsNotAuthenticated(connect(mapStateToProps, mapDispatchToProps)(Login));
123
+ const withConnect = connect(mapStateToProps, mapDispatchToProps);
124
+
125
+ const withSaga = injectSaga({ key: 'Login', saga: capSaga });
126
+ export default compose(
127
+ UserIsNotAuthenticated,
128
+ withRouter,
129
+ withSaga,
130
+ withConnect,
131
+ )(Login);
@@ -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 { Row, Col, Spin, Breadcrumb, notification } from 'antd';
13
13
  import _ from 'lodash';
14
14
  import { createStructuredSelector } from 'reselect';
@@ -22,6 +22,12 @@ import * as actions from './actions';
22
22
  import {getMessageObject} from '../../../utils/messageUtils';
23
23
  import { makeSelectTemplates } from '../../Templates/selectors';
24
24
  import messages from './messages';
25
+ import injectReducer from '../../../utils/injectReducer';
26
+ import injectSaga from '../../../utils/injectSaga';
27
+ import reducer from './reducer';
28
+ import { createMPushSaga } from './sagas';
29
+ import { UserIsAuthenticated } from '../../../utils/authWrapper';
30
+
25
31
  const BreadcrumbItem = Breadcrumb.Item;
26
32
  export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
27
33
  constructor(props) {
@@ -2277,4 +2283,13 @@ function mapDispatchToProps(dispatch) {
2277
2283
  };
2278
2284
  }
2279
2285
 
2280
- export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(Create));
2286
+ const withConnect = connect(mapStateToProps, mapDispatchToProps);
2287
+ const withReducer = injectReducer({ key: 'mobileCreate', reducer });
2288
+ const withSaga = injectSaga({ key: 'mobileCreate', saga: createMPushSaga });
2289
+
2290
+ export default compose(
2291
+ UserIsAuthenticated,
2292
+ withReducer,
2293
+ withSaga,
2294
+ withConnect,
2295
+ )(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';
@@ -38,19 +36,19 @@ export function* getIosCtas(licenseCode) {
38
36
 
39
37
  function* watchCreateTemplate() {
40
38
 
41
- const watcher = yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
42
- yield take(LOCATION_CHANGE);
43
- yield cancel(watcher);
39
+ yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
40
+
41
+
44
42
  }
45
43
  function* watchUploadAsset() {
46
- const watcher = yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
47
- yield take(LOCATION_CHANGE);
48
- yield cancel(watcher);
44
+ yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
45
+
46
+
49
47
  }
50
48
  function* watchGetIosCtas() {
51
- const watcher = yield takeLatest(types.GET_IOS_CTAS, getIosCtas);
52
- yield take(LOCATION_CHANGE);
53
- yield cancel(watcher);
49
+ yield takeLatest(types.GET_IOS_CTAS, getIosCtas);
50
+
51
+
54
52
  }
55
53
  // All sagas to be loaded
56
54
  export default [
@@ -58,3 +56,11 @@ export default [
58
56
  watchUploadAsset,
59
57
  watchGetIosCtas,
60
58
  ];
59
+
60
+ export function* createMPushSaga() {
61
+ yield all([
62
+ watchCreateTemplate(),
63
+ watchUploadAsset(),
64
+ watchGetIosCtas(),
65
+ ]);
66
+ }