@capillarytech/creatives-library 2.0.69 → 2.0.71

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 (391) hide show
  1. package/app.js +1 -1
  2. package/components/Ckeditor/index.js +2 -1
  3. package/components/FormBuilder/index.js +25 -10
  4. package/components/Header/index.js +3 -1
  5. package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +38 -3
  6. package/components/TemplatePreview/index.js +45 -51
  7. package/components/TemplatePreview/messages.js +1 -1
  8. package/containers/Cap/actions.js +0 -5
  9. package/containers/Cap/reducer.js +1 -1
  10. package/containers/Cap/selectors.js +0 -13
  11. package/containers/Ebill/index.js +1 -2
  12. package/containers/Email/_email.scss +1 -0
  13. package/containers/Email/actions.js +3 -8
  14. package/containers/Email/constants.js +0 -1
  15. package/containers/Email/index.js +947 -322
  16. package/containers/Email/reducer.js +0 -3
  17. package/containers/Email/sagas.js +6 -3
  18. package/containers/Email/selectors.js +1 -4
  19. package/containers/Line/Create/index.js +1 -2
  20. package/containers/Line/Edit/_lineEdit.scss +4 -0
  21. package/containers/Line/Edit/index.js +1 -3
  22. package/containers/MobilePush/Create/_mobilePushCreate.scss +3 -12
  23. package/containers/MobilePush/Create/actions.js +0 -6
  24. package/containers/MobilePush/Create/constants.js +0 -1
  25. package/containers/MobilePush/Create/index.js +1133 -628
  26. package/containers/MobilePush/Create/messages.js +1 -5
  27. package/containers/MobilePush/Create/reducer.js +0 -2
  28. package/containers/MobilePush/Create/selectors.js +3 -3
  29. package/containers/MobilePush/Edit/_mobilePushCreate.scss +3 -9
  30. package/containers/MobilePush/Edit/index.js +1127 -393
  31. package/containers/MobilePush/Edit/messages.js +0 -4
  32. package/containers/MobilePush/Edit/reducer.js +1 -2
  33. package/containers/MobilePush/Edit/selectors.js +3 -6
  34. package/containers/Sms/Create/_smsCreate.scss +2 -1
  35. package/containers/Sms/Create/actions.js +4 -4
  36. package/containers/Sms/Create/index.js +570 -102
  37. package/containers/Sms/Create/sagas.js +2 -1
  38. package/containers/Sms/Edit/actions.js +5 -10
  39. package/containers/Sms/Edit/constants.js +0 -1
  40. package/containers/Sms/Edit/index.js +548 -103
  41. package/containers/Sms/Edit/reducer.js +0 -2
  42. package/containers/Sms/Edit/sagas.js +3 -1
  43. package/containers/TagList/index.js +3 -3
  44. package/containers/Templates/actions.js +1 -3
  45. package/containers/Templates/index.js +299 -268
  46. package/containers/Templates/messages.js +90 -122
  47. package/containers/Templates/reducer.js +3 -3
  48. package/containers/Templates/sagas.js +1 -5
  49. package/containers/Templates/selectors.js +1 -41
  50. package/containers/WeChat/MapTemplates/index.js +3 -4
  51. package/containers/WeChat/RichmediaTemplates/Create/index.js +18 -4
  52. package/containers/WeChat/RichmediaTemplates/Create/messages.js +4 -0
  53. package/containers/WeChat/RichmediaTemplates/Edit/index.js +3 -1
  54. package/containers/WeChat/RichmediaTemplates/View/index.js +3 -1
  55. package/index.js +31 -31
  56. package/initialState.js +6 -0
  57. package/package.json +3 -3
  58. package/routes.js +24 -19
  59. package/services/api.js +6 -2
  60. package/services/getSchema.js +18 -0
  61. package/v2Containers/App/actions.js +7 -0
  62. package/v2Containers/App/constants.js +3 -0
  63. package/v2Containers/App/reducer.js +19 -0
  64. package/v2Containers/App/sagas.js +26 -0
  65. package/v2Containers/App/selectors.js +25 -0
  66. package/v2Containers/App/tests/actions.test.js +18 -0
  67. package/v2Containers/App/tests/reducer.test.js +9 -0
  68. package/v2Containers/App/tests/sagas.test.js +15 -0
  69. package/v2Containers/App/tests/selectors.test.js +10 -0
  70. package/v2Containers/Assets/Gallery/_gallery.scss +0 -0
  71. package/v2Containers/Assets/Gallery/actions.js +37 -0
  72. package/v2Containers/Assets/Gallery/constants.js +23 -0
  73. package/v2Containers/Assets/Gallery/index.js +479 -0
  74. package/v2Containers/Assets/Gallery/messages.js +97 -0
  75. package/v2Containers/Assets/Gallery/reducer.js +81 -0
  76. package/v2Containers/Assets/Gallery/sagas.js +84 -0
  77. package/v2Containers/Assets/Gallery/selectors.js +25 -0
  78. package/v2Containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +7 -0
  79. package/v2Containers/Assets/Gallery/tests/actions.test.js +26 -0
  80. package/v2Containers/Assets/Gallery/tests/index.test.js +10 -0
  81. package/v2Containers/Assets/Gallery/tests/reducer.test.js +95 -0
  82. package/v2Containers/Assets/Gallery/tests/sagas.test.js +15 -0
  83. package/v2Containers/Assets/Gallery/tests/selectors.test.js +10 -0
  84. package/v2Containers/CallTask/_callTask.scss +5 -0
  85. package/v2Containers/CallTask/actions.js +15 -0
  86. package/v2Containers/CallTask/constants.js +7 -0
  87. package/v2Containers/CallTask/index.js +141 -0
  88. package/v2Containers/CallTask/messages.js +21 -0
  89. package/v2Containers/CallTask/reducer.js +23 -0
  90. package/v2Containers/CallTask/sagas.js +11 -0
  91. package/v2Containers/CallTask/selectors.js +25 -0
  92. package/v2Containers/CallTask/tests/actions.test.js +18 -0
  93. package/v2Containers/CallTask/tests/index.test.js +10 -0
  94. package/v2Containers/CallTask/tests/reducer.test.js +9 -0
  95. package/v2Containers/CallTask/tests/sagas.test.js +15 -0
  96. package/v2Containers/CallTask/tests/selectors.test.js +10 -0
  97. package/v2Containers/Cap/actions.js +64 -0
  98. package/v2Containers/Cap/constants.js +24 -0
  99. package/v2Containers/Cap/index.js +349 -0
  100. package/v2Containers/Cap/messsages.js +63 -0
  101. package/v2Containers/Cap/reducer.js +111 -0
  102. package/v2Containers/Cap/sagas.js +143 -0
  103. package/v2Containers/Cap/selectors.js +85 -0
  104. package/v2Containers/Cap/tests/index.test.js +16 -0
  105. package/v2Containers/Cap/tests/selectors.test.js +28 -0
  106. package/v2Containers/ChannelTemplates/actions.js +20 -0
  107. package/v2Containers/ChannelTemplates/constants.js +8 -0
  108. package/v2Containers/ChannelTemplates/index.js +48 -0
  109. package/v2Containers/ChannelTemplates/messages.js +13 -0
  110. package/v2Containers/ChannelTemplates/reducer.js +34 -0
  111. package/v2Containers/ChannelTemplates/sagas.js +32 -0
  112. package/v2Containers/ChannelTemplates/selectors.js +25 -0
  113. package/v2Containers/ChannelTemplates/tests/actions.test.js +18 -0
  114. package/v2Containers/ChannelTemplates/tests/index.test.js +10 -0
  115. package/v2Containers/ChannelTemplates/tests/reducer.test.js +9 -0
  116. package/v2Containers/ChannelTemplates/tests/sagas.test.js +15 -0
  117. package/v2Containers/ChannelTemplates/tests/selectors.test.js +10 -0
  118. package/v2Containers/CreativesContainer/SlideBoxContent.js +257 -0
  119. package/v2Containers/CreativesContainer/SlideBoxFooter.js +45 -0
  120. package/v2Containers/CreativesContainer/SlideBoxHeader.js +70 -0
  121. package/v2Containers/CreativesContainer/actions.js +27 -0
  122. package/v2Containers/CreativesContainer/constants.js +16 -0
  123. package/v2Containers/CreativesContainer/index.js +483 -0
  124. package/v2Containers/CreativesContainer/index.scss +27 -0
  125. package/v2Containers/CreativesContainer/messages.js +293 -0
  126. package/v2Containers/CreativesContainer/reducer.js +29 -0
  127. package/v2Containers/CreativesContainer/sagas.js +11 -0
  128. package/v2Containers/CreativesContainer/selectors.js +30 -0
  129. package/v2Containers/CreativesContainer/tests/actions.test.js +18 -0
  130. package/v2Containers/CreativesContainer/tests/index.test.js +10 -0
  131. package/v2Containers/CreativesContainer/tests/reducer.test.js +9 -0
  132. package/v2Containers/CreativesContainer/tests/sagas.test.js +15 -0
  133. package/v2Containers/CreativesContainer/tests/selectors.test.js +10 -0
  134. package/v2Containers/Dashboard/actions.js +15 -0
  135. package/v2Containers/Dashboard/constants.js +7 -0
  136. package/v2Containers/Dashboard/index.js +54 -0
  137. package/v2Containers/Dashboard/messages.js +13 -0
  138. package/v2Containers/Dashboard/reducer.js +21 -0
  139. package/v2Containers/Dashboard/sagas.js +11 -0
  140. package/v2Containers/Dashboard/selectors.js +25 -0
  141. package/v2Containers/Dashboard/tests/actions.test.js +18 -0
  142. package/v2Containers/Dashboard/tests/index.test.js +10 -0
  143. package/v2Containers/Dashboard/tests/reducer.test.js +9 -0
  144. package/v2Containers/Dashboard/tests/sagas.test.js +15 -0
  145. package/v2Containers/Dashboard/tests/selectors.test.js +10 -0
  146. package/v2Containers/Ebill/_ebill.scss +5 -0
  147. package/v2Containers/Ebill/actions.js +43 -0
  148. package/v2Containers/Ebill/constants.js +20 -0
  149. package/v2Containers/Ebill/index.js +1261 -0
  150. package/v2Containers/Ebill/messages.js +73 -0
  151. package/v2Containers/Ebill/reducer.js +72 -0
  152. package/v2Containers/Ebill/sagas.js +65 -0
  153. package/v2Containers/Ebill/selectors.js +25 -0
  154. package/v2Containers/Ebill/tests/actions.test.js +18 -0
  155. package/v2Containers/Ebill/tests/index.test.js +10 -0
  156. package/v2Containers/Ebill/tests/reducer.test.js +9 -0
  157. package/v2Containers/Ebill/tests/sagas.test.js +15 -0
  158. package/v2Containers/Ebill/tests/selectors.test.js +10 -0
  159. package/v2Containers/Email/_email.scss +140 -0
  160. package/v2Containers/Email/actions.js +86 -0
  161. package/v2Containers/Email/constants.js +37 -0
  162. package/v2Containers/Email/index.js +2703 -0
  163. package/v2Containers/Email/initialSchema.js +540 -0
  164. package/v2Containers/Email/messages.js +237 -0
  165. package/v2Containers/Email/reducer.js +147 -0
  166. package/v2Containers/Email/sagas.js +133 -0
  167. package/v2Containers/Email/selectors.js +34 -0
  168. package/v2Containers/Email/tests/actions.test.js +18 -0
  169. package/v2Containers/Email/tests/index.test.js +10 -0
  170. package/v2Containers/Email/tests/reducer.test.js +9 -0
  171. package/v2Containers/Email/tests/sagas.test.js +15 -0
  172. package/v2Containers/Email/tests/selectors.test.js +10 -0
  173. package/v2Containers/EmailWrapper/actions.js +15 -0
  174. package/v2Containers/EmailWrapper/constants.js +7 -0
  175. package/v2Containers/EmailWrapper/index.js +258 -0
  176. package/v2Containers/EmailWrapper/messages.js +57 -0
  177. package/v2Containers/EmailWrapper/reducer.js +23 -0
  178. package/v2Containers/EmailWrapper/sagas.js +11 -0
  179. package/v2Containers/EmailWrapper/selectors.js +25 -0
  180. package/v2Containers/EmailWrapper/tests/actions.test.js +18 -0
  181. package/v2Containers/EmailWrapper/tests/index.test.js +10 -0
  182. package/v2Containers/EmailWrapper/tests/reducer.test.js +9 -0
  183. package/v2Containers/EmailWrapper/tests/sagas.test.js +15 -0
  184. package/v2Containers/EmailWrapper/tests/selectors.test.js +10 -0
  185. package/v2Containers/LanguageProvider/actions.js +17 -0
  186. package/v2Containers/LanguageProvider/constants.js +8 -0
  187. package/v2Containers/LanguageProvider/index.js +46 -0
  188. package/v2Containers/LanguageProvider/reducer.js +30 -0
  189. package/v2Containers/LanguageProvider/selectors.js +20 -0
  190. package/v2Containers/LanguageProvider/tests/actions.test.js +19 -0
  191. package/v2Containers/LanguageProvider/tests/index.test.js +49 -0
  192. package/v2Containers/LanguageProvider/tests/reducer.test.js +20 -0
  193. package/v2Containers/LanguageProvider/tests/selectors.test.js +15 -0
  194. package/v2Containers/Line/Create/_lineCreate.scss +43 -0
  195. package/v2Containers/Line/Create/actions.js +90 -0
  196. package/v2Containers/Line/Create/constants.js +39 -0
  197. package/v2Containers/Line/Create/index.js +822 -0
  198. package/v2Containers/Line/Create/messages.js +173 -0
  199. package/v2Containers/Line/Create/reducer.js +99 -0
  200. package/v2Containers/Line/Create/sagas.js +107 -0
  201. package/v2Containers/Line/Create/selectors.js +36 -0
  202. package/v2Containers/Line/Edit/_lineEdit.scss +21 -0
  203. package/v2Containers/Line/Edit/actions.js +79 -0
  204. package/v2Containers/Line/Edit/constants.js +27 -0
  205. package/v2Containers/Line/Edit/index.js +1050 -0
  206. package/v2Containers/Line/Edit/messages.js +157 -0
  207. package/v2Containers/Line/Edit/reducer.js +83 -0
  208. package/v2Containers/Line/Edit/sagas.js +81 -0
  209. package/v2Containers/Line/Edit/selectors.js +29 -0
  210. package/v2Containers/Line/Edit/tests/actions.test.js +18 -0
  211. package/v2Containers/Line/Edit/tests/index.test.js +10 -0
  212. package/v2Containers/Line/Edit/tests/reducer.test.js +9 -0
  213. package/v2Containers/Line/Edit/tests/sagas.test.js +15 -0
  214. package/v2Containers/Line/Edit/tests/selectors.test.js +10 -0
  215. package/v2Containers/Login/assets/images/capillary_logo.png +0 -0
  216. package/v2Containers/Login/components/LoginForm/index.js +59 -0
  217. package/v2Containers/Login/components/LoginForm/messages.js +21 -0
  218. package/v2Containers/Login/components/LoginForm/tests/index.test.js +10 -0
  219. package/v2Containers/Login/index.js +106 -0
  220. package/v2Containers/Login/messages.js +21 -0
  221. package/v2Containers/Login/selectors.js +25 -0
  222. package/v2Containers/Login/tests/index.test.js +10 -0
  223. package/v2Containers/Login/tests/sagas.test.js +15 -0
  224. package/v2Containers/Login/tests/selectors.test.js +10 -0
  225. package/v2Containers/MobilePush/Create/_mobilePushCreate.scss +41 -0
  226. package/v2Containers/MobilePush/Create/actions.js +52 -0
  227. package/v2Containers/MobilePush/Create/constants.js +24 -0
  228. package/v2Containers/MobilePush/Create/index.js +1759 -0
  229. package/v2Containers/MobilePush/Create/messages.js +237 -0
  230. package/v2Containers/MobilePush/Create/reducer.js +72 -0
  231. package/v2Containers/MobilePush/Create/sagas.js +60 -0
  232. package/v2Containers/MobilePush/Create/selectors.js +28 -0
  233. package/v2Containers/MobilePush/Create/tests/actions.test.js +18 -0
  234. package/v2Containers/MobilePush/Create/tests/index.test.js +10 -0
  235. package/v2Containers/MobilePush/Create/tests/reducer.test.js +9 -0
  236. package/v2Containers/MobilePush/Create/tests/sagas.test.js +15 -0
  237. package/v2Containers/MobilePush/Create/tests/selectors.test.js +10 -0
  238. package/v2Containers/MobilePush/Edit/_mobilePushCreate.scss +38 -0
  239. package/v2Containers/MobilePush/Edit/actions.js +91 -0
  240. package/v2Containers/MobilePush/Edit/constants.js +35 -0
  241. package/v2Containers/MobilePush/Edit/index.js +1846 -0
  242. package/v2Containers/MobilePush/Edit/messages.js +253 -0
  243. package/v2Containers/MobilePush/Edit/reducer.js +113 -0
  244. package/v2Containers/MobilePush/Edit/sagas.js +119 -0
  245. package/v2Containers/MobilePush/Edit/selectors.js +32 -0
  246. package/v2Containers/MobilePush/Edit/tests/actions.test.js +18 -0
  247. package/v2Containers/MobilePush/Edit/tests/index.test.js +10 -0
  248. package/v2Containers/MobilePush/Edit/tests/reducer.test.js +9 -0
  249. package/v2Containers/MobilePush/Edit/tests/sagas.test.js +15 -0
  250. package/v2Containers/MobilePush/Edit/tests/selectors.test.js +10 -0
  251. package/v2Containers/MobilePush/commonMethods.js +249 -0
  252. package/v2Containers/MobilePush/eventsMap.js +127 -0
  253. package/v2Containers/MobilePush/initialSchema.js +1739 -0
  254. package/v2Containers/MobilepushWrapper/_mobilepushWrapper.scss +18 -0
  255. package/v2Containers/MobilepushWrapper/index.js +136 -0
  256. package/v2Containers/MobilepushWrapper/messages.js +29 -0
  257. package/v2Containers/MobilepushWrapper/tests/index.test.js +10 -0
  258. package/v2Containers/NotFoundPage/index.js +25 -0
  259. package/v2Containers/NotFoundPage/messages.js +13 -0
  260. package/v2Containers/NotFoundPage/tests/index.test.js +17 -0
  261. package/v2Containers/Sms/Create/_smsCreate.scss +58 -0
  262. package/v2Containers/Sms/Create/actions.js +27 -0
  263. package/v2Containers/Sms/Create/constants.js +16 -0
  264. package/v2Containers/Sms/Create/index.js +1017 -0
  265. package/v2Containers/Sms/Create/messages.js +85 -0
  266. package/v2Containers/Sms/Create/reducer.js +41 -0
  267. package/v2Containers/Sms/Create/sagas.js +35 -0
  268. package/v2Containers/Sms/Create/selectors.js +28 -0
  269. package/v2Containers/Sms/Create/tests/actions.test.js +18 -0
  270. package/v2Containers/Sms/Create/tests/index.test.js +10 -0
  271. package/v2Containers/Sms/Create/tests/reducer.test.js +9 -0
  272. package/v2Containers/Sms/Create/tests/sagas.test.js +15 -0
  273. package/v2Containers/Sms/Create/tests/selectors.test.js +10 -0
  274. package/v2Containers/Sms/Edit/actions.js +45 -0
  275. package/v2Containers/Sms/Edit/constants.js +18 -0
  276. package/v2Containers/Sms/Edit/index.js +1018 -0
  277. package/v2Containers/Sms/Edit/messages.js +89 -0
  278. package/v2Containers/Sms/Edit/reducer.js +52 -0
  279. package/v2Containers/Sms/Edit/sagas.js +50 -0
  280. package/v2Containers/Sms/Edit/selectors.js +32 -0
  281. package/v2Containers/Sms/Edit/tests/actions.test.js +18 -0
  282. package/v2Containers/Sms/Edit/tests/index.test.js +10 -0
  283. package/v2Containers/Sms/Edit/tests/reducer.test.js +9 -0
  284. package/v2Containers/Sms/Edit/tests/sagas.test.js +15 -0
  285. package/v2Containers/Sms/Edit/tests/selectors.test.js +10 -0
  286. package/v2Containers/Sms/initialSchema.js +281 -0
  287. package/v2Containers/TagList/_tagList.scss +8 -0
  288. package/v2Containers/TagList/actions.js +15 -0
  289. package/v2Containers/TagList/constants.js +7 -0
  290. package/v2Containers/TagList/index.js +236 -0
  291. package/v2Containers/TagList/messages.js +13 -0
  292. package/v2Containers/TagList/reducer.js +23 -0
  293. package/v2Containers/TagList/sagas.js +11 -0
  294. package/v2Containers/TagList/selectors.js +25 -0
  295. package/v2Containers/TagList/tests/actions.test.js +18 -0
  296. package/v2Containers/TagList/tests/index.test.js +10 -0
  297. package/v2Containers/TagList/tests/reducer.test.js +9 -0
  298. package/v2Containers/TagList/tests/sagas.test.js +15 -0
  299. package/v2Containers/TagList/tests/selectors.test.js +10 -0
  300. package/v2Containers/Templates/_templates.scss +349 -0
  301. package/v2Containers/Templates/actions.js +110 -0
  302. package/v2Containers/Templates/constants.js +45 -0
  303. package/v2Containers/Templates/index.js +1682 -0
  304. package/v2Containers/Templates/messages.js +273 -0
  305. package/v2Containers/Templates/reducer.js +142 -0
  306. package/v2Containers/Templates/sagas.js +180 -0
  307. package/v2Containers/Templates/selectors.js +68 -0
  308. package/v2Containers/Templates/tests/actions.test.js +18 -0
  309. package/v2Containers/Templates/tests/index.test.js +10 -0
  310. package/v2Containers/Templates/tests/reducer.test.js +9 -0
  311. package/v2Containers/Templates/tests/sagas.test.js +15 -0
  312. package/v2Containers/Templates/tests/selectors.test.js +10 -0
  313. package/v2Containers/TemplatesV2/_templatesV2.scss +5 -0
  314. package/v2Containers/TemplatesV2/actions.js +16 -0
  315. package/v2Containers/TemplatesV2/constants.js +10 -0
  316. package/v2Containers/TemplatesV2/index.js +217 -0
  317. package/v2Containers/TemplatesV2/messages.js +29 -0
  318. package/v2Containers/TemplatesV2/selectors.js +25 -0
  319. package/v2Containers/TemplatesV2/tests/actions.test.js +18 -0
  320. package/v2Containers/TemplatesV2/tests/index.test.js +10 -0
  321. package/v2Containers/TemplatesV2/tests/reducer.test.js +9 -0
  322. package/v2Containers/TemplatesV2/tests/sagas.test.js +15 -0
  323. package/v2Containers/TemplatesV2/tests/selectors.test.js +10 -0
  324. package/v2Containers/TestPage/constants.js +7 -0
  325. package/v2Containers/TestPage/index.js +31 -0
  326. package/v2Containers/TestPage/messages.js +13 -0
  327. package/v2Containers/TestPage/reducer.js +21 -0
  328. package/v2Containers/TestPage/sagas.js +11 -0
  329. package/v2Containers/Testv2/actions.js +15 -0
  330. package/v2Containers/Testv2/constants.js +7 -0
  331. package/v2Containers/Testv2/index.js +47 -0
  332. package/v2Containers/Testv2/messages.js +13 -0
  333. package/v2Containers/Testv2/reducer.js +23 -0
  334. package/v2Containers/Testv2/sagas.js +11 -0
  335. package/v2Containers/Testv2/selectors.js +25 -0
  336. package/v2Containers/Testv2/tests/actions.test.js +18 -0
  337. package/v2Containers/Testv2/tests/index.test.js +10 -0
  338. package/v2Containers/Testv2/tests/reducer.test.js +9 -0
  339. package/v2Containers/Testv2/tests/sagas.test.js +15 -0
  340. package/v2Containers/Testv2/tests/selectors.test.js +10 -0
  341. package/v2Containers/WeChat/MapTemplates/_mapTemplates.scss +8 -0
  342. package/v2Containers/WeChat/MapTemplates/actions.js +52 -0
  343. package/v2Containers/WeChat/MapTemplates/constants.js +28 -0
  344. package/v2Containers/WeChat/MapTemplates/index.js +1385 -0
  345. package/v2Containers/WeChat/MapTemplates/messages.js +73 -0
  346. package/v2Containers/WeChat/MapTemplates/reducer.js +74 -0
  347. package/v2Containers/WeChat/MapTemplates/sagas.js +86 -0
  348. package/v2Containers/WeChat/MapTemplates/selectors.js +25 -0
  349. package/v2Containers/WeChat/MapTemplates/tests/actions.test.js +18 -0
  350. package/v2Containers/WeChat/MapTemplates/tests/index.test.js +10 -0
  351. package/v2Containers/WeChat/MapTemplates/tests/reducer.test.js +9 -0
  352. package/v2Containers/WeChat/MapTemplates/tests/sagas.test.js +15 -0
  353. package/v2Containers/WeChat/MapTemplates/tests/selectors.test.js +10 -0
  354. package/v2Containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +57 -0
  355. package/v2Containers/WeChat/RichmediaTemplates/Create/actions.js +36 -0
  356. package/v2Containers/WeChat/RichmediaTemplates/Create/constants.js +15 -0
  357. package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +1053 -0
  358. package/v2Containers/WeChat/RichmediaTemplates/Create/messages.js +141 -0
  359. package/v2Containers/WeChat/RichmediaTemplates/Create/reducer.js +60 -0
  360. package/v2Containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +497 -0
  361. package/v2Containers/WeChat/RichmediaTemplates/Create/sagas.js +48 -0
  362. package/v2Containers/WeChat/RichmediaTemplates/Create/selectors.js +37 -0
  363. package/v2Containers/WeChat/RichmediaTemplates/Create/tests/actions.test.js +18 -0
  364. package/v2Containers/WeChat/RichmediaTemplates/Create/tests/index.test.js +10 -0
  365. package/v2Containers/WeChat/RichmediaTemplates/Create/tests/reducer.test.js +9 -0
  366. package/v2Containers/WeChat/RichmediaTemplates/Create/tests/sagas.test.js +15 -0
  367. package/v2Containers/WeChat/RichmediaTemplates/Create/tests/selectors.test.js +10 -0
  368. package/v2Containers/WeChat/RichmediaTemplates/Edit/actions.js +20 -0
  369. package/v2Containers/WeChat/RichmediaTemplates/Edit/constants.js +10 -0
  370. package/v2Containers/WeChat/RichmediaTemplates/Edit/index.js +116 -0
  371. package/v2Containers/WeChat/RichmediaTemplates/Edit/messages.js +13 -0
  372. package/v2Containers/WeChat/RichmediaTemplates/Edit/reducer.js +28 -0
  373. package/v2Containers/WeChat/RichmediaTemplates/Edit/sagas.js +32 -0
  374. package/v2Containers/WeChat/RichmediaTemplates/Edit/selectors.js +30 -0
  375. package/v2Containers/WeChat/RichmediaTemplates/Edit/tests/actions.test.js +18 -0
  376. package/v2Containers/WeChat/RichmediaTemplates/Edit/tests/index.test.js +10 -0
  377. package/v2Containers/WeChat/RichmediaTemplates/Edit/tests/reducer.test.js +9 -0
  378. package/v2Containers/WeChat/RichmediaTemplates/Edit/tests/sagas.test.js +15 -0
  379. package/v2Containers/WeChat/RichmediaTemplates/Edit/tests/selectors.test.js +10 -0
  380. package/v2Containers/WeChat/RichmediaTemplates/View/actions.js +15 -0
  381. package/v2Containers/WeChat/RichmediaTemplates/View/constants.js +7 -0
  382. package/v2Containers/WeChat/RichmediaTemplates/View/index.js +47 -0
  383. package/v2Containers/WeChat/RichmediaTemplates/View/messages.js +13 -0
  384. package/v2Containers/WeChat/RichmediaTemplates/View/reducer.js +23 -0
  385. package/v2Containers/WeChat/RichmediaTemplates/View/sagas.js +11 -0
  386. package/v2Containers/WeChat/RichmediaTemplates/View/selectors.js +25 -0
  387. package/v2Containers/WeChat/RichmediaTemplates/View/tests/actions.test.js +18 -0
  388. package/v2Containers/WeChat/RichmediaTemplates/View/tests/index.test.js +10 -0
  389. package/v2Containers/WeChat/RichmediaTemplates/View/tests/reducer.test.js +9 -0
  390. package/v2Containers/WeChat/RichmediaTemplates/View/tests/sagas.test.js +15 -0
  391. package/v2Containers/WeChat/RichmediaTemplates/View/tests/selectors.test.js +10 -0
