x25 2.9.2 → 3.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/.eslintignore +2 -0
  2. package/.eslintrc.json +275 -0
  3. package/.flowconfig +23 -0
  4. package/conf/dev.js +19 -0
  5. package/conf/dist.js +19 -0
  6. package/conf/polyfills/tempPolyfills.js +7 -0
  7. package/package.json +16 -16
  8. package/src/Account/Load.jsx +79 -0
  9. package/src/Account/actions.js +10 -0
  10. package/src/Account/index.js +11 -0
  11. package/src/Account/reducer.js +139 -0
  12. package/src/Account/request.js +36 -0
  13. package/src/Async/InitModule.jsx +114 -0
  14. package/src/Async/RouteLoading.jsx +52 -0
  15. package/src/Async/SimulatedException.jsx +19 -0
  16. package/src/Async/index.jsx +75 -0
  17. package/src/Async/types.js +39 -0
  18. package/src/Company/Load.jsx +84 -0
  19. package/src/Company/actions.js +10 -0
  20. package/src/Company/index.js +11 -0
  21. package/src/Company/reducer.js +201 -0
  22. package/src/Company/request.js +30 -0
  23. package/src/Company/util.js +7 -0
  24. package/src/Header/AccountOptionsContainer.jsx +124 -0
  25. package/src/Header/AdminSelectCompany.jsx +101 -0
  26. package/src/Header/ClientSelectCompany.jsx +90 -0
  27. package/src/Header/Header.jsx +120 -0
  28. package/src/Header/HeaderContainer.jsx +30 -0
  29. package/src/Header/Logo.jsx +16 -0
  30. package/src/Header/LogoutButton.jsx +34 -0
  31. package/src/Header/index.jsx +9 -0
  32. package/src/Header/request.js +28 -0
  33. package/src/Header/types.js +6 -0
  34. package/src/Header/util.jsx +61 -0
  35. package/src/Inputs/Business/BankAccount.jsx +39 -0
  36. package/src/Inputs/Business/BankName.jsx +40 -0
  37. package/src/Inputs/Business/CifField.jsx +93 -0
  38. package/src/Inputs/Business/CifFieldContainer.jsx +142 -0
  39. package/src/Inputs/Business/Email.jsx +23 -0
  40. package/src/Inputs/Business/NidField.jsx +77 -0
  41. package/src/Inputs/Business/Phone.jsx +23 -0
  42. package/src/Inputs/Business/index.js +16 -0
  43. package/src/Inputs/Business/request.js +39 -0
  44. package/src/Inputs/CaptchaBox.jsx +131 -0
  45. package/src/Inputs/DateInput.jsx +188 -0
  46. package/src/Inputs/DateTemplate.jsx +213 -0
  47. package/src/Inputs/DelayInputChange.jsx +130 -0
  48. package/src/Inputs/FocusTemplate.jsx +41 -0
  49. package/src/Inputs/InputTemplate.jsx +79 -0
  50. package/src/Inputs/LabelTemplate.jsx +47 -0
  51. package/src/Inputs/NumericInput.jsx +142 -0
  52. package/src/Inputs/NumericTemplate.jsx +155 -0
  53. package/src/Inputs/Selects/County.jsx +19 -0
  54. package/src/Inputs/Selects/Custom.jsx +55 -0
  55. package/src/Inputs/Selects/Simple.jsx +73 -0
  56. package/src/Inputs/Selects/index.jsx +37 -0
  57. package/src/Inputs/SimpleInput.jsx +40 -0
  58. package/src/Inputs/SimpleTextarea.jsx +55 -0
  59. package/src/Inputs/TextareaTemplate.jsx +57 -0
  60. package/src/Inputs/Tooltip.jsx +61 -0
  61. package/src/Inputs/index.js +22 -0
  62. package/src/Messages/Error.jsx +83 -0
  63. package/src/Messages/Loading.jsx +43 -0
  64. package/src/Messages/index.jsx +4 -0
  65. package/src/Modal/Delete.jsx +237 -0
  66. package/src/Modal/Root.jsx +57 -0
  67. package/src/Modal/SimpleModal.jsx +47 -0
  68. package/src/Modal/actions.js +7 -0
  69. package/src/Modal/getComponent.jsx +32 -0
  70. package/src/Modal/index.jsx +12 -0
  71. package/src/Modal/reducer.js +40 -0
  72. package/src/Modal/types.js +6 -0
  73. package/src/Modal/util.js +15 -0
  74. package/src/Payment/EstimatePrice/Description.jsx +101 -0
  75. package/src/Payment/EstimatePrice/PayBox.jsx +173 -0
  76. package/src/Payment/EstimatePrice/index.jsx +63 -0
  77. package/src/Payment/EstimatePrice/util.js +15 -0
  78. package/src/Payment/MobilpayForm.jsx +77 -0
  79. package/src/Payment/Modal/BankTransfer.jsx +129 -0
  80. package/src/Payment/Modal/CompanyValability.jsx +14 -0
  81. package/src/Payment/Modal/DoneForm.jsx +209 -0
  82. package/src/Payment/Modal/PaymentDone.jsx +27 -0
  83. package/src/Payment/Modal/index.js +13 -0
  84. package/src/Payment/actions.jsx +22 -0
  85. package/{Payment → src/Payment}/codes.js +16 -19
  86. package/src/Payment/index.jsx +124 -0
  87. package/src/Payment/request.js +50 -0
  88. package/src/Payment/types.js +14 -0
  89. package/src/Payment/util.jsx +52 -0
  90. package/src/Payment/validate.js +25 -0
  91. package/src/Sidebar.jsx +158 -0
  92. package/src/Things.jsx +35 -0
  93. package/src/actions.js +36 -0
  94. package/src/config.js +7 -0
  95. package/src/dev/ErrorBoundary.jsx +98 -0
  96. package/src/dev/TheError.jsx +87 -0
  97. package/src/dev/index.js +127 -0
  98. package/src/dev/types.js +10 -0
  99. package/src/prod/SentryErrorBoundary.jsx +98 -0
  100. package/src/reducer/captchas.js +44 -0
  101. package/src/reducer/counties.js +46 -0
  102. package/src/reducer/index.js +25 -0
  103. package/src/reducer/module.jsx +43 -0
  104. package/src/style/.sass-lint.yml +84 -0
  105. package/src/style/.stylelintrc.json +161 -0
  106. package/src/style/_fancy-text.scss +37 -0
  107. package/src/style/_fix_bootstrap_placeholder_color.scss +14 -0
  108. package/src/style/_header-company.scss +69 -0
  109. package/src/style/_inputs.scss +12 -0
  110. package/src/style/_minimal.scss +31 -0
  111. package/src/style/_navigation.scss +24 -0
  112. package/src/style/_others.scss +79 -0
  113. package/src/style/index.scss +7 -0
  114. package/src/style/sidebar/_animations.scss +21 -0
  115. package/src/style/sidebar/_dark-theme.scss +77 -0
  116. package/src/style/sidebar/_scroll.scss +37 -0
  117. package/src/style/sidebar/_structure.scss +299 -0
  118. package/src/style/sidebar.scss +4 -0
  119. package/src/types.js +31 -0
  120. package/src/utility/calendar.js +39 -0
  121. package/src/utility/date.js +100 -0
  122. package/src/utility/index.js +12 -0
  123. package/src/utility/language.js +17 -0
  124. package/src/utility/mql.js +3 -0
  125. package/src/utility/normalize-test.js +58 -0
  126. package/src/utility/normalize.js +119 -0
  127. package/src/utility/numbers.js +87 -0
  128. package/src/utility/numeric.js +114 -0
  129. package/src/utility/others.jsx +160 -0
  130. package/src/utility/strings-test.js +136 -0
  131. package/src/utility/strings.js +80 -0
  132. package/src/utility/validation/common.js +360 -0
  133. package/src/utility/validation/index.js +70 -0
  134. package/src/utility/validation/specific.js +9 -0
  135. package/src/utility/validation/validate/bank-test.js +129 -0
  136. package/src/utility/validation/validate/bank.js +176 -0
  137. package/src/utility/validation/validate/cif-test.js +105 -0
  138. package/src/utility/validation/validate/cif.js +44 -0
  139. package/src/utility/validation/validate/cnp-test.js +216 -0
  140. package/src/utility/validation/validate/cnp.js +261 -0
  141. package/{utility → src/utility}/validation/validate/date.js +73 -61
  142. package/src/utility/validation/validate/email-test.js +36 -0
  143. package/src/utility/validation/validate/email.js +6 -0
  144. package/src/utility/validation/validate/index.js +7 -0
  145. package/webpack.config.js +90 -0
  146. package/x25.wiki/Account.md +41 -0
  147. package/x25.wiki/Company.md +39 -0
  148. package/x25.wiki/Header.md +21 -0
  149. package/x25.wiki/Home.md +1 -0
  150. package/x25.wiki/Inputs.md +33 -0
  151. package/x25.wiki/Messages.md +27 -0
  152. package/x25.wiki/Payment.md +42 -0
  153. package/Account/Load.js +0 -75
  154. package/Account/actions.js +0 -15
  155. package/Account/index.js +0 -20
  156. package/Account/reducer.js +0 -122
  157. package/Account/request.js +0 -44
  158. package/Async/InitModule.js +0 -190
  159. package/Async/RouteLoading.js +0 -64
  160. package/Async/SimulatedException.js +0 -44
  161. package/Async/index.js +0 -95
  162. package/Async/types.js +0 -1
  163. package/Company/Load.js +0 -82
  164. package/Company/actions.js +0 -15
  165. package/Company/index.js +0 -20
  166. package/Company/reducer.js +0 -165
  167. package/Company/request.js +0 -36
  168. package/Company/util.js +0 -10
  169. package/Header/AccountOptionsContainer.js +0 -144
  170. package/Header/AdminSelectCompany.js +0 -109
  171. package/Header/ClientSelectCompany.js +0 -104
  172. package/Header/Header.js +0 -127
  173. package/Header/HeaderContainer.js +0 -39
  174. package/Header/Logo.js +0 -30
  175. package/Header/LogoutButton.js +0 -39
  176. package/Header/index.js +0 -19
  177. package/Header/request.js +0 -26
  178. package/Header/types.js +0 -1
  179. package/Header/util.js +0 -58
  180. package/Inputs/Business/BankAccount.js +0 -48
  181. package/Inputs/Business/BankName.js +0 -49
  182. package/Inputs/Business/CifField.js +0 -112
  183. package/Inputs/Business/CifFieldContainer.js +0 -157
  184. package/Inputs/Business/Email.js +0 -37
  185. package/Inputs/Business/NidField.js +0 -91
  186. package/Inputs/Business/Phone.js +0 -37
  187. package/Inputs/Business/index.js +0 -34
  188. package/Inputs/Business/request.js +0 -39
  189. package/Inputs/CaptchaBox.js +0 -151
  190. package/Inputs/DateInput.js +0 -172
  191. package/Inputs/DateTemplate.js +0 -200
  192. package/Inputs/DelayInputChange.js +0 -135
  193. package/Inputs/FocusTemplate.js +0 -47
  194. package/Inputs/InputTemplate.js +0 -78
  195. package/Inputs/LabelTemplate.js +0 -59
  196. package/Inputs/NumericInput.js +0 -139
  197. package/Inputs/NumericTemplate.js +0 -148
  198. package/Inputs/Selects/County.js +0 -29
  199. package/Inputs/Selects/Custom.js +0 -56
  200. package/Inputs/Selects/Simple.js +0 -75
  201. package/Inputs/Selects/index.js +0 -52
  202. package/Inputs/SimpleInput.js +0 -42
  203. package/Inputs/SimpleTextarea.js +0 -47
  204. package/Inputs/TextareaTemplate.js +0 -55
  205. package/Inputs/Tooltip.js +0 -82
  206. package/Inputs/index.js +0 -185
  207. package/Messages/Error.js +0 -106
  208. package/Messages/Loading.js +0 -68
  209. package/Messages/index.js +0 -29
  210. package/Modal/Delete.js +0 -240
  211. package/Modal/Root.js +0 -81
  212. package/Modal/SimpleModal.js +0 -57
  213. package/Modal/actions.js +0 -10
  214. package/Modal/getComponent.js +0 -42
  215. package/Modal/index.js +0 -22
  216. package/Modal/reducer.js +0 -53
  217. package/Modal/types.js +0 -7
  218. package/Modal/util.js +0 -17
  219. package/Payment/EstimatePrice/Description.js +0 -92
  220. package/Payment/EstimatePrice/PayBox.js +0 -220
  221. package/Payment/EstimatePrice/index.js +0 -92
  222. package/Payment/EstimatePrice/util.js +0 -21
  223. package/Payment/MobilpayForm.js +0 -86
  224. package/Payment/Modal/BankTransfer.js +0 -233
  225. package/Payment/Modal/CompanyValability.js +0 -28
  226. package/Payment/Modal/DoneForm.js +0 -222
  227. package/Payment/Modal/PaymentDone.js +0 -53
  228. package/Payment/Modal/index.js +0 -27
  229. package/Payment/actions.js +0 -23
  230. package/Payment/index.js +0 -141
  231. package/Payment/request.js +0 -49
  232. package/Payment/types.js +0 -1
  233. package/Payment/util.js +0 -50
  234. package/Payment/validate.js +0 -23
  235. package/Sidebar.js +0 -156
  236. package/Things.js +0 -53
  237. package/actions.js +0 -73
  238. package/config.js +0 -10
  239. package/dev/ErrorBoundary.js +0 -109
  240. package/dev/TheError.js +0 -113
  241. package/dev/index.js +0 -132
  242. package/dev/types.js +0 -1
  243. package/prod/SentryErrorBoundary.js +0 -150
  244. package/reducer/captchas.js +0 -51
  245. package/reducer/counties.js +0 -57
  246. package/reducer/index.js +0 -38
  247. package/reducer/module.js +0 -48
  248. package/style/index.css +0 -1
  249. package/style/sidebar.css +0 -1
  250. package/types.js +0 -1
  251. package/utility/calendar.js +0 -45
  252. package/utility/date.js +0 -111
  253. package/utility/index.js +0 -125
  254. package/utility/language.js +0 -20
  255. package/utility/mql.js +0 -6
  256. package/utility/normalize-test.js +0 -54
  257. package/utility/normalize.js +0 -108
  258. package/utility/numbers.js +0 -93
  259. package/utility/numeric.js +0 -103
  260. package/utility/others.js +0 -142
  261. package/utility/strings-test.js +0 -216
  262. package/utility/strings.js +0 -85
  263. package/utility/validation/common.js +0 -278
  264. package/utility/validation/index.js +0 -110
  265. package/utility/validation/specific.js +0 -14
  266. package/utility/validation/validate/bank-test.js +0 -41
  267. package/utility/validation/validate/bank.js +0 -176
  268. package/utility/validation/validate/cif-test.js +0 -37
  269. package/utility/validation/validate/cif.js +0 -44
  270. package/utility/validation/validate/cnp-test.js +0 -68
  271. package/utility/validation/validate/cnp.js +0 -193
  272. package/utility/validation/validate/email-test.js +0 -30
  273. package/utility/validation/validate/email.js +0 -11
  274. package/utility/validation/validate/index.js +0 -65
