@capillarytech/creatives-library 2.0.70 → 2.0.72

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 (395) hide show
  1. package/app.js +1 -1
  2. package/components/Ckeditor/index.js +2 -1
  3. package/components/EmailMobilePreview/index.scss +0 -1
  4. package/components/EmailPreviewV2/_emailPreviewV2.scss +4 -1
  5. package/components/EmailPreviewV2/index.js +1 -1
  6. package/components/FormBuilder/index.js +25 -10
  7. package/components/Header/index.js +3 -1
  8. package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +38 -3
  9. package/components/TemplatePreview/index.js +45 -51
  10. package/components/TemplatePreview/messages.js +1 -1
  11. package/config/app.js +1 -0
  12. package/containers/Cap/actions.js +0 -5
  13. package/containers/Cap/reducer.js +1 -1
  14. package/containers/Cap/selectors.js +0 -13
  15. package/containers/Ebill/index.js +1 -2
  16. package/containers/Email/_email.scss +1 -0
  17. package/containers/Email/actions.js +3 -8
  18. package/containers/Email/constants.js +0 -1
  19. package/containers/Email/index.js +947 -322
  20. package/containers/Email/reducer.js +0 -3
  21. package/containers/Email/sagas.js +6 -3
  22. package/containers/Email/selectors.js +1 -4
  23. package/containers/Line/Create/index.js +1 -2
  24. package/containers/Line/Edit/_lineEdit.scss +4 -0
  25. package/containers/Line/Edit/index.js +1 -3
  26. package/containers/MobilePush/Create/_mobilePushCreate.scss +3 -12
  27. package/containers/MobilePush/Create/actions.js +0 -6
  28. package/containers/MobilePush/Create/constants.js +0 -1
  29. package/containers/MobilePush/Create/index.js +1133 -628
  30. package/containers/MobilePush/Create/messages.js +1 -5
  31. package/containers/MobilePush/Create/reducer.js +0 -2
  32. package/containers/MobilePush/Create/selectors.js +3 -3
  33. package/containers/MobilePush/Edit/_mobilePushCreate.scss +3 -9
  34. package/containers/MobilePush/Edit/index.js +1127 -393
  35. package/containers/MobilePush/Edit/messages.js +0 -4
  36. package/containers/MobilePush/Edit/reducer.js +1 -2
  37. package/containers/MobilePush/Edit/selectors.js +3 -6
  38. package/containers/Sms/Create/_smsCreate.scss +2 -1
  39. package/containers/Sms/Create/actions.js +4 -4
  40. package/containers/Sms/Create/index.js +570 -102
  41. package/containers/Sms/Create/sagas.js +2 -1
  42. package/containers/Sms/Edit/actions.js +5 -10
  43. package/containers/Sms/Edit/constants.js +0 -1
  44. package/containers/Sms/Edit/index.js +548 -103
  45. package/containers/Sms/Edit/reducer.js +0 -2
  46. package/containers/Sms/Edit/sagas.js +3 -1
  47. package/containers/TagList/index.js +3 -3
  48. package/containers/Templates/actions.js +1 -3
  49. package/containers/Templates/index.js +299 -268
  50. package/containers/Templates/messages.js +90 -122
  51. package/containers/Templates/reducer.js +3 -3
  52. package/containers/Templates/sagas.js +1 -5
  53. package/containers/Templates/selectors.js +1 -41
  54. package/containers/WeChat/MapTemplates/index.js +3 -4
  55. package/containers/WeChat/RichmediaTemplates/Create/index.js +18 -4
  56. package/containers/WeChat/RichmediaTemplates/Create/messages.js +4 -0
  57. package/containers/WeChat/RichmediaTemplates/Edit/index.js +3 -1
  58. package/containers/WeChat/RichmediaTemplates/View/index.js +3 -1
  59. package/index.js +31 -31
  60. package/initialState.js +6 -0
  61. package/package.json +3 -3
  62. package/routes.js +24 -19
  63. package/services/api.js +6 -2
  64. package/services/getSchema.js +18 -0
  65. package/v2Containers/App/actions.js +7 -0
  66. package/v2Containers/App/constants.js +3 -0
  67. package/v2Containers/App/reducer.js +19 -0
  68. package/v2Containers/App/sagas.js +26 -0
  69. package/v2Containers/App/selectors.js +25 -0
  70. package/v2Containers/App/tests/actions.test.js +18 -0
  71. package/v2Containers/App/tests/reducer.test.js +9 -0
  72. package/v2Containers/App/tests/sagas.test.js +15 -0
  73. package/v2Containers/App/tests/selectors.test.js +10 -0
  74. package/v2Containers/Assets/Gallery/_gallery.scss +0 -0
  75. package/v2Containers/Assets/Gallery/actions.js +37 -0
  76. package/v2Containers/Assets/Gallery/constants.js +23 -0
  77. package/v2Containers/Assets/Gallery/index.js +479 -0
  78. package/v2Containers/Assets/Gallery/messages.js +97 -0
  79. package/v2Containers/Assets/Gallery/reducer.js +81 -0
  80. package/v2Containers/Assets/Gallery/sagas.js +84 -0
  81. package/v2Containers/Assets/Gallery/selectors.js +25 -0
  82. package/v2Containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +7 -0
  83. package/v2Containers/Assets/Gallery/tests/actions.test.js +26 -0
  84. package/v2Containers/Assets/Gallery/tests/index.test.js +10 -0
  85. package/v2Containers/Assets/Gallery/tests/reducer.test.js +95 -0
  86. package/v2Containers/Assets/Gallery/tests/sagas.test.js +15 -0
  87. package/v2Containers/Assets/Gallery/tests/selectors.test.js +10 -0
  88. package/v2Containers/CallTask/_callTask.scss +5 -0
  89. package/v2Containers/CallTask/actions.js +15 -0
  90. package/v2Containers/CallTask/constants.js +7 -0
  91. package/v2Containers/CallTask/index.js +141 -0
  92. package/v2Containers/CallTask/messages.js +21 -0
  93. package/v2Containers/CallTask/reducer.js +23 -0
  94. package/v2Containers/CallTask/sagas.js +11 -0
  95. package/v2Containers/CallTask/selectors.js +25 -0
  96. package/v2Containers/CallTask/tests/actions.test.js +18 -0
  97. package/v2Containers/CallTask/tests/index.test.js +10 -0
  98. package/v2Containers/CallTask/tests/reducer.test.js +9 -0
  99. package/v2Containers/CallTask/tests/sagas.test.js +15 -0
  100. package/v2Containers/CallTask/tests/selectors.test.js +10 -0
  101. package/v2Containers/Cap/actions.js +64 -0
  102. package/v2Containers/Cap/constants.js +24 -0
  103. package/v2Containers/Cap/index.js +349 -0
  104. package/v2Containers/Cap/messsages.js +63 -0
  105. package/v2Containers/Cap/reducer.js +111 -0
  106. package/v2Containers/Cap/sagas.js +143 -0
  107. package/v2Containers/Cap/selectors.js +85 -0
  108. package/v2Containers/Cap/tests/index.test.js +16 -0
  109. package/v2Containers/Cap/tests/selectors.test.js +28 -0
  110. package/v2Containers/ChannelTemplates/actions.js +20 -0
  111. package/v2Containers/ChannelTemplates/constants.js +8 -0
  112. package/v2Containers/ChannelTemplates/index.js +48 -0
  113. package/v2Containers/ChannelTemplates/messages.js +13 -0
  114. package/v2Containers/ChannelTemplates/reducer.js +34 -0
  115. package/v2Containers/ChannelTemplates/sagas.js +32 -0
  116. package/v2Containers/ChannelTemplates/selectors.js +25 -0
  117. package/v2Containers/ChannelTemplates/tests/actions.test.js +18 -0
  118. package/v2Containers/ChannelTemplates/tests/index.test.js +10 -0
  119. package/v2Containers/ChannelTemplates/tests/reducer.test.js +9 -0
  120. package/v2Containers/ChannelTemplates/tests/sagas.test.js +15 -0
  121. package/v2Containers/ChannelTemplates/tests/selectors.test.js +10 -0
  122. package/v2Containers/CreativesContainer/SlideBoxContent.js +257 -0
  123. package/v2Containers/CreativesContainer/SlideBoxFooter.js +45 -0
  124. package/v2Containers/CreativesContainer/SlideBoxHeader.js +70 -0
  125. package/v2Containers/CreativesContainer/actions.js +27 -0
  126. package/v2Containers/CreativesContainer/constants.js +16 -0
  127. package/v2Containers/CreativesContainer/index.js +483 -0
  128. package/v2Containers/CreativesContainer/index.scss +27 -0
  129. package/v2Containers/CreativesContainer/messages.js +293 -0
  130. package/v2Containers/CreativesContainer/reducer.js +29 -0
  131. package/v2Containers/CreativesContainer/sagas.js +11 -0
  132. package/v2Containers/CreativesContainer/selectors.js +30 -0
  133. package/v2Containers/CreativesContainer/tests/actions.test.js +18 -0
  134. package/v2Containers/CreativesContainer/tests/index.test.js +10 -0
  135. package/v2Containers/CreativesContainer/tests/reducer.test.js +9 -0
  136. package/v2Containers/CreativesContainer/tests/sagas.test.js +15 -0
  137. package/v2Containers/CreativesContainer/tests/selectors.test.js +10 -0
  138. package/v2Containers/Dashboard/actions.js +15 -0
  139. package/v2Containers/Dashboard/constants.js +7 -0
  140. package/v2Containers/Dashboard/index.js +54 -0
  141. package/v2Containers/Dashboard/messages.js +13 -0
  142. package/v2Containers/Dashboard/reducer.js +21 -0
  143. package/v2Containers/Dashboard/sagas.js +11 -0
  144. package/v2Containers/Dashboard/selectors.js +25 -0
  145. package/v2Containers/Dashboard/tests/actions.test.js +18 -0
  146. package/v2Containers/Dashboard/tests/index.test.js +10 -0
  147. package/v2Containers/Dashboard/tests/reducer.test.js +9 -0
  148. package/v2Containers/Dashboard/tests/sagas.test.js +15 -0
  149. package/v2Containers/Dashboard/tests/selectors.test.js +10 -0
  150. package/v2Containers/Ebill/_ebill.scss +5 -0
  151. package/v2Containers/Ebill/actions.js +43 -0
  152. package/v2Containers/Ebill/constants.js +20 -0
  153. package/v2Containers/Ebill/index.js +1261 -0
  154. package/v2Containers/Ebill/messages.js +73 -0
  155. package/v2Containers/Ebill/reducer.js +72 -0
  156. package/v2Containers/Ebill/sagas.js +65 -0
  157. package/v2Containers/Ebill/selectors.js +25 -0
  158. package/v2Containers/Ebill/tests/actions.test.js +18 -0
  159. package/v2Containers/Ebill/tests/index.test.js +10 -0
  160. package/v2Containers/Ebill/tests/reducer.test.js +9 -0
  161. package/v2Containers/Ebill/tests/sagas.test.js +15 -0
  162. package/v2Containers/Ebill/tests/selectors.test.js +10 -0
  163. package/v2Containers/Email/_email.scss +140 -0
  164. package/v2Containers/Email/actions.js +86 -0
  165. package/v2Containers/Email/constants.js +37 -0
  166. package/v2Containers/Email/index.js +2703 -0
  167. package/v2Containers/Email/initialSchema.js +540 -0
  168. package/v2Containers/Email/messages.js +237 -0
  169. package/v2Containers/Email/reducer.js +147 -0
  170. package/v2Containers/Email/sagas.js +133 -0
  171. package/v2Containers/Email/selectors.js +34 -0
  172. package/v2Containers/Email/tests/actions.test.js +18 -0
  173. package/v2Containers/Email/tests/index.test.js +10 -0
  174. package/v2Containers/Email/tests/reducer.test.js +9 -0
  175. package/v2Containers/Email/tests/sagas.test.js +15 -0
  176. package/v2Containers/Email/tests/selectors.test.js +10 -0
  177. package/v2Containers/EmailWrapper/actions.js +15 -0
  178. package/v2Containers/EmailWrapper/constants.js +7 -0
  179. package/v2Containers/EmailWrapper/index.js +258 -0
  180. package/v2Containers/EmailWrapper/messages.js +57 -0
  181. package/v2Containers/EmailWrapper/reducer.js +23 -0
  182. package/v2Containers/EmailWrapper/sagas.js +11 -0
  183. package/v2Containers/EmailWrapper/selectors.js +25 -0
  184. package/v2Containers/EmailWrapper/tests/actions.test.js +18 -0
  185. package/v2Containers/EmailWrapper/tests/index.test.js +10 -0
  186. package/v2Containers/EmailWrapper/tests/reducer.test.js +9 -0
  187. package/v2Containers/EmailWrapper/tests/sagas.test.js +15 -0
  188. package/v2Containers/EmailWrapper/tests/selectors.test.js +10 -0
  189. package/v2Containers/LanguageProvider/actions.js +17 -0
  190. package/v2Containers/LanguageProvider/constants.js +8 -0
  191. package/v2Containers/LanguageProvider/index.js +46 -0
  192. package/v2Containers/LanguageProvider/reducer.js +30 -0
  193. package/v2Containers/LanguageProvider/selectors.js +20 -0
  194. package/v2Containers/LanguageProvider/tests/actions.test.js +19 -0
  195. package/v2Containers/LanguageProvider/tests/index.test.js +49 -0
  196. package/v2Containers/LanguageProvider/tests/reducer.test.js +20 -0
  197. package/v2Containers/LanguageProvider/tests/selectors.test.js +15 -0
  198. package/v2Containers/Line/Create/_lineCreate.scss +43 -0
  199. package/v2Containers/Line/Create/actions.js +90 -0
  200. package/v2Containers/Line/Create/constants.js +39 -0
  201. package/v2Containers/Line/Create/index.js +822 -0
  202. package/v2Containers/Line/Create/messages.js +173 -0
  203. package/v2Containers/Line/Create/reducer.js +99 -0
  204. package/v2Containers/Line/Create/sagas.js +107 -0
  205. package/v2Containers/Line/Create/selectors.js +36 -0
  206. package/v2Containers/Line/Edit/_lineEdit.scss +21 -0
  207. package/v2Containers/Line/Edit/actions.js +79 -0
  208. package/v2Containers/Line/Edit/constants.js +27 -0
  209. package/v2Containers/Line/Edit/index.js +1050 -0
  210. package/v2Containers/Line/Edit/messages.js +157 -0
  211. package/v2Containers/Line/Edit/reducer.js +83 -0
  212. package/v2Containers/Line/Edit/sagas.js +81 -0
  213. package/v2Containers/Line/Edit/selectors.js +29 -0
  214. package/v2Containers/Line/Edit/tests/actions.test.js +18 -0
  215. package/v2Containers/Line/Edit/tests/index.test.js +10 -0
  216. package/v2Containers/Line/Edit/tests/reducer.test.js +9 -0
  217. package/v2Containers/Line/Edit/tests/sagas.test.js +15 -0
  218. package/v2Containers/Line/Edit/tests/selectors.test.js +10 -0
  219. package/v2Containers/Login/assets/images/capillary_logo.png +0 -0
  220. package/v2Containers/Login/components/LoginForm/index.js +59 -0
  221. package/v2Containers/Login/components/LoginForm/messages.js +21 -0
  222. package/v2Containers/Login/components/LoginForm/tests/index.test.js +10 -0
  223. package/v2Containers/Login/index.js +106 -0
  224. package/v2Containers/Login/messages.js +21 -0
  225. package/v2Containers/Login/selectors.js +25 -0
  226. package/v2Containers/Login/tests/index.test.js +10 -0
  227. package/v2Containers/Login/tests/sagas.test.js +15 -0
  228. package/v2Containers/Login/tests/selectors.test.js +10 -0
  229. package/v2Containers/MobilePush/Create/_mobilePushCreate.scss +41 -0
  230. package/v2Containers/MobilePush/Create/actions.js +52 -0
  231. package/v2Containers/MobilePush/Create/constants.js +24 -0
  232. package/v2Containers/MobilePush/Create/index.js +1759 -0
  233. package/v2Containers/MobilePush/Create/messages.js +237 -0
  234. package/v2Containers/MobilePush/Create/reducer.js +72 -0
  235. package/v2Containers/MobilePush/Create/sagas.js +60 -0
  236. package/v2Containers/MobilePush/Create/selectors.js +28 -0
  237. package/v2Containers/MobilePush/Create/tests/actions.test.js +18 -0
  238. package/v2Containers/MobilePush/Create/tests/index.test.js +10 -0
  239. package/v2Containers/MobilePush/Create/tests/reducer.test.js +9 -0
  240. package/v2Containers/MobilePush/Create/tests/sagas.test.js +15 -0
  241. package/v2Containers/MobilePush/Create/tests/selectors.test.js +10 -0
  242. package/v2Containers/MobilePush/Edit/_mobilePushCreate.scss +38 -0
  243. package/v2Containers/MobilePush/Edit/actions.js +91 -0
  244. package/v2Containers/MobilePush/Edit/constants.js +35 -0
  245. package/v2Containers/MobilePush/Edit/index.js +1851 -0
  246. package/v2Containers/MobilePush/Edit/messages.js +253 -0
  247. package/v2Containers/MobilePush/Edit/reducer.js +113 -0
  248. package/v2Containers/MobilePush/Edit/sagas.js +119 -0
  249. package/v2Containers/MobilePush/Edit/selectors.js +32 -0
  250. package/v2Containers/MobilePush/Edit/tests/actions.test.js +18 -0
  251. package/v2Containers/MobilePush/Edit/tests/index.test.js +10 -0
  252. package/v2Containers/MobilePush/Edit/tests/reducer.test.js +9 -0
  253. package/v2Containers/MobilePush/Edit/tests/sagas.test.js +15 -0
  254. package/v2Containers/MobilePush/Edit/tests/selectors.test.js +10 -0
  255. package/v2Containers/MobilePush/commonMethods.js +249 -0
  256. package/v2Containers/MobilePush/eventsMap.js +127 -0
  257. package/v2Containers/MobilePush/initialSchema.js +1739 -0
  258. package/v2Containers/MobilepushWrapper/_mobilepushWrapper.scss +18 -0
  259. package/v2Containers/MobilepushWrapper/index.js +136 -0
  260. package/v2Containers/MobilepushWrapper/messages.js +29 -0
  261. package/v2Containers/MobilepushWrapper/tests/index.test.js +10 -0
  262. package/v2Containers/NotFoundPage/index.js +25 -0
  263. package/v2Containers/NotFoundPage/messages.js +13 -0
  264. package/v2Containers/NotFoundPage/tests/index.test.js +17 -0
  265. package/v2Containers/Sms/Create/_smsCreate.scss +58 -0
  266. package/v2Containers/Sms/Create/actions.js +27 -0
  267. package/v2Containers/Sms/Create/constants.js +16 -0
  268. package/v2Containers/Sms/Create/index.js +1017 -0
  269. package/v2Containers/Sms/Create/messages.js +85 -0
  270. package/v2Containers/Sms/Create/reducer.js +41 -0
  271. package/v2Containers/Sms/Create/sagas.js +35 -0
  272. package/v2Containers/Sms/Create/selectors.js +28 -0
  273. package/v2Containers/Sms/Create/tests/actions.test.js +18 -0
  274. package/v2Containers/Sms/Create/tests/index.test.js +10 -0
  275. package/v2Containers/Sms/Create/tests/reducer.test.js +9 -0
  276. package/v2Containers/Sms/Create/tests/sagas.test.js +15 -0
  277. package/v2Containers/Sms/Create/tests/selectors.test.js +10 -0
  278. package/v2Containers/Sms/Edit/actions.js +45 -0
  279. package/v2Containers/Sms/Edit/constants.js +18 -0
  280. package/v2Containers/Sms/Edit/index.js +1018 -0
  281. package/v2Containers/Sms/Edit/messages.js +89 -0
  282. package/v2Containers/Sms/Edit/reducer.js +52 -0
  283. package/v2Containers/Sms/Edit/sagas.js +50 -0
  284. package/v2Containers/Sms/Edit/selectors.js +32 -0
  285. package/v2Containers/Sms/Edit/tests/actions.test.js +18 -0
  286. package/v2Containers/Sms/Edit/tests/index.test.js +10 -0
  287. package/v2Containers/Sms/Edit/tests/reducer.test.js +9 -0
  288. package/v2Containers/Sms/Edit/tests/sagas.test.js +15 -0
  289. package/v2Containers/Sms/Edit/tests/selectors.test.js +10 -0
  290. package/v2Containers/Sms/initialSchema.js +281 -0
  291. package/v2Containers/TagList/_tagList.scss +8 -0
  292. package/v2Containers/TagList/actions.js +15 -0
  293. package/v2Containers/TagList/constants.js +7 -0
  294. package/v2Containers/TagList/index.js +236 -0
  295. package/v2Containers/TagList/messages.js +13 -0
  296. package/v2Containers/TagList/reducer.js +23 -0
  297. package/v2Containers/TagList/sagas.js +11 -0
  298. package/v2Containers/TagList/selectors.js +25 -0
  299. package/v2Containers/TagList/tests/actions.test.js +18 -0
  300. package/v2Containers/TagList/tests/index.test.js +10 -0
  301. package/v2Containers/TagList/tests/reducer.test.js +9 -0
  302. package/v2Containers/TagList/tests/sagas.test.js +15 -0
  303. package/v2Containers/TagList/tests/selectors.test.js +10 -0
  304. package/v2Containers/Templates/_templates.scss +349 -0
  305. package/v2Containers/Templates/actions.js +110 -0
  306. package/v2Containers/Templates/constants.js +45 -0
  307. package/v2Containers/Templates/index.js +1725 -0
  308. package/v2Containers/Templates/messages.js +278 -0
  309. package/v2Containers/Templates/reducer.js +142 -0
  310. package/v2Containers/Templates/sagas.js +180 -0
  311. package/v2Containers/Templates/selectors.js +68 -0
  312. package/v2Containers/Templates/tests/actions.test.js +18 -0
  313. package/v2Containers/Templates/tests/index.test.js +10 -0
  314. package/v2Containers/Templates/tests/reducer.test.js +9 -0
  315. package/v2Containers/Templates/tests/sagas.test.js +15 -0
  316. package/v2Containers/Templates/tests/selectors.test.js +10 -0
  317. package/v2Containers/TemplatesV2/_templatesV2.scss +5 -0
  318. package/v2Containers/TemplatesV2/actions.js +16 -0
  319. package/v2Containers/TemplatesV2/constants.js +10 -0
  320. package/v2Containers/TemplatesV2/index.js +217 -0
  321. package/v2Containers/TemplatesV2/messages.js +29 -0
  322. package/v2Containers/TemplatesV2/selectors.js +25 -0
  323. package/v2Containers/TemplatesV2/tests/actions.test.js +18 -0
  324. package/v2Containers/TemplatesV2/tests/index.test.js +10 -0
  325. package/v2Containers/TemplatesV2/tests/reducer.test.js +9 -0
  326. package/v2Containers/TemplatesV2/tests/sagas.test.js +15 -0
  327. package/v2Containers/TemplatesV2/tests/selectors.test.js +10 -0
  328. package/v2Containers/TestPage/constants.js +7 -0
  329. package/v2Containers/TestPage/index.js +31 -0
  330. package/v2Containers/TestPage/messages.js +13 -0
  331. package/v2Containers/TestPage/reducer.js +21 -0
  332. package/v2Containers/TestPage/sagas.js +11 -0
  333. package/v2Containers/Testv2/actions.js +15 -0
  334. package/v2Containers/Testv2/constants.js +7 -0
  335. package/v2Containers/Testv2/index.js +47 -0
  336. package/v2Containers/Testv2/messages.js +13 -0
  337. package/v2Containers/Testv2/reducer.js +23 -0
  338. package/v2Containers/Testv2/sagas.js +11 -0
  339. package/v2Containers/Testv2/selectors.js +25 -0
  340. package/v2Containers/Testv2/tests/actions.test.js +18 -0
  341. package/v2Containers/Testv2/tests/index.test.js +10 -0
  342. package/v2Containers/Testv2/tests/reducer.test.js +9 -0
  343. package/v2Containers/Testv2/tests/sagas.test.js +15 -0
  344. package/v2Containers/Testv2/tests/selectors.test.js +10 -0
  345. package/v2Containers/WeChat/MapTemplates/_mapTemplates.scss +8 -0
  346. package/v2Containers/WeChat/MapTemplates/actions.js +52 -0
  347. package/v2Containers/WeChat/MapTemplates/constants.js +28 -0
  348. package/v2Containers/WeChat/MapTemplates/index.js +1385 -0
  349. package/v2Containers/WeChat/MapTemplates/messages.js +73 -0
  350. package/v2Containers/WeChat/MapTemplates/reducer.js +74 -0
  351. package/v2Containers/WeChat/MapTemplates/sagas.js +86 -0
  352. package/v2Containers/WeChat/MapTemplates/selectors.js +25 -0
  353. package/v2Containers/WeChat/MapTemplates/tests/actions.test.js +18 -0
  354. package/v2Containers/WeChat/MapTemplates/tests/index.test.js +10 -0
  355. package/v2Containers/WeChat/MapTemplates/tests/reducer.test.js +9 -0
  356. package/v2Containers/WeChat/MapTemplates/tests/sagas.test.js +15 -0
  357. package/v2Containers/WeChat/MapTemplates/tests/selectors.test.js +10 -0
  358. package/v2Containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +57 -0
  359. package/v2Containers/WeChat/RichmediaTemplates/Create/actions.js +36 -0
  360. package/v2Containers/WeChat/RichmediaTemplates/Create/constants.js +15 -0
  361. package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +1053 -0
  362. package/v2Containers/WeChat/RichmediaTemplates/Create/messages.js +141 -0
  363. package/v2Containers/WeChat/RichmediaTemplates/Create/reducer.js +60 -0
  364. package/v2Containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +497 -0
  365. package/v2Containers/WeChat/RichmediaTemplates/Create/sagas.js +48 -0
  366. package/v2Containers/WeChat/RichmediaTemplates/Create/selectors.js +37 -0
  367. package/v2Containers/WeChat/RichmediaTemplates/Create/tests/actions.test.js +18 -0
  368. package/v2Containers/WeChat/RichmediaTemplates/Create/tests/index.test.js +10 -0
  369. package/v2Containers/WeChat/RichmediaTemplates/Create/tests/reducer.test.js +9 -0
  370. package/v2Containers/WeChat/RichmediaTemplates/Create/tests/sagas.test.js +15 -0
  371. package/v2Containers/WeChat/RichmediaTemplates/Create/tests/selectors.test.js +10 -0
  372. package/v2Containers/WeChat/RichmediaTemplates/Edit/actions.js +20 -0
  373. package/v2Containers/WeChat/RichmediaTemplates/Edit/constants.js +10 -0
  374. package/v2Containers/WeChat/RichmediaTemplates/Edit/index.js +116 -0
  375. package/v2Containers/WeChat/RichmediaTemplates/Edit/messages.js +13 -0
  376. package/v2Containers/WeChat/RichmediaTemplates/Edit/reducer.js +28 -0
  377. package/v2Containers/WeChat/RichmediaTemplates/Edit/sagas.js +32 -0
  378. package/v2Containers/WeChat/RichmediaTemplates/Edit/selectors.js +30 -0
  379. package/v2Containers/WeChat/RichmediaTemplates/Edit/tests/actions.test.js +18 -0
  380. package/v2Containers/WeChat/RichmediaTemplates/Edit/tests/index.test.js +10 -0
  381. package/v2Containers/WeChat/RichmediaTemplates/Edit/tests/reducer.test.js +9 -0
  382. package/v2Containers/WeChat/RichmediaTemplates/Edit/tests/sagas.test.js +15 -0
  383. package/v2Containers/WeChat/RichmediaTemplates/Edit/tests/selectors.test.js +10 -0
  384. package/v2Containers/WeChat/RichmediaTemplates/View/actions.js +15 -0
  385. package/v2Containers/WeChat/RichmediaTemplates/View/constants.js +7 -0
  386. package/v2Containers/WeChat/RichmediaTemplates/View/index.js +47 -0
  387. package/v2Containers/WeChat/RichmediaTemplates/View/messages.js +13 -0
  388. package/v2Containers/WeChat/RichmediaTemplates/View/reducer.js +23 -0
  389. package/v2Containers/WeChat/RichmediaTemplates/View/sagas.js +11 -0
  390. package/v2Containers/WeChat/RichmediaTemplates/View/selectors.js +25 -0
  391. package/v2Containers/WeChat/RichmediaTemplates/View/tests/actions.test.js +18 -0
  392. package/v2Containers/WeChat/RichmediaTemplates/View/tests/index.test.js +10 -0
  393. package/v2Containers/WeChat/RichmediaTemplates/View/tests/reducer.test.js +9 -0
  394. package/v2Containers/WeChat/RichmediaTemplates/View/tests/sagas.test.js +15 -0
  395. package/v2Containers/WeChat/RichmediaTemplates/View/tests/selectors.test.js +10 -0