@@ -9,19 +9,20 @@ import PropTypes from 'prop-types';
9
9
  import React from 'react';
10
10
  import { connect } from 'react-redux';
11
11
  import { bindActionCreators } from 'redux';
12
- import { Row, Col, Popover, Modal, Select } from 'antd';
12
+ import Helmet from 'react-helmet';
13
+ import { Row, Col, Spin, Breadcrumb, Popover, Modal, Select } from 'antd';
13
14
  import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
14
- import { CapButton, CapInput, CapSpin } from '@capillarytech/cap-ui-library';
15
+ import { CapButton, CapInput } from '@capillarytech/cap-ui-library';
15
16
  import { createStructuredSelector } from 'reselect';
16
17
  import _ from 'lodash';
17
18
  import moment from "moment";
18
19
  import FormBuilder from '../../components/FormBuilder';
19
- import { makeSelectMetaEntities, selectCurrentOrgDetails, isLoadingMetaEntities, makeSelectAuthenticated, setInjectedTags } from '../Cap/selectors';
20
+ import { makeSelectMetaEntities, makeSelectAuthenticated, setInjectedTags } from '../Cap/selectors';
20
21
  import * as actions from './actions';
21
22
  import * as templatesActions from '../Templates/actions';
22
23
  import * as globalActions from '../../containers/Cap/actions';
23
24
  import { UserIsAuthenticated } from '../../utils/authWrapper';
24
- import {makeSelectEmail} from './selectors';
25
+ import makeSelectEmail from './selectors';
25
26
  import { makeSelectTemplates } from '../Templates/selectors';
26
27
  import messages from './messages';
27
28
  // import PageHeader from '../../components/PageHeader';
@@ -31,13 +32,12 @@ import EmailPreview from '../../components/EmailPreview';
31
32
  import ImagePreview from '../../components/ImagePreview';
32
33
  import CardGrid from '../../components/CardGrid';
33
34
  import Pagination from '../../components/Pagination';
34
- import * as creativesContainerActions from '../CreativesContainer/actions';
35
+ const BreadcrumbItem = Breadcrumb.Item;
35
36
 
36
37
  export class Email extends React.Component { // eslint-disable-line react/prefer-stateless-function
37
38
  constructor(props) {
38
39
  super(props);
39
40
  this.state = {
40
- loadingStatus: 0,
41
41
  formData: {},
42
42
  tabCount: 1,
43
43
  currentTab: 1,
@@ -48,6 +48,543 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
48
48
  },
49
49
  isEdit: false,
50
50
  schema: {},
51
+ // schema: {
52
+ // standalone: {
53
+ // sections: [
54
+ // {
55
+ // type: "col-label",
56
+ // inputFields: [
57
+ // {
58
+ // id: "template-subject",
59
+ // placeholder: "Enter Email Subject",
60
+ // type: "input",
61
+ // metaType: "text",
62
+ // datatype: "string",
63
+ // required: true,
64
+ // label: "Subject",
65
+ // style: {
66
+ // fontSize: "20px",
67
+ // fontFamily: "proxima-nova,sans-serif",
68
+ // fontStyle: "normal",
69
+ // fontWeight: 600,
70
+ // display: (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs")) ? "" : "none",
71
+ // },
72
+ // labelStyle: {
73
+ // fontSize: "18px",
74
+ // fontFamily: "proxima-nova,sans-serif",
75
+ // fontStyle: "normal",
76
+ // fontWeight: 600,
77
+ // display: (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs")) ? "" : "none",
78
+ // background: "white",
79
+ // },
80
+ // styling: "semantic",
81
+ // order: 1,
82
+ // width: 9,
83
+ // customComponent: false,
84
+ // standalone: true,
85
+ // onlyDisplay: false,
86
+ // errorMessage: "Email Subject cannot be empty.",
87
+ // // supportedEvents: [
88
+ // // "onChange",
89
+ // // ],
90
+ // },
91
+ // ],
92
+ // },
93
+ // {
94
+ // type: "multicols",
95
+ // inputFields: [
96
+ // {
97
+ // cols: [
98
+ // {
99
+ // id: "template-name",
100
+ // placeholder: "Enter template name",
101
+ // type: "input",
102
+ // metaType: "text",
103
+ // datatype: "string",
104
+ // required: true,
105
+ // style: {
106
+ // fontSize: "20px",
107
+ // fontFamily: "proxima-nova,sans-serif",
108
+ // fontStyle: "normal",
109
+ // fontWeight: 600,
110
+ // },
111
+ // styling: "semantic",
112
+ // order: 1,
113
+ // width: 9,
114
+ // customComponent: false,
115
+ // standalone: true,
116
+ // onlyDisplay: false,
117
+ // errorMessage: "Template name cannot be empty.",
118
+ // supportedEvents: [
119
+ // "onChange",
120
+ // ],
121
+ // },
122
+ // {
123
+ // id: "template-version",
124
+ // type: "select", //Resembles component to be used
125
+ // options: [],
126
+ // metaType: "text",
127
+ // datatype: "string",
128
+ // required: true,
129
+ // fluid: true,
130
+ // style: {
131
+ // fontSize: '14px',
132
+ // fontFamily: 'open-sans',
133
+ // fontStyle: 'normal',
134
+ // marginBottom: '16px',
135
+ // },
136
+ // styling: "semantic",
137
+ // order: 1,
138
+ // width: 5,
139
+ // customComponent: false,
140
+ // standalone: true,
141
+ // supportedEvents: [
142
+ // 'onSelect',
143
+ // 'addVersion',
144
+ // ],
145
+ // },
146
+ // {
147
+ // id: "preview-button",
148
+ // width: 3,
149
+ // offset: 3,
150
+ // metaType: "submit-button",
151
+ // colStyle: {
152
+ // textAlign: "right",
153
+ // paddingRight: "12px",
154
+ // },
155
+ // type: "button",
156
+ // buttonType: "cancel",
157
+ // value: "Preview",
158
+ // customComponent: false,
159
+ // standalone: true,
160
+ // styling: "semantic",
161
+ // order: 3,
162
+ // fluid: false,
163
+ // submitAction: "previewTemplate",
164
+ // onlyDisplay: true,
165
+ // supportedEvents: [
166
+ // "previewTemplate",
167
+ // ],
168
+ // },
169
+ // {
170
+ // id: "cancel-button",
171
+ // width: 2,
172
+ // metaType: "submit-button",
173
+ // colStyle: {
174
+ // textAlign: "right",
175
+ // width: "9%",
176
+ // },
177
+ // type: "button",
178
+ // buttonType: "cancel",
179
+ // value: "Cancel",
180
+ // customComponent: false,
181
+ // standalone: true,
182
+ // styling: "semantic",
183
+ // order: 3,
184
+ // fluid: false,
185
+ // onlyDisplay: true,
186
+ // submitAction: "cancelTemplate",
187
+ // supportedEvents: [
188
+ // "cancelTemplate",
189
+ // ],
190
+ // },
191
+ // {
192
+ // id: "save-button",
193
+ // width: 2,
194
+ // metaType: "submit-button",
195
+ // colStyle: {
196
+ // textAlign: "right",
197
+ // width: "7%",
198
+ // },
199
+ // type: "button",
200
+ // buttonType: "primary",
201
+ // value: "Save",
202
+ // customComponent: false,
203
+ // styling: "semantic",
204
+ // order: 3,
205
+ // fluid: false,
206
+ // standalone: true,
207
+ // onlyDisplay: true,
208
+ // submitAction: "saveFormData",
209
+ // supportedEvents: [
210
+ // "saveFormData",
211
+ // ],
212
+ // },
213
+ // ],
214
+ // },
215
+ // ],
216
+ // actionFields: [],
217
+ // },
218
+ // ],
219
+ // },
220
+ // containers: [
221
+ // {
222
+ // panes: [
223
+ // {
224
+ // sections: [
225
+ // {
226
+ // type: "multicols",
227
+ // width: 24,
228
+ // rowStyle: {
229
+ // // height: "calc(100vh - 142px)",
230
+ // },
231
+ // actionFields: [],
232
+ // inputFields: [
233
+ // {
234
+ // cols: [
235
+ // {
236
+ // id: "template-content",
237
+ // type: "ckeditor",
238
+ // metaType: "text",
239
+ // datatype: "string",
240
+ // required: true,
241
+ // onlyDisplay: false,
242
+ // standalone: false,
243
+ // order: 2,
244
+ // width: 24,
245
+ // events: {
246
+ // blur: this.onBlur,
247
+ // afterPaste: this.afterPaste,
248
+ // // change: this.onChange,
249
+ // },
250
+ // colStyle: {
251
+ // display: (!_.isEmpty(this.props.Templates.edmTemplate) && this.props.Templates.edmTemplate.versions.base.drag_drop_id) ? 'none' : '',
252
+ // },
253
+ // customComponent: true,
254
+ // getEditorInstanse: this.getEditorInstanse,
255
+ // supportedEvents: [
256
+ // "onContentChange",
257
+ // ],
258
+ // },
259
+ // {
260
+ // id: "edmeditor",
261
+ // type: "edmeditor",
262
+ // metaType: "text",
263
+ // datatype: "string",
264
+ // required: true,
265
+ // onlyDisplay: true,
266
+ // standalone: false,
267
+ // width: 24,
268
+ // order: 2,
269
+ // customComponent: true,
270
+ // // getEditorInstanse: this.getEditorInstanse,
271
+ // colStyle: {
272
+ // display: (!_.isEmpty(this.props.Templates.edmTemplate) && this.props.Templates.edmTemplate.versions.base.drag_drop_id) ? '' : 'none',
273
+ // },
274
+ // supportedEvents: [
275
+ // // "onContentChange",
276
+ // ],
277
+ // },
278
+ // ],
279
+ // },
280
+ // ],
281
+ // },
282
+ // ],
283
+ // },
284
+ // ],
285
+ // type: "tabs",
286
+ // defaultPanes: 1,
287
+ // additionalPanes: 0,
288
+ // id: "pane",
289
+ // tabBarExtraContent: {
290
+ // sections: [
291
+ // {
292
+ // type: "multicols",
293
+ // actionFields: [],
294
+ // inputFields: [
295
+ // {
296
+ // cols: [
297
+ // {
298
+ // id: "add-language-button",
299
+ // metaType: "submit-button",
300
+ // type: "customPopover",
301
+ // customComponent: true,
302
+ // onlyDisplay: true,
303
+ // styling: "semantic",
304
+ // order: 3,
305
+ // width: 3,
306
+ // colStyle: {
307
+ // color: `rgb(78, 146, 229)`,
308
+ // fontSize: '14px',
309
+ // fontFamily: 'open-sans',
310
+ // lineHeight: '24px',
311
+ // textAlign: 'center',
312
+ // cursor: 'pointer',
313
+ // display: (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "timeline" )) ? 'none' : '',
314
+ // },
315
+ // popOverList: this.props.Global.currentOrgDetails && this.props.Global.currentOrgDetails.basic_details.supported_languages ? this.props.Global.currentOrgDetails.basic_details.supported_languages : [],
316
+ // baseLanguage: this.props.Global.currentOrgDetails && this.props.Global.currentOrgDetails.basic_details.base_language ? this.props.Global.currentOrgDetails.basic_details.base_language : 'en',
317
+ // submitAction: "addLanguage",
318
+ // supportedEvents: [
319
+ // "addLanguage",
320
+ // ],
321
+ // },
322
+ // {
323
+ // id: "tagList",
324
+ // label: "Tags",
325
+ // type: "tag-list", //Resembles component to be used
326
+ // metaType: "List",
327
+ // datatype: "select",
328
+ // required: true,
329
+ // fluid: true,
330
+ // onlyDisplay: true,
331
+ // styling: "semantic",
332
+ // order: 1,
333
+ // style: {
334
+ // border: "none",
335
+ // },
336
+ // customComponent: true,
337
+ // width: 3,
338
+ // offset: 11,
339
+ // supportedEvents: [
340
+ // 'onTagSelect',
341
+ // ],
342
+ // },
343
+ // {
344
+ // id: "insert-image",
345
+ // metaType: "label",
346
+ // type: "div", //Resembles component to be used
347
+ // primitive: true,
348
+ // value: "Insert Image",
349
+ // fluid: true,
350
+ // onlyDisplay: false,
351
+ // styling: "semantic",
352
+ // order: 1,
353
+ // customComponent: false,
354
+ // submitAction: "onImageSelect",
355
+ // style: {
356
+ // color: "#4E92E5",
357
+ // fontSize: "14px",
358
+ // fontFamily: "open-sans",
359
+ // lineHeight: "24px",
360
+ // textAlign: "center",
361
+ // cursor: "pointer",
362
+ // },
363
+ // width: 3,
364
+ // supportedEvents: [
365
+ // "onImageSelect",
366
+ // ],
367
+ // },
368
+ // {
369
+ // id: "mark-final-version-label",
370
+ // metaType: "label",
371
+ // type: "div",
372
+ // primitive: true,
373
+ // value: "Mark as Final",
374
+ // onlyDisplay: true,
375
+ // customComponent: false,
376
+ // order: 3,
377
+ // width: 3,
378
+ // fluid: false,
379
+ // style: {
380
+ // color: "#4E92E5",
381
+ // fontSize: "14px",
382
+ // fontFamily: "open-sans",
383
+ // lineHeight: "24px",
384
+ // textAlign: "center",
385
+ // cursor: "pointer",
386
+ // display: (this.props.location.query.type === 'embedded') ? "none" : "",
387
+ // },
388
+ // submitAction: "markFinalVersion",
389
+ // supportedEvents: [
390
+ // "markFinalVersion",
391
+ // ],
392
+ // },
393
+ // {
394
+ // id: "tab-options-popover",
395
+ // metaType: "display",
396
+ // colStyle: {
397
+ // flex: 0,
398
+ // },
399
+ // type: "popover",
400
+ // customComponent: false,
401
+ // styling: "semantic",
402
+ // order: 3,
403
+ // width: 1,
404
+ // fluid: false,
405
+ // onlyDisplay: true,
406
+ // submitAction: "onTabOptionSelect",
407
+ // supportedEvents: [
408
+ // "onTabOptionSelect",
409
+ // ],
410
+ // content: {
411
+ // sections: [
412
+ // {
413
+ // type: "multicols",
414
+ // inputFields: [
415
+ // {
416
+ // cols: [
417
+ // {
418
+ // id: "duplicate-version-label",
419
+ // metaType: "label",
420
+ // type: "div",
421
+ // primitive: true,
422
+ // value: "Duplicate Version",
423
+ // onlyDisplay: true,
424
+ // customComponent: false,
425
+ // order: 3,
426
+ // fluid: false,
427
+ // colStyle: {
428
+ // display: (this.props.location.query.type === 'embedded') ? "none" : "",
429
+ // },
430
+ // className: "version-popover",
431
+ // submitAction: "duplicateVersion",
432
+ // supportedEvents: [
433
+ // "duplicateVersion",
434
+ // ],
435
+ // },
436
+ // ],
437
+ // },
438
+ // {
439
+ // cols: [
440
+ // {
441
+ // id: "delete-version-label",
442
+ // metaType: "label",
443
+ // type: "div",
444
+ // primitive: true,
445
+ // value: "Delete Version",
446
+ // onlyDisplay: true,
447
+ // customComponent: false,
448
+ // order: 3,
449
+ // fluid: false,
450
+ // colStyle: {
451
+ // display: (this.props.location.query.type === 'embedded') ? "none" : "",
452
+ // },
453
+ // className: "version-popover",
454
+ // submitAction: "deleteVersion",
455
+ // supportedEvents: [
456
+ // "deleteVersion",
457
+ // ],
458
+ // },
459
+ // ],
460
+ // },
461
+ // {
462
+ // cols: [
463
+ // {
464
+ // id: "delete-language-label",
465
+ // metaType: "label",
466
+ // type: "div",
467
+ // primitive: true,
468
+ // value: "Delete Language",
469
+ // onlyDisplay: true,
470
+ // customComponent: false,
471
+ // order: 3,
472
+ // fluid: false,
473
+ // className: "version-popover",
474
+ // submitAction: "deleteLanguage",
475
+ // supportedEvents: [
476
+ // "deleteLanguage",
477
+ // ],
478
+ // },
479
+ // ],
480
+ // },
481
+ // {
482
+ // cols: [
483
+ // {
484
+ // id: "switch-editor-label",
485
+ // metaType: "label",
486
+ // type: "div",
487
+ // primitive: true,
488
+ // value: "Switch Editor",
489
+ // onlyDisplay: true,
490
+ // customComponent: false,
491
+ // order: 4,
492
+ // fluid: false,
493
+ // className: "version-popover",
494
+ // submitAction: "switchEditor",
495
+ // supportedEvents: [
496
+ // "switchEditor",
497
+ // ],
498
+ // style: {
499
+ // display: (!_.isEmpty(this.props.Templates.edmTemplate) && this.props.Templates.edmTemplate.versions.base.drag_drop_id) ? '' : 'none',
500
+ // },
501
+ // },
502
+ // ],
503
+ // },
504
+ // ],
505
+ // actionFields: [],
506
+ // },
507
+ // ],
508
+ // },
509
+ // value: {
510
+ // sections: [
511
+ // {
512
+ // type: "multicols",
513
+ // inputFields: [
514
+ // {
515
+ // cols: [
516
+ // {
517
+ // id: "tab-option-icon",
518
+ // metaType: "display",
519
+ // type: "icon",
520
+ // onlyDisplay: true,
521
+ // primitive: false,
522
+ // value: "",
523
+ // customComponent: false,
524
+ // order: 3,
525
+ // fluid: false,
526
+ // },
527
+ // ],
528
+ // },
529
+ // ],
530
+ // actionFields: [],
531
+ // },
532
+ // ],
533
+ // },
534
+ // trigger: "click",
535
+ // placement: "bottomLeft",
536
+ // },
537
+ // ],
538
+ // },
539
+ // ],
540
+ // },
541
+ // ],
542
+ // },
543
+ // tabContent: {
544
+ // sections: [
545
+ // {
546
+ // type: "multicols",
547
+ // inputFields: [
548
+ // {
549
+ // rowStyle: {
550
+ // display: "flex",
551
+ // flex: 1,
552
+ // },
553
+ // cols: [
554
+ // {
555
+ // id: "tab-header",
556
+ // metaType: "label",
557
+ // value: "English",
558
+ // primitive: true,
559
+ // dynamicTab: false,
560
+ // type: "div",
561
+ // width: 5,
562
+ // offset: 0,
563
+ // onlyDisplay: true,
564
+ // colStyle: {
565
+ // flex: 1,
566
+ // },
567
+ // supportedEvents: [
568
+ // "onChange",
569
+ // ],
570
+ // },
571
+ // ],
572
+ // },
573
+ // ],
574
+ // actionFields: [],
575
+ // },
576
+ // ],
577
+ // },
578
+ // label: "Version",
579
+ // onlyDisplay: true,
580
+ // supportedEvents: [
581
+ // "onTabChange",
582
+ // ],
583
+ // isActive: true,
584
+ // },
585
+ // ],
586
+ // channel: "EMAIL",
587
+ // },
51
588
  loading: false,
52
589
  isFormValid: true,
53
590
  injectedTags: {},
@@ -80,7 +617,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
80
617
 
81
618
  this.isTagLoaded = false;
82
619
  this.edmEvent = undefined;
83
- this.supportedLanguages = this.getSupportedLanguages(props);
620
+ this.supportedLanguages = this.props.Global.currentOrgDetails && this.props.Global.currentOrgDetails.basic_details.supported_languages ? this.props.Global.currentOrgDetails.basic_details.supported_languages : [];
84
621
  this.map = {
85
622
  "template-name": {
86
623
  onChange: this.onTemplateNameChange,
@@ -146,7 +683,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
146
683
  },
147
684
  };
148
685
  }
686
+
149
687
  componentWillMount() {
688
+ console.log('new log 2');
689
+ console.log('Dark KNight', this.props.Templates, this.props.Email, this.props.Global, this.supportedLanguages);
150
690
  const formData = this.initFormData(this.props, true); //_.cloneDeep(this.state.formData);
151
691
  const isEmpty = _.isEmpty(formData);
152
692
  if (!isEmpty) {
@@ -162,7 +702,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
162
702
  value: 'New Version',
163
703
  },
164
704
  ];
165
- //
705
+ // console.log('New Form Data Preparing ', this.initFormData());
166
706
  formData['template-version'] = "version 1";
167
707
  }
