x25 3.0.0 → 17.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (274) hide show
  1. package/Account/Load.js +75 -0
  2. package/Account/actions.js +15 -0
  3. package/Account/index.js +20 -0
  4. package/Account/reducer.js +122 -0
  5. package/Account/request.js +44 -0
  6. package/Async/InitModule.js +190 -0
  7. package/Async/RouteLoading.js +64 -0
  8. package/Async/SimulatedException.js +44 -0
  9. package/Async/index.js +95 -0
  10. package/Async/types.js +1 -0
  11. package/Company/Load.js +82 -0
  12. package/Company/actions.js +15 -0
  13. package/Company/index.js +20 -0
  14. package/Company/reducer.js +165 -0
  15. package/Company/request.js +36 -0
  16. package/Company/util.js +10 -0
  17. package/Header/AccountOptionsContainer.js +144 -0
  18. package/Header/AdminSelectCompany.js +109 -0
  19. package/Header/ClientSelectCompany.js +104 -0
  20. package/Header/Header.js +127 -0
  21. package/Header/HeaderContainer.js +39 -0
  22. package/Header/Logo.js +30 -0
  23. package/Header/LogoutButton.js +39 -0
  24. package/Header/index.js +19 -0
  25. package/Header/request.js +26 -0
  26. package/Header/types.js +1 -0
  27. package/Header/util.js +58 -0
  28. package/Inputs/Business/BankAccount.js +48 -0
  29. package/Inputs/Business/BankName.js +49 -0
  30. package/Inputs/Business/CifField.js +112 -0
  31. package/Inputs/Business/CifFieldContainer.js +157 -0
  32. package/Inputs/Business/Email.js +37 -0
  33. package/Inputs/Business/NidField.js +91 -0
  34. package/Inputs/Business/Phone.js +37 -0
  35. package/Inputs/Business/index.js +34 -0
  36. package/Inputs/Business/request.js +39 -0
  37. package/Inputs/CaptchaBox.js +151 -0
  38. package/Inputs/DateInput.js +172 -0
  39. package/Inputs/DateTemplate.js +200 -0
  40. package/Inputs/DelayInputChange.js +135 -0
  41. package/Inputs/FocusTemplate.js +47 -0
  42. package/Inputs/InputTemplate.js +78 -0
  43. package/Inputs/LabelTemplate.js +59 -0
  44. package/Inputs/NumericInput.js +139 -0
  45. package/Inputs/NumericTemplate.js +148 -0
  46. package/Inputs/Selects/County.js +29 -0
  47. package/Inputs/Selects/Custom.js +56 -0
  48. package/Inputs/Selects/Simple.js +75 -0
  49. package/Inputs/Selects/index.js +52 -0
  50. package/Inputs/SimpleInput.js +42 -0
  51. package/Inputs/SimpleTextarea.js +47 -0
  52. package/Inputs/TextareaTemplate.js +55 -0
  53. package/Inputs/Tooltip.js +82 -0
  54. package/Inputs/index.js +185 -0
  55. package/Messages/Error.js +106 -0
  56. package/Messages/Loading.js +68 -0
  57. package/Messages/index.js +29 -0
  58. package/Modal/Delete.js +240 -0
  59. package/Modal/Root.js +81 -0
  60. package/Modal/SimpleModal.js +57 -0
  61. package/Modal/actions.js +10 -0
  62. package/Modal/getComponent.js +42 -0
  63. package/Modal/index.js +22 -0
  64. package/Modal/reducer.js +53 -0
  65. package/Modal/types.js +7 -0
  66. package/Modal/util.js +17 -0
  67. package/Payment/EstimatePrice/Description.js +92 -0
  68. package/Payment/EstimatePrice/PayBox.js +220 -0
  69. package/Payment/EstimatePrice/index.js +92 -0
  70. package/Payment/EstimatePrice/util.js +21 -0
  71. package/Payment/MobilpayForm.js +86 -0
  72. package/Payment/Modal/BankTransfer.js +233 -0
  73. package/Payment/Modal/CompanyValability.js +28 -0
  74. package/Payment/Modal/DoneForm.js +222 -0
  75. package/Payment/Modal/PaymentDone.js +53 -0
  76. package/Payment/Modal/index.js +27 -0
  77. package/Payment/actions.js +23 -0
  78. package/{src/Payment → Payment}/codes.js +19 -16
  79. package/Payment/index.js +141 -0
  80. package/Payment/request.js +49 -0
  81. package/Payment/types.js +1 -0
  82. package/Payment/util.js +50 -0
  83. package/Payment/validate.js +23 -0
  84. package/Sidebar.js +156 -0
  85. package/Things.js +53 -0
  86. package/actions.js +73 -0
  87. package/config.js +10 -0
  88. package/dev/ErrorBoundary.js +109 -0
  89. package/dev/TheError.js +113 -0
  90. package/dev/index.js +132 -0
  91. package/dev/types.js +1 -0
  92. package/package.json +13 -13
  93. package/prod/SentryErrorBoundary.js +150 -0
  94. package/reducer/captchas.js +51 -0
  95. package/reducer/counties.js +57 -0
  96. package/reducer/index.js +38 -0
  97. package/reducer/module.js +48 -0
  98. package/style/index.css +1 -0
  99. package/style/sidebar.css +1 -0
  100. package/types.js +1 -0
  101. package/utility/calendar.js +45 -0
  102. package/utility/date.js +111 -0
  103. package/utility/index.js +125 -0
  104. package/utility/language.js +20 -0
  105. package/utility/mql.js +6 -0
  106. package/utility/normalize-test.js +54 -0
  107. package/utility/normalize.js +108 -0
  108. package/utility/numbers.js +93 -0
  109. package/utility/numeric.js +103 -0
  110. package/utility/others.js +142 -0
  111. package/utility/strings-test.js +216 -0
  112. package/utility/strings.js +85 -0
  113. package/utility/validation/common.js +278 -0
  114. package/utility/validation/index.js +110 -0
  115. package/utility/validation/specific.js +14 -0
  116. package/utility/validation/validate/bank-test.js +41 -0
  117. package/utility/validation/validate/bank.js +176 -0
  118. package/utility/validation/validate/cif-test.js +37 -0
  119. package/utility/validation/validate/cif.js +44 -0
  120. package/utility/validation/validate/cnp-test.js +68 -0
  121. package/utility/validation/validate/cnp.js +193 -0
  122. package/{src/utility → utility}/validation/validate/date.js +61 -73
  123. package/utility/validation/validate/email-test.js +30 -0
  124. package/utility/validation/validate/email.js +11 -0
  125. package/utility/validation/validate/index.js +65 -0
  126. package/.eslintignore +0 -2
  127. package/.eslintrc.json +0 -275
  128. package/.flowconfig +0 -23
  129. package/conf/dev.js +0 -19
  130. package/conf/dist.js +0 -19
  131. package/conf/polyfills/tempPolyfills.js +0 -7
  132. package/src/Account/Load.jsx +0 -79
  133. package/src/Account/actions.js +0 -10
  134. package/src/Account/index.js +0 -11
  135. package/src/Account/reducer.js +0 -139
  136. package/src/Account/request.js +0 -36
  137. package/src/Async/InitModule.jsx +0 -114
  138. package/src/Async/RouteLoading.jsx +0 -52
  139. package/src/Async/SimulatedException.jsx +0 -19
  140. package/src/Async/index.jsx +0 -75
  141. package/src/Async/types.js +0 -39
  142. package/src/Company/Load.jsx +0 -84
  143. package/src/Company/actions.js +0 -10
  144. package/src/Company/index.js +0 -11
  145. package/src/Company/reducer.js +0 -201
  146. package/src/Company/request.js +0 -30
  147. package/src/Company/util.js +0 -7
  148. package/src/Header/AccountOptionsContainer.jsx +0 -124
  149. package/src/Header/AdminSelectCompany.jsx +0 -101
  150. package/src/Header/ClientSelectCompany.jsx +0 -90
  151. package/src/Header/Header.jsx +0 -120
  152. package/src/Header/HeaderContainer.jsx +0 -30
  153. package/src/Header/Logo.jsx +0 -16
  154. package/src/Header/LogoutButton.jsx +0 -34
  155. package/src/Header/index.jsx +0 -9
  156. package/src/Header/request.js +0 -28
  157. package/src/Header/types.js +0 -6
  158. package/src/Header/util.jsx +0 -61
  159. package/src/Inputs/Business/BankAccount.jsx +0 -39
  160. package/src/Inputs/Business/BankName.jsx +0 -40
  161. package/src/Inputs/Business/CifField.jsx +0 -93
  162. package/src/Inputs/Business/CifFieldContainer.jsx +0 -142
  163. package/src/Inputs/Business/Email.jsx +0 -23
  164. package/src/Inputs/Business/NidField.jsx +0 -77
  165. package/src/Inputs/Business/Phone.jsx +0 -23
  166. package/src/Inputs/Business/index.js +0 -16
  167. package/src/Inputs/Business/request.js +0 -39
  168. package/src/Inputs/CaptchaBox.jsx +0 -131
  169. package/src/Inputs/DateInput.jsx +0 -188
  170. package/src/Inputs/DateTemplate.jsx +0 -213
  171. package/src/Inputs/DelayInputChange.jsx +0 -130
  172. package/src/Inputs/FocusTemplate.jsx +0 -41
  173. package/src/Inputs/InputTemplate.jsx +0 -79
  174. package/src/Inputs/LabelTemplate.jsx +0 -47
  175. package/src/Inputs/NumericInput.jsx +0 -142
  176. package/src/Inputs/NumericTemplate.jsx +0 -155
  177. package/src/Inputs/Selects/County.jsx +0 -19
  178. package/src/Inputs/Selects/Custom.jsx +0 -55
  179. package/src/Inputs/Selects/Simple.jsx +0 -73
  180. package/src/Inputs/Selects/index.jsx +0 -37
  181. package/src/Inputs/SimpleInput.jsx +0 -40
  182. package/src/Inputs/SimpleTextarea.jsx +0 -55
  183. package/src/Inputs/TextareaTemplate.jsx +0 -57
  184. package/src/Inputs/Tooltip.jsx +0 -61
  185. package/src/Inputs/index.js +0 -22
  186. package/src/Messages/Error.jsx +0 -83
  187. package/src/Messages/Loading.jsx +0 -43
  188. package/src/Messages/index.jsx +0 -4
  189. package/src/Modal/Delete.jsx +0 -237
  190. package/src/Modal/Root.jsx +0 -57
  191. package/src/Modal/SimpleModal.jsx +0 -47
  192. package/src/Modal/actions.js +0 -7
  193. package/src/Modal/getComponent.jsx +0 -32
  194. package/src/Modal/index.jsx +0 -12
  195. package/src/Modal/reducer.js +0 -40
  196. package/src/Modal/types.js +0 -6
  197. package/src/Modal/util.js +0 -15
  198. package/src/Payment/EstimatePrice/Description.jsx +0 -101
  199. package/src/Payment/EstimatePrice/PayBox.jsx +0 -173
  200. package/src/Payment/EstimatePrice/index.jsx +0 -63
  201. package/src/Payment/EstimatePrice/util.js +0 -15
  202. package/src/Payment/MobilpayForm.jsx +0 -77
  203. package/src/Payment/Modal/BankTransfer.jsx +0 -129
  204. package/src/Payment/Modal/CompanyValability.jsx +0 -14
  205. package/src/Payment/Modal/DoneForm.jsx +0 -209
  206. package/src/Payment/Modal/PaymentDone.jsx +0 -27
  207. package/src/Payment/Modal/index.js +0 -13
  208. package/src/Payment/actions.jsx +0 -22
  209. package/src/Payment/index.jsx +0 -124
  210. package/src/Payment/request.js +0 -50
  211. package/src/Payment/types.js +0 -14
  212. package/src/Payment/util.jsx +0 -52
  213. package/src/Payment/validate.js +0 -25
  214. package/src/Sidebar.jsx +0 -158
  215. package/src/Things.jsx +0 -35
  216. package/src/actions.js +0 -36
  217. package/src/config.js +0 -7
  218. package/src/dev/ErrorBoundary.jsx +0 -98
  219. package/src/dev/TheError.jsx +0 -87
  220. package/src/dev/index.js +0 -127
  221. package/src/dev/types.js +0 -10
  222. package/src/prod/SentryErrorBoundary.jsx +0 -98
  223. package/src/reducer/captchas.js +0 -44
  224. package/src/reducer/counties.js +0 -46
  225. package/src/reducer/index.js +0 -25
  226. package/src/reducer/module.jsx +0 -43
  227. package/src/style/.sass-lint.yml +0 -84
  228. package/src/style/.stylelintrc.json +0 -161
  229. package/src/style/_fancy-text.scss +0 -37
  230. package/src/style/_fix_bootstrap_placeholder_color.scss +0 -14
  231. package/src/style/_header-company.scss +0 -69
  232. package/src/style/_inputs.scss +0 -12
  233. package/src/style/_minimal.scss +0 -31
  234. package/src/style/_navigation.scss +0 -24
  235. package/src/style/_others.scss +0 -79
  236. package/src/style/index.scss +0 -7
  237. package/src/style/sidebar/_animations.scss +0 -21
  238. package/src/style/sidebar/_dark-theme.scss +0 -77
  239. package/src/style/sidebar/_scroll.scss +0 -37
  240. package/src/style/sidebar/_structure.scss +0 -299
  241. package/src/style/sidebar.scss +0 -4
  242. package/src/types.js +0 -31
  243. package/src/utility/calendar.js +0 -39
  244. package/src/utility/date.js +0 -100
  245. package/src/utility/index.js +0 -12
  246. package/src/utility/language.js +0 -17
  247. package/src/utility/mql.js +0 -3
  248. package/src/utility/normalize-test.js +0 -58
  249. package/src/utility/normalize.js +0 -119
  250. package/src/utility/numbers.js +0 -87
  251. package/src/utility/numeric.js +0 -114
  252. package/src/utility/others.jsx +0 -160
  253. package/src/utility/strings-test.js +0 -136
  254. package/src/utility/strings.js +0 -80
  255. package/src/utility/validation/common.js +0 -360
  256. package/src/utility/validation/index.js +0 -70
  257. package/src/utility/validation/specific.js +0 -9
  258. package/src/utility/validation/validate/bank-test.js +0 -129
  259. package/src/utility/validation/validate/bank.js +0 -176
  260. package/src/utility/validation/validate/cif-test.js +0 -105
  261. package/src/utility/validation/validate/cif.js +0 -44
  262. package/src/utility/validation/validate/cnp-test.js +0 -216
  263. package/src/utility/validation/validate/cnp.js +0 -261
  264. package/src/utility/validation/validate/email-test.js +0 -36
  265. package/src/utility/validation/validate/email.js +0 -6
  266. package/src/utility/validation/validate/index.js +0 -7
  267. package/webpack.config.js +0 -90
  268. package/x25.wiki/Account.md +0 -41
  269. package/x25.wiki/Company.md +0 -39
  270. package/x25.wiki/Header.md +0 -21
  271. package/x25.wiki/Home.md +0 -1
  272. package/x25.wiki/Inputs.md +0 -33
  273. package/x25.wiki/Messages.md +0 -27
  274. package/x25.wiki/Payment.md +0 -42