@@ -0,0 +1,1053 @@
1
+ /*
2
+ *
3
+ * Create
4
+ *
5
+ */
6
+
7
+ import PropTypes from 'prop-types';
8
+
9
+ import React from 'react';
10
+ import { connect } from 'react-redux';
11
+ import Helmet from 'react-helmet';
12
+ import { bindActionCreators } from 'redux';
13
+ import { createStructuredSelector } from 'reselect';
14
+ import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
15
+ import _ from 'lodash';
16
+ import { Menu, Dropdown } from 'antd';
17
+ import { CapRow, CapColumn, CapButton, CapCard, CapSpinner } from '@capillarytech/cap-ui-library';
18
+ import makeSelectCreate, {makeSelectTemplates, getAssetDetails, getContentAssetDetails} from './selectors';
19
+ import * as actions from './actions';
20
+ import richmediaschema from './richmediaschema';
21
+ import './_createRichmedia.scss';
22
+ import messages from './messages';
23
+ import * as globalActions from '../../../../containers/Cap/actions';
24
+ import {getMessageObject} from '../../../../../utils/messageUtils';
25
+ import FormBuilder from '../../../../components/FormBuilder';
26
+ import Header from '../../../../components/Header';
27
+ import WechatRichmediaTemplatePreview from '../../../../components/TemplatePreview/WechatRichmediaTemplatePreview';
28
+ const MenuItem = Menu.Item;
29
+ export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
30
+ constructor(props) {
31
+ super(props);
32
+ let templateData = {};
33
+ let isEdit = false;
34
+ let totalContentBlocks = 0;
35
+ let mediaId = "";
36
+ let templateId = "";
37
+ let templateName = "";
38
+ let isIframe = false;
39
+ if (props.location.query.type === "embedded" && props.location.query.module === "outbound") {
40
+ isIframe = true;
41
+ }
42
+ if (props.mode === 'EDIT') {
43
+ templateData = props.templateData;
44
+ isEdit = true;
45
+ totalContentBlocks = props.totalContentBlocks;
46
+ mediaId = props.mediaId;
47
+ templateId = props.templateId;
48
+ templateName = props.templateName;
49
+ }
50
+ this.state = {
51
+ richmediaSchema: richmediaschema,
52
+ map: {
53
+ "image-value": {
54
+ onUpload: this.uploadImage,
55
+ },
56
+ "title-value": {
57
+ onChange: this.onFormDataChange,
58
+ },
59
+ "author-value": {
60
+ onChange: this.onFormDataChange,
61
+ },
62
+ "cover-abstract-value": {
63
+ onChange: this.onFormDataChange,
64
+ },
65
+ "source-link-value": {
66
+ onChange: this.onFormDataChange,
67
+ },
68
+ "content-value": {
69
+ getEditorInstanse: this.getEditorInstanse,
70
+ onContentChange: this.onContentChange,
71
+ onFocusOut: this.focusOutFromCkEditor,
72
+ onFocusIn: this.focusInFromCkeditor,
73
+ },
74
+ "show-cover-pic-value": {
75
+ onChange: this.onFormDataChange,
76
+ },
77
+ "post-comments-value": {
78
+ onChange: this.onFormDataChange,
79
+ },
80
+ "content-image-value": {
81
+ onUpload: this.uploadImage,
82
+ },
83
+ },
84
+ isEdit,
85
+ isFormValid: true,
86
+ templateData,
87
+ currentContentId: 0,
88
+ totalContentBlocks,
89
+ templateName,
90
+ templateId,
91
+ mediaId,
92
+ isIframe,
93
+ hovered: false,
94
+ loading: false,
95
+ showPreview: false,
96
+ focusOut: true,
97
+ showModal: false,
98
+ modalContent: {
99
+ title: this.props.intl.formatMessage(messages.modalTitle),
100
+ body: this.props.intl.formatMessage(messages.modalBody),
101
+ type: 'confirm',
102
+ id: 'template-back-confirm-modal',
103
+ },
104
+ };
105
+ this.onFormDataChange = this.onFormDataChange.bind(this);
106
+ this.cancelHandler = this.cancelHandler.bind(this);
107
+ this.templateNameHandler = this.templateNameHandler.bind(this);
108
+ this.saveHandler = this.saveHandler.bind(this);
109
+ this.previewHandler = this.previewHandler.bind(this);
110
+ this.setFormValidity = this.setFormValidity.bind(this);
111
+ this.injectEvents = this.injectEvents.bind(this);
112
+ this.injectSections = this.injectSections.bind(this);
113
+ this.injectContainer = this.injectContainer.bind(this);
114
+ this.injectColLabelSection = this.injectColLabelSection.bind(this);
115
+ this.injectMultiColSection = this.injectMultiColSection.bind(this);
116
+ this.getMappedEvent = this.getMappedEvent.bind(this);
117
+ this.updateTotalContentBlocks = this.updateTotalContentBlocks.bind(this);
118
+ this.insertTemplateData = this.insertTemplateData.bind(this);
119
+ this.uploadImage = this.uploadImage.bind(this);
120
+ this.returnCardLayout = this.returnCardLayout.bind(this);
121
+ this.menuOnClickEvent = this.menuOnClickEvent.bind(this);
122
+ this.showErrorMessage = this.showErrorMessage.bind(this);
123
+ this.returnCurrentFormData = this.returnCurrentFormData.bind(this);
124
+ this.returnCurrentSchema = this.returnCurrentSchema.bind(this);
125
+ this.handleFrameTasks = this.handleFrameTasks.bind(this);
126
+ this.getCurrentWindow = this.getCurrentWindow.bind(this);
127
+ // this.startLoading = this.startLoading.bind(this);
128
+ this.moveToTemplates = this.moveToTemplates.bind(this);
129
+ this.showNext = this.showNext.bind(this);
130
+ this.prepareWeChatRichmediaPreviewData = this.prepareWeChatRichmediaPreviewData.bind(this);
131
+ this.injectMessages = this.injectMessages.bind(this);
132
+ }
133
+ componentWillMount = () => {
134
+ if (_.isEmpty(this.props.Templates.selectedWeChatAccount)) {
135
+ const module = this.props.location.query.module ? this.props.location.query.module : 'default';
136
+ const type = this.props.location.query.type;
137
+ this.props.router.push({
138
+ pathname: `/wechat`,
139
+ query: type === 'embedded' ? {type: 'embedded', module} : {module},
140
+ });
141
+ }
142
+ }
143
+ componentDidMount = () => {
144
+ if (!this.state.isEdit) {
145
+ this.updateTotalContentBlocks();
146
+ }
147
+ if (this.state.isIframe) {
148
+ window.addEventListener("message", this.handleFrameTasks);
149
+ this.showNext();
150
+ }
151
+ }
152
+ componentWillReceiveProps = (nextProps) => {
153
+ if (nextProps.Create.saveTemplateRes && !_.isEmpty(nextProps.Create.saveTemplateRes) && nextProps.Create.saveTemplateSuccess && !_.isEqual(nextProps.Create.saveTemplateRes, this.props.Create.saveTemplateRes)) {
154
+ this.setState({loading: false});
155
+ const message = getMessageObject('success', this.props.intl.formatMessage(messages.saveSuccess), true);
156
+ this.props.globalActions.addMessageToQueue(message);
157
+ const type = nextProps.location.query.type;
158
+ nextProps.router.push({
159
+ pathname: `/wechat`,
160
+ query: type === 'embedded' ? {type: 'embedded'} : {},
161
+ });
162
+ }
163
+ if (!nextProps.Create.saveTemplateSuccess && nextProps.Create.saveTemplateSuccess !== undefined && nextProps.Create.saveTemplateErrorMessage && nextProps.Create.saveTemplateErrorMessage !== this.props.Create.saveTemplateErrorMessage) {
164
+ this.setState({loading: false});
165
+ this.showErrorMessage(nextProps.Create.saveTemplateErrorMessage);
166
+ }
167
+ }
168
+ componentWillUnmount() {
169
+ if (this.state.isIframe) {
170
+ window.removeEventListener("message", this.handleFrameTasks);
171
+ }
172
+ }
173
+ onHover = (data) => {
174
+ this.setState({hovered: data});
175
+ }
176
+ onHoverRemove = (data) => {
177
+ this.setState({hovered: data});
178
+ }
179
+ onFormDataChange = (currentFormData) => {
180
+ const templateData = _.cloneDeep(this.state.templateData);
181
+ templateData[this.state.currentContentId].formData = _.cloneDeep(currentFormData);
182
+ this.setState({templateData});
183
+ }
184
+ onContentChange = (evt) => {
185
+ const templateData = _.cloneDeep(this.state.templateData);
186
+ console.log('oncontentchange onChange ', evt, evt.editor.getData(), templateData);
187
+ templateData[this.state.currentContentId].formData['content-value'] = evt.editor.getData();
188
+ this.setState({templateData});
189
+ }
190
+ getEditorInstanse = (instance, id) => {
191
+ console.log('Got editor Instance ', instance, id);
192
+ window.CKEDITOR.on( 'instanceReady', ( event ) => {
193
+ this.setState({editorInstanse: event.editor});
194
+ event.editor.on( 'focus', () => {
195
+ console.log( 'focused', event.editor, this );
196
+ this.setState({editorInstanse: event.editor});
197
+ });
198
+ });
199
+ //this.setState({editorInstanse: instance});
200
+ }
201
+ getMappedEvent = (id, event) => {
202
+ const map = this.state.map;
203
+ // if (!map[id] || !map[id][event]) {
204
+ // }
205
+ return map[id][event];
206
+ }
207
+ setFormValidity = (isFormValid) => {
208
+ this.setState({isFormValid});
209
+ }
210
+ getCurrentWindow(e) {
211
+ console.log("moveToTemplates richmedia getCurrentWindow");
212
+ const response = {
213
+ action: e.action,
214
+ value: 'edit',
215
+ direction: e.value,
216
+ };
217
+ parent.postMessage(JSON.stringify(response), '*');
218
+ }
219
+ getFormData(e) {
220
+ console.log("getformdata wechat richmedia: ", this.state.templateData, this.props, this.state);
221
+ const message = {
222
+ mediaList: this.props.templateData.templateDetails.versions.base.mediaList,
223
+ media_id: this.props.templateData.templateDetails.versions.base.mediaId,
224
+ definition: {
225
+ msgtype: "MPNEWS",
226
+ msgcontent: "RICH_MEDIA_WECHAT",
227
+ },
228
+ };
229
+ const data = {
230
+ data: message,
231
+ accountId: this.props.Templates && this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.id,
232
+ template_id: this.props.templateId,
233
+ Title: this.props.templateName,
234
+ OriginalId: this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier,
235
+ TopColor: "#000000",
236
+ touser: "{{wechat_open_id}}",
237
+ creative_template_id: this.props.templateId,
238
+ };
239
+ const response = {
240
+ action: "getFormData",
241
+ value: data,
242
+ validity: this.state.isFormValid,
243
+ };
244
+ console.log("getformdata2 wechat richmedia: ", data);
245
+ e.source.postMessage(JSON.stringify(response), e.origin);
246
+ }
247
+ injectMessages(elem) {
248
+ const temp = elem;
249
+ if (temp.value && messages[temp.value]) {
250
+ temp.value = this.props.intl.formatMessage(messages[temp.value]);
251
+ }
252
+ if (temp.label && messages[temp.label]) {
253
+ temp.label = this.props.intl.formatMessage(messages[temp.label]);
254
+ }
255
+ if (temp.errorMessage && messages[temp.errorMessage]) {
256
+ temp.errorMessage = this.props.intl.formatMessage(messages[temp.errorMessage]);
257
+ }
258
+ if (temp.placeholder && messages[temp.placeholder]) {
259
+ temp.placeholder = this.props.intl.formatMessage(messages[temp.placeholder]);
260
+ }
261
+ if (temp.options) {
262
+ _.forEach(temp.options, (option, id) => {
263
+ if (messages[option]) {
264
+ temp.options[id] = this.props.intl.formatMessage(messages[option]);
265
+ }
266
+ });
267
+ }
268
+ return temp;
269
+ }
270
+ showErrorMessage = (errorMessage) => {
271
+ const message = getMessageObject('error', errorMessage, true);
272
+ this.props.globalActions.addMessageToQueue(message);
273
+ }
274
+ checkFormFieldsCount = () => {
275
+ const templateData = _.cloneDeep(this.state.templateData);
276
+ let isLimitExceeded = false;
277
+ _.forEach(templateData, (content) => {
278
+ if (_.isEmpty(content)) {
279
+ isLimitExceeded = true;
280
+ }
281
+ if (content.formData['title-value'].length > 64) {
282
+ this.showErrorMessage(`${this.props.intl.formatMessage(messages.titleCharacterCount)} ${content.formData['title-value'].length - 64} characters`);
283
+ isLimitExceeded = true;
284
+ }
285
+ if (content.formData['author-value'].length > 8) {
286
+ this.showErrorMessage(`${this.props.intl.formatMessage(messages.authorCharacterCount)} ${content.formData['author-value'].length - 8} characters`);
287
+ isLimitExceeded = true;
288
+ }
289
+ if (content.formData['cover-abstract-value'].length > 120) {
290
+ this.showErrorMessage(`${this.props.intl.formatMessage(messages.coverAbstractCharacterCount)} ${content.formData['cover-abstract-value'].length - 120} characters`);
291
+ isLimitExceeded = true;
292
+ }
293
+ return isLimitExceeded;
294
+ });
295
+ return isLimitExceeded;
296
+ }
297
+ // startLoading(ifEdit) {
298
+ // if (ifEdit) {
299
+ // this.setState({loading: true});
300
+ // }
301
+ // }
302
+ moveToTemplates() {
303
+ console.log("moveToTemplates richmedia");
304
+ const modalContent = {
305
+ title: this.props.intl.formatMessage(messages.modalTitle),
306
+ body: this.props.intl.formatMessage(messages.modalBody),
307
+ type: 'confirm',
308
+ id: 'template-back-confirm-modal',
309
+ show: true,
310
+ };
311
+ this.setState({modalContent, showModal: true});
312
+ }
313
+ handleCancelModal = () => {
314
+ this.setState({showModal: false});
315
+ }
316
+ showNext() {
317
+ console.log("richmedia shownext");
318
+ const response = {
319
+ action: "showNext",
320
+ value: true,
321
+ };
322
+ parent.postMessage(JSON.stringify(response), '*');
323
+ }
324
+ handleFrameTasks = (e) => {
325
+ console.log("richmedia handleFrameTasks: ", e.data);
326
+ const type = e.data;
327
+ if (typeof type === 'object') {
328
+ const action = type.action;
329
+ switch (action) {
330
+ case "startLoading":
331
+ this.startLoading(type.edit);
332
+ break;
333
+ case "getCurrentWindow":
334
+ this.getCurrentWindow(type);
335
+ break;
336
+ default:
337
+ break;
338
+ }
339
+ } else {
340
+ switch (type) {
341
+ case "getFormData":
342
+ this.getFormData(e);
343
+ break;
344
+ case "moveToTemplates":
345
+ console.log("moveToTemplates richmedia case");
346
+ this.moveToTemplates();
347
+ break;
348
+ default:
349
+ break;
350
+ }
351
+ }
352
+ }
353
+ injectEvents = (schema) => {
354
+ const temp = schema;
355
+ if (temp.standalone) {
356
+ temp.standalone.sections = this.injectSections(temp.standalone.sections);
357
+ }
358
+ if (temp.containers) {
359
+ _.forEach(temp.containers, (container) => {
360
+ let tempContainer = container;
361
+ tempContainer = this.injectContainer(tempContainer);
362
+ return tempContainer;
363
+ });
364
+ }
365
+ return schema;
366
+ }
367
+ injectContainer = (container) => {
368
+ const temp = container;
369
+ if (temp.type === 'tabs') {
370
+ temp.injectedEvents = {};
371
+ _.forEach(temp.supportedEvents, (event) => {
372
+ temp.injectedEvents[event] = this.getMappedEvent(temp.id, event);
373
+ });
374
+ _.forEach(temp.panes, (pane) => {
375
+ const tempPane = pane;
376
+ tempPane.sectionsHeaders = this.injectSections(tempPane.sectionsHeaders);
377
+ tempPane.sections = this.injectSections(tempPane.sections);
378
+ });
379
+ }
380
+ return temp;
381
+ }
382
+ injectSections = (sections) => {
383
+ _.forEach(sections, (section) => {
384
+ let temp = section;
385
+ if (temp.type === 'col-label') {
386
+ temp = this.injectColLabelSection(temp);
387
+ } else if (section.type === 'multicols') {
388
+ temp = this.injectMultiColSection(temp);
389
+ } else if (section.type === 'parent') {
390
+ temp = this.injectSections(temp.childSections);
391
+ }
392
+ });
393
+ return sections;
394
+ }
395
+ injectColLabelSection = (section) => {
396
+ _.forEach(section.inputFields, (inputField) => {
397
+ let temp = inputField;
398
+ temp.injectedEvents = {};
399
+ _.forEach(inputField.supportedEvents, (event) => {
400
+ temp.injectedEvents[event] = this.getMappedEvent(inputField.id, event);
401
+ });
402
+ temp = this.injectMessages(temp);
403
+ return true;
404
+ });
405
+ _.forEach(section.actionFields, (actionField) => {
406
+ let temp = actionField;
407
+ temp.injectedEvents = {};
408
+ _.forEach(actionField.supportedEvents, (event) => {
409
+ temp.injectedEvents[event] = this.getMappedEvent(actionField.id, event);
410
+ });
411
+ temp = this.injectMessages(temp);
412
+ return true;
413
+ });
414
+ return section;
415
+ }
416
+ injectMultiColSection = (section) => {
417
+ _.forEach(section.inputFields, (inputField) => {
418
+ _.forEach(inputField.cols, (col) => {
419
+ let temp = col;
420
+ temp.injectedEvents = {};
421
+ _.forEach(col.supportedEvents, (event) => {
422
+ temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
423
+ });
424
+ temp = this.injectMessages(temp);
425
+ return true;
426
+ });
427
+ });
428
+ _.forEach(section.actionFields, (actionField) => {
429
+ _.forEach(actionField.cols, (col) => {
430
+ let temp = col;
431
+ temp.injectedEvents = {};
432
+ _.forEach(col.supportedEvents, (event) => {
433
+ temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
434
+ });
435
+ temp = this.injectMessages(temp);
436
+ return true;
437
+ });
438
+ });
439
+ return section;
440
+ }
441
+ templateNameHandler = (ev) => {
442
+ const { value } = ev.target;
443
+ this.setState({templateName: value});
444
+ }
445
+ cancelHandler = () => {
446
+ const type = this.props.location.query.type;
447
+ this.props.router.push({
448
+ pathname: `/wechat`,
449
+ query: type === 'embedded' ? {type: 'embedded'} : {},
450
+ });
451
+ }
452
+ closeSlideBox = () => {
453
+ this.setState({showPreview: false});
454
+ }
455
+ deducePostCommentsData = (data) => {
456
+ let postCommentsData = {};
457
+ if (data && data.toLowerCase() === 'anyone') {
458
+ postCommentsData = {
459
+ need_open_comment: 1,
460
+ only_fans_can_comment: 0,
461
+ };
462
+ } else if (data && data.toLowerCase() === 'only followers') {
463
+ postCommentsData = {
464
+ need_open_comment: 1,
465
+ only_fans_can_comment: 1,
466
+ };
467
+ } else {
468
+ postCommentsData = {
469
+ need_open_comment: 0,
470
+ only_fans_can_comment: 0,
471
+ };
472
+ }
473
+ return postCommentsData;
474
+ }
475
+ prepareMediaList = () => {
476
+ const templateData = _.cloneDeep(this.state.templateData);
477
+ const mediaList = [];
478
+ _.forEach(templateData, (contentData) => {
479
+ const postCommentsData = this.deducePostCommentsData(contentData.formData['post-comments-value']);
480
+ const filteredContent = {
481
+ title: contentData.formData['title-value'],
482
+ author: contentData.formData['author-value'] ? contentData.formData['author-value'] : '',
483
+ digest: contentData.formData['cover-abstract-value'] ? contentData.formData['cover-abstract-value'] : '',
484
+ content: contentData.formData['content-value'],
485
+ content_source_url: contentData.formData['source-link-value'],
486
+ show_cover_pic: contentData.formData['show-cover-pic-value'] === true ? 1 : 0,
487
+ need_open_comment: postCommentsData.need_open_comment,
488
+ only_fans_can_comment: postCommentsData.only_fans_can_comment,
489
+ thumb_media_id: contentData.mediaId,
490
+ image_url: contentData.imageUrl,
491
+ };
492
+ mediaList.push(filteredContent);
493
+ });
494
+ return mediaList;
495
+ }
496
+ prepareWeChatRichmediaPreviewData = () => {
497
+ const templateData = _.cloneDeep(this.state.templateData);
498
+ const returnObj = [];
499
+ _.forEach(templateData, (contentData, contentIndex) => {
500
+ const id = parseInt(contentIndex, 10);
501
+ if (id === 0) {
502
+ returnObj.push(
503
+ <div style={{ width: "100%", height: 116, position: "relative" }}>
504
+ <CapRow>
505
+ <img alt="default" width="100%" height="110px" src={contentData.imageUrl} />
506
+ <div style={{ position: "absolute", bottom: "5%", left: "5%" }}>{contentData.formData['title-value'] ? contentData.formData['title-value'] : ""}</div>
507
+ </CapRow>
508
+ {Object.keys(templateData).length === 1 ?
509
+ <CapRow style={{ height: 32 }}>
510
+ {contentData.formData['cover-abstract-value'] ? contentData.formData['cover-abstract-value'] : ""}
511
+ </CapRow>
512
+ :
513
+ ""
514
+ }
515
+ </div>
516
+ );
517
+ } else {
518
+ returnObj.push(
519
+ <CapRow style={{ "width": "100%", "height": 64, "border-bottom": "0.5px solid lightgrey" }}>
520
+ <CapColumn style={{ padding: "5% 0% 0% 5%", float: "left" }}>
521
+ {contentData.formData['title-value']}
522
+ </CapColumn>
523
+ <CapColumn style={{ float: "right" }}>
524
+ <img alt="default" width="60px" height="60px" src={contentData.imageUrl} style={{ "padding-right": "10%", "float": "left" }}/>
525
+ </CapColumn>
526
+ </CapRow>
527
+ );
528
+ }
529
+ });
530
+ return returnObj;
531
+ }
532
+ previewHandler = () => {
533
+ this.setState({showPreview: true});
534
+ }
535
+ saveHandler = () => {
536
+ let isFormValid = this.validateFormFields();
537
+ if (_.isEmpty(this.state.templateName)) {
538
+ this.showErrorMessage(this.props.intl.formatMessage(messages.emptyTemplateName));
539
+ isFormValid = false;
540
+ }
541
+ if (isFormValid) {
542
+ const mediaList = this.prepareMediaList();
543
+ const saveObj = {};
544
+ saveObj.name = this.state.templateName.trim();
545
+ saveObj.appId = this.props.Templates.selectedWeChatAccount.configs.wechat_app_id;
546
+ saveObj.appSecret = this.props.Templates.selectedWeChatAccount.configs.wechat_app_secret;
547
+ saveObj.versions = {
548
+ base: {
549
+ OriginalId: this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier,
550
+ mediaList,
551
+ },
552
+ history: [],
553
+ };
554
+ saveObj.definition = {
555
+ msgtype: "MPNEWS",
556
+ msgcontent: "RICH_MEDIA_WECHAT",
557
+ };
558
+ if (this.state.isEdit) {
559
+ saveObj._id = this.props.templateId;
560
+ saveObj.mediaId = this.props.mediaId;
561
+ saveObj.type = "WECHAT";
562
+ }
563
+ this.setState({loading: true});
564
+ this.props.actions.saveTemplate(saveObj);
565
+ }
566
+ }
567
+ uploadImage = (data, uploadId) => {
568
+ if (data.type === "wrong file") {
569
+ this.showErrorMessage(this.props.intl.formatMessage(messages.wrongFormatFile));
570
+ } else {
571
+ const wechatParams = {
572
+ appId: this.props.Templates.selectedWeChatAccount.configs.wechat_app_id,
573
+ appSecret: this.props.Templates.selectedWeChatAccount.configs.wechat_app_secret,
574
+ source: 'wechat',
575
+ };
576
+ this.setState({loading: true});
577
+ this.props.actions.uploadAsset(data.file, data.type, data.fileParams, null, wechatParams, this.state.currentContentId, uploadId);
578
+ }
579
+ }
580
+ updateTotalContentBlocks = () => {
581
+ this.setState({
582
+ totalContentBlocks: this.state.totalContentBlocks + 1,
583
+ }, () => {
584
+ this.insertTemplateData();
585
+ });
586
+ }
587
+ insertTemplateData = () => {
588
+ const templateData = _.cloneDeep(this.state.templateData);
589
+ templateData[this.state.totalContentBlocks - 1] = {
590
+ formData: {},
591
+ imageUrl: "",
592
+ mediaId: "",
593
+ };
594
+ this.setState({templateData});
595
+ }
596
+ updateImageData = () => {
597
+ const templateData = _.cloneDeep(this.state.templateData);
598
+ if (this.props.ImageData && !_.isEmpty(this.props.ImageData[this.state.currentContentId]) && this.props.ImageData[this.state.currentContentId].metaInfo && this.props.ImageData[this.state.currentContentId].metaInfo.secure_file_path && this.props.ImageData[this.state.currentContentId].metaInfo.mediaId && templateData[this.state.currentContentId].imageUrl !== this.props.ImageData[this.state.currentContentId].metaInfo.secure_file_path) {
599
+ templateData[this.state.currentContentId].imageUrl = this.props.ImageData[this.state.currentContentId].metaInfo.secure_file_path;
600
+ templateData[this.state.currentContentId].mediaId = this.props.ImageData[this.state.currentContentId].metaInfo.mediaId;
601
+ this.setState({templateData, loading: false});
602
+ }
603
+ }
604
+ viewContent = (e, id) => {
605
+ this.setState({currentContentId: id});
606
+ }
607
+ deleteContent = (e, id) => {
608
+ const modalContent = {
609
+ title: this.props.intl.formatMessage(messages.modalTitle),
610
+ body: this.props.intl.formatMessage(messages.deleteContent),
611
+ type: 'confirm',
612
+ id: 'template-delete-confirm-modal',
613
+ show: true,
614
+ contentId: id,
615
+ };
616
+ this.setState({showModal: true, modalContent});
617
+ }
618
+ handleDelete = (modalContent) => {
619
+ const templateData = _.cloneDeep(this.state.templateData);
620
+ let totalContentBlocks = this.state.totalContentBlocks;
621
+ let currentContentId = this.state.currentContentId;
622
+ let index = 0;
623
+ for (index = modalContent.contentId; index <= (totalContentBlocks - 2); index += 1) {
624
+ templateData[index] = templateData[index + 1];
625
+ }
626
+ delete templateData[index];
627
+ currentContentId = (totalContentBlocks - 1) === modalContent.contentId ? modalContent.contentId - 1 : modalContent.contentId;
628
+ totalContentBlocks -= 1;
629
+ this.setState({templateData, totalContentBlocks, currentContentId, showModal: false});
630
+ }
631
+ moveContentDownward = (e, id) => {
632
+ const templateData = _.cloneDeep(this.state.templateData);
633
+ let currentContentId = this.state.currentContentId;
634
+ const temp = templateData[id];
635
+ templateData[id] = templateData[id + 1];
636
+ templateData[id + 1] = temp;
637
+ currentContentId = id + 1;
638
+ this.setState({templateData, currentContentId});
639
+ }
640
+ moveContentUpward = (e, id) => {
641
+ const templateData = _.cloneDeep(this.state.templateData);
642
+ let currentContentId = this.state.currentContentId;
643
+ const temp = templateData[id];
644
+ templateData[id] = templateData[id - 1];
645
+ templateData[id - 1] = temp;
646
+ currentContentId = id - 1;
647
+ this.setState({templateData, currentContentId});
648
+ }
649
+ returnCardLayout = () => {
650
+ const templateData = _.cloneDeep(this.state.templateData);
651
+ const returnObj = [];
652
+ if (this.state.isIframe) {
653
+ _.forEach(templateData, (contentData, contentId) => {
654
+ const id = parseInt(contentId, 10);
655
+ const imageUrl = contentData.imageUrl;
656
+ if (id === 0) {
657
+ returnObj[id] = (
658
+ <div className="hover-container">
659
+ <CapCard
660
+ id={id}
661
+ style={{ width: 244, height: 221 }}
662
+ bodyStyle={{ "padding": 0, "background-color": "#707070", "height": 139 }}
663
+ onClick={(e) => this.viewContent(e, id)}
664
+ className={id === this.state.currentContentId ? "richmedia-card richmedia-card-clicked" : "richmedia-card"}
665
+ >
666
+ <div>
667
+ <div className="custom-image">
668
+ <img alt="" width="100%" height="139px" src={imageUrl} />
669
+ </div>
670
+ <div className="custom-card overflow-wrap-fields">
671
+ <p style={{ padding: "0px 8px" }}>{contentData && contentData.formData ? contentData.formData['cover-abstract-value'] : ""}</p>
672
+ </div>
673
+ </div>
674
+ </CapCard>
675
+ </div>
676
+ );
677
+ } else {
678
+ returnObj[id] = (
679
+ <div
680
+ id={id}
681
+ style={{ "margin-top": 10 }}
682
+ className="hover-container"
683
+ onClick={(e) => this.viewContent(e, id)}
684
+ >
685
+ <CapRow style={{ width: 244, height: 53 }} className={id === this.state.currentContentId ? "richmedia-card-rectangle richmedia-card-rectangle-clicked" : "richmedia-card-rectangle"}>
686
+ <CapColumn span={19} style={{ padding: "10px 8px 0px 8px" }} className="overflow-wrap-fields" >
687
+ {contentData && contentData.formData ? contentData.formData['title-value'] : ""}
688
+ </CapColumn>
689
+ <CapColumn span={5} style={{ "height": "100%", "background-color": "#707070" }}>
690
+ <img alt="" width="50px" height="100%" src={imageUrl} />
691
+ </CapColumn>
692
+ </CapRow>
693
+ </div>
694
+ );
695
+ }
696
+ });
697
+ } else {
698
+ _.forEach(templateData, (contentData, contentId) => {
699
+ const id = parseInt(contentId, 10);
700
+ const imageUrl = contentData.imageUrl;
701
+ if (id === 0) {
702
+ returnObj[id] = (
703
+ <div className="hover-container">
704
+ <CapCard
705
+ id={id}
706
+ style={{ width: 244, height: 221 }}
707
+ bodyStyle={{ "padding": 0, "background-color": "#707070", "height": 139 }}
708
+ className={id === this.state.currentContentId ? "richmedia-card richmedia-card-clicked" : "richmedia-card"}
709
+ >
710
+ <div>
711
+ <div className="custom-image">
712
+ <img alt="" width="100%" height="139px" src={imageUrl} />
713
+ </div>
714
+ <div className="custom-card overflow-wrap-fields">
715
+ <p style={{ padding: "0px 8px" }}>{contentData && contentData.formData ? contentData.formData['cover-abstract-value'] : ""}</p>
716
+ </div>
717
+ </div>
718
+ </CapCard>
719
+
720
+ {this.state.totalContentBlocks !== 1 ?
721
+ <div className="richmedia-icons">
722
+ <div id={id} onClick={(e) => this.moveContentDownward(e, id)}>
723
+ <i className="material-icons hover-icons">arrow_downward</i>
724
+ </div>
725
+ <div id={id} onClick={(e) => this.viewContent(e, id)} style={{ 'padding-left': '190px' }}>
726
+ <i className="material-icons hover-icons">visibility</i>
727
+ </div>
728
+ </div>
729
+ :
730
+ <div className="richmedia-icons">
731
+ <div id={id} onClick={(e) => this.viewContent(e, id)} style={{ 'padding-left': '214px' }}>
732
+ <i className="material-icons hover-icons">visibility</i>
733
+ </div>
734
+ </div>
735
+ }
736
+ </div>
737
+ );
738
+ } else {
739
+ returnObj[id] = (
740
+ <div
741
+ id={id}
742
+ style={{ "margin-top": 10 }}
743
+ className="hover-container"
744
+ >
745
+ <CapRow style={{ width: 244, height: 53 }} className={id === this.state.currentContentId ? "richmedia-card-rectangle richmedia-card-rectangle-clicked" : "richmedia-card-rectangle"}>
746
+ <CapColumn span={19} style={{ padding: "10px 8px 0px 8px" }} className="overflow-wrap-fields" >
747
+ {contentData && contentData.formData ? contentData.formData['title-value'] : ""}
748
+ </CapColumn>
749
+ <CapColumn span={5} style={{ "height": "100%", "background-color": "#707070" }}>
750
+ <img alt="" width="50px" height="100%" src={imageUrl} />
751
+ </CapColumn>
752
+ </CapRow>
753
+ <div className="richmedia-icons">
754
+ <div style={{display: 'inline-flex'}}>
755
+ <div id={id} onClick={(e) => this.moveContentUpward(e, id)}>
756
+ <i className="material-icons hover-icons">arrow_upward</i>
757
+ </div>
758
+ {id !== (this.state.totalContentBlocks - 1 ) ?
759
+ <div id={id} onClick={(e) => this.moveContentDownward(e, id)}>
760
+ <i className="material-icons hover-icons">arrow_downward</i>
761
+ </div>
762
+ :
763
+ ""
764
+ }
765
+ </div>
766
+ {id !== (this.state.totalContentBlocks - 1 ) ?
767
+ <div style={{'display': 'inline-flex', 'padding-left': '142px'}}>
768
+ <div id={id} onClick={(e) => this.viewContent(e, id)}>
769
+ <i className="material-icons hover-icons">visibility</i>
770
+ </div>
771
+ <div id={id} onClick={(e) => this.deleteContent(e, id)} >
772
+ <i className="material-icons hover-icons">delete</i>
773
+ </div>
774
+ </div>
775
+ :
776
+ <div style={{'display': 'inline-flex', 'padding-left': '166px'}}>
777
+ <div id={id} onClick={(e) => this.viewContent(e, id)}>
778
+ <i className="material-icons hover-icons">visibility</i>
779
+ </div>
780
+ <div id={id} onClick={(e) => this.deleteContent(e, id)} >
781
+ <i className="material-icons hover-icons">delete</i>
782
+ </div>
783
+ </div>
784
+ }
785
+ </div>
786
+ </div>
787
+ );
788
+ }
789
+ });
790
+ }
791
+ return (
792
+ <div>{returnObj}</div>
793
+ );
794
+ }
795
+ isTitleRepeated = () => {
796
+ const templateData = _.cloneDeep(this.state.templateData);
797
+ const titleSet = new Set();
798
+ let isRepeated = false;
799
+ _.forEach(templateData, (content) => {
800
+ const setSizeBefore = titleSet.size;
801
+ titleSet.add(content.formData['title-value'].toLowerCase());
802
+ const setSizeAfter = titleSet.size;
803
+ if (setSizeAfter === setSizeBefore) {
804
+ isRepeated = true;
805
+ }
806
+ });
807
+ return isRepeated;
808
+ }
809
+ isFormEmpty = () => {
810
+ const templateData = _.cloneDeep(this.state.templateData);
811
+ let isEmpty = false;
812
+ _.forEach(templateData, (content) => {
813
+ if (_.isEmpty(content.formData)) {
814
+ isEmpty = true;
815
+ }
816
+ });
817
+ return isEmpty;
818
+ }
819
+ validateFormFields = () => {
820
+ let isValid = true;
821
+ const currentContent = this.state.templateData[this.state.currentContentId];
822
+ if (this.isFormEmpty()) {
823
+ this.showErrorMessage(this.props.intl.formatMessage(messages.formEmpty));
824
+ isValid = false;
825
+ return isValid;
826
+ }
827
+ if (_.isEmpty(currentContent.formData['title-value'])) {
828
+ this.showErrorMessage(this.props.intl.formatMessage(messages.titleEmpty));
829
+ isValid = false;
830
+ return isValid;
831
+ }
832
+ if (_.isEmpty(currentContent.imageUrl) || _.isEmpty(currentContent.mediaId)) {
833
+ this.showErrorMessage(this.props.intl.formatMessage(messages.noImage));
834
+ isValid = false;
835
+ return isValid;
836
+ }
837
+ if (_.isEmpty(currentContent.formData['source-link-value'])) {
838
+ this.showErrorMessage(this.props.intl.formatMessage(messages.sourceLinkEmpty));
839
+ isValid = false;
840
+ return isValid;
841
+ }
842
+ if (_.isEmpty(currentContent.formData['content-value'])) {
843
+ this.showErrorMessage(this.props.intl.formatMessage(messages.contentEmpty));
844
+ isValid = false;
845
+ return isValid;
846
+ }
847
+ if (this.checkFormFieldsCount(currentContent.formData)) {
848
+ isValid = false;
849
+ return isValid;
850
+ }
851
+ if (this.isTitleRepeated()) {
852
+ this.showErrorMessage(this.props.intl.formatMessage(messages.titleNameRepeated));
853
+ isValid = false;
854
+ return isValid;
855
+ }
856
+ if (!_.isEmpty(currentContent.formData['source-link-value'])) {
857
+ isValid = currentContent.formData['source-link-value'].match(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g);
858
+ if (!isValid) {
859
+ this.showErrorMessage(this.props.intl.formatMessage(messages.wrongUrl));
860
+ return isValid;
861
+ }
862
+ }
863
+ return isValid;
864
+ }
865
+ menuOnClickEvent(ev) {
866
+ const isFormValid = this.validateFormFields();
867
+ if (!isFormValid) {
868
+ return false;
869
+ }
870
+ switch (ev.key) {
871
+ case "new_richmedia_content":
872
+ if (this.state.totalContentBlocks < 8) {
873
+ this.setState({
874
+ currentContentId: this.state.totalContentBlocks,
875
+ }, () => {
876
+ this.updateTotalContentBlocks();
877
+ });
878
+ } else {
879
+ this.showErrorMessage(this.props.intl.formatMessage(messages.maxContentCount));
880
+ }
881
+ break;
882
+ case "old_richmedia_content":
883
+ this.setState({
884
+ currentContentId: this.state.currentContentId + 1,
885
+ }, () => {
886
+ this.updateTotalContentBlocks();
887
+ });
888
+ break;
889
+ default:
890
+ this.setState({
891
+ currentContentId: this.state.totalContentBlocks + 1,
892
+ }, () => {
893
+ this.updateTotalContentBlocks();
894
+ });
895
+ }
896
+ return true;
897
+ }
898
+ updateContentData = () => {
899
+ this.state.editorInstanse.insertHtml(`<img src='${this.props.ContentImageData.metaInfo.wechatUrl}' alt='Capillary Image'>`);
900
+ this.props.actions.clearContentImageStore();
901
+ this.setState({loading: false});
902
+ }
903
+ returnContentMenu = () => {
904
+ let actionButton = '';
905
+ const createPushMenu = (
906
+ <Menu onClick={this.menuOnClickEvent}>
907
+ {/* <MenuItem key="old_richmedia_content">
908
+ Add existing Richmedia content
909
+ </MenuItem> */}
910
+ <MenuItem key="new_richmedia_content">
911
+ <FormattedMessage {...messages.addNewRichmedia} />
912
+ </MenuItem>
913
+ </Menu>
914
+ );
915
+ actionButton = (<Dropdown overlay={createPushMenu} trigger={['click']}>
916
+ <CapButton style={{width: '244', height: '53', marginTop: '16'}} type="secondary">
917
+ <div style={{display: 'inline-flex'}}>
918
+ <p>
919
+ <i style={{ color: '#2e89df'}} className="material-icons">+</i>
920
+ </p>
921
+ </div>
922
+ </CapButton>
923
+ </Dropdown>);
924
+ return actionButton;
925
+ }
926
+ focusOutFromCkEditor = () => {
927
+ this.setState({focusOut: true});
928
+ }
929
+ focusInFromCkeditor = () => {
930
+ this.setState({focusOut: false});
931
+ }
932
+ returnCurrentSchema = () => {
933
+ let schema = _.cloneDeep(this.state.richmediaSchema);
934
+ if (this.state.isIframe) {
935
+ const disabledFormSchema = _.cloneDeep(this.state.richmediaSchema);
936
+ disabledFormSchema.standalone.sections[0].childSections[0].inputFields[0].cols[1].disabled = true;
937
+ disabledFormSchema.standalone.sections[0].childSections[0].inputFields[1].cols[1].disabled = true;
938
+ disabledFormSchema.standalone.sections[0].childSections[0].inputFields[2].cols[1].disabled = true;
939
+ disabledFormSchema.standalone.sections[0].childSections[0].inputFields[3].cols[1].disabled = true;
940
+ disabledFormSchema.standalone.sections[0].childSections[0].inputFields[4].cols[0].disabled = true;
941
+ disabledFormSchema.standalone.sections[0].childSections[0].inputFields[5].cols[1].disabled = true;
942
+ disabledFormSchema.standalone.sections[0].childSections[2].inputFields[0].cols[1].disabled = true;
943
+ disabledFormSchema.standalone.sections[0].childSections[1].childSections[1].childSections[0].inputFields[0].cols[1].disabled = true;
944
+ if (this.state.editorInstanse) {
945
+ this.state.editorInstanse.setReadOnly(true);
946
+ }
947
+ schema = this.injectEvents(disabledFormSchema);
948
+ return schema;
949
+ }
950
+ if (this.state.editorInstanse && this.state.focusOut) {
951
+ schema.standalone.sections[0].childSections[1].childSections[1].childSections[0].inputFields[0].cols[1].disabled = true;
952
+ } else if (this.state.editorInstanse && !this.state.focusOut) {
953
+ schema.standalone.sections[0].childSections[1].childSections[1].childSections[0].inputFields[0].cols[1].disabled = false;
954
+ }
955
+ schema = this.injectEvents(schema);
956
+ return schema;
957
+ }
958
+ returnCurrentFormData = () => {
959
+ const formData = this.state.templateData && !_.isEmpty(this.state.templateData[this.state.currentContentId]) && this.state.templateData[this.state.currentContentId].formData ? _.cloneDeep(this.state.templateData[this.state.currentContentId].formData) : {};
960
+ return formData;
961
+ }
962
+ render() {
963
+ const cardLayout = this.returnCardLayout();
964
+ const contentMenu = this.returnContentMenu();
965
+ const schema = this.returnCurrentSchema();
966
+ const formData = this.returnCurrentFormData();
967
+ this.updateImageData();
968
+ if (this.props.ContentImageData && this.props.ContentImageData.metaInfo && this.props.ContentImageData.metaInfo.wechatUrl) {
969
+ this.updateContentData();
970
+ }
971
+ return (
972
+ <div className="richmedia-container">
973
+ <CapSpinner spinning={this.state.loading}>
974
+ {this.state.showPreview && <WechatRichmediaTemplatePreview
975
+ show={this.state.showPreview}
976
+ closeSlideBox={this.closeSlideBox}
977
+ header={this.state.templateName}
978
+ width={50}
979
+ showSlidebox
980
+ const type={this.props.location && this.props.location.query.type ? this.props.location.query.type : ''}
981
+ content={this.prepareMediaList()}
982
+ />}
983
+ <div>
984
+ <Helmet
985
+ title="Wechat Richmedia"
986
+ />
987
+ <div className="wechat-container">
988
+ {!this.state.isIframe && <Header templateName={this.state.templateName} templateNameHandler={this.templateNameHandler} previewHandler={this.previewHandler} cancelHandler={this.cancelHandler} saveHandler={this.saveHandler} />}
989
+ <CapRow className="wechat-form-container">
990
+ <CapColumn span={6}>
991
+ {cardLayout}
992
+ {!this.state.isIframe && contentMenu}
993
+ </CapColumn>
994
+ <CapColumn span={18}>
995
+ <FormBuilder
996
+ key={this.state.currentContentId}
997
+ schema={schema}
998
+ onChange={this.onFormDataChange}
999
+ parent={this}
1000
+ formData={formData}
1001
+ onFormValidityChange={this.setFormValidity}
1002
+ location={this.props.location}
1003
+ usingTabContainer={false}
1004
+ router={this.props.router}
1005
+ modal={this.state.modalContent}
1006
+ showModal={this.state.showModal}
1007
+ handleCancelModal={this.handleCancelModal}
1008
+ iframeParent={parent}
1009
+ handleDelete={this.handleDelete}
1010
+ />
1011
+ </CapColumn>
1012
+ </CapRow>
1013
+ </div>
1014
+ </div>
1015
+ </CapSpinner>
1016
+ </div>
1017
+ );
1018
+ }
1019
+ }
1020
+
1021
+ Create.propTypes = {
1022
+ location: PropTypes.object,
1023
+ router: PropTypes.object,
1024
+ mode: PropTypes.string,
1025
+ templateData: PropTypes.object,
1026
+ totalContentBlocks: PropTypes.integer,
1027
+ templateName: PropTypes.string,
1028
+ templateId: PropTypes.string,
1029
+ mediaId: PropTypes.string,
1030
+ Templates: PropTypes.object,
1031
+ ImageData: PropTypes.object,
1032
+ actions: PropTypes.object,
1033
+ globalActions: PropTypes.object,
1034
+ Create: PropTypes.object,
1035
+ intl: intlShape.isRequired,
1036
+ ContentImageData: PropTypes.object,
1037
+ };
1038
+
1039
+ const mapStateToProps = createStructuredSelector({
1040
+ Create: makeSelectCreate(),
1041
+ Templates: makeSelectTemplates(),
1042
+ ImageData: getAssetDetails(),
1043
+ ContentImageData: getContentAssetDetails(),
1044
+ });
1045
+
1046
+ function mapDispatchToProps(dispatch) {
1047
+ return {
1048
+ actions: bindActionCreators(actions, dispatch),
1049
+ globalActions: bindActionCreators(globalActions, dispatch),
1050
+ };
1051
+ }
1052
+
1053
+ export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(Create));