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
@@ -1,139 +0,0 @@
1
- // @flow
2
-
3
- import type { Action, State } from "src\\types";
4
-
5
- import { createSelector } from "reselect";
6
- import * as Immutable from "immutable";
7
-
8
- import { isAdministratorAccount, noError } from "../utility";
9
-
10
- const initialState = Immutable.Map({
11
- error : noError,
12
- fetched : false,
13
- fetching : false,
14
-
15
- info : Immutable.Map(),
16
- companies : Immutable.Map(),
17
- });
18
-
19
- const
20
- fetchCurrentAccountPending = (state : any) => (
21
- state.merge({
22
- error : noError,
23
- fetching : true,
24
- })
25
- ),
26
- fetchCurrentAccountRejected = (state : any, { payload : { error } }) => (
27
- state.merge({
28
- error,
29
- fetching: false,
30
- })
31
- ),
32
- fetchCurrentAccountFulfilled = (state : any, { payload }) => (
33
- state.mergeDeep({
34
- fetched : true,
35
- fetching : false,
36
-
37
- info : payload.Account,
38
- companies : payload.Companies,
39
- })
40
- ),
41
- accountChangePassword = (state : any) => (
42
- state.setIn([
43
- "info",
44
- "RequireChange",
45
- ], false)
46
- ),
47
- accountGaveConsent = (state : any) => (
48
- state.setIn([
49
- "info",
50
- "HasToGiveConsent",
51
- ], false)
52
- );
53
-
54
- const reducer = (state : any = initialState, action : Action) => {
55
-
56
- switch (action.type) {
57
- case "FETCH_INITIAL_INFORMATION_PENDING":
58
- return fetchCurrentAccountPending(state);
59
-
60
- case "FETCH_INITIAL_INFORMATION_REJECTED":
61
- return fetchCurrentAccountRejected(state,
62
- action);
63
-
64
- case "FETCH_INITIAL_INFORMATION_FULFILLED":
65
- return fetchCurrentAccountFulfilled(state,
66
- action);
67
-
68
- case "ACCOUNT_CHANGE_PASSWORD":
69
- return accountChangePassword(state);
70
-
71
- case "ACCOUNT_GAVE_CONSENT":
72
- return accountGaveConsent(state);
73
-
74
- default:
75
- return state;
76
- }
77
- };
78
-
79
- const
80
- getFetched = (state : State) => state.getIn([
81
- "account",
82
- "fetched",
83
- ]),
84
- getError = (state : State) => state.getIn([
85
- "account",
86
- "error",
87
- ]);
88
-
89
- const
90
- getCurrentAccount = (state : State) => state.getIn([
91
- "account",
92
- "info",
93
- ]),
94
- getCurrentAccountCompanies = (state : State) => state.getIn([
95
- "account",
96
- "companies",
97
- ]),
98
- getCurrentAccountIsFetching = (state : State) => state.getIn([
99
- "account",
100
- "fetching",
101
- ]),
102
- getCurrentAccountShouldFetch = createSelector(
103
- getCurrentAccountIsFetching,
104
- getFetched,
105
- getError,
106
- (isFetching, isFetched, error) => (
107
- !isFetching && !isFetched && error === noError
108
- ),
109
- ),
110
- getCurrentAccountIsFetched = createSelector(
111
- getCurrentAccountIsFetching,
112
- getFetched,
113
- getError,
114
- (isFetching, isFetched, error) => (
115
- !isFetching && isFetched && error === noError
116
- ),
117
- ),
118
- getCurrentAccountHasError = createSelector(
119
- getError,
120
- (error) => error !== noError,
121
- ),
122
- getIsCurrentAccountAdministrator = createSelector(
123
- getCurrentAccount,
124
- (account) => (
125
- isAdministratorAccount(account.get("Type"))
126
- ),
127
- );
128
-
129
- export const selectors = {
130
- getCurrentAccountCompanies,
131
- getCurrentAccount,
132
- getCurrentAccountIsFetching,
133
- getCurrentAccountShouldFetch,
134
- getCurrentAccountIsFetched,
135
- getCurrentAccountHasError,
136
- getIsCurrentAccountAdministrator,
137
- };
138
-
139
- export default reducer;
@@ -1,36 +0,0 @@
1
- // @flow
2
-
3
- import agent from "superagent";
4
- import * as Immutable from "immutable";
5
-
6
- import { noError, normalizeArrayByField, withPromiseCallback, normalizeArray } from "../utility";
7
-
8
- const normalizeInitialInformation = (info : any) => {
9
-
10
- const
11
- { Account, IsConnected, Counties, Companies } = info;
12
-
13
- return {
14
- Account : Immutable.Map(Account || {}),
15
- IsConnected,
16
- Error : IsConnected ? noError : "Not connected",
17
- Counties : (typeof Counties === "undefined") ? [] : (
18
- normalizeArrayByField(Counties,
19
- "Short").entities
20
- ),
21
- Companies: (typeof Companies === "undefined") ? [] : (
22
- normalizeArray(Companies).entities
23
- ),
24
- };
25
- };
26
-
27
- export const fetchInitialInformation = (app : string) => (
28
- new Promise((resolve, reject) => (
29
- agent.
30
- get("/api/extern/get-initial-information").
31
- type("form").
32
- query({ app }).
33
- end(withPromiseCallback((reponse) => resolve(normalizeInitialInformation(reponse)),
34
- reject))
35
- )) : Promise<any>
36
- );
@@ -1,114 +0,0 @@
1
- // @flow
2
-
3
- import type { RouteType, PaginatorType } from "./types";
4
-
5
- import type { Dispatch, State } from "src\\types";
6
-
7
- type Props = {
8
- +ready: bool;
9
- +props: any;
10
- +route: RouteType;
11
- +initModule: () => void;
12
- };
13
-
14
- type OwnProps = {
15
- route: RouteType,
16
- props: any;
17
- }
18
-
19
- import * as React from "react";
20
-
21
- import { LoadingMessage } from "../Messages/Loading";
22
- import { injectModals } from "../Modal/util";
23
- import { injectReducer } from "redux-injector";
24
- import { delay } from "../utility";
25
-
26
- const injectPaginator = ({ key, itemsReducer, pagesReducer } : PaginatorType) => {
27
- injectReducer(`entities.${key}`, itemsReducer);
28
- injectReducer(`paginations.${key}`, pagesReducer);
29
- };
30
-
31
- import { connect } from "react-redux";
32
-
33
- import { getIsModuleReady, moduleIsReadyAction } from "../reducer/module";
34
-
35
- const
36
- mapStateToProps = (state : State, { route : { default : { module } } } : OwnProps) => ({
37
- ready: getIsModuleReady(state, module),
38
- }),
39
- mapDispatchToProps = (dispatch : Dispatch, { route } : OwnProps) => ({
40
- initModule () {
41
- const { reducers, modals, paginators, module } = route.default;
42
-
43
- delay().
44
- then(() => {
45
- if (reducers) {
46
- if (Array.isArray(reducers)) {
47
- for (const { key, func } of reducers) {
48
- injectReducer(key, func);
49
- }
50
- } else {
51
- const { key, func } = reducers;
52
-
53
- injectReducer(key, func);
54
- }
55
- }
56
- }).
57
- then(() => {
58
- if (modals) {
59
- injectModals(modals);
60
- }
61
- }).
62
- then(() => {
63
- if (paginators) {
64
- if (Array.isArray(paginators)) {
65
- for (const paginator of paginators) {
66
- injectPaginator(paginator);
67
- }
68
- } else {
69
- injectPaginator(paginators);
70
- }
71
- }
72
- }).
73
- then(() => {
74
- dispatch(moduleIsReadyAction(module));
75
- });
76
- },
77
- });
78
-
79
- class InitModule extends React.Component<Props> {
80
- componentDidMount () {
81
- if (!this.props.ready) {
82
- this.props.initModule();
83
- }
84
- }
85
-
86
- shouldComponentUpdate () {
87
- return (
88
- true
89
- );
90
- }
91
-
92
- render () {
93
- const { route, ready, props } = this.props;
94
- const { Component } = route.default;
95
-
96
- if (ready) {
97
- return <Component {...props} />;
98
- }
99
-
100
- return (
101
- <div className="mt-3">
102
- <LoadingMessage message="Așteaptă un pic..." />
103
- </div>
104
- );
105
- }
106
- }
107
-
108
- const WrapInitModule = connect(mapStateToProps, mapDispatchToProps)(InitModule);
109
-
110
- const createWrap = (route : RouteType, props: any) => (
111
- <WrapInitModule props={props} route={route} />
112
- );
113
-
114
- export default createWrap;
@@ -1,52 +0,0 @@
1
- // @flow
2
-
3
- type LoadingPropTypes = {
4
- +error?: any;
5
- +timedOut: bool;
6
- +pastDelay: bool;
7
- +retry: () => void;
8
- }
9
-
10
- type FireErrorPropTypes = {
11
- error: any;
12
- }
13
-
14
- import React from "react";
15
-
16
- import { LoadingMessage } from "../Messages/Loading";
17
- import SimulatedException from "./SimulatedException";
18
-
19
- import { ErrorBoundary } from "./index";
20
-
21
- const IgnoreThisNode = ({ error : { message, stack } } : FireErrorPropTypes) => {
22
- throw new SimulatedException(message, stack);
23
- };
24
-
25
- const RouteLoading = ({ error, retry, timedOut } : LoadingPropTypes) => {
26
- if (error) {
27
- return (
28
- <ErrorBoundary>
29
- <IgnoreThisNode error={error} />
30
- </ErrorBoundary>
31
- );
32
- }
33
-
34
- if (timedOut) {
35
- return (
36
- <div>{"Se pare că se încarcă mai greu ca de obicei "}
37
- <button
38
- className="btn btn-primary btn-block"
39
- onClick={retry} type="button">{"Încearcă din nou"}
40
- </button>
41
- </div>
42
- );
43
- }
44
-
45
- return (
46
- <div className="mt-3">
47
- <LoadingMessage message="Așteaptă un pic..." />
48
- </div>
49
- );
50
- };
51
-
52
- export default RouteLoading;
@@ -1,19 +0,0 @@
1
- // @flow
2
- /* eslint-disable max-classes-per-file */
3
-
4
- class CustomError<Message: string, Stack: string> extends Error {
5
-
6
- constructor (message: Message, stack: Stack) {
7
- super(message);
8
- this.message = message;
9
- this.name = message;
10
- this.stack = stack;
11
- }
12
- }
13
-
14
- type Message = string;
15
- type Stack = string;
16
-
17
- class SimulatedException extends CustomError<Message, Stack> {}
18
-
19
- export default SimulatedException;
@@ -1,75 +0,0 @@
1
- // @flow
2
- /* eslint-disable new-cap, react/prefer-stateless-function, react/require-optimization */
3
-
4
-
5
- type LoaderType = (path : string) => void;
6
-
7
- import Loadable from "react-loadable";
8
- import * as React from "react";
9
-
10
- import RouteLoading from "./RouteLoading";
11
- import InitModule from "./InitModule";
12
-
13
- // type injectPaginatorTypes = {
14
- // key: string,
15
- // itemsReducer: any;
16
- // pagesReducer: any;
17
- // };
18
- // import { injectReducer } from "redux-injector";
19
- // import { injectModals } from "../Modal/util";
20
-
21
- const
22
- timeout = 15000;
23
-
24
- export let
25
- ErrorBoundary = () => (
26
- <div>{"No ErrorBoundary passed to x25"}</div>
27
- );
28
-
29
- // const injectPaginator = ({ key, itemsReducer, pagesReducer } : injectPaginatorTypes) => {
30
- // injectReducer(`entities.${key}`, itemsReducer);
31
- // injectReducer(`paginations.${key}`, pagesReducer);
32
- // };
33
-
34
- // const renderWithReducer = (route, props) => {
35
- // const { Component, reducers, modals, paginators } = route.default;
36
- //
37
- // if (reducers) {
38
- // if (Array.isArray(reducers)) {
39
- // for (const { key, func } of reducers) {
40
- // injectReducer(key, func);
41
- // }
42
- // } else {
43
- // const { key, func } = reducers;
44
- //
45
- // injectReducer(key, func);
46
- // }
47
- // }
48
- //
49
- // if (modals) {
50
- // injectModals(modals);
51
- // }
52
- //
53
- // if (paginators) {
54
- // if (Array.isArray(paginators)) {
55
- // for (const paginator of paginators) {
56
- // injectPaginator(paginator);
57
- // }
58
- // } else {
59
- // injectPaginator(paginators);
60
- // }
61
- // }
62
- //
63
- // return <Component {...props} />;
64
- // };
65
-
66
- export const setErrorBoundary = (theError : React.Node) => {
67
- ErrorBoundary = theError;
68
- };
69
-
70
- export const createAsyncRoute = (loader : LoaderType) => Loadable({
71
- loader,
72
- loading : RouteLoading,
73
- render : InitModule,
74
- timeout,
75
- });
@@ -1,39 +0,0 @@
1
- // @flow
2
-
3
- // import * as React from "react";
4
-
5
- import type { State } from "src\\types";
6
- import type { ModalsTypes } from "../Modal/types";
7
-
8
- type Reducer = (state : State, action : any) => void;
9
-
10
- type ReducerOptionsType = {
11
- key: string,
12
- func: Reducer,
13
- };
14
-
15
- type PaginatorType = {
16
- key: string,
17
- itemsReducer: Reducer;
18
- pagesReducer: Reducer;
19
- };
20
-
21
- type ReducersTypes = Array<ReducerOptionsType> | ReducerOptionsType;
22
- type PaginatorsTypes = Array<PaginatorType> | PaginatorType;
23
-
24
- type RouteType = {
25
- default: {
26
- module: string,
27
- Component: any,
28
- reducers: ReducersTypes,
29
- modals: ModalsTypes,
30
- paginators: PaginatorsTypes,
31
- },
32
- }
33
-
34
- export type {
35
- ReducersTypes,
36
- PaginatorsTypes,
37
- PaginatorType,
38
- RouteType,
39
- };
@@ -1,84 +0,0 @@
1
- // @flow
2
- /* eslint-disable react/require-optimization */
3
-
4
- import type { Dispatch, State } from "src\\types";
5
-
6
- type PropTypes = {
7
- +isAdministrator: bool;
8
- +isFetching: bool;
9
- +hasError: bool;
10
-
11
- +data: any;
12
- +shouldFetch: any;
13
- +children: any;
14
-
15
- +fetchCurrentCompany: () => void;
16
- }
17
-
18
- import React from "react";
19
-
20
- import { withRouter } from "react-router-dom";
21
- // import moment from "moment";
22
- import { connect } from "react-redux";
23
-
24
- import { selectors } from "./reducer";
25
- import { accountSelectors } from "../Account";
26
-
27
- import { fetchCurrentCompany as fetchCurrentCompanyAction } from "./actions";
28
-
29
- import { LargeErrorMessage, LoadingMessage } from "../Messages";
30
-
31
- // import EstimatePrice from "../Payment/EstimatePrice";
32
-
33
- const
34
- mapStateToProps = (state : State) => ({
35
- isAdministrator : accountSelectors.getIsCurrentAccountAdministrator(state),
36
- data : selectors.getCurrentCompany(state),
37
- hasError : selectors.getCurrentCompanyHasError(state),
38
- fetched : selectors.getCurrentCompanyIsFetched(state),
39
- isFetching : selectors.getCurrentCompanyIsFetching(state),
40
- shouldFetch : selectors.getCurrentCompanyShouldFetch(state),
41
- }),
42
- mapDispatchToProps = (dispatch : Dispatch, { match : { params : { company } } }) => ({
43
- fetchCurrentCompany () {
44
- dispatch(fetchCurrentCompanyAction(company));
45
- },
46
- });
47
-
48
-
49
- const LoadCompany = (props : PropTypes) => {
50
- const { children, data, isFetching, shouldFetch, hasError, fetchCurrentCompany } = props;
51
-
52
- React.useEffect(() => {
53
- if (shouldFetch) {
54
- fetchCurrentCompany();
55
- }
56
- }, [
57
- shouldFetch,
58
- isFetching,
59
- hasError,
60
- ]);
61
-
62
- if (isFetching) {
63
- return (
64
- <LoadingMessage message="Așteaptă..." />
65
- );
66
- }
67
-
68
- if (hasError) {
69
- return (
70
- <LargeErrorMessage
71
- message="Nu am putut stabili conexiunea cu server-ul"
72
- onRetry={fetchCurrentCompany}
73
- />
74
- );
75
- }
76
-
77
- if (data.size === 0) {
78
- return null;
79
- }
80
-
81
- return children;
82
- };
83
-
84
- export default withRouter(connect(mapStateToProps, mapDispatchToProps)(LoadCompany));
@@ -1,10 +0,0 @@
1
- // @flow
2
-
3
- import type { Action } from "src\\types";
4
-
5
- import { fetchCurrentCompany as fetchCurrentCompanyRequest } from "./request";
6
-
7
- export const fetchCurrentCompany = (rawID : string) : Action => ({
8
- type : "FETCH_CURRENT_COMPANY_INFO",
9
- payload : fetchCurrentCompanyRequest(rawID),
10
- });
@@ -1,11 +0,0 @@
1
- // @flow
2
-
3
- import companyReducer, { selectors as companySelectors } from "./reducer";
4
-
5
- import LoadCompany from "./Load";
6
-
7
- export {
8
- companySelectors,
9
- companyReducer,
10
- LoadCompany,
11
- };