package/.eslintignore ADDED
@@ -0,0 +1,2 @@
1
+ webpack.config.js
2
+ node_modules
package/.eslintrc.json ADDED
@@ -0,0 +1,275 @@
1
+ {
2
+ "env":{
3
+ "browser":true,
4
+ "es6":true,
5
+ "jest":true
6
+ },
7
+ "parser":"babel-eslint",
8
+ "extends":[
9
+ "eslint:all",
10
+ "plugin:react/all",
11
+ "plugin:react-hooks/recommended"
12
+ ],
13
+ "settings": {
14
+ "react": {
15
+ "pragma": "React",
16
+ "version": "16.12.0",
17
+ "flowVersion": "0.112.0"
18
+ }
19
+ },
20
+ "parserOptions":{
21
+ "ecmaVersion":2018,
22
+ "ecmaFeatures":{
23
+ "jsx":true,
24
+ "modules":true
25
+ },
26
+ "sourceType":"module"
27
+ },
28
+ "plugins":[
29
+ "react"
30
+ ],
31
+ "rules":{
32
+ "react/require-optimization": 0,
33
+ "default-param-last": 0,
34
+ "react/jsx-props-no-spreading": 0,
35
+ "function-call-argument-newline": ["error", "consistent"],
36
+
37
+ "react/no-deprecated": 0,
38
+ "max-lines-per-function": ["error", { "max": 300 }],
39
+
40
+ "react/jsx-fragments": 0,
41
+ "react/state-in-constructor": 0,
42
+ "react/jsx-handler-names":0,
43
+ "no-confusing-arrow":0,
44
+ "max-statements":0,
45
+ "react/destructuring-assignment":0,
46
+ "react/no-unused-prop-types":0,
47
+ "react/require-default-props":0,
48
+ "react/jsx-sort-default-props":0,
49
+ "react/jsx-max-depth":0,
50
+ "prefer-promise-reject-errors":0,
51
+ "react/no-unused-state": 0,
52
+ "react/jsx-one-expression-per-line":0,
53
+ "react/jsx-no-literals":0,
54
+ "react/default-props-match-prop-types":0,
55
+ "padding-line-between-statements":[
56
+ "error",
57
+ {
58
+ "blankLine":"always",
59
+ "prev":[
60
+ "const",
61
+ "let",
62
+ "var"
63
+ ],
64
+ "next":"*"
65
+ },
66
+ {
67
+ "blankLine":"any",
68
+ "prev":[
69
+ "const",
70
+ "let",
71
+ "var"
72
+ ],
73
+ "next":[
74
+ "const",
75
+ "let",
76
+ "var"
77
+ ]
78
+ }
79
+ ],
80
+ "react/forbid-component-props":0,
81
+ "react/no-multi-comp":0,
82
+ "react/no-set-state":0,
83
+ "react/jsx-closing-bracket-location":0,
84
+ "react/jsx-max-props-per-line":0,
85
+ "no-underscore-dangle":0,
86
+ "function-paren-newline":0,
87
+ "no-nested-ternary":0,
88
+ "max-params":[
89
+ "error",
90
+ 5
91
+ ],
92
+ "multiline-comment-style":0,
93
+ "lines-between-class-members":[
94
+ "error",
95
+ "always",
96
+ {
97
+ "exceptAfterSingleLine":true
98
+ }
99
+ ],
100
+ "react/jsx-indent-props":0,
101
+ "react/jsx-indent":0,
102
+ "react/no-array-index-key":0,
103
+ "react/jsx-curly-brace-presence":[
104
+ 2,
105
+ {
106
+ "props":"never",
107
+ "children":"ignore"
108
+ }
109
+ ],
110
+ "react/sort-comp":[
111
+ 2,
112
+ {
113
+ "order":[
114
+ "static-methods",
115
+ "lifecycle",
116
+ "render"
117
+ ],
118
+ "groups":{
119
+ "lifecycle":[
120
+ "defaultProps",
121
+ "props",
122
+ "contextTypes",
123
+ "childContextTypes",
124
+ "statics",
125
+ "state",
126
+ "everything-else",
127
+ "constructor",
128
+ "getDefaultProps",
129
+ "getInitialState",
130
+ "getChildContext",
131
+ "componentWillMount",
132
+ "componentDidMount",
133
+ "componentWillReceiveProps",
134
+ "shouldComponentUpdate",
135
+ "componentWillUpdate",
136
+ "componentDidUpdate",
137
+ "componentWillUnmount"
138
+ ]
139
+ }
140
+ }
141
+ ],
142
+ "new-cap":[
143
+ 2,
144
+ {
145
+ "capIsNewExceptions":[
146
+ "List",
147
+ "Map",
148
+ "OrderedList",
149
+ "OrderedMap",
150
+ "OrderedSet",
151
+ "Record",
152
+ "Stack"
153
+ ]
154
+ }
155
+ ],
156
+ "comma-dangle":[
157
+ "error",
158
+ "always-multiline"
159
+ ],
160
+ "no-extra-parens":[
161
+ "off"
162
+ ],
163
+ "no-magic-numbers":[
164
+ "error",
165
+ {
166
+ "ignore":[
167
+ 0,
168
+ 1,
169
+ 2,
170
+ 10
171
+ ],
172
+ "ignoreArrayIndexes":true
173
+ }
174
+ ],
175
+ "strict":[
176
+ "error",
177
+ "global"
178
+ ],
179
+ "max-lines":[
180
+ 2,
181
+ 450
182
+ ],
183
+ "max-len":[
184
+ "error",
185
+ 105
186
+ ],
187
+ "object-curly-spacing":[
188
+ "error",
189
+ "always"
190
+ ],
191
+ "indent":[
192
+ "error",
193
+ 2,
194
+ {
195
+ "SwitchCase":1
196
+ }
197
+ ],
198
+ "linebreak-style":[
199
+ "error",
200
+ "windows"
201
+ ],
202
+ "padded-blocks":[
203
+ "off"
204
+ ],
205
+ "one-var":[
206
+ "off"
207
+ ],
208
+ "no-ternary":[
209
+ "off"
210
+ ],
211
+ "multiline-ternary":[
212
+ "off"
213
+ ],
214
+ "quote-props":[
215
+ "error",
216
+ "consistent"
217
+ ],
218
+ "object-curly-newline":[
219
+ "off"
220
+ ],
221
+ "quotes":[
222
+ "error",
223
+ "double",
224
+ "avoid-escape"
225
+ ],
226
+ "semi":[
227
+ "error"
228
+ ],
229
+ "sort-vars":[
230
+ "off"
231
+ ],
232
+ "sort-keys":[
233
+ "off"
234
+ ],
235
+ "sort-imports":[
236
+ "off"
237
+ ],
238
+ "capitalized-comments":[
239
+ "off"
240
+ ],
241
+ "arrow-body-style":[
242
+ "error",
243
+ "as-needed"
244
+ ],
245
+ "arrow-parens":[
246
+ "error",
247
+ "always"
248
+ ],
249
+ "class-methods-use-this":[
250
+ "error",
251
+ {
252
+ "exceptMethods":[
253
+ "componentDidMount",
254
+ "componentDidUpdate",
255
+ "componentWillMount",
256
+ "componentWillReceiveProps",
257
+ "componentWillUnmount",
258
+ "componentWillUpdate",
259
+ "render",
260
+ "shouldComponentUpdate"
261
+ ]
262
+ }
263
+ ],
264
+ "key-spacing":[
265
+ "error",
266
+ {
267
+ "align":{
268
+ "beforeColon":true,
269
+ "afterColon":true,
270
+ "on":"colon"
271
+ }
272
+ }
273
+ ]
274
+ }
275
+ }
package/.flowconfig ADDED
@@ -0,0 +1,23 @@
1
+ [ignore]
2
+ .*/node_modules/fbjs/.*
3
+ .*/node_modules/config-chain/test/broken.json
4
+ .*/node_modules/npmconf/test/.*
5
+ .*/node_modules/npm/test/.*
6
+ [untyped]
7
+ .*/node_modules/react-select/.*
8
+ [include]
9
+ [libs]
10
+ src/types
11
+ [options]
12
+ emoji=true
13
+ esproposal.class_static_fields=enable
14
+ module.file_ext=.css
15
+ module.file_ext=.js
16
+ module.file_ext=.json
17
+ module.file_ext=.jsx
18
+ module.file_ext=.scss
19
+ module.ignore_non_literal_requires=true
20
+ suppress_type=$FlowIssue
21
+ suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
22
+ suppress_type=$Intl
23
+ module.name_mapper='^src\(.*\)$' -> '<PROJECT_ROOT>/src/\1'
package/conf/dev.js ADDED
@@ -0,0 +1,19 @@
1
+ // @flow
2
+ /* eslint-disable no-console, no-undefined */
3
+
4
+ const fileName = "config.json";
5
+
6
+ const fs = require("fs");
7
+
8
+ const file = require(`../${fileName}`);
9
+
10
+ file.isProduction = false;
11
+
12
+ fs.writeFile(fileName, JSON.stringify(file, null, 2), (err) => {
13
+
14
+ if (err) {
15
+ return console.log(err);
16
+ }
17
+
18
+ return undefined;
19
+ });
package/conf/dist.js ADDED
@@ -0,0 +1,19 @@
1
+ // @flow
2
+ /* eslint-disable no-console, no-undefined */
3
+
4
+ const fileName = "config.json";
5
+
6
+ const fs = require("fs");
7
+
8
+ const file = require(`../${fileName}`);
9
+
10
+ file.isProduction = true;
11
+
12
+ fs.writeFile(fileName, JSON.stringify(file, null, 2), (err) => {
13
+
14
+ if (err) {
15
+ return console.log(err);
16
+ }
17
+
18
+ return undefined;
19
+ });
@@ -0,0 +1,7 @@
1
+ /* eslint-disable */
2
+
3
+ const raf = global.requestAnimationFrame = (cb) => {
4
+ setTimeout(cb, 0);
5
+ }
6
+
7
+ export default raf;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.9.2",
2
+ "version": "3.0.0",
3
3
  "name": "x25",