package/src/Things.jsx DELETED
@@ -1,35 +0,0 @@
1
- // @flow
2
-
3
- import React from "react";
4
-
5
- import ModalRoot from "./Modal/Root";
6
-
7
- import type { Dispatch, State } from "src\\types";
8
-
9
- import { connect } from "react-redux";
10
- import Notifications from "react-notification-system-redux2";
11
-
12
- import { deleteNotification } from "./actions";
13
-
14
- const
15
- mapStateToProps = (state : State) => ({
16
- notifications: state.get("notifications", []),
17
- }),
18
- mapDispatchToProps = (dispatch : Dispatch) => ({
19
- handleDismiss: (notification) => {
20
- dispatch(deleteNotification(notification.key));
21
- },
22
- });
23
-
24
- const NotificationsContainer = connect(mapStateToProps, mapDispatchToProps)(Notifications);
25
-
26
- const Things = () => (
27
- <React.Fragment>
28
- <div className="d-print-none">
29
- <NotificationsContainer />
30
- </div>
31
- <ModalRoot />
32
- </React.Fragment>
33
- );
34
-
35
- export default Things;
package/src/actions.js DELETED
@@ -1,36 +0,0 @@
1
- // @flow
2
-
3
- import type { Action } from "src\\types";
4
-
5
- import Notifications from "react-notification-system-redux2";
6
-
7
- const createNotification = (level : string) => (title : any, options : any) : Action => (
8
- Notifications.show({
9
- title,
10
- position : "tc",
11
- autoDismiss : 3,
12
- ...options,
13
- }, level)
14
- );
15
-
16
- export const notify = createNotification("success");
17
- // export const notifyWarning = createNotification("warning");
18
- export const notifyError = createNotification("error");
19
-
20
- export const deleteNotification = (position : number) : Action => ({
21
- type : "DELETE_NOTIFICATION",
22
- payload : position,
23
- });
24
-
25
- export const showCaptcha = (payload : { id: string ; name : string }) : Action => ({
26
- type: "SHOW_CAPTCHA",
27
- payload,
28
- });
29
-
30
- export const hideCaptcha = (payload : string) : Action => ({
31
- type: "HIDE_CAPTCHA",
32
- payload,
33
- });
34
-
35
- export * from "./Modal/actions";
36
- export * from "./Account/actions";
package/src/config.js DELETED
@@ -1,7 +0,0 @@
1
- // @flow
2
-
3
- export let config : any = {};
4
-
5
- export const setConfiguration = (current : any) => {
6
- config = current;
7
- };
@@ -1,98 +0,0 @@
1
- // @flow
2
-
3
- import type { ErrorType, InfoType } from "./types";
4
-
5
- type ErrorBoundaryProps = {
6
- +error?: ErrorType;
7
- +status?: InfoType;
8
- +children: any;
9
- +info?: string;
10
- }
11
-
12
- type ErrorBoundaryState = {
13
- status: ?string;
14
- error: ?ErrorType;
15
- info: ?InfoType;
16
- }
17
-
18
- import React from "react";
19
-
20
- import TheError from "./TheError";
21
-
22
- const
23
- refreshKeyCode = 82,
24
- timeoutDelay = 200;
25
-
26
- class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
27
-
28
- handleKey: (event : KeyboardEvent) => void;
29
- refresh: () => void;
30
-
31
- componentDidCatch (error : ErrorType, info : InfoType) {
32
- this.setState({
33
- error,
34
- info,
35
- });
36
- }
37
-
38
- constructor (props : ErrorBoundaryProps) {
39
- super(props);
40
-
41
- this.state = {
42
- status : null,
43
- error : null,
44
- info : null,
45
- };
46
-
47
- this.handleKey = (event : KeyboardEvent) => {
48
- if (event.keyCode === refreshKeyCode) {
49
- this.refresh();
50
- }
51
- };
52
-
53
- this.refresh = () => {
54
- this.setState({
55
- status : "Trying to recover...",
56
- error : null,
57
- info : null,
58
- }, () => {
59
- setTimeout(() => {
60
- this.setState({
61
- status : null,
62
- error : null,
63
- info : null,
64
- });
65
- }, timeoutDelay);
66
- });
67
-
68
- };
69
- }
70
-
71
- shouldComponentUpdate () {
72
- return (
73
- true
74
- );
75
- }
76
-
77
- render () {
78
- const { info, error, status } = this.state;
79
-
80
- // render fallback UI
81
- if (error) {
82
- return (
83
- <TheError
84
- error={error}
85
- handleKey={this.handleKey}
86
- info={info}
87
- refresh={this.refresh}
88
- status={status}
89
- />
90
- );
91
- }
92
-
93
- // when there's not an error, render children untouched
94
- return this.props.children;
95
- }
96
- }
97
-
98
- export default ErrorBoundary;
@@ -1,87 +0,0 @@
1
- // @flow
2
-
3
- import type { ErrorType, InfoType } from "./types";
4
-
5
- type TheErrorProps = {
6
- +error: ?ErrorType;
7
- +info: ?InfoType;
8
- +status: ?string;
9
- +refresh: () => void;
10
- +handleKey: (event : KeyboardEvent) => void;
11
- }
12
-
13
- import React from "react";
14
-
15
- const TheError = (props :TheErrorProps) => {
16
-
17
- React.useEffect(() => {
18
- document.addEventListener("keydown", props.handleKey);
19
-
20
- return () => {
21
- document.removeEventListener("keydown", props.handleKey);
22
- };
23
- }, []);
24
-
25
- const { error, info, status, refresh } = props;
26
-
27
- // render fallback UI
28
- return (
29
- <div className="small" tabIndex="0">
30
- <div className=" m-2">
31
- {
32
- status ? (
33
- <div className="text-fancy">{"Trying to recover app..."}</div>
34
- ) : (
35
- <div>
36
- <button
37
- className="btn btn-block btn-sm btn-primary"
38
- onClick={refresh} type="button">
39
- {"Recover the app"}
40
- </button>
41
- <div className="mt-2 mb-2">
42
- {"Press "}
43
- <kbd>{"R"}</kbd>
44
- {" to recover the app, after you've done the changes"}
45
- </div>
46
- <hr />
47
- {
48
- error ? (
49
- <React.Fragment>
50
- <h5 className="text-danger">{error.message}</h5>
51
- <b>{"Stack:"}</b>
52
- <pre>
53
- {
54
- error.stack ? (
55
- error.stack.split("↵").map((line, index) => (
56
- <div key={index}>{line}</div>
57
- ))
58
- ) : null
59
- }
60
- </pre>
61
- </React.Fragment>
62
- ) : null
63
- }
64
- <br />
65
- {
66
- info && info.componentStack ? (
67
- <React.Fragment>
68
- <b>{"React info:"}</b>
69
- <pre>
70
- {
71
- info.componentStack.split("↵").map((line, index) => (
72
- <div key={index}>{line}</div>
73
- ))
74
- }
75
- </pre>
76
- </React.Fragment>
77
- ) : null
78
- }
79
- </div>
80
- )
81
- }
82
- </div>
83
- </div>
84
- );
85
- };
86
-
87
- export default TheError;
package/src/dev/index.js DELETED
@@ -1,127 +0,0 @@
1
- // @flow
2
- /* eslint-disable no-alert, no-console, no-undefined, callback-return, max-len */
3
-
4
- import * as Immutable from "immutable";
5
-
6
- const setFavIconToDev = () => {
7
- const element : any = document.querySelector("link[rel*='icon");
8
-
9
- if (element !== null && element.href) {
10
- element.href = "/static/dev.ico";
11
- }
12
- };
13
-
14
- const ensureImmutableState = (ignored : Array<*> = []) => {
15
-
16
- const ignore = (key : string) => (
17
- ignored.includes(key)
18
- );
19
-
20
- const isGood = (data, key) => (
21
- ignore(key) ||
22
- data === null ||
23
- data === undefined ||
24
- Immutable.isImmutable(data) ||
25
- typeof data === "number" ||
26
- typeof data === "boolean" ||
27
- typeof data === "string"
28
- );
29
-
30
- let
31
- problems : any = Immutable.Map(),
32
- allKeys = Immutable.List(),
33
- currentKey = Immutable.List();
34
-
35
- const listCurrentProblems = () => {
36
- if (currentKey.size !== 0) {
37
- const log = ({ data, state, key }) => {
38
- const itExists = (
39
- typeof data !== "undefined" ||
40
- typeof state !== "undefined" ||
41
- typeof key !== "undefined"
42
- );
43
-
44
- if (itExists) {
45
- console.group("redux-ensure-state-is-immutable");
46
- console.log("data:",
47
- data);
48
- console.log("parent:",
49
- state.toJS());
50
- console.log("typeof data:",
51
- typeof data);
52
- console.log("key:",
53
- key);
54
- console.groupEnd();
55
- }
56
- };
57
-
58
- alert("something is not immutable. check console");
59
-
60
- currentKey.map((current) => log(problems.get(current)));
61
- currentKey = currentKey.clear();
62
- }
63
- };
64
-
65
- const addProblem = ({ data, state, key }) => {
66
- problems = problems.set(key,
67
- {
68
- key,
69
- state,
70
- data,
71
- });
72
-
73
- if (!allKeys.includes(key)) {
74
- allKeys = allKeys.push(key);
75
- currentKey = currentKey.push(key);
76
- }
77
- };
78
-
79
- const shouldParse = (data, key) => (
80
- !ignore(key) &&
81
- Immutable.isImmutable(data)
82
- );
83
-
84
- const checkStateContainsOnlyImmutable = (state) => {
85
- const parse = (data, key) => {
86
- const goodData = isGood(data,
87
- key);
88
- const canParse = shouldParse(data,
89
- key);
90
-
91
- if (!goodData) {
92
- addProblem({
93
- data,
94
- state,
95
- key,
96
- });
97
- }
98
-
99
- listCurrentProblems();
100
-
101
- if (canParse) {
102
- checkStateContainsOnlyImmutable(data);
103
- }
104
- };
105
-
106
- state.forEach((current, key) => {
107
- parse(current,
108
- key);
109
- });
110
- };
111
-
112
- return ({ getState } : any) => (next : any) => (action : any) => {
113
-
114
- const
115
- returnValue = next(action),
116
- state = getState();
117
-
118
- checkStateContainsOnlyImmutable(state);
119
-
120
- return returnValue;
121
- };
122
- };
123
-
124
- export {
125
- setFavIconToDev,
126
- ensureImmutableState,
127
- };
package/src/dev/types.js DELETED
@@ -1,10 +0,0 @@
1
- // @flow
2
-
3
- export type ErrorType = {
4
- message: string;
5
- stack: string;
6
- };
7
-
8
- export type InfoType = {
9
- componentStack: string;
10
- };
@@ -1,98 +0,0 @@
1
- // @flow
2
-
3
- import type { InfoType, ErrorType } from "../dev/types";
4
-
5
- type Props = {
6
- +error?: ErrorType;
7
- +children: any;
8
- +info?: string;
9
- }
10
-
11
- type State = {
12
- error: ?ErrorType;
13
- }
14
-
15
- import * as Sentry from "@sentry/browser";
16
-
17
- import React from "react";
18
-
19
- class ErrorBoundary extends React.Component<Props, State> {
20
-
21
- componentDidCatch (error : ErrorType, errorInfo : InfoType) {
22
- this.setState({ error });
23
-
24
- Sentry.withScope((scope : any) => {
25
- Object.keys(errorInfo).forEach((key) => {
26
- scope.setExtra(key, errorInfo[key]);
27
- });
28
- Sentry.captureException(error);
29
- });
30
- }
31
-
32
- tellUs: () => void;
33
-
34
- constructor (props : Props) {
35
- super(props);
36
-
37
- this.state = {
38
- error: null,
39
- };
40
-
41
- this.tellUs = () => Sentry.showReportDialog({
42
- title : "Se pare că avem probleme.",
43
- subtitle : "Echipa noastră a fost anunțată.",
44
- subtitle2 : `Dacă doriți să ne ajutați, spuneți-ne ce sa întâmplat mai jos.
45
- Ne va ajuta foarte mult`,
46
- labelName : "Numele dvs.",
47
- labelEmail : "Adresa de e-mail",
48
- labelComments : "Ce s-a întâmplat?",
49
- labelClose : "Închide",
50
- labelSubmit : "Trimite",
51
- errorGeneric : `A apărut o eroare necunoscută la trimiterea raportului
52
- dvs. Vă rugăm să încercați din nou.`,
53
- errorFormEntry : "Unele câmpuri au fost nevalide. Corectați erorile și încercați din nou.",
54
- successMessage : "Feedback-ul dvs. a fost trimis. Mulțumesc!",
55
- });
56
- }
57
-
58
- render () {
59
- if (this.state.error) {
60
- // render fallback UI
61
- return (
62
- <div className="jumbotron">
63
- <h1 className="display-4">{"Hrmm... Ceva nu a mers cum trebuia"}</h1>
64
- <p className="lead">
65
- {`Acest mesaj apare când programul a avut o eroare și nu a mai reușit
66
- să îți revină. Administratorul a fost informat automat despre
67
- această problemă. Nu avem decât să ne cerem scuze.`}
68
- </p>
69
- <hr className="my-4" />
70
- <p>
71
- {"Ne-ar fi de mare folos pentru remedierea erori, decă ne-ai "}
72
- <button
73
- className="btn btn-primary text-link"
74
- onClick={this.tellUs} type="button">
75
- {"spune ce s-a întâmplat"}
76
- </button>
77
- </p>
78
- <hr />
79
- <p>
80
- {"Sfat: Încearcă să împrospătezi pagina - apasă tasta "}
81
- <ul>
82
- <li><kbd>{"F5"}</kbd>{" pe sistemul de operare Windows "}</li>
83
- <br />
84
- <li><kbd>{"CMD"}</kbd>{" și "}
85
- <kbd>{"R"}</kbd>{" pe sistemul de operare IOs"}
86
- </li>
87
- </ul>
88
- </p>
89
- </div>
90
- );
91
- }
92
-
93
- // when there's not an error, render children untouched
94
- return this.props.children;
95
- }
96
- }
97
-
98
- export default ErrorBoundary;
@@ -1,44 +0,0 @@
1
- // @flow
2
-
3
- import * as Immutable from "immutable";
4
- import type { State } from "src\\types";
5
-
6
- const initialState = Immutable.Map();
7
-
8
- const
9
- showCaptcha = (state : any, { payload : { name, id } }) => (
10
- state.set(name,
11
- id)
12
- ),
13
- hideCaptcha = (state : any, { payload }) => (
14
- state.delete(payload)
15
- );
16
-
17
- const captchasReducer = (state : any = initialState, action : any) => {
18
- switch (action.type) {
19
- case "SHOW_CAPTCHA":
20
- return showCaptcha(state,
21
- action);
22
-
23
- case "HIDE_CAPTCHA":
24
- return hideCaptcha(state,
25
- action);
26
-
27
- default:
28
- return state;
29
- }
30
- };
31
-
32
- const
33
- getCaptcha = (state : State, name : string) => (
34
- state.getIn([
35
- "captchas",
36
- name,
37
- ]) || ""
38
- );
39
-
40
- export const selectors = {
41
- getCaptcha,
42
- };
43
-
44
- export default captchasReducer;
@@ -1,46 +0,0 @@
1
- // @flow
2
-
3
- import type { Action, State } from "src\\types";
4
-
5
- import * as Immutable from "immutable";
6
- import { createSelector } from "reselect";
7
-
8
- const initialState = Immutable.Map();
9
-
10
- const
11
- fetchCurrentAccountFulfilled = (state : any, { payload }) => (
12
- payload.Counties
13
- );
14
-
15
- const reducer = (state : any = initialState, action : Action) => {
16
- switch (action.type) {
17
- case "FETCH_INITIAL_INFORMATION_FULFILLED":
18
- return fetchCurrentAccountFulfilled(state,
19
- action);
20
-
21
- default:
22
- return state;
23
- }
24
- };
25
-
26
- const
27
- getCounties = (state : State) => state.get("counties"),
28
- getCountiesList = createSelector(
29
- getCounties,
30
- (ids) => ids.toList(),
31
- ),
32
- getCounty = (state : State, id : string) => (
33
- getCounties(state).get(id)
34
- ),
35
- getCountiesSorted = createSelector(
36
- getCountiesList,
37
- (list) => list.sortBy((county) => county.get("Name")),
38
- );
39
-
40
- export const selectors = {
41
- getCounties,
42
- getCounty,
43
- getCountiesSorted,
44
- };
45
-
46
- export default reducer;
@@ -1,25 +0,0 @@
1
- // @flow
2
-
3
- import modal, { selectors as modalSelectors } from "../Modal/reducer";
4
- import account, { selectors as accountSelectors } from "../Account/reducer";
5
-
6
- import captchas, { selectors as captchasReducer } from "./captchas";
7
- import module from "./module";
8
-
9
- const state = {
10
- module,
11
- account,
12
- captchas,
13
- modal,
14
- };
15
-
16
- const selectors = {
17
- ...captchasReducer,
18
- ...accountSelectors,
19
- ...modalSelectors,
20
- };
21
-
22
- export {
23
- state,
24
- selectors,
25
- };
@@ -1,43 +0,0 @@
1
- // @flow
2
-
3
- import * as Immutable from "immutable";
4
-
5
- const initialState = Immutable.Map();
6
-
7
- const
8
- initModule = (state : any, { payload }) => (
9
- state.set(payload, true)
10
- );
11
-
12
- const reducer = (state : any = initialState, action : any) => {
13
-
14
- switch (action.type) {
15
- case "INIT_MODULE":
16
- return initModule(state, action);
17
-
18
- default:
19
- return state;
20
- }
21
- };
22
-
23
- const getIsModuleReady = (state : any, id : string) => (
24
- state.getIn([
25
- "module",
26
- id,
27
- ]) || false
28
- );
29
-
30
- const moduleIsReadyAction = (payload : string) => ({
31
- type: "INIT_MODULE",
32
- payload,
33
- });
34
-
35
- export {
36
- // selectors
37
- getIsModuleReady,
38
-
39
- // actions
40
- moduleIsReadyAction,
41
- };
42
-
43
- export default reducer;