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
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _react = require("react");
8
+
9
+ var _react2 = _interopRequireDefault(_react);
10
+
11
+ var _reactRedux = require("react-redux");
12
+
13
+ var _reducer = require("./reducer");
14
+
15
+ var _actions = require("./actions");
16
+
17
+ var _Messages = require("../Messages");
18
+
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+
21
+ var mapStateToProps = function mapStateToProps(state) {
22
+ return {
23
+ data: _reducer.selectors.getCurrentAccount(state),
24
+ hasError: _reducer.selectors.getCurrentAccountHasError(state),
25
+ fetched: _reducer.selectors.getCurrentAccountIsFetched(state),
26
+ isFetching: _reducer.selectors.getCurrentAccountIsFetching(state),
27
+ shouldFetch: _reducer.selectors.getCurrentAccountShouldFetch(state)
28
+ };
29
+ },
30
+ mapDispatchToProps = function mapDispatchToProps(dispatch, _ref) {
31
+ var appName = _ref.appName;
32
+ return {
33
+ fetchInitialInformation: function fetchInitialInformation() {
34
+ setTimeout(function () {
35
+ dispatch((0, _actions.fetchInitialInformation)(appName));
36
+ });
37
+ }
38
+ };
39
+ };
40
+ /* eslint-disable react/require-optimization */
41
+
42
+ var LoadAccount = function LoadAccount(props) {
43
+ var children = props.children,
44
+ data = props.data,
45
+ isFetching = props.isFetching,
46
+ shouldFetch = props.shouldFetch,
47
+ hasError = props.hasError,
48
+ fetchInitialInformation = props.fetchInitialInformation;
49
+
50
+
51
+ _react2.default.useEffect(function () {
52
+ if (shouldFetch) {
53
+ fetchInitialInformation();
54
+ }
55
+ }, [shouldFetch, isFetching, hasError]);
56
+
57
+ if (isFetching) {
58
+ return _react2.default.createElement(_Messages.LoadingMessage, { message: "A\u0219teapt\u0103..." });
59
+ }
60
+
61
+ if (hasError) {
62
+ return _react2.default.createElement(_Messages.LargeErrorMessage, {
63
+ message: "Nu am putut stabili conexiunea cu server-ul",
64
+ onRetry: fetchInitialInformation
65
+ });
66
+ }
67
+
68
+ if (data.size === 0) {
69
+ return null;
70
+ }
71
+
72
+ return children;
73
+ };
74
+
75
+ exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(LoadAccount);
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.fetchInitialInformation = undefined;
7
+
8
+ var _request = require("./request");
9
+
10
+ var fetchInitialInformation = exports.fetchInitialInformation = function fetchInitialInformation(appName) {
11
+ return {
12
+ type: "FETCH_INITIAL_INFORMATION",
13
+ payload: (0, _request.fetchInitialInformation)(appName)
14
+ };
15
+ };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LoadAccount = exports.accountReducer = exports.accountSelectors = undefined;
7
+
8
+ var _reducer = require("./reducer");
9
+
10
+ var _reducer2 = _interopRequireDefault(_reducer);
11
+
12
+ var _Load = require("./Load");
13
+
14
+ var _Load2 = _interopRequireDefault(_Load);
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ exports.accountSelectors = _reducer.selectors;
19
+ exports.accountReducer = _reducer2.default;
20
+ exports.LoadAccount = _Load2.default;
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.selectors = undefined;
7
+
8
+ var _reselect = require("reselect");
9
+
10
+ var _immutable = require("immutable");
11
+
12
+ var Immutable = _interopRequireWildcard(_immutable);
13
+
14
+ var _utility = require("../utility");
15
+
16
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
17
+
18
+ var initialState = Immutable.Map({
19
+ error: _utility.noError,
20
+ fetched: false,
21
+ fetching: false,
22
+
23
+ info: Immutable.Map(),
24
+ companies: Immutable.Map()
25
+ });
26
+
27
+ var fetchCurrentAccountPending = function fetchCurrentAccountPending(state) {
28
+ return state.merge({
29
+ error: _utility.noError,
30
+ fetching: true
31
+ });
32
+ },
33
+ fetchCurrentAccountRejected = function fetchCurrentAccountRejected(state, _ref) {
34
+ var error = _ref.payload.error;
35
+ return state.merge({
36
+ error: error,
37
+ fetching: false
38
+ });
39
+ },
40
+ fetchCurrentAccountFulfilled = function fetchCurrentAccountFulfilled(state, _ref2) {
41
+ var payload = _ref2.payload;
42
+ return state.mergeDeep({
43
+ fetched: true,
44
+ fetching: false,
45
+
46
+ info: payload.Account,
47
+ companies: payload.Companies
48
+ });
49
+ },
50
+ accountChangePassword = function accountChangePassword(state) {
51
+ return state.setIn(["info", "RequireChange"], false);
52
+ },
53
+ accountGaveConsent = function accountGaveConsent(state) {
54
+ return state.setIn(["info", "HasToGiveConsent"], false);
55
+ };
56
+
57
+ var reducer = function reducer() {
58
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
59
+ var action = arguments[1];
60
+
61
+
62
+ switch (action.type) {
63
+ case "FETCH_INITIAL_INFORMATION_PENDING":
64
+ return fetchCurrentAccountPending(state);
65
+
66
+ case "FETCH_INITIAL_INFORMATION_REJECTED":
67
+ return fetchCurrentAccountRejected(state, action);
68
+
69
+ case "FETCH_INITIAL_INFORMATION_FULFILLED":
70
+ return fetchCurrentAccountFulfilled(state, action);
71
+
72
+ case "ACCOUNT_CHANGE_PASSWORD":
73
+ return accountChangePassword(state);
74
+
75
+ case "ACCOUNT_GAVE_CONSENT":
76
+ return accountGaveConsent(state);
77
+
78
+ default:
79
+ return state;
80
+ }
81
+ };
82
+
83
+ var getFetched = function getFetched(state) {
84
+ return state.getIn(["account", "fetched"]);
85
+ },
86
+ getError = function getError(state) {
87
+ return state.getIn(["account", "error"]);
88
+ };
89
+
90
+ var getCurrentAccount = function getCurrentAccount(state) {
91
+ return state.getIn(["account", "info"]);
92
+ },
93
+ getCurrentAccountCompanies = function getCurrentAccountCompanies(state) {
94
+ return state.getIn(["account", "companies"]);
95
+ },
96
+ getCurrentAccountIsFetching = function getCurrentAccountIsFetching(state) {
97
+ return state.getIn(["account", "fetching"]);
98
+ },
99
+ getCurrentAccountShouldFetch = (0, _reselect.createSelector)(getCurrentAccountIsFetching, getFetched, getError, function (isFetching, isFetched, error) {
100
+ return !isFetching && !isFetched && error === _utility.noError;
101
+ }),
102
+ getCurrentAccountIsFetched = (0, _reselect.createSelector)(getCurrentAccountIsFetching, getFetched, getError, function (isFetching, isFetched, error) {
103
+ return !isFetching && isFetched && error === _utility.noError;
104
+ }),
105
+ getCurrentAccountHasError = (0, _reselect.createSelector)(getError, function (error) {
106
+ return error !== _utility.noError;
107
+ }),
108
+ getIsCurrentAccountAdministrator = (0, _reselect.createSelector)(getCurrentAccount, function (account) {
109
+ return (0, _utility.isAdministratorAccount)(account.get("Type"));
110
+ });
111
+
112
+ var selectors = exports.selectors = {
113
+ getCurrentAccountCompanies: getCurrentAccountCompanies,
114
+ getCurrentAccount: getCurrentAccount,
115
+ getCurrentAccountIsFetching: getCurrentAccountIsFetching,
116
+ getCurrentAccountShouldFetch: getCurrentAccountShouldFetch,
117
+ getCurrentAccountIsFetched: getCurrentAccountIsFetched,
118
+ getCurrentAccountHasError: getCurrentAccountHasError,
119
+ getIsCurrentAccountAdministrator: getIsCurrentAccountAdministrator
120
+ };
121
+
122
+ exports.default = reducer;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.fetchInitialInformation = undefined;
7
+
8
+ var _superagent = require("superagent");
9
+
10
+ var _superagent2 = _interopRequireDefault(_superagent);
11
+
12
+ var _immutable = require("immutable");
13
+
14
+ var Immutable = _interopRequireWildcard(_immutable);
15
+
16
+ var _utility = require("../utility");
17
+
18
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ var normalizeInitialInformation = function normalizeInitialInformation(info) {
23
+ var Account = info.Account,
24
+ IsConnected = info.IsConnected,
25
+ Counties = info.Counties,
26
+ Companies = info.Companies;
27
+
28
+
29
+ return {
30
+ Account: Immutable.Map(Account || {}),
31
+ IsConnected: IsConnected,
32
+ Error: IsConnected ? _utility.noError : "Not connected",
33
+ Counties: typeof Counties === "undefined" ? Immutable.List() : (0, _utility.normalizeArrayByField)(Counties, "Short").entities,
34
+ Companies: typeof Companies === "undefined" ? Immutable.List() : (0, _utility.normalizeArray)(Companies).entities
35
+ };
36
+ };
37
+
38
+ var fetchInitialInformation = exports.fetchInitialInformation = function fetchInitialInformation(app) {
39
+ return new Promise(function (resolve, reject) {
40
+ return _superagent2.default.get("/api/extern/get-initial-information").type("form").query({ app: app }).end((0, _utility.withPromiseCallback)(function (reponse) {
41
+ return resolve(normalizeInitialInformation(reponse));
42
+ }, reject));
43
+ });
44
+ };
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8
+
9
+ var _react = require("react");
10
+
11
+ var React = _interopRequireWildcard(_react);
12
+
13
+ var _Loading = require("../Messages/Loading");
14
+
15
+ var _util = require("../Modal/util");
16
+
17
+ var _reduxInjector = require("redux-injector");
18
+
19
+ var _utility = require("../utility");
20
+
21
+ var _reactRedux = require("react-redux");
22
+
23
+ var _module = require("../reducer/module");
24
+
25
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
26
+
27
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
28
+
29
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
30
+
31
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
32
+
33
+ var injectPaginator = function injectPaginator(_ref) {
34
+ var key = _ref.key,
35
+ itemsReducer = _ref.itemsReducer,
36
+ pagesReducer = _ref.pagesReducer;
37
+
38
+ (0, _reduxInjector.injectReducer)("entities." + key, itemsReducer);
39
+ (0, _reduxInjector.injectReducer)("paginations." + key, pagesReducer);
40
+ };
41
+
42
+ var mapStateToProps = function mapStateToProps(state, _ref2) {
43
+ var module = _ref2.route.default.module;
44
+ return {
45
+ ready: (0, _module.getIsModuleReady)(state, module)
46
+ };
47
+ },
48
+ mapDispatchToProps = function mapDispatchToProps(dispatch, _ref3) {
49
+ var route = _ref3.route;
50
+ return {
51
+ initModule: function initModule() {
52
+ var _route$default = route.default,
53
+ reducers = _route$default.reducers,
54
+ modals = _route$default.modals,
55
+ paginators = _route$default.paginators,
56
+ module = _route$default.module;
57
+
58
+
59
+ (0, _utility.delay)().then(function () {
60
+ if (reducers) {
61
+ if (Array.isArray(reducers)) {
62
+ var _iteratorNormalCompletion = true;
63
+ var _didIteratorError = false;
64
+ var _iteratorError = undefined;
65
+
66
+ try {
67
+ for (var _iterator = reducers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
68
+ var _ref4 = _step.value;
69
+ var key = _ref4.key,
70
+ func = _ref4.func;
71
+
72
+ (0, _reduxInjector.injectReducer)(key, func);
73
+ }
74
+ } catch (err) {
75
+ _didIteratorError = true;
76
+ _iteratorError = err;
77
+ } finally {
78
+ try {
79
+ if (!_iteratorNormalCompletion && _iterator.return) {
80
+ _iterator.return();
81
+ }
82
+ } finally {
83
+ if (_didIteratorError) {
84
+ throw _iteratorError;
85
+ }
86
+ }
87
+ }
88
+ } else {
89
+ var _key = reducers.key,
90
+ _func = reducers.func;
91
+
92
+
93
+ (0, _reduxInjector.injectReducer)(_key, _func);
94
+ }
95
+ }
96
+ }).then(function () {
97
+ if (modals) {
98
+ (0, _util.injectModals)(modals);
99
+ }
100
+ }).then(function () {
101
+ if (paginators) {
102
+ if (Array.isArray(paginators)) {
103
+ var _iteratorNormalCompletion2 = true;
104
+ var _didIteratorError2 = false;
105
+ var _iteratorError2 = undefined;
106
+
107
+ try {
108
+ for (var _iterator2 = paginators[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
109
+ var paginator = _step2.value;
110
+
111
+ injectPaginator(paginator);
112
+ }
113
+ } catch (err) {
114
+ _didIteratorError2 = true;
115
+ _iteratorError2 = err;
116
+ } finally {
117
+ try {
118
+ if (!_iteratorNormalCompletion2 && _iterator2.return) {
119
+ _iterator2.return();
120
+ }
121
+ } finally {
122
+ if (_didIteratorError2) {
123
+ throw _iteratorError2;
124
+ }
125
+ }
126
+ }
127
+ } else {
128
+ injectPaginator(paginators);
129
+ }
130
+ }
131
+ }).then(function () {
132
+ dispatch((0, _module.moduleIsReadyAction)(module));
133
+ });
134
+ }
135
+ };
136
+ };
137
+
138
+ var InitModule = function (_React$Component) {
139
+ _inherits(InitModule, _React$Component);
140
+
141
+ function InitModule() {
142
+ _classCallCheck(this, InitModule);
143
+
144
+ return _possibleConstructorReturn(this, (InitModule.__proto__ || Object.getPrototypeOf(InitModule)).apply(this, arguments));
145
+ }
146
+
147
+ _createClass(InitModule, [{
148
+ key: "componentDidMount",
149
+ value: function componentDidMount() {
150
+ if (!this.props.ready) {
151
+ this.props.initModule();
152
+ }
153
+ }
154
+ }, {
155
+ key: "shouldComponentUpdate",
156
+ value: function shouldComponentUpdate() {
157
+ return true;
158
+ }
159
+ }, {
160
+ key: "render",
161
+ value: function render() {
162
+ var _props = this.props,
163
+ route = _props.route,
164
+ ready = _props.ready,
165
+ props = _props.props;
166
+ var Component = route.default.Component;
167
+
168
+
169
+ if (ready) {
170
+ return React.createElement(Component, props);
171
+ }
172
+
173
+ return React.createElement(
174
+ "div",
175
+ { className: "mt-3" },
176
+ React.createElement(_Loading.LoadingMessage, { message: "A\u0219teapt\u0103 un pic..." })
177
+ );
178
+ }
179
+ }]);
180
+
181
+ return InitModule;
182
+ }(React.Component);
183
+
184
+ var WrapInitModule = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(InitModule);
185
+
186
+ var createWrap = function createWrap(route, props) {
187
+ return React.createElement(WrapInitModule, { props: props, route: route });
188
+ };
189
+
190
+ exports.default = createWrap;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _react = require("react");
8
+
9
+ var _react2 = _interopRequireDefault(_react);
10
+
11
+ var _Loading = require("../Messages/Loading");
12
+
13
+ var _SimulatedException = require("./SimulatedException");
14
+
15
+ var _SimulatedException2 = _interopRequireDefault(_SimulatedException);
16
+
17
+ var _index = require("./index");
18
+
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+
21
+ var IgnoreThisNode = function IgnoreThisNode(_ref) {
22
+ var _ref$error = _ref.error,
23
+ message = _ref$error.message,
24
+ stack = _ref$error.stack;
25
+
26
+ throw new _SimulatedException2.default(message, stack);
27
+ };
28
+
29
+ var RouteLoading = function RouteLoading(_ref2) {
30
+ var error = _ref2.error,
31
+ retry = _ref2.retry,
32
+ timedOut = _ref2.timedOut;
33
+
34
+ if (error) {
35
+ return _react2.default.createElement(
36
+ _index.ErrorBoundary,
37
+ null,
38
+ _react2.default.createElement(IgnoreThisNode, { error: error })
39
+ );
40
+ }
41
+
42
+ if (timedOut) {
43
+ return _react2.default.createElement(
44
+ "div",
45
+ null,
46
+ "Se pare că se încarcă mai greu ca de obicei ",
47
+ _react2.default.createElement(
48
+ "button",
49
+ {
50
+ className: "btn btn-primary btn-block",
51
+ onClick: retry, type: "button" },
52
+ "Încearcă din nou"
53
+ )
54
+ );
55
+ }
56
+
57
+ return _react2.default.createElement(
58
+ "div",
59
+ { className: "mt-3" },
60
+ _react2.default.createElement(_Loading.LoadingMessage, { message: "A\u0219teapt\u0103 un pic..." })
61
+ );
62
+ };
63
+
64
+ exports.default = RouteLoading;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
+
9
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
10
+
11
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
12
+
13
+ /* eslint-disable max-classes-per-file */
14
+
15
+ var CustomError = function (_Error) {
16
+ _inherits(CustomError, _Error);
17
+
18
+ function CustomError(message, stack) {
19
+ _classCallCheck(this, CustomError);
20
+
21
+ var _this = _possibleConstructorReturn(this, (CustomError.__proto__ || Object.getPrototypeOf(CustomError)).call(this, message));
22
+
23
+ _this.message = message;
24
+ _this.name = message;
25
+ _this.stack = stack;
26
+ return _this;
27
+ }
28
+
29
+ return CustomError;
30
+ }(Error);
31
+
32
+ var SimulatedException = function (_CustomError) {
33
+ _inherits(SimulatedException, _CustomError);
34
+
35
+ function SimulatedException() {
36
+ _classCallCheck(this, SimulatedException);
37
+
38
+ return _possibleConstructorReturn(this, (SimulatedException.__proto__ || Object.getPrototypeOf(SimulatedException)).apply(this, arguments));
39
+ }
40
+
41
+ return SimulatedException;
42
+ }(CustomError);
43
+
44
+ exports.default = SimulatedException;
package/Async/index.js ADDED
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createAsyncRoute = exports.setErrorBoundary = exports.ErrorBoundary = undefined;
7
+
8
+ var _reactLoadable = require("react-loadable");
9
+
10
+ var _reactLoadable2 = _interopRequireDefault(_reactLoadable);
11
+
12
+ var _react = require("react");
13
+
14
+ var React = _interopRequireWildcard(_react);
15
+
16
+ var _RouteLoading = require("./RouteLoading");
17
+
18
+ var _RouteLoading2 = _interopRequireDefault(_RouteLoading);
19
+
20
+ var _InitModule = require("./InitModule");
21
+
22
+ var _InitModule2 = _interopRequireDefault(_InitModule);
23
+
24
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
25
+
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
+
28
+ // type injectPaginatorTypes = {
29
+ // key: string,
30
+ // itemsReducer: any;
31
+ // pagesReducer: any;
32
+ // };
33
+ // import { injectReducer } from "redux-injector";
34
+ // import { injectModals } from "../Modal/util";
35
+
36
+ var timeout = 15000;
37
+ /* eslint-disable new-cap, react/prefer-stateless-function, react/require-optimization */
38
+
39
+ var ErrorBoundary = exports.ErrorBoundary = function ErrorBoundary() {
40
+ return React.createElement(
41
+ "div",
42
+ null,
43
+ "No ErrorBoundary passed to x25"
44
+ );
45
+ };
46
+
47
+ // const injectPaginator = ({ key, itemsReducer, pagesReducer } : injectPaginatorTypes) => {
48
+ // injectReducer(`entities.${key}`, itemsReducer);
49
+ // injectReducer(`paginations.${key}`, pagesReducer);
50
+ // };
51
+
52
+ // const renderWithReducer = (route, props) => {
53
+ // const { Component, reducers, modals, paginators } = route.default;
54
+ //
55
+ // if (reducers) {
56
+ // if (Array.isArray(reducers)) {
57
+ // for (const { key, func } of reducers) {
58
+ // injectReducer(key, func);
59
+ // }
60
+ // } else {
61
+ // const { key, func } = reducers;
62
+ //
63
+ // injectReducer(key, func);
64
+ // }
65
+ // }
66
+ //
67
+ // if (modals) {
68
+ // injectModals(modals);
69
+ // }
70
+ //
71
+ // if (paginators) {
72
+ // if (Array.isArray(paginators)) {
73
+ // for (const paginator of paginators) {
74
+ // injectPaginator(paginator);
75
+ // }
76
+ // } else {
77
+ // injectPaginator(paginators);
78
+ // }
79
+ // }
80
+ //
81
+ // return <Component {...props} />;
82
+ // };
83
+
84
+ var setErrorBoundary = exports.setErrorBoundary = function setErrorBoundary(theError) {
85
+ exports.ErrorBoundary = ErrorBoundary = theError;
86
+ };
87
+
88
+ var createAsyncRoute = exports.createAsyncRoute = function createAsyncRoute(loader) {
89
+ return (0, _reactLoadable2.default)({
90
+ loader: loader,
91
+ loading: _RouteLoading2.default,
92
+ render: _InitModule2.default,
93
+ timeout: timeout
94
+ });
95
+ };
package/Async/types.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";