168
708
  // const formData = _.cloneDeep(this.state.formData);
@@ -189,7 +729,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
189
729
  this.props.actions.getCmsSetting('edm', this.props.Templates.edmTemplate.versions.base.drag_drop_id, 'create', undefined, isEdmSupport);
190
730
  }
191
731
  }
192
-
732
+ console.log('Form Data ', formData);
193
733
  this.setState({ content: (this.props.Templates.selectedEmailLayout ? this.props.Templates.selectedEmailLayout : ''), formData}, () => {
194
734
  // this.injectEvents(this.state.schema);
195
735
  });
@@ -201,6 +741,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
201
741
  }
202
742
 
203
743
  componentDidMount() {
744
+ console.log('email container mounted');
204
745
  const query = {
205
746
  layout: 'EMAIL',
206
747
  type: 'LAYOUT',
@@ -213,17 +754,19 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
213
754
  }
214
755
 
215
756
  componentWillReceiveProps(nextProps) {
757
+ console.log('setting new language Next Props email', nextProps, this.state);
216
758
  // if (this.props.location.query.type === 'embedded') {
217
759
  // this.showNext();
218
760
  // }
219
761
 
220
762
  if (this.state.languageDataSet && nextProps.Templates.selectedEmailLayout && nextProps.Templates.selectedEmailLayout !== '' && !_.isEqual(this.props.Templates.selectedEmailLayout, nextProps.Templates.selectedEmailLayout )) {
763
+ console.log('setting new language content props', nextProps.Templates.selectedEmailLayout);
221
764
  this.setNewLanguageContent(nextProps.Templates.selectedEmailLayout);
222
765
  }
223
766
  if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.schema)) {
224
767
  const newSchema = this.injectEvents(nextProps.metaEntities.layouts[0].definition);
225
-
226
- this.setState({schema: newSchema, loadingStatus: this.state.loadingStatus + 1});
768
+ console.log('Schema test 1 ', newSchema);
769
+ this.setState({schema: newSchema});
227
770
  if (this.props.location.query.module !== 'library' || (this.props.location.query.module === 'library' && this.props.getDefaultTags)) {
228
771
  const query = {
229
772
  layout: 'EMAIL',
@@ -242,7 +785,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
242
785
  this.showSubject();
243
786
  }, 0);
244
787
  }
245
- if (nextProps.currentOrgDetails && nextProps.currentOrgDetails.basic_details && !_.isEmpty(nextProps.currentOrgDetails.basic_details) && _.isEmpty(this.state.formData)) {
788
+ if (nextProps.Global.currentOrgDetails && nextProps.Global.currentOrgDetails.basic_details && !_.isEmpty(nextProps.Global.currentOrgDetails.basic_details) && _.isEmpty(this.state.formData)) {
246
789
  const formData = this.initFormData(nextProps);
247
790
  formData['template-version-options'] = [
248
791
  {
@@ -256,7 +799,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
256
799
  value: 'New Version',
257
800
  },
258
801
  ];
259
- //
802
+ // console.log('New Form Data Preparing ', this.initFormData());
260
803
  formData['template-version'] = "version 1";
261
804
  //const that = this;
262
805
  this.setState({formData}, () => {
@@ -265,10 +808,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
265
808
  // that.startTemplateCreation();
266
809
  // }, 15000);
267
810
  });
268
- } else if (nextProps.currentOrgDetails && nextProps.currentOrgDetails.basic_details) {
811
+ } else if (nextProps.Global.currentOrgDetails && nextProps.Global.currentOrgDetails.basic_details) {
269
812
  // this.injectEvents(this.state.schema);
270
- const baseLanguage = nextProps.currentOrgDetails.basic_details.base_language;
813
+ const baseLanguage = nextProps.Global.currentOrgDetails.basic_details.base_language;
271
814
  if (this.state.formData[`${this.state.currentTab - 1}`] && _.isEmpty(this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages)) {
815
+ console.log('Language Empty ', this.state.formData);
272
816
  const formData = _.cloneDeep(this.state.formData);
273
817
  formData[`${this.state.currentTab - 1}`].selectedLanguages = [];
274
818
  formData[`${this.state.currentTab - 1}`].selectedLanguages.push(baseLanguage);
@@ -279,19 +823,19 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
279
823
 
280
824
  if (!_.isEmpty(this.state.schema)) {
281
825
  const schema = _.cloneDeep(this.state.schema);
282
-
826
+ console.log('Schema test 2', schema);
283
827
  const formData = _.cloneDeep(this.state.formData);
284
828
  const container = schema.containers[0];
285
- // const baseLanguage = this.props.currentOrgDetails.basic_details.base_language;
829
+ // const baseLanguage = this.props.Global.currentOrgDetails.basic_details.base_language;
286
830
  if (baseLanguage === formData[0].activeTab) {
287
831
  container.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: "none"};
288
832
  } else {
289
833
  container.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: ""};
290
834
  }
291
- this.setState({schema, loadingStatus: this.state.loadingStatus + 1});
835
+ this.setState({schema});
292
836
  }
293
837
 
294
- //
838
+ // console.log('isTagLoaded', this.isTagLoaded);
295
839
  // if (!this.isTagLoaded) {
296
840
  // this.isTagLoaded = true;
297
841
  // const query = {
@@ -304,6 +848,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
304
848
  // }
305
849
 
306
850
  if (this.state.isEdit && !this.state.editDataSet && !_.isEmpty(nextProps.Email.templateDetails) && !_.isEmpty(this.state.schema)) {
851
+ console.log('setting edit data in email', nextProps.Email.templateDetails);
307
852
  this.setState({editDataSet: true}, () => {
308
853
  this.setEditData(nextProps.Email.templateDetails);
309
854
  });
@@ -312,21 +857,18 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
312
857
  this.startTemplateCreation(nextProps.templateData);
313
858
  }
314
859
  if (nextProps.location.query.module === 'library' && nextProps.isGetFormData) {
315
- if (!_.isEmpty(this.props.Email.cmsData)) {
316
- this.props.actions.resetCmsData();
317
- }
318
860
  this.getFormData();
319
861
  }
320
862
 
321
863
  if (!_.isEmpty(nextProps.Email.CmsSettings) && !_.isEqual(this.props.Email.CmsSettings, nextProps.Email.CmsSettings)) {
322
864
  const apiLangId = nextProps.Email.CmsSettings.langId;
323
- const langId = nextProps.Email.CmsSettings.langId !== "undefined" ? nextProps.Email.CmsSettings.langId : nextProps.currentOrgDetails.basic_details.base_language;
324
-
865
+ const langId = nextProps.Email.CmsSettings.langId !== "undefined" ? nextProps.Email.CmsSettings.langId : nextProps.Global.currentOrgDetails.basic_details.base_language;
866
+ console.log('Got src', this.state.currentTab, nextProps.Email.CmsSettings, langId, nextProps.Global.currentOrgDetails.basic_details.base_language);
325
867
  const formData = _.cloneDeep(this.state.formData);
326
868
 
327
869
  const schema = _.cloneDeep(this.state.schema);
328
870
  const langIndex = formData[this.state.currentTab - 1].selectedLanguages.indexOf(langId);
329
-
871
+ console.log('edm trying to set data', langIndex, langId, formData[this.state.currentTab - 1].activeTab, apiLangId);
330
872
  const temp = schema.containers[this.state.currentTab - 1];
331
873
  if (baseLanguage === langId && (apiLangId === "undefined" || apiLangId === formData[this.state.currentTab - 1].activeTab)) {
332
874
  temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: "none"};
@@ -345,15 +887,15 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
345
887
  }
346
888
  _.forEach(temp.panes, (pane, index) => {
347
889
  const tempPane = pane;
348
- //
890
+ // console.log('edm trying to set data', index, langIndex, tempPane);
349
891
  if (parseInt(index, 10) === parseInt(langIndex, 10)) {
350
- //
892
+ // console.log('edm trying to set data done', index, langIndex, tempPane);
351
893
  tempPane.sections[0].inputFields[0].cols[1].colStyle = {display: ""};
352
894
  tempPane.sections[0].inputFields[0].cols[0].colStyle = {display: "none"};
353
895
  }
354
896
  });
355
-
356
- this.setState({schema, isSchemaChanged: true, loadingStatus: this.state.loadingStatus + 1});
897
+ console.log('Schema test 3', schema);
898
+ this.setState({schema, isSchemaChanged: true});
357
899
  } else {
358
900
  _.forEach(temp.panes, (pane, index) => {
359
901
  const tempPane = pane;
@@ -362,20 +904,21 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
362
904
  tempPane.sections[0].inputFields[0].cols[0].colStyle = {display: ""};
363
905
  }
364
906
  });
365
-
366
- this.setState({schema, isSchemaChanged: true, loadingStatus: this.state.loadingStatus + 1});
907
+ console.log('Schema test 4', schema);
908
+ this.setState({schema, isSchemaChanged: true});
367
909
  let html = decodeURIComponent(nextProps.Email.CmsSettings.htmlContent);
368
-
910
+ console.log('Before ', html, nextProps.Email.CmsSettings.htmlContent);
369
911
  html = html.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/\\&quot;/g, '"');
370
-
912
+ console.log('html content ', html);
371
913
  formData[this.state.currentTab - 1][langId]["template-content"] = html;
372
914
  if (window.CKEDITOR && apiLangId !== "undefined") {
373
915
  const instanceName = `template-content${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`;
374
-
916
+ console.log('email switch data name', instanceName);
375
917
  _.forEach(window.CKEDITOR.instances, (winInstance) => {
376
918
  const tempInstance = winInstance;
377
-
919
+ console.log('email switch data instance', winInstance, winInstance.name);
378
920
  if (winInstance.name === instanceName) {
921
+ console.log('setting instance name after loading', winInstance, name);
379
922
  tempInstance.setData(html);
380
923
  } else if (winInstance.name.indexOf('editor') !== -1) {
381
924
  tempInstance.setData(html);
@@ -388,13 +931,34 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
388
931
  this.hideEdmOptions(nextProps.Email.CmsSettings.isDragDrop);
389
932
  });
390
933
  }
934
+
935
+ if (nextProps.Email.createResponse && nextProps.Email.createResponse.templateId) {
936
+ // this.resetSchema();
937
+ let message;
938
+ if (this.state.isEdit) {
939
+ message = getMessageObject('success', this.props.intl.formatMessage(messages.emailEditSuccess), true);
940
+ } else {
941
+ message = getMessageObject('success', this.props.intl.formatMessage(messages.emailCreateSuccess), true);
942
+ }
943
+ this.props.globalActions.addMessageToQueue(message);
944
+ this.props.actions.clearCRUDResponse();
945
+ const module = this.props.location.query.module ? this.props.location.query.module : 'default';
946
+ const type = this.props.location.query.type;
947
+ const isLanguageSupport = this.props.location.query.isLanguageSupport || false;
948
+ const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
949
+ this.props.router.push({
950
+ pathname: `/email`,
951
+ query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module, isLanguageSupport, isEdmSupport},
952
+ });
953
+ }
391
954
  if (nextProps.Email.createTemplateError && !_.isEqual(nextProps.Email.createTemplateError, this.props.Email.createTemplateError)) {
392
955
  const message = getMessageObject('error', (nextProps.Email.createTemplateErrorMessage && nextProps.Email.createTemplateErrorMessage !== '') ? nextProps.Email.createTemplateErrorMessage : this.props.intl.formatMessage(messages.somethingWentWrong), true);
393
956
  this.props.globalActions.addMessageToQueue(message);
394
957
  }
