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,125 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _calendar = require("./calendar");
8
+
9
+ Object.keys(_calendar).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ Object.defineProperty(exports, key, {
12
+ enumerable: true,
13
+ get: function get() {
14
+ return _calendar[key];
15
+ }
16
+ });
17
+ });
18
+
19
+ var _date = require("./date");
20
+
21
+ Object.keys(_date).forEach(function (key) {
22
+ if (key === "default" || key === "__esModule") return;
23
+ Object.defineProperty(exports, key, {
24
+ enumerable: true,
25
+ get: function get() {
26
+ return _date[key];
27
+ }
28
+ });
29
+ });
30
+
31
+ var _language = require("./language");
32
+
33
+ Object.keys(_language).forEach(function (key) {
34
+ if (key === "default" || key === "__esModule") return;
35
+ Object.defineProperty(exports, key, {
36
+ enumerable: true,
37
+ get: function get() {
38
+ return _language[key];
39
+ }
40
+ });
41
+ });
42
+
43
+ var _normalize = require("./normalize");
44
+
45
+ Object.keys(_normalize).forEach(function (key) {
46
+ if (key === "default" || key === "__esModule") return;
47
+ Object.defineProperty(exports, key, {
48
+ enumerable: true,
49
+ get: function get() {
50
+ return _normalize[key];
51
+ }
52
+ });
53
+ });
54
+
55
+ var _numbers = require("./numbers");
56
+
57
+ Object.keys(_numbers).forEach(function (key) {
58
+ if (key === "default" || key === "__esModule") return;
59
+ Object.defineProperty(exports, key, {
60
+ enumerable: true,
61
+ get: function get() {
62
+ return _numbers[key];
63
+ }
64
+ });
65
+ });
66
+
67
+ var _numeric = require("./numeric");
68
+
69
+ Object.keys(_numeric).forEach(function (key) {
70
+ if (key === "default" || key === "__esModule") return;
71
+ Object.defineProperty(exports, key, {
72
+ enumerable: true,
73
+ get: function get() {
74
+ return _numeric[key];
75
+ }
76
+ });
77
+ });
78
+
79
+ var _others = require("./others");
80
+
81
+ Object.keys(_others).forEach(function (key) {
82
+ if (key === "default" || key === "__esModule") return;
83
+ Object.defineProperty(exports, key, {
84
+ enumerable: true,
85
+ get: function get() {
86
+ return _others[key];
87
+ }
88
+ });
89
+ });
90
+
91
+ var _strings = require("./strings");
92
+
93
+ Object.keys(_strings).forEach(function (key) {
94
+ if (key === "default" || key === "__esModule") return;
95
+ Object.defineProperty(exports, key, {
96
+ enumerable: true,
97
+ get: function get() {
98
+ return _strings[key];
99
+ }
100
+ });
101
+ });
102
+
103
+ var _mql = require("./mql");
104
+
105
+ Object.keys(_mql).forEach(function (key) {
106
+ if (key === "default" || key === "__esModule") return;
107
+ Object.defineProperty(exports, key, {
108
+ enumerable: true,
109
+ get: function get() {
110
+ return _mql[key];
111
+ }
112
+ });
113
+ });
114
+
115
+ var _validation = require("./validation");
116
+
117
+ Object.keys(_validation).forEach(function (key) {
118
+ if (key === "default" || key === "__esModule") return;
119
+ Object.defineProperty(exports, key, {
120
+ enumerable: true,
121
+ get: function get() {
122
+ return _validation[key];
123
+ }
124
+ });
125
+ });
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var language = exports.language = {
7
+ message: {
8
+ failPerform: "Nu am putut îndeplini sarcina",
9
+ confirmDelete: "Am șters cu succes",
10
+ confirmAdd: "Am adăugat cu succes",
11
+ confirmUpdate: "Am actualizat datele"
12
+ },
13
+ label: {
14
+ modify: "Modifică",
15
+ add: "Adaugă",
16
+ remove: "Șterge",
17
+ confirmation: "Confirmare",
18
+ cancel: "Renunță"
19
+ }
20
+ };
package/utility/mql.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var mql = exports.mql = window ? window.matchMedia("(min-width: 800px)") : null;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ var _normalize = require("./normalize");
4
+
5
+ var _immutable = require("immutable");
6
+
7
+ var Immutable = _interopRequireWildcard(_immutable);
8
+
9
+ var _jestImmutableMatchers = require("jest-immutable-matchers");
10
+
11
+ var matchers = _interopRequireWildcard(_jestImmutableMatchers);
12
+
13
+ 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; } }
14
+
15
+ describe("test util/normalize", function () {
16
+ beforeEach(function () {
17
+ jest.addMatchers(matchers);
18
+ });
19
+
20
+ var input = [{
21
+ ID: 1,
22
+ Name: "BlaBla 1"
23
+ }, {
24
+ ID: 2,
25
+ Name: "BlaBla 2"
26
+ }, {
27
+ ID: 3,
28
+ Name: "BlaBla 3"
29
+ }];
30
+
31
+ describe("given an array", function () {
32
+ var result = (0, _normalize.normalizeArray)(input);
33
+
34
+ it("normalizes the entities", function () {
35
+ expect(result.entities).toEqualImmutable(Immutable.Map({
36
+ "1": Immutable.Map({
37
+ ID: 1,
38
+ Name: "BlaBla 1"
39
+ }),
40
+ "2": Immutable.Map({
41
+ ID: 2,
42
+ Name: "BlaBla 2"
43
+ }),
44
+ "3": Immutable.Map({
45
+ ID: 3,
46
+ Name: "BlaBla 3"
47
+ })
48
+ }));
49
+ });
50
+ it("normalizes the result", function () {
51
+ expect(result.result).toEqualImmutable(Immutable.List(["1", "2", "3"]));
52
+ });
53
+ });
54
+ });
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.normalizeSelectNumeric = exports.normalizeBoolean = exports.normalizeArray = exports.withHandlePDFCallback = exports.withPromiseCallback = exports.normalizeArrayByField = exports.customNormalizeArrayByField = undefined;
7
+
8
+ var _immutable = require("immutable");
9
+
10
+ var Immutable = _interopRequireWildcard(_immutable);
11
+
12
+ 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; } }
13
+
14
+ var timeout = 500; /* eslint-disable max-len, no-duplicate-imports */
15
+
16
+
17
+ var defaultNormalizr = function defaultNormalizr(item) {
18
+ return Immutable.Map(item);
19
+ };
20
+
21
+ var defaultValue = function defaultValue() {
22
+ return {
23
+ entities: Immutable.Map(),
24
+ result: Immutable.List()
25
+ };
26
+ };
27
+
28
+ var customNormalizeArrayByField = exports.customNormalizeArrayByField = function customNormalizeArrayByField(raw, field, normalizr) {
29
+ return raw === null ? defaultValue() : raw.reduce(function (previous, current) {
30
+ var stringID = String(current[field]);
31
+
32
+ previous.entities = previous.entities.set(stringID, normalizr(current));
33
+
34
+ previous.result = previous.result.push(stringID);
35
+
36
+ return previous;
37
+ }, defaultValue());
38
+ };
39
+
40
+ var normalizeArrayByField = exports.normalizeArrayByField = function normalizeArrayByField(raw, field) {
41
+ return customNormalizeArrayByField(raw, field, defaultNormalizr);
42
+ };
43
+
44
+ var withPromiseCallback = exports.withPromiseCallback = function withPromiseCallback(resolve, reject) {
45
+ return function (error, response) {
46
+ if (error) {
47
+ var StatusUnauthorized = 401;
48
+
49
+ if (error.status === StatusUnauthorized) {
50
+ document.location.href = "/";
51
+ } else {
52
+ // error.message
53
+ reject({ error: "Ceva nu a funcționat cum trebuia" });
54
+ }
55
+ } else {
56
+ resolve(response.body);
57
+ }
58
+ };
59
+ };
60
+
61
+ var withHandlePDFCallback = exports.withHandlePDFCallback = function withHandlePDFCallback(_ref) {
62
+ var resolve = _ref.resolve,
63
+ reject = _ref.reject,
64
+ title = _ref.title;
65
+ return function (error, response) {
66
+ // It is necessary to create a new blob object with mime-type explicitly set
67
+ // otherwise only Chrome works like it should
68
+ var newBlob = new Blob([response.body], { type: "application/pdf" });
69
+
70
+ // IE doesn't allow using a blob object directly as link href
71
+ // instead it is necessary to use msSaveOrOpenBlob
72
+ if (window.navigator && window.navigator.msSaveOrOpenBlob) {
73
+ window.navigator.msSaveOrOpenBlob(newBlob);
74
+ return;
75
+ }
76
+
77
+ // For other browsers:
78
+ // Create a link pointing to the ObjectURL containing the blob.
79
+ var data = window.URL.createObjectURL(newBlob);
80
+ var link = document.createElement("a");
81
+
82
+ link.href = data;
83
+ link.download = title + ".pdf";
84
+ link.click();
85
+ setTimeout(function () {
86
+ // For Firefox it is necessary to delay revoking the ObjectURL
87
+ window.URL.revokeObjectURL(data);
88
+ withPromiseCallback(resolve, reject)(error, response);
89
+ }, timeout);
90
+ };
91
+ };
92
+
93
+ /*
94
+ * entities ---> Object { "1": Immutable.Map(), ... ]) }
95
+ * result ---> List([ "1", "2", "3" ])
96
+ */
97
+
98
+ var normalizeArray = exports.normalizeArray = function normalizeArray(raw, normalizr) {
99
+ return customNormalizeArrayByField(raw, "ID", typeof normalizr === "undefined" ? defaultNormalizr : normalizr);
100
+ };
101
+
102
+ var normalizeBoolean = exports.normalizeBoolean = function normalizeBoolean(value) {
103
+ return value || false;
104
+ };
105
+
106
+ var normalizeSelectNumeric = exports.normalizeSelectNumeric = function normalizeSelectNumeric(raw) {
107
+ return typeof raw === "string" && raw !== "" ? parseInt(raw, 10) : raw;
108
+ };
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+
8
+ var numberFormat = new Intl.NumberFormat("ro", {
9
+ minimumFractionDigits: 2
10
+ });
11
+ /* eslint-disable no-magic-numbers */
12
+
13
+ var plainNumberFormat = new Intl.NumberFormat("ro");
14
+
15
+ var replaceCharInString = function replaceCharInString(_ref) {
16
+ var word = _ref.word,
17
+ oldChar = _ref.oldChar,
18
+ newChar = _ref.newChar;
19
+
20
+
21
+ var regex = new RegExp(oldChar, "gu");
22
+
23
+ return word.replace(regex, newChar);
24
+ };
25
+
26
+ // 127.99 ----> 127,99
27
+ // 0 ----> ""
28
+ var formatZeroValue = exports.formatZeroValue = function formatZeroValue(word, optional) {
29
+ return optional && word === "" ? "" : replaceCharInString({
30
+ word: String(word),
31
+ oldChar: "\\.",
32
+ newChar: ","
33
+ });
34
+ };
35
+
36
+ var formatNumber = exports.formatNumber = function formatNumber(word) {
37
+ return replaceCharInString({
38
+ word: String(word),
39
+ oldChar: "\\.",
40
+ newChar: ","
41
+ });
42
+ };
43
+
44
+ // 78,45 ---> 78.45
45
+ var normalizeNumber = exports.normalizeNumber = function normalizeNumber(word) {
46
+ return replaceCharInString({
47
+ word: String(word),
48
+ oldChar: ",",
49
+ newChar: "."
50
+ });
51
+ };
52
+
53
+ var numberToLocale = exports.numberToLocale = function numberToLocale(value) {
54
+ return numberFormat.format(value);
55
+ };
56
+
57
+ var plainNumberToLocale = exports.plainNumberToLocale = function plainNumberToLocale(value) {
58
+ return plainNumberFormat.format(value);
59
+ };
60
+
61
+ var numberToLocaleForm = exports.numberToLocaleForm = function numberToLocaleForm(value) {
62
+ var upperLimit = 20,
63
+ formatted = plainNumberFormat.format(value);
64
+
65
+ if (value < upperLimit) {
66
+ return formatted;
67
+ }
68
+
69
+ return formatted + " de";
70
+ };
71
+
72
+ var numericBehavior = exports.numericBehavior = {
73
+ normalize: normalizeNumber,
74
+ format: formatNumber
75
+ };
76
+
77
+ var tryToParseNumber = exports.tryToParseNumber = function tryToParseNumber(raw) {
78
+ var result = Number(raw);
79
+
80
+ if (!isNaN(result) && raw !== "") {
81
+ return result;
82
+ }
83
+
84
+ return raw;
85
+ };
86
+
87
+ var numberToLocaleHideBlank = exports.numberToLocaleHideBlank = function numberToLocaleHideBlank(raw) {
88
+ return typeof raw === "number" && raw !== 0 ? numberToLocale(raw) : "";
89
+ };
90
+
91
+ var plainNumberToLocaleHideZero = exports.plainNumberToLocaleHideZero = function plainNumberToLocaleHideZero(raw) {
92
+ return typeof raw === "number" && raw !== 0 ? plainNumberToLocale(raw) : "";
93
+ };
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.cwrp = exports.normalizeFloat = exports.handleBlur = undefined;
7
+
8
+ var _numbers = require("./numbers");
9
+
10
+ var handleBlur = exports.handleBlur = function handleBlur(that) {
11
+ var state = that.state,
12
+ props = that.props;
13
+ var input = props.input,
14
+ normalizeValue = props.normalizeValue,
15
+ optional = props.optional,
16
+ onBlur = input.onBlur,
17
+ currentValue = state.value;
18
+
19
+
20
+ var performBlur = function performBlur(value, shouldRenderAgain) {
21
+
22
+ input.onChange(value);
23
+
24
+ /*
25
+ * Swallow the event to prevent Redux Form from
26
+ * extracting the form value
27
+ */
28
+ onBlur();
29
+
30
+ if (shouldRenderAgain) {
31
+ var setState = that.setState.bind(that);
32
+
33
+ return setState({
34
+ value: value
35
+ });
36
+ }
37
+
38
+ return null;
39
+ };
40
+
41
+ var shouldNotChange = currentValue === "" && optional;
42
+
43
+ if (shouldNotChange) {
44
+ if (input.value === "") {
45
+ return null;
46
+ }
47
+
48
+ return performBlur(null, true);
49
+ }
50
+
51
+ var normalizedValue = normalizeValue(currentValue),
52
+ shouldRenderAgain = !isNaN(normalizedValue) && currentValue !== normalizedValue;
53
+
54
+ return performBlur(normalizedValue, shouldRenderAgain);
55
+ };
56
+
57
+ var normalizeFloat = exports.normalizeFloat = function normalizeFloat(raw) {
58
+
59
+ /* eslint-disable no-magic-numbers */
60
+
61
+ var value = (0, _numbers.normalizeNumber)(raw),
62
+ shouldNotNormalize = value.trim() === "" || isNaN(Number(value));
63
+
64
+ if (shouldNotNormalize) {
65
+ return NaN;
66
+ }
67
+
68
+ var result = Number(value),
69
+ truncateTo = function truncateTo(unRouned) {
70
+ var nrOfDecimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
71
+
72
+ var parts = String(unRouned).split(".");
73
+
74
+ if (parts.length !== 2) {
75
+ // ex. 12
76
+ return unRouned;
77
+ }
78
+ var newDecimals = parts[1].slice(0, nrOfDecimals),
79
+ newString = parts[0] + "." + newDecimals;
80
+
81
+ return Number(newString);
82
+ },
83
+ normalized = truncateTo(result);
84
+
85
+ return normalized;
86
+ };
87
+
88
+ var cwrp = exports.cwrp = function cwrp(that, nextany) {
89
+ var state = that.state;
90
+ var newValue = nextany.input.value;
91
+ var currentValue = state.value;
92
+
93
+
94
+ var shouldRenderAgain = !isNaN(newValue) && currentValue !== newValue;
95
+
96
+ var setState = that.setState.bind(that);
97
+
98
+ if (shouldRenderAgain) {
99
+ setState({
100
+ value: newValue
101
+ });
102
+ }
103
+ };
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.months = exports.years = exports.userHasPressedCKeyAlone = exports.showCheck = exports.delay = exports.ReduxFormSubmissionError = exports.addID = exports.removeID = exports.nothingFetched = exports.rowsPerLoad = exports.noError = exports.createModal = exports.isAdministratorAccount = exports.getDateSortNumber = undefined;
7
+
8
+ var _react = require("react");
9
+
10
+ var _react2 = _interopRequireDefault(_react);
11
+
12
+ var _immutable = require("redux-form/immutable");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ var getDateSortNumber = exports.getDateSortNumber = function getDateSortNumber(item) {
17
+ return Number(new Date(item).getTime());
18
+ };
19
+
20
+ var isAdministratorAccount = exports.isAdministratorAccount = function isAdministratorAccount(current) {
21
+ return current === 0;
22
+ };
23
+
24
+ var createModal = exports.createModal = function createModal(modalType, modalProps) {
25
+ return {
26
+ type: "SHOW_MODAL",
27
+ payload: {
28
+ modalType: modalType,
29
+ modalProps: modalProps
30
+ }
31
+ };
32
+ };
33
+
34
+ var noError = exports.noError = "",
35
+ rowsPerLoad = exports.rowsPerLoad = 50,
36
+ nothingFetched = exports.nothingFetched = -1;
37
+
38
+ var removeID = exports.removeID = function removeID(payload) {
39
+ return function (list) {
40
+ return (
41
+ // $FlowFixMe
42
+ list.delete(list.findIndex(function (current) {
43
+ return current === String(payload.get("ID"));
44
+ }))
45
+ );
46
+ };
47
+ };
48
+
49
+ var addID = exports.addID = function addID(payload) {
50
+ return function (list) {
51
+ return list.push(String(payload.get("ID")));
52
+ };
53
+ };
54
+
55
+ var ReduxFormSubmissionError = exports.ReduxFormSubmissionError = function ReduxFormSubmissionError(error) {
56
+ if (error) {
57
+ if (error instanceof _immutable.SubmissionError) {
58
+ throw error;
59
+ }
60
+
61
+ var _error = typeof error.error === "string" ? error.error : "Am pierdut conexiunea cu server-ul";
62
+
63
+ throw new _immutable.SubmissionError({
64
+ _error: _error
65
+ });
66
+ }
67
+ };
68
+
69
+ var delay = exports.delay = function delay() {
70
+ return new Promise(function (resolve) {
71
+ setTimeout(resolve);
72
+ });
73
+ };
74
+
75
+ var showCheck = exports.showCheck = function showCheck(value) {
76
+ return value ? _react2.default.createElement("i", { className: "fa fa-check text-success" }) : null;
77
+ };
78
+
79
+ var userHasPressedCKeyAlone = exports.userHasPressedCKeyAlone = function userHasPressedCKeyAlone(currentEvent) {
80
+ var ctrlKey = currentEvent.ctrlKey,
81
+ keyCode = currentEvent.keyCode,
82
+ localName = currentEvent.srcElement.localName;
83
+
84
+
85
+ var createInvoiceKey = 67,
86
+ tag = localName.toLowerCase(),
87
+ isNotInputOrTextarea = tag !== "input" && tag !== "textarea";
88
+
89
+ return !ctrlKey && keyCode === createInvoiceKey && isNotInputOrTextarea;
90
+ };
91
+
92
+ var years = exports.years = [{
93
+ value: 2018,
94
+ name: "2018"
95
+ }, {
96
+ value: 2019,
97
+ name: "2019"
98
+ }, {
99
+ value: 2020,
100
+ name: "2020"
101
+ }, {
102
+ value: 2021,
103
+ name: "2021"
104
+ }];
105
+
106
+ var months = exports.months = [{
107
+ value: 0,
108
+ name: "Ianuarie"
109
+ }, {
110
+ value: 1,
111
+ name: "Februarie"
112
+ }, {
113
+ value: 2,
114
+ name: "Martie"
115
+ }, {
116
+ value: 3,
117
+ name: "Aprilie"
118
+ }, {
119
+ value: 4,
120
+ name: "Mai"
121
+ }, {
122
+ value: 5,
123
+ name: "Iunie"
124
+ }, {
125
+ value: 6,
126
+ name: "Iulie"
127
+ }, {
128
+ value: 7,
129
+ name: "August"
130
+ }, {
131
+ value: 8,
132
+ name: "Septembrie"
133
+ }, {
134
+ value: 9,
135
+ name: "Octombrie"
136
+ }, {
137
+ value: 10,
138
+ name: "Noiembrie"
139
+ }, {
140
+ value: 11,
141
+ name: "Decembrie"
142
+ }];