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