4
4
  "description": "x25",
5
5
  "scripts": {
@@ -7,7 +7,7 @@
7
7
  "build-babel": "babel src --out-dir dist",
8
8
  "build": "npm run build-scss && npm run build-babel",
9
9
  "clean": "rimraf dist dist",
10
- "check": "npm-check -u -i babel-jest -i jest --specials=bin,eslint,babel,webpack",
10
+ "check": "npm-check -u -i babel-jest -i jest -i history --specials=bin,eslint,babel,webpack",
11
11
  "flow": "flow check --color=always",
12
12
  "eslint": "eslint --ext .jsx,.js src --fix",
13
13
  "copy": "copy package.json dist",
@@ -20,7 +20,7 @@
20
20
  "url": "git+https://github.com/cristian-sima/x25.git"
21
21
  },
22
22
  "keywords": [],
23
- "author": "Cristian Sima",
23
+ "author": "SC SIDEWORK SRL",
24
24
  "license": "MIT",
25
25
  "bugs": {
26
26
  "url": "https://github.com/cristian-sima/x25/issues"
@@ -56,7 +56,7 @@
56
56
  }
57
57
  },
58
58
  "engines": {
59
- "node": ">= 6.3.1"
59
+ "node": ">= 15.0.0"
60
60
  },
61
61
  "jest": {
62
62
  "transform": {
@@ -95,6 +95,7 @@
95
95
  "eslint-plugin-flowtype": "^4.4.1",
96
96
  "eslint-plugin-jsx-a11y": "^6.2.3",
97
97
  "eslint-plugin-react": "^7.16.0",
98
+ "eslint-plugin-react-hooks": "^4.3.0",
98
99
  "file-loader": "^4.3.0",
99
100
  "flow-bin": "^0.112.0",
100
101
  "flow-status-webpack-plugin": "^0.1.7",
@@ -103,11 +104,10 @@
103
104
  "json-loader": "^0.5.7",
104
105
  "node-sass": "^4.13.0",
105
106
  "npm": "^6.13.1",
106
- "npm-check": "^5.9.0",
107
+ "npm-check": "^5.9.2",
107
108
  "npm-check-unused": "^6.0.0",
108
109
  "npm-check-updates": "^3.2.1",
109
110
  "postcss-loader": "^3.0.0",
110
- "react-hot-loader": "^4.12.18",
111
111
  "sass-loader": "^8.0.0",
112
112
  "scss-compile": "^0.1.7",
113
113
  "style-loader": "^1.0.0",
@@ -127,19 +127,19 @@
127
127
  "copy": "^0.3.2",
128
128
  "immutable": "^4.0.0-rc.12",
129
129
  "moment": "^2.22.2",
130
- "react": "^16.12.0",
131
- "react-dom": "^16.12.0",
132
- "react-loadable": "^5.5.0",
133
- "react-notification-system-redux": "^2.0.0",
134
- "react-redux": "^7.1.3",
130
+ "react": "^17.0.2",
131
+ "react-dom": "^17.0.2",
132
+ "react-loadable": "~5.5.0",
133
+ "react-notification-system-redux2": "^2.0.1",
134
+ "react-redux": "^7.2.6",
135
135
  "react-router-dom": "^5.1.2",
136
- "react-select": "^3.0.8",
136
+ "react-select": "^5.2.2",
137
137
  "react-sidebar": "^3.0.2",
138
- "reactstrap": "^8.1.1",
138
+ "reactstrap": "^9.0.1",
139
139
  "redux": "^4.0.4",
140
- "redux-form": "^8.2.5",
140
+ "redux-form": "^8.3.8",
141
141
  "redux-injector": "^0.1.0",
142
- "reselect": "^4.0.0",
142
+ "reselect": "^4.1.5",
143
143
  "superagent": "^5.1.1"
144
144
  }
145
- }
145
+ }
@@ -0,0 +1,79 @@
1
+ // @flow
2
+ /* eslint-disable react/require-optimization */
3
+
4
+ import type { Dispatch, State } from "src\\types";
5
+
6
+ type PropTypes = {
7
+ +appName: string;
8
+ +isFetching: bool;
9
+ +hasError: bool;
10
+ +data: any;
11
+ +children: any;
12
+ +shouldFetch: any;
13
+
14
+ +fetchInitialInformation: () => void;
15
+ }
16
+
17
+ import React from "react";
18
+
19
+ import { connect } from "react-redux";
20
+
21
+ import { selectors } from "./reducer";
22
+
23
+ import { fetchInitialInformation as fetchInitialInformationAction } from "./actions";
24
+
25
+ import { LargeErrorMessage, LoadingMessage } from "../Messages";
26
+
27
+ const
28
+ mapStateToProps = (state : State) => ({
29
+ data : selectors.getCurrentAccount(state),
30
+ hasError : selectors.getCurrentAccountHasError(state),
31
+ fetched : selectors.getCurrentAccountIsFetched(state),
32
+ isFetching : selectors.getCurrentAccountIsFetching(state),
33
+ shouldFetch : selectors.getCurrentAccountShouldFetch(state),
34
+ }),
35
+ mapDispatchToProps = (dispatch : Dispatch, { appName }) => ({
36
+ fetchInitialInformation () {
37
+ setTimeout(() => {
38
+ dispatch(fetchInitialInformationAction(appName));
39
+ });
40
+ },
41
+ });
42
+
43
+ const LoadAccount = (props : PropTypes) => {
44
+ const { children, data, isFetching, shouldFetch, hasError, fetchInitialInformation } = props;
45
+
46
+ React.useEffect(() => {
47
+ if (shouldFetch) {
48
+ fetchInitialInformation();
49
+ }
50
+ }, [
51
+ shouldFetch,
52
+ isFetching,
53
+ hasError,
54
+ ]);
55
+
56
+ if (isFetching) {
57
+ return (
58
+ <LoadingMessage message="Așteaptă..." />
59
+ );
60
+ }
61
+
62
+ if (hasError) {
63
+ return (
64
+ <LargeErrorMessage
65
+ message="Nu am putut stabili conexiunea cu server-ul"
66
+ onRetry={fetchInitialInformation}
67
+ />
68
+ );
69
+ }
70
+
71
+ if (data.size === 0) {
72
+ return null;
73
+ }
74
+
75
+ return children;
76
+ };
77
+
78
+ export default connect(mapStateToProps,
79
+ mapDispatchToProps)(LoadAccount);
@@ -0,0 +1,10 @@
1
+ // @flow
2
+
3
+ import type { Action } from "src\\types";
4
+
5
+ import { fetchInitialInformation as fetchInitialInformationRequest } from "./request";
6
+
7
+ export const fetchInitialInformation = (appName : string) : Action => ({
8
+ type : "FETCH_INITIAL_INFORMATION",
9
+ payload : fetchInitialInformationRequest(appName),
10
+ });
@@ -0,0 +1,11 @@
1
+ // @flow
2
+
3
+ import accountReducer, { selectors as accountSelectors } from "./reducer";
4
+
5
+ import LoadAccount from "./Load";
6
+
7
+ export {
8
+ accountSelectors,
9
+ accountReducer,
10
+ LoadAccount,
11
+ };
@@ -0,0 +1,139 @@
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;