x25 17.7.0 → 17.7.2

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 (434) hide show
  1. package/index.d.ts +7 -1
  2. package/package.json +3 -3
  3. package/utility/normalize.test.d.ts +1 -0
  4. package/utility/normalize.test.js +40 -0
  5. package/utility/normalize.test.js.map +1 -0
  6. package/utility/strings.test.d.ts +1 -0
  7. package/utility/strings.test.js +104 -0
  8. package/utility/strings.test.js.map +1 -0
  9. package/utility/validation/validate/email.test.d.ts +1 -0
  10. package/utility/validation/validate/email.test.js +24 -0
  11. package/utility/validation/validate/email.test.js.map +1 -0
  12. package/.eslintignore +0 -3
  13. package/.eslintrc.json +0 -350
  14. package/.vscode/settings.json +0 -61
  15. package/conf/dev.js +0 -19
  16. package/conf/dist.js +0 -19
  17. package/conf/polyfills/tempPolyfills.js +0 -7
  18. package/cspell.json +0 -18
  19. package/dist/index.d.ts +0 -7
  20. package/dist/package.json +0 -137
  21. package/script/check.js +0 -15
  22. package/src/Account/Load.tsx +0 -61
  23. package/src/Account/actions.ts +0 -45
  24. package/src/Account/index.ts +0 -4
  25. package/src/Account/reducer.ts +0 -103
  26. package/src/Async/InitModule.tsx +0 -44
  27. package/src/Async/RouteLoading.tsx +0 -79
  28. package/src/Async/SimulatedException.ts +0 -15
  29. package/src/Async/helpers.ts +0 -58
  30. package/src/Async/index.tsx +0 -72
  31. package/src/Async/types.ts +0 -39
  32. package/src/Async/util.ts +0 -110
  33. package/src/Developer/JSONSyntaxFromData.tsx +0 -24
  34. package/src/Developer/JSONSyntaxFromText.tsx +0 -33
  35. package/src/Developer/types.ts +0 -14
  36. package/src/Developer/util.ts +0 -41
  37. package/src/Inputs/CaptchaBox.tsx +0 -78
  38. package/src/Inputs/DateInput.tsx +0 -124
  39. package/src/Inputs/DateTemplate.tsx +0 -147
  40. package/src/Inputs/DelayInputChange.tsx +0 -104
  41. package/src/Inputs/InputTemplate.tsx +0 -68
  42. package/src/Inputs/LabelTemplate.tsx +0 -46
  43. package/src/Inputs/NumericInput.tsx +0 -130
  44. package/src/Inputs/NumericTemplate.tsx +0 -126
  45. package/src/Inputs/Selects/Custom.tsx +0 -49
  46. package/src/Inputs/Selects/Simple.tsx +0 -63
  47. package/src/Inputs/Selects/index.tsx +0 -26
  48. package/src/Inputs/SimpleInput.tsx +0 -42
  49. package/src/Inputs/SimpleTextarea.tsx +0 -43
  50. package/src/Inputs/TextareaTemplate.tsx +0 -49
  51. package/src/Inputs/common.ts +0 -44
  52. package/src/Inputs/index.ts +0 -13
  53. package/src/Loader/LoaderRender.tsx +0 -88
  54. package/src/Loader/index.ts +0 -195
  55. package/src/Messages/CenterLoading.tsx +0 -48
  56. package/src/Messages/Error.tsx +0 -77
  57. package/src/Messages/Loading.tsx +0 -55
  58. package/src/Messages/Update.tsx +0 -32
  59. package/src/Messages/index.ts +0 -2
  60. package/src/Modal/ConfirmationModal.tsx +0 -120
  61. package/src/Modal/ModalWindow.tsx +0 -167
  62. package/src/Modal/Root.tsx +0 -64
  63. package/src/Modal/actions.ts +0 -12
  64. package/src/Modal/getComponent.tsx +0 -24
  65. package/src/Modal/index.ts +0 -5
  66. package/src/Modal/reducer.ts +0 -52
  67. package/src/Modal/types.ts +0 -47
  68. package/src/Modal/util.ts +0 -12
  69. package/src/Payment/Modal/BankTransfer.tsx +0 -117
  70. package/src/Payment/Modal/BankTransferDoneModal.tsx +0 -27
  71. package/src/Payment/Modal/index.ts +0 -11
  72. package/src/Payment/Pieces/BankTransferForm/BankTransferForm.tsx +0 -91
  73. package/src/Payment/Pieces/BankTransferForm/BankTransferFormWrapper.tsx +0 -56
  74. package/src/Payment/Pieces/BankTransferForm/BankTransferNumberField.tsx +0 -33
  75. package/src/Payment/Pieces/BankTransferForm/validate.ts +0 -14
  76. package/src/Payment/Pieces/MobilPayForm.tsx +0 -47
  77. package/src/Payment/Pieces/Payment.tsx +0 -91
  78. package/src/Payment/core/actions.ts +0 -17
  79. package/src/Payment/core/codes.ts +0 -31
  80. package/src/Payment/core/request.ts +0 -39
  81. package/src/Payment/core/types.d.ts +0 -19
  82. package/src/Payment/core/util/info.ts +0 -10
  83. package/src/Payment/core/util/util.ts +0 -41
  84. package/src/Payment/index.ts +0 -9
  85. package/src/UI/Collapse.tsx +0 -80
  86. package/src/UI/LoadImages.tsx +0 -58
  87. package/src/UI/NewFeature.tsx +0 -23
  88. package/src/UI/Things.tsx +0 -30
  89. package/src/actions.ts +0 -48
  90. package/src/config.ts +0 -19
  91. package/src/index.ts +0 -16
  92. package/src/node_modules/.vitest/results.json +0 -1
  93. package/src/reducer/captchas.ts +0 -34
  94. package/src/reducer/index.ts +0 -17
  95. package/src/reducer/module.ts +0 -31
  96. package/src/styles/_json.scss +0 -48
  97. package/src/styles/index.scss +0 -1
  98. package/src/types.ts +0 -27
  99. package/src/utility/breakpoint.tsx +0 -88
  100. package/src/utility/calendar.ts +0 -23
  101. package/src/utility/date.ts +0 -108
  102. package/src/utility/dev/ErrorBoundary.tsx +0 -90
  103. package/src/utility/dev/TheError.tsx +0 -74
  104. package/src/utility/dev/index.ts +0 -109
  105. package/src/utility/dev/types.ts +0 -8
  106. package/src/utility/hooks.ts +0 -32
  107. package/src/utility/index.ts +0 -17
  108. package/src/utility/languages/date.ts +0 -2
  109. package/src/utility/languages/english.ts +0 -127
  110. package/src/utility/languages/ro.ts +0 -123
  111. package/src/utility/normalize.test.ts +0 -43
  112. package/src/utility/normalize.ts +0 -75
  113. package/src/utility/numbers.ts +0 -62
  114. package/src/utility/numeric.ts +0 -103
  115. package/src/utility/others.tsx +0 -53
  116. package/src/utility/strings.test.ts +0 -123
  117. package/src/utility/strings.ts +0 -22
  118. package/src/utility/uuid.ts +0 -30
  119. package/src/utility/validation/common.ts +0 -255
  120. package/src/utility/validation/index.ts +0 -24
  121. package/src/utility/validation/specific.ts +0 -18
  122. package/src/utility/validation/types.ts +0 -53
  123. package/src/utility/validation/validate/date.ts +0 -52
  124. package/src/utility/validation/validate/email.test.ts +0 -26
  125. package/src/utility/validation/validate/email.ts +0 -3
  126. package/src/utility/validation/validate/index.ts +0 -2
  127. package/src/utility/words.ts +0 -82
  128. package/tsconfig.json +0 -95
  129. package/vite.config.ts +0 -10
  130. package/webpack.config.js +0 -67
  131. package/x25.wiki/Account.md +0 -41
  132. package/x25.wiki/Company.md +0 -39
  133. package/x25.wiki/Header.md +0 -21
  134. package/x25.wiki/Home.md +0 -1
  135. package/x25.wiki/Inputs.md +0 -32
  136. package/x25.wiki/Messages.md +0 -27
  137. package/x25.wiki/Payment.md +0 -42
  138. /package/{dist/Account → Account}/Load.d.ts +0 -0
  139. /package/{dist/Account → Account}/Load.js +0 -0
  140. /package/{dist/Account → Account}/Load.js.map +0 -0
  141. /package/{dist/Account → Account}/actions.d.ts +0 -0
  142. /package/{dist/Account → Account}/actions.js +0 -0
  143. /package/{dist/Account → Account}/actions.js.map +0 -0
  144. /package/{dist/Account → Account}/index.d.ts +0 -0
  145. /package/{dist/Account → Account}/index.js +0 -0
  146. /package/{dist/Account → Account}/index.js.map +0 -0
  147. /package/{dist/Account → Account}/reducer.d.ts +0 -0
  148. /package/{dist/Account → Account}/reducer.js +0 -0
  149. /package/{dist/Account → Account}/reducer.js.map +0 -0
  150. /package/{dist/Async → Async}/InitModule.d.ts +0 -0
  151. /package/{dist/Async → Async}/InitModule.js +0 -0
  152. /package/{dist/Async → Async}/InitModule.js.map +0 -0
  153. /package/{dist/Async → Async}/RouteLoading.d.ts +0 -0
  154. /package/{dist/Async → Async}/RouteLoading.js +0 -0
  155. /package/{dist/Async → Async}/RouteLoading.js.map +0 -0
  156. /package/{dist/Async → Async}/SimulatedException.d.ts +0 -0
  157. /package/{dist/Async → Async}/SimulatedException.js +0 -0
  158. /package/{dist/Async → Async}/SimulatedException.js.map +0 -0
  159. /package/{dist/Async → Async}/helpers.d.ts +0 -0
  160. /package/{dist/Async → Async}/helpers.js +0 -0
  161. /package/{dist/Async → Async}/helpers.js.map +0 -0
  162. /package/{dist/Async → Async}/index.d.ts +0 -0
  163. /package/{dist/Async → Async}/index.js +0 -0
  164. /package/{dist/Async → Async}/index.js.map +0 -0
  165. /package/{dist/Async → Async}/types.d.ts +0 -0
  166. /package/{dist/Async → Async}/types.js +0 -0
  167. /package/{dist/Async → Async}/types.js.map +0 -0
  168. /package/{dist/Async → Async}/util.d.ts +0 -0
  169. /package/{dist/Async → Async}/util.js +0 -0
  170. /package/{dist/Async → Async}/util.js.map +0 -0
  171. /package/{dist/Developer → Developer}/JSONSyntaxFromData.d.ts +0 -0
  172. /package/{dist/Developer → Developer}/JSONSyntaxFromData.js +0 -0
  173. /package/{dist/Developer → Developer}/JSONSyntaxFromData.js.map +0 -0
  174. /package/{dist/Developer → Developer}/JSONSyntaxFromText.d.ts +0 -0
  175. /package/{dist/Developer → Developer}/JSONSyntaxFromText.js +0 -0
  176. /package/{dist/Developer → Developer}/JSONSyntaxFromText.js.map +0 -0
  177. /package/{dist/Developer → Developer}/types.d.ts +0 -0
  178. /package/{dist/Developer → Developer}/types.js +0 -0
  179. /package/{dist/Developer → Developer}/types.js.map +0 -0
  180. /package/{dist/Developer → Developer}/util.d.ts +0 -0
  181. /package/{dist/Developer → Developer}/util.js +0 -0
  182. /package/{dist/Developer → Developer}/util.js.map +0 -0
  183. /package/{dist/Inputs → Inputs}/CaptchaBox.d.ts +0 -0
  184. /package/{dist/Inputs → Inputs}/CaptchaBox.js +0 -0
  185. /package/{dist/Inputs → Inputs}/CaptchaBox.js.map +0 -0
  186. /package/{dist/Inputs → Inputs}/DateInput.d.ts +0 -0
  187. /package/{dist/Inputs → Inputs}/DateInput.js +0 -0
  188. /package/{dist/Inputs → Inputs}/DateInput.js.map +0 -0
  189. /package/{dist/Inputs → Inputs}/DateTemplate.d.ts +0 -0
  190. /package/{dist/Inputs → Inputs}/DateTemplate.js +0 -0
  191. /package/{dist/Inputs → Inputs}/DateTemplate.js.map +0 -0
  192. /package/{dist/Inputs → Inputs}/DelayInputChange.d.ts +0 -0
  193. /package/{dist/Inputs → Inputs}/DelayInputChange.js +0 -0
  194. /package/{dist/Inputs → Inputs}/DelayInputChange.js.map +0 -0
  195. /package/{dist/Inputs → Inputs}/InputTemplate.d.ts +0 -0
  196. /package/{dist/Inputs → Inputs}/InputTemplate.js +0 -0
  197. /package/{dist/Inputs → Inputs}/InputTemplate.js.map +0 -0
  198. /package/{dist/Inputs → Inputs}/LabelTemplate.d.ts +0 -0
  199. /package/{dist/Inputs → Inputs}/LabelTemplate.js +0 -0
  200. /package/{dist/Inputs → Inputs}/LabelTemplate.js.map +0 -0
  201. /package/{dist/Inputs → Inputs}/NumericInput.d.ts +0 -0
  202. /package/{dist/Inputs → Inputs}/NumericInput.js +0 -0
  203. /package/{dist/Inputs → Inputs}/NumericInput.js.map +0 -0
  204. /package/{dist/Inputs → Inputs}/NumericTemplate.d.ts +0 -0
  205. /package/{dist/Inputs → Inputs}/NumericTemplate.js +0 -0
  206. /package/{dist/Inputs → Inputs}/NumericTemplate.js.map +0 -0
  207. /package/{dist/Inputs → Inputs}/Selects/Custom.d.ts +0 -0
  208. /package/{dist/Inputs → Inputs}/Selects/Custom.js +0 -0
  209. /package/{dist/Inputs → Inputs}/Selects/Custom.js.map +0 -0
  210. /package/{dist/Inputs → Inputs}/Selects/Simple.d.ts +0 -0
  211. /package/{dist/Inputs → Inputs}/Selects/Simple.js +0 -0
  212. /package/{dist/Inputs → Inputs}/Selects/Simple.js.map +0 -0
  213. /package/{dist/Inputs → Inputs}/Selects/index.d.ts +0 -0
  214. /package/{dist/Inputs → Inputs}/Selects/index.js +0 -0
  215. /package/{dist/Inputs → Inputs}/Selects/index.js.map +0 -0
  216. /package/{dist/Inputs → Inputs}/SimpleInput.d.ts +0 -0
  217. /package/{dist/Inputs → Inputs}/SimpleInput.js +0 -0
  218. /package/{dist/Inputs → Inputs}/SimpleInput.js.map +0 -0
  219. /package/{dist/Inputs → Inputs}/SimpleTextarea.d.ts +0 -0
  220. /package/{dist/Inputs → Inputs}/SimpleTextarea.js +0 -0
  221. /package/{dist/Inputs → Inputs}/SimpleTextarea.js.map +0 -0
  222. /package/{dist/Inputs → Inputs}/TextareaTemplate.d.ts +0 -0
  223. /package/{dist/Inputs → Inputs}/TextareaTemplate.js +0 -0
  224. /package/{dist/Inputs → Inputs}/TextareaTemplate.js.map +0 -0
  225. /package/{dist/Inputs → Inputs}/common.d.ts +0 -0
  226. /package/{dist/Inputs → Inputs}/common.js +0 -0
  227. /package/{dist/Inputs → Inputs}/common.js.map +0 -0
  228. /package/{dist/Inputs → Inputs}/index.d.ts +0 -0
  229. /package/{dist/Inputs → Inputs}/index.js +0 -0
  230. /package/{dist/Inputs → Inputs}/index.js.map +0 -0
  231. /package/{dist/Loader → Loader}/LoaderRender.d.ts +0 -0
  232. /package/{dist/Loader → Loader}/LoaderRender.js +0 -0
  233. /package/{dist/Loader → Loader}/LoaderRender.js.map +0 -0
  234. /package/{dist/Loader → Loader}/index.d.ts +0 -0
  235. /package/{dist/Loader → Loader}/index.js +0 -0
  236. /package/{dist/Loader → Loader}/index.js.map +0 -0
  237. /package/{dist/Messages → Messages}/CenterLoading.d.ts +0 -0
  238. /package/{dist/Messages → Messages}/CenterLoading.js +0 -0
  239. /package/{dist/Messages → Messages}/CenterLoading.js.map +0 -0
  240. /package/{dist/Messages → Messages}/Error.d.ts +0 -0
  241. /package/{dist/Messages → Messages}/Error.js +0 -0
  242. /package/{dist/Messages → Messages}/Error.js.map +0 -0
  243. /package/{dist/Messages → Messages}/Loading.d.ts +0 -0
  244. /package/{dist/Messages → Messages}/Loading.js +0 -0
  245. /package/{dist/Messages → Messages}/Loading.js.map +0 -0
  246. /package/{dist/Messages → Messages}/Update.d.ts +0 -0
  247. /package/{dist/Messages → Messages}/Update.js +0 -0
  248. /package/{dist/Messages → Messages}/Update.js.map +0 -0
  249. /package/{dist/Messages → Messages}/index.d.ts +0 -0
  250. /package/{dist/Messages → Messages}/index.js +0 -0
  251. /package/{dist/Messages → Messages}/index.js.map +0 -0
  252. /package/{dist/Modal → Modal}/ConfirmationModal.d.ts +0 -0
  253. /package/{dist/Modal → Modal}/ConfirmationModal.js +0 -0
  254. /package/{dist/Modal → Modal}/ConfirmationModal.js.map +0 -0
  255. /package/{dist/Modal → Modal}/ModalWindow.d.ts +0 -0
  256. /package/{dist/Modal → Modal}/ModalWindow.js +0 -0
  257. /package/{dist/Modal → Modal}/ModalWindow.js.map +0 -0
  258. /package/{dist/Modal → Modal}/Root.d.ts +0 -0
  259. /package/{dist/Modal → Modal}/Root.js +0 -0
  260. /package/{dist/Modal → Modal}/Root.js.map +0 -0
  261. /package/{dist/Modal → Modal}/actions.d.ts +0 -0
  262. /package/{dist/Modal → Modal}/actions.js +0 -0
  263. /package/{dist/Modal → Modal}/actions.js.map +0 -0
  264. /package/{dist/Modal → Modal}/getComponent.d.ts +0 -0
  265. /package/{dist/Modal → Modal}/getComponent.js +0 -0
  266. /package/{dist/Modal → Modal}/getComponent.js.map +0 -0
  267. /package/{dist/Modal → Modal}/index.d.ts +0 -0
  268. /package/{dist/Modal → Modal}/index.js +0 -0
  269. /package/{dist/Modal → Modal}/index.js.map +0 -0
  270. /package/{dist/Modal → Modal}/reducer.d.ts +0 -0
  271. /package/{dist/Modal → Modal}/reducer.js +0 -0
  272. /package/{dist/Modal → Modal}/reducer.js.map +0 -0
  273. /package/{dist/Modal → Modal}/types.d.ts +0 -0
  274. /package/{dist/Modal → Modal}/types.js +0 -0
  275. /package/{dist/Modal → Modal}/types.js.map +0 -0
  276. /package/{dist/Modal → Modal}/util.d.ts +0 -0
  277. /package/{dist/Modal → Modal}/util.js +0 -0
  278. /package/{dist/Modal → Modal}/util.js.map +0 -0
  279. /package/{dist/Payment → Payment}/Modal/BankTransfer.d.ts +0 -0
  280. /package/{dist/Payment → Payment}/Modal/BankTransfer.js +0 -0
  281. /package/{dist/Payment → Payment}/Modal/BankTransfer.js.map +0 -0
  282. /package/{dist/Payment → Payment}/Modal/BankTransferDoneModal.d.ts +0 -0
  283. /package/{dist/Payment → Payment}/Modal/BankTransferDoneModal.js +0 -0
  284. /package/{dist/Payment → Payment}/Modal/BankTransferDoneModal.js.map +0 -0
  285. /package/{dist/Payment → Payment}/Modal/index.d.ts +0 -0
  286. /package/{dist/Payment → Payment}/Modal/index.js +0 -0
  287. /package/{dist/Payment → Payment}/Modal/index.js.map +0 -0
  288. /package/{dist/Payment → Payment}/Pieces/BankTransferForm/BankTransferForm.d.ts +0 -0
  289. /package/{dist/Payment → Payment}/Pieces/BankTransferForm/BankTransferForm.js +0 -0
  290. /package/{dist/Payment → Payment}/Pieces/BankTransferForm/BankTransferForm.js.map +0 -0
  291. /package/{dist/Payment → Payment}/Pieces/BankTransferForm/BankTransferFormWrapper.d.ts +0 -0
  292. /package/{dist/Payment → Payment}/Pieces/BankTransferForm/BankTransferFormWrapper.js +0 -0
  293. /package/{dist/Payment → Payment}/Pieces/BankTransferForm/BankTransferFormWrapper.js.map +0 -0
  294. /package/{dist/Payment → Payment}/Pieces/BankTransferForm/BankTransferNumberField.d.ts +0 -0
  295. /package/{dist/Payment → Payment}/Pieces/BankTransferForm/BankTransferNumberField.js +0 -0
  296. /package/{dist/Payment → Payment}/Pieces/BankTransferForm/BankTransferNumberField.js.map +0 -0
  297. /package/{dist/Payment → Payment}/Pieces/BankTransferForm/validate.d.ts +0 -0
  298. /package/{dist/Payment → Payment}/Pieces/BankTransferForm/validate.js +0 -0
  299. /package/{dist/Payment → Payment}/Pieces/BankTransferForm/validate.js.map +0 -0
  300. /package/{dist/Payment → Payment}/Pieces/MobilPayForm.d.ts +0 -0
  301. /package/{dist/Payment → Payment}/Pieces/MobilPayForm.js +0 -0
  302. /package/{dist/Payment → Payment}/Pieces/MobilPayForm.js.map +0 -0
  303. /package/{dist/Payment → Payment}/Pieces/Payment.d.ts +0 -0
  304. /package/{dist/Payment → Payment}/Pieces/Payment.js +0 -0
  305. /package/{dist/Payment → Payment}/Pieces/Payment.js.map +0 -0
  306. /package/{dist/Payment → Payment}/core/actions.d.ts +0 -0
  307. /package/{dist/Payment → Payment}/core/actions.js +0 -0
  308. /package/{dist/Payment → Payment}/core/actions.js.map +0 -0
  309. /package/{dist/Payment → Payment}/core/codes.d.ts +0 -0
  310. /package/{dist/Payment → Payment}/core/codes.js +0 -0
  311. /package/{dist/Payment → Payment}/core/codes.js.map +0 -0
  312. /package/{dist/Payment → Payment}/core/request.d.ts +0 -0
  313. /package/{dist/Payment → Payment}/core/request.js +0 -0
  314. /package/{dist/Payment → Payment}/core/request.js.map +0 -0
  315. /package/{dist/Payment → Payment}/core/util/info.d.ts +0 -0
  316. /package/{dist/Payment → Payment}/core/util/info.js +0 -0
  317. /package/{dist/Payment → Payment}/core/util/info.js.map +0 -0
  318. /package/{dist/Payment → Payment}/core/util/util.d.ts +0 -0
  319. /package/{dist/Payment → Payment}/core/util/util.js +0 -0
  320. /package/{dist/Payment → Payment}/core/util/util.js.map +0 -0
  321. /package/{dist/Payment → Payment}/index.d.ts +0 -0
  322. /package/{dist/Payment → Payment}/index.js +0 -0
  323. /package/{dist/Payment → Payment}/index.js.map +0 -0
  324. /package/{dist/UI → UI}/Collapse.d.ts +0 -0
  325. /package/{dist/UI → UI}/Collapse.js +0 -0
  326. /package/{dist/UI → UI}/Collapse.js.map +0 -0
  327. /package/{dist/UI → UI}/LoadImages.d.ts +0 -0
  328. /package/{dist/UI → UI}/LoadImages.js +0 -0
  329. /package/{dist/UI → UI}/LoadImages.js.map +0 -0
  330. /package/{dist/UI → UI}/NewFeature.d.ts +0 -0
  331. /package/{dist/UI → UI}/NewFeature.js +0 -0
  332. /package/{dist/UI → UI}/NewFeature.js.map +0 -0
  333. /package/{dist/UI → UI}/Things.d.ts +0 -0
  334. /package/{dist/UI → UI}/Things.js +0 -0
  335. /package/{dist/UI → UI}/Things.js.map +0 -0
  336. /package/{dist/actions.d.ts → actions.d.ts} +0 -0
  337. /package/{dist/actions.js → actions.js} +0 -0
  338. /package/{dist/actions.js.map → actions.js.map} +0 -0
  339. /package/{dist/config.d.ts → config.d.ts} +0 -0
  340. /package/{dist/config.js → config.js} +0 -0
  341. /package/{dist/config.js.map → config.js.map} +0 -0
  342. /package/{dist/index.js → index.js} +0 -0
  343. /package/{dist/index.js.map → index.js.map} +0 -0
  344. /package/{dist/reducer → reducer}/captchas.d.ts +0 -0
  345. /package/{dist/reducer → reducer}/captchas.js +0 -0
  346. /package/{dist/reducer → reducer}/captchas.js.map +0 -0
  347. /package/{dist/reducer → reducer}/index.d.ts +0 -0
  348. /package/{dist/reducer → reducer}/index.js +0 -0
  349. /package/{dist/reducer → reducer}/index.js.map +0 -0
  350. /package/{dist/reducer → reducer}/module.d.ts +0 -0
  351. /package/{dist/reducer → reducer}/module.js +0 -0
  352. /package/{dist/reducer → reducer}/module.js.map +0 -0
  353. /package/{dist/styles → styles}/index.css +0 -0
  354. /package/{dist/types.d.ts → types.d.ts} +0 -0
  355. /package/{dist/types.js → types.js} +0 -0
  356. /package/{dist/types.js.map → types.js.map} +0 -0
  357. /package/{dist/utility → utility}/breakpoint.d.ts +0 -0
  358. /package/{dist/utility → utility}/breakpoint.js +0 -0
  359. /package/{dist/utility → utility}/breakpoint.js.map +0 -0
  360. /package/{dist/utility → utility}/calendar.d.ts +0 -0
  361. /package/{dist/utility → utility}/calendar.js +0 -0
  362. /package/{dist/utility → utility}/calendar.js.map +0 -0
  363. /package/{dist/utility → utility}/date.d.ts +0 -0
  364. /package/{dist/utility → utility}/date.js +0 -0
  365. /package/{dist/utility → utility}/date.js.map +0 -0
  366. /package/{dist/utility → utility}/dev/ErrorBoundary.d.ts +0 -0
  367. /package/{dist/utility → utility}/dev/ErrorBoundary.js +0 -0
  368. /package/{dist/utility → utility}/dev/ErrorBoundary.js.map +0 -0
  369. /package/{dist/utility → utility}/dev/TheError.d.ts +0 -0
  370. /package/{dist/utility → utility}/dev/TheError.js +0 -0
  371. /package/{dist/utility → utility}/dev/TheError.js.map +0 -0
  372. /package/{dist/utility → utility}/dev/index.d.ts +0 -0
  373. /package/{dist/utility → utility}/dev/index.js +0 -0
  374. /package/{dist/utility → utility}/dev/index.js.map +0 -0
  375. /package/{dist/utility → utility}/dev/types.d.ts +0 -0
  376. /package/{dist/utility → utility}/dev/types.js +0 -0
  377. /package/{dist/utility → utility}/dev/types.js.map +0 -0
  378. /package/{dist/utility → utility}/hooks.d.ts +0 -0
  379. /package/{dist/utility → utility}/hooks.js +0 -0
  380. /package/{dist/utility → utility}/hooks.js.map +0 -0
  381. /package/{dist/utility → utility}/index.d.ts +0 -0
  382. /package/{dist/utility → utility}/index.js +0 -0
  383. /package/{dist/utility → utility}/index.js.map +0 -0
  384. /package/{dist/utility → utility}/languages/date.d.ts +0 -0
  385. /package/{dist/utility → utility}/languages/date.js +0 -0
  386. /package/{dist/utility → utility}/languages/date.js.map +0 -0
  387. /package/{dist/utility → utility}/languages/english.d.ts +0 -0
  388. /package/{dist/utility → utility}/languages/english.js +0 -0
  389. /package/{dist/utility → utility}/languages/english.js.map +0 -0
  390. /package/{dist/utility → utility}/languages/ro.d.ts +0 -0
  391. /package/{dist/utility → utility}/languages/ro.js +0 -0
  392. /package/{dist/utility → utility}/languages/ro.js.map +0 -0
  393. /package/{dist/utility → utility}/normalize.d.ts +0 -0
  394. /package/{dist/utility → utility}/normalize.js +0 -0
  395. /package/{dist/utility → utility}/normalize.js.map +0 -0
  396. /package/{dist/utility → utility}/numbers.d.ts +0 -0
  397. /package/{dist/utility → utility}/numbers.js +0 -0
  398. /package/{dist/utility → utility}/numbers.js.map +0 -0
  399. /package/{dist/utility → utility}/numeric.d.ts +0 -0
  400. /package/{dist/utility → utility}/numeric.js +0 -0
  401. /package/{dist/utility → utility}/numeric.js.map +0 -0
  402. /package/{dist/utility → utility}/others.d.ts +0 -0
  403. /package/{dist/utility → utility}/others.js +0 -0
  404. /package/{dist/utility → utility}/others.js.map +0 -0
  405. /package/{dist/utility → utility}/strings.d.ts +0 -0
  406. /package/{dist/utility → utility}/strings.js +0 -0
  407. /package/{dist/utility → utility}/strings.js.map +0 -0
  408. /package/{dist/utility → utility}/uuid.d.ts +0 -0
  409. /package/{dist/utility → utility}/uuid.js +0 -0
  410. /package/{dist/utility → utility}/uuid.js.map +0 -0
  411. /package/{dist/utility → utility}/validation/common.d.ts +0 -0
  412. /package/{dist/utility → utility}/validation/common.js +0 -0
  413. /package/{dist/utility → utility}/validation/common.js.map +0 -0
  414. /package/{dist/utility → utility}/validation/index.d.ts +0 -0
  415. /package/{dist/utility → utility}/validation/index.js +0 -0
  416. /package/{dist/utility → utility}/validation/index.js.map +0 -0
  417. /package/{dist/utility → utility}/validation/specific.d.ts +0 -0
  418. /package/{dist/utility → utility}/validation/specific.js +0 -0
  419. /package/{dist/utility → utility}/validation/specific.js.map +0 -0
  420. /package/{dist/utility → utility}/validation/types.d.ts +0 -0
  421. /package/{dist/utility → utility}/validation/types.js +0 -0
  422. /package/{dist/utility → utility}/validation/types.js.map +0 -0
  423. /package/{dist/utility → utility}/validation/validate/date.d.ts +0 -0
  424. /package/{dist/utility → utility}/validation/validate/date.js +0 -0
  425. /package/{dist/utility → utility}/validation/validate/date.js.map +0 -0
  426. /package/{dist/utility → utility}/validation/validate/email.d.ts +0 -0
  427. /package/{dist/utility → utility}/validation/validate/email.js +0 -0
  428. /package/{dist/utility → utility}/validation/validate/email.js.map +0 -0
  429. /package/{dist/utility → utility}/validation/validate/index.d.ts +0 -0
  430. /package/{dist/utility → utility}/validation/validate/index.js +0 -0
  431. /package/{dist/utility → utility}/validation/validate/index.js.map +0 -0
  432. /package/{dist/utility → utility}/words.d.ts +0 -0
  433. /package/{dist/utility → utility}/words.js +0 -0
  434. /package/{dist/utility → utility}/words.js.map +0 -0
