@temboplus/frontend-core 0.4.0 → 0.4.1

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 (426) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +100 -38
  3. package/esm/_dnt.test_shims.d.ts.map +1 -0
  4. package/esm/deps/deno.land/std@0.217.0/assert/_constants.d.ts.map +1 -0
  5. package/esm/deps/deno.land/std@0.217.0/assert/_diff.d.ts.map +1 -0
  6. package/esm/deps/deno.land/std@0.217.0/assert/_format.d.ts.map +1 -0
  7. package/esm/deps/deno.land/std@0.217.0/assert/assert.d.ts.map +1 -0
  8. package/esm/deps/deno.land/std@0.217.0/assert/assert_almost_equals.d.ts.map +1 -0
  9. package/esm/deps/deno.land/std@0.217.0/assert/assert_array_includes.d.ts.map +1 -0
  10. package/esm/deps/deno.land/std@0.217.0/assert/assert_equals.d.ts.map +1 -0
  11. package/esm/deps/deno.land/std@0.217.0/assert/assert_exists.d.ts.map +1 -0
  12. package/esm/deps/deno.land/std@0.217.0/assert/assert_false.d.ts.map +1 -0
  13. package/esm/deps/deno.land/std@0.217.0/assert/assert_greater.d.ts.map +1 -0
  14. package/esm/deps/deno.land/std@0.217.0/assert/assert_greater_or_equal.d.ts.map +1 -0
  15. package/esm/deps/deno.land/std@0.217.0/assert/assert_instance_of.d.ts.map +1 -0
  16. package/esm/deps/deno.land/std@0.217.0/assert/assert_is_error.d.ts.map +1 -0
  17. package/esm/deps/deno.land/std@0.217.0/assert/assert_less.d.ts.map +1 -0
  18. package/esm/deps/deno.land/std@0.217.0/assert/assert_less_or_equal.d.ts.map +1 -0
  19. package/esm/deps/deno.land/std@0.217.0/assert/assert_match.d.ts.map +1 -0
  20. package/esm/deps/deno.land/std@0.217.0/assert/assert_not_equals.d.ts.map +1 -0
  21. package/esm/deps/deno.land/std@0.217.0/assert/assert_not_instance_of.d.ts.map +1 -0
  22. package/esm/deps/deno.land/std@0.217.0/assert/assert_not_match.d.ts.map +1 -0
  23. package/esm/deps/deno.land/std@0.217.0/assert/assert_not_strict_equals.d.ts.map +1 -0
  24. package/esm/deps/deno.land/std@0.217.0/assert/assert_object_match.d.ts.map +1 -0
  25. package/esm/deps/deno.land/std@0.217.0/assert/assert_rejects.d.ts.map +1 -0
  26. package/esm/deps/deno.land/std@0.217.0/assert/assert_strict_equals.d.ts.map +1 -0
  27. package/esm/deps/deno.land/std@0.217.0/assert/assert_string_includes.d.ts.map +1 -0
  28. package/esm/deps/deno.land/std@0.217.0/assert/assert_throws.d.ts.map +1 -0
  29. package/esm/deps/deno.land/std@0.217.0/assert/assertion_error.d.ts.map +1 -0
  30. package/esm/deps/deno.land/std@0.217.0/assert/equal.d.ts.map +1 -0
  31. package/esm/deps/deno.land/std@0.217.0/assert/fail.d.ts.map +1 -0
  32. package/esm/deps/deno.land/std@0.217.0/assert/mod.d.ts.map +1 -0
  33. package/esm/deps/deno.land/std@0.217.0/assert/unimplemented.d.ts.map +1 -0
  34. package/esm/deps/deno.land/std@0.217.0/assert/unreachable.d.ts.map +1 -0
  35. package/esm/deps/deno.land/std@0.217.0/fmt/colors.d.ts.map +1 -0
  36. package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.d.ts.map +1 -0
  37. package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.d.ts.map +1 -0
  38. package/esm/deps/jsr.io/@std/assert/1.0.10/assert.d.ts.map +1 -0
  39. package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.d.ts.map +1 -0
  40. package/esm/deps/jsr.io/@std/assert/1.0.10/equal.d.ts.map +1 -0
  41. package/esm/deps/jsr.io/@std/assert/1.0.10/equals.d.ts.map +1 -0
  42. package/esm/deps/jsr.io/@std/assert/1.0.10/exists.d.ts.map +1 -0
  43. package/esm/deps/jsr.io/@std/assert/1.0.10/fail.d.ts.map +1 -0
  44. package/esm/deps/jsr.io/@std/assert/1.0.10/false.d.ts.map +1 -0
  45. package/esm/deps/jsr.io/@std/assert/1.0.10/greater.d.ts.map +1 -0
  46. package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.d.ts.map +1 -0
  47. package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.d.ts.map +1 -0
  48. package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.d.ts.map +1 -0
  49. package/esm/deps/jsr.io/@std/assert/1.0.10/less.d.ts.map +1 -0
  50. package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.d.ts.map +1 -0
  51. package/esm/deps/jsr.io/@std/assert/1.0.10/match.d.ts.map +1 -0
  52. package/esm/deps/jsr.io/@std/assert/1.0.10/mod.d.ts.map +1 -0
  53. package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.d.ts.map +1 -0
  54. package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.d.ts.map +1 -0
  55. package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.d.ts.map +1 -0
  56. package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.d.ts.map +1 -0
  57. package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.d.ts.map +1 -0
  58. package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.d.ts.map +1 -0
  59. package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.d.ts.map +1 -0
  60. package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.d.ts.map +1 -0
  61. package/esm/deps/jsr.io/@std/assert/1.0.10/throws.d.ts.map +1 -0
  62. package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.d.ts.map +1 -0
  63. package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.d.ts.map +1 -0
  64. package/esm/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts.map +1 -0
  65. package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +1 -0
  66. package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +1 -0
  67. package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +1 -0
  68. package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +1 -0
  69. package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +1 -0
  70. package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +1 -0
  71. package/esm/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts.map +1 -0
  72. package/esm/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts.map +1 -0
  73. package/esm/mod.d.ts +5 -0
  74. package/esm/mod.d.ts.map +1 -0
  75. package/esm/mod.js +4 -0
  76. package/esm/package.json +3 -0
  77. package/esm/src/config/config_service.d.ts +11 -0
  78. package/esm/src/config/config_service.d.ts.map +1 -0
  79. package/esm/src/config/config_service.js +19 -0
  80. package/esm/src/config/index.d.ts +2 -0
  81. package/esm/src/config/index.d.ts.map +1 -0
  82. package/esm/src/config/index.js +1 -0
  83. package/esm/src/data/banks_tz.d.ts +7 -0
  84. package/esm/src/data/banks_tz.d.ts.map +1 -0
  85. package/esm/src/data/banks_tz.js +197 -0
  86. package/esm/src/data/countries.d.ts +39 -0
  87. package/esm/src/data/countries.d.ts.map +1 -0
  88. package/esm/src/data/countries.js +2475 -0
  89. package/esm/src/data/currencies.d.ts +1901 -0
  90. package/esm/src/data/currencies.d.ts.map +1 -0
  91. package/esm/src/data/currencies.js +1073 -0
  92. package/esm/src/data/phone_patterns.d.ts +3809 -0
  93. package/esm/src/data/phone_patterns.d.ts.map +1 -0
  94. package/esm/src/data/phone_patterns.js +2325 -0
  95. package/esm/src/models/amount/amount.d.ts +53 -0
  96. package/esm/src/models/amount/amount.d.ts.map +1 -0
  97. package/esm/src/models/amount/amount.js +190 -0
  98. package/esm/src/models/amount/amount.test.d.ts.map +1 -0
  99. package/esm/src/models/amount/antd_validator.d.ts +40 -0
  100. package/esm/src/models/amount/antd_validator.d.ts.map +1 -0
  101. package/esm/src/models/amount/antd_validator.js +58 -0
  102. package/esm/src/models/amount/antd_validator.test.d.ts.map +1 -0
  103. package/esm/src/models/amount/index.d.ts +3 -0
  104. package/esm/src/models/amount/index.d.ts.map +1 -0
  105. package/esm/src/models/amount/index.js +2 -0
  106. package/esm/src/models/bank/antd_validator.d.ts +11 -0
  107. package/esm/src/models/bank/antd_validator.d.ts.map +1 -0
  108. package/esm/src/models/bank/antd_validator.js +26 -0
  109. package/esm/src/models/bank/antd_validator.test.d.ts.map +1 -0
  110. package/esm/src/models/bank/bank.d.ts +257 -0
  111. package/esm/src/models/bank/bank.d.ts.map +1 -0
  112. package/esm/src/models/bank/bank.js +450 -0
  113. package/esm/src/models/bank/bank.test.d.ts.map +1 -0
  114. package/esm/src/models/bank/index.d.ts +5 -0
  115. package/esm/src/models/bank/index.d.ts.map +1 -0
  116. package/esm/src/models/bank/index.js +4 -0
  117. package/esm/src/models/bank/types.d.ts +7 -0
  118. package/esm/src/models/bank/types.d.ts.map +1 -0
  119. package/esm/src/models/bank/types.js +45 -0
  120. package/esm/src/models/bank/utils.d.ts +8 -0
  121. package/esm/src/models/bank/utils.d.ts.map +1 -0
  122. package/esm/src/models/bank/utils.js +9 -0
  123. package/esm/src/models/country/country.d.ts +822 -0
  124. package/esm/src/models/country/country.d.ts.map +1 -0
  125. package/esm/src/models/country/country.js +737 -0
  126. package/esm/src/models/country/country.test.d.ts.map +1 -0
  127. package/esm/src/models/country/index.d.ts +4 -0
  128. package/esm/src/models/country/index.d.ts.map +1 -0
  129. package/esm/src/models/country/index.js +3 -0
  130. package/{dist/models/country/country.types.d.ts → esm/src/models/country/types.d.ts} +1 -0
  131. package/esm/src/models/country/types.d.ts.map +1 -0
  132. package/esm/src/models/country/types.js +105 -0
  133. package/{dist/models/country/country.validation.d.ts → esm/src/models/country/utils.d.ts} +6 -10
  134. package/esm/src/models/country/utils.d.ts.map +1 -0
  135. package/esm/src/models/country/utils.js +25 -0
  136. package/esm/src/models/currency/currency.d.ts +465 -0
  137. package/esm/src/models/currency/currency.d.ts.map +1 -0
  138. package/esm/src/models/currency/currency.js +471 -0
  139. package/esm/src/models/currency/currency.test.d.ts.map +1 -0
  140. package/esm/src/models/currency/index.d.ts +4 -0
  141. package/esm/src/models/currency/index.d.ts.map +1 -0
  142. package/esm/src/models/currency/index.js +3 -0
  143. package/{dist/models/currency/currency.types.d.ts → esm/src/models/currency/types.d.ts} +2 -1
  144. package/esm/src/models/currency/types.d.ts.map +1 -0
  145. package/esm/src/models/currency/types.js +28 -0
  146. package/esm/src/models/currency/utils.d.ts +8 -0
  147. package/esm/src/models/currency/utils.d.ts.map +1 -0
  148. package/esm/src/models/currency/utils.js +9 -0
  149. package/esm/src/models/index.d.ts +6 -0
  150. package/esm/src/models/index.d.ts.map +1 -0
  151. package/{dist/models/index.d.ts → esm/src/models/index.js} +1 -1
  152. package/esm/src/models/phone_number/format.d.ts +13 -0
  153. package/esm/src/models/phone_number/format.d.ts.map +1 -0
  154. package/esm/src/models/phone_number/format.js +13 -0
  155. package/esm/src/models/phone_number/global/phone_number.d.ts +162 -0
  156. package/esm/src/models/phone_number/global/phone_number.d.ts.map +1 -0
  157. package/esm/src/models/phone_number/global/phone_number.js +459 -0
  158. package/esm/src/models/phone_number/global/phone_number.test.d.ts.map +1 -0
  159. package/esm/src/models/phone_number/global/service.d.ts +267 -0
  160. package/esm/src/models/phone_number/global/service.d.ts.map +1 -0
  161. package/esm/src/models/phone_number/global/service.js +498 -0
  162. package/esm/src/models/phone_number/global/service.test.d.ts.map +1 -0
  163. package/esm/src/models/phone_number/index.d.ts +6 -0
  164. package/esm/src/models/phone_number/index.d.ts.map +1 -0
  165. package/esm/src/models/phone_number/index.js +5 -0
  166. package/esm/src/models/phone_number/tz/antd_validator.d.ts +77 -0
  167. package/esm/src/models/phone_number/tz/antd_validator.d.ts.map +1 -0
  168. package/esm/src/models/phone_number/tz/antd_validator.js +90 -0
  169. package/esm/src/models/phone_number/tz/antdvalidator.test.d.ts.map +1 -0
  170. package/esm/src/models/phone_number/tz/network_operator.d.ts +30 -0
  171. package/esm/src/models/phone_number/tz/network_operator.d.ts.map +1 -0
  172. package/esm/src/models/phone_number/tz/network_operator.js +47 -0
  173. package/esm/src/models/phone_number/tz/phone_number.d.ts +141 -0
  174. package/esm/src/models/phone_number/tz/phone_number.d.ts.map +1 -0
  175. package/esm/src/models/phone_number/tz/phone_number.js +290 -0
  176. package/esm/src/models/phone_number/tz/phone_number.test.d.ts.map +1 -0
  177. package/esm/src/reports/index.d.ts +2 -0
  178. package/esm/src/reports/index.d.ts.map +1 -0
  179. package/esm/src/reports/index.js +1 -0
  180. package/esm/src/reports/report_manager.d.ts +146 -0
  181. package/esm/src/reports/report_manager.d.ts.map +1 -0
  182. package/esm/src/reports/report_manager.js +320 -0
  183. package/{dist → esm/src}/utils/id.d.ts +3 -7
  184. package/esm/src/utils/id.d.ts.map +1 -0
  185. package/esm/src/utils/id.js +19 -0
  186. package/esm/src/utils/index.d.ts +4 -0
  187. package/esm/src/utils/index.d.ts.map +1 -0
  188. package/esm/src/utils/text.d.ts +32 -0
  189. package/esm/src/utils/text.d.ts.map +1 -0
  190. package/esm/src/utils/text.js +68 -0
  191. package/esm/src/utils/text.test.d.ts.map +1 -0
  192. package/{dist → esm/src}/utils/time.d.ts +4 -9
  193. package/esm/src/utils/time.d.ts.map +1 -0
  194. package/esm/src/utils/time.js +34 -0
  195. package/package.json +23 -46
  196. package/script/_dnt.test_shims.d.ts.map +1 -0
  197. package/script/deps/deno.land/std@0.217.0/assert/_constants.d.ts.map +1 -0
  198. package/script/deps/deno.land/std@0.217.0/assert/_diff.d.ts.map +1 -0
  199. package/script/deps/deno.land/std@0.217.0/assert/_format.d.ts.map +1 -0
  200. package/script/deps/deno.land/std@0.217.0/assert/assert.d.ts.map +1 -0
  201. package/script/deps/deno.land/std@0.217.0/assert/assert_almost_equals.d.ts.map +1 -0
  202. package/script/deps/deno.land/std@0.217.0/assert/assert_array_includes.d.ts.map +1 -0
  203. package/script/deps/deno.land/std@0.217.0/assert/assert_equals.d.ts.map +1 -0
  204. package/script/deps/deno.land/std@0.217.0/assert/assert_exists.d.ts.map +1 -0
  205. package/script/deps/deno.land/std@0.217.0/assert/assert_false.d.ts.map +1 -0
  206. package/script/deps/deno.land/std@0.217.0/assert/assert_greater.d.ts.map +1 -0
  207. package/script/deps/deno.land/std@0.217.0/assert/assert_greater_or_equal.d.ts.map +1 -0
  208. package/script/deps/deno.land/std@0.217.0/assert/assert_instance_of.d.ts.map +1 -0
  209. package/script/deps/deno.land/std@0.217.0/assert/assert_is_error.d.ts.map +1 -0
  210. package/script/deps/deno.land/std@0.217.0/assert/assert_less.d.ts.map +1 -0
  211. package/script/deps/deno.land/std@0.217.0/assert/assert_less_or_equal.d.ts.map +1 -0
  212. package/script/deps/deno.land/std@0.217.0/assert/assert_match.d.ts.map +1 -0
  213. package/script/deps/deno.land/std@0.217.0/assert/assert_not_equals.d.ts.map +1 -0
  214. package/script/deps/deno.land/std@0.217.0/assert/assert_not_instance_of.d.ts.map +1 -0
  215. package/script/deps/deno.land/std@0.217.0/assert/assert_not_match.d.ts.map +1 -0
  216. package/script/deps/deno.land/std@0.217.0/assert/assert_not_strict_equals.d.ts.map +1 -0
  217. package/script/deps/deno.land/std@0.217.0/assert/assert_object_match.d.ts.map +1 -0
  218. package/script/deps/deno.land/std@0.217.0/assert/assert_rejects.d.ts.map +1 -0
  219. package/script/deps/deno.land/std@0.217.0/assert/assert_strict_equals.d.ts.map +1 -0
  220. package/script/deps/deno.land/std@0.217.0/assert/assert_string_includes.d.ts.map +1 -0
  221. package/script/deps/deno.land/std@0.217.0/assert/assert_throws.d.ts.map +1 -0
  222. package/script/deps/deno.land/std@0.217.0/assert/assertion_error.d.ts.map +1 -0
  223. package/script/deps/deno.land/std@0.217.0/assert/equal.d.ts.map +1 -0
  224. package/script/deps/deno.land/std@0.217.0/assert/fail.d.ts.map +1 -0
  225. package/script/deps/deno.land/std@0.217.0/assert/mod.d.ts.map +1 -0
  226. package/script/deps/deno.land/std@0.217.0/assert/unimplemented.d.ts.map +1 -0
  227. package/script/deps/deno.land/std@0.217.0/assert/unreachable.d.ts.map +1 -0
  228. package/script/deps/deno.land/std@0.217.0/fmt/colors.d.ts.map +1 -0
  229. package/script/deps/jsr.io/@std/assert/1.0.10/almost_equals.d.ts.map +1 -0
  230. package/script/deps/jsr.io/@std/assert/1.0.10/array_includes.d.ts.map +1 -0
  231. package/script/deps/jsr.io/@std/assert/1.0.10/assert.d.ts.map +1 -0
  232. package/script/deps/jsr.io/@std/assert/1.0.10/assertion_error.d.ts.map +1 -0
  233. package/script/deps/jsr.io/@std/assert/1.0.10/equal.d.ts.map +1 -0
  234. package/script/deps/jsr.io/@std/assert/1.0.10/equals.d.ts.map +1 -0
  235. package/script/deps/jsr.io/@std/assert/1.0.10/exists.d.ts.map +1 -0
  236. package/script/deps/jsr.io/@std/assert/1.0.10/fail.d.ts.map +1 -0
  237. package/script/deps/jsr.io/@std/assert/1.0.10/false.d.ts.map +1 -0
  238. package/script/deps/jsr.io/@std/assert/1.0.10/greater.d.ts.map +1 -0
  239. package/script/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.d.ts.map +1 -0
  240. package/script/deps/jsr.io/@std/assert/1.0.10/instance_of.d.ts.map +1 -0
  241. package/script/deps/jsr.io/@std/assert/1.0.10/is_error.d.ts.map +1 -0
  242. package/script/deps/jsr.io/@std/assert/1.0.10/less.d.ts.map +1 -0
  243. package/script/deps/jsr.io/@std/assert/1.0.10/less_or_equal.d.ts.map +1 -0
  244. package/script/deps/jsr.io/@std/assert/1.0.10/match.d.ts.map +1 -0
  245. package/script/deps/jsr.io/@std/assert/1.0.10/mod.d.ts.map +1 -0
  246. package/script/deps/jsr.io/@std/assert/1.0.10/not_equals.d.ts.map +1 -0
  247. package/script/deps/jsr.io/@std/assert/1.0.10/not_instance_of.d.ts.map +1 -0
  248. package/script/deps/jsr.io/@std/assert/1.0.10/not_match.d.ts.map +1 -0
  249. package/script/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.d.ts.map +1 -0
  250. package/script/deps/jsr.io/@std/assert/1.0.10/object_match.d.ts.map +1 -0
  251. package/script/deps/jsr.io/@std/assert/1.0.10/rejects.d.ts.map +1 -0
  252. package/script/deps/jsr.io/@std/assert/1.0.10/strict_equals.d.ts.map +1 -0
  253. package/script/deps/jsr.io/@std/assert/1.0.10/string_includes.d.ts.map +1 -0
  254. package/script/deps/jsr.io/@std/assert/1.0.10/throws.d.ts.map +1 -0
  255. package/script/deps/jsr.io/@std/assert/1.0.10/unimplemented.d.ts.map +1 -0
  256. package/script/deps/jsr.io/@std/assert/1.0.10/unreachable.d.ts.map +1 -0
  257. package/script/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts.map +1 -0
  258. package/script/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +1 -0
  259. package/script/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +1 -0
  260. package/script/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +1 -0
  261. package/script/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +1 -0
  262. package/script/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +1 -0
  263. package/script/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +1 -0
  264. package/script/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts.map +1 -0
  265. package/script/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts.map +1 -0
  266. package/script/mod.d.ts +5 -0
  267. package/script/mod.d.ts.map +1 -0
  268. package/script/mod.js +20 -0
  269. package/script/package.json +3 -0
  270. package/script/src/config/config_service.d.ts +11 -0
  271. package/script/src/config/config_service.d.ts.map +1 -0
  272. package/script/src/config/config_service.js +23 -0
  273. package/script/src/config/index.d.ts +2 -0
  274. package/script/src/config/index.d.ts.map +1 -0
  275. package/script/src/config/index.js +17 -0
  276. package/script/src/data/banks_tz.d.ts +7 -0
  277. package/script/src/data/banks_tz.d.ts.map +1 -0
  278. package/script/src/data/banks_tz.js +199 -0
  279. package/script/src/data/countries.d.ts +39 -0
  280. package/script/src/data/countries.d.ts.map +1 -0
  281. package/script/src/data/countries.js +2477 -0
  282. package/script/src/data/currencies.d.ts +1901 -0
  283. package/script/src/data/currencies.d.ts.map +1 -0
  284. package/script/src/data/currencies.js +1075 -0
  285. package/script/src/data/phone_patterns.d.ts +3809 -0
  286. package/script/src/data/phone_patterns.d.ts.map +1 -0
  287. package/script/src/data/phone_patterns.js +2327 -0
  288. package/script/src/models/amount/amount.d.ts +53 -0
  289. package/script/src/models/amount/amount.d.ts.map +1 -0
  290. package/script/src/models/amount/amount.js +194 -0
  291. package/script/src/models/amount/amount.test.d.ts.map +1 -0
  292. package/script/src/models/amount/antd_validator.d.ts +40 -0
  293. package/script/src/models/amount/antd_validator.d.ts.map +1 -0
  294. package/script/src/models/amount/antd_validator.js +62 -0
  295. package/script/src/models/amount/antd_validator.test.d.ts.map +1 -0
  296. package/script/src/models/amount/index.d.ts +3 -0
  297. package/script/src/models/amount/index.d.ts.map +1 -0
  298. package/script/src/models/amount/index.js +18 -0
  299. package/script/src/models/bank/antd_validator.d.ts +11 -0
  300. package/script/src/models/bank/antd_validator.d.ts.map +1 -0
  301. package/script/src/models/bank/antd_validator.js +30 -0
  302. package/script/src/models/bank/antd_validator.test.d.ts.map +1 -0
  303. package/script/src/models/bank/bank.d.ts +257 -0
  304. package/script/src/models/bank/bank.d.ts.map +1 -0
  305. package/script/src/models/bank/bank.js +458 -0
  306. package/script/src/models/bank/bank.test.d.ts.map +1 -0
  307. package/script/src/models/bank/index.d.ts +5 -0
  308. package/script/src/models/bank/index.d.ts.map +1 -0
  309. package/script/src/models/bank/index.js +20 -0
  310. package/script/src/models/bank/types.d.ts +7 -0
  311. package/script/src/models/bank/types.d.ts.map +1 -0
  312. package/script/src/models/bank/types.js +48 -0
  313. package/script/src/models/bank/utils.d.ts +8 -0
  314. package/script/src/models/bank/utils.d.ts.map +1 -0
  315. package/script/src/models/bank/utils.js +12 -0
  316. package/script/src/models/country/country.d.ts +822 -0
  317. package/script/src/models/country/country.d.ts.map +1 -0
  318. package/script/src/models/country/country.js +745 -0
  319. package/script/src/models/country/country.test.d.ts.map +1 -0
  320. package/script/src/models/country/index.d.ts +4 -0
  321. package/script/src/models/country/index.d.ts.map +1 -0
  322. package/script/src/models/country/index.js +19 -0
  323. package/script/src/models/country/types.d.ts +63 -0
  324. package/script/src/models/country/types.d.ts.map +1 -0
  325. package/script/src/models/country/types.js +108 -0
  326. package/script/src/models/country/utils.d.ts +21 -0
  327. package/script/src/models/country/utils.d.ts.map +1 -0
  328. package/script/src/models/country/utils.js +30 -0
  329. package/script/src/models/currency/currency.d.ts +465 -0
  330. package/script/src/models/currency/currency.d.ts.map +1 -0
  331. package/script/src/models/currency/currency.js +479 -0
  332. package/script/src/models/currency/currency.test.d.ts.map +1 -0
  333. package/script/src/models/currency/index.d.ts +4 -0
  334. package/script/src/models/currency/index.d.ts.map +1 -0
  335. package/script/src/models/currency/index.js +19 -0
  336. package/script/src/models/currency/types.d.ts +21 -0
  337. package/script/src/models/currency/types.d.ts.map +1 -0
  338. package/script/src/models/currency/types.js +31 -0
  339. package/script/src/models/currency/utils.d.ts +8 -0
  340. package/script/src/models/currency/utils.d.ts.map +1 -0
  341. package/script/src/models/currency/utils.js +12 -0
  342. package/script/src/models/index.d.ts +6 -0
  343. package/script/src/models/index.d.ts.map +1 -0
  344. package/script/src/models/index.js +21 -0
  345. package/script/src/models/phone_number/format.d.ts +13 -0
  346. package/script/src/models/phone_number/format.d.ts.map +1 -0
  347. package/script/src/models/phone_number/format.js +16 -0
  348. package/script/src/models/phone_number/global/phone_number.d.ts +162 -0
  349. package/script/src/models/phone_number/global/phone_number.d.ts.map +1 -0
  350. package/script/src/models/phone_number/global/phone_number.js +463 -0
  351. package/script/src/models/phone_number/global/phone_number.test.d.ts.map +1 -0
  352. package/script/src/models/phone_number/global/service.d.ts +267 -0
  353. package/script/src/models/phone_number/global/service.d.ts.map +1 -0
  354. package/script/src/models/phone_number/global/service.js +506 -0
  355. package/script/src/models/phone_number/global/service.test.d.ts.map +1 -0
  356. package/script/src/models/phone_number/index.d.ts +6 -0
  357. package/script/src/models/phone_number/index.d.ts.map +1 -0
  358. package/script/src/models/phone_number/index.js +21 -0
  359. package/script/src/models/phone_number/tz/antd_validator.d.ts +77 -0
  360. package/script/src/models/phone_number/tz/antd_validator.d.ts.map +1 -0
  361. package/script/src/models/phone_number/tz/antd_validator.js +94 -0
  362. package/script/src/models/phone_number/tz/antdvalidator.test.d.ts.map +1 -0
  363. package/script/src/models/phone_number/tz/network_operator.d.ts +30 -0
  364. package/script/src/models/phone_number/tz/network_operator.d.ts.map +1 -0
  365. package/script/src/models/phone_number/tz/network_operator.js +50 -0
  366. package/script/src/models/phone_number/tz/phone_number.d.ts +141 -0
  367. package/script/src/models/phone_number/tz/phone_number.d.ts.map +1 -0
  368. package/script/src/models/phone_number/tz/phone_number.js +294 -0
  369. package/script/src/models/phone_number/tz/phone_number.test.d.ts.map +1 -0
  370. package/script/src/reports/index.d.ts +2 -0
  371. package/script/src/reports/index.d.ts.map +1 -0
  372. package/script/src/reports/index.js +17 -0
  373. package/script/src/reports/report_manager.d.ts +146 -0
  374. package/script/src/reports/report_manager.d.ts.map +1 -0
  375. package/script/src/reports/report_manager.js +330 -0
  376. package/script/src/utils/id.d.ts +12 -0
  377. package/script/src/utils/id.d.ts.map +1 -0
  378. package/script/src/utils/id.js +23 -0
  379. package/script/src/utils/index.d.ts +4 -0
  380. package/script/src/utils/index.d.ts.map +1 -0
  381. package/script/src/utils/index.js +19 -0
  382. package/script/src/utils/text.d.ts +32 -0
  383. package/script/src/utils/text.d.ts.map +1 -0
  384. package/script/src/utils/text.js +75 -0
  385. package/script/src/utils/text.test.d.ts.map +1 -0
  386. package/script/src/utils/time.d.ts +21 -0
  387. package/script/src/utils/time.d.ts.map +1 -0
  388. package/script/src/utils/time.js +39 -0
  389. package/dist/constants/index.d.ts +0 -1
  390. package/dist/constants/payout-countries.d.ts +0 -2
  391. package/dist/index.cjs.js +0 -8
  392. package/dist/index.cjs.js.map +0 -1
  393. package/dist/index.d.ts +0 -4
  394. package/dist/index.esm.js +0 -5
  395. package/dist/index.esm.js.map +0 -1
  396. package/dist/models/amount/amount.d.ts +0 -748
  397. package/dist/models/amount/index.d.ts +0 -1
  398. package/dist/models/bank/bank.d.ts +0 -184
  399. package/dist/models/bank/bank.schema.d.ts +0 -23
  400. package/dist/models/bank/bank.types.d.ts +0 -5
  401. package/dist/models/bank/bank.validation.d.ts +0 -80
  402. package/dist/models/bank/index.d.ts +0 -4
  403. package/dist/models/country/country.d.ts +0 -329
  404. package/dist/models/country/country.schema.d.ts +0 -73
  405. package/dist/models/country/index.d.ts +0 -4
  406. package/dist/models/currency/currency.d.ts +0 -214
  407. package/dist/models/currency/currency.schema.d.ts +0 -24
  408. package/dist/models/currency/currency.validation.d.ts +0 -11
  409. package/dist/models/currency/index.d.ts +0 -4
  410. package/dist/models/phone-number/index.d.ts +0 -6
  411. package/dist/models/phone-number/mno/index.d.ts +0 -6
  412. package/dist/models/phone-number/mno/ke/mobile-number.ke-mnos.d.ts +0 -22
  413. package/dist/models/phone-number/mno/ke/mobile-number.ke.d.ts +0 -45
  414. package/dist/models/phone-number/mno/mno.types.d.ts +0 -62
  415. package/dist/models/phone-number/mno/mno.utils.d.ts +0 -40
  416. package/dist/models/phone-number/mno/tz/mobile-number.tz-mnos.d.ts +0 -48
  417. package/dist/models/phone-number/mno/tz/mobile-number.tz.d.ts +0 -44
  418. package/dist/models/phone-number/phone-number.d.ts +0 -135
  419. package/dist/models/phone-number/phone-number.factory.d.ts +0 -52
  420. package/dist/models/phone-number/phone-number.service.d.ts +0 -36
  421. package/dist/models/phone-number/phone-number.types.d.ts +0 -115
  422. package/dist/models/phone-number/phone-number.utils.d.ts +0 -67
  423. package/dist/services/index.d.ts +0 -1
  424. package/dist/services/logger.d.ts +0 -2
  425. package/dist/utils/text.d.ts +0 -103
  426. /package/{dist/utils/index.d.ts → esm/src/utils/index.js} +0 -0
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Available file formats for reports
3
+ */
4
+ export declare enum FileFormat {
5
+ /** PDF file format */
6
+ PDF = "pdf",
7
+ /** Excel file format */
8
+ EXCEL = "excel",
9
+ /** CSV file format */
10
+ CSV = "csv"
11
+ }
12
+ /**
13
+ * Available project types
14
+ */
15
+ export declare enum ProjectType {
16
+ /** Tembo Dashboard project */
17
+ DASHBOARD = "dashboard",
18
+ /** Afloat project */
19
+ AFLOAT = "afloat",
20
+ /** VertoX project */
21
+ VERTO_X = "verto_x"
22
+ }
23
+ /**
24
+ * Available report types with improved naming
25
+ */
26
+ export declare enum ReportType {
27
+ /** Merchant payout statement (Dashboard) */
28
+ MERCHANT_DISBURSEMENT_REPORT = "merchant_disbursement_report",
29
+ /** Transaction revenue summary (Dashboard) */
30
+ TRANSACTION_REVENUE_SUMMARY = "transaction_revenue_summary",
31
+ /** Customer wallet activity (Afloat) */
32
+ CUSTOMER_WALLET_ACTIVITY = "customer_wallet_activity",
33
+ /** Customer profile information (Afloat) */
34
+ CUSTOMER_PROFILE_SNAPSHOT = "customer_profile_snapshot",
35
+ /** Gateway transaction log (VertoX) */
36
+ GATEWAY_TRANSACTION_LOG = "gateway_transaction_log"
37
+ }
38
+ /**
39
+ * Report definition interface
40
+ */
41
+ export interface ReportDefinition {
42
+ /** Unique identifier for the report */
43
+ id: string;
44
+ /** Human-readable report name for UI display */
45
+ displayName: string;
46
+ /** API endpoint path for the report */
47
+ endpoint: string;
48
+ /** Available file formats for the report */
49
+ availableFormats: FileFormat[];
50
+ /** Optional description of the report */
51
+ description?: string;
52
+ /** Project the report belongs to */
53
+ projectType: ProjectType;
54
+ /** Type of the report */
55
+ reportType: ReportType;
56
+ }
57
+ /**
58
+ * Registry of all available reports
59
+ */
60
+ export declare const REPORTS: {
61
+ merchant_disbursement_report: ReportDefinition;
62
+ transaction_revenue_summary: ReportDefinition;
63
+ customer_wallet_activity: ReportDefinition;
64
+ customer_profile_snapshot: ReportDefinition;
65
+ gateway_transaction_log: ReportDefinition;
66
+ };
67
+ /**
68
+ * Get all reports for a specific project
69
+ * @param projectType The project type to filter by
70
+ * @returns Array of report definitions for the project
71
+ */
72
+ export declare function getReportsByProject(projectType: ProjectType): ReportDefinition[];
73
+ /**
74
+ * Get a report by its type
75
+ * @param reportType The report type to retrieve
76
+ * @returns The report definition or undefined if not found
77
+ */
78
+ export declare function getReportByType(reportType: ReportType): ReportDefinition;
79
+ /**
80
+ * Validates if a report type is available for a project
81
+ * @param projectType The project type
82
+ * @param reportType The report type
83
+ * @returns True if the report is available for the project, false otherwise
84
+ */
85
+ export declare function isReportAvailableForProject(projectType: ProjectType, reportType: ReportType): boolean;
86
+ /**
87
+ * Report Manager class for handling report downloads
88
+ */
89
+ export declare class ReportManager {
90
+ private static _instance;
91
+ private constructor();
92
+ /**
93
+ * Get the singleton instance of ReportManager
94
+ */
95
+ static get instance(): ReportManager;
96
+ /**
97
+ * Get the base URL for the report API
98
+ * @returns The base URL
99
+ */
100
+ private getBaseURL;
101
+ /**
102
+ * Downloads a report based on project type and report type
103
+ * @param args Arguments for the report download
104
+ * @returns Promise that resolves when download is complete
105
+ */
106
+ downloadReport(args: {
107
+ token: string;
108
+ projectType: ProjectType;
109
+ reportType: ReportType;
110
+ fileFormat: FileFormat;
111
+ query?: Record<string, any>;
112
+ }): Promise<void>;
113
+ /**
114
+ * Process the download
115
+ * @param response The response from the API
116
+ * @param report The report definition
117
+ * @param fileFormat The requested file format
118
+ */
119
+ private processDownload;
120
+ /**
121
+ * Handle error responses from the API
122
+ * @param response The response from the API
123
+ * @throws Error with appropriate message
124
+ */
125
+ private handleErrorResponse;
126
+ /**
127
+ * Generates a default filename based on report and file format
128
+ * @param report The report definition
129
+ * @param fileFormat The requested file format
130
+ * @returns A suitable default filename with proper extension
131
+ */
132
+ private getDefaultFilename;
133
+ /**
134
+ * Extracts the filename from the Content-Disposition header
135
+ * @param contentDisposition The Content-Disposition header value
136
+ * @returns The extracted filename or null if not found
137
+ */
138
+ private extractFilenameFromContentDisposition;
139
+ /**
140
+ * Converts a base64 string to a Blob
141
+ * @param base64 The base64 string
142
+ * @returns A Blob
143
+ */
144
+ private b64toBlob;
145
+ }
146
+ //# sourceMappingURL=report_manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report_manager.d.ts","sourceRoot":"","sources":["../../../src/src/reports/report_manager.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,oBAAY,UAAU;IACpB,sBAAsB;IACtB,GAAG,QAAQ;IACX,wBAAwB;IACxB,KAAK,UAAU;IACf,sBAAsB;IACtB,GAAG,QAAQ;CACZ;AAED;;GAEG;AACH,oBAAY,WAAW;IACrB,8BAA8B;IAC9B,SAAS,cAAc;IACvB,qBAAqB;IACrB,MAAM,WAAW;IACjB,qBAAqB;IACrB,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,oBAAY,UAAU;IACpB,4CAA4C;IAC5C,4BAA4B,iCAAiC;IAC7D,8CAA8C;IAC9C,2BAA2B,gCAAgC;IAC3D,wCAAwC;IACxC,wBAAwB,6BAA6B;IACrD,4CAA4C;IAC5C,yBAAyB,8BAA8B;IACvD,uCAAuC;IACvC,uBAAuB,4BAA4B;CACpD;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uCAAuC;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,gBAAgB,EAAE,UAAU,EAAE,CAAC;IAC/B,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,WAAW,EAAE,WAAW,CAAC;IACzB,yBAAyB;IACzB,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,OAAO;kCAUb,gBAAgB;iCAUhB,gBAAgB;8BAWhB,gBAAgB;+BAUhB,gBAAgB;6BAWhB,gBAAgB;CACtB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,GACvB,gBAAgB,EAAE,CAIpB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,gBAAgB,CAExE;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,OAAO,CAGT;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAgB;IAExC,OAAO;IAEP;;OAEG;IACH,WAAkB,QAAQ,kBAEzB;IAED;;;OAGG;IACH,OAAO,CAAC,UAAU,CAOhB;IAEF;;;;OAIG;IACU,cAAc,CAAC,IAAI,EAAE;QAChC,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,WAAW,CAAC;QACzB,UAAU,EAAE,UAAU,CAAC;QACvB,UAAU,EAAE,UAAU,CAAC;QAEvB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC7B,GAAG,OAAO,CAAC,IAAI,CAAC;IAmFjB;;;;;OAKG;YACW,eAAe;IAqB7B;;;;OAIG;YACW,mBAAmB;IAwBjC;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAe1B;;;;OAIG;IACH,OAAO,CAAC,qCAAqC;IA6B7C;;;;OAIG;IACH,OAAO,CAAC,SAAS,CACyB;CAC3C"}
@@ -0,0 +1,320 @@
1
+ import FileSaver from "file-saver";
2
+ import { ConfigService } from "../config/index.js";
3
+ /**
4
+ * Available file formats for reports
5
+ */
6
+ export var FileFormat;
7
+ (function (FileFormat) {
8
+ /** PDF file format */
9
+ FileFormat["PDF"] = "pdf";
10
+ /** Excel file format */
11
+ FileFormat["EXCEL"] = "excel";
12
+ /** CSV file format */
13
+ FileFormat["CSV"] = "csv";
14
+ })(FileFormat || (FileFormat = {}));
15
+ /**
16
+ * Available project types
17
+ */
18
+ export var ProjectType;
19
+ (function (ProjectType) {
20
+ /** Tembo Dashboard project */
21
+ ProjectType["DASHBOARD"] = "dashboard";
22
+ /** Afloat project */
23
+ ProjectType["AFLOAT"] = "afloat";
24
+ /** VertoX project */
25
+ ProjectType["VERTO_X"] = "verto_x";
26
+ })(ProjectType || (ProjectType = {}));
27
+ /**
28
+ * Available report types with improved naming
29
+ */
30
+ export var ReportType;
31
+ (function (ReportType) {
32
+ /** Merchant payout statement (Dashboard) */
33
+ ReportType["MERCHANT_DISBURSEMENT_REPORT"] = "merchant_disbursement_report";
34
+ /** Transaction revenue summary (Dashboard) */
35
+ ReportType["TRANSACTION_REVENUE_SUMMARY"] = "transaction_revenue_summary";
36
+ /** Customer wallet activity (Afloat) */
37
+ ReportType["CUSTOMER_WALLET_ACTIVITY"] = "customer_wallet_activity";
38
+ /** Customer profile information (Afloat) */
39
+ ReportType["CUSTOMER_PROFILE_SNAPSHOT"] = "customer_profile_snapshot";
40
+ /** Gateway transaction log (VertoX) */
41
+ ReportType["GATEWAY_TRANSACTION_LOG"] = "gateway_transaction_log";
42
+ })(ReportType || (ReportType = {}));
43
+ /**
44
+ * Registry of all available reports
45
+ */
46
+ export const REPORTS = {
47
+ // Dashboard Reports
48
+ [ReportType.MERCHANT_DISBURSEMENT_REPORT]: {
49
+ id: "merchant_disbursement_report",
50
+ displayName: "Merchant Disbursement Report",
51
+ endpoint: "/dashboard/merchant_disbursements",
52
+ availableFormats: [FileFormat.PDF, FileFormat.EXCEL],
53
+ projectType: ProjectType.DASHBOARD,
54
+ reportType: ReportType.MERCHANT_DISBURSEMENT_REPORT,
55
+ description: "Detailed breakdown of payments made to merchants",
56
+ },
57
+ [ReportType.TRANSACTION_REVENUE_SUMMARY]: {
58
+ id: "transaction_revenue_summary",
59
+ displayName: "Transaction Revenue Summary",
60
+ endpoint: "/dashboard/revenue_summary",
61
+ availableFormats: [FileFormat.PDF, FileFormat.EXCEL],
62
+ projectType: ProjectType.DASHBOARD,
63
+ reportType: ReportType.TRANSACTION_REVENUE_SUMMARY,
64
+ description: "Summary of all revenue transactions by period",
65
+ },
66
+ // Afloat Reports
67
+ [ReportType.CUSTOMER_WALLET_ACTIVITY]: {
68
+ id: "customer_wallet_activity",
69
+ displayName: "Customer Wallet Activity",
70
+ endpoint: "/afloat/wallet_activity",
71
+ availableFormats: [FileFormat.PDF, FileFormat.EXCEL],
72
+ projectType: ProjectType.AFLOAT,
73
+ reportType: ReportType.CUSTOMER_WALLET_ACTIVITY,
74
+ description: "Detailed record of all customer wallet transactions",
75
+ },
76
+ [ReportType.CUSTOMER_PROFILE_SNAPSHOT]: {
77
+ id: "customer_profile_snapshot",
78
+ displayName: "Customer Profile Snapshot",
79
+ endpoint: "/afloat/profile_snapshot",
80
+ availableFormats: [FileFormat.PDF],
81
+ projectType: ProjectType.AFLOAT,
82
+ reportType: ReportType.CUSTOMER_PROFILE_SNAPSHOT,
83
+ description: "Current account information and status",
84
+ },
85
+ // VertoX Reports
86
+ [ReportType.GATEWAY_TRANSACTION_LOG]: {
87
+ id: "gateway_transaction_log",
88
+ displayName: "Gateway Transaction Log",
89
+ endpoint: "/vertox/gateway_transactions",
90
+ availableFormats: [FileFormat.EXCEL],
91
+ projectType: ProjectType.VERTO_X,
92
+ reportType: ReportType.GATEWAY_TRANSACTION_LOG,
93
+ description: "Log of all payment gateway API transactions",
94
+ },
95
+ };
96
+ /**
97
+ * Get all reports for a specific project
98
+ * @param projectType The project type to filter by
99
+ * @returns Array of report definitions for the project
100
+ */
101
+ export function getReportsByProject(projectType) {
102
+ return Object.values(REPORTS).filter((report) => report.projectType === projectType);
103
+ }
104
+ /**
105
+ * Get a report by its type
106
+ * @param reportType The report type to retrieve
107
+ * @returns The report definition or undefined if not found
108
+ */
109
+ export function getReportByType(reportType) {
110
+ return REPORTS[reportType];
111
+ }
112
+ /**
113
+ * Validates if a report type is available for a project
114
+ * @param projectType The project type
115
+ * @param reportType The report type
116
+ * @returns True if the report is available for the project, false otherwise
117
+ */
118
+ export function isReportAvailableForProject(projectType, reportType) {
119
+ const report = REPORTS[reportType];
120
+ return report !== undefined && report.projectType === projectType;
121
+ }
122
+ /**
123
+ * Report Manager class for handling report downloads
124
+ */
125
+ export class ReportManager {
126
+ constructor() {
127
+ /**
128
+ * Get the base URL for the report API
129
+ * @returns The base URL
130
+ */
131
+ Object.defineProperty(this, "getBaseURL", {
132
+ enumerable: true,
133
+ configurable: true,
134
+ writable: true,
135
+ value: () => {
136
+ let url = ConfigService.instance.pdfMakerBaseUrl;
137
+ if (url.trim().length === 0) {
138
+ url = "https://api.afloat.money/pdf-maker";
139
+ }
140
+ if (url.endsWith("/"))
141
+ return url.slice(0, -1);
142
+ return url;
143
+ }
144
+ });
145
+ /**
146
+ * Converts a base64 string to a Blob
147
+ * @param base64 The base64 string
148
+ * @returns A Blob
149
+ */
150
+ Object.defineProperty(this, "b64toBlob", {
151
+ enumerable: true,
152
+ configurable: true,
153
+ writable: true,
154
+ value: (base64) => fetch(base64).then((res) => res.blob())
155
+ });
156
+ }
157
+ /**
158
+ * Get the singleton instance of ReportManager
159
+ */
160
+ static get instance() {
161
+ return this._instance || (this._instance = new this());
162
+ }
163
+ /**
164
+ * Downloads a report based on project type and report type
165
+ * @param args Arguments for the report download
166
+ * @returns Promise that resolves when download is complete
167
+ */
168
+ async downloadReport(args) {
169
+ try {
170
+ // Get the report from the registry
171
+ const report = REPORTS[args.reportType];
172
+ if (!report) {
173
+ throw new Error(`Report type ${args.reportType} not configured`);
174
+ }
175
+ // Validate that the report belongs to the specified project
176
+ if (report.projectType !== args.projectType) {
177
+ throw new Error(`Report type ${args.reportType} does not belong to project ${args.projectType}`);
178
+ }
179
+ // Check if requested format is supported
180
+ if (!report.availableFormats.includes(args.fileFormat)) {
181
+ throw new Error(`File format ${args.fileFormat} not supported for ${report.displayName}`);
182
+ }
183
+ // Build URL using the report's endpoint
184
+ let url = `${this.getBaseURL()}${report.endpoint}`;
185
+ // Create a properly typed query parameters object
186
+ // deno-lint-ignore no-explicit-any
187
+ const queryParams = {
188
+ ...(args.query || {}),
189
+ fileFormat: args.fileFormat,
190
+ };
191
+ // Build the query string
192
+ const searchParams = new URLSearchParams();
193
+ for (const key in queryParams) {
194
+ if (Object.prototype.hasOwnProperty.call(queryParams, key)) {
195
+ const value = queryParams[key];
196
+ if (value !== undefined && value !== null) {
197
+ if (Array.isArray(value)) {
198
+ value.forEach((item) => {
199
+ searchParams.append(key + "[]", String(item));
200
+ });
201
+ }
202
+ else {
203
+ searchParams.append(key, String(value));
204
+ }
205
+ }
206
+ }
207
+ }
208
+ const queryString = searchParams.toString();
209
+ if (queryString) {
210
+ url += `?${queryString}`;
211
+ }
212
+ // Make the request
213
+ const response = await fetch(url, {
214
+ method: "GET",
215
+ headers: {
216
+ "Accept": "*/*",
217
+ "Content-Type": "application/json",
218
+ "Authorization": `Bearer ${args.token}`,
219
+ },
220
+ });
221
+ if (response.status !== 200) {
222
+ await this.handleErrorResponse(response);
223
+ }
224
+ // Process the download
225
+ await this.processDownload(response, report, args.fileFormat);
226
+ }
227
+ catch (error) {
228
+ console.error("Report download failed:", error);
229
+ throw error;
230
+ }
231
+ }
232
+ /**
233
+ * Process the download
234
+ * @param response The response from the API
235
+ * @param report The report definition
236
+ * @param fileFormat The requested file format
237
+ */
238
+ async processDownload(response, report, fileFormat) {
239
+ const contentDisposition = response.headers.get("Content-Disposition");
240
+ // Get default filename based on report and file format
241
+ const defaultFilename = this.getDefaultFilename(report, fileFormat);
242
+ // Try to get filename from Content-Disposition, fall back to default
243
+ const fileName = this.extractFilenameFromContentDisposition(contentDisposition) ||
244
+ defaultFilename;
245
+ // Handle the response based on content type
246
+ // deno-lint-ignore no-explicit-any
247
+ const blob = await this.b64toBlob(await response.text());
248
+ FileSaver.saveAs(blob, fileName);
249
+ }
250
+ /**
251
+ * Handle error responses from the API
252
+ * @param response The response from the API
253
+ * @throws Error with appropriate message
254
+ */
255
+ async handleErrorResponse(response) {
256
+ let errorMessage = "Encountered an error while generating report";
257
+ try {
258
+ // Try to parse as JSON first
259
+ const contentType = response.headers.get("Content-Type");
260
+ if (contentType && contentType.includes("application/json")) {
261
+ const errorData = await response.json();
262
+ errorMessage = errorData.message || errorData.error ||
263
+ errorMessage;
264
+ }
265
+ else {
266
+ // Try to get error as text
267
+ const textError = await response.text();
268
+ if (textError) {
269
+ errorMessage = textError;
270
+ }
271
+ }
272
+ }
273
+ catch (parseError) {
274
+ console.error("Error parsing error response:", parseError);
275
+ }
276
+ throw new Error(errorMessage);
277
+ }
278
+ /**
279
+ * Generates a default filename based on report and file format
280
+ * @param report The report definition
281
+ * @param fileFormat The requested file format
282
+ * @returns A suitable default filename with proper extension
283
+ */
284
+ getDefaultFilename(report, fileFormat) {
285
+ const date = new Date().toISOString().slice(0, 10); // YYYY-MM-DD format
286
+ // Build the filename with project, report type, and date
287
+ const baseFilename = `${report.id}_${date}`;
288
+ // Add the extension based on the file format
289
+ return fileFormat === FileFormat.PDF
290
+ ? `${baseFilename}.pdf`
291
+ : `${baseFilename}.xlsx`;
292
+ }
293
+ /**
294
+ * Extracts the filename from the Content-Disposition header
295
+ * @param contentDisposition The Content-Disposition header value
296
+ * @returns The extracted filename or null if not found
297
+ */
298
+ extractFilenameFromContentDisposition(contentDisposition) {
299
+ // Check if the header exists
300
+ if (!contentDisposition) {
301
+ return null;
302
+ }
303
+ // Try to match the filename pattern
304
+ const filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
305
+ const matches = filenameRegex.exec(contentDisposition);
306
+ if (matches && matches[1]) {
307
+ // Clean up the filename by removing quotes if present
308
+ let filename = matches[1].trim();
309
+ // Remove surrounding quotes if they exist
310
+ if (filename.startsWith('"') && filename.endsWith('"')) {
311
+ filename = filename.substring(1, filename.length - 1);
312
+ }
313
+ else if (filename.startsWith("'") && filename.endsWith("'")) {
314
+ filename = filename.substring(1, filename.length - 1);
315
+ }
316
+ return filename;
317
+ }
318
+ return null;
319
+ }
320
+ }
@@ -2,15 +2,11 @@
2
2
  * Generates a unique UUID (version 4).
3
3
  * @returns {string} - A randomly generated UUID string.
4
4
  */
5
- declare function generateUniqueUUID(): string;
5
+ export declare function generateUniqueUUID(): string;
6
6
  /**
7
7
  * Generates a UUID (version 5) based on the input string and a predefined namespace.
8
8
  * @param {string} data - The input string to generate the UUID from.
9
9
  * @returns {string} - A UUID string generated from the input string.
10
10
  */
11
- declare function generateUuidBasedOn(data: string): string;
12
- export declare const IdUtils: {
13
- generateUniqueUUID: typeof generateUniqueUUID;
14
- generateUuidBasedOn: typeof generateUuidBasedOn;
15
- };
16
- export {};
11
+ export declare function generateUuidBasedOn(data: string): string;
12
+ //# sourceMappingURL=id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../../src/src/utils/id.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAKD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExD"}
@@ -0,0 +1,19 @@
1
+ import { v4 as uuidv4 } from "uuid";
2
+ import { v5 as uuidv5 } from "uuid";
3
+ /**
4
+ * Generates a unique UUID (version 4).
5
+ * @returns {string} - A randomly generated UUID string.
6
+ */
7
+ export function generateUniqueUUID() {
8
+ return uuidv4();
9
+ }
10
+ // Predefined namespace
11
+ const NAMESPACE = uuidv5.DNS;
12
+ /**
13
+ * Generates a UUID (version 5) based on the input string and a predefined namespace.
14
+ * @param {string} data - The input string to generate the UUID from.
15
+ * @returns {string} - A UUID string generated from the input string.
16
+ */
17
+ export function generateUuidBasedOn(data) {
18
+ return uuidv5(data, NAMESPACE);
19
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./id.js";
2
+ export * from "./time.js";
3
+ export * from "./text.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Capitalizes the first letter of a string and converts the rest of the string to lowercase.
3
+ * @param {string} str - The input string.
4
+ * @returns {string} - The formatted string with the first letter capitalized.
5
+ */
6
+ export declare function capitalizeFirstLetter(str: string): string;
7
+ /**
8
+ * Combines a first name and a last name into a full name.
9
+ * @param {string} firstName - The first name.
10
+ * @param {string} lastName - The last name.
11
+ * @returns {string} - The full name formatted as "FirstName LastName".
12
+ */
13
+ export declare function getFullName(firstName: string, lastName: string): string;
14
+ /**
15
+ * Generates a URL-friendly slug from a given text.
16
+ * @param {string} text - The input string.
17
+ * @returns {string} - The generated slug with lowercase alphanumeric characters and hyphens.
18
+ */
19
+ export declare function generateSlug(text: string): string;
20
+ /**
21
+ * Abbreviates a full name into a first name and the initial of the last name.
22
+ * @param {string} fullName - The input full name.
23
+ * @returns {string} - The abbreviated name in the format "FirstName L.".
24
+ */
25
+ export declare function abbreviateName(fullName: string): string;
26
+ /**
27
+ * Extracts the initials from a full name.
28
+ * @param {string} fullName - The input full name.
29
+ * @returns {string} - The initials in uppercase format.
30
+ */
31
+ export declare function getInitialsFrom(fullName: string): string;
32
+ //# sourceMappingURL=text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/src/utils/text.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CASzD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOjD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAYvD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAcxD"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Capitalizes the first letter of a string and converts the rest of the string to lowercase.
3
+ * @param {string} str - The input string.
4
+ * @returns {string} - The formatted string with the first letter capitalized.
5
+ */
6
+ export function capitalizeFirstLetter(str) {
7
+ if (str.length === 0) {
8
+ return str; // Return an empty string if input is empty
9
+ }
10
+ const firstLetter = str.charAt(0).toUpperCase();
11
+ const restOfString = str.slice(1).toLowerCase();
12
+ return firstLetter + restOfString;
13
+ }
14
+ /**
15
+ * Combines a first name and a last name into a full name.
16
+ * @param {string} firstName - The first name.
17
+ * @param {string} lastName - The last name.
18
+ * @returns {string} - The full name formatted as "FirstName LastName".
19
+ */
20
+ export function getFullName(firstName, lastName) {
21
+ return `${firstName} ${lastName}`;
22
+ }
23
+ /**
24
+ * Generates a URL-friendly slug from a given text.
25
+ * @param {string} text - The input string.
26
+ * @returns {string} - The generated slug with lowercase alphanumeric characters and hyphens.
27
+ */
28
+ export function generateSlug(text) {
29
+ return text
30
+ .toLowerCase() // Convert to lowercase
31
+ .replace(/[^\w\s-]/g, "") // Remove non-alphanumeric characters except spaces and hyphens
32
+ .trim() // Trim leading/trailing spaces
33
+ .replace(/\s+/g, "-") // Replace spaces with hyphens
34
+ .replace(/-+/g, "-"); // Replace multiple hyphens with a single hyphen
35
+ }
36
+ /**
37
+ * Abbreviates a full name into a first name and the initial of the last name.
38
+ * @param {string} fullName - The input full name.
39
+ * @returns {string} - The abbreviated name in the format "FirstName L.".
40
+ */
41
+ export function abbreviateName(fullName) {
42
+ const nameParts = fullName.trim().split(" ");
43
+ if (nameParts.length === 1) {
44
+ // If there's only one word in the name, return it as is.
45
+ return fullName;
46
+ }
47
+ const firstName = nameParts[0];
48
+ const lastNameInitial = nameParts[nameParts.length - 1].charAt(0);
49
+ return `${firstName} ${lastNameInitial}.`;
50
+ }
51
+ /**
52
+ * Extracts the initials from a full name.
53
+ * @param {string} fullName - The input full name.
54
+ * @returns {string} - The initials in uppercase format.
55
+ */
56
+ export function getInitialsFrom(fullName) {
57
+ let label = "";
58
+ const names = (fullName ?? "").trim().split(" ");
59
+ if (names.length === 0)
60
+ return "";
61
+ const firstName = names[0];
62
+ label = firstName.charAt(0);
63
+ if (names.length > 1) {
64
+ const lastName = names[names.length - 1];
65
+ label = `${firstName.charAt(0)}${lastName.charAt(0)}`;
66
+ }
67
+ return label.toUpperCase();
68
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.test.d.ts","sourceRoot":"","sources":["../../../src/src/utils/text.test.ts"],"names":[],"mappings":""}
@@ -4,23 +4,18 @@
4
4
  * @param {Date} b - The second Date object.
5
5
  * @returns {boolean} - Returns true if the dates are equal in terms of year, month, and day; otherwise, false.
6
6
  */
7
- declare function compareDates(a: Date, b: Date): boolean;
7
+ export declare function compareDates(a: Date, b: Date): boolean;
8
8
  /**
9
9
  * Sorts two dates in descending order (latest date first).
10
10
  * @param {Date} a - The first Date object.
11
11
  * @param {Date} b - The second Date object.
12
12
  * @returns {number} - Returns a positive value if `b` is after `a`, a negative value if `a` is after `b`, and 0 if they are equal.
13
13
  */
14
- declare function sortDates(a: Date, b: Date): number;
14
+ export declare function sortDates(a: Date, b: Date): number;
15
15
  /**
16
16
  * Creates a delay for a given number of milliseconds.
17
17
  * @param {number} milliseconds - The delay duration in milliseconds.
18
18
  * @returns {Promise<void>} - A promise that resolves after the specified delay.
19
19
  */
20
- declare function delay(milliseconds: number): Promise<void>;
21
- export declare const TimeUtils: {
22
- compareDates: typeof compareDates;
23
- sortDates: typeof sortDates;
24
- delay: typeof delay;
25
- };
26
- export {};
20
+ export declare function delay(milliseconds: number): Promise<void>;
21
+ //# sourceMappingURL=time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../src/src/utils/time.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,OAAO,CAMtD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAElD;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMzD"}