395
- if (!nextProps.Email.fetchingCmsData && !_.isEqual(nextProps.Email.cmsData, this.props.Email.cmsData) && !_.isEmpty(nextProps.Email.cmsData)) {
958
+ if (!nextProps.Email.fetchingCmsData && !_.isEqual(nextProps.Email.cmsData, this.props.Email.cmsData)) {
396
959
  const formData = _.cloneDeep(this.state.formData);
397
960
  if (nextProps.Email.langId && nextProps.Email.langId !== 'undefined') {
961
+ console.log('setting template content', nextProps.Email.cmsData, decodeURIComponent(nextProps.Email.cmsData));
398
962
  const langId = nextProps.Email.langId;
399
963
  formData[`${this.state.currentTab - 1}`][langId]['template-content'] = decodeURIComponent(nextProps.Email.cmsData);
400
964
  if (formData[`${this.state.currentTab - 1}`].base) {
@@ -407,13 +971,15 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
407
971
  formData.base[formData.base.activeTab]['template-content'] = decodeURIComponent(nextProps.Email.cmsData);
408
972
  }
409
973
  } else {
974
+ console.log('email switch data ', this.state.currentTab, formData, formData[`${this.state.currentTab - 1}`].activeTab);
410
975
  const langIndex = formData[this.state.currentTab - 1].selectedLanguages.indexOf(formData[this.state.currentTab - 1].activeTab);
411
976
  const instanceName = `template-content${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`;
412
-
977
+ console.log('email switch data name', instanceName);
413
978
  _.forEach(window.CKEDITOR.instances, (winInstance) => {
414
979
  const temp = winInstance;
415
-
980
+ console.log('email switch data instance', winInstance, winInstance.name);
416
981
  if (winInstance.name === instanceName) {
982
+ console.log('setting instance name after loading', winInstance, name);
417
983
  temp.setData(decodeURIComponent(nextProps.Email.cmsData));
418
984
  } else if (winInstance.name.indexOf('editor') !== -1) {
419
985
  temp.setData(decodeURIComponent(nextProps.Email.cmsData));
@@ -429,8 +995,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
429
995
  formData.base[formData.base.activeTab].drag_drop_id = "";
430
996
  delete formData.base[formData.base.activeTab].edmeditorsrc;
431
997
  }
998
+ console.log('ckeditor trying to set ckeditor data');
432
999
  }
433
-
1000
+ console.log('setting template content final', formData);
434
1001
  this.setState({ formData }, () => {
435
1002
  if (nextProps.Email.langId) {
436
1003
  this.shouldStartValidation();
@@ -439,9 +1006,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
439
1006
  }
440
1007
 
441
1008
  if ( !_.isEqual(nextProps.Email.uploadAssetSuccess, this.props.Email.uploadAssetSuccess) && nextProps.Email.uploadAssetSuccess) {
1009
+ console.log('Post on will receive props');
442
1010
  const isDragDrop = this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop;
443
1011
  const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
444
1012
  if (isDragDrop && isEdmSupport) {
1013
+ console.log('Handle EDM ', this.edmEvent, JSON.parse(this.edmEvent.data)._dynId, nextProps.Email.uploadedAssetData.metaInfo.secure_file_path);
445
1014
  const evtData = JSON.parse(this.edmEvent.data);
446
1015
  if (evtData.action === 'editBackground') {
447
1016
  this.edmEvent.source.postMessage(JSON.stringify({
@@ -477,8 +1046,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
477
1046
  this.props.globalActions.addMessageToQueue(message);
478
1047
  }
479
1048
 
480
- if (!_.isEqual(nextProps.currentOrgDetails.basic_details.supported_languages, this.props.currentOrgDetails.basic_details.supported_languages)) {
481
- this.supportedLanguages = nextProps.currentOrgDetails.basic_details.supported_languages;
1049
+ if (!_.isEqual(nextProps.Global.currentOrgDetails.basic_details.supported_languages, this.props.Global.currentOrgDetails.basic_details.supported_languages)) {
1050
+ this.supportedLanguages = nextProps.Global.currentOrgDetails.basic_details.supported_languages;
482
1051
  }
483
1052
 
484
1053
  if (!nextProps.Email.fetchingAllAssets && !_.isEqual(nextProps.Email.fetchingAllAssets, this.props.Email.fetchingAllAssets) && !_.isEmpty(nextProps.Email.assetList) && nextProps.Email.assetList[0] && nextProps.Email.assetList[0].totalCount && this.state.totalCount === 0) {
@@ -488,15 +1057,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
488
1057
  }
489
1058
 
490
1059
  componentWillUnmount() {
491
- if (this.props.setIsLoadingContent) {
492
- this.props.setIsLoadingContent(true); // setting isLoading of CreativesContainer so that slidebox foot can be hidden till content is loaded
493
- }
1060
+ console.log('removed listener create');
494
1061
  this.resetStateValue();
495
1062
  window.removeEventListener("message", this.handleFrameTasks);
496
1063
  this.props.actions.clearStoreValues();
497
1064
  }
498
1065
 
499
1066
  onFormDataChange = (formData, tabCount, currentTab) => {
1067
+ console.log('Form data changed is ', formData, tabCount, currentTab);
500
1068
  // this.transformFormData(formData);
501
1069
  this.setState({formData, tabCount, isSchemaChanged: false});
502
1070
  if (currentTab) {
@@ -507,17 +1075,17 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
507
1075
 
508
1076
  onChange = (evt) => {
509
1077
  const formData = _.cloneDeep(this.state.formData);
510
-
1078
+ console.log('oncontentchange onChange ', evt, evt.editor.getData());
511
1079
  //if (evt.editor.name.indexOf('editor') === -1) {
512
1080
  // _.forEach(window.CKEDITOR.instances, (winInstance) => {
513
1081
  // const temp = winInstance;
514
1082
  // if (winInstance.name === evt.editor.name) {
515
- //
1083
+ // console.log('setting instance name after loading', winInstance, name);
516
1084
  // setTimeout(() => {
517
1085
  // //temp.name = id;
518
1086
  // }, 1000);
519
1087
  // //temp.name = id;
520
- //
1088
+ // console.log('setting instance name after loading 2', winInstance, name);
521
1089
  // }
522
1090
  // });
523
1091
  //}
@@ -526,14 +1094,19 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
526
1094
  if (formData[`${this.state.currentTab - 1}`].tabKey === formData.base.tabKey) {
527
1095
  formData.base[formData[`${this.state.currentTab - 1}`].activeTab][`template-content`] = _.cloneDeep(evt.editor.getData());
528
1096
  }
529
-
1097
+ console.log("Modified Form Data ", formData);
530
1098
  this.setState({formData, content: evt.editor.getData()}, () => {
531
-
1099
+ console.log('Dark Knight ', this.state.content);
532
1100
  });
533
1101
  }
534
1102
  }
535
1103
 
1104
+ onBlur = (evt) => {
1105
+ console.log("onBlur fired with event info: ", evt);
1106
+ }
1107
+
536
1108
  onTabChange(data, formData) {
1109
+ console.log('inside parent ontabchange', data, this.state);
537
1110
  //this.resetCkEditorInstance(data, formData);
538
1111
  const schema = _.cloneDeep(this.state.schema);
539
1112
  const container = schema.containers[`${data - 1}`];
@@ -544,24 +1117,25 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
544
1117
  container.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[3].cols[0].style = {display: "none"};
545
1118
  container.tabBarExtraContent.sections[0].inputFields[0].cols[2].style.display = "";
546
1119
  }
547
- const baseLanguage = this.props.currentOrgDetails.basic_details.base_language;
1120
+ const baseLanguage = this.props.Global.currentOrgDetails.basic_details.base_language;
548
1121
  if (baseLanguage === formData[`${data - 1}`].activeTab) {
549
1122
  container.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: "none"};
550
1123
  } else {
551
1124
  container.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: ""};
552
1125
  }
553
- this.setState({currentTab: data, formData, schema, loadingStatus: this.state.loadingStatus + 1});
1126
+ this.setState({currentTab: data, formData, schema});
554
1127
  }
555
1128
 
556
- onTemplateNameChange = () => {
557
-
1129
+ onTemplateNameChange = (name) => {
1130
+ console.log('Template name changed to ', name);
558
1131
  }
559
1132
 
560
- onTagSelect = (data) => {
1133
+ onTagSelect = (data, currentTab, value) => {
1134
+ console.log('On Tag selection ', data, currentTab, value);
561
1135
  const isDragDrop = this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop;
562
1136
  const formData = _.cloneDeep(this.state.formData);
563
1137
  const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
564
-
1138
+ console.log('isEdmsupport', isEdmSupport);
565
1139
  if (isDragDrop && isEdmSupport) {
566
1140
  let msg = {};
567
1141
  if (data === "unsubscribe") {
@@ -582,6 +1156,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
582
1156
  const win = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`).contentWindow;
583
1157
  win.postMessage(msgString, '*');
584
1158
  } else {
1159
+ console.log('tag', this.state, this.state.editorInstanse);
585
1160
  if (data === "unsubscribe") {
586
1161
  const anchor = `<a href='{{${data}}}'>${data}</a>`;
587
1162
  this.state.editorInstanse.insertHtml(`${anchor}`);
@@ -592,7 +1167,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
592
1167
  }
593
1168
  }
594
1169
 
595
- onImageSelect = () => {
1170
+ onImageSelect = (data) => {
1171
+ console.log('Calling', data);
596
1172
  this.setState({ showImageSelectionBox: true }, () => {
597
1173
  const params = {
598
1174
  name: this.state.searchText,
@@ -602,48 +1178,15 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
602
1178
  // this.props.actions.getAllAssets("image", params);
603
1179
  });
604
1180
  }
605
- onUpdateTemplateComplete = (createResponse) => {
606
- if (createResponse && createResponse.templateId) {
607
- // this.resetSchema();
608
- let message;
609
- if (this.state.isEdit) {
610
- message = getMessageObject('success', this.props.intl.formatMessage(messages.emailEditSuccess), true);
611
- } else {
612
- message = getMessageObject('success', this.props.intl.formatMessage(messages.emailCreateSuccess), true);
613
- }
614
- this.props.globalActions.addMessageToQueue(message);
615
- this.props.actions.clearCRUDResponse();
616
- const module = this.props.location.query.module ? this.props.location.query.module : 'default';
617
- const type = this.props.location.query.type;
618
- const isLanguageSupport = this.props.location.query.isLanguageSupport || false;
619
- const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
620
- if (this.props.isFullMode) {
621
- const {versions, ...rest} = createResponse.templateId;
622
- this.props.getFormSubscriptionData({ value: versions, ...rest, validity: true});
623
- } else {
624
- this.props.router.push({
625
- pathname: `/email`,
626
- query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module, isLanguageSupport, isEdmSupport},
627
- });
628
- }
629
- }
630
- }
631
1181
 
632
- getSupportedLanguages = (props) => {
633
- const {currentOrgDetails} = props;
634
- let supportedLanguages = [];
635
- if (!_.isEmpty(currentOrgDetails)) {
636
- const {basic_details} = currentOrgDetails;
637
- supportedLanguages = basic_details.supported_languages || [];
638
- }
639
- return supportedLanguages;
640
- }
641
1182
  getValidationData = () => {
1183
+ console.log('all data save getting validation data');
642
1184
  const that = this;
643
1185
  const formData = _.cloneDeep(this.state.formData);
644
1186
  _.forEach(formData, (val, index) => {
645
1187
  if (!isNaN(index)) {
646
1188
  _.forEach(val.selectedLanguages, (language) => {
1189
+ console.log('all data save language', language, val[language]);
647
1190
  if (val[language].is_drag_drop) {
648
1191
  that.props.actions.getCmsData('edm', val[language].drag_drop_id, language);
649
1192
  }
@@ -651,12 +1194,13 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
651
1194
  }
652
1195
  });
653
1196
  }
1197
+
654
1198
  setNewLanguageContent = (data) => {
655
1199
  const content = _.cloneDeep(data);
656
1200
  const formData = _.cloneDeep(this.state.formData);
657
1201
  const currentTab = this.state.currentTab - 1;
658
1202
  // const schema = _.cloneDeep(this.state.schema);
659
-
1203
+ console.log('Setting new language content', formData, this.state.settingLanguage);
660
1204
  const currentTabData = formData[currentTab][this.state.settingLanguage.iso_code];
661
1205
  currentTabData.is_drag_drop = false;
662
1206
  currentTabData.drag_drop_id = "";
@@ -667,12 +1211,12 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
667
1211
  delete currentTabData.edmeditorsrc;
668
1212
  }
669
1213
  formData[currentTab].selectedLanguages.push(newActiveTab);
670
-
1214
+ console.log('setting new language content final', formData);
671
1215
  // this.setState({formData});
672
1216
  // const container = schema.containers[this.state.currentTab - 1];
673
1217
  // const temp = container;
674
1218
  // const langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(newActiveTab);
675
- //
1219
+ // console.log('switch language Tab ', langTab, this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages, this.state.formData[`${this.state.currentTab - 1}`].activeTab);
676
1220
  // temp.panes[langTab].sections[0].inputFields[0].cols[0].colStyle = {display: ""};
677
1221
  // temp.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = {display: "none"};
678
1222
  // temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[3].cols[0].style = {display: "none"};
@@ -689,14 +1233,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
689
1233
  this.setState({getFormDataValue: value, gettingFormData: true}, () => {
690
1234
  this.saveValidationData();
691
1235
  });
692
- //
1236
+ // console.log('posting final result', this.state.formData);
693
1237
  // const response = {
694
1238
  // action: "getFormData",
695
1239
  // postAction: value || 'next',
696
1240
  // value: this.transformFormData(this.state.formData),
697
1241
  // validity: this.state.isFormValid,
698
1242
  // };
699
- //
1243
+ // console.log('Get Data', response);
700
1244
  // this.setState({checkValidation: true});
701
1245
  // if (e) {
702
1246
  // e.source.postMessage(JSON.stringify(response), e.origin);
@@ -705,14 +1249,16 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
705
1249
  }
706
1250
 
707
1251
  setFormValidity = (isFormValid) => {
708
- this.setState({isFormValid, startValidation: false});
1252
+ this.setState({isFormValid});
709
1253
  }
710
1254
 
711
1255
  setEditData(editData) {
1256
+ console.log('Edit Data is ', editData);
712
1257
  const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
713
1258
  const formData = _.cloneDeep(this.state.formData);
714
1259
 
715
- const schema = (this.props.location.query.type === 'embedded') ? this.removeStandAlone(this.state.schema) : _.cloneDeep(this.state.schema);
1260
+ const tabIndex = this.state.currentTab + 1;
1261
+ const schema = (this.props.location.query.type === 'embedded') ? this.removeStandAlone() : _.cloneDeep(this.state.schema);
716
1262
  const containers = _.cloneDeep(schema.containers.slice());
717
1263
  let tabKey = "";
718
1264
  let currentTab = _.cloneDeep(this.state.currentTab);
@@ -732,7 +1278,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
732
1278
  // containers[0].isActive = true;
733
1279
  _.forEach(firstPane.sections, (section) => {
734
1280
  let sect = _.cloneDeep(section);
735
-
1281
+ console.log('trying to clone in add version', JSON.stringify(sect), index);
736
1282
  if (sect.type === 'col-label') {
737
1283
  sect = this.cloneColLabel(sect, index, true);
738
1284
  } else if (sect.type === 'multicols') {
@@ -740,7 +1286,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
740
1286
  } else if (sect.type === 'parent') {
741
1287
  sect = this.cloneParent(sect, index, true);
742
1288
  }
743
-
1289
+ console.log('returning section', sect);
744
1290
  sections.push(sect);
745
1291
  return true;
746
1292
  });
@@ -748,7 +1294,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
748
1294
  containers[0].panes = [];
749
1295
  containers[0].panes.push(firstPane);
750
1296
  schema.containers.push(containers[0]);
751
-
1297
+ console.log('Pane Version', containers);
752
1298
 
753
1299
  // _.forEach(sections[0].inputFields[0].cols, (inputField) => {
754
1300
  // if (this.map[inputField.id] === undefined) {
@@ -769,25 +1315,29 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
769
1315
  formData['template-version-options'].push(newVersionOption);
770
1316
  }
771
1317
 
772
- // data.activeTab = this.props.currentOrgDetails.basic_details.base_language;
1318
+ // data.activeTab = this.props.Global.currentOrgDetails.basic_details.base_language;
773
1319
  _.forEach((data.selectedLanguages), (language) => {
774
1320
  if (data.tabKey === data[language].tabKey) {
775
1321
  data.activeTab = language;
776
1322
  }
777
1323
  });
778
1324
  if (data.constructor === Object) {
1325
+ console.log("Edit Data ", data, 'Tab key ', editData.versions.base.tabKey, data.tabKey, index, schema.containers, formData);
779
1326
  if (data.tabKey === editData.versions.base.tabKey) {
780
1327
  tabKey = data.tabKey;
781
1328
  schema.containers[index].isActive = true;
782
1329
  formData['template-version'] = formData['template-version-options'][index].key;
783
1330
  currentTab = index + 1;
1331
+ console.log('Dummy Random Tabkey Found ', tabKey, index, schema.containers[index].isActive);
784
1332
  } else {
785
1333
  schema.containers[index].isActive = false;
1334
+ console.log('Dummy Random ', schema.containers[index].isActive, index);
786
1335
  }
787
1336
  // const isLanguageSupport = this.props.location.query.isLanguageSupport;
788
-
1337
+ console.log('Schema Test ', schema, schema.containers[index]);
789
1338
  _.forEach(data.selectedLanguages, (lang, langIndex) => {
790
- if ((type !== 'embedded' || (type === 'embedded' && isLanguageSupport === 'true')) && lang !== this.props.currentOrgDetails.basic_details.base_language) {
1339
+ console.log('Language ', lang, langIndex);
1340
+ if ((type !== 'embedded' || (type === 'embedded' && isLanguageSupport === 'true')) && lang !== this.props.Global.currentOrgDetails.basic_details.base_language) {
791
1341
  const tabContent = _.cloneDeep(containers[0].tabContent.sections[0]);
792
1342
  const tabContentSection = tabContent.inputFields[0].cols[0];
793
1343
  const panes = containers[0].panes.slice();
@@ -795,7 +1345,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
795
1345
  const sections = [];
796
1346
  _.forEach(firstPane.sections, (section) => {
797
1347
  let sect = _.cloneDeep(section);
798
-
1348
+ console.log('trying to clone in add version', JSON.stringify(sect), tabIndex);
799
1349
  if (sect.type === 'col-label') {
800
1350
  sect = this.cloneColLabel(sect, (langIndex + 1));
801
1351
  } else if (sect.type === 'multicols') {
@@ -803,23 +1353,23 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
803
1353
  } else if (sect.type === 'parent') {
804
1354
  sect = this.cloneParent(sect, (langIndex + 1));
805
1355
  }
806
-
1356
+ console.log('returning section', sect);
807
1357
  sections.push(sect);
808
1358
  return true;
809
1359
  });
810
- //
811
-
1360
+ // console.log('tabContent.inputFields[0].cols[0]', tabContentSection, this.state.currentTab);
1361
+ console.log('Testing language', this.map[tabContentSection.id], tabContentSection.id, data, lang);
812
1362
  this.map[`template-content${data.selectedLanguages.indexOf(lang) + 1}`] = this.map['template-content'];
813
1363
  tabContentSection.id = `${tabContentSection.id}${index + 1}`;
814
1364
  tabContentSection.value = `${data[lang].language}`;
815
-
1365
+ console.log('cloned final sections', sections, tabContent);
816
1366
  firstPane.sections = sections;
817
1367
  firstPane.sectionsHeaders = [tabContent];
818
-
1368
+ console.log('firstPane final version', JSON.stringify(firstPane));
819
1369
  // panes.push(firstPane);
820
-
1370
+ console.log('initial panes', JSON.stringify(this.state.schema.containers));
821
1371
  schema.containers[index].panes.push(firstPane);
822
- } else if (lang !== this.props.currentOrgDetails.basic_details.base_language) {
1372
+ } else if (lang !== this.props.Global.currentOrgDetails.basic_details.base_language) {
823
1373
  delete data[lang];
824
1374
  data.selectedLanguages.splice(langIndex, 1);
825
1375
  }
@@ -838,8 +1388,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
838
1388
  }
839
1389
  });
840
1390
 
841
-
842
- this.setState({ formData, schema, tabKey, currentTab, tabCount: editData.versions.history.length, loadingStatus: this.state.loadingStatus + 1 }, () => {
1391
+ console.log('Edit Form Data ', formData, schema);
1392
+ this.setState({ formData, schema, tabKey, currentTab, tabCount: editData.versions.history.length }, () => {
1393
+ console.log('Form Data Set ', this.state.formData);
843
1394
  _.forEach((editData.versions.base.selectedLanguages), (language) => {
844
1395
  // if (formData[this.state.currentTab - 1].tabKey === formData[this.state.currentTab - 1][language].tabKey) {
845
1396
  // formData[this.state.currentTab - 1].activeTab = language;
@@ -848,18 +1399,23 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
848
1399
  // formData.base.activeTab = language;
849
1400
  // }
850
1401
  if (language && editData.versions.base[language].is_drag_drop) {
1402
+ console.log('making edm calls again');
851
1403
  this.props.actions.getCmsSetting('edm', editData.versions.base[language].drag_drop_id, 'open', language, isEdmSupport);
852
1404
  }
853
1405
  });
854
-
1406
+ console.log('final form data edit', formData);
855
1407
  // this.resetCkEditorInstance(this.state.currentTab - 1, formData);
856
1408
  // this.setState({formData});
857
1409
  });
858
1410
  }
859
1411
 
860
- getMappedEvent = (id, event) => this.map[id][event]
1412
+ getMappedEvent = (id, event) => {
1413
+ console.log('Map ', this.map, id, event);
1414
+ return this.map[id][event];
1415
+ }
861
1416
 
862
1417
  getCurrentWindow = (e) => {
1418
+ console.log('in email create', e);
863
1419
  const response = {
864
1420
  action: e.action,
865
1421
  value: 'edit',
@@ -868,10 +1424,12 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
868
1424
  parent.postMessage(JSON.stringify(response), '*');
869
1425
  }
870
1426
 
871
- getEditorInstanse = () => {
1427
+ getEditorInstanse = (instance, id) => {
1428
+ console.log('Got editor Instance ', instance, id);
872
1429
  window.CKEDITOR.on( 'instanceReady', ( event ) => {
873
1430
  this.setState({editorInstanse: event.editor});
874
1431
  event.editor.on( 'focus', () => {
1432
+ console.log( 'focused', event.editor, this );
875
1433
  this.setState({editorInstanse: event.editor});
876
1434
  });
877
1435
  });
@@ -916,7 +1474,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
916
1474
 
917
1475
  shouldStartValidation = () => {
918
1476
  this.setState((prevState) => ({ cmsDataCount: prevState.cmsDataCount + 1}), () => {
1477
+ console.log('all data save count validating', this.state.saveCount, this.state.cmsDataCount);
919
1478
  if (this.state.targetSaveCount === this.state.cmsDataCount) {
1479
+ console.log('validation final starting edm validation');
920
1480
  this.setState({startValidation: true});
921
1481
  }
922
1482
  });
@@ -932,6 +1492,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
932
1492
  if (!isNaN(index)) {
933
1493
  _.forEach(newdata.selectedLanguages, (language) => {
934
1494
  if (newdata[language].is_drag_drop && ((parseInt(index, 10) + 1) === this.state.currentTab)) {
1495
+ console.log('all data 4');
935
1496
  saveCount += 1;
936
1497
  }
937
1498
  });
@@ -945,6 +1506,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
945
1506
  const data = this.state.formData[this.state.currentTab - 1];
946
1507
  _.forEach(data.selectedLanguages, (language, langIndex) => {
947
1508
  if (data[language].is_drag_drop) {
1509
+ console.log('saving edm template', document.getElementById("edmeditor"), `edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`);
948
1510
  const win = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`).contentWindow;
949
1511
  win.postMessage("saveProject", '*');
950
1512
  }
@@ -983,7 +1545,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
983
1545
  showEdmEmailTemplates: false,
984
1546
  editDataSet: false,
985
1547
  }, () => {
986
-
1548
+ console.log('Unmount value cleared', this.state);
987
1549
  });
988
1550
  }
989
1551
 
@@ -991,8 +1553,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
991
1553
  const currentLang = formData[`${data - 1}`].selectedLanguages.indexOf(formData[`${data - 1}`].activeTab);
992
1554
  const langIndex = formData[`${data - 1}`].selectedLanguages.indexOf(formData[`${data - 1}`].activeTab);
993
1555
  let instance1 = window.CKEDITOR.instances[`editor${currentLang + 1}`];
1556
+ const instanceCount = 0;
994
1557
  const instanceArray = [];
995
- _.forEach(window.CKEDITOR.instances, (instance ) => {
1558
+ _.forEach(window.CKEDITOR.instances, (instance, index) => {
1559
+ console.log('all ck instances ', instance, index, instanceCount, langIndex);
996
1560
  const name = instance.name;
997
1561
  if (instance.status === "destroyed") {
998
1562
  return;
@@ -1013,7 +1577,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1013
1577
  instanceArray.push(obj);
1014
1578
  }
1015
1579
  });
1016
-
1580
+ console.log('sorted instance array before sort', instanceArray);
1017
1581
  instanceArray.sort( (a, b) => {
1018
1582
  const idxA = a.idx;
1019
1583
  const idxB = b.idx;
@@ -1024,11 +1588,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1024
1588
  }
1025
1589
  return 0;
1026
1590
  });
1027
-
1591
+ console.log('sorted instance array after sort', instanceArray);
1028
1592
  //instanceCount += 1;
1029
1593
  // if (instanceIdx === langIndex) {
1030
1594
  const instance = instanceArray[langIndex].instance;
1031
-
1595
+ console.log('setting instance as ', instance, instance.name);
1032
1596
  instance1 = instance;
1033
1597
  this.setState({editorInstanse: instance1}, () => {
1034
1598
  if (onInsert && !isImage) {
@@ -1040,10 +1604,13 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1040
1604
  }
1041
1605
 
1042
1606
  uploadFile = () => {
1607
+ console.log('uploadFile');
1043
1608
  document.getElementById('filename').click();
1609
+ console.log('Upload File initiated');
1044
1610
  };
1045
1611
 
1046
1612
  useEditor = () => {
1613
+ console.log('useEditor');
1047
1614
  //this.toggleEdmEmailTemplateSelection();
1048
1615
  this.setState({addLanguageType: "useEditor"}, () => {
1049
1616
  this.setState({showModal: false}, () => {
@@ -1054,12 +1621,12 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1054
1621
 
1055
1622
  copyPrimaryLanguage = () => {
1056
1623
  const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
1057
-
1624
+ console.log('copy primary language');
1058
1625
  this.setState({addLanguageType: "copyPrimaryLanguage"}, () => {
1059
1626
  this.setState({showModal: false});
1060
1627
  const formData = _.cloneDeep(this.state.formData);
1061
1628
  const currentTab = this.state.currentTab - 1;
1062
- const baseLanguage = this.props.currentOrgDetails.basic_details.base_language ? this.props.currentOrgDetails.basic_details.base_language : 'en';
1629
+ const baseLanguage = this.props.Global.currentOrgDetails.basic_details.base_language ? this.props.Global.currentOrgDetails.basic_details.base_language : 'en';
1063
1630
  if (formData[currentTab][baseLanguage].is_drag_drop) {
1064
1631
  this.props.actions.getCmsSetting('edm', formData[currentTab][baseLanguage].drag_drop_id, 'duplicate', baseLanguage, isEdmSupport);
1065
1632
  }
@@ -1072,14 +1639,16 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1072
1639
  }
1073
1640
  const fileExtension = files[0].name.split('.').pop();
1074
1641
  const supportedZipFormats = ['zip'];
1075
-
1642
+ console.log('File Params ', fileExtension);
1076
1643
  if (supportedZipFormats.indexOf(fileExtension.toLowerCase()) !== -1) {
1077
1644
  this.setState({ addLanguageType: "upload"}, () => {
1645
+ console.log('Zip Format got');
1078
1646
  this.props.templatesActions.handleZipUpload(files[0]);
1079
1647
  document.getElementById("filename").value = "";
1080
1648
  this.setState({showModal: false});
1081
1649
  });
1082
1650
  } else if (fileExtension === 'html' || fileExtension === 'htm') {
1651
+ console.log('html Format got');
1083
1652
  const reader = new FileReader();
1084
1653
  reader.onload = () => {
1085
1654
  this.setState({ addLanguageType: "upload"}, () => {
@@ -1092,6 +1661,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1092
1661
  reader.readAsText(files[0]);
1093
1662
  } else {
1094
1663
  alert('Invalid file type added! Please Give a proper zip/html file');
1664
+ console.log('Invalid file type added! Please Give a proper zip/html file');
1095
1665
  }
1096
1666
  };
1097
1667
 
@@ -1168,25 +1738,28 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1168
1738
 
1169
1739
  deleteLanguage = (passedData, val) => {
1170
1740
  const formData = _.cloneDeep(passedData);
1171
-
1741
+ console.log('Delete Language ', formData, val);
1172
1742
  const schema = _.cloneDeep(this.state.schema);
1173
1743
  schema.containers[this.state.currentTab - 1].panes.splice(val, 1);
1174
1744
  schema.containers[this.state.currentTab - 1].tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: "none"};
1175
1745
  //this.resetCkEditorInstance(this.state.currentTab, formData);
1176
1746
  this.setState({schema, formData, showModal: false});
1747
+ console.log('Schema ', schema, formData, val);
1177
1748
  }
1178
1749
 
1179
- initFormData(props) {
1750
+ initFormData(props, fromMount) {
1751
+ console.log('init email', props, fromMount);
1180
1752
  let newFormData = {};
1181
- if (props.currentOrgDetails && props.currentOrgDetails.basic_details) {
1753
+ if (props.Global.currentOrgDetails && props.Global.currentOrgDetails.basic_details) {
1754
+ console.log('init email actual', props, fromMount);
1182
1755
  newFormData = {
1183
1756
  "0": {},
1184
1757
  "template-name": "",
1185
1758
  "base": {},
1186
1759
  };
1187
1760
  const baseData = {};
1188
- const baseLanguage = props.currentOrgDetails.basic_details.base_language;
1189
- this.supportedLanguages = this.getSupportedLanguages(props);
1761
+ const baseLanguage = props.Global.currentOrgDetails.basic_details.base_language;
1762
+ this.supportedLanguages = props.Global.currentOrgDetails.basic_details.supported_languages;
1190
1763
  const languageObject = this.supportedLanguages[_.findIndex(this.supportedLanguages, {iso_code: baseLanguage})];
1191
1764
  baseData.activeTab = baseLanguage;
1192
1765
  baseData[languageObject.iso_code] = {};
@@ -1208,6 +1781,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1208
1781
  }
1209
1782
 
1210
1783
  transformFormData = (formData) => {
1784
+ console.log('Transforming data ', formData);
1211
1785
  const newFormData = {
1212
1786
  base: {},
1213
1787
  secondary_templates: [],
@@ -1228,24 +1802,27 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1228
1802
  tmpData.drag_drop_id = (content.drag_drop_id ? content.drag_drop_id : "");
1229
1803
  }
1230
1804
 
1231
- if (index === this.props.currentOrgDetails.basic_details.base_language) {
1805
+ if (index === this.props.Global.currentOrgDetails.basic_details.base_language) {
1232
1806
  newFormData.base = _.cloneDeep(tmpData);
1233
1807
  }
1234
1808
  newFormData.secondary_templates.push({template_data: tmpData});
1809
+ console.log('Tranforming data for embedded mode', tmpData);
1235
1810
  }
1236
1811
  });
1237
1812
  if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "coupon_expiry" || this.props.location.query.module === "timeline" || this.props.location.query.module === "library")) {
1238
1813
  newFormData.base.subject = formData['template-subject'];
1239
1814
  }
1240
1815
 
1241
-
1816
+ console.log('This is test subject ', newFormData);
1242
1817
  return newFormData;
1243
1818
  }
1244
1819
 
1245
1820
  handleFrameTasks = (e) => {
1821
+ console.log('data listened to is', e.data);
1246
1822
  const type = this.isValidJson(e.data) ? JSON.parse(e.data) : e.data;
1247
-
1823
+ console.log('data type', typeof type);
1248
1824
  if (typeof type === 'object') {
1825
+ console.log('received something', type);
1249
1826
  const action = type.action;
1250
1827
  switch (action) {
1251
1828
  case "startTemplateCreation":
@@ -1254,12 +1831,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1254
1831
  case "edit":
1255
1832
  this.edmEvent = e;
1256
1833
  if (type.elementJson.type === "IMAGE") {
1834
+ console.log('Data Inside ', type);
1257
1835
  this.onImageSelect();
1258
1836
  }
1259
1837
  break;
1260
1838
  case "editBackground":
1261
1839
  this.edmEvent = e;
1262
1840
  if (type.elementJson.type === "BOX" || type.elementJson.type === "BUTTON" || type.elementJson.type === "GENERAL") {
1841
+ console.log('Data Inside ', type);
1263
1842
  this.onImageSelect();
1264
1843
  }
1265
1844
  break;
@@ -1282,26 +1861,25 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1282
1861
  break;
1283
1862
  }
1284
1863
  } else {
1864
+ console.log('Else Type ', type);
1285
1865
  switch (type) {
1286
1866
  case "getFormData":
1287
1867
  this.getFormData(e);
1288
1868
  break;
1289
1869
  case "startTemplateCreation":
1290
-
1870
+ console.log('Starting to create template');
1291
1871
  //this.getFormData(e);
1292
1872
  break;
1293
1873
  case "moveToTemplates":
1294
-
1874
+ console.log('moving to templates');
1295
1875
  this.moveToTemplates();
1296
1876
  break;
1297
1877
  case "validateContent":
1298
-
1878
+ console.log('validating Content');
1299
1879
  this.validateContent(e);
1300
1880
  break;
1301
1881
  case "Save result: success":
1302
- if (_.isEmpty(this.props.Email.cmsData)) {
1303
- this.handleEdmSave();
1304
- }
1882
+ this.handleEdmSave();
1305
1883
  break;
1306
1884
  case "JsonChanged":
1307
1885
  this.edmEvent = e;
@@ -1322,8 +1900,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1322
1900
  }
1323
1901
 
1324
1902
  handleEdmSave = () => {
1903
+ console.log('all data save', this.state.mode, this.state.targetSaveCount, this.state.saveCount);
1325
1904
  if (this.state.mode === "save") {
1326
1905
  this.setState((prevState) => ({ saveCount: prevState.saveCount + 1}), () => {
1906
+ console.log('all data save count', this.state.saveCount);
1327
1907
  if (this.state.targetSaveCount === this.state.saveCount) {
1328
1908
  if (this.state.saveEdmDataMode === 'validation') {
1329
1909
  this.getValidationData();
@@ -1341,14 +1921,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1341
1921
  if (parseInt(index, 10) === (this.state.currentTab - 1)) {
1342
1922
  const temp = container;
1343
1923
  const langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(formData[`${this.state.currentTab - 1}`].activeTab);
1344
-
1924
+ console.log('switch language Tab ', langTab, formData[`${this.state.currentTab - 1}`].selectedLanguages, formData[`${this.state.currentTab - 1}`].activeTab);
1345
1925
  temp.panes[langTab].sections[0].inputFields[0].cols[0].colStyle = {display: ""};
1346
1926
  temp.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = {display: "none"};
1347
1927
  temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[3].cols[0].style = {display: "none"};
1348
1928
  }
1349
1929
  });
1350
1930
  schema = this.showInsertImageButton(schema);
1351
-
1931
+ console.log('Handle OK ', schema);
1352
1932
  this.setState({ schema, showConfirmationModal: false, isSchemaChanged: true }, () => {
1353
1933
  this.injectEvents(schema);
1354
1934
  });
@@ -1361,18 +1941,20 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1361
1941
  }
1362
1942
 
1363
1943
  handleContentChange = (data) => {
1944
+ console.log('CKEditor Data changed ', data);
1364
1945
  const formData = _.cloneDeep(this.state.formData);
1365
1946
  formData[this.state.currentTab][formData[this.state.currentTab - 1].activeTab]["template-content"] = data;
1366
1947
  this.setState({formData});
1367
1948
  }
1368
1949
 
1369
- handleOnHoverItem = (isHovering) => {
1950
+ handleOnHoverItem = (isHovering, id) => {
1951
+ console.log('Card Howering ', isHovering, id);
1370
1952
  if (!isHovering) {
1371
1953
  // const data = _.find(this.props.Email.assetList, {_id: id});
1372
- //
1954
+ // console.log('Found Data ', data);
1373
1955
  // if (data) {
1374
1956
  // if (this.state.isDragDrop) {
1375
- //
1957
+ // console.log('Handle EDM ', isHovering, id);
1376
1958
  // } else {
1377
1959
  // this.state.editorInstanse.insertHtml(`<img src='${data.metaInfo.public_url}' alt='Capillary Image'>`);
1378
1960
  // }
@@ -1400,7 +1982,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1400
1982
  });
1401
1983
  }
1402
1984
  });
1403
-
1985
+ console.log('HandleEdmOption ', JSON.stringify(schema));
1404
1986
  this.setState({schema, isSchemaChanged: true});
1405
1987
  }
1406
1988
 
@@ -1416,30 +1998,30 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1416
1998
  });
1417
1999
  }
1418
2000
  });
1419
-
2001
+ console.log('HandleHideMarkAsFinal ', JSON.stringify(schema));
1420
2002
  this.setState({schema, isSchemaChanged: true});
1421
2003
  }
1422
2004
 
1423
2005
  showSubject = () => {
1424
2006
  const schema = _.cloneDeep(this.state.schema);
1425
- if (schema.standalone) {
1426
- if ((this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "timeline" || this.props.location.query.module === "coupon_expiry" ||
2007
+ if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "timeline" || this.props.location.query.module === "coupon_expiry" ||
1427
2008
  this.props.location.query.module === "library")) {
1428
- schema.standalone.sections[0].inputFields[0].style.display = "";
1429
- schema.standalone.sections[0].inputFields[0].labelStyle.display = "";
1430
- }
1431
- this.setState({schema});
2009
+ schema.standalone.sections[0].inputFields[0].style.display = "";
2010
+ schema.standalone.sections[0].inputFields[0].labelStyle.display = "";
1432
2011
  }
2012
+ this.setState({schema});
1433
2013
  }
1434
2014
 
1435
2015
  handleOnItemClick = (isSelected, id) => {
2016
+ console.log('Dummy ', isSelected, id, event);
1436
2017
  const isDragDrop = this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop;
1437
2018
  const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
1438
2019
  if (isSelected) {
1439
2020
  const data = _.find(this.props.Email.assetList, {_id: id});
1440
-
2021
+ console.log('Found Data ', data, this.state.isDragDrop);
1441
2022
  if (data) {
1442
2023
  if (isDragDrop && isEdmSupport) {
2024
+ console.log('Handle EDM ', isSelected, id, this.edmEvent, JSON.parse(this.edmEvent.data)._dynId, data.metaInfo.secure_file_path);
1443
2025
  const evtData = JSON.parse(this.edmEvent.data);
1444
2026
  if (evtData.action === 'editBackground') {
1445
2027
  this.edmEvent.source.postMessage(JSON.stringify({
@@ -1497,14 +2079,16 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1497
2079
  this.setState({ device });
1498
2080
  }
1499
2081
 
1500
- handleVersionSelect = (status, formData) => {
2082
+ handleVersionSelect = (status, formData, val) => {
2083
+ console.log('HandleVersion select', status, val);
1501
2084
  const newFormData = _.cloneDeep(this.state.formData);
1502
2085
  const schema = _.cloneDeep(this.state.schema);
1503
2086
  const versionIndex = _.findIndex(formData['template-version-options'], {key: status});
1504
2087
  newFormData['template-version'] = formData['template-version-options'][versionIndex].key;
1505
-
2088
+ console.log('Selected Version', status, formData, val, versionIndex);
1506
2089
  const newContainers = [];
1507
2090
  _.forEach(schema.containers, (container, index) => {
2091
+ console.log('Container Iteration ', container, index);
1508
2092
  const tmpContainer = _.cloneDeep(container);
1509
2093
  if (index === versionIndex) {
1510
2094
  tmpContainer.isActive = true;
@@ -1517,11 +2101,12 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1517
2101
  this.setState({formData: newFormData, schema, currentTab: (versionIndex + 1), isSchemaChanged: true});
1518
2102
  }
1519
2103
 
1520
- afterPaste = () => {
1521
-
2104
+ afterPaste = (evt) => {
2105
+ console.log("afterPaste fired with event info: ", evt);
1522
2106
  }
1523
2107
 
1524
2108
  deleteVersion = (data, currentTab) => {
2109
+ console.log('deleting version', data, currentTab);
1525
2110
  if (this.state.tabCount === 1 || currentTab === 1) {
1526
2111
  return;
1527
2112
  }
@@ -1532,35 +2117,38 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1532
2117
  delete formData[`${currentTab - 1}`];
1533
2118
  formData['template-version-options'].splice(`${currentTab - 1}`, 1);
1534
2119
  formData['template-version'] = formData['template-version-options'][0].value;
1535
-
2120
+ console.log('Current formData and Schema after delete', formData, schema);
1536
2121
  this.setState({schema, tabCount: (this.state.tabCount - 1), currentTab: 1, isSchemaChanged: true, showModal: false});
1537
2122
  }
1538
2123
 
1539
2124
  switchEditor = () => {
2125
+ console.log('Editor Switched');
1540
2126
  this.setState({showConfirmationModal: true});
1541
2127
  }
1542
2128
 
1543
- renameVersion = () => {
1544
-
2129
+ renameVersion = (data, currentTab) => {
2130
+ console.log('renaming version', data, currentTab);
1545
2131
  }
1546
2132
 
1547
- markFinalVersion = () => {
2133
+ markFinalVersion = (data, currentTab) => {
1548
2134
  const message = getMessageObject('success', this.props.intl.formatMessage(messages["Template Marked as Final Successfully"]), true);
1549
2135
  this.props.globalActions.addMessageToQueue(message);
2136
+ console.log('markFinal version', data, currentTab, this.state.schema);
1550
2137
  }
1551
2138
 
1552
- duplicateVersion = (formData) => {
2139
+ duplicateVersion = (formData, currentTab) => {
2140
+ console.log('duplicate version', formData, currentTab);
1553
2141
  this.setState({formData}, () => {
1554
2142
  this.addVersion(this.state.tabCount);
1555
2143
  });
1556
2144
  }
1557
2145
 
1558
- addVersion = () => {
2146
+ addVersion = (data) => {
1559
2147
  if (this.state.schema.containers.length === 5) {
1560
2148
  alert('You cant have more that 5 versions');
1561
2149
  return;
1562
2150
  }
1563
-
2151
+ console.log('adding version', data, this.state.formData);
1564
2152
  const schema = _.cloneDeep(this.state.schema);
1565
2153
  const tabIndex = schema.containers.length + 1; //data + 1;
1566
2154
  const formData = _.cloneDeep(this.state.formData);
@@ -1570,7 +2158,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1570
2158
  containers[0].isActive = true;
1571
2159
  _.forEach(firstPane.sections, (section) => {
1572
2160
  let sect = _.cloneDeep(section);
1573
-
2161
+ console.log('trying to clone in add version', JSON.stringify(sect), tabIndex);
1574
2162
  if (sect.type === 'col-label') {
1575
2163
  sect = this.cloneColLabel(sect, tabIndex);
1576
2164
  } else if (sect.type === 'multicols') {
@@ -1578,7 +2166,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1578
2166
  } else if (sect.type === 'parent') {
1579
2167
  sect = this.cloneParent(sect, tabIndex);
1580
2168
  }
1581
-
2169
+ console.log('returning section', sect);
1582
2170
  sections.push(sect);
1583
2171
  return true;
1584
2172
  });
@@ -1590,7 +2178,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1590
2178
  _.forEach(schema.containers, (container, index) => {
1591
2179
  schema.containers[index].isActive = ((index + 1) === this.state.currentTab);
1592
2180
  });
1593
-
2181
+ console.log('Pane ', containers);
1594
2182
 
1595
2183
  _.forEach(sections[0].inputFields[0].cols, (inputField) => {
1596
2184
  if (this.map[inputField.id] === undefined) {
@@ -1620,7 +2208,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1620
2208
  addLanguage = (tempLang, passedData, val, asyncLanguages) => {
1621
2209
  if (this.state.addLanguageType === "upload") {
1622
2210
  this.setState({languageDataSet: true}, () => {
2211
+ console.log('adding from add language 1', this.props.Templates);
1623
2212
  if (this.props.Templates.selectedEmailLayout && this.props.Templates.selectedEmailLayout !== '') {
2213
+ console.log('adding from add language 2');
1624
2214
  this.setNewLanguageContent(this.props.Templates.selectedEmailLayout);
1625
2215
  }
1626
2216
  });
@@ -1634,82 +2224,98 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1634
2224
  let langTab = 0;
1635
2225
  const schema = _.cloneDeep(this.state.schema);
1636
2226
  const formData = _.cloneDeep(passedData);
1637
- if (!_.isEmpty(schema)) {
1638
- for (let idx = 0; idx < addLanguageLength; idx += 1) {
1639
- let newActiveTab = this.state.settingLanguage ? this.state.settingLanguage.iso_code : 'en';
1640
- if (asyncLanguages) {
1641
- newActiveTab = asyncLanguages[idx].iso_code;
1642
- data = asyncLanguages[idx];
1643
- }
2227
+ for (let idx = 0; idx < addLanguageLength; idx += 1) {
2228
+ let newActiveTab = this.state.settingLanguage ? this.state.settingLanguage.iso_code : 'en';
2229
+ if (asyncLanguages) {
2230
+ newActiveTab = asyncLanguages[idx].iso_code;
2231
+ data = asyncLanguages[idx];
2232
+ }
2233
+ langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(newActiveTab);
2234
+ if (langTab === -1) {
2235
+ formData[`${this.state.currentTab - 1}`].selectedLanguages.push(newActiveTab);
1644
2236
  langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(newActiveTab);
1645
- if (langTab === -1) {
1646
- formData[`${this.state.currentTab - 1}`].selectedLanguages.push(newActiveTab);
1647
- langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(newActiveTab);
2237
+ }
2238
+ const selectedLanguage = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(data.iso_code);
2239
+ tabKey = formData[`${this.state.currentTab - 1}`][data.iso_code].tabKey;
2240
+ console.log('adding language', data, formData, val, selectedLanguage, formData[`${this.state.currentTab - 1}`]);
2241
+ const tabIndex = (selectedLanguage) + 1;
2242
+ const containers = schema.containers.slice();
2243
+ const tabContent = _.cloneDeep(containers[0].tabContent.sections[0]);
2244
+ const tabContentSection = tabContent.inputFields[0].cols[0];
2245
+ const panes = containers[`${this.state.currentTab - 1}`].panes.slice();
2246
+ const firstPane = _.cloneDeep(panes[0]);
2247
+ const sections = [];
2248
+ _.forEach(firstPane.sections, (section) => {
2249
+ let sect = _.cloneDeep(section);
2250
+ console.log('trying to clone in add version', JSON.stringify(sect), tabIndex);
2251
+ if (sect.type === 'col-label') {
2252
+ sect = this.cloneColLabel(sect, tabIndex);
2253
+ } else if (sect.type === 'multicols') {
2254
+ sect = this.cloneMultiCol(sect, tabIndex);
2255
+ } else if (sect.type === 'parent') {
2256
+ sect = this.cloneParent(sect, tabIndex);
1648
2257
  }
1649
- const selectedLanguage = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(data.iso_code);
1650
- tabKey = formData[`${this.state.currentTab - 1}`][data.iso_code].tabKey;
1651
- const tabIndex = (selectedLanguage) + 1;
1652
- const containers = schema.containers.slice();
1653
- const tabContent = _.cloneDeep(containers[0].tabContent.sections[0]);
1654
- const tabContentSection = tabContent.inputFields[0].cols[0];
1655
- const panes = containers[`${this.state.currentTab - 1}`].panes.slice();
1656
- const firstPane = _.cloneDeep(panes[0]);
1657
- const sections = [];
1658
- _.forEach(firstPane.sections, (section) => {
1659
- let sect = _.cloneDeep(section);
1660
- if (sect.type === 'col-label') {
1661
- sect = this.cloneColLabel(sect, tabIndex);
1662
- } else if (sect.type === 'multicols') {
1663
- sect = this.cloneMultiCol(sect, tabIndex);
1664
- } else if (sect.type === 'parent') {
1665
- sect = this.cloneParent(sect, tabIndex);
1666
- }
1667
- sections.push(sect);
1668
- return true;
1669
- });
1670
- tabContentSection.id = `${tabContentSection.id}${tabIndex}`;
1671
- tabContentSection.value = `${data.language}`;
1672
- _.forEach(sections[0].inputFields[0].cols, (inputField) => {
1673
- if (this.map[inputField.id] === undefined) {
1674
- if (inputField.id.indexOf('template-content') > -1) {
1675
- this.map[inputField.id] = this.map['template-content'];
1676
- } else if (inputField.id.indexOf('edmeditor2') > -1) {
1677
- this.map[inputField.id] = this.map.edmeditor2;
1678
- }
2258
+ console.log('returning section', sect);
2259
+ sections.push(sect);
2260
+ return true;
2261
+ });
2262
+ console.log('tabContent.inputFields[0].cols[0]', tabContentSection, this.state.currentTab);
2263
+ tabContentSection.id = `${tabContentSection.id}${tabIndex}`;
2264
+ tabContentSection.value = `${data.language}`;
2265
+ console.log('cloned final sections', sections, tabContent);
2266
+ _.forEach(sections[0].inputFields[0].cols, (inputField) => {
2267
+ if (this.map[inputField.id] === undefined) {
2268
+ if (inputField.id.indexOf('template-content') > -1) {
2269
+ this.map[inputField.id] = this.map['template-content'];
2270
+ } else if (inputField.id.indexOf('edmeditor2') > -1) {
2271
+ this.map[inputField.id] = this.map.edmeditor2;
1679
2272
  }
1680
- });
1681
- firstPane.sections = sections;
1682
- firstPane.sectionsHeaders = [tabContent];
1683
- // panes.push(firstPane);
1684
- schema.containers[`${this.state.currentTab - 1}`].panes.push(firstPane);
1685
- // schema.containers[0].tabContent.sections.push(tabContent);
1686
- }
1687
- //this.props.templatesActions.getEdmDefaultTemplates();
1688
- const container = schema.containers[this.state.currentTab - 1];
1689
- const temp = container;
1690
- if (this.state.addLanguageType === "upload") {
1691
- temp.panes[langTab].sections[0].inputFields[0].cols[0].colStyle = {display: ""};
1692
- temp.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = {display: "none"};
1693
- temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[3].cols[0].style = {display: "none"};
1694
- }
1695
- temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: ""};
1696
- if (schema) {
1697
- this.setState({schema, isSchemaChanged: true, tabKey});
1698
- if (this.state.addLanguageType !== "upload") {
1699
- this.setState({addLanguageType: ''});
1700
2273
  }
1701
- //this.toggleEdmEmailTemplateSelection();
2274
+ });
2275
+ firstPane.sections = sections;
2276
+ firstPane.sectionsHeaders = [tabContent];
2277
+ console.log('firstPane final version', JSON.stringify(firstPane));
2278
+ // panes.push(firstPane);
2279
+ console.log('initial panes', JSON.stringify(this.state.schema.containers));
2280
+ schema.containers[`${this.state.currentTab - 1}`].panes.push(firstPane);
2281
+ // schema.containers[0].tabContent.sections.push(tabContent);
2282
+ console.log('final schema after adding version', firstPane, schema);
2283
+ }
2284
+ //this.props.templatesActions.getEdmDefaultTemplates();
2285
+ const container = schema.containers[this.state.currentTab - 1];
2286
+ const temp = container;
2287
+ console.log('switch language Tab ', langTab, formData[`${this.state.currentTab - 1}`].selectedLanguages, this.state.formData[`${this.state.currentTab - 1}`].activeTab);
2288
+ if (this.state.addLanguageType === "upload") {
2289
+ temp.panes[langTab].sections[0].inputFields[0].cols[0].colStyle = {display: ""};
2290
+ temp.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = {display: "none"};
2291
+ temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[3].cols[0].style = {display: "none"};
2292
+ }
2293
+ temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: ""};
2294
+ if (schema) {
2295
+ this.setState({schema, isSchemaChanged: true, tabKey});
2296
+ if (this.state.addLanguageType !== "upload") {
2297
+ this.setState({addLanguageType: ''});
1702
2298
  }
2299
+ //this.toggleEdmEmailTemplateSelection();
1703
2300
  }
2301
+ // const mode = this.state.addLanguageMode;
2302
+ // switch (mode) {
2303
+ // case "upload":
2304
+ //
2305
+ // default:
2306
+ // break;
2307
+ // }
1704
2308
  }
1705
2309
 
1706
2310
  openPreviewMode = (selectedAsset) => {
2311
+ console.log('Open Preview Mode', selectedAsset);
1707
2312
  const asset = selectedAsset;
1708
2313
  asset.showButtons = asset.showButtons ? !asset.showButtons : true;
1709
2314
  this.setState({selectedAsset: asset});
1710
2315
  }
1711
2316
 
1712
2317
  cloneParent = (section, tabIndex, noSuffix) => {
2318
+ console.log('trying to clone', JSON.stringify(section), tabIndex);
1713
2319
  const parentsect = section;
1714
2320
  const childSectionsBeforeCloning = parentsect.childSections.slice();
1715
2321
  const childSections = [];
@@ -1722,17 +2328,18 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1722
2328
  } else if (childSection.type === 'parent') {
1723
2329
  sect = this.cloneParent(childSection, tabIndex, noSuffix);
1724
2330
  }
1725
-
2331
+ console.log('returning cloned parent section', sect);
1726
2332
  childSections.push(sect);
1727
2333
  return true;
1728
2334
  });
1729
-
2335
+ console.log('returning cloned parent section final 1', JSON.stringify(childSections));
1730
2336
  parentsect.childSections = childSections;
1731
-
2337
+ console.log('returning cloned parent section final', parentsect);
1732
2338
  return _.cloneDeep(parentsect);
1733
2339
  }
1734
2340
 
1735
2341
  cloneColLabel = (sectionObj, tabIndex, noSuffix) => {
2342
+ console.log('cloning cloneColLabel', sectionObj, tabIndex);
1736
2343
  const section = _.cloneDeep(sectionObj);
1737
2344
  const inputFields = _.forEach(section.inputFields, (inputField) => {
1738
2345
  const inputF = inputField;
@@ -1741,11 +2348,12 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1741
2348
  return inputF;
1742
2349
  });
1743
2350
  section.inputFields = inputFields;
1744
-
2351
+ console.log('cloned ifs are', section);
1745
2352
  return section;
1746
2353
  }
1747
2354
 
1748
2355
  cloneMultiCol = (sectionObj, tabIndex, noSuffix) => {
2356
+ console.log('cloning multicol ', sectionObj, tabIndex);
1749
2357
  const section = _.cloneDeep(sectionObj);
1750
2358
  const inputFields = _.forEach(section.inputFields, (inputField) => {
1751
2359
  const inputF = inputField;
@@ -1759,7 +2367,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1759
2367
  return inputF;
1760
2368
  });
1761
2369
  section.inputFields = inputFields;
1762
-
2370
+ console.log('cloned cols are', section);
1763
2371
  return section;
1764
2372
  }
1765
2373
 
@@ -1781,6 +2389,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1781
2389
  }
1782
2390
 
1783
2391
  showNext = () => {
2392
+ console.log("Inside ShowNext");
1784
2393
  const response = {
1785
2394
  action: "showNext",
1786
2395
  value: true,
@@ -1789,6 +2398,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1789
2398
  }
1790
2399
 
1791
2400
  moveToTemplates = () => {
2401
+ console.log('in move to Templates');
1792
2402
  const modalContent = {
1793
2403
  title: "Alert",
1794
2404
  body: "Do you really want to go back? All your temporary changes will be lost!",
@@ -1815,6 +2425,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1815
2425
  }
1816
2426
 
1817
2427
  prepareImageData() {
2428
+ console.log('Preparing Image Dataa ');
1818
2429
  const data = [];
1819
2430
  const assetList = this.props.Email.assetList;
1820
2431
  _.forEach(assetList, (asset) => {
@@ -1864,15 +2475,15 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1864
2475
 
1865
2476
  injectEvents = (schema) => {
1866
2477
  const type = this.props.location.query.type;
1867
-
1868
- let temp = _.cloneDeep(schema);
2478
+ console.log('now injecting events');
2479
+ const temp = schema;
1869
2480
  temp.standalone.sections = this.injectSections(temp.standalone.sections);
1870
2481
  _.forEach(temp.containers, (container) => {
1871
2482
  let tempContainer = container;
1872
2483
  tempContainer = this.injectContainer(tempContainer);
1873
2484
  return tempContainer;
1874
2485
  });
1875
-
2486
+ console.log("Lang Test ", this.props.location.query.isLanguageSupport, (this.props.location.query.isLanguageSupport === false));
1876
2487
  // if (type !== "embedded" || (type === "embedded" && (this.props.location.query.isLanguageSupport === "false" || (this.props.location.query.isLanguageSupport === undefined || this.props.location.query.isLanguageSupport === "true")))) {
1877
2488
  const ifLangSupported = this.props.location.query.isLanguageSupport === "true" || type !== "embedded";
1878
2489
  _.forEach(temp.containers, (container) => {
@@ -1881,8 +2492,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1881
2492
  _.forEach(container.tabContent.sections[0].inputFields[0].cols, (containerInputFieldCol) => {
1882
2493
  const tempEl = containerInputFieldCol;
1883
2494
  if (containerInputFieldCol.id === "tab-header") {
1884
- const baseLanguage = this.props.currentOrgDetails && this.props.currentOrgDetails.basic_details && this.props.currentOrgDetails.basic_details.base_language && this.props.currentOrgDetails.basic_details.base_language !== "" ? this.props.currentOrgDetails.basic_details.base_language : 'en';
1885
- const supportedLanguages = this.getSupportedLanguages(this.props);
2495
+ const baseLanguage = this.props.Global.currentOrgDetails && this.props.Global.currentOrgDetails.basic_details && this.props.Global.currentOrgDetails.basic_details.base_language && this.props.Global.currentOrgDetails.basic_details.base_language !== "" ? this.props.Global.currentOrgDetails.basic_details.base_language : 'en';
2496
+ const supportedLanguages = this.props.Global.currentOrgDetails.basic_details.supported_languages;
1886
2497
  if (!supportedLanguages) {
1887
2498
  tempEl.value = 'English';
1888
2499
  return;
@@ -1907,18 +2518,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1907
2518
  }
1908
2519
  if (containerInputFieldCol.id === 'add-language-button' && !ifLangSupported) {
1909
2520
  const newContainerInputFieldCol = containerInputFieldCol;
1910
- if (newContainerInputFieldCol.colStyle.display !== "none") {
1911
- newContainerInputFieldCol.colStyle.display = "none";
1912
- }
2521
+ newContainerInputFieldCol.colStyle.display = "none";
1913
2522
  hideLang = true;
1914
2523
  } else if (containerInputFieldCol.id === 'add-language-button') {
1915
2524
  hideLang = true;
1916
2525
  }
1917
2526
  if (containerInputFieldCol.id === "mark-final-version-label") {
1918
2527
  const newContainerInputFieldCol = containerInputFieldCol;
1919
- if (newContainerInputFieldCol.colStyle.display !== "none") {
1920
- newContainerInputFieldCol.colStyle.display = "none";
1921
- }
2528
+ newContainerInputFieldCol.colStyle.display = "none";
1922
2529
  }
1923
2530
  // if (containerInputFieldCol.id === "tab-options-popover") {
1924
2531
  // const newContainerInputFieldCol = containerInputFieldCol;
@@ -1935,8 +2542,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1935
2542
  }
1936
2543
  });
1937
2544
  //}
1938
- temp = type === 'embedded' ? this.removeStandAlone(temp) : temp;
1939
- this.setState({schema: temp, isSchemaChanged: true, loadingStatus: this.state.loadingStatus + 1}, () => {
2545
+ console.log('final injected schema', schema);
2546
+ this.setState({schema, isSchemaChanged: true}, () => {
2547
+ if (type === 'embedded') {
2548
+ this.removeStandAlone();
2549
+ }
1940
2550
  if (type === 'embedded' && (this.props.route.name === 'EmailView' || (this.props.location.query.module && (this.props.location.query.module.toLowerCase() === 'loyalty' || this.props.location.query.module.toLowerCase() === 'dvs' || this.props.location.query.module.toLowerCase() === 'coupon_expiry' || this.props.location.query.module.toLowerCase() === 'timeline')))) {
1941
2551
  if ((this.props.route.name === "EmailEdit" || this.props.route.name === "EmailCreate") && (this.props.location.query.module === "dvs" || this.props.location.query.module.toLowerCase() === 'coupon_expiry')) {
1942
2552
  return;
@@ -1947,10 +2557,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1947
2557
  parent.postMessage(JSON.stringify(response), '*');
1948
2558
  }
1949
2559
  });
1950
- return temp;
2560
+ return schema;
1951
2561
  }
1952
2562
 
1953
2563
  handleOnTagsContextChange = (data) => {
2564
+ console.log('parent tags context', data);
1954
2565
  const query = {
1955
2566
  layout: 'EMAIL',
1956
2567
  type: 'TAG',
@@ -1960,17 +2571,17 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1960
2571
  this.props.globalActions.fetchSchemaForEntity(query);
1961
2572
  }
1962
2573
 
1963
- removeStandAlone(schema) {
1964
- const newSchema = _.cloneDeep(schema);
1965
- delete newSchema.standalone;
1966
- newSchema.standalone = {};
1967
- newSchema.standalone.sections = [];
2574
+ removeStandAlone() {
2575
+ const schema = _.cloneDeep(this.state.schema);
2576
+ delete schema.standalone;
2577
+ schema.standalone = {};
2578
+ schema.standalone.sections = [];
1968
2579
  if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "coupon_expiry" || this.props.location.query.module === "timeline" ||
1969
2580
  this.props.location.query.module === "library")) {
1970
- newSchema.standalone.sections.push(_.cloneDeep(schema.standalone.sections[0]));
2581
+ schema.standalone.sections.push(_.cloneDeep(this.state.schema.standalone.sections[0]));
1971
2582
  }
1972
2583
 
1973
- _.forEach(newSchema.containers, (container) => {
2584
+ _.forEach(schema.containers, (container) => {
1974
2585
  const temp = container;
1975
2586
  if (temp.type === 'tabs') {
1976
2587
  // temp.tabBarExtraContent = {};
@@ -2006,10 +2617,12 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2006
2617
  temp.panes.push(basePane);
2007
2618
  }
2008
2619
  });
2009
- return newSchema;
2620
+ this.setState({ schema, isSchemaChanged: true });
2621
+ return schema;
2010
2622
  }
2011
2623
 
2012
2624
  startTemplateCreation(data) {
2625
+ console.log('startTemplatecreations', data);
2013
2626
  if (_.isEmpty(data)) {
2014
2627
  return;
2015
2628
  }
@@ -2017,17 +2630,18 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2017
2630
 
2018
2631
  //const data = {"base":{"subject":"deded","html_content":"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <html> <head> \t<title>Scheduled Report</title> \t<meta http-equiv=\"Content-Type\" content=\"text/html charset=UTF-8\"/> \t<style type=\"text/css\">.container-main p{line-height: 1.6;}@media screen and (max-width: 480px){a.brand{font-size: 35px;}}@media screen and (max-width: 480px){.container-main a{text-align: center;}a.brand{text-align: center;}}a.brand img{vertical-align: middle; padding: 0 8px 0 0; width: 250px;}@media screen and (max-width: 480px){a.brand img{width: 220px !important;}}@media screen and (max-width: 480px){.container-content{padding: 15px 20px; font-size: 12px !important;} .email-footer{font-size: 12px !important;}}.container-content table{border-collapse: collapse;}.container-content table tr td p{margin: 5px;}.container-content table tr td p span{font-weight: bold; padding: 0 3px 0 0;}@media screen and (max-width: 480px){a.btn-view-reports{margin: 25px auto 10px;}}a.btn-view-reports:hover{background: grey; color: #fff;}.email-footer p{text-align: center; font-size: 12px; color: grey;}.email-footer p a{color: blue; cursor: pointer;}.email-footer p a:hover{color: grey;} \t</style> </head> <body><center>\n\t\t\t\t\t\t\t\t\t\tIf you have difficulties viewing this mail, click\n\t\t\t\t\t\t\t\t\t\t<a href=\"https://nightly.capillary.in/business_controller/campaigns/emails/links/view.php?utrack={{user_id_b64}}&mtrack={{outbox_id_b64}}\" style = \"text-decoration: underline;color: #369;\" target=\"_blank\">here</a><br/>\n\t\t\t\t\t\t\t\t\t</center> <table class=\"container-main\" style=\"background:#eeeeee; color:#000000; font-family:'Open Sans',sans-serif; font-size:16px; font-weight:400; margin:0 auto; max-width:978px; padding:15px; width:100%\"> \t<tbody> \t\t<tr> \t\t\t<td> \t\t\t<table class=\"email-header\" style=\"background:#ffffff; margin:0 0 5px; padding:17px 0; width:100%\"> \t\t\t\t<tbody> \t\t\t\t\t<tr> \t\t\t\t\t\t<td style=\"width:100%\"><a class=\"brand\" href=\"#\" style=\"display: table; margin: 0 auto; text-decoration: none; font-size: 37px; color: grey;\"><img alt=\"Capillary Technologies\" src=\"https://s3.amazonaws.com/fileservice.in/intouch_creative_assets/60221e2020ba572f6787.png\" /> </a></td> \t\t\t\t\t</tr> \t\t\t\t</tbody> \t\t\t</table> \t\t\t<div class=\"container-content\" style=\"background:#ffffff; padding:20px 35px\"> \t\t\t<p>Hi Ashish Karan,</p> \t\t\t<p>You&#39;ve received a new scheduled report. {{unsubscribe}}</p> \t\t\t<table> \t\t\t\t<tbody> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Org Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>autotest1</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Scheduled Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>Schedule Test</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Time Period: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>1st Jan, 2017 to 24th Sep, 2017</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Report Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>redDart Report</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t</tbody> \t\t\t</table> \t\t\t<p style=\"font-size:15px; margin-top:25px\">By clicking &quot;View Report&quot; you will be redirected to Capillary Analytics to view the automated report.</p> \t\t\t<a href=\"https://nightly.capillary.in/analytics/v2/report/59c37820e626a10df78c8d91?snapshot=59c8bce750f4e75ec8b0d24c\" style=\"background: #009e0f; text-align: center; color: #fff; font-size: 16px; padding: 10px 25px; cursor: pointer; text-decoration: none; display: block; width: 120px; margin: 25px auto 15px;\" target=\"_blank\">View Report</a></div> \t\t\t<div class=\"email-footer\"> \t\t\t<p style=\"color:grey; font-size:12px; text-align:center\">You&#39;ve received this mail because you subscribed to Schedule Test schedule of redDart Report. <a href=\"https://nightly.capillary.in/analytics/v2/report/59c37820e626a10df78c8d91/schedule/59c8bce750f4e75ec8b0d24c/unsubscribeSchedule\" style=\"color: blue; cursor: pointer;\" target=\"_blank\">Unsubscribe</a></p> \t\t\t<p><a href=\"http://capillarytech.com/privacy-policy/\" target=\"_blank\">Privacy Policy</a> | <a href=\"http://capillarytech.com/about-us/\" target=\"_blank\">About Capillary</a></p> \t\t\t</div> \t\t\t</td> \t\t</tr> \t</tbody> </table> </body> </html> ","is_drag_drop":false,"drag_drop_id":null},"secondary_templates":[{"is_preview_generated":null,"preview_url":null,"is_favourite":null,"is_drag_drop":false,"drag_drop_id":null,"scope":null,"tag":null,"is_default":null,"html_content":"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <html> <head> \t<title>Scheduled Report</title> \t<meta http-equiv=\"Content-Type\" content=\"text/html charset=UTF-8\"/> \t<style type=\"text/css\">.container-main p{line-height: 1.6;}@media screen and (max-width: 480px){a.brand{font-size: 35px;}}@media screen and (max-width: 480px){.container-main a{text-align: center;}a.brand{text-align: center;}}a.brand img{vertical-align: middle; padding: 0 8px 0 0; width: 250px;}@media screen and (max-width: 480px){a.brand img{width: 220px !important;}}@media screen and (max-width: 480px){.container-content{padding: 15px 20px; font-size: 12px !important;} .email-footer{font-size: 12px !important;}}.container-content table{border-collapse: collapse;}.container-content table tr td p{margin: 5px;}.container-content table tr td p span{font-weight: bold; padding: 0 3px 0 0;}@media screen and (max-width: 480px){a.btn-view-reports{margin: 25px auto 10px;}}a.btn-view-reports:hover{background: grey; color: #fff;}.email-footer p{text-align: center; font-size: 12px; color: grey;}.email-footer p a{color: blue; cursor: pointer;}.email-footer p a:hover{color: grey;} \t</style> </head> <body><center>\n\t\t\t\t\t\t\t\t\t\tIf you have difficulties viewing this mail, click\n\t\t\t\t\t\t\t\t\t\t<a href=\"https://nightly.capillary.in/business_controller/campaigns/emails/links/view.php?utrack={{user_id_b64}}&mtrack={{outbox_id_b64}}\" style = \"text-decoration: underline;color: #369;\" target=\"_blank\">here</a><br/>\n\t\t\t\t\t\t\t\t\t</center> <table class=\"container-main\" style=\"background:#eeeeee; color:#000000; font-family:'Open Sans',sans-serif; font-size:16px; font-weight:400; margin:0 auto; max-width:978px; padding:15px; width:100%\"> \t<tbody> \t\t<tr> \t\t\t<td> \t\t\t<table class=\"email-header\" style=\"background:#ffffff; margin:0 0 5px; padding:17px 0; width:100%\"> \t\t\t\t<tbody> \t\t\t\t\t<tr> \t\t\t\t\t\t<td style=\"width:100%\"><a class=\"brand\" href=\"#\" style=\"display: table; margin: 0 auto; text-decoration: none; font-size: 37px; color: grey;\"><img alt=\"Capillary Technologies\" src=\"https://s3.amazonaws.com/fileservice.in/intouch_creative_assets/60221e2020ba572f6787.png\" /> </a></td> \t\t\t\t\t</tr> \t\t\t\t</tbody> \t\t\t</table> \t\t\t<div class=\"container-content\" style=\"background:#ffffff; padding:20px 35px\"> \t\t\t<p>Hi Ashish Karan,</p> \t\t\t<p>You&#39;ve received a new scheduled report. {{unsubscribe}}</p> \t\t\t<table> \t\t\t\t<tbody> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Org Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>autotest1</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Scheduled Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>Schedule Test</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Time Period: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>1st Jan, 2017 to 24th Sep, 2017</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Report Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>redDart Report</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t</tbody> \t\t\t</table> \t\t\t<p style=\"font-size:15px; margin-top:25px\">By clicking &quot;View Report&quot; you will be redirected to Capillary Analytics to view the automated report.</p> \t\t\t<a href=\"https://nightly.capillary.in/analytics/v2/report/59c37820e626a10df78c8d91?snapshot=59c8bce750f4e75ec8b0d24c\" style=\"background: #009e0f; text-align: center; color: #fff; font-size: 16px; padding: 10px 25px; cursor: pointer; text-decoration: none; display: block; width: 120px; margin: 25px auto 15px;\" target=\"_blank\">View Report</a></div> \t\t\t<div class=\"email-footer\"> \t\t\t<p style=\"color:grey; font-size:12px; text-align:center\">You&#39;ve received this mail because you subscribed to Schedule Test schedule of redDart Report. <a href=\"https://nightly.capillary.in/analytics/v2/report/59c37820e626a10df78c8d91/schedule/59c8bce750f4e75ec8b0d24c/unsubscribeSchedule\" style=\"color: blue; cursor: pointer;\" target=\"_blank\">Unsubscribe</a></p> \t\t\t<p><a href=\"http://capillarytech.com/privacy-policy/\" target=\"_blank\">Privacy Policy</a> | <a href=\"http://capillarytech.com/about-us/\" target=\"_blank\">About Capillary</a></p> \t\t\t</div> \t\t\t</td> \t\t</tr> \t</tbody> </table> </body> </html> ","secondary_template_id":"9500","is_base_template":1,"language_name":"English","language":"English","lang_id":"69"}],"edit":true,"tags":[]};
2019
2632
  // const data = {edit: true, "base":{"subject":"testsubject","html_content":"<html> <head> \t<meta charset=\"utf-8\" /> \t<title>Aster Secure</title> \t<style type=\"text/css\">#outlook a { padding: 0; } body { width: 100% !important; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; margin: 0; padding: 0;} .ExternalClass { width: 100%; } .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; } #backgroundTable { margin: 0; padding: 0; width: 100% !important; line-height: 100% !important; } img { outline: none; text-decoration: none; border: none; -ms-interpolation-mode: bicubic; } a img { border: none; } .image_fix { display: block; } p { margin: 0px 0px !important; } table td { border-collapse: collapse; } table { border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; } table[class=full] { width: 100%; clear: both; } table[class=spacetable] { height: 176px; } table[class=spacetable1] { height: 431px; } table[class=spacetable2] { height: 50px; } table[class=spacetable3] { height: 55px; } \t @media only screen and (min-width: 320px) and (max-width: 540px) { a[href^=\"tel\"], a[href^=\"sms\"] { text-decoration: none; color: #ffffff; pointer-events: none; cursor: default; } .mobile_link a[href^=\"tel\"], .mobile_link a[href^=\"sms\"] { text-decoration: default; color: #ffffff !important; pointer-events: auto; cursor: default; } img[class=logo] { width: 132px!important; } img[class=shop] { width:53px!important; text-align: center!important; } table[class=innerlayer] { width: 300px !important; text-align: center; } img[class=spot] { width: 65px!important; } img[class=banner] { width: 290px !important; text-align: center; } img[class=banner1] { width: 229px!important; } img[class=click] { width:55px!important; } img[class=border] { width: 290px!important; } td[class=txtfont] { font-size:11px!important; height:50px!important; line-height: 15px!important; } \t span[class=txtfont] { font-size:9px!important; height:98px!important; line-height:23px!important; } \t td[class=txtfont1] { font-size:11px!important; height:40px!important; line-height: 14px!important; } img[class=left] { width:195px!important; } img[class=right] { width:46px!important; } \t \t td[class=txtfont3] { font-size:8px!important;} \ttd[class=txtfont2] { font-size:6px!important; line-height:9px!important; } td[class=txtbold] { font-size: 21px!important; } img[class=gap] { width:92px!important; } img[class=gap1] { width: 20px!important; } table[class=social] { width: 99% !important; } img[class=fb] { width:20px!important; } img[class=in] { width:21px!important; } img[class=tw] { width:20px!important; } img[class=pin] { width:41px!important; } \t img[class=and] { width:81px!important; } img[class=my] { width: 44px!important; } \t img[class=you] { width:21px!important; } img[class=store] { width:65px!important; } \t \t img[class=snap] { width:24px!important; } td[class=textlen] { height:52px!important; } \ttd[class=tdlen] \t{ \theight:35px!important;font-size: 10px !important; \t} \t\t\timg[class=a] { width: 42px!important; } \t\t\timg[class=b] { width: 22px!important; } \t\t\timg[class=c] { width: 72px!important; } \t\t\timg[class=d] { width: 50px!important; } \t\t\timg[class=e] { width: 56px!important; } \t\t\timg[class=f] { width: 56px!important; } \t\t\t} \t</style> </head> <body><center>\n\t\t\t\t\t\t\t\t\t\tIf you have difficulties viewing this mail, click\n\t\t\t\t\t\t\t\t\t\t<a href=\"https://nightly.capillary.in/business_controller/campaigns/emails/links/view.php?utrack={{user_id_b64}}&mtrack={{outbox_id_b64}}\" style = \"text-decoration: underline;color: #369;\" target=\"_blank\">here</a><br/>\n\t\t\t\t\t\t\t\t\t</center> <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"outerlayer\" style=\"width:650px\"> \t<tbody> \t\t<tr> \t\t\t<td> \t\t\t<table align=\"center\" bgcolor=\"#fff\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"outerlayer\" style=\"width:650px\"> \t\t\t\t<tbody> \t\t\t\t\t<tr> \t\t\t\t\t\t<td class=\"txtfont2\" height=\"40\" style=\"font-family: Verdana, Geneva, sans-serif; text-align:center; font-size:11px; color:gray; line-height:13px;\" width=\"600\">Shop at Aster Pharmacy this month and You could be the next lucky winner!</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><a href=\"#\" style=\"pointer-events:none;\"><img class=\"banner\" src=\"https://s3-eu-west-1.amazonaws.com/fs.capillary.eu/intouch_creative_assets/890bdffee3b2322d8ec7.jpg\" style=\"border:none; display:block\" /></a></td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td class=\"txtfont2\" height=\"40\" style=\"font-family: Verdana, Geneva, sans-serif; text-align:center; font-size:11px; color:gray; line-height:13px;\" width=\"600\">To remove your email address from our mailing list , please click on {{unsubscribe}}</td> \t\t\t\t\t</tr> \t\t\t\t</tbody> \t\t\t</table> \t\t\t</td> \t\t</tr> \t</tbody> </table> </body> </html> ","is_drag_drop":0,"drag_drop_id":null},"secondary_templates":[{"is_preview_generated":null,"preview_url":null,"is_favourite":null,"is_drag_drop":false,"drag_drop_id":null,"scope":null,"tag":null,"is_default":null,"html_content":"<html>\r\n<head>\r\n\t<meta charset=\"utf-8\" />\r\n\t<title>Aster Secure</title>\r\n\t<style type=\"text/css\">#outlook a { padding: 0; } body { width: 100% !important; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; margin: 0; padding: 0;} .ExternalClass { width: 100%; } .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; } #backgroundTable { margin: 0; padding: 0; width: 100% !important; line-height: 100% !important; } img { outline: none; text-decoration: none; border: none; -ms-interpolation-mode: bicubic; } a img { border: none; } .image_fix { display: block; } p { margin: 0px 0px !important; } table td { border-collapse: collapse; } table { border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; } table[class=full] { width: 100%; clear: both; } table[class=spacetable] { height: 176px; } table[class=spacetable1] { height: 431px; } table[class=spacetable2] { height: 50px; } table[class=spacetable3] { height: 55px; } \t @media only screen and (min-width: 320px) and (max-width: 540px) { a[href^=\"tel\"], a[href^=\"sms\"] { text-decoration: none; color: #ffffff; pointer-events: none; cursor: default; } .mobile_link a[href^=\"tel\"], .mobile_link a[href^=\"sms\"] { text-decoration: default; color: #ffffff !important; pointer-events: auto; cursor: default; } img[class=logo] { width: 132px!important; } img[class=shop] { width:53px!important; text-align: center!important; } table[class=innerlayer] { width: 300px !important; text-align: center; } img[class=spot] { width: 65px!important; } img[class=banner] { width: 290px !important; text-align: center; } img[class=banner1] { width: 229px!important; } img[class=click] { width:55px!important; } img[class=border] { width: 290px!important; } td[class=txtfont] { font-size:11px!important; height:50px!important; line-height: 15px!important; } \t span[class=txtfont] { font-size:9px!important; height:98px!important; line-height:23px!important; } \t td[class=txtfont1] { font-size:11px!important; height:40px!important; line-height: 14px!important; } img[class=left] { width:195px!important; } img[class=right] { width:46px!important; } \t \t td[class=txtfont3] { font-size:8px!important;} \ttd[class=txtfont2] { font-size:6px!important; line-height:9px!important; } td[class=txtbold] { font-size: 21px!important; } img[class=gap] { width:92px!important; } img[class=gap1] { width: 20px!important; } table[class=social] { width: 99% !important; } img[class=fb] { width:20px!important; } img[class=in] { width:21px!important; } img[class=tw] { width:20px!important; } img[class=pin] { width:41px!important; } \t img[class=and] { width:81px!important; } img[class=my] { width: 44px!important; } \t img[class=you] { width:21px!important; } img[class=store] { width:65px!important; } \t \t img[class=snap] { width:24px!important; } td[class=textlen] { height:52px!important; } \ttd[class=tdlen] \t{ \theight:35px!important;font-size: 10px !important; \t} \t\t\timg[class=a] { width: 42px!important; } \t\t\timg[class=b] { width: 22px!important; } \t\t\timg[class=c] { width: 72px!important; } \t\t\timg[class=d] { width: 50px!important; } \t\t\timg[class=e] { width: 56px!important; } \t\t\timg[class=f] { width: 56px!important; } \t\t\t}\r\n\t</style>\r\n</head>\r\n<body>\r\n<table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"outerlayer\" style=\"width:650px\">\r\n\t<tbody>\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t<table align=\"center\" bgcolor=\"#fff\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"outerlayer\" style=\"width:650px\">\r\n\t\t\t\t<tbody>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td class=\"txtfont2\" height=\"40\" style=\"font-family: Verdana, Geneva, sans-serif; text-align:center; font-size:11px; color:gray; line-height:13px;\" width=\"600\">Shop at Aster Pharmacy this month and You could be the next lucky winner!</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td><a href=\"#\" style=\"pointer-events:none;\"><img class=\"banner\" src=\"https://s3-eu-west-1.amazonaws.com/fs.capillary.eu/intouch_creative_assets/890bdffee3b2322d8ec7.jpg\" style=\"border:none; display:block\" /></a></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td class=\"txtfont2\" height=\"40\" style=\"font-family: Verdana, Geneva, sans-serif; text-align:center; font-size:11px; color:gray; line-height:13px;\" width=\"600\">To remove your email address from our mailing list , please click on {{unsubscribe}}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</tbody>\r\n\t\t\t</table>\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</tbody>\r\n</table>\r\n</body>\r\n</html>\r\n","secondary_template_id":"9584","is_base_template":1,"language_name":"English","language":"English","lang_id":"69"}, {"is_preview_generated":null,"preview_url":null,"is_favourite":null,"is_drag_drop":false,"drag_drop_id":null,"scope":null,"tag":null,"is_default":null,"html_content":"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <html> <head> \t<title>Scheduled Report</title> \t<meta http-equiv=\"Content-Type\" content=\"text/html charset=UTF-8\"/> \t<style type=\"text/css\">.container-main p{line-height: 1.6;}@media screen and (max-width: 480px){a.brand{font-size: 35px;}}@media screen and (max-width: 480px){.container-main a{text-align: center;}a.brand{text-align: center;}}a.brand img{vertical-align: middle; padding: 0 8px 0 0; width: 250px;}@media screen and (max-width: 480px){a.brand img{width: 220px !important;}}@media screen and (max-width: 480px){.container-content{padding: 15px 20px; font-size: 12px !important;} .email-footer{font-size: 12px !important;}}.container-content table{border-collapse: collapse;}.container-content table tr td p{margin: 5px;}.container-content table tr td p span{font-weight: bold; padding: 0 3px 0 0;}@media screen and (max-width: 480px){a.btn-view-reports{margin: 25px auto 10px;}}a.btn-view-reports:hover{background: grey; color: #fff;}.email-footer p{text-align: center; font-size: 12px; color: grey;}.email-footer p a{color: blue; cursor: pointer;}.email-footer p a:hover{color: grey;} \t</style> </head> <body><center>\n\t\t\t\t\t\t\t\t\t\tIf you have difficulties viewing this mail, click\n\t\t\t\t\t\t\t\t\t\t<a href=\"https://nightly.capillary.in/business_controller/campaigns/emails/links/view.php?utrack={{user_id_b64}}&mtrack={{outbox_id_b64}}\" style = \"text-decoration: underline;color: #369;\" target=\"_blank\">here</a><br/>\n\t\t\t\t\t\t\t\t\t</center> <table class=\"container-main\" style=\"background:#eeeeee; color:#000000; font-family:'Open Sans',sans-serif; font-size:16px; font-weight:400; margin:0 auto; max-width:978px; padding:15px; width:100%\"> \t<tbody> \t\t<tr> \t\t\t<td> \t\t\t<table class=\"email-header\" style=\"background:#ffffff; margin:0 0 5px; padding:17px 0; width:100%\"> \t\t\t\t<tbody> \t\t\t\t\t<tr> \t\t\t\t\t\t<td style=\"width:100%\"><a class=\"brand\" href=\"#\" style=\"display: table; margin: 0 auto; text-decoration: none; font-size: 37px; color: grey;\"><img alt=\"Capillary Technologies\" src=\"https://s3.amazonaws.com/fileservice.in/intouch_creative_assets/60221e2020ba572f6787.png\" /> </a></td> \t\t\t\t\t</tr> \t\t\t\t</tbody> \t\t\t</table> \t\t\t<div class=\"container-content\" style=\"background:#ffffff; padding:20px 35px\"> \t\t\t<p>Hi Ashish Karan,</p> \t\t\t<p>You&#39;ve received a new scheduled report. {{unsubscribe}}</p> \t\t\t<table> \t\t\t\t<tbody> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Org Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>autotest1</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Scheduled Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>Schedule Test</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Time Period: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>1st Jan, 2017 to 24th Sep, 2017</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td><strong>Report Name: </strong></td> \t\t\t\t\t\t<td> \t\t\t\t\t\t<p>redDart Report</p> \t\t\t\t\t\t</td> \t\t\t\t\t</tr> \t\t\t\t</tbody> \t\t\t</table> \t\t\t<p style=\"font-size:15px; margin-top:25px\">By clicking &quot;View Report&quot; you will be redirected to Capillary Analytics to view the automated report.</p> \t\t\t<a href=\"https://nightly.capillary.in/analytics/v2/report/59c37820e626a10df78c8d91?snapshot=59c8bce750f4e75ec8b0d24c\" style=\"background: #009e0f; text-align: center; color: #fff; font-size: 16px; padding: 10px 25px; cursor: pointer; text-decoration: none; display: block; width: 120px; margin: 25px auto 15px;\" target=\"_blank\">View Report</a></div> \t\t\t<div class=\"email-footer\"> \t\t\t<p style=\"color:grey; font-size:12px; text-align:center\">You&#39;ve received this mail because you subscribed to Schedule Test schedule of redDart Report. <a href=\"https://nightly.capillary.in/analytics/v2/report/59c37820e626a10df78c8d91/schedule/59c8bce750f4e75ec8b0d24c/unsubscribeSchedule\" style=\"color: blue; cursor: pointer;\" target=\"_blank\">Unsubscribe</a></p> \t\t\t<p><a href=\"http://capillarytech.com/privacy-policy/\" target=\"_blank\">Privacy Policy</a> | <a href=\"http://capillarytech.com/about-us/\" target=\"_blank\">About Capillary</a></p> \t\t\t</div> \t\t\t</td> \t\t</tr> \t</tbody> </table> </body> </html> ","secondary_template_id":"9500","is_base_template":false,"language_name":"Hindi","language":"Hindi","lang_id":"151"},{"is_preview_generated":null,"preview_url":null,"is_favourite":null,"is_drag_drop":1,"drag_drop_id":"55acf47048a85bbf7681a35a","scope":null,"tag":null,"is_default":null,"html_content":"","secondary_template_id":"9500","is_base_template":0,"language_name":"Japanese","language":"Japanese","lang_id":"100"}]};
2020
-
2633
+ console.log('Start template creation ', data, this.props.location.query.isLanguageSupport, this.props.location.query.type === 'embedded', this.props.location.query.type === 'embedded' && !this.props.location.query.isLanguageSupport);
2021
2634
  if (data && data.edit) {
2635
+ console.log('startTemplateCreation');
2022
2636
  // const formData = {'0': {}};
2023
2637
  const formData = _.cloneDeep(this.state.formData);
2024
2638
  formData[0].selectedLanguages = [];
2025
2639
  let tabKey;
2026
- if ((this.props.location.query.isLanguageSupport === undefined || this.props.location.query.isLanguageSupport === 'false')) {
2640
+ if (this.props.location.query.type === 'embedded' && (this.props.location.query.isLanguageSupport === undefined || this.props.location.query.isLanguageSupport === 'false')) {
2027
2641
  formData['template-subject'] = data.base.subject ? data.base.subject : '';
2028
- const baseLanguage = this.props.currentOrgDetails.basic_details.base_language;
2642
+ const baseLanguage = this.props.Global.currentOrgDetails.basic_details.base_language;
2029
2643
  let languageIndex = _.findIndex(this.supportedLanguages, {iso_code: baseLanguage});
2030
-
2644
+ console.log("startTemplatecreation before index", languageIndex, this.supportedLanguages, baseLanguage, formData);
2031
2645
  if (languageIndex === -1) {
2032
2646
  languageIndex = 0;
2033
2647
  }
@@ -2043,9 +2657,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2043
2657
  formData[0][this.supportedLanguages[languageIndex].iso_code] = tempData;
2044
2658
  formData[0].activeTab = this.supportedLanguages[languageIndex].iso_code;
2045
2659
  tabKey = "2";
2660
+ console.log("start Template creation midway data", formData, languageIndex);
2046
2661
  } else {
2047
2662
  const additionalLanguages = [];
2048
2663
  _.forEach(data.secondary_templates, (templates) => {
2664
+ console.log('creating form data', templates);
2049
2665
  const id = "1";
2050
2666
  tabKey = id;
2051
2667
  let languageIndex = _.findIndex(this.supportedLanguages, {language: templates.language});
@@ -2065,10 +2681,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2065
2681
  }
2066
2682
  // formData.usingTabContainer = true;
2067
2683
  // formData.tabCount = 1;
2068
-
2684
+ console.log('Language Index ', languageIndex, this.supportedLanguages);
2069
2685
  // formData[0].tabkey = "1";
2070
2686
  // formData[0] = {};
2071
- // formData[0].activeTab = this.props.currentOrgDetails.basic_details.base_language;
2687
+ // formData[0].activeTab = this.props.Global.currentOrgDetails.basic_details.base_language;
2072
2688
  formData[0].base = true;
2073
2689
  formData[0].selectedLanguages.push(this.supportedLanguages[languageIndex].iso_code);
2074
2690
  formData[0][this.supportedLanguages[languageIndex].iso_code] = tempData;
@@ -2082,7 +2698,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2082
2698
  this.addLanguage(false, formData, false, additionalLanguages);
2083
2699
  }
2084
2700
  formData.base = _.cloneDeep(formData[0]);
2085
-
2701
+ console.log('startTemplateCreation final ', formData);
2086
2702
  this.setState({formData, loading: false, injectedTags: data.tags, tabKey, isDragDrop: (data.base.is_drag_drop !== 0 )}, () => {
2087
2703
  // this.setState({tabKey: ''});
2088
2704
  _.forEach(formData[0].selectedLanguages, (language) => {
@@ -2098,6 +2714,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2098
2714
  }
2099
2715
 
2100
2716
  startLoading = (ifEdit) => {
2717
+ console.log('startLoading', ifEdit);
2101
2718
  if (ifEdit) {
2102
2719
  this.setState({loading: true});
2103
2720
  }
@@ -2132,10 +2749,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2132
2749
  }
2133
2750
  temp.injectedEvents = {};
2134
2751
  _.forEach(col.supportedEvents, (event) => {
2135
- //
2752
+ // console.log('injected event for ', col, event, this.getMappedEvent(col.id, event));
2136
2753
  temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
2137
2754
  });
2138
- //
2755
+ // console.log('should translate multicol', temp);
2139
2756
  if (temp.type === 'icon') {
2140
2757
  return true;
2141
2758
  }
@@ -2166,7 +2783,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2166
2783
  _.forEach(col.supportedEvents, (event) => {
2167
2784
  temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
2168
2785
  });
2169
- //
2786
+ // console.log('should translate multicol action', temp);
2170
2787
  if (temp.type === 'icon') {
2171
2788
  return true;
2172
2789
  }
@@ -2200,7 +2817,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2200
2817
  _.forEach(inputField.supportedEvents, (event) => {
2201
2818
  temp.injectedEvents[event] = this.getMappedEvent(inputField.id, event);
2202
2819
  });
2203
- //
2820
+ // console.log('should translate collabel', temp);
2204
2821
  if (temp.type === 'icon') {
2205
2822
  return true;
2206
2823
  }
@@ -2229,7 +2846,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2229
2846
  _.forEach(actionField.supportedEvents, (event) => {
2230
2847
  temp.injectedEvents[event] = this.getMappedEvent(actionField.id, event);
2231
2848
  });
2232
- //
2849
+ // console.log('should translate collabel action', temp);
2233
2850
  if (temp.type === 'icon') {
2234
2851
  return true;
2235
2852
  }
@@ -2281,7 +2898,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2281
2898
  saveFormData = (passedData) => {
2282
2899
  //Logic to save in db etc
2283
2900
  // const isValidated = this.validateFormData(formData);
2284
- //
2901
+ // console.log('whyyyy');
2285
2902
  // if (!isValidated) {
2286
2903
  // return;
2287
2904
  // }
@@ -2289,26 +2906,26 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2289
2906
  // this.saveValidationData();
2290
2907
  // return;
2291
2908
  //}
2292
-
2909
+ console.log('save form data', passedData, this.state.gettingFormData, this.state.startValidation, this.state);
2293
2910
  if (this.state.gettingFormData) {
2911
+ console.log('posting final result', passedData);
2294
2912
  const response = {
2295
2913
  action: "getFormData",
2296
2914
  postAction: this.state.getFormDataValue || 'next',
2297
2915
  value: this.transformFormData(passedData),
2298
2916
  validity: this.state.isFormValid,
2299
- type: 'EMAIL',
2300
2917
  };
2301
-
2918
+ console.log('Get Data', response);
2302
2919
  this.setState({checkValidation: true});
2303
2920
  if (this.props.location.query.module === 'library' && this.props.isGetFormData) {
2304
2921
  this.props.getFormSubscriptionData(response);
2305
2922
  }
2306
2923
  parent.postMessage(JSON.stringify(response), "*");
2307
- this.setState({gettingFormData: false, startValidation: false, loading: true});
2924
+ this.setState({gettingFormData: false, startValidation: false});
2308
2925
  return;
2309
2926
  }
2310
2927
  const formData = _.cloneDeep(passedData);
2311
-
2928
+ console.log('Saving form data', JSON.stringify(formData), this.state.tabCount);
2312
2929
  const obj = {};
2313
2930
  obj.versions = {
2314
2931
  base: {},
@@ -2318,13 +2935,13 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2318
2935
  obj._id = this.props.Email.templateDetails._id;
2319
2936
  }
2320
2937
  obj.type = 'EMAIL';
2321
- const baseLanguage = this.props.currentOrgDetails.basic_details.base_language;
2938
+ const baseLanguage = this.props.Global.currentOrgDetails.basic_details.base_language;
2322
2939
  let baseKey = -1;
2323
2940
  //let saveCount = 0;
2324
-
2941
+ console.log('all data', this.state.currentTab);
2325
2942
  _.forEach(formData, (data, index) => {
2326
2943
  const newdata = data;
2327
-
2944
+ console.log('all data 2', newdata, index);
2328
2945
  if (!isNaN(index) && newdata) {
2329
2946
  const baseLangTabKey = newdata[baseLanguage].tabKey;
2330
2947
  newdata.tabKey = baseLangTabKey;
@@ -2333,9 +2950,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2333
2950
  baseKey = baseLangTabKey;
2334
2951
  }
2335
2952
  _.forEach(newdata.selectedLanguages, (language) => {
2336
- //
2953
+ // console.log('all data 3', newdata[language], language, this.state.currentTab, index, (index + 1), (index + 1) === this.state.currentTab, newdata[language].is_drag_drop);
2337
2954
  // if (newdata[language].is_drag_drop && ((parseInt(index, 10) + 1) === this.state.currentTab)) {
2338
- //
2955
+ // console.log('all data 4');
2339
2956
  // saveCount += 1;
2340
2957
  // }
2341
2958
  if (newdata[language].is_drag_drop) {
@@ -2355,15 +2972,15 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2355
2972
  delete obj.versions.base[language].edmeditorsrc;
2356
2973
  }
2357
2974
  });
2358
-
2975
+ console.log('obj', obj);
2359
2976
  // if (saveCount === 0) {
2360
-
2361
- this.props.actions.createTemplate(obj, this.onUpdateTemplateComplete);
2977
+ console.log('final save obj', obj);
2978
+ this.props.actions.createTemplate(obj);
2362
2979
  // } else {
2363
2980
  // this.setState({saveObj: obj, targetSaveCount: saveCount, mode: "save", saveEdmDataMode: 'save'}, () => {
2364
2981
  // _.forEach(data.selectedLanguages, (language, langIndex) => {
2365
2982
  // if (data[language].is_drag_drop) {
2366
- //
2983
+ // console.log('saving edm template', document.getElementById("edmeditor"), `edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`);
2367
2984
  // const win = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`).contentWindow;
2368
2985
  // win.postMessage("saveProject", '*');
2369
2986
  // }
@@ -2371,12 +2988,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2371
2988
  // });
2372
2989
  // }
2373
2990
  }
2991
+
2374
2992
  handleOk = () => {
2375
2993
  const formData = _.cloneDeep(this.state.formData);
2376
2994
  const activeLangTab = formData[`${this.state.currentTab - 1}`].activeTab;
2377
2995
  const langIndex = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(activeLangTab);
2378
-
2996
+ console.log('switching editor midway', activeLangTab, langIndex, formData);
2379
2997
  this.setState({mode: "switchEditor"}, () => {
2998
+ console.log('posting message for switching editor', `edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`);
2380
2999
  const win = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`).contentWindow;
2381
3000
  win.postMessage("saveProject", '*');
2382
3001
  });
@@ -2395,6 +3014,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2395
3014
  }
2396
3015
 
2397
3016
  toggleEdmEmailTemplateSelection = () => {
3017
+ console.log('toggle Selection ', this.state.showEdmEmailTemplates);
2398
3018
  this.setState( (prevState) => ({
2399
3019
  showEdmEmailTemplates: !prevState.showEdmEmailTemplates}), () => {
2400
3020
  if (this.state.showEdmEmailTemplates) {
@@ -2412,7 +3032,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2412
3032
  // const isEdmSupport = (this.props.location.query.isEdmSupport) ? this.props.location.query.isEdmSupport : true;
2413
3033
  // let getQuery = '';
2414
3034
  const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
2415
-
3035
+ console.log('Selected EDM Data ', data, this.state.formData[this.state.currentTab - 1].activeTab);
2416
3036
  this.props.actions.getCmsSetting('edm', data.versions.base.drag_drop_id, 'create', this.state.formData[this.state.currentTab - 1].activeTab, isEdmSupport);
2417
3037
  // this.props.templatesActions.setEdmTemplate(data);
2418
3038
  this.toggleEdmEmailTemplateSelection();
@@ -2428,21 +3048,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2428
3048
  }
2429
3049
  };
2430
3050
 
2431
- isEmailLoading = () => {
2432
- //let {isLoading} = this.props;
2433
- let isLoading = this.props.isLoadingMetaEntities || this.state.loading || (this.props.Email && "createTemplateInProgress" in this.props.Email && this.props.Email.createTemplateInProgress) || (this.props.Email.assetUploading !== undefined && this.props.Email.assetUploading);
2434
-
2435
- if (!isLoading) {
2436
- isLoading = this.state.loadingStatus < 2;
2437
- }
2438
- // if (isLoading) {
2439
- // this.props.creativesContainerActions.hideCreativesContanerLoader();
2440
- // }
2441
- if (!isLoading && this.props.setIsLoadingContent) {
2442
- this.props.setIsLoadingContent(isLoading);
2443
- }
2444
- return isLoading;
2445
- }
2446
3051
  renderConfirmationModal() {
2447
3052
  const modal = (
2448
3053
  <Modal
@@ -2464,10 +3069,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2464
3069
  </Modal>);
2465
3070
  return modal;
2466
3071
  }
3072
+
2467
3073
  render() {
2468
3074
  // const pageHeading = (this.state.isEdit) ? this.props.intl.formatMessage(messages.editHeading) : this.props.intl.formatMessage(messages.createHeading);
2469
3075
  // const actionComponents = '';
2470
-
3076
+ console.log('supported languages', this.supportedLanguages);
2471
3077
  const filterContent = (
2472
3078
  <div className="action-container" style={{ display: 'inline-flex', width: '100%'}}>
2473
3079
  <div style={{ marginTop: '8px', width: '50%'}}>
@@ -2501,7 +3107,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2501
3107
  </div>
2502
3108
  );
2503
3109
  const schema = this.state.schema;
2504
- const isLoading = this.isEmailLoading();
3110
+ const spinning = this.state.loading || (this.props.Email && "createTemplateInProgress" in this.props.Email && this.props.Email.createTemplateInProgress) || (this.props.Email.assetUploading !== undefined && this.props.Email.assetUploading);
2505
3111
  const previewHeader = (<h3>Email Preview</h3>);
2506
3112
  const imagePreviewHeader = (<h3>Image Selection</h3>);
2507
3113
  const imagePreviewContent = (
@@ -2522,16 +3128,15 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2522
3128
  onItemClick={this.handleOnItemClick}
2523
3129
  colNumber={2}
2524
3130
  enablePagination
2525
- isLoading={this.props.Email.fetchingAllAssets}
2526
3131
  />
2527
3132
  </Pagination>
2528
3133
  </div>
2529
3134
  );
2530
-
2531
- if (!this.props.currentOrgDetails || !this.props.currentOrgDetails.basic_details) {
3135
+ console.log('Render Form Data ', this.state.formData, this.supportedLanguages, this.state);
3136
+ if (!this.props.Global.currentOrgDetails || !this.props.Global.currentOrgDetails.basic_details) {
2532
3137
  return (<div>Loading...</div>);
2533
3138
  }
2534
-
3139
+ console.log('CMS Data ', this.props.Email.CmsSettings, this.props.Global.currentOrgDetails.basic_details.supported_languages);
2535
3140
  let loaderText = this.props.Email.createTemplateInProgress ? this.props.intl.formatMessage(messages.saveTemplateLoader) : this.props.intl.formatMessage(messages.templateLoader);
2536
3141
  if (this.props.Email.assetUploading) {
2537
3142
  loaderText = this.props.intl.formatMessage(messages.uploadingImage);
@@ -2542,15 +3147,43 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2542
3147
  }
2543
3148
  return (
2544
3149
  <div className="email-container">
2545
-
3150
+ <Helmet
3151
+ title="Email"
3152
+ meta={[
3153
+ { name: 'description', content: 'Description of Email' },
3154
+ ]}
3155
+ />
2546
3156
  {/* <PageHeader pageHeading={pageHeading} /> */}
2547
- <CapSpin tip={loaderText} spinning={isLoading}>
2548
-
3157
+ <Spin tip={loaderText} spinning={spinning}>
3158
+ {this.props.location.query.type !== 'embedded' && <Row>
3159
+ <Col span={24}>
3160
+ {this.props.location.query.type !== "embedded" &&
3161
+ <Breadcrumb>
3162
+ <BreadcrumbItem>Campaigns</BreadcrumbItem>
3163
+ <BreadcrumbItem>Creatives</BreadcrumbItem>
3164
+ <BreadcrumbItem>Email</BreadcrumbItem>
3165
+ </Breadcrumb>
3166
+ }
3167
+ </Col>
3168
+ </Row>}
2549
3169
  <Row>
2550
3170
  <Col>
3171
+ {/* <input type="file" id="filename" style={{ display: 'none'}} accept="text/html" onChange={(event) => this.openFile(event)} /><br/> */}
3172
+ {/* <CKEditor
3173
+ content={this.state.content}
3174
+ config={{}}
3175
+ events={this.state.events}
3176
+ /> */}
3177
+ {/* { (!this.props.Email.fetchingCmsSettings && !this.props.Email.fetchingCmsSettingsError &&
3178
+ !_.isEmpty(this.props.Email.CmsSettings) && this.props.Email.CmsSettings.url) ?
3179
+ <EDMEditor
3180
+ content={'Hello World'}
3181
+ getEditorInstanse={this.getEditorInstanse}
3182
+ edmSrc={this.props.Email.CmsSettings.url}
3183
+ /> : ''
3184
+ } */}
2551
3185
  { !_.isEmpty(schema) && (this.state.formData[0] || this.state.formData["0"]) ?
2552
3186
  <FormBuilder
2553
- isFullMode={this.props.isFullMode}
2554
3187
  schema={schema}
2555
3188
  onSubmit={this.saveFormData}
2556
3189
  onChange={this.onFormDataChange}
@@ -2574,8 +3207,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2574
3207
  isEdit={this.state.isEdit}
2575
3208
  iframeParent={parent}
2576
3209
  router={this.props.router}
2577
- baseLanguage={this.props.currentOrgDetails.basic_details.base_language}
2578
- supportedLanguages={this.getSupportedLanguages(this.props)}
3210
+ baseLanguage={this.props.Global.currentOrgDetails.basic_details.base_language}
3211
+ supportedLanguages={this.props.Global.currentOrgDetails.basic_details.supported_languages}
2579
3212
  isSchemaChanged={this.state.isSchemaChanged}
2580
3213
  cmsTemplates={this.props.Templates.cmsTemplates}
2581
3214
  getCmsTemplatesInProgress={this.props.Templates.getCmsTemplatesInProgress}
@@ -2591,7 +3224,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2591
3224
  /> : ''}
2592
3225
  </Col>
2593
3226
  </Row>
2594
- </CapSpin>
3227
+ </Spin>
2595
3228
  {!_.isEmpty(this.state.formData[(this.state.currentTab - 1)]) && <EmailPreview
2596
3229
  header={previewHeader}
2597
3230
  content={this.state.formData[(this.state.currentTab - 1)][this.state.formData[(this.state.currentTab - 1)].activeTab] ? this.state.formData[(this.state.currentTab - 1)][this.state.formData[(this.state.currentTab - 1)].activeTab][`template-content`] : ''}
@@ -2623,6 +3256,7 @@ Email.propTypes = {
2623
3256
  location: PropTypes.object,
2624
3257
  intl: intlShape.isRequired,
2625
3258
  metaEntities: PropTypes.object,
3259
+ Global: PropTypes.object,
2626
3260
  templatesActions: PropTypes.object,
2627
3261
  route: PropTypes.object,
2628
3262
  templateData: PropTypes.object,
@@ -2630,20 +3264,13 @@ Email.propTypes = {
2630
3264
  getFormSubscriptionData: PropTypes.func,
2631
3265
  supportedTags: PropTypes.array,
2632
3266
  getDefaultTags: PropTypes.string,
2633
- currentOrgDetails: PropTypes.object,
2634
- isLoadingMetaEntities: PropTypes.bool,
2635
- // creativesContainerActions: PropTypes.object,
2636
- isFullMode: PropTypes.bool,
2637
- setIsLoadingContent: PropTypes.func,
2638
3267
  injectedTags: PropTypes.object,
2639
3268
  };
2640
3269
 
2641
- const mapStateToProps = (state, props) => createStructuredSelector({
3270
+ const mapStateToProps = createStructuredSelector({
2642
3271
  Email: makeSelectEmail(),
2643
3272
  Templates: makeSelectTemplates(),
2644
3273
  metaEntities: makeSelectMetaEntities(),
2645
- currentOrgDetails: props.cap ? () => props.cap.currentOrgDetails : selectCurrentOrgDetails(),
2646
- isLoadingMetaEntities: isLoadingMetaEntities(),
2647
3274
  Global: makeSelectAuthenticated(),
2648
3275
  injectedTags: setInjectedTags(),
2649
3276
  });
@@ -2653,9 +3280,7 @@ function mapDispatchToProps(dispatch) {
2653
3280
  actions: bindActionCreators(actions, dispatch),
2654
3281
  globalActions: bindActionCreators(globalActions, dispatch),
2655
3282
  templatesActions: bindActionCreators(templatesActions, dispatch),
2656
- creativesContainerActions: bindActionCreators(creativesContainerActions, dispatch),
2657
3283
  };
2658
3284
  }
2659
3285
 
2660
3286
  export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(Email)));
2661
-