@@ -1,109 +0,0 @@
1
- /* eslint-disable no-alert, no-console, no-undefined, callback-return */
2
- import * as Immutable from "immutable";
3
- import { words } from "..";
4
-
5
- type Log = { data : any, state : any, key : string};
6
-
7
- const setFavIconToDev = () => {
8
- const element: any = document.querySelector("link[rel*='icon");
9
-
10
- if (element !== null && element.href) {
11
- element.href = "/static/dev.ico";
12
- }
13
- },
14
-
15
- ensureImmutableState = (ignored: Array<any> = []) => {
16
- const
17
- ignore = (key: string) => ignored.includes(key),
18
- isGood = (data : any, key : string) => (
19
- ignore(key) ||
20
- data === null ||
21
- data === undefined ||
22
- Immutable.isImmutable(data) ||
23
- typeof data === "number" ||
24
- typeof data === "boolean" ||
25
- typeof data === "string"
26
- );
27
-
28
- let
29
- problems: any = Immutable.Map(),
30
- allKeys = Immutable.List(),
31
- currentKey = Immutable.List();
32
-
33
- const
34
- listCurrentProblems = () => {
35
- if (currentKey.size !== 0) {
36
- const
37
- log = ({ data, state, key } : Log) => {
38
- const itExists = (
39
- typeof data !== "undefined" ||
40
- typeof state !== "undefined" ||
41
- typeof key !== "undefined"
42
- );
43
-
44
- if (itExists) {
45
- console.group("redux-ensure-state-is-immutable");
46
- console.log("data:", data);
47
- console.log("parent:", state.toJS());
48
- console.log("typeof data:", typeof data);
49
- console.log("key:", key);
50
- console.groupEnd();
51
- }
52
- };
53
-
54
- alert(words.SomethingIsNotImmutable);
55
- currentKey.map((current) => log(problems.get(current)));
56
- currentKey = currentKey.clear();
57
- }
58
- },
59
-
60
- addProblem = ({ data, state, key } : Log) => {
61
- problems = problems.set(key, {
62
- key,
63
- state,
64
- data,
65
- });
66
-
67
- if (!allKeys.includes(key)) {
68
- allKeys = allKeys.push(key);
69
- currentKey = currentKey.push(key);
70
- }
71
- },
72
-
73
- shouldParse = (data : any, key : string) => !ignore(key) && Immutable.isImmutable(data),
74
-
75
- checkStateContainsOnlyImmutable = (state : any) => {
76
- const parse = (data : any, key : string) => {
77
- const goodData = isGood(data, key),
78
- canParse = shouldParse(data, key);
79
-
80
- if (!goodData) {
81
- addProblem({
82
- data,
83
- state,
84
- key,
85
- });
86
- }
87
-
88
- listCurrentProblems();
89
-
90
- if (canParse) {
91
- checkStateContainsOnlyImmutable(data);
92
- }
93
- };
94
-
95
- state.forEach((current : string, key : string) => {
96
- parse(current, key);
97
- });
98
- };
99
-
100
- return ({ getState }: any) => (next: any) => (action: any) => {
101
- const returnValue = next(action),
102
- state = getState();
103
-
104
- checkStateContainsOnlyImmutable(state);
105
- return returnValue;
106
- };
107
- };
108
-
109
- export { setFavIconToDev, ensureImmutableState };
@@ -1,8 +0,0 @@
1
- export type ErrorType = {
2
- name: string;
3
- message: string;
4
- stack?: string;
5
- };
6
- export type InfoType = {
7
- componentStack: string;
8
- };
@@ -1,32 +0,0 @@
1
-
2
- import { useEffect } from "react";
3
-
4
- type CheckClickOutsideMenu = {
5
- menuRef: any;
6
- buttonRef: any;
7
- setIsOpen : (value : boolean) => any
8
- }
9
-
10
- export const
11
- checkClickOutsideMenu = ({ menuRef, buttonRef, setIsOpen } : CheckClickOutsideMenu) => {
12
- useEffect(() => {
13
- const handleClickOutside = (event : MouseEvent) => {
14
- const isClickOutsideButNotOnButton = (
15
- menuRef.current &&
16
- !menuRef.current.contains(event.target) &&
17
- !buttonRef.current.contains(event.target)
18
- );
19
-
20
- if (isClickOutsideButNotOnButton) {
21
- setIsOpen(false);
22
- }
23
- };
24
-
25
- document.addEventListener("mousedown", handleClickOutside);
26
-
27
- return () => {
28
- document.removeEventListener("mousedown", handleClickOutside);
29
- };
30
- }, [menuRef, buttonRef]);
31
- };
32
-
@@ -1,17 +0,0 @@
1
- export * from "./calendar";
2
- export * from "./date";
3
- export * from "./hooks";
4
- export * from "./numbers";
5
- export * from "./numeric";
6
- export * from "./others";
7
- export * from "./strings";
8
- export * from "./validation";
9
- export * from "./words";
10
-
11
- import { FORM_ERROR } from "final-form";
12
-
13
- export const
14
- formError = (message : string) => ({
15
- [FORM_ERROR]: message,
16
- }),
17
- toNumeric = (raw : any) => Number(String(raw));
@@ -1,2 +0,0 @@
1
- export const
2
- DateFormat = "DD.MM.YEAR";
@@ -1,127 +0,0 @@
1
- import { DateFormat } from "./date";
2
-
3
- export const english = {
4
- Showing : "Showing",
5
- All : "all",
6
- Of : "of",
7
- LoadingData : "Loading data...",
8
- LoadMore : "Load more",
9
-
10
- UpdateTitle : "Update available",
11
- UpdateDescriptionLine1 : "The app is constantly receiving updates in order to improve its functions",
12
- UpdateDescriptionLine2 : "In order to continue",
13
- UpdateDescriptionLine3 : "you must click the blue button",
14
- UpdateButton : "Update app",
15
-
16
- ThisPage : "If this error persists, please navigate to",
17
- IfThisIsErrorPersist : "this page",
18
- PleaseWait : "Please wait...",
19
- TryAgain : "Try again",
20
- ThereWasAProblem : "There was a problem. Try again",
21
- NoErrorPassed : "No ErrorBoundary passed to x25",
22
- ItLoadsSlower : "It seems that it loads slower than usual. Please wait... ",
23
- TryingToRecover : "Trying to recover...",
24
- SomethingIsNotImmutable : "Something is not immutable. check console",
25
- // header
26
- ConnectionLost : "I lost the connection to server. Try again.",
27
- Options : "Options",
28
- TermsAndConditions : "Terms and conditions",
29
- PrivacyPolicy : "Privacy Policy",
30
- SelectCompany : "Select company",
31
- Toggle : "Toggle",
32
- Settings : "Settings",
33
- RenewSubscription : "Renew subscription",
34
- TheSubscriptionWillExpireIn : "The subscription will expire in",
35
- SignOut : "Sing out",
36
- NoOptions : "No options",
37
- // inputs
38
- BankAccount : "Bank Account",
39
- BankName : "Bank Name",
40
- FiscalID : "Fiscal ID",
41
- GetDataFromInternet : "Getting the data from the Internet",
42
- EnterAValidFiscalID : "Please type a valid fiscal ID",
43
- PersonalID : "Personal ID",
44
- County : "County",
45
- Select : "Select",
46
- CaptchaDescription : `The purpose of this check is to distinguish a person from a robot.
47
- This code usually appears when a feature in the application is overused`,
48
- CaptchaTypeNumbers : "Type numbers from the image below",
49
- CaptchaVerify : "Verification",
50
- DateFormat,
51
- ErrorNeverExisted : "It may have been deleted or never existed",
52
- ErrorConnection : `There seems to be a problem with your server or your internet connection
53
- has been interrupted.`,
54
- Sentry: {
55
- TellUs: {
56
- title : "It seems we have a problem",
57
- subtitle : "Our team has been announced.",
58
- subtitle2 : `If you want to help us, tell us what happened below.
59
- It will help us a lot`,
60
- labelName : "Your name",
61
- labelEmail : "Email",
62
- labelComments : "What happened?",
63
- labelClose : "Close",
64
- labelSubmit : "Send",
65
- errorGeneric : `An unknown error occurred while sending the report
66
- Please try again`,
67
- errorFormEntry : "Some fields were invalid. Please correct the errors and try again.",
68
- successMessage : "Your feedback has been sent. Thanks!",
69
- },
70
- Message: `This message appears when the program failed and failed
71
- to recover. The administrator has been automatically notified about
72
- this problem. All we have to do is apologize.`,
73
- Button : "Tell us",
74
- Hint : "Tip: Try refreshing the page - press the key",
75
- },
76
- Confirmation : "Confirmation",
77
- // validation
78
- PleaseSelect : "Please select",
79
- EnterValidPersonalID : "Type a valid personal ID",
80
- EnterValidFiscalID : "Type a valid fiscal ID",
81
- EnterValidBankAccount : "Type a valid bank account",
82
- EnterValidEmail : "Type a valid email",
83
- EnterValidDate : `Type a valid date (${DateFormat})`,
84
- NumberBetween : "between",
85
- NumberAnd : "and",
86
- NumberUpTo : "up to",
87
- NumberGreaterThan : "grater than",
88
- NumberMustBe : "Must be a number",
89
- NumberInteger : "integer",
90
- NumberFloat : "float",
91
- Chars : "chars",
92
- Has : "has",
93
- TheField : "The field",
94
- Has6Digits : "The code has 6 digits",
95
- CodeNotValid : "The code is not valid",
96
- AddARow : "Add at least a row",
97
- message : {
98
- failPerform : "Could not perform task",
99
- confirmDelete : "I deleted successfully",
100
- confirmAdd : "Successfully added",
101
- confirmUpdate : "Updated data",
102
- },
103
- label: {
104
- modify : "Modify",
105
- add : "Add",
106
- remove : "Delete",
107
- confirmation : "Confirm",
108
- cancel : "Cancel",
109
- },
110
- Month: {
111
- 0 : "January",
112
- 1 : "February",
113
- 2 : "March",
114
- 3 : "April",
115
- 4 : "May",
116
- 5 : "June",
117
- 6 : "July",
118
- 7 : "August",
119
- 8 : "September",
120
- 9 : "October",
121
- 10 : "November",
122
- 11 : "December",
123
- },
124
- MustAgree: "You must agree with this",
125
-
126
- getNumberTense: (value: number) => String(value),
127
- };
@@ -1,123 +0,0 @@
1
- /* eslint-disable max-len */
2
-
3
- const DateFormat = "DD.MM.YEAR";
4
-
5
- export const
6
- romanian = {
7
- Showing : "Se afișează",
8
- All : "tot",
9
- Of : "din",
10
- LoadingData : "Se încarcă...",
11
- LoadMore : "Încarcă mai mult",
12
-
13
- UpdateTitle : "Actualizare disponibilă",
14
- UpdateDescriptionLine1 : "Aplicația primește modificări constant pentru îmbunătățirea funcțiilor",
15
- UpdateDescriptionLine2 : "Pentru a continua",
16
- UpdateDescriptionLine3 : "trebuie să apeși butonul albastru de mai jos",
17
- UpdateButton : "Actualizează aplicația",
18
-
19
- IfThisIsErrorPersist : "Dacă eroarea persistă, vă ",
20
- ThisPage : "dați click aici pentru actualizare",
21
- PleaseWait : "Vă rugăm asteptați...",
22
- TryAgain : "Încearcă din nou",
23
- ThereWasAProblem : "A apărut o problemă. Încercați din nou",
24
- NoErrorPassed : "Niciun ErrorBoundary transmis la x25",
25
- ItLoadsSlower : "Se pare că se încarcă mai lent ca de obicei. Vă rugăm să așteptați...",
26
- TryingToRecover : "Încerc să-mi revin...",
27
- SomethingIsNotImmutable : "Ceva nu este imuabil. verificați consola",
28
- // header
29
- ConnectionLost : "Am pierdut conexiunea la server. Încercați din nou.",
30
- Options : "Opțiuni",
31
- TermsAndConditions : "Termeni si conditii",
32
- PrivacyPolicy : "Politica de Confidențialitate",
33
- SelectCompany : "Selectați compania",
34
- Toggle : "Comută",
35
- Settings : "Setări",
36
- RenewSubscription : "Reînnoiește abonamentul",
37
- TheSubscriptionWillExpireIn : "Abonamentul va expira în",
38
- SignOut : "Deconectează-mă",
39
- NoOptions : "Fără opțiuni",
40
- // inputs
41
- BankAccount : "Cont bancar",
42
- BankName : "Numele băncii",
43
- FiscalID : "ID fiscal",
44
- GetDataFromInternet : "Obținerea datelor de pe internet",
45
- EnterAValidFiscalID : "Vă rugăm să introduceți un act de identitate fiscal valid",
46
- PersonalID : "ID personal",
47
- County : "județ",
48
- Select : "Selectați",
49
- CaptchaDescription : "Scopul acestei verificări este de a distinge o persoană de un robot. Acest cod apare de obicei atunci când o funcție din aplicație este suprautilizată",
50
- CaptchaTypeNumbers : "Tastați numerele din imaginea de mai jos",
51
- CaptchaVerify : "Verificare",
52
- DateFormat,
53
- ErrorNeverExisted : "Este posibil să fi fost șters sau să nu fi existat niciodată",
54
- ErrorConnection : "Există o problemă cu conexiunea sau folosești o versiune veche a aplicației",
55
- Sentry : {
56
- TellUs: {
57
- title : "Se pare că avem o problemă",
58
- subtitle : "Echipa noastră a fost anunțată",
59
- subtitle2 : "Dacă vrei să ne ajuți, spune-ne mai jos ce s-a întâmplat. Ne va ajuta foarte mult",
60
- labelName : "Numele dumneavoastră",
61
- labelEmail : "E-mail",
62
- labelComments : "Ce s-a întâmplat?",
63
- labelClose : "Închide",
64
- labelSubmit : "Trimite",
65
- errorGeneric : "A apărut o eroare necunoscută la trimiterea raportului Vă rugăm să încercați din nou",
66
- errorFormEntry : "Unele câmpuri au fost nevalide. Vă rugăm să corectați erorile și să încercați din nou.",
67
- successMessage : "Feedback-ul dvs. a fost trimis. Mulțumesc!",
68
- },
69
- Message : "Acest mesaj apare atunci când programul a eșuat și nu a reușit să se recupereze. Administratorul a fost anunțat automat despre această problemă. Tot ce trebuie să facem este să ne cerem scuze.",
70
- Button : "Spune-ne",
71
- Hint : "Sfat: Încercați să reîmprospătați pagina - apăsați tasta",
72
- },
73
- Confirmation : "Cofirmare",
74
- // validation
75
- PleaseSelect : "Selectează o opțiune din listă",
76
- EnterValidPersonalID : "Introduceți un ID personal valid",
77
- EnterValidFiscalID : "Introduceți un ID fiscal valid",
78
- EnterValidBankAccount : "Introduceți un cont bancar valid",
79
- EnterValidEmail : "Introduceți un e-mail valid",
80
- EnterValidDate : `Introduceți o dată validă (${DateFormat})`,
81
- NumberBetween : "între",
82
- NumberAnd : "și",
83
- NumberUpTo : "pâna la",
84
- NumberGreaterThan : "mai mult decat",
85
- NumberMustBe : "Trebuie sa fie un numar",
86
- NumberInteger : "întreg",
87
- NumberFloat : "număr cu virgulă",
88
- Chars : "caractere",
89
- Has : "are",
90
- TheField : "Campul",
91
- Has6Digits : "Codul are 6 cifre",
92
- CodeNotValid : "Codul nu este valid",
93
- AddARow : "Adăugați cel puțin un rând",
94
- message : {
95
- failPerform : "Nu am putut îndeplini sarcina",
96
- confirmDelete : "Am șters cu succes",
97
- confirmAdd : "Adăugat cu succes",
98
- confirmUpdate : "Date actualizate",
99
- },
100
- label: {
101
- modify : "Modifica",
102
- add : "Adăuga",
103
- remove : "Șterge",
104
- confirmation : "A confirma",
105
- cancel : "Anulare",
106
- },
107
- Month: {
108
- 0 : "Ianuarie",
109
- 1 : "Februarie",
110
- 2 : "Martie",
111
- 3 : "Aprilie",
112
- 4 : "Mai",
113
- 5 : "Iunie",
114
- 6 : "Iulie",
115
- 7 : "August",
116
- 8 : "Septembrie",
117
- 9 : "Octombrie",
118
- 10 : "Noiembrie",
119
- 11 : "Decembrie",
120
- },
121
- MustAgree : "Trebuie să fiți de acord pentru a continua",
122
- getNumberTense : (value: number) => String(value),
123
- };
@@ -1,43 +0,0 @@
1
-
2
- import * as Immutable from "immutable";
3
- import { describe, expect, test } from "vitest";
4
- import { normalize } from "../";
5
-
6
- describe("test util/normalize", () => {
7
- const input = [
8
- {
9
- ID : 1,
10
- Name : "BlaBla 1",
11
- }, {
12
- ID : 2,
13
- Name : "BlaBla 2",
14
- }, {
15
- ID : 3,
16
- Name : "BlaBla 3",
17
- },
18
- ];
19
-
20
- describe("given an array", () => {
21
- const result = normalize.normalizeArray(input);
22
-
23
- test("normalizes the entities", () => {
24
- expect(result.entities).toEqual(Immutable.Map({
25
- "1": Immutable.Map({
26
- ID : 1,
27
- Name : "BlaBla 1",
28
- }),
29
- "2": Immutable.Map({
30
- ID : 2,
31
- Name : "BlaBla 2",
32
- }),
33
- "3": Immutable.Map({
34
- ID : 3,
35
- Name : "BlaBla 3",
36
- }),
37
- }));
38
- });
39
- test("normalizes the result", () => {
40
- expect(result.result).toEqual(Immutable.List(["1", "2", "3"]));
41
- });
42
- });
43
- });
@@ -1,75 +0,0 @@
1
- /* eslint-disable max-len, no-duplicate-imports */
2
- import * as Immutable from "immutable";
3
- import { words } from "./words";
4
- import type { NormalizedResult } from "src/types";
5
-
6
- type Normalizr = (item: any) => any;
7
- type NormalizeBoolean = (input: "" | boolean) => boolean;
8
- type NormalizeArray = (raw: Array<any>) => NormalizedResult;
9
- type Normalize = (raw: Array<any>, field: string, normalizr: Normalizr) => NormalizedResult;
10
- type Resolve = (data: any) => void;
11
- type Reject = (arg: any) => void;
12
- type Response = {
13
- body: any;
14
- };
15
- type Error = {
16
- status: any;
17
- };
18
- type DefaultNormalize = (raw: Array<any>, field: string) => NormalizedResult;
19
-
20
- const
21
- defaultNormalizr: Normalizr = (item) => Immutable.fromJS(item),
22
-
23
- defaultValue = () => ({
24
- entities : Immutable.Map(),
25
- result : Immutable.List(),
26
- }),
27
-
28
- customNormalizeArrayByField: Normalize = (raw: Array<any>, field: string, normalizr: Normalizr) => raw === null ? defaultValue() : raw.reduce((previous, current) => {
29
- const stringID = String(current[field]);
30
-
31
- previous.entities = previous.entities.set(stringID, normalizr(current));
32
- previous.result = previous.result.push(stringID);
33
- return previous;
34
- }, defaultValue()),
35
-
36
- withPromiseCallback = (resolve: Resolve, reject: Reject) => (error: Error, response: Response) => {
37
- if (error) {
38
- const StatusUnauthorized = 401;
39
-
40
- if (error.status === StatusUnauthorized) {
41
- document.location.href = "/";
42
- } else {
43
- // error.message
44
- reject({
45
- error: words.ThereWasAProblem,
46
- });
47
- }
48
- } else {
49
- resolve(response.body);
50
- }
51
- },
52
- /*
53
- * entities ---> Object { "1": Immutable.Map(), ... ]) }
54
- * result ---> List([ "1", "2", "3" ])
55
- */
56
- normalizeArray: NormalizeArray = (raw: Array<any>, normalizr?: Normalizr) => (
57
- customNormalizeArrayByField(raw, "ID", typeof normalizr === "undefined" ? defaultNormalizr : normalizr)
58
- ),
59
-
60
- normalizeBoolean: NormalizeBoolean = (value: boolean | "") => value || false,
61
-
62
- normalizeArrayByField: DefaultNormalize = (raw: Array<any>, field: string) => customNormalizeArrayByField(raw, field, defaultNormalizr),
63
-
64
-
65
- normalizeSelectNumeric = (raw: string) => typeof raw === "string" && raw !== "" ? parseInt(raw, 10) : raw,
66
-
67
- normalize = {
68
- normalizeArrayByField,
69
- normalizeSelectNumeric,
70
- withPromiseCallback,
71
- normalizeArray,
72
- normalizeBoolean,
73
- };
74
-
75
- export default normalize;
@@ -1,62 +0,0 @@
1
- /* eslint-disable no-magic-numbers */
2
-
3
- const numberFormat: any = new Intl.NumberFormat("ro", {
4
- minimumFractionDigits: 2,
5
- }),
6
- plainNumberFormat: any = new Intl.NumberFormat("ro"),
7
-
8
- replaceCharInString = ({
9
- word,
10
- oldChar,
11
- newChar,
12
- }: {
13
- word: string;
14
- oldChar: string;
15
- newChar: string;
16
- }): string => {
17
- const regex = new RegExp(oldChar, "gu");
18
-
19
- return word.replace(regex, newChar);
20
- };
21
-
22
- // 127.99 ----> 127,99
23
- // 0 ----> ""
24
- export const
25
- formatZeroValue = (word: any, optional?: boolean): string => (
26
- optional && word === "" ? "" : replaceCharInString({
27
- word : String(word),
28
- oldChar : "\\.",
29
- newChar : ",",
30
- })
31
- ),
32
- formatNumber = (word: any): string => replaceCharInString({
33
- word : String(word),
34
- oldChar : "\\.",
35
- newChar : ",",
36
- }),
37
- normalizeNumber = (word: any): string => replaceCharInString({
38
- word : String(word),
39
- oldChar : ",",
40
- newChar : ".",
41
- }),
42
- numberToLocale = (value: number): string => numberFormat.format(value),
43
- plainNumberToLocale = (value: number): string => plainNumberFormat.format(value),
44
- numericBehavior = {
45
- normalize : normalizeNumber,
46
- format : formatNumber,
47
- },
48
- tryToParseNumber = (raw: string) => {
49
- const result = Number(raw);
50
-
51
- if (!isNaN(result) && raw !== "") {
52
- return result;
53
- }
54
-
55
- return raw;
56
- },
57
- numberToLocaleHideBlank = (raw: any) => (
58
- typeof raw === "number" && raw !== 0 ? numberToLocale(raw) : ""
59
- ),
60
- plainNumberToLocaleHideZero = (raw: any) => (
61
- typeof raw === "number" && raw !== 0 ? plainNumberToLocale(raw) : ""
62
- );