@capillarytech/creatives-library 8.0.159-alpha.0 → 8.0.159

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 (298) hide show
  1. package/constants/unified.js +189 -0
  2. package/index.js +4 -2
  3. package/package.json +1 -1
  4. package/routes.js +136 -202
  5. package/services/getSchema.js +1 -1
  6. package/services/localStorageApi.js +1 -0
  7. package/tests/i18n.test.js +1 -1
  8. package/utils/authWrapper.js +1 -1
  9. package/utils/common.js +2 -2
  10. package/utils/tagValidations.js +1 -1
  11. package/utils/tests/authWrapper.test.js +1 -1
  12. package/utils/tests/checkStore.test.js +1 -1
  13. package/utils/tests/customAuth.test.js +1 -1
  14. package/utils/transformerUtils.js +1 -1
  15. package/v2Components/CapTagList/index.js +9 -14
  16. package/v2Components/Carousel/style.scss +1 -1
  17. package/v2Components/CustomerSearchSection/index.js +79 -83
  18. package/v2Components/EmailMobilePreview/index.js +2 -2
  19. package/v2Components/FormBuilder/index.js +2 -2
  20. package/v2Components/TemplatePreview/index.js +2 -1
  21. package/v2Components/TestAndPreviewSlidebox/PreviewSection.js +1 -1
  22. package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +1 -2
  23. package/v2Components/TestAndPreviewSlidebox/index.js +3 -37
  24. package/v2Components/TestAndPreviewSlidebox/tests/PreviewSection.test.js +1 -1
  25. package/v2Containers/Cap/tests/saga.test.js +1 -1
  26. package/v2Containers/Email/index.js +26 -61
  27. package/v2Containers/FTP/index.js +1 -1
  28. package/v2Containers/Line/Container/Text/index.js +1 -1
  29. package/v2Containers/Sms/Create/index.js +1 -1
  30. package/v2Containers/Sms/Edit/index.js +1 -1
  31. package/v2Containers/TagList/index.js +1 -1
  32. package/v2Containers/TagList/utils.js +1 -1
  33. package/v2Containers/Templates/index.js +1 -1
  34. package/v2Containers/Templates/sagas.js +1 -1
  35. package/components/BreadCrumbs/index.js +0 -65
  36. package/components/BreadCrumbs/messages.js +0 -13
  37. package/components/CapTagList/index.js +0 -235
  38. package/components/CapTagList/messages.js +0 -45
  39. package/components/Card/_customCard.scss +0 -40
  40. package/components/Card/index.js +0 -78
  41. package/components/Card/tests/__snapshots__/index.test.js.snap +0 -22
  42. package/components/Card/tests/index.test.js +0 -20
  43. package/components/CardGrid/index.js +0 -71
  44. package/components/Ckeditor/index.js +0 -238
  45. package/components/Ckeditor/messages.js +0 -13
  46. package/components/Ckeditor/style.scss +0 -3
  47. package/components/Component/index.js +0 -29
  48. package/components/CustomPopOver/index.js +0 -81
  49. package/components/CustomPopOver/messages.js +0 -17
  50. package/components/DateFilter/index.js +0 -349
  51. package/components/DateFilter/messages.js +0 -57
  52. package/components/DateRange/index.js +0 -114
  53. package/components/DateRange/messages.js +0 -25
  54. package/components/Edmeditor/index.js +0 -65
  55. package/components/Edmeditor/messages.js +0 -13
  56. package/components/EmailPreview/_emailPreview.scss +0 -119
  57. package/components/EmailPreview/assets/images/iPad.svg +0 -10
  58. package/components/EmailPreview/assets/images/mobile.png +0 -0
  59. package/components/EmailPreview/index.js +0 -107
  60. package/components/EmailPreview/messages.js +0 -33
  61. package/components/Footer/index.js +0 -27
  62. package/components/Footer/messages.js +0 -13
  63. package/components/FormBuilder/_formBuilder.scss +0 -83
  64. package/components/FormBuilder/index.js +0 -3279
  65. package/components/FormBuilder/messages.js +0 -61
  66. package/components/Header/index.js +0 -44
  67. package/components/Header/messages.js +0 -29
  68. package/components/ImagePreview/_imagePreview.scss +0 -63
  69. package/components/ImagePreview/index.js +0 -52
  70. package/components/ImagePreview/messages.js +0 -17
  71. package/components/PageHeader/_pageHeader.scss +0 -22
  72. package/components/PageHeader/index.js +0 -37
  73. package/components/PageHeader/messages.js +0 -13
  74. package/components/Pagination/_pagination.scss +0 -5
  75. package/components/Pagination/index.js +0 -49
  76. package/components/PreviewSideBar/_previewsidebar.scss +0 -28
  77. package/components/PreviewSideBar/index.js +0 -152
  78. package/components/PreviewSideBar/messages.js +0 -41
  79. package/components/Sidebar/_sidebar.scss +0 -115
  80. package/components/Sidebar/index.js +0 -214
  81. package/components/Sidebar/messages.js +0 -21
  82. package/components/SlideBox/_slideBox.scss +0 -63
  83. package/components/SlideBox/index.js +0 -47
  84. package/components/SlideBox/tests/index.test.js +0 -103
  85. package/components/SmsEditor/index.js +0 -55
  86. package/components/SmsTest/index.js +0 -117
  87. package/components/SmsTest/messages.js +0 -21
  88. package/components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +0 -42
  89. package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +0 -141
  90. package/components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +0 -21
  91. package/components/TemplatePreview/_templatePreview.scss +0 -642
  92. package/components/TemplatePreview/assets/images/WECHAT_5x.png +0 -0
  93. package/components/TemplatePreview/assets/images/androidPushMessage.svg +0 -45
  94. package/components/TemplatePreview/assets/images/home-screen-android.svg +0 -21
  95. package/components/TemplatePreview/assets/images/home-screen-ios.svg +0 -16
  96. package/components/TemplatePreview/assets/images/iPhonePushMessage.svg +0 -135
  97. package/components/TemplatePreview/assets/images/mobile.svg +0 -24
  98. package/components/TemplatePreview/assets/images/sms-body.png +0 -0
  99. package/components/TemplatePreview/assets/images/sms-icon.png +0 -0
  100. package/components/TemplatePreview/assets/images/sms_mobile.png +0 -0
  101. package/components/TemplatePreview/assets/images/sms_mobile_android.svg +0 -22
  102. package/components/TemplatePreview/assets/images/sms_mobile_ios.svg +0 -16
  103. package/components/TemplatePreview/assets/images/user-icon.svg +0 -19
  104. package/components/TemplatePreview/assets/images/wechat-mobile.svg +0 -78
  105. package/components/TemplatePreview/assets/images/wechat_mobile_android.svg +0 -20
  106. package/components/TemplatePreview/index.js +0 -617
  107. package/components/TemplatePreview/messages.js +0 -78
  108. package/components/Toastr/index.js +0 -60
  109. package/components/Toastr/messages.js +0 -13
  110. package/components/ToastrMessage/index.js +0 -113
  111. package/components/ToastrMessage/messages.js +0 -17
  112. package/components/TopBar/_topbar.scss +0 -46
  113. package/components/TopBar/assets/images/capillary_logo.png +0 -0
  114. package/components/TopBar/assets/images/old_capillary_logo.png +0 -0
  115. package/components/TopBar/index.js +0 -113
  116. package/components/TopBar/messages.js +0 -29
  117. package/containers/App/actions.js +0 -7
  118. package/containers/App/constants.js +0 -114
  119. package/containers/App/index.js +0 -52
  120. package/containers/App/reducer.js +0 -19
  121. package/containers/App/sagas.js +0 -31
  122. package/containers/App/selectors.js +0 -25
  123. package/containers/App/test/saga.test.js +0 -11
  124. package/containers/Assets/Gallery/_gallery.scss +0 -126
  125. package/containers/Assets/Gallery/actions.js +0 -37
  126. package/containers/Assets/Gallery/constants.js +0 -23
  127. package/containers/Assets/Gallery/index.js +0 -473
  128. package/containers/Assets/Gallery/messages.js +0 -93
  129. package/containers/Assets/Gallery/reducer.js +0 -81
  130. package/containers/Assets/Gallery/sagas.js +0 -80
  131. package/containers/Assets/Gallery/selectors.js +0 -25
  132. package/containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +0 -9
  133. package/containers/Assets/Gallery/tests/actions.test.js +0 -25
  134. package/containers/Assets/Gallery/tests/reducer.test.js +0 -96
  135. package/containers/Assets/Gallery/tests/saga.test.js +0 -157
  136. package/containers/Cap/actions.js +0 -66
  137. package/containers/Cap/constants.js +0 -25
  138. package/containers/Cap/index.js +0 -402
  139. package/containers/Cap/messages.js +0 -75
  140. package/containers/Cap/reducer.js +0 -113
  141. package/containers/Cap/sagas.js +0 -159
  142. package/containers/Cap/selectors.js +0 -75
  143. package/containers/Cap/tests/__snapshots__/index.test.js.snap +0 -2270
  144. package/containers/Cap/tests/index.test.js +0 -22
  145. package/containers/Cap/tests/saga.test.js +0 -284
  146. package/containers/Dashboard/actions.js +0 -15
  147. package/containers/Dashboard/constants.js +0 -7
  148. package/containers/Dashboard/index.js +0 -76
  149. package/containers/Dashboard/messages.js +0 -13
  150. package/containers/Dashboard/reducer.js +0 -21
  151. package/containers/Dashboard/sagas.js +0 -17
  152. package/containers/Dashboard/selectors.js +0 -25
  153. package/containers/Dashboard/test/saga.test.js +0 -9
  154. package/containers/Ebill/_ebill.scss +0 -5
  155. package/containers/Ebill/actions.js +0 -43
  156. package/containers/Ebill/constants.js +0 -20
  157. package/containers/Ebill/index.js +0 -1278
  158. package/containers/Ebill/messages.js +0 -77
  159. package/containers/Ebill/reducer.js +0 -72
  160. package/containers/Ebill/sagas.js +0 -74
  161. package/containers/Ebill/selectors.js +0 -25
  162. package/containers/Ebill/test/saga.test.js +0 -11
  163. package/containers/Email/_email.scss +0 -141
  164. package/containers/Email/actions.js +0 -81
  165. package/containers/Email/constants.js +0 -36
  166. package/containers/Email/index.js +0 -3325
  167. package/containers/Email/messages.js +0 -289
  168. package/containers/Email/reducer.js +0 -142
  169. package/containers/Email/sagas.js +0 -135
  170. package/containers/Email/selectors.js +0 -31
  171. package/containers/Email/test/saga.test.js +0 -671
  172. package/containers/LanguageProvider/actions.js +0 -17
  173. package/containers/LanguageProvider/constants.js +0 -8
  174. package/containers/LanguageProvider/index.js +0 -80
  175. package/containers/LanguageProvider/reducer.js +0 -30
  176. package/containers/LanguageProvider/selectors.js +0 -20
  177. package/containers/LanguageProvider/tests/actions.test.js +0 -19
  178. package/containers/LanguageProvider/tests/index.test.js +0 -78
  179. package/containers/LanguageProvider/tests/reducer.test.js +0 -20
  180. package/containers/LanguageProvider/tests/selectors.test.js +0 -15
  181. package/containers/Line/Create/_lineCreate.scss +0 -54
  182. package/containers/Line/Create/actions.js +0 -90
  183. package/containers/Line/Create/constants.js +0 -39
  184. package/containers/Line/Create/index.js +0 -836
  185. package/containers/Line/Create/messages.js +0 -189
  186. package/containers/Line/Create/reducer.js +0 -99
  187. package/containers/Line/Create/sagas.js +0 -121
  188. package/containers/Line/Create/selectors.js +0 -36
  189. package/containers/Line/Create/tests/saga.test.js +0 -202
  190. package/containers/Line/Edit/_lineEdit.scss +0 -35
  191. package/containers/Line/Edit/actions.js +0 -79
  192. package/containers/Line/Edit/constants.js +0 -27
  193. package/containers/Line/Edit/index.js +0 -1050
  194. package/containers/Line/Edit/messages.js +0 -177
  195. package/containers/Line/Edit/reducer.js +0 -83
  196. package/containers/Line/Edit/sagas.js +0 -80
  197. package/containers/Line/Edit/selectors.js +0 -29
  198. package/containers/Line/Edit/test/saga.test.js +0 -160
  199. package/containers/Login/assets/images/capillary_logo.png +0 -0
  200. package/containers/Login/components/LoginForm/index.js +0 -62
  201. package/containers/Login/components/LoginForm/messages.js +0 -33
  202. package/containers/Login/index.js +0 -130
  203. package/containers/Login/messages.js +0 -25
  204. package/containers/Login/selectors.js +0 -25
  205. package/containers/MobilePush/Create/_mobilePushCreate.scss +0 -39
  206. package/containers/MobilePush/Create/actions.js +0 -46
  207. package/containers/MobilePush/Create/constants.js +0 -23
  208. package/containers/MobilePush/Create/index.js +0 -2303
  209. package/containers/MobilePush/Create/messages.js +0 -269
  210. package/containers/MobilePush/Create/reducer.js +0 -70
  211. package/containers/MobilePush/Create/sagas.js +0 -74
  212. package/containers/MobilePush/Create/selectors.js +0 -28
  213. package/containers/MobilePush/Create/test/saga.test.js +0 -19
  214. package/containers/MobilePush/Edit/_mobilePushCreate.scss +0 -39
  215. package/containers/MobilePush/Edit/actions.js +0 -91
  216. package/containers/MobilePush/Edit/constants.js +0 -35
  217. package/containers/MobilePush/Edit/index.js +0 -2601
  218. package/containers/MobilePush/Edit/messages.js +0 -266
  219. package/containers/MobilePush/Edit/reducer.js +0 -112
  220. package/containers/MobilePush/Edit/sagas.js +0 -126
  221. package/containers/MobilePush/Edit/selectors.js +0 -29
  222. package/containers/MobilePush/Edit/tests/saga.test.js +0 -255
  223. package/containers/NotFoundPage/index.js +0 -25
  224. package/containers/NotFoundPage/messages.js +0 -13
  225. package/containers/NotFoundPage/tests/index.test.js +0 -17
  226. package/containers/Sms/Create/_smsCreate.scss +0 -42
  227. package/containers/Sms/Create/actions.js +0 -27
  228. package/containers/Sms/Create/constants.js +0 -16
  229. package/containers/Sms/Create/index.js +0 -1488
  230. package/containers/Sms/Create/messages.js +0 -109
  231. package/containers/Sms/Create/reducer.js +0 -41
  232. package/containers/Sms/Create/sagas.js +0 -40
  233. package/containers/Sms/Create/selectors.js +0 -28
  234. package/containers/Sms/Create/test/saga.test.js +0 -11
  235. package/containers/Sms/Edit/actions.js +0 -40
  236. package/containers/Sms/Edit/constants.js +0 -17
  237. package/containers/Sms/Edit/index.js +0 -1472
  238. package/containers/Sms/Edit/messages.js +0 -105
  239. package/containers/Sms/Edit/reducer.js +0 -50
  240. package/containers/Sms/Edit/sagas.js +0 -60
  241. package/containers/Sms/Edit/selectors.js +0 -32
  242. package/containers/Sms/Edit/test/saga.test.js +0 -13
  243. package/containers/TagList/_tagList.scss +0 -8
  244. package/containers/TagList/actions.js +0 -15
  245. package/containers/TagList/constants.js +0 -32
  246. package/containers/TagList/index.js +0 -236
  247. package/containers/TagList/messages.js +0 -13
  248. package/containers/TagList/reducer.js +0 -23
  249. package/containers/TagList/sagas.js +0 -11
  250. package/containers/TagList/selectors.js +0 -25
  251. package/containers/Templates/_templates.scss +0 -333
  252. package/containers/Templates/actions.js +0 -103
  253. package/containers/Templates/constants.js +0 -60
  254. package/containers/Templates/index.js +0 -1756
  255. package/containers/Templates/messages.js +0 -337
  256. package/containers/Templates/reducer.js +0 -142
  257. package/containers/Templates/sagas.js +0 -163
  258. package/containers/Templates/selectors.js +0 -28
  259. package/containers/Templates/test/saga.test.js +0 -241
  260. package/containers/WeChat/MapTemplates/_mapTemplates.scss +0 -8
  261. package/containers/WeChat/MapTemplates/actions.js +0 -52
  262. package/containers/WeChat/MapTemplates/constants.js +0 -28
  263. package/containers/WeChat/MapTemplates/index.js +0 -1610
  264. package/containers/WeChat/MapTemplates/messages.js +0 -157
  265. package/containers/WeChat/MapTemplates/reducer.js +0 -74
  266. package/containers/WeChat/MapTemplates/sagas.js +0 -84
  267. package/containers/WeChat/MapTemplates/selectors.js +0 -25
  268. package/containers/WeChat/MapTemplates/test/saga.test.js +0 -155
  269. package/containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +0 -57
  270. package/containers/WeChat/RichmediaTemplates/Create/actions.js +0 -36
  271. package/containers/WeChat/RichmediaTemplates/Create/constants.js +0 -15
  272. package/containers/WeChat/RichmediaTemplates/Create/index.js +0 -1071
  273. package/containers/WeChat/RichmediaTemplates/Create/messages.js +0 -165
  274. package/containers/WeChat/RichmediaTemplates/Create/reducer.js +0 -60
  275. package/containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +0 -497
  276. package/containers/WeChat/RichmediaTemplates/Create/sagas.js +0 -51
  277. package/containers/WeChat/RichmediaTemplates/Create/selectors.js +0 -37
  278. package/containers/WeChat/RichmediaTemplates/Create/test/saga.test.js +0 -13
  279. package/containers/WeChat/RichmediaTemplates/Edit/actions.js +0 -20
  280. package/containers/WeChat/RichmediaTemplates/Edit/constants.js +0 -10
  281. package/containers/WeChat/RichmediaTemplates/Edit/index.js +0 -136
  282. package/containers/WeChat/RichmediaTemplates/Edit/messages.js +0 -13
  283. package/containers/WeChat/RichmediaTemplates/Edit/reducer.js +0 -28
  284. package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +0 -36
  285. package/containers/WeChat/RichmediaTemplates/Edit/selectors.js +0 -30
  286. package/containers/WeChat/RichmediaTemplates/Edit/test/saga.test.js +0 -12
  287. package/containers/WeChat/RichmediaTemplates/View/actions.js +0 -15
  288. package/containers/WeChat/RichmediaTemplates/View/constants.js +0 -7
  289. package/containers/WeChat/RichmediaTemplates/View/index.js +0 -47
  290. package/containers/WeChat/RichmediaTemplates/View/messages.js +0 -21
  291. package/containers/WeChat/RichmediaTemplates/View/reducer.js +0 -23
  292. package/containers/WeChat/RichmediaTemplates/View/sagas.js +0 -11
  293. package/containers/WeChat/RichmediaTemplates/View/selectors.js +0 -25
  294. package/utils/asyncInjectors.js +0 -78
  295. package/utils/callNativeEvent.js +0 -16
  296. package/utils/checkStore.js +0 -21
  297. package/utils/customAuthWrapper.js +0 -62
  298. package/utils/customConnectedAuthWrapper.js +0 -26
@@ -1,136 +0,0 @@
1
- /*
2
- *
3
- * Edit
4
- *
5
- */
6
-
7
- import PropTypes from 'prop-types';
8
-
9
- import React from 'react';
10
- import { connect } from 'react-redux';
11
- import { bindActionCreators, compose } from 'redux';
12
- import _ from 'lodash';
13
- import { createStructuredSelector } from 'reselect';
14
- import makeSelectEdit, { makeSelectTemplates } from './selectors';
15
- import * as actions from './actions';
16
- import Create from '../Create';
17
- import injectSaga from '../../../../utils/injectSaga';
18
- import injectReducer from '../../../../utils/injectReducer';
19
- import reducer from './reducer';
20
- import createReducer from '../Create/reducer';
21
- import { richMediaTemplatesEditSaga } from './sagas';
22
- import { richMediaTemplatesSaga } from '../Create/sagas';
23
- import { createQueryString } from '../../../../utils/common';
24
-
25
- export class Edit extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
26
- constructor(props) {
27
- super(props);
28
- this.state = {
29
- totalContentBlocks: 0,
30
- templateData: {},
31
- };
32
- this.setTemplateData = this.setTemplateData.bind(this);
33
- }
34
- componentWillMount = () => {
35
- if (_.isEmpty(this.props.Templates.selectedWeChatAccount)) {
36
- const module = this.props.location.query.module ? this.props.location.query.module : 'default';
37
- const type = this.props.location.query.type;
38
- this.props.router.push({
39
- pathname: `/wechat`,
40
- search : createQueryString(type === 'embedded' ? {type: 'embedded', module} : {module})
41
- });
42
- }
43
- }
44
- componentDidMount = () => {
45
- this.props.actions.getTemplateDetails(this.props.params.id, "wechat");
46
- }
47
- componentWillReceiveProps = (nextProps) => {
48
- if (nextProps.Edit.templateDetails && !_.isEmpty(nextProps.Edit.templateDetails) && !_.isEqual(this.props.Edit.templateDetails, nextProps.Edit.templateDetails)) {
49
- const templateData = this.setTemplateData(nextProps.Edit.templateDetails);
50
- this.setState({templateData});
51
- }
52
- }
53
- setTemplateData = (templateDetails) => {
54
- const templateData = {};
55
- let contentId = 0;
56
- if (!_.isEmpty(templateDetails)) {
57
- _.forEach(templateDetails.versions.base.mediaList, (content) => {
58
- const formData = {};
59
- formData['title-value'] = content.title;
60
- formData['author-value'] = content.author;
61
- formData['cover-abstract-value'] = content.digest;
62
- formData['content-value'] = content.content;
63
- formData['source-link-value'] = content.content_source_url;
64
- formData['post-comments-value'] = content.post_comments_scope;
65
- formData['show-cover-pic-value'] = content.show_cover_pic;
66
- templateData[contentId] = {
67
- formData,
68
- imageUrl: content.image_url,
69
- mediaId: content.thumb_media_id,
70
- };
71
- contentId += 1;
72
- });
73
- if (this.props.location.query.type === "embedded" && this.props.location.query.module === "outbound") {
74
- templateData.templateDetails = templateDetails;
75
- }
76
- }
77
- this.setState({totalContentBlocks: contentId});
78
- return templateData;
79
- }
80
- render() {
81
- if (this.state.templateData && !_.isEmpty(this.state.templateData) && this.state.totalContentBlocks > 0) {
82
- return (
83
- <div className="richmedia-container">
84
- <Create
85
- templateData={this.state.templateData}
86
- mode="EDIT"
87
- totalContentBlocks={this.state.totalContentBlocks}
88
- templateName={this.props.Edit && this.props.Edit.templateDetails && this.props.Edit.templateDetails.name ? this.props.Edit.templateDetails.name : ""}
89
- mediaId={this.props.Edit && this.props.Edit.templateDetails && this.props.Edit.templateDetails.versions && this.props.Edit.templateDetails.versions.base && this.props.Edit.templateDetails.versions.base.mediaId ? this.props.Edit.templateDetails.versions.base.mediaId : ""}
90
- templateId={this.props.Edit && this.props.Edit.templateDetails && this.props.Edit.templateDetails._id ? this.props.Edit.templateDetails._id : ""}
91
- router={this.props.router}
92
- location={this.props.location}
93
- />
94
- </div>
95
- );
96
- }
97
- return (
98
- <div></div>
99
- );
100
- }
101
- }
102
-
103
- Edit.propTypes = {
104
- router: PropTypes.object,
105
- location: PropTypes.object,
106
- actions: PropTypes.object,
107
- params: PropTypes.object,
108
- Edit: PropTypes.object,
109
- Templates: PropTypes.object,
110
- };
111
-
112
- const mapStateToProps = createStructuredSelector({
113
- Edit: makeSelectEdit(),
114
- Templates: makeSelectTemplates(),
115
- });
116
-
117
- function mapDispatchToProps(dispatch) {
118
- return {
119
- actions: bindActionCreators(actions, dispatch),
120
- };
121
- }
122
-
123
- const withConnect = connect(mapStateToProps, mapDispatchToProps);
124
- const withReducer = injectReducer({ key: 'edit', reducer });
125
- const withCreateReducer = injectReducer({ key: 'create', reducer: createReducer });
126
- const withSaga = injectSaga({ key: 'edit', saga: richMediaTemplatesEditSaga });
127
- const withCreateSaga = injectSaga({ key: 'create', saga: richMediaTemplatesSaga });
128
-
129
- export default compose(
130
- withReducer,
131
- withCreateReducer,
132
- withSaga,
133
- withCreateSaga,
134
- withConnect,
135
- )(Edit);
136
-
@@ -1,13 +0,0 @@
1
- /*
2
- * Edit Messages
3
- *
4
- * This contains all the text for the Edit component.
5
- */
6
- import { defineMessages } from 'react-intl';
7
-
8
- export default defineMessages({
9
- header: {
10
- id: 'creatives.containers.Edit.header',
11
- defaultMessage: 'This is Edit container !',
12
- },
13
- });
@@ -1,28 +0,0 @@
1
- /*
2
- *
3
- * Edit reducer
4
- *
5
- */
6
-
7
- import { fromJS } from 'immutable';
8
- import * as types from './constants';
9
-
10
- const initialState = fromJS({});
11
-
12
- function editReducer(state = initialState, action) {
13
- switch (action.type) {
14
- case types.DEFAULT_ACTION:
15
- return state;
16
- case types.GET_TEMPLATE_DETAILS_REQUEST:
17
- return state.set('getTemplateDetailsInProgress', true);
18
- case types.GET_TEMPLATE_DETAILS_SUCCESS:
19
- return state.set('getTemplateDetailsInProgress', false)
20
- .set('templateDetails', action.data);
21
- case types.GET_TEMPLATE_DETAILS_FAILURE:
22
- return state.set('getTemplateDetailsInProgress', false);
23
- default:
24
- return state;
25
- }
26
- }
27
-
28
- export default editReducer;
@@ -1,36 +0,0 @@
1
- import { call, put, takeLatest, all } from 'redux-saga/effects';
2
- import * as Api from '../../../../services/api';
3
- import * as types from './constants';
4
-
5
- // Individual exports for testing
6
- export function* defaultSaga() {
7
- // See example in containers/HomePage/sagas.js
8
- }
9
- export function* getTemplateDetails({id, channel}) {
10
- try {
11
- const params = {
12
- id, channel,
13
- };
14
-
15
- const result = yield call(Api.getTemplateDetails, params);
16
- // const sidebar = result.response.sidebar;
17
- yield put({ type: types.GET_TEMPLATE_DETAILS_SUCCESS, data: result.response });
18
- } catch (error) {
19
- yield put({ type: types.GET_TEMPLATE_DETAILS_FAILURE, error });
20
- }
21
- }
22
- function* watchGetTemplateDetails() {
23
- yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
24
- }
25
- // All sagas to be loaded
26
- export default [
27
- defaultSaga,
28
- watchGetTemplateDetails,
29
- ];
30
-
31
- export function* richMediaTemplatesEditSaga() {
32
- yield all([
33
- defaultSaga(),
34
- watchGetTemplateDetails(),
35
- ]);
36
- }
@@ -1,30 +0,0 @@
1
- import { createSelector } from 'reselect';
2
-
3
- /**
4
- * Direct selector to the edit state domain
5
- */
6
- const selectEditDomain = () => (state) => state.get('edit');
7
- const selectTemplatesDomain = (state) => state.get('templates');
8
-
9
- /**
10
- * Other specific selectors
11
- */
12
- const makeSelectTemplates = () => createSelector(
13
- selectTemplatesDomain,
14
- (globalState) => globalState.toJS()
15
- );
16
-
17
- /**
18
- * Default selector used by Edit
19
- */
20
-
21
- const makeSelectEdit = () => createSelector(
22
- selectEditDomain(),
23
- (substate) => substate.toJS()
24
- );
25
-
26
- export default makeSelectEdit;
27
- export {
28
- selectEditDomain,
29
- makeSelectTemplates,
30
- };
@@ -1,12 +0,0 @@
1
-
2
- import { expectSaga } from "redux-saga-test-plan";
3
-
4
- import {
5
- richMediaTemplatesEditSaga,
6
- } from "../sagas";
7
-
8
- describe("richMediaTemplatesEditSaga Combined", () => {
9
- it.concurrent("should initialize all richMediaTemplatesEditSaga-related watcher sagas without error", () => {
10
- return expectSaga(richMediaTemplatesEditSaga).run();
11
- });
12
- });
@@ -1,15 +0,0 @@
1
- /*
2
- *
3
- * View actions
4
- *
5
- */
6
-
7
- import {
8
- DEFAULT_ACTION,
9
- } from './constants';
10
-
11
- export function defaultAction() {
12
- return {
13
- type: DEFAULT_ACTION,
14
- };
15
- }
@@ -1,7 +0,0 @@
1
- /*
2
- *
3
- * View constants
4
- *
5
- */
6
-
7
- export const DEFAULT_ACTION = 'app/View/DEFAULT_ACTION';
@@ -1,47 +0,0 @@
1
- /*
2
- *
3
- * View
4
- *
5
- */
6
-
7
- import PropTypes from 'prop-types';
8
-
9
- import React from 'react';
10
- import { connect } from 'react-redux';
11
- import Helmet from 'react-helmet';
12
- import { FormattedMessage } from 'react-intl';
13
- import { createStructuredSelector } from 'reselect';
14
- import makeSelectView from './selectors';
15
- import messages from './messages';
16
-
17
- export class View extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
18
- render() {
19
- return (
20
- <div>
21
- <Helmet
22
- title={<FormattedMessage {...messages.view} />}
23
- meta={[
24
- { name: 'description', content: <FormattedMessage {...messages.descriptionView} /> },
25
- ]}
26
- />
27
- <FormattedMessage {...messages.header} />
28
- </div>
29
- );
30
- }
31
- }
32
-
33
- View.propTypes = {
34
- dispatch: PropTypes.func.isRequired,
35
- };
36
-
37
- const mapStateToProps = createStructuredSelector({
38
- View: makeSelectView(),
39
- });
40
-
41
- function mapDispatchToProps(dispatch) {
42
- return {
43
- dispatch,
44
- };
45
- }
46
-
47
- export default connect(mapStateToProps, mapDispatchToProps)(View);
@@ -1,21 +0,0 @@
1
- /*
2
- * View Messages
3
- *
4
- * This contains all the text for the View component.
5
- */
6
- import { defineMessages } from 'react-intl';
7
-
8
- export default defineMessages({
9
- header: {
10
- id: 'creatives.containers.View.header',
11
- defaultMessage: 'This is View container !',
12
- },
13
- view: {
14
- id: 'creatives.containers.View.view',
15
- defaultMessage: 'View',
16
- },
17
- descriptionView: {
18
- id: 'creatives.containers.View.descriptionView',
19
- defaultMessage: 'Description of View',
20
- },
21
- });
@@ -1,23 +0,0 @@
1
- /*
2
- *
3
- * View reducer
4
- *
5
- */
6
-
7
- import { fromJS } from 'immutable';
8
- import {
9
- DEFAULT_ACTION,
10
- } from './constants';
11
-
12
- const initialState = fromJS({});
13
-
14
- function viewReducer(state = initialState, action) {
15
- switch (action.type) {
16
- case DEFAULT_ACTION:
17
- return state;
18
- default:
19
- return state;
20
- }
21
- }
22
-
23
- export default viewReducer;
@@ -1,11 +0,0 @@
1
- // import { take, call, put, select } from 'redux-saga/effects';
2
-
3
- // Individual exports for testing
4
- export function* defaultSaga() {
5
- // See example in containers/HomePage/sagas.js
6
- }
7
-
8
- // All sagas to be loaded
9
- export default [
10
- defaultSaga,
11
- ];
@@ -1,25 +0,0 @@
1
- import { createSelector } from 'reselect';
2
-
3
- /**
4
- * Direct selector to the view state domain
5
- */
6
- const selectViewDomain = () => (state) => state.get('view');
7
-
8
- /**
9
- * Other specific selectors
10
- */
11
-
12
-
13
- /**
14
- * Default selector used by View
15
- */
16
-
17
- const makeSelectView = () => createSelector(
18
- selectViewDomain(),
19
- (substate) => substate.toJS()
20
- );
21
-
22
- export default makeSelectView;
23
- export {
24
- selectViewDomain,
25
- };
@@ -1,78 +0,0 @@
1
- import conformsTo from 'lodash/conformsTo';
2
- import isEmpty from 'lodash/isEmpty';
3
- import isFunction from 'lodash/isFunction';
4
- import isObject from 'lodash/isObject';
5
- import isString from 'lodash/isString';
6
- import invariant from 'invariant';
7
- import warning from 'warning';
8
- import createReducer from 'reducers';
9
-
10
- /**
11
- * Validate the shape of redux store
12
- */
13
- export function checkStore(store) {
14
- const shape = {
15
- dispatch: isFunction,
16
- subscribe: isFunction,
17
- getState: isFunction,
18
- replaceReducer: isFunction,
19
- runSaga: isFunction,
20
- asyncReducers: isObject,
21
- };
22
- invariant(
23
- conformsTo(store, shape),
24
- '(app/utils...) asyncInjectors: Expected a valid redux store'
25
- );
26
- }
27
-
28
- /**
29
- * Inject an asynchronously loaded reducer
30
- */
31
- export function injectAsyncReducer(store, isValid) {
32
- return function injectReducer(name, asyncReducer) {
33
- if (!isValid) checkStore(store);
34
-
35
- invariant(
36
- isString(name) && !isEmpty(name) && isFunction(asyncReducer),
37
- '(app/utils...) injectAsyncReducer: Expected `asyncReducer` to be a reducer function'
38
- );
39
-
40
- if (Reflect.has(store.asyncReducers, name)) return;
41
-
42
- store.asyncReducers[name] = asyncReducer; // eslint-disable-line no-param-reassign
43
- store.replaceReducer(createReducer(store.asyncReducers));
44
- };
45
- }
46
-
47
- /**
48
- * Inject an asynchronously loaded saga
49
- */
50
- export function injectAsyncSagas(store, isValid) {
51
- return function injectSagas(sagas) {
52
- if (!isValid) checkStore(store);
53
-
54
- invariant(
55
- Array.isArray(sagas),
56
- '(app/utils...) injectAsyncSagas: Expected `sagas` to be an array of generator functions'
57
- );
58
-
59
- warning(
60
- !isEmpty(sagas),
61
- '(app/utils...) injectAsyncSagas: Received an empty `sagas` array'
62
- );
63
-
64
- sagas.map(store.runSaga);
65
- };
66
- }
67
-
68
- /**
69
- * Helper for creating injectors
70
- */
71
- export function getAsyncInjectors(store) {
72
- checkStore(store);
73
-
74
- return {
75
- injectReducer: injectAsyncReducer(store, true),
76
- injectSagas: injectAsyncSagas(store, true),
77
- };
78
- }
@@ -1,16 +0,0 @@
1
- //https://github.com/facebook/react/issues/11488#issuecomment-470623779
2
- export default function callNativeEvent({field, value, event}) {
3
- //cuz in react 16 native events does not work
4
- const ev = event;
5
- const input = field;
6
- const lastValue = input.value;
7
- input.value = value;
8
- // hack React15
9
- ev.simulated = true;
10
- // hack React16 内部定义了descriptor拦截value,此处重置状态
11
- const tracker = input._valueTracker;
12
- if (tracker) {
13
- tracker.setValue(lastValue);
14
- }
15
- input.dispatchEvent(ev);
16
- }
@@ -1,21 +0,0 @@
1
- import { conformsTo, isFunction, isObject } from 'lodash';
2
- import invariant from 'invariant';
3
-
4
- /**
5
- * Validate the shape of redux store
6
- */
7
- export default function checkStore(store) {
8
- const shape = {
9
- dispatch: isFunction,
10
- subscribe: isFunction,
11
- getState: isFunction,
12
- replaceReducer: isFunction,
13
- runSaga: isFunction,
14
- injectedReducers: isObject,
15
- injectedSagas: isObject,
16
- };
17
- invariant(
18
- conformsTo(store, shape),
19
- '(app/utils...) injectors: Expected a valid redux store',
20
- );
21
- }
@@ -1,62 +0,0 @@
1
- /* eslint-disable no-unused-vars */
2
- /* eslint-disable react/no-multi-comp */
3
- /* eslint-disable react/prefer-stateless-function */
4
- import React, { Component } from 'react';
5
- import PropTypes from 'prop-types';
6
- import hoistStatics from 'hoist-non-react-statics';
7
-
8
- const AuthenticatingComponentWithRef = React.forwardRef((props, ref) => (
9
- <div ref={ref} />
10
- ));
11
- const FailureComponentWithRef = React.forwardRef((props, ref) => (
12
- <div ref={ref} />
13
- ));
14
- const defaults = {
15
- AuthenticatingComponent: AuthenticatingComponentWithRef, // dont render anything while authenticating
16
- FailureComponent: FailureComponentWithRef, // dont render anything on failure of the predicate
17
- wrapperDisplayName: 'AuthWrapper',
18
- };
19
-
20
- export default args => {
21
- const { AuthenticatingComponent, FailureComponent, wrapperDisplayName } = {
22
- ...defaults,
23
- ...args,
24
- };
25
-
26
- // Wraps the component that needs the auth enforcement
27
- return function wrapComponent(DecoratedComponent) {
28
- const displayName =
29
- DecoratedComponent.displayName || DecoratedComponent.name || 'Component';
30
-
31
- class UserAuthWrapper extends Component {
32
- static displayName = `${wrapperDisplayName}(${displayName})`;
33
-
34
- static propTypes = {
35
- isAuthenticated: PropTypes.bool,
36
- isAuthenticating: PropTypes.bool,
37
- };
38
-
39
- static defaultProps = {
40
- isAuthenticating: false,
41
- };
42
-
43
- render() {
44
- const { isAuthenticated, isAuthenticating, forwardedRef } = this.props;
45
- if (isAuthenticated) {
46
- return <DecoratedComponent {...this.props} ref={forwardedRef} />;
47
- }
48
- if (isAuthenticating) {
49
- return <AuthenticatingComponent {...this.props} ref={forwardedRef} />;
50
- }
51
- return <FailureComponent {...this.props} ref={forwardedRef} />;
52
- }
53
- }
54
-
55
- /** forwardRef from HOC to the Wrapped Component */
56
- const UserAuthWrapperWithRef = React.forwardRef((props, ref) => (
57
- <UserAuthWrapper {...props} forwardedRef={ref} />
58
- ));
59
-
60
- return hoistStatics(UserAuthWrapperWithRef, DecoratedComponent);
61
- };
62
- };
@@ -1,26 +0,0 @@
1
- import { connect } from 'react-redux';
2
-
3
- import authWrapper from './customAuthWrapper';
4
-
5
- const connectedDefaults = {
6
- authenticatingSelector: () => false,
7
- };
8
-
9
- export default args => {
10
- const { authenticatedSelector, authenticatingSelector } = {
11
- ...connectedDefaults,
12
- ...args,
13
- };
14
-
15
- /** Passed withRef option set to true for forwarding Ref to Wrapped Component */
16
- return DecoratedComponent =>
17
- connect(
18
- (state, ownProps) => ({
19
- isAuthenticated: authenticatedSelector(state, ownProps),
20
- isAuthenticating: authenticatingSelector(state, ownProps),
21
- }),
22
- null,
23
- null,
24
- { withRef: true },
25
- )(authWrapper(args)(DecoratedComponent));
26
- };