@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
@@ -1,748 +0,0 @@
1
- import { z } from "zod";
2
- import { CurrencyCode } from "../currency/index.js";
3
- /**
4
- * Regular expression for validating amount strings
5
- * Supports both positive and negative amounts with optional comma separators and decimals
6
- */
7
- declare const AMOUNT_REGEX: RegExp;
8
- /**
9
- * Zod schema for Amount JSON serialization
10
- * This schema validates the JSON representation of an Amount instance
11
- */
12
- export declare const AmountJSONSchema: z.ZodObject<{
13
- /** The numeric value of the amount (can be positive, negative, or zero) */
14
- value: z.ZodNumber;
15
- /** The formatted text representation of the amount */
16
- text: z.ZodString;
17
- /** The ISO currency code */
18
- currencyCode: z.ZodString;
19
- /** Version for future compatibility */
20
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
21
- }, "strip", z.ZodTypeAny, {
22
- version: string;
23
- value: number;
24
- text: string;
25
- currencyCode: string;
26
- }, {
27
- value: number;
28
- text: string;
29
- currencyCode: string;
30
- version?: string | undefined;
31
- }>;
32
- /**
33
- * Infer the AmountJSON type from the schema
34
- */
35
- export type AmountJSON = z.infer<typeof AmountJSONSchema>;
36
- /**
37
- * Represents a monetary amount with currency information
38
- *
39
- * Enhanced with currency-amount parsing support:
40
- * - Supports formats like "TZS1000", "1000TZS", "TZS1,000.00", "1,000.00TZS"
41
- * - Case-insensitive currency codes
42
- * - US/UK format (comma for thousands, period for decimal)
43
- * - Automatic whitespace removal
44
- * - Clear error messages for invalid formats
45
- *
46
- * @example
47
- * ```typescript
48
- * // Currency-amount combinations
49
- * Amount.from('TZS10000'); // TZS 10,000.00
50
- * Amount.from('TZS 10,000'); // TZS 10,000.00 (spaces removed)
51
- * Amount.from('10000TZS'); // TZS 10,000.00
52
- * Amount.from('TZS1,234.56'); // TZS 1,234.56
53
- * Amount.from('-TZS1000'); // -TZS 1,000.00
54
- * Amount.from('TZS-1000'); // -TZS 1,000.00
55
- *
56
- * // Traditional usage still works
57
- * Amount.from(1000, 'TZS'); // TZS 1,000.00
58
- * Amount.from('1000', 'USD'); // USD 1,000.00
59
- * ```
60
- */
61
- /**
62
- * JSON representation interface for Amount serialization
63
- */
64
- export interface AmountJson {
65
- /** The numeric value of the amount (can be positive, negative, or zero) */
66
- value: number;
67
- /** The formatted text representation of the amount */
68
- text: string;
69
- /** The ISO currency code */
70
- currencyCode: string;
71
- /** Version for future compatibility */
72
- version?: string;
73
- }
74
- /**
75
- * Formatting options for the enhanced format method
76
- */
77
- interface AmountFormatOptions {
78
- /** Show currency indicator (code by default, or symbol if useSymbol is true). Default: true */
79
- showCurrency?: boolean;
80
- /** Use currency symbol (e.g., $, TSh) instead of code (e.g., USD, TZS). Default: false */
81
- useSymbol?: boolean;
82
- /** Position of currency indicator. Default: "before" */
83
- currencyPosition?: "before" | "after";
84
- /** Use thousands separators (commas). Default: true */
85
- useGrouping?: boolean;
86
- /** Minimum number of decimal places */
87
- minimumFractionDigits?: number;
88
- /** Maximum number of decimal places */
89
- maximumFractionDigits?: number;
90
- /** How to display sign for positive/negative numbers */
91
- showSign?: "always" | "negative" | "never";
92
- /** Locale for formatting (defaults to 'en-US') */
93
- locale?: string;
94
- /** Custom thousands separator */
95
- thousandsSeparator?: string;
96
- /** Custom decimal separator */
97
- decimalSeparator?: string;
98
- /** Use native formatting with Intl.NumberFormat (defaults to false) */
99
- useNativeFormatting?: boolean;
100
- /** Prefer native locale for the currency (overrides provided locale) */
101
- useNativeLocale?: boolean;
102
- }
103
- /**
104
- * Represents a monetary amount with currency information
105
- *
106
- * Features:
107
- * - Supports both positive and negative amounts
108
- * - Handles multiple input formats (strings with commas, numbers, etc.)
109
- * - Provides mathematical operations (add, subtract, multiply, divide)
110
- * - Includes comparison operations (equals, greaterThan, etc.)
111
- * - Maintains currency consistency across operations
112
- * - Immutable - all operations return new Amount instances
113
- *
114
- * @example
115
- * ```typescript
116
- * // Creating amounts
117
- * const positive = Amount.from(1000, 'USD'); // USD 1,000.00
118
- * const negative = Amount.from(-500, 'USD'); // -USD 500.00
119
- * const fromString = Amount.from('-1,234.56', 'EUR'); // -EUR 1,234.56
120
- *
121
- * // Mathematical operations
122
- * const sum = positive.add(negative); // $500.00
123
- * const product = positive.multiply(-0.1); // -$100.00
124
- *
125
- * // Comparisons
126
- * const isNegative = negative.isNegative(); // true
127
- * const isPositive = positive.isPositive(); // true
128
- * ```
129
- */
130
- declare class Amount {
131
- private readonly value;
132
- private readonly text;
133
- private readonly currency;
134
- /**
135
- * Private constructor to ensure proper validation through factory methods
136
- *
137
- * @param value - The numeric value of the amount (can be positive or negative)
138
- * @param text - The formatted text representation of the amount
139
- * @param currencyCode - The currency code for this amount
140
- * @throws {Error} When currency code is invalid
141
- * @private
142
- */
143
- private constructor();
144
- /**
145
- * Creates an Amount instance from string or number input
146
- *
147
- * Supports currency-amount combinations like:
148
- * - "TZS10000", "10000TZS" (no space)
149
- * - "TZS 10,000", "10,000 TZS" (with spaces - automatically cleaned)
150
- * - "-TZS1000", "TZS-1000", "-1000TZS" (negative amounts)
151
- * - Case-insensitive: "tzs10000", "TZS10000", "Tzs10000"
152
- *
153
- * @param input - String with currency-amount or number
154
- * @param currencyCode - Currency code (optional if detected from string)
155
- * @returns Amount instance or undefined if invalid
156
- * @throws Error with clear message if format is invalid
157
- */
158
- static from(input: string | number, currencyCode?: CurrencyCode | null): Amount | undefined;
159
- /**
160
- * Parse currency-amount combination from cleaned string
161
- * @param cleaned - String with whitespace already removed
162
- * @returns Object with currency code and amount string
163
- */
164
- private static parseCurrencyAmount;
165
- /**
166
- * Validate and normalize currency code
167
- * @param code - Currency code string (e.g., "TZS", "tzs")
168
- * @returns Normalized currency code or undefined if invalid
169
- */
170
- private static validateCurrencyCode;
171
- /**
172
- * Create Amount from numeric value
173
- */
174
- private static fromNumericValue;
175
- /**
176
- * Create Amount from parsed currency and amount values
177
- * @param amountStr - Numeric amount string (may include commas, decimal, minus)
178
- * @param currencyCode - Validated currency code
179
- */
180
- private static fromParsedValues;
181
- /**
182
- * Returns the currency code
183
- *
184
- * @returns The ISO currency code (e.g., 'USD', 'EUR', 'TZS')
185
- */
186
- get currencyCode(): CurrencyCode;
187
- /**
188
- * Returns the numeric value of the amount
189
- *
190
- * Can be positive, negative, or zero
191
- *
192
- * @returns The raw numeric value
193
- *
194
- * @example
195
- * ```typescript
196
- * Amount.from(1000).numericValue; // 1000
197
- * Amount.from(-500).numericValue; // -500
198
- * Amount.from(0).numericValue; // 0
199
- * ```
200
- */
201
- get numericValue(): number;
202
- /**
203
- * Returns the formatted numeric value of the amount
204
- *
205
- * Always shows 2 decimal places for consistency, handles negative numbers
206
- *
207
- * @returns Formatted numeric string
208
- *
209
- * @example
210
- * ```typescript
211
- * Amount.from(1234.5).formattedNumericValue; // "1,234.50"
212
- * Amount.from(-1234.5).formattedNumericValue; // "-1,234.50"
213
- * ```
214
- */
215
- get formattedNumericValue(): string;
216
- /**
217
- * Adds this amount to another amount or number
218
- *
219
- * Supports mixing positive and negative amounts:
220
- * - Positive + Positive = Positive
221
- * - Positive + Negative = Difference
222
- * - Negative + Negative = More negative
223
- *
224
- * @param other - Amount object or number to add
225
- * @returns New Amount object with the sum
226
- * @throws {Error} If currencies don't match when adding Amount objects
227
- *
228
- * @example
229
- * ```typescript
230
- * Amount.from(100).add(Amount.from(-50)); // Amount(50)
231
- * Amount.from(-100).add(-50); // Amount(-150)
232
- * Amount.from(100).add(Amount.from(-200)); // Amount(-100)
233
- * ```
234
- */
235
- add(other: Amount | number): Amount;
236
- /**
237
- * Subtracts another amount or number from this amount
238
- *
239
- * Supports all combinations of positive and negative amounts:
240
- * - Positive - Positive = Difference (can be negative)
241
- * - Positive - Negative = Sum (double positive)
242
- * - Negative - Positive = More negative
243
- * - Negative - Negative = Difference
244
- *
245
- * @param other - Amount object or number to subtract
246
- * @returns New Amount object with the difference
247
- * @throws {Error} If currencies don't match when subtracting Amount objects
248
- *
249
- * @example
250
- * ```typescript
251
- * Amount.from(100).subtract(Amount.from(150)); // Amount(-50)
252
- * Amount.from(100).subtract(Amount.from(-50)); // Amount(150)
253
- * Amount.from(-100).subtract(Amount.from(50)); // Amount(-150)
254
- * ```
255
- */
256
- subtract(other: Amount | number): Amount;
257
- /**
258
- * Multiplies this amount by a number
259
- * @param multiplier - Number to multiply by
260
- * @returns New Amount object with the product
261
- */
262
- multiply(multiplier: number): Amount;
263
- /**
264
- * Divides this amount by a number
265
- * @param divisor - Number to divide by
266
- * @returns New Amount object with the quotient
267
- * @throws Error if divisor is zero
268
- */
269
- divide(divisor: number): Amount;
270
- /**
271
- * Returns the absolute value of this amount
272
- * @returns New Amount object with absolute value
273
- */
274
- abs(): Amount;
275
- /**
276
- * Rounds this amount to the specified number of decimal places
277
- *
278
- * Works correctly with both positive and negative amounts
279
- *
280
- * @param decimals - Number of decimal places (defaults to currency's decimal digits)
281
- * @returns New Amount object with rounded value
282
- *
283
- * @example
284
- * ```typescript
285
- * Amount.from(123.456, 'USD').round(); // Amount(123.46)
286
- * Amount.from(-123.456, 'USD').round(1); // Amount(-123.5)
287
- * Amount.from(123.456, 'TZS').round(0); // Amount(123)
288
- * ```
289
- */
290
- round(decimals?: number): Amount;
291
- /**
292
- * Returns the minimum of this amount and another amount/number
293
- *
294
- * Properly handles negative number comparisons
295
- *
296
- * @param other - Amount object or number to compare with
297
- * @returns New Amount object with the minimum value
298
- *
299
- * @example
300
- * ```typescript
301
- * Amount.from(100).min(Amount.from(-50)); // Amount(-50)
302
- * Amount.from(-100).min(-150); // Amount(-150)
303
- * ```
304
- */
305
- min(other: Amount | number): Amount;
306
- /**
307
- * Returns the maximum of this amount and another amount/number
308
- *
309
- * Properly handles negative number comparisons
310
- *
311
- * @param other - Amount object or number to compare with
312
- * @returns New Amount object with the maximum value
313
- *
314
- * @example
315
- * ```typescript
316
- * Amount.from(100).max(Amount.from(-50)); // Amount(100)
317
- * Amount.from(-100).max(-50); // Amount(-50)
318
- * ```
319
- */
320
- max(other: Amount | number): Amount;
321
- /**
322
- * Checks if this amount equals another amount or number
323
- *
324
- * Uses strict equality, works with negative numbers
325
- *
326
- * @param other - Amount object or number to compare with
327
- * @returns True if values are equal
328
- *
329
- * @example
330
- * ```typescript
331
- * Amount.from(-100).equals(Amount.from(-100)); // true
332
- * Amount.from(-100).equals(-100); // true
333
- * Amount.from(-100).equals(100); // false
334
- * ```
335
- */
336
- equals(other: Amount | number): boolean;
337
- /**
338
- * Checks if this amount is greater than another amount or number
339
- *
340
- * Properly handles negative number comparisons (-50 > -100 is true)
341
- *
342
- * @param other - Amount object or number to compare with
343
- * @returns True if this amount is greater
344
- *
345
- * @example
346
- * ```typescript
347
- * Amount.from(-50).greaterThan(Amount.from(-100)); // true
348
- * Amount.from(-100).greaterThan(-50); // false
349
- * Amount.from(100).greaterThan(-100); // true
350
- * ```
351
- */
352
- greaterThan(other: Amount | number): boolean;
353
- /**
354
- * Checks if this amount is less than another amount or number
355
- *
356
- * Properly handles negative number comparisons (-100 < -50 is true)
357
- *
358
- * @param other - Amount object or number to compare with
359
- * @returns True if this amount is less
360
- *
361
- * @example
362
- * ```typescript
363
- * Amount.from(-100).lessThan(Amount.from(-50)); // true
364
- * Amount.from(-50).lessThan(-100); // false
365
- * Amount.from(-100).lessThan(100); // true
366
- * ```
367
- */
368
- lessThan(other: Amount | number): boolean;
369
- /**
370
- * Checks if this amount is greater than or equal to another amount or number
371
- *
372
- * @param other - Amount object or number to compare with
373
- * @returns True if this amount is greater than or equal
374
- */
375
- greaterThanOrEqual(other: Amount | number): boolean;
376
- /**
377
- * Checks if this amount is less than or equal to another amount or number
378
- *
379
- * @param other - Amount object or number to compare with
380
- * @returns True if this amount is less than or equal
381
- */
382
- lessThanOrEqual(other: Amount | number): boolean;
383
- /**
384
- * Converts this amount to a different currency
385
- *
386
- * Works with both positive and negative amounts
387
- *
388
- * @param targetCurrency - Target currency code
389
- * @param exchangeRate - Exchange rate from current currency to target currency
390
- * @returns New Amount object in target currency
391
- *
392
- * @example
393
- * ```typescript
394
- * Amount.from(-1000, 'TZS').convertTo('USD', 0.00043); // Amount(-0.43, 'USD')
395
- * ```
396
- */
397
- convertTo(targetCurrency: CurrencyCode, exchangeRate: number): Amount;
398
- /**
399
- * Returns a percentage of this amount
400
- *
401
- * Maintains the sign of the original amount
402
- *
403
- * @param percentage - Percentage as a number (e.g., 10 for 10%, -5 for -5%)
404
- * @returns New Amount object representing the percentage
405
- *
406
- * @example
407
- * ```typescript
408
- * Amount.from(1000).percentage(10); // Amount(100)
409
- * Amount.from(-1000).percentage(10); // Amount(-100)
410
- * Amount.from(1000).percentage(-10); // Amount(-100)
411
- * ```
412
- */
413
- percentage(percentage: number): Amount;
414
- /**
415
- * Checks if this amount is zero
416
- *
417
- * @returns True if the amount is exactly zero
418
- *
419
- * @example
420
- * ```typescript
421
- * Amount.from(0).isZero(); // true
422
- * Amount.from(-0).isZero(); // true
423
- * Amount.from(0.01).isZero(); // false
424
- * ```
425
- */
426
- isZero(): boolean;
427
- /**
428
- * Checks if this amount is positive
429
- *
430
- * @returns True if the amount is greater than zero
431
- *
432
- * @example
433
- * ```typescript
434
- * Amount.from(100).isPositive(); // true
435
- * Amount.from(-100).isPositive(); // false
436
- * Amount.from(0).isPositive(); // false
437
- * ```
438
- */
439
- isPositive(): boolean;
440
- /**
441
- * Checks if this amount is negative
442
- *
443
- * @returns True if the amount is less than zero
444
- *
445
- * @example
446
- * ```typescript
447
- * Amount.from(-100).isNegative(); // true
448
- * Amount.from(100).isNegative(); // false
449
- * Amount.from(0).isNegative(); // false
450
- * ```
451
- */
452
- isNegative(): boolean;
453
- /**
454
- * Gets the best locale for this currency
455
- * Maps currency codes to their primary locales
456
- */
457
- private getNativeLocaleForCurrency;
458
- /**
459
- * Formats using native Intl.NumberFormat with comprehensive options
460
- */
461
- private formatWithIntl;
462
- /**
463
- * Manual formatting method (existing logic)
464
- */
465
- private formatManually;
466
- /**
467
- * Determines if currency should use spacing (for manual formatting)
468
- */
469
- private shouldUseSpacing;
470
- /**
471
- * Enhanced format method with comprehensive options including native formatting
472
- *
473
- * @param options - Formatting configuration options
474
- * @returns Formatted amount string according to specified options
475
- *
476
- * @example
477
- * ```typescript
478
- * const amount = Amount.from(-1234.56, 'USD');
479
- * const tzAmount = Amount.from(1234.56, 'TZS');
480
- *
481
- * // Default formatting (currency codes)
482
- * amount.format(); // "-USD 1,234.56"
483
- * tzAmount.format(); // "TZS 1,234.56"
484
- *
485
- * // Symbol formatting (opt-in)
486
- * amount.format({ useSymbol: true }); // "-$1,234.56"
487
- * tzAmount.format({ useSymbol: true }); // "TSh 1,234.56"
488
- *
489
- * // Native formatting with Intl (uses symbols via browser locale)
490
- * tzAmount.format({ useNativeFormatting: true, useNativeLocale: true }); // Uses Swahili locale
491
- *
492
- * // Currency position
493
- * amount.format({ currencyPosition: 'after' }); // "-1,234.56 USD"
494
- *
495
- * // No currency
496
- * amount.format({ showCurrency: false }); // "-1,234.56"
497
- * ```
498
- */
499
- format(options?: AmountFormatOptions): string;
500
- /**
501
- * Convenience method for native formatting using Intl.NumberFormat with symbols
502
- * @param options Additional formatting options
503
- * @returns Formatted string using native currency conventions with symbols
504
- */
505
- formatNative(options?: Omit<AmountFormatOptions, "useNativeFormatting">): string;
506
- /**
507
- * Primary display label using currency codes (e.g., "TZS 1,000.00", "USD 500.00")
508
- */
509
- get label(): string;
510
- /**
511
- * International label using currency codes with en-US locale
512
- */
513
- get internationalLabel(): string;
514
- /**
515
- * Returns the amount as a plain number string without currency indicator
516
- *
517
- * @param options - Formatting options for the numeric value
518
- * @returns Plain numeric string
519
- *
520
- * @example
521
- * ```typescript
522
- * Amount.from(-1234.56).toPlainNumber(); // "-1,234.56"
523
- * Amount.from(1000).toPlainNumber({ useGrouping: false }); // "1000.00"
524
- * Amount.from(1234.5).toPlainNumber({
525
- * minimumFractionDigits: 4
526
- * }); // "1,234.5000"
527
- * ```
528
- */
529
- toPlainNumber(options?: Omit<AmountFormatOptions, "showCurrency" | "useSymbol" | "currencyPosition">): string;
530
- /**
531
- * Formats amount in compact notation (K, M, B, T)
532
- *
533
- * @param precision - Number of decimal places for compact numbers (default: 1)
534
- * @param options - Additional formatting options
535
- * @returns Compact formatted string
536
- *
537
- * @example
538
- * ```typescript
539
- * Amount.from(1500).toCompactFormat(); // "TZS 1.5K"
540
- * Amount.from(-2500000, 'USD').toCompactFormat(); // "-USD 2.5M"
541
- * Amount.from(1234567890, 'USD').toCompactFormat(); // "USD 1.2B"
542
- * Amount.from(999, 'USD').toCompactFormat(); // "USD 999"
543
- * Amount.from(1000000, 'EUR').toCompactFormat(2, { alwaysShowDecimals: true }); // "EUR 1.00M"
544
- * Amount.from(1500000, 'USD').toCompactFormat(0); // "USD 2M" (rounded)
545
- * ```
546
- */
547
- toCompactFormat(precision?: number, options?: {
548
- showCurrency?: boolean;
549
- useSymbol?: boolean;
550
- alwaysShowDecimals?: boolean;
551
- roundingMode?: "round" | "floor" | "ceil";
552
- }): string;
553
- /**
554
- * Returns the amount rounded to the nearest whole number
555
- *
556
- * @param showCurrency - Whether to include currency code (default: false)
557
- * @param useGrouping - Whether to use thousands separators (default: true)
558
- * @returns Whole number formatted string
559
- *
560
- * @example
561
- * ```typescript
562
- * Amount.from(1234.56).toWholeNumber(); // "1,235"
563
- * Amount.from(-1234.44).toWholeNumber(); // "-1,234"
564
- * Amount.from(1000.5, 'USD').toWholeNumber(true); // "USD 1,001"
565
- * Amount.from(999.4).toWholeNumber(false, false); // "999"
566
- * ```
567
- */
568
- toWholeNumber(showCurrency?: boolean, useGrouping?: boolean): string;
569
- /**
570
- * Helper method to get the actual rounded value as a number (for toWholeNumber)
571
- *
572
- * @returns The amount rounded to the nearest whole number
573
- *
574
- * @example
575
- * ```typescript
576
- * Amount.from(1234.56).getWholeValue(); // 1235
577
- * Amount.from(-1234.44).getWholeValue(); // -1234
578
- * ```
579
- */
580
- getWholeValue(): number;
581
- /**
582
- * Serializes the Amount instance to a JSON-compatible object
583
- */
584
- toJSON(): AmountJSON;
585
- /**
586
- * Serializes the Amount instance to a JSON string
587
- */
588
- toJSONString(): string;
589
- /**
590
- * Creates an Amount instance from a JSON-compatible object or string
591
- */
592
- static fromJSON(json: AmountJSON | string): Amount | undefined;
593
- /**
594
- * Creates an Amount instance from a JSON string
595
- */
596
- static fromJSONString(jsonString: string): Amount | undefined;
597
- /**
598
- * Type guard to check if an object is a valid AmountJSON using Zod validation
599
- */
600
- static isAmountJSON(obj: unknown): obj is AmountJSON;
601
- /**
602
- * Returns the sum of multiple amounts
603
- *
604
- * Handles arrays containing both positive and negative amounts
605
- *
606
- * @param amounts - Array of Amount objects to sum
607
- * @returns New Amount object with the total sum
608
- * @throws {Error} If amounts have different currencies
609
- *
610
- * @example
611
- * ```typescript
612
- * const amounts = [
613
- * Amount.from(100),
614
- * Amount.from(-50),
615
- * Amount.from(25)
616
- * ];
617
- * Amount.sum(amounts); // Amount(75)
618
- * ```
619
- */
620
- static sum(amounts: Amount[]): Amount;
621
- /**
622
- * Returns the average of multiple amounts
623
- *
624
- * Handles arrays containing both positive and negative amounts
625
- *
626
- * @param amounts - Array of Amount objects to average
627
- * @returns New Amount object with the average value
628
- * @throws {Error} If amounts have different currencies or array is empty
629
- *
630
- * @example
631
- * ```typescript
632
- * const amounts = [
633
- * Amount.from(100),
634
- * Amount.from(-200),
635
- * Amount.from(200)
636
- * ];
637
- * Amount.average(amounts); // Amount(33.33)
638
- * ```
639
- */
640
- static average(amounts: Amount[]): Amount;
641
- /**
642
- * Returns the minimum amount from an array of amounts
643
- *
644
- * Properly handles negative amounts (most negative is minimum)
645
- *
646
- * @param amounts - Array of Amount objects
647
- * @returns Amount object with minimum value
648
- * @throws {Error} If array is empty
649
- *
650
- * @example
651
- * ```typescript
652
- * const amounts = [
653
- * Amount.from(100),
654
- * Amount.from(-200),
655
- * Amount.from(50)
656
- * ];
657
- * Amount.min(amounts); // Amount(-200)
658
- * ```
659
- */
660
- static min(amounts: Amount[]): Amount;
661
- /**
662
- * Returns the maximum amount from an array of amounts
663
- *
664
- * Properly handles negative amounts (least negative is maximum)
665
- *
666
- * @param amounts - Array of Amount objects
667
- * @returns Amount object with maximum value
668
- * @throws {Error} If array is empty
669
- *
670
- * @example
671
- * ```typescript
672
- * const amounts = [
673
- * Amount.from(100),
674
- * Amount.from(-200),
675
- * Amount.from(50)
676
- * ];
677
- * Amount.max(amounts); // Amount(100)
678
- * ```
679
- */
680
- static max(amounts: Amount[]): Amount;
681
- /**
682
- * Checks if the amount is valid
683
- *
684
- * Now accepts both positive and negative amounts as valid
685
- *
686
- * @param input - Amount to be checked for validity
687
- * @param currencyCode - Currency code to validate against
688
- * @returns True if the amount is valid, false otherwise
689
- *
690
- * @example
691
- * ```typescript
692
- * Amount.canConstruct(1000); // true
693
- * Amount.canConstruct(-500); // true
694
- * Amount.canConstruct(0); // true
695
- * Amount.canConstruct('abc'); // false
696
- * Amount.canConstruct(null); // false
697
- * ```
698
- */
699
- static canConstruct(input?: string | number | null, currencyCode?: CurrencyCode): boolean;
700
- /**
701
- * Checks if an unknown value is an Amount instance
702
- *
703
- * Validates the structural integrity of an amount object, including negative amounts
704
- *
705
- * @param obj - The value to validate
706
- * @returns Type predicate indicating if the value is a valid Amount
707
- *
708
- * @example
709
- * ```typescript
710
- * const amount = Amount.from(-100);
711
- * Amount.is(amount); // true
712
- * Amount.is({}); // false
713
- * Amount.is(null); // false
714
- * ```
715
- */
716
- static is(obj: unknown): obj is Amount;
717
- /**
718
- * Checks the validity of the amount data
719
- *
720
- * @returns True if the amount data is available and valid
721
- */
722
- validate(): boolean;
723
- /**
724
- * Gets payout constraints (min/max amounts) for a specific currency
725
- *
726
- * Returns Amount objects that can be directly compared and formatted,
727
- * providing type safety and automatic currency context.
728
- *
729
- * @param currency - The currency code to get constraints for
730
- * @returns Object with min and max Amount objects, or undefined if currency not supported
731
- *
732
- * @example
733
- * ```typescript
734
- * const constraints = Amount.getTransactionLimits('TZS');
735
- * if (constraints && myAmount.lessThan(constraints.min)) {
736
- * throw new Error(`Minimum amount is ${constraints.min.label}`);
737
- * }
738
- * ```
739
- */
740
- static getTransactionLimits(currency: CurrencyCode): {
741
- min: Amount;
742
- max: Amount;
743
- };
744
- }
745
- /**
746
- * Export the Amount class and regex pattern
747
- */
748
- export { Amount, AMOUNT_REGEX };