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