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,216 @@
1
+ "use strict";
2
+
3
+ var _strings = require("./strings");
4
+
5
+ // toTitle
6
+ (function () {
7
+ describe("Test toTitle", function () {
8
+ var tests = [{
9
+ input: "",
10
+ output: ""
11
+ }, {
12
+ input: "cosovei",
13
+ output: "Cosovei"
14
+ }, {
15
+ input: "simona cosovei",
16
+ output: "Simona Cosovei"
17
+ }, {
18
+ input: "ștefănică țepeș",
19
+ output: "Ștefănică Țepeș"
20
+ }, {
21
+ input: "this is 4 long name 5",
22
+ output: "This Is 4 Long Name 5"
23
+ }];
24
+
25
+ var _loop = function _loop(_ref) {
26
+ var input = _ref.input,
27
+ output = _ref.output;
28
+
29
+ describe("Given the raw string \"" + input + "\"", function () {
30
+ it("should be transformed to \"" + output + "\"", function () {
31
+ expect((0, _strings.toTitle)(input)).toEqual(output);
32
+ });
33
+ });
34
+ };
35
+
36
+ var _iteratorNormalCompletion = true;
37
+ var _didIteratorError = false;
38
+ var _iteratorError = undefined;
39
+
40
+ try {
41
+ for (var _iterator = tests[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
42
+ var _ref = _step.value;
43
+
44
+ _loop(_ref);
45
+ }
46
+ } catch (err) {
47
+ _didIteratorError = true;
48
+ _iteratorError = err;
49
+ } finally {
50
+ try {
51
+ if (!_iteratorNormalCompletion && _iterator.return) {
52
+ _iterator.return();
53
+ }
54
+ } finally {
55
+ if (_didIteratorError) {
56
+ throw _iteratorError;
57
+ }
58
+ }
59
+ }
60
+ });
61
+ })();
62
+
63
+ // firstToUppercase
64
+ (function () {
65
+ describe("Test firstToUppercase", function () {
66
+ var tests = [{
67
+ input: "",
68
+ output: ""
69
+ }, {
70
+ input: "sima",
71
+ output: "Sima"
72
+ }, {
73
+ input: "Simona Cosovei",
74
+ output: "Simona Cosovei"
75
+ }, {
76
+ input: "this is 4 long name 5",
77
+ output: "This is 4 long name 5"
78
+ }];
79
+
80
+ var _loop2 = function _loop2(_ref2) {
81
+ var input = _ref2.input,
82
+ output = _ref2.output;
83
+
84
+ describe("given \"" + input + "\"", function () {
85
+ it("should be transformed to \"" + output + "\"", function () {
86
+ expect((0, _strings.firstToUppercase)(input)).toEqual(output);
87
+ });
88
+ });
89
+ };
90
+
91
+ var _iteratorNormalCompletion2 = true;
92
+ var _didIteratorError2 = false;
93
+ var _iteratorError2 = undefined;
94
+
95
+ try {
96
+ for (var _iterator2 = tests[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
97
+ var _ref2 = _step2.value;
98
+
99
+ _loop2(_ref2);
100
+ }
101
+ } catch (err) {
102
+ _didIteratorError2 = true;
103
+ _iteratorError2 = err;
104
+ } finally {
105
+ try {
106
+ if (!_iteratorNormalCompletion2 && _iterator2.return) {
107
+ _iterator2.return();
108
+ }
109
+ } finally {
110
+ if (_didIteratorError2) {
111
+ throw _iteratorError2;
112
+ }
113
+ }
114
+ }
115
+ });
116
+ })();
117
+
118
+ // toUpper
119
+ (function () {
120
+ var tests = [{
121
+ input: "",
122
+ output: ""
123
+ }, {
124
+ input: "sima",
125
+ output: "SIMA"
126
+ }, {
127
+ input: "this is 4 long name 5",
128
+ output: "THIS IS 4 LONG NAME 5"
129
+ }];
130
+
131
+ var _loop3 = function _loop3(_ref3) {
132
+ var input = _ref3.input,
133
+ output = _ref3.output;
134
+
135
+ describe("given \"" + input + "\"", function () {
136
+ it("should be transformed to \"" + output + "\"", function () {
137
+ expect((0, _strings.toUpper)(input)).toEqual(output);
138
+ });
139
+ });
140
+ };
141
+
142
+ var _iteratorNormalCompletion3 = true;
143
+ var _didIteratorError3 = false;
144
+ var _iteratorError3 = undefined;
145
+
146
+ try {
147
+ for (var _iterator3 = tests[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
148
+ var _ref3 = _step3.value;
149
+
150
+ _loop3(_ref3);
151
+ }
152
+ } catch (err) {
153
+ _didIteratorError3 = true;
154
+ _iteratorError3 = err;
155
+ } finally {
156
+ try {
157
+ if (!_iteratorNormalCompletion3 && _iterator3.return) {
158
+ _iterator3.return();
159
+ }
160
+ } finally {
161
+ if (_didIteratorError3) {
162
+ throw _iteratorError3;
163
+ }
164
+ }
165
+ }
166
+ })();
167
+
168
+ // toLower
169
+ (function () {
170
+ var tests = [{
171
+ input: "",
172
+ output: ""
173
+ }, {
174
+ input: "siMa",
175
+ output: "sima"
176
+ }, {
177
+ input: "This is 4 long Name 5",
178
+ output: "this is 4 long name 5"
179
+ }];
180
+
181
+ var _loop4 = function _loop4(_ref4) {
182
+ var input = _ref4.input,
183
+ output = _ref4.output;
184
+
185
+ describe("given \"" + input + "\"", function () {
186
+ it("should be transformed to \"" + output + "\"", function () {
187
+ expect((0, _strings.toLower)(input)).toEqual(output);
188
+ });
189
+ });
190
+ };
191
+
192
+ var _iteratorNormalCompletion4 = true;
193
+ var _didIteratorError4 = false;
194
+ var _iteratorError4 = undefined;
195
+
196
+ try {
197
+ for (var _iterator4 = tests[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
198
+ var _ref4 = _step4.value;
199
+
200
+ _loop4(_ref4);
201
+ }
202
+ } catch (err) {
203
+ _didIteratorError4 = true;
204
+ _iteratorError4 = err;
205
+ } finally {
206
+ try {
207
+ if (!_iteratorNormalCompletion4 && _iterator4.return) {
208
+ _iterator4.return();
209
+ }
210
+ } finally {
211
+ if (_didIteratorError4) {
212
+ throw _iteratorError4;
213
+ }
214
+ }
215
+ }
216
+ })();
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ /*
7
+ *
8
+ * Simona Cosovei ---> Simona Cosovei
9
+ */
10
+ var toTitle = exports.toTitle = function toTitle(str) {
11
+ var transform = function transform(txt) {
12
+ var firstPart = txt.charAt(0).toUpperCase(),
13
+ secondPart = txt.substr(1).toLowerCase();
14
+
15
+ return "" + firstPart + secondPart;
16
+ };
17
+
18
+ return str.replace(/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+/g, transform);
19
+ };
20
+
21
+ // this is an example ---> This is an example
22
+ var firstToUppercase = exports.firstToUppercase = function firstToUppercase(str) {
23
+ var firstPart = str.charAt(0).toUpperCase(),
24
+ secondPart = str.slice(1);
25
+
26
+ return "" + firstPart + secondPart;
27
+ };
28
+
29
+ var normalizeDiacritics = exports.normalizeDiacritics = function normalizeDiacritics(str) {
30
+ var chars = {
31
+ "ă": "a",
32
+ "â": "a",
33
+ "î": "i",
34
+ "ț": "t",
35
+ "ș": "s",
36
+
37
+ "Ă": "A",
38
+ "Â": "A",
39
+ "Î": "I",
40
+ "Ț": "T",
41
+ "Ș": "S"
42
+ };
43
+
44
+ return str.replace(/\u0103|\xE2|\xEE|\u021B|\u0219|\u0102|\xC2|\xCE|\u021A|\u0218/gi, function (matched) {
45
+ return chars[matched];
46
+ });
47
+ };
48
+
49
+ // This is ---> THIS IS
50
+ var toUpper = exports.toUpper = function toUpper(str) {
51
+ return str.toUpperCase();
52
+ };
53
+
54
+ // This is ---> this is
55
+ var toLower = exports.toLower = function toLower(str) {
56
+ return str.toLowerCase();
57
+ };
58
+
59
+ var formatBankAccount = exports.formatBankAccount = function formatBankAccount(raw) {
60
+
61
+ if (typeof raw === "undefined" || raw === "") {
62
+ return "";
63
+ }
64
+
65
+ var output = "";
66
+
67
+ var nrOfCharsPerGroup = 4,
68
+ withoutSpaces = raw.replace(/ /g, "");
69
+
70
+ for (var index = 0; index < withoutSpaces.length; index += 1) {
71
+ var currentChar = withoutSpaces.charAt(index);
72
+
73
+ if (output !== "" && index % nrOfCharsPerGroup === 0) {
74
+ output += " ";
75
+ }
76
+
77
+ output += currentChar;
78
+ }
79
+
80
+ return output;
81
+ };
82
+
83
+ var normalizeCompanyName = exports.normalizeCompanyName = function normalizeCompanyName(raw) {
84
+ return toTitle(raw).replace(/[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF][s\u017F]rl/gi, " S.R.L.").replace(/[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF][s\u017F]\.r\.l/gi, " S.R.L");
85
+ };
@@ -0,0 +1,278 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.validateFields = exports.validatePassword = exports.validateHumanName = exports.validateResetToken = exports.validateCaptchaSolution = exports.validateID = exports.validateSelect = exports.validateString = exports.validateFloat = exports.validateDate = exports.validateOptionalDate = exports.validateEmail = exports.validateBankAccount = exports.validateCif = exports.validateHumanNid = undefined;
7
+
8
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
9
+
10
+ var _validate = require("./validate");
11
+
12
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+
14
+ var errMessageSelectField = "Selectează câmpul";
15
+
16
+ var limitTense = 19,
17
+ getNumberTense = function getNumberTense(value) {
18
+ return value > limitTense ? value + " de" : String(value);
19
+ };
20
+
21
+ var validateHumanNid = exports.validateHumanNid = function validateHumanNid() {
22
+ var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
23
+ return function (value) {
24
+ var notValid = optional && typeof value !== "undefined" && value !== "" && !(0, _validate.isValidCNP)(value) || !optional && (typeof value === "undefined" || !(0, _validate.isValidCNP)(value)),
25
+ error = notValid ? "Trebuie un CNP valid" : null;
26
+
27
+ return {
28
+ notValid: notValid,
29
+ error: error
30
+ };
31
+ };
32
+ };
33
+
34
+ var validateCif = exports.validateCif = function validateCif(value) {
35
+ var notValid = typeof value === "undefined" || !(0, _validate.isValidCIF)(value),
36
+ error = notValid ? "Trebuie un cod valid de identificare fiscală" : null;
37
+
38
+ return {
39
+ notValid: notValid,
40
+ error: error
41
+ };
42
+ };
43
+
44
+ var validateBankAccount = exports.validateBankAccount = function validateBankAccount(value) {
45
+ var notValid = typeof value !== "undefined" && value !== "" && !(0, _validate.isValidBankAccount)(value),
46
+ error = notValid ? "Trebuie furnizat un IBAN valid" : null;
47
+
48
+ return {
49
+ notValid: notValid,
50
+ error: error
51
+ };
52
+ };
53
+
54
+ var validateEmail = exports.validateEmail = function validateEmail(_ref) {
55
+ var optional = _ref.optional;
56
+ return function (value) {
57
+ var notValid = optional && typeof value !== "undefined" && value !== "" && !(0, _validate.isValidEmail)(value) || !optional && (typeof value === "undefined" || !(0, _validate.isValidEmail)(value)),
58
+ error = notValid ? "Trebuie o adresă validă de e-mail" : null;
59
+
60
+ return {
61
+ notValid: notValid,
62
+ error: error
63
+ };
64
+ };
65
+ };
66
+
67
+ var validateOptionalDate = exports.validateOptionalDate = function validateOptionalDate(value) {
68
+ var notValid = !(typeof value === "undefined" || value === "" || value === null || (0, _validate.isValidDateStamp)(value)),
69
+ error = notValid ? "Trebuie o dată validă (ZZ.LL.ANUL)" : null;
70
+
71
+ return {
72
+ notValid: notValid,
73
+ error: error
74
+ };
75
+ };
76
+
77
+ var validateDate = exports.validateDate = function validateDate(value) {
78
+ var notValid = !(typeof value !== "undefined" && (0, _validate.isValidDateStamp)(value)),
79
+ error = notValid ? "Trebuie o dată validă (ZZ.LL.ANUL)" : null;
80
+
81
+ return {
82
+ notValid: notValid,
83
+ error: error
84
+ };
85
+ };
86
+
87
+ var isInt = function isInt(value) {
88
+ return !isNaN(value) && parseInt(Number(value), 10) === value && !isNaN(parseInt(value, 10));
89
+ };
90
+
91
+ var validateNumberRange = function validateNumberRange(_ref2) {
92
+ var min = _ref2.min,
93
+ max = _ref2.max,
94
+ value = _ref2.value,
95
+ integer = _ref2.integer;
96
+
97
+ if (typeof value !== "number") {
98
+ return false;
99
+ }
100
+
101
+ var numeric = Number(value),
102
+ hasMin = typeof min === "number",
103
+ hasMax = typeof max === "number";
104
+
105
+ return typeof value !== "undefined" && value !== "" && !isNaN(value) && (!integer || integer && isInt(value)) && (!hasMin || typeof min === "number" && numeric >= min) && (!hasMax || typeof max === "number" && numeric <= max);
106
+ };
107
+
108
+ var getNumberRangeError = function getNumberRangeError(_ref3) {
109
+ var min = _ref3.min,
110
+ max = _ref3.max,
111
+ integer = _ref3.integer;
112
+
113
+
114
+ var minTense = typeof min === "number" ? getNumberTense(min) : "",
115
+ maxTense = typeof max === "number" ? getNumberTense(max) : "",
116
+ range = typeof min === "number" && typeof max === "number" ? " \xEEntre " + minTense + " \u0219i " + maxTense : typeof max === "number" ? " p\xE2n\u0103 \xEEn " + maxTense : typeof min === "number" ? " mai mare ca " + minTense : "";
117
+
118
+ return "Trebuie un num\u0103r " + (integer ? "întreg" : "cu virgulă") + " " + range;
119
+ };
120
+
121
+ var validateFloat = exports.validateFloat = function validateFloat(props) {
122
+ return function (value) {
123
+ var min = props.min,
124
+ max = props.max,
125
+ optional = props.optional,
126
+ integer = props.integer;
127
+
128
+
129
+ var whenOptional = optional && !(typeof value === "undefined" || value === null || validateNumberRange({
130
+ min: min,
131
+ max: max,
132
+ value: value,
133
+ integer: integer
134
+ })),
135
+ whenRequired = !optional && !(typeof value !== "undefined" && value !== null && validateNumberRange({
136
+ min: min,
137
+ max: max,
138
+ value: value,
139
+ integer: integer
140
+ })),
141
+ notValid = whenOptional || whenRequired,
142
+ error = notValid ? getNumberRangeError({
143
+ min: min,
144
+ max: max,
145
+ integer: integer
146
+ }) : "";
147
+
148
+ return {
149
+ notValid: notValid,
150
+ error: error
151
+ };
152
+ };
153
+ };
154
+
155
+ var getStringTense = function getStringTense(_ref4) {
156
+ var min = _ref4.min,
157
+ max = _ref4.max,
158
+ what = _ref4.what;
159
+
160
+ var maxTense = max ? getNumberTense(max) : "",
161
+ minTense = min ? getNumberTense(min) : "",
162
+ isBetween = typeof max === "number" && typeof min === "number",
163
+ rangeError = isBetween ? "\xEEntre " + minTense + " \u0219i " + maxTense : typeof max === "number" ? "p\xE2n\u0103 \xEEn " + maxTense : typeof min === "number" ? "cel pu\u021Bin " + minTense : "";
164
+
165
+ return what + " are " + rangeError + " caractere";
166
+ };
167
+
168
+ var validateStringRange = function validateStringRange(_ref5) {
169
+ var min = _ref5.min,
170
+ max = _ref5.max,
171
+ value = _ref5.value;
172
+
173
+ if (typeof value !== "string") {
174
+ return false;
175
+ }
176
+
177
+ var length = typeof value === "undefined" ? 0 : value.length,
178
+ hasMin = typeof min === "number",
179
+ hasMax = typeof max === "number";
180
+
181
+ return (!hasMin || typeof min === "number" && length >= min) && (!hasMax || typeof max === "number" && length <= max);
182
+ };
183
+
184
+ var validateString = exports.validateString = function validateString(props) {
185
+ return function (value) {
186
+ var _props$what = props.what,
187
+ what = _props$what === undefined ? "Câmpul" : _props$what,
188
+ min = props.min,
189
+ max = props.max,
190
+ optional = props.optional;
191
+
192
+ var whenOptional = optional && !(typeof value === "undefined" || value === null || validateStringRange({
193
+ min: min,
194
+ max: max,
195
+ value: value
196
+ })),
197
+ whenRequired = !optional && !(typeof value !== "undefined" && value !== null && validateStringRange({
198
+ min: min,
199
+ max: max,
200
+ value: value
201
+ })),
202
+ notValid = whenOptional || whenRequired,
203
+ error = notValid ? getStringTense({
204
+ min: min,
205
+ max: max,
206
+ what: what
207
+ }) : "";
208
+
209
+ return {
210
+ notValid: notValid,
211
+ error: error
212
+ };
213
+ };
214
+ };
215
+
216
+ var validateSelect = exports.validateSelect = function validateSelect(message) {
217
+ return function (value) {
218
+ var notValid = typeof value === "undefined" || value === null || value === "",
219
+ error = notValid ? typeof message === "undefined" ? errMessageSelectField : message : null;
220
+
221
+ return {
222
+ notValid: notValid,
223
+ error: error
224
+ };
225
+ };
226
+ };
227
+
228
+ var validateID = exports.validateID = function validateID(message) {
229
+ return function (value) {
230
+ var notValid = !(typeof value === "number" && !isNaN(value)),
231
+ error = notValid ? typeof message === "undefined" ? errMessageSelectField : message : null;
232
+
233
+ return {
234
+ notValid: notValid,
235
+ error: error
236
+ };
237
+ };
238
+ };
239
+
240
+ var validateCaptchaSolution = exports.validateCaptchaSolution = function validateCaptchaSolution(value) {
241
+ var pattern = /^[0-9]{6}$/,
242
+ notValid = typeof value !== "undefined" && !pattern.test(value),
243
+ error = notValid ? "Codul are exact șase cifre" : null;
244
+
245
+ return {
246
+ notValid: notValid,
247
+ error: error
248
+ };
249
+ };
250
+
251
+ var validateResetToken = exports.validateResetToken = function validateResetToken(value) {
252
+ var tokenSize = 64,
253
+ notValid = typeof value === "undefined" || String(value).length !== tokenSize,
254
+ error = notValid ? "Codul nu este valid" : null;
255
+
256
+ return {
257
+ notValid: notValid,
258
+ error: error
259
+ };
260
+ };
261
+
262
+ var validateHumanName = exports.validateHumanName = validateString({
263
+ min: 3,
264
+ max: 40
265
+ });
266
+
267
+ var validatePassword = exports.validatePassword = validateString({
268
+ min: 6,
269
+ max: 25
270
+ });
271
+
272
+ var validateFields = exports.validateFields = function validateFields(fields, checker) {
273
+ return fields.reduce(function (accumulator, _ref6) {
274
+ var field = _ref6.field,
275
+ options = _ref6.options;
276
+ return _extends({}, accumulator, _defineProperty({}, field, checker(options)));
277
+ }, {});
278
+ };
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _common = require("./common");
8
+
9
+ Object.keys(_common).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ Object.defineProperty(exports, key, {
12
+ enumerable: true,
13
+ get: function get() {
14
+ return _common[key];
15
+ }
16
+ });
17
+ });
18
+
19
+ var _specific = require("./specific");
20
+
21
+ Object.keys(_specific).forEach(function (key) {
22
+ if (key === "default" || key === "__esModule") return;
23
+ Object.defineProperty(exports, key, {
24
+ enumerable: true,
25
+ get: function get() {
26
+ return _specific[key];
27
+ }
28
+ });
29
+ });
30
+
31
+ var _validate = require("./validate");
32
+
33
+ Object.keys(_validate).forEach(function (key) {
34
+ if (key === "default" || key === "__esModule") return;
35
+ Object.defineProperty(exports, key, {
36
+ enumerable: true,
37
+ get: function get() {
38
+ return _validate[key];
39
+ }
40
+ });
41
+ });
42
+
43
+
44
+ var processErrors = function processErrors(_ref, _ref2) {
45
+ var error = _ref.error,
46
+ isArray = _ref.isArray,
47
+ _error = _ref._error,
48
+ arrayErrors = _ref.arrayErrors;
49
+ var field = _ref2.field,
50
+ errors = _ref2.errors;
51
+
52
+ if (isArray) {
53
+ if (arrayErrors) {
54
+ errors[field] = arrayErrors;
55
+ } else {
56
+ errors[field] = { _error: _error };
57
+ }
58
+ } else {
59
+ errors[field] = error;
60
+ }
61
+ };
62
+
63
+ var extractErrorsFromCheckers = exports.extractErrorsFromCheckers = function extractErrorsFromCheckers(checkers) {
64
+ return function (values) {
65
+ var errors = {};
66
+
67
+ for (var field in checkers) {
68
+ if (Object.prototype.hasOwnProperty.call(checkers, field)) {
69
+ var checker = checkers[field],
70
+ result = checker(values.get(field)),
71
+ notValid = result.notValid;
72
+
73
+
74
+ if (notValid) {
75
+ processErrors(result, {
76
+ field: field,
77
+ errors: errors
78
+ });
79
+ }
80
+ }
81
+ }
82
+
83
+ return errors;
84
+ };
85
+ };
86
+
87
+ var performValidateRows = exports.performValidateRows = function performValidateRows(items, checkers) {
88
+ var notValid = typeof items === "undefined" || items.size === 0;
89
+
90
+ if (notValid) {
91
+ return {
92
+ notValid: notValid,
93
+ _error: "Adaugă cel puțin un rând",
94
+ isArray: true
95
+ };
96
+ }
97
+
98
+ var arrayErrors = items.reduce(function (previous, item, key) {
99
+ previous[key] = extractErrorsFromCheckers(checkers)(item);
100
+
101
+ return previous;
102
+ }, []);
103
+
104
+ return {
105
+ notValid: true,
106
+ arrayErrors: arrayErrors,
107
+
108
+ isArray: true
109
+ };
110
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.validateDay = undefined;
7
+
8
+ var _common = require("./common");
9
+
10
+ var validateDay = exports.validateDay = (0, _common.validateFloat)({
11
+ min: 1,
12
+ max: 31,
13
+ integer: true
14
+ });