@temboplus/afloat 0.1.61 → 0.1.63
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 +246 -42
- package/{esm/src/features/admin/contract.d.ts → dist/features/admin/admin.contract.d.ts} +41 -77
- package/{script/npm/src/src/features/admin/schemas.d.ts → dist/features/admin/admin.dtos.d.ts} +8 -9
- package/dist/features/admin/admin.repository.d.ts +179 -0
- package/dist/features/admin/index.d.ts +2 -0
- package/{esm/src/features/auth/access/contract.d.ts → dist/features/auth/access/access.api-contract.d.ts} +0 -1
- package/dist/features/auth/access/access.repository.d.ts +55 -0
- package/{esm/src/features/auth/contract.d.ts → dist/features/auth/auth.contract.d.ts} +12 -8
- package/dist/features/auth/auth.manager.d.ts +249 -0
- package/dist/features/auth/auth.repository.d.ts +66 -0
- package/dist/features/auth/auth.store.d.ts +139 -0
- package/{script/npm/src/src/features/auth/identity/contract.d.ts → dist/features/auth/identity/identity.api-contract.d.ts} +0 -1
- package/dist/features/auth/identity/identity.repository.d.ts +58 -0
- package/dist/features/auth/index.d.ts +5 -0
- package/{script/npm/src/src/features/auth/profile/contract.d.ts → dist/features/auth/profile/profile.api-contract.d.ts} +8 -6
- package/dist/features/auth/profile/profile.dtos.d.ts +80 -0
- package/dist/features/auth/profile/profile.repository.d.ts +56 -0
- package/{script/npm/src/src/features/auth/storage/client_store.d.ts → dist/features/auth/storage/client-store.d.ts} +2 -3
- package/{esm/src/features/auth/storage/client_token_handler.d.ts → dist/features/auth/storage/client-token-handler.d.ts} +1 -2
- package/{script/npm/src/src → dist}/features/auth/storage/types.d.ts +1 -2
- package/dist/features/contact/contact-input-handler.d.ts +16 -0
- package/{esm/src/features/contact/contract.d.ts → dist/features/contact/contact.api-contract.d.ts} +101 -45
- package/dist/features/contact/contact.dtos.d.ts +90 -0
- package/dist/features/contact/contact.repository.d.ts +116 -0
- package/dist/features/contact/index.d.ts +2 -0
- package/dist/features/payout/index.d.ts +3 -0
- package/dist/features/payout/payout-channel-handler.d.ts +108 -0
- package/{esm/src/features/payout/contract.d.ts → dist/features/payout/payout.api-contract.d.ts} +351 -187
- package/dist/features/payout/payout.dtos.d.ts +365 -0
- package/dist/features/payout/payout.repository.d.ts +193 -0
- package/dist/features/wallet/index.d.ts +4 -0
- package/dist/features/wallet/wallet-manager.session.d.ts +143 -0
- package/{script/npm/src/src/features/wallet/contract.d.ts → dist/features/wallet/wallet.contract.d.ts} +9 -7
- package/dist/features/wallet/wallet.dtos.d.ts +204 -0
- package/dist/features/wallet/wallet.repository.d.ts +173 -0
- package/dist/features/wallet/wallet.utils.d.ts +17 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/{esm/src/shared/base_repository.d.ts → dist/lib/api/base-repository.d.ts} +137 -42
- package/{script/npm/src/src/shared/common_responses.d.ts → dist/lib/api/common-responses.d.ts} +0 -1
- package/dist/lib/api/index.d.ts +2 -0
- package/{esm/src/errors/api_error.d.ts → dist/lib/error/error.api.d.ts} +0 -1
- package/{script/npm/src/src/errors/permission_error.d.ts → dist/lib/error/error.permission.d.ts} +1 -2
- package/dist/lib/error/error.utils.d.ts +22 -0
- package/dist/lib/error/index.d.ts +3 -0
- package/dist/models/contact-info.model.d.ts +817 -0
- package/{script/npm/src/src/models/contact/derivatives/contact.d.ts → dist/models/contact.model.d.ts} +23 -16
- package/dist/models/index.d.ts +11 -0
- package/{esm/src/models/user/managed-user.d.ts → dist/models/managed-user.model.d.ts} +3 -3
- package/dist/models/narration.model.d.ts +184 -0
- package/{script/npm/src/src/models/payout/derivatives/payout.d.ts → dist/models/payout.model.d.ts} +14 -16
- package/{esm/src → dist}/models/permission.d.ts +1 -2
- package/{script/npm/src/src/models/user/profile.d.ts → dist/models/profile.model.d.ts} +37 -43
- package/{script/npm/src/src/models/role.d.ts → dist/models/role.model.d.ts} +2 -10
- package/dist/models/statement-entry.model.d.ts +248 -0
- package/dist/models/user.model.d.ts +65 -0
- package/{script/npm/src/src/models/wallet/wallet.d.ts → dist/models/wallet.model.d.ts} +3 -46
- package/package.json +47 -24
- package/LICENSE +0 -7
- package/esm/mod.d.ts +0 -8
- package/esm/mod.d.ts.map +0 -1
- package/esm/mod.js +0 -7
- package/esm/package.json +0 -3
- package/esm/src/errors/api_error.d.ts.map +0 -1
- package/esm/src/errors/api_error.js +0 -90
- package/esm/src/errors/index.d.ts +0 -3
- package/esm/src/errors/index.d.ts.map +0 -1
- package/esm/src/errors/index.js +0 -2
- package/esm/src/errors/permission_error.d.ts +0 -48
- package/esm/src/errors/permission_error.d.ts.map +0 -1
- package/esm/src/errors/permission_error.js +0 -70
- package/esm/src/features/admin/contract.d.ts.map +0 -1
- package/esm/src/features/admin/contract.js +0 -210
- package/esm/src/features/admin/index.d.ts +0 -4
- package/esm/src/features/admin/index.d.ts.map +0 -1
- package/esm/src/features/admin/index.js +0 -3
- package/esm/src/features/admin/repository.d.ts +0 -114
- package/esm/src/features/admin/repository.d.ts.map +0 -1
- package/esm/src/features/admin/repository.js +0 -248
- package/esm/src/features/admin/schemas.d.ts +0 -146
- package/esm/src/features/admin/schemas.d.ts.map +0 -1
- package/esm/src/features/admin/schemas.js +0 -206
- package/esm/src/features/auth/access/contract.d.ts.map +0 -1
- package/esm/src/features/auth/access/contract.js +0 -14
- package/esm/src/features/auth/access/repository.d.ts +0 -11
- package/esm/src/features/auth/access/repository.d.ts.map +0 -1
- package/esm/src/features/auth/access/repository.js +0 -25
- package/esm/src/features/auth/contract.d.ts.map +0 -1
- package/esm/src/features/auth/contract.js +0 -43
- package/esm/src/features/auth/identity/contract.d.ts +0 -23
- package/esm/src/features/auth/identity/contract.d.ts.map +0 -1
- package/esm/src/features/auth/identity/contract.js +0 -17
- package/esm/src/features/auth/identity/repository.d.ts +0 -22
- package/esm/src/features/auth/identity/repository.d.ts.map +0 -1
- package/esm/src/features/auth/identity/repository.js +0 -30
- package/esm/src/features/auth/index.d.ts +0 -6
- package/esm/src/features/auth/index.d.ts.map +0 -1
- package/esm/src/features/auth/index.js +0 -5
- package/esm/src/features/auth/manager.d.ts +0 -105
- package/esm/src/features/auth/manager.d.ts.map +0 -1
- package/esm/src/features/auth/manager.js +0 -181
- package/esm/src/features/auth/profile/contract.d.ts +0 -37
- package/esm/src/features/auth/profile/contract.d.ts.map +0 -1
- package/esm/src/features/auth/profile/contract.js +0 -14
- package/esm/src/features/auth/profile/repository.d.ts +0 -11
- package/esm/src/features/auth/profile/repository.d.ts.map +0 -1
- package/esm/src/features/auth/profile/repository.js +0 -25
- package/esm/src/features/auth/repository.d.ts +0 -30
- package/esm/src/features/auth/repository.d.ts.map +0 -1
- package/esm/src/features/auth/repository.js +0 -69
- package/esm/src/features/auth/storage/client_store.d.ts +0 -30
- package/esm/src/features/auth/storage/client_store.d.ts.map +0 -1
- package/esm/src/features/auth/storage/client_store.js +0 -46
- package/esm/src/features/auth/storage/client_token_handler.d.ts.map +0 -1
- package/esm/src/features/auth/storage/client_token_handler.js +0 -36
- package/esm/src/features/auth/storage/server_store.d.ts +0 -24
- package/esm/src/features/auth/storage/server_store.d.ts.map +0 -1
- package/esm/src/features/auth/storage/server_store.js +0 -34
- package/esm/src/features/auth/storage/server_token_handler.d.ts +0 -36
- package/esm/src/features/auth/storage/server_token_handler.d.ts.map +0 -1
- package/esm/src/features/auth/storage/server_token_handler.js +0 -115
- package/esm/src/features/auth/storage/types.d.ts +0 -42
- package/esm/src/features/auth/storage/types.d.ts.map +0 -1
- package/esm/src/features/auth/storage/types.js +0 -1
- package/esm/src/features/contact/contract.d.ts.map +0 -1
- package/esm/src/features/contact/contract.js +0 -49
- package/esm/src/features/contact/index.d.ts +0 -2
- package/esm/src/features/contact/index.d.ts.map +0 -1
- package/esm/src/features/contact/index.js +0 -1
- package/esm/src/features/contact/repository.d.ts +0 -58
- package/esm/src/features/contact/repository.d.ts.map +0 -1
- package/esm/src/features/contact/repository.js +0 -108
- package/esm/src/features/payout/contract.d.ts.map +0 -1
- package/esm/src/features/payout/contract.js +0 -75
- package/esm/src/features/payout/index.d.ts +0 -2
- package/esm/src/features/payout/index.d.ts.map +0 -1
- package/esm/src/features/payout/index.js +0 -1
- package/esm/src/features/payout/repository.d.ts +0 -67
- package/esm/src/features/payout/repository.d.ts.map +0 -1
- package/esm/src/features/payout/repository.js +0 -163
- package/esm/src/features/wallet/contract.d.ts +0 -137
- package/esm/src/features/wallet/contract.d.ts.map +0 -1
- package/esm/src/features/wallet/contract.js +0 -38
- package/esm/src/features/wallet/index.d.ts +0 -2
- package/esm/src/features/wallet/index.d.ts.map +0 -1
- package/esm/src/features/wallet/index.js +0 -1
- package/esm/src/features/wallet/repository.d.ts +0 -57
- package/esm/src/features/wallet/repository.d.ts.map +0 -1
- package/esm/src/features/wallet/repository.js +0 -93
- package/esm/src/models/contact/derivatives/contact.d.ts +0 -172
- package/esm/src/models/contact/derivatives/contact.d.ts.map +0 -1
- package/esm/src/models/contact/derivatives/contact.js +0 -266
- package/esm/src/models/contact/derivatives/contact_info.d.ts +0 -188
- package/esm/src/models/contact/derivatives/contact_info.d.ts.map +0 -1
- package/esm/src/models/contact/derivatives/contact_info.js +0 -255
- package/esm/src/models/contact/index.d.ts +0 -5
- package/esm/src/models/contact/index.d.ts.map +0 -1
- package/esm/src/models/contact/index.js +0 -4
- package/esm/src/models/contact/schemas.d.ts +0 -66
- package/esm/src/models/contact/schemas.d.ts.map +0 -1
- package/esm/src/models/contact/schemas.js +0 -64
- package/esm/src/models/contact/validation.d.ts +0 -37
- package/esm/src/models/contact/validation.d.ts.map +0 -1
- package/esm/src/models/contact/validation.js +0 -146
- package/esm/src/models/index.d.ts +0 -7
- package/esm/src/models/index.d.ts.map +0 -1
- package/esm/src/models/index.js +0 -6
- package/esm/src/models/payout/api.d.ts +0 -29
- package/esm/src/models/payout/api.d.ts.map +0 -1
- package/esm/src/models/payout/api.js +0 -1
- package/esm/src/models/payout/channel.d.ts +0 -58
- package/esm/src/models/payout/channel.d.ts.map +0 -1
- package/esm/src/models/payout/channel.js +0 -53
- package/esm/src/models/payout/derivatives/payout.d.ts +0 -158
- package/esm/src/models/payout/derivatives/payout.d.ts.map +0 -1
- package/esm/src/models/payout/derivatives/payout.js +0 -265
- package/esm/src/models/payout/index.d.ts +0 -7
- package/esm/src/models/payout/index.d.ts.map +0 -1
- package/esm/src/models/payout/index.js +0 -6
- package/esm/src/models/payout/narration.d.ts +0 -164
- package/esm/src/models/payout/narration.d.ts.map +0 -1
- package/esm/src/models/payout/narration.js +0 -308
- package/esm/src/models/payout/schemas.d.ts +0 -156
- package/esm/src/models/payout/schemas.d.ts.map +0 -1
- package/esm/src/models/payout/schemas.js +0 -105
- package/esm/src/models/payout/status.d.ts +0 -33
- package/esm/src/models/payout/status.d.ts.map +0 -1
- package/esm/src/models/payout/status.js +0 -34
- package/esm/src/models/permission.d.ts.map +0 -1
- package/esm/src/models/permission.js +0 -50
- package/esm/src/models/role.d.ts +0 -21
- package/esm/src/models/role.d.ts.map +0 -1
- package/esm/src/models/role.js +0 -73
- package/esm/src/models/user/authenticated-user.d.ts +0 -77
- package/esm/src/models/user/authenticated-user.d.ts.map +0 -1
- package/esm/src/models/user/authenticated-user.js +0 -226
- package/esm/src/models/user/index.d.ts +0 -4
- package/esm/src/models/user/index.d.ts.map +0 -1
- package/esm/src/models/user/index.js +0 -3
- package/esm/src/models/user/managed-user.d.ts.map +0 -1
- package/esm/src/models/user/managed-user.js +0 -255
- package/esm/src/models/user/profile.d.ts +0 -161
- package/esm/src/models/user/profile.d.ts.map +0 -1
- package/esm/src/models/user/profile.js +0 -334
- package/esm/src/models/wallet/index.d.ts +0 -4
- package/esm/src/models/wallet/index.d.ts.map +0 -1
- package/esm/src/models/wallet/index.js +0 -3
- package/esm/src/models/wallet/schemas.d.ts +0 -95
- package/esm/src/models/wallet/schemas.d.ts.map +0 -1
- package/esm/src/models/wallet/schemas.js +0 -35
- package/esm/src/models/wallet/statement_entry.d.ts +0 -160
- package/esm/src/models/wallet/statement_entry.d.ts.map +0 -1
- package/esm/src/models/wallet/statement_entry.js +0 -255
- package/esm/src/models/wallet/wallet.d.ts +0 -147
- package/esm/src/models/wallet/wallet.d.ts.map +0 -1
- package/esm/src/models/wallet/wallet.js +0 -279
- package/esm/src/shared/base_repository.d.ts.map +0 -1
- package/esm/src/shared/base_repository.js +0 -153
- package/esm/src/shared/common_responses.d.ts +0 -13
- package/esm/src/shared/common_responses.d.ts.map +0 -1
- package/esm/src/shared/common_responses.js +0 -10
- package/esm/src/shared/index.d.ts +0 -3
- package/esm/src/shared/index.d.ts.map +0 -1
- package/esm/src/shared/index.js +0 -2
- package/esm/src/shared/token_required_repository.d.ts +0 -78
- package/esm/src/shared/token_required_repository.d.ts.map +0 -1
- package/esm/src/shared/token_required_repository.js +0 -128
- package/script/mod.d.ts +0 -8
- package/script/mod.d.ts.map +0 -1
- package/script/mod.js +0 -23
- package/script/npm/src/mod.d.ts +0 -8
- package/script/npm/src/mod.d.ts.map +0 -1
- package/script/npm/src/mod.js +0 -23
- package/script/npm/src/src/errors/api_error.d.ts +0 -63
- package/script/npm/src/src/errors/api_error.d.ts.map +0 -1
- package/script/npm/src/src/errors/api_error.js +0 -94
- package/script/npm/src/src/errors/index.d.ts +0 -3
- package/script/npm/src/src/errors/index.d.ts.map +0 -1
- package/script/npm/src/src/errors/index.js +0 -18
- package/script/npm/src/src/errors/permission_error.d.ts.map +0 -1
- package/script/npm/src/src/errors/permission_error.js +0 -74
- package/script/npm/src/src/features/admin/contract.d.ts +0 -842
- package/script/npm/src/src/features/admin/contract.d.ts.map +0 -1
- package/script/npm/src/src/features/admin/contract.js +0 -213
- package/script/npm/src/src/features/admin/index.d.ts +0 -4
- package/script/npm/src/src/features/admin/index.d.ts.map +0 -1
- package/script/npm/src/src/features/admin/index.js +0 -19
- package/script/npm/src/src/features/admin/repository.d.ts +0 -114
- package/script/npm/src/src/features/admin/repository.d.ts.map +0 -1
- package/script/npm/src/src/features/admin/repository.js +0 -252
- package/script/npm/src/src/features/admin/schemas.d.ts.map +0 -1
- package/script/npm/src/src/features/admin/schemas.js +0 -209
- package/script/npm/src/src/features/auth/access/contract.d.ts +0 -14
- package/script/npm/src/src/features/auth/access/contract.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/access/contract.js +0 -17
- package/script/npm/src/src/features/auth/access/repository.d.ts +0 -11
- package/script/npm/src/src/features/auth/access/repository.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/access/repository.js +0 -29
- package/script/npm/src/src/features/auth/contract.d.ts +0 -112
- package/script/npm/src/src/features/auth/contract.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/contract.js +0 -46
- package/script/npm/src/src/features/auth/identity/contract.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/identity/contract.js +0 -20
- package/script/npm/src/src/features/auth/identity/repository.d.ts +0 -22
- package/script/npm/src/src/features/auth/identity/repository.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/identity/repository.js +0 -34
- package/script/npm/src/src/features/auth/index.d.ts +0 -6
- package/script/npm/src/src/features/auth/index.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/index.js +0 -21
- package/script/npm/src/src/features/auth/manager.d.ts +0 -105
- package/script/npm/src/src/features/auth/manager.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/manager.js +0 -185
- package/script/npm/src/src/features/auth/profile/contract.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/profile/contract.js +0 -17
- package/script/npm/src/src/features/auth/profile/repository.d.ts +0 -11
- package/script/npm/src/src/features/auth/profile/repository.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/profile/repository.js +0 -29
- package/script/npm/src/src/features/auth/repository.d.ts +0 -30
- package/script/npm/src/src/features/auth/repository.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/repository.js +0 -73
- package/script/npm/src/src/features/auth/storage/client_store.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/storage/client_store.js +0 -51
- package/script/npm/src/src/features/auth/storage/client_token_handler.d.ts +0 -32
- package/script/npm/src/src/features/auth/storage/client_token_handler.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/storage/client_token_handler.js +0 -40
- package/script/npm/src/src/features/auth/storage/server_store.d.ts +0 -24
- package/script/npm/src/src/features/auth/storage/server_store.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/storage/server_store.js +0 -38
- package/script/npm/src/src/features/auth/storage/server_token_handler.d.ts +0 -36
- package/script/npm/src/src/features/auth/storage/server_token_handler.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/storage/server_token_handler.js +0 -119
- package/script/npm/src/src/features/auth/storage/types.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/storage/types.js +0 -2
- package/script/npm/src/src/features/contact/contract.d.ts +0 -170
- package/script/npm/src/src/features/contact/contract.d.ts.map +0 -1
- package/script/npm/src/src/features/contact/contract.js +0 -52
- package/script/npm/src/src/features/contact/index.d.ts +0 -2
- package/script/npm/src/src/features/contact/index.d.ts.map +0 -1
- package/script/npm/src/src/features/contact/index.js +0 -17
- package/script/npm/src/src/features/contact/repository.d.ts +0 -58
- package/script/npm/src/src/features/contact/repository.d.ts.map +0 -1
- package/script/npm/src/src/features/contact/repository.js +0 -112
- package/script/npm/src/src/features/payout/contract.d.ts +0 -623
- package/script/npm/src/src/features/payout/contract.d.ts.map +0 -1
- package/script/npm/src/src/features/payout/contract.js +0 -78
- package/script/npm/src/src/features/payout/index.d.ts +0 -2
- package/script/npm/src/src/features/payout/index.d.ts.map +0 -1
- package/script/npm/src/src/features/payout/index.js +0 -17
- package/script/npm/src/src/features/payout/repository.d.ts +0 -67
- package/script/npm/src/src/features/payout/repository.d.ts.map +0 -1
- package/script/npm/src/src/features/payout/repository.js +0 -167
- package/script/npm/src/src/features/wallet/contract.d.ts.map +0 -1
- package/script/npm/src/src/features/wallet/contract.js +0 -41
- package/script/npm/src/src/features/wallet/index.d.ts +0 -2
- package/script/npm/src/src/features/wallet/index.d.ts.map +0 -1
- package/script/npm/src/src/features/wallet/index.js +0 -17
- package/script/npm/src/src/features/wallet/repository.d.ts +0 -57
- package/script/npm/src/src/features/wallet/repository.d.ts.map +0 -1
- package/script/npm/src/src/features/wallet/repository.js +0 -97
- package/script/npm/src/src/models/contact/derivatives/contact.d.ts.map +0 -1
- package/script/npm/src/src/models/contact/derivatives/contact.js +0 -270
- package/script/npm/src/src/models/contact/derivatives/contact_info.d.ts +0 -188
- package/script/npm/src/src/models/contact/derivatives/contact_info.d.ts.map +0 -1
- package/script/npm/src/src/models/contact/derivatives/contact_info.js +0 -260
- package/script/npm/src/src/models/contact/index.d.ts +0 -5
- package/script/npm/src/src/models/contact/index.d.ts.map +0 -1
- package/script/npm/src/src/models/contact/index.js +0 -20
- package/script/npm/src/src/models/contact/schemas.d.ts +0 -66
- package/script/npm/src/src/models/contact/schemas.d.ts.map +0 -1
- package/script/npm/src/src/models/contact/schemas.js +0 -67
- package/script/npm/src/src/models/contact/validation.d.ts +0 -37
- package/script/npm/src/src/models/contact/validation.d.ts.map +0 -1
- package/script/npm/src/src/models/contact/validation.js +0 -153
- package/script/npm/src/src/models/index.d.ts +0 -7
- package/script/npm/src/src/models/index.d.ts.map +0 -1
- package/script/npm/src/src/models/index.js +0 -22
- package/script/npm/src/src/models/payout/api.d.ts +0 -29
- package/script/npm/src/src/models/payout/api.d.ts.map +0 -1
- package/script/npm/src/src/models/payout/api.js +0 -2
- package/script/npm/src/src/models/payout/channel.d.ts +0 -58
- package/script/npm/src/src/models/payout/channel.d.ts.map +0 -1
- package/script/npm/src/src/models/payout/channel.js +0 -56
- package/script/npm/src/src/models/payout/derivatives/payout.d.ts.map +0 -1
- package/script/npm/src/src/models/payout/derivatives/payout.js +0 -269
- package/script/npm/src/src/models/payout/index.d.ts +0 -7
- package/script/npm/src/src/models/payout/index.d.ts.map +0 -1
- package/script/npm/src/src/models/payout/index.js +0 -22
- package/script/npm/src/src/models/payout/narration.d.ts +0 -164
- package/script/npm/src/src/models/payout/narration.d.ts.map +0 -1
- package/script/npm/src/src/models/payout/narration.js +0 -312
- package/script/npm/src/src/models/payout/schemas.d.ts +0 -156
- package/script/npm/src/src/models/payout/schemas.d.ts.map +0 -1
- package/script/npm/src/src/models/payout/schemas.js +0 -108
- package/script/npm/src/src/models/payout/status.d.ts +0 -33
- package/script/npm/src/src/models/payout/status.d.ts.map +0 -1
- package/script/npm/src/src/models/payout/status.js +0 -37
- package/script/npm/src/src/models/permission.d.ts +0 -55
- package/script/npm/src/src/models/permission.d.ts.map +0 -1
- package/script/npm/src/src/models/permission.js +0 -53
- package/script/npm/src/src/models/role.d.ts.map +0 -1
- package/script/npm/src/src/models/role.js +0 -77
- package/script/npm/src/src/models/user/authenticated-user.d.ts +0 -77
- package/script/npm/src/src/models/user/authenticated-user.d.ts.map +0 -1
- package/script/npm/src/src/models/user/authenticated-user.js +0 -230
- package/script/npm/src/src/models/user/index.d.ts +0 -4
- package/script/npm/src/src/models/user/index.d.ts.map +0 -1
- package/script/npm/src/src/models/user/index.js +0 -19
- package/script/npm/src/src/models/user/managed-user.d.ts +0 -108
- package/script/npm/src/src/models/user/managed-user.d.ts.map +0 -1
- package/script/npm/src/src/models/user/managed-user.js +0 -260
- package/script/npm/src/src/models/user/profile.d.ts.map +0 -1
- package/script/npm/src/src/models/user/profile.js +0 -338
- package/script/npm/src/src/models/wallet/index.d.ts +0 -4
- package/script/npm/src/src/models/wallet/index.d.ts.map +0 -1
- package/script/npm/src/src/models/wallet/index.js +0 -19
- package/script/npm/src/src/models/wallet/schemas.d.ts +0 -95
- package/script/npm/src/src/models/wallet/schemas.d.ts.map +0 -1
- package/script/npm/src/src/models/wallet/schemas.js +0 -38
- package/script/npm/src/src/models/wallet/statement_entry.d.ts +0 -160
- package/script/npm/src/src/models/wallet/statement_entry.d.ts.map +0 -1
- package/script/npm/src/src/models/wallet/statement_entry.js +0 -259
- package/script/npm/src/src/models/wallet/wallet.d.ts.map +0 -1
- package/script/npm/src/src/models/wallet/wallet.js +0 -283
- package/script/npm/src/src/shared/base_repository.d.ts +0 -80
- package/script/npm/src/src/shared/base_repository.d.ts.map +0 -1
- package/script/npm/src/src/shared/base_repository.js +0 -157
- package/script/npm/src/src/shared/common_responses.d.ts.map +0 -1
- package/script/npm/src/src/shared/common_responses.js +0 -13
- package/script/npm/src/src/shared/index.d.ts +0 -3
- package/script/npm/src/src/shared/index.d.ts.map +0 -1
- package/script/npm/src/src/shared/index.js +0 -18
- package/script/npm/src/src/shared/token_required_repository.d.ts +0 -78
- package/script/npm/src/src/shared/token_required_repository.d.ts.map +0 -1
- package/script/npm/src/src/shared/token_required_repository.js +0 -132
- package/script/package.json +0 -3
|
@@ -0,0 +1,817 @@
|
|
|
1
|
+
import { Bank, ISO2CountryCode, PhoneNumber } from "@temboplus/frontend-core";
|
|
2
|
+
import { PayoutDTO } from "../features/payout";
|
|
3
|
+
import { ContactType, ContactDTO } from "../features/contact/contact.dtos";
|
|
4
|
+
import type { BankSwiftCode, MNOId } from "@temboplus/frontend-core";
|
|
5
|
+
/**
|
|
6
|
+
* Abstract base class that provides a common interface for different types of contact information.
|
|
7
|
+
* This class defines the structure and validation requirements for both mobile and bank contacts.
|
|
8
|
+
*
|
|
9
|
+
* Serves as the foundation for type-safe contact handling throughout the application,
|
|
10
|
+
* ensuring consistent behavior between mobile money and bank transfer contacts.
|
|
11
|
+
*
|
|
12
|
+
* @abstract
|
|
13
|
+
* @class BaseContactInfo
|
|
14
|
+
*
|
|
15
|
+
* @property {ContactType} type - The type of contact (either "Mobile" or "Bank")
|
|
16
|
+
* @property {ISO2CountryCode} countryCode - The ISO2 country code where this contact operates
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // Cannot instantiate directly - use concrete implementations
|
|
21
|
+
* const mobileContact = new MobileContactInfo("John Doe", phoneNumber);
|
|
22
|
+
* const bankContact = new BankContactInfo("Jane Smith", bank, "123456789");
|
|
23
|
+
*
|
|
24
|
+
* // Polymorphic usage
|
|
25
|
+
* function processContact(contact: BaseContactInfo) {
|
|
26
|
+
* console.log(`Processing ${contact.type} contact: ${contact.displayName}`);
|
|
27
|
+
* console.log(`Channel: ${contact.channelDisplayName}`);
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
declare abstract class BaseContactInfo {
|
|
32
|
+
readonly type: ContactType;
|
|
33
|
+
readonly countryCode: ISO2CountryCode;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new instance of BaseContactInfo.
|
|
36
|
+
* Protected constructor ensures only subclasses can instantiate.
|
|
37
|
+
*
|
|
38
|
+
* @protected
|
|
39
|
+
* @param {ContactType} type - The type of contact to create ("Mobile" or "Bank")
|
|
40
|
+
* @param {ISO2CountryCode} countryCode - The ISO2 country code for this contact
|
|
41
|
+
*/
|
|
42
|
+
constructor(type: ContactType, countryCode: ISO2CountryCode);
|
|
43
|
+
/**
|
|
44
|
+
* Gets the typed channel identifier for the contact.
|
|
45
|
+
* Returns MNO ID for mobile contacts, SWIFT code for bank contacts.
|
|
46
|
+
*
|
|
47
|
+
* @abstract
|
|
48
|
+
* @returns {MNOId | BankSwiftCode} The typed channel identifier
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const mobileChannel: MNOId = mobileContact.channelId; // "VODACOM", "SAFARICOM", etc.
|
|
53
|
+
* const bankChannel: BankSwiftCode = bankContact.channelId; // "CORUTZTZ", "KCBLKENX", etc.
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
abstract get channelId(): MNOId | BankSwiftCode;
|
|
57
|
+
/**
|
|
58
|
+
* Gets the human-readable channel name for display purposes.
|
|
59
|
+
* Returns mobile money service name for mobile contacts, bank short name for bank contacts.
|
|
60
|
+
*
|
|
61
|
+
* @abstract
|
|
62
|
+
* @returns {string} The display-friendly channel name
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* console.log(mobileContact.channelName); // "M-Pesa", "Airtel Money", etc.
|
|
67
|
+
* console.log(bankContact.channelName); // "CRDB", "KCB", etc.
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
abstract get channelName(): string;
|
|
71
|
+
/**
|
|
72
|
+
* Gets the primary display name for the contact.
|
|
73
|
+
*
|
|
74
|
+
* @abstract
|
|
75
|
+
* @returns {string} The contact's display name (personal name for mobile, account name for bank)
|
|
76
|
+
*/
|
|
77
|
+
abstract get accountName(): string;
|
|
78
|
+
/**
|
|
79
|
+
* Gets the primary account/identification number for the contact.
|
|
80
|
+
*
|
|
81
|
+
* @abstract
|
|
82
|
+
* @returns {string} The contact's number (phone number for mobile, account number for bank)
|
|
83
|
+
*/
|
|
84
|
+
abstract get accountNumber(): string;
|
|
85
|
+
/**
|
|
86
|
+
* Gets the localized label for the display name field.
|
|
87
|
+
*
|
|
88
|
+
* @abstract
|
|
89
|
+
* @returns {string} The appropriate label for the display name based on contact type
|
|
90
|
+
*/
|
|
91
|
+
abstract get accountNameLabel(): string;
|
|
92
|
+
/**
|
|
93
|
+
* Gets the localized label for the account number field.
|
|
94
|
+
*
|
|
95
|
+
* @abstract
|
|
96
|
+
* @returns {string} The appropriate label for the account number based on contact type
|
|
97
|
+
*/
|
|
98
|
+
abstract get accountNumberLabel(): string;
|
|
99
|
+
/**
|
|
100
|
+
* Gets the localized label for the channel field.
|
|
101
|
+
*
|
|
102
|
+
* @abstract
|
|
103
|
+
* @returns {string} The appropriate label for the channel based on contact type
|
|
104
|
+
*/
|
|
105
|
+
abstract get channelLabel(): string;
|
|
106
|
+
/**
|
|
107
|
+
* Validates that all contact information is consistent and correct.
|
|
108
|
+
*
|
|
109
|
+
* @abstract
|
|
110
|
+
* @returns {boolean} True if the contact information is valid
|
|
111
|
+
*/
|
|
112
|
+
abstract validate(): boolean;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Implementation of BaseContactInfo for mobile phone contacts.
|
|
116
|
+
* Handles storage, validation, and display of contact details specific to mobile money services.
|
|
117
|
+
*
|
|
118
|
+
* This class properly delegates MNO-related logic to country-specific implementations,
|
|
119
|
+
* supporting both countries with Mobile Number Portability (MNP) and those without.
|
|
120
|
+
*
|
|
121
|
+
* **Key Features:**
|
|
122
|
+
* - Automatic MNO detection for countries without MNP (e.g., Tanzania)
|
|
123
|
+
* - Explicit MNO requirement for countries with MNP (e.g., Kenya)
|
|
124
|
+
* - Country-specific validation through MNOUtils delegation
|
|
125
|
+
* - Comprehensive error handling with structured context
|
|
126
|
+
*
|
|
127
|
+
* **MNP Handling:**
|
|
128
|
+
* - **Tanzania (no MNP)**: MNO can be auto-detected from phone number prefix
|
|
129
|
+
* - **Kenya (has MNP)**: MNO must be explicitly provided as numbers can be ported
|
|
130
|
+
*
|
|
131
|
+
* @extends BaseContactInfo
|
|
132
|
+
* @class MobileContactInfo
|
|
133
|
+
*
|
|
134
|
+
* @property {string} name - The contact's personal name
|
|
135
|
+
* @property {PhoneNumber} phoneNumber - The validated phone number object
|
|
136
|
+
* @property {MNOId} mnoId - The mobile network operator identifier (always available after construction)
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* // Tanzania - MNO auto-detected from prefix
|
|
141
|
+
* const tzContact = new MobileContactInfo("John Doe", tzPhoneNumber);
|
|
142
|
+
* console.log(tzContact.channel); // "VODACOM" (auto-detected)
|
|
143
|
+
*
|
|
144
|
+
* // Tanzania - Explicit MNO (validated against prefix)
|
|
145
|
+
* const tzExplicit = new MobileContactInfo("John Doe", tzPhoneNumber, TZMNOId.VODACOM);
|
|
146
|
+
*
|
|
147
|
+
* // Kenya - MNO must be explicit due to MNP
|
|
148
|
+
* const keContact = new MobileContactInfo("Jane Smith", kePhoneNumber, KEMNOId.SAFARICOM);
|
|
149
|
+
*
|
|
150
|
+
* // Kenya - This would throw an error (MNO required)
|
|
151
|
+
* // const keContact = new MobileContactInfo("Jane Smith", kePhoneNumber); // ❌ Error
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
* @throws {ContactInfoError} When validation fails (invalid name, phone, or MNO)
|
|
155
|
+
*/
|
|
156
|
+
export declare class MobileContactInfo extends BaseContactInfo {
|
|
157
|
+
readonly name: string;
|
|
158
|
+
readonly phoneNumber: PhoneNumber;
|
|
159
|
+
readonly mnoId: MNOId;
|
|
160
|
+
/**
|
|
161
|
+
* Creates a new mobile contact with comprehensive validation.
|
|
162
|
+
*
|
|
163
|
+
* **Validation Process:**
|
|
164
|
+
* 1. Validates name is non-empty
|
|
165
|
+
* 2. Validates phone number structure
|
|
166
|
+
* 3. Handles MNO validation based on country MNP status:
|
|
167
|
+
* - **Countries with MNP (KE)**: Requires explicit MNO, validates it's valid for country
|
|
168
|
+
* - **Countries without MNP (TZ)**: Can auto-detect or validate explicit MNO against prefix
|
|
169
|
+
*
|
|
170
|
+
* @param {string} name - The contact's personal name (required, non-empty)
|
|
171
|
+
* @param {PhoneNumber} phoneNumber - The validated phone number object
|
|
172
|
+
* @param {MNOId} [mnoId] - Optional MNO ID. Required for MNP countries (KE), optional for non-MNP (TZ)
|
|
173
|
+
*
|
|
174
|
+
* @throws {ContactInfoError} When any validation fails:
|
|
175
|
+
* - Empty or invalid name
|
|
176
|
+
* - Invalid phone number structure
|
|
177
|
+
* - Invalid MNO for the country
|
|
178
|
+
* - MNO-phone number mismatch (for non-MNP countries)
|
|
179
|
+
* - Missing MNO for MNP countries
|
|
180
|
+
* - Unable to auto-detect MNO for non-MNP countries
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* try {
|
|
185
|
+
* // All these are valid
|
|
186
|
+
* const tzAuto = new MobileContactInfo("John", tzPhone);
|
|
187
|
+
* const tzExplicit = new MobileContactInfo("John", tzPhone, TZMNOId.VODACOM);
|
|
188
|
+
* const keExplicit = new MobileContactInfo("Jane", kePhone, KEMNOId.SAFARICOM);
|
|
189
|
+
* } catch (error) {
|
|
190
|
+
* if (error instanceof ContactInfoError) {
|
|
191
|
+
* console.log(`${error.message} - Context:`, error.context);
|
|
192
|
+
* }
|
|
193
|
+
* }
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
constructor(name: string, phoneNumber: PhoneNumber, mnoId?: MNOId);
|
|
197
|
+
/**
|
|
198
|
+
* Creates a MobileContactInfo instance from a ContactDTO object.
|
|
199
|
+
* Handles validation and MNO extraction from the DTO's channel field.
|
|
200
|
+
*
|
|
201
|
+
* **Process:**
|
|
202
|
+
* 1. Validates DTO type is "Mobile"
|
|
203
|
+
* 2. Validates country code format
|
|
204
|
+
* 3. Parses phone number with country context
|
|
205
|
+
* 4. Extracts and validates MNO from channel field (if provided)
|
|
206
|
+
* 5. Delegates to constructor for final validation
|
|
207
|
+
*
|
|
208
|
+
* @static
|
|
209
|
+
* @param {ContactDTO} info - The contact data transfer object
|
|
210
|
+
* @param {string} info.type - Must be "Mobile"
|
|
211
|
+
* @param {string} info.accountNo - The phone number string to parse
|
|
212
|
+
* @param {string} info.countryCode - ISO2 country code
|
|
213
|
+
* @param {string} info.displayName - The contact's name
|
|
214
|
+
* @param {string} [info.channel] - Optional MNO ID (required for MNP countries)
|
|
215
|
+
*
|
|
216
|
+
* @returns {MobileContactInfo | undefined} New instance if successful, undefined if validation fails
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```typescript
|
|
220
|
+
* const contactDTO = {
|
|
221
|
+
* type: "Mobile",
|
|
222
|
+
* accountNo: "+255712345678",
|
|
223
|
+
* countryCode: "TZ",
|
|
224
|
+
* displayName: "John Doe",
|
|
225
|
+
* channel: "VODACOM" // Optional for TZ, required for KE
|
|
226
|
+
* };
|
|
227
|
+
*
|
|
228
|
+
* const contact = MobileContactInfo.fromContactDTO(contactDTO);
|
|
229
|
+
* if (contact) {
|
|
230
|
+
* console.log(`Created contact: ${contact.displayName}`);
|
|
231
|
+
* }
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
static fromContactDTO(info: ContactDTO): MobileContactInfo | undefined;
|
|
235
|
+
/**
|
|
236
|
+
* Creates a MobileContactInfo instance from a PayoutDTO object.
|
|
237
|
+
* Extracts mobile contact information from payout data structure.
|
|
238
|
+
*
|
|
239
|
+
* **Process:**
|
|
240
|
+
* 1. Validates country code format
|
|
241
|
+
* 2. Parses phone number from msisdn field
|
|
242
|
+
* 3. Extracts MNO from channel field (if available)
|
|
243
|
+
* 4. Uses payeeName as the contact name
|
|
244
|
+
* 5. Delegates to constructor for validation
|
|
245
|
+
*
|
|
246
|
+
* @static
|
|
247
|
+
* @param {PayoutDTO} info - The payout data transfer object
|
|
248
|
+
* @param {string} info.msisdn - The phone number in various formats
|
|
249
|
+
* @param {string} info.countryCode - ISO2 country code
|
|
250
|
+
* @param {string} info.payeeName - The recipient's name
|
|
251
|
+
* @param {string} [info.channel] - Optional MNO ID
|
|
252
|
+
*
|
|
253
|
+
* @returns {MobileContactInfo | undefined} New instance if successful, undefined if parsing fails
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```typescript
|
|
257
|
+
* const payoutDTO = {
|
|
258
|
+
* msisdn: "+254712345678",
|
|
259
|
+
* countryCode: "KE",
|
|
260
|
+
* payeeName: "Jane Smith",
|
|
261
|
+
* channel: "SAFARICOM"
|
|
262
|
+
* };
|
|
263
|
+
*
|
|
264
|
+
* const contact = MobileContactInfo.fromPayoutDTO(payoutDTO);
|
|
265
|
+
* if (contact) {
|
|
266
|
+
* console.log(`Payout contact: ${contact.displayName} via ${contact.channelDisplayName}`);
|
|
267
|
+
* }
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
|
+
static fromPayoutDTO(info: PayoutDTO): MobileContactInfo | undefined;
|
|
271
|
+
/**
|
|
272
|
+
* Type guard to validate if an unknown object is a valid MobileContactInfo instance.
|
|
273
|
+
* Performs comprehensive structural and data validation including country-specific MNO rules.
|
|
274
|
+
*
|
|
275
|
+
* **Validation Process:**
|
|
276
|
+
* 1. **Structural validation**: Checks required properties exist with correct types
|
|
277
|
+
* 2. **Name validation**: Ensures name is non-empty string
|
|
278
|
+
* 3. **Phone validation**: Validates phone number can be parsed and is valid
|
|
279
|
+
* 4. **MNO validation**: Country-specific validation:
|
|
280
|
+
* - **MNP countries (KE)**: Validates MNO ID is valid for country
|
|
281
|
+
* - **Non-MNP countries (TZ)**: Validates MNO matches phone number prefix
|
|
282
|
+
*
|
|
283
|
+
* @static
|
|
284
|
+
* @param {unknown} obj - The object to validate
|
|
285
|
+
* @returns {obj is MobileContactInfo} Type predicate indicating validity
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```typescript
|
|
289
|
+
* const unknownData = JSON.parse(someJsonString);
|
|
290
|
+
*
|
|
291
|
+
* if (MobileContactInfo.is(unknownData)) {
|
|
292
|
+
* // TypeScript now knows this is MobileContactInfo
|
|
293
|
+
* console.log(unknownData.name); // ✅ Type-safe access
|
|
294
|
+
* console.log(unknownData.phoneNumber.e164Format); // ✅ Type-safe
|
|
295
|
+
* console.log(unknownData.mnoId); // ✅ Type-safe
|
|
296
|
+
* } else {
|
|
297
|
+
* console.log("Invalid MobileContactInfo structure");
|
|
298
|
+
* }
|
|
299
|
+
*
|
|
300
|
+
* // Usage in arrays
|
|
301
|
+
* const contacts = jsonArray.filter(MobileContactInfo.is);
|
|
302
|
+
* // contacts is now typed as MobileContactInfo[]
|
|
303
|
+
* ```
|
|
304
|
+
*
|
|
305
|
+
* @remarks
|
|
306
|
+
* - Validates both serialized and live objects
|
|
307
|
+
* - Phone numbers can be provided as strings or PhoneNumber objects
|
|
308
|
+
* - Uses country-specific MNO validation through MNOUtils
|
|
309
|
+
* - Returns false for any validation failure (fail-fast approach)
|
|
310
|
+
*/
|
|
311
|
+
static is(obj: unknown): obj is MobileContactInfo;
|
|
312
|
+
/**
|
|
313
|
+
* Validates that all contact information is consistent and correct.
|
|
314
|
+
* Uses country-specific validation logic through MNOUtils delegation.
|
|
315
|
+
*
|
|
316
|
+
* **Validation Checks:**
|
|
317
|
+
* 1. **Name validation**: Non-empty string
|
|
318
|
+
* 2. **Phone validation**: Valid phone number structure
|
|
319
|
+
* 3. **MNO validation**: Valid MNO for the country
|
|
320
|
+
* 4. **Consistency check**: For non-MNP countries, validates MNO matches phone prefix
|
|
321
|
+
*
|
|
322
|
+
* @returns {boolean} True if all validations pass, false otherwise
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```typescript
|
|
326
|
+
* const contact = new MobileContactInfo("John", phoneNumber, TZMNOId.VODACOM);
|
|
327
|
+
*
|
|
328
|
+
* if (contact.validate()) {
|
|
329
|
+
* console.log("Contact is valid and ready to use");
|
|
330
|
+
* } else {
|
|
331
|
+
* console.log("Contact has validation issues");
|
|
332
|
+
* // Use getValidationDetails() for specific error information
|
|
333
|
+
* }
|
|
334
|
+
* ```
|
|
335
|
+
*
|
|
336
|
+
* @see {@link getValidationDetails} For detailed validation results with specific errors
|
|
337
|
+
*/
|
|
338
|
+
/**
|
|
339
|
+
* Validates that all bank contact information meets banking industry standards.
|
|
340
|
+
* Uses comprehensive validation rules for account names, numbers, and bank data.
|
|
341
|
+
*
|
|
342
|
+
* **Validation Checks:**
|
|
343
|
+
* 1. **Account name**: Format, length, and character requirements
|
|
344
|
+
* 2. **Account number**: Country-specific format validation
|
|
345
|
+
* 3. **Bank data**: SWIFT code validity and institution data integrity
|
|
346
|
+
*
|
|
347
|
+
* @returns {boolean} True if all validations pass, false otherwise
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
* ```typescript
|
|
351
|
+
* const contact = new BankContactInfo("John Doe", bank, "0150123456789");
|
|
352
|
+
*
|
|
353
|
+
* if (contact.validate()) {
|
|
354
|
+
* console.log("Bank contact is ready for transactions");
|
|
355
|
+
* } else {
|
|
356
|
+
* console.log("Bank contact has validation issues");
|
|
357
|
+
* }
|
|
358
|
+
* ```
|
|
359
|
+
*
|
|
360
|
+
* @remarks
|
|
361
|
+
* Uses BankValidation utility methods for industry-standard validation rules.
|
|
362
|
+
* All validation must pass for the contact to be considered valid.
|
|
363
|
+
*/
|
|
364
|
+
validate(): boolean;
|
|
365
|
+
/**
|
|
366
|
+
* Provides detailed validation results with specific error and warning information.
|
|
367
|
+
* Uses country-specific validation logic for comprehensive analysis.
|
|
368
|
+
*
|
|
369
|
+
* **Validation Categories:**
|
|
370
|
+
* - **Errors**: Critical issues that make the contact invalid
|
|
371
|
+
* - **Warnings**: Potential issues that don't prevent usage but indicate inconsistencies
|
|
372
|
+
*
|
|
373
|
+
* @returns {Object} Detailed validation results
|
|
374
|
+
* @returns {boolean} returns.isValid - True if no errors found
|
|
375
|
+
* @returns {string[]} returns.errors - Array of error messages for critical issues
|
|
376
|
+
* @returns {string[]} returns.warnings - Array of warning messages for potential issues
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```typescript
|
|
380
|
+
* const contact = new MobileContactInfo("John", phoneNumber, TZMNOId.AIRTEL);
|
|
381
|
+
* const validation = contact.getValidationDetails();
|
|
382
|
+
*
|
|
383
|
+
* console.log(`Valid: ${validation.isValid}`);
|
|
384
|
+
*
|
|
385
|
+
* if (validation.errors.length > 0) {
|
|
386
|
+
* console.log("Errors found:");
|
|
387
|
+
* validation.errors.forEach(error => console.log(`- ${error}`));
|
|
388
|
+
* }
|
|
389
|
+
*
|
|
390
|
+
* if (validation.warnings.length > 0) {
|
|
391
|
+
* console.log("Warnings:");
|
|
392
|
+
* validation.warnings.forEach(warning => console.log(`- ${warning}`));
|
|
393
|
+
* }
|
|
394
|
+
*
|
|
395
|
+
* // Example output for TZ number with wrong MNO:
|
|
396
|
+
* // Valid: false
|
|
397
|
+
* // Errors:
|
|
398
|
+
* // - Invalid MNO AIRTEL for country TZ
|
|
399
|
+
* // Warnings:
|
|
400
|
+
* // - MNO doesn't match phone number prefix - possible data inconsistency
|
|
401
|
+
* ```
|
|
402
|
+
*
|
|
403
|
+
* @remarks
|
|
404
|
+
* Uses MNOUtils for country-specific validation logic:
|
|
405
|
+
* - **Tanzania**: Validates MNO against phone number prefix
|
|
406
|
+
* - **Kenya**: Acknowledges MNP limitations, focuses on MNO validity
|
|
407
|
+
*/
|
|
408
|
+
getValidationDetails(): {
|
|
409
|
+
isValid: boolean;
|
|
410
|
+
errors: string[];
|
|
411
|
+
warnings: string[];
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* Gets the contact's personal name for display purposes.
|
|
415
|
+
*
|
|
416
|
+
* @override
|
|
417
|
+
* @returns {string} The contact's personal name
|
|
418
|
+
*/
|
|
419
|
+
get accountName(): string;
|
|
420
|
+
/**
|
|
421
|
+
* Gets the phone number formatted for display and storage.
|
|
422
|
+
* Returns the number in international numeric format (without + prefix).
|
|
423
|
+
*
|
|
424
|
+
* @override
|
|
425
|
+
* @returns {string} Phone number in international numeric format (e.g., "255712345678")
|
|
426
|
+
*
|
|
427
|
+
* @example
|
|
428
|
+
* ```typescript
|
|
429
|
+
* const contact = new MobileContactInfo("John", phoneNumber);
|
|
430
|
+
* console.log(contact.accNumber); // "255712345678"
|
|
431
|
+
* ```
|
|
432
|
+
*/
|
|
433
|
+
get accountNumber(): string;
|
|
434
|
+
/**
|
|
435
|
+
* Gets the localized label for the display name field.
|
|
436
|
+
*
|
|
437
|
+
* @override
|
|
438
|
+
* @returns {string} Always returns "Name" for mobile contacts
|
|
439
|
+
*/
|
|
440
|
+
get accountNameLabel(): string;
|
|
441
|
+
/**
|
|
442
|
+
* Gets the localized label for the account number field.
|
|
443
|
+
*
|
|
444
|
+
* @override
|
|
445
|
+
* @returns {string} Always returns "Phone Number" for mobile contacts
|
|
446
|
+
*/
|
|
447
|
+
get accountNumberLabel(): string;
|
|
448
|
+
/**
|
|
449
|
+
* Gets the localized label for the channel field.
|
|
450
|
+
*
|
|
451
|
+
* @override
|
|
452
|
+
* @returns {string} Always returns "Channel" for mobile contacts
|
|
453
|
+
*/
|
|
454
|
+
get channelLabel(): string;
|
|
455
|
+
/**
|
|
456
|
+
* Gets the typed MNO identifier for this mobile contact.
|
|
457
|
+
* This is the programmatic identifier used for API calls and business logic.
|
|
458
|
+
*
|
|
459
|
+
* @returns {MNOId} The MNO identifier (e.g., "VODACOM", "SAFARICOM")
|
|
460
|
+
*
|
|
461
|
+
* @example
|
|
462
|
+
* ```typescript
|
|
463
|
+
* const contact = new MobileContactInfo("John", tzPhone, TZMNOId.VODACOM);
|
|
464
|
+
* console.log(contact.channel); // "VODACOM"
|
|
465
|
+
*
|
|
466
|
+
* // Type-safe usage
|
|
467
|
+
* if (contact.channel === TZMNOId.VODACOM) {
|
|
468
|
+
* console.log("This is a Vodacom number");
|
|
469
|
+
* }
|
|
470
|
+
* ```
|
|
471
|
+
*/
|
|
472
|
+
get channelId(): MNOId;
|
|
473
|
+
/**
|
|
474
|
+
* Gets the human-readable mobile money service name for display purposes.
|
|
475
|
+
* Uses MNOUtils to retrieve service information from country-specific implementations.
|
|
476
|
+
*
|
|
477
|
+
* **Behavior:**
|
|
478
|
+
* - Returns the mobile money service name (e.g., "M-Pesa", "Airtel Money")
|
|
479
|
+
* - Falls back to MNO display name if service name unavailable
|
|
480
|
+
* - Falls back to MNO ID if no display information available
|
|
481
|
+
*
|
|
482
|
+
* @returns {string} The mobile money service name for display
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* ```typescript
|
|
486
|
+
* const vodacomContact = new MobileContactInfo("John", tzPhone, TZMNOId.VODACOM);
|
|
487
|
+
* console.log(vodacomContact.channelDisplayName); // "M-Pesa"
|
|
488
|
+
*
|
|
489
|
+
* const safaricomContact = new MobileContactInfo("Jane", kePhone, KEMNOId.SAFARICOM);
|
|
490
|
+
* console.log(safaricomContact.channelDisplayName); // "M-Pesa"
|
|
491
|
+
*
|
|
492
|
+
* const airtelContact = new MobileContactInfo("Bob", tzPhone, TZMNOId.AIRTEL);
|
|
493
|
+
* console.log(airtelContact.channelDisplayName); // "Airtel Money"
|
|
494
|
+
* ```
|
|
495
|
+
*
|
|
496
|
+
* @remarks
|
|
497
|
+
* Uses MNOUtils.getMNOById() which delegates to country-specific implementations
|
|
498
|
+
* for consistent and accurate service name retrieval.
|
|
499
|
+
*/
|
|
500
|
+
get channelName(): string;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Implementation of BaseContactInfo for bank account contacts.
|
|
504
|
+
* Handles storage, validation, and display of contact details specific to bank transfers.
|
|
505
|
+
*
|
|
506
|
+
* This class provides comprehensive validation for bank account information including
|
|
507
|
+
* SWIFT code validation, account name verification, and account number format checking.
|
|
508
|
+
*
|
|
509
|
+
* **Key Features:**
|
|
510
|
+
* - SWIFT code validation per country regulations
|
|
511
|
+
* - Account name format validation
|
|
512
|
+
* - Account number format validation (country-specific rules)
|
|
513
|
+
* - Integration with Bank service for institution data
|
|
514
|
+
*
|
|
515
|
+
* @extends BaseContactInfo
|
|
516
|
+
* @class BankContactInfo
|
|
517
|
+
*
|
|
518
|
+
* @property {string} accName - The bank account holder's name
|
|
519
|
+
* @property {Bank} bank - The bank institution object with SWIFT code and details
|
|
520
|
+
* @property {string} accNo - The bank account number
|
|
521
|
+
*
|
|
522
|
+
* @example
|
|
523
|
+
* ```typescript
|
|
524
|
+
* // Create bank contact with validation
|
|
525
|
+
* const bank = Bank.from("CORUTZTZ", "TZ"); // CRDB Bank
|
|
526
|
+
* const contact = new BankContactInfo("John Doe", bank, "0150123456789");
|
|
527
|
+
*
|
|
528
|
+
* console.log(contact.channel); // "CORUTZTZ" (SWIFT code)
|
|
529
|
+
* console.log(contact.channelDisplayName); // "CRDB" (bank short name)
|
|
530
|
+
* console.log(contact.displayName); // "John Doe"
|
|
531
|
+
* console.log(contact.accNumber); // "0150123456789"
|
|
532
|
+
* ```
|
|
533
|
+
*
|
|
534
|
+
* @throws {ContactInfoError} When validation fails (invalid account name, number, or bank)
|
|
535
|
+
*/
|
|
536
|
+
export declare class BankContactInfo extends BaseContactInfo {
|
|
537
|
+
readonly accName: string;
|
|
538
|
+
readonly bank: Bank;
|
|
539
|
+
readonly accNo: string;
|
|
540
|
+
/**
|
|
541
|
+
* Creates a new bank contact with comprehensive validation.
|
|
542
|
+
*
|
|
543
|
+
* **Validation Process:**
|
|
544
|
+
* 1. **Account name validation**: Checks format and character requirements
|
|
545
|
+
* 2. **Account number validation**: Validates format per country banking rules
|
|
546
|
+
* 3. **Bank validation**: Ensures bank object is valid and contains required data
|
|
547
|
+
*
|
|
548
|
+
* @param {string} accName - The bank account holder's name (must pass BankValidation.validateAccountName)
|
|
549
|
+
* @param {Bank} bank - The bank institution object (must be valid Bank instance)
|
|
550
|
+
* @param {string} accNo - The bank account number (must pass country-specific validation)
|
|
551
|
+
*
|
|
552
|
+
* @throws {ContactInfoError} When validation fails:
|
|
553
|
+
* - Invalid account name format
|
|
554
|
+
* - Invalid account number format for the country
|
|
555
|
+
* - Invalid or missing bank information
|
|
556
|
+
*
|
|
557
|
+
* @example
|
|
558
|
+
* ```typescript
|
|
559
|
+
* try {
|
|
560
|
+
* const bank = Bank.from("CORUTZTZ", "TZ");
|
|
561
|
+
* const contact = new BankContactInfo("John Doe", bank, "0150123456789");
|
|
562
|
+
* console.log("Bank contact created successfully");
|
|
563
|
+
* } catch (error) {
|
|
564
|
+
* if (error instanceof ContactInfoError) {
|
|
565
|
+
* console.log(`Validation failed: ${error.message}`);
|
|
566
|
+
* }
|
|
567
|
+
* }
|
|
568
|
+
* ```
|
|
569
|
+
*/
|
|
570
|
+
constructor(accName: string, bank: Bank, accNo: string);
|
|
571
|
+
/**
|
|
572
|
+
* Creates a BankContactInfo instance from a ContactDTO object.
|
|
573
|
+
* Handles SWIFT code validation and bank lookup.
|
|
574
|
+
*
|
|
575
|
+
* **Process:**
|
|
576
|
+
* 1. Validates DTO type is "Bank"
|
|
577
|
+
* 2. Validates country code format
|
|
578
|
+
* 3. Validates SWIFT code format and existence
|
|
579
|
+
* 4. Looks up bank information using SWIFT code
|
|
580
|
+
* 5. Delegates to constructor for final validation
|
|
581
|
+
*
|
|
582
|
+
* @static
|
|
583
|
+
* @param {ContactDTO} info - The contact data transfer object
|
|
584
|
+
* @param {string} info.type - Must be "Bank"
|
|
585
|
+
* @param {string} info.channel - The SWIFT code for the bank
|
|
586
|
+
* @param {string} info.countryCode - ISO2 country code
|
|
587
|
+
* @param {string} info.displayName - The account holder's name
|
|
588
|
+
* @param {string} info.accountNo - The bank account number
|
|
589
|
+
*
|
|
590
|
+
* @returns {BankContactInfo | undefined} New instance if successful, undefined if validation fails
|
|
591
|
+
*
|
|
592
|
+
* @example
|
|
593
|
+
* ```typescript
|
|
594
|
+
* const contactDTO = {
|
|
595
|
+
* type: "Bank",
|
|
596
|
+
* channel: "CORUTZTZ", // CRDB Bank SWIFT code
|
|
597
|
+
* countryCode: "TZ",
|
|
598
|
+
* displayName: "John Doe",
|
|
599
|
+
* accountNo: "0150123456789"
|
|
600
|
+
* };
|
|
601
|
+
*
|
|
602
|
+
* const contact = BankContactInfo.fromContactDTO(contactDTO);
|
|
603
|
+
* if (contact) {
|
|
604
|
+
* console.log(`Created bank contact: ${contact.displayName} at ${contact.bank.shortName}`);
|
|
605
|
+
* }
|
|
606
|
+
* ```
|
|
607
|
+
*/
|
|
608
|
+
static fromContactDTO(info: ContactDTO): BankContactInfo | undefined;
|
|
609
|
+
/**
|
|
610
|
+
* Creates a BankContactInfo instance from a PayoutDTO object.
|
|
611
|
+
* Parses bank information from the payout's msisdn field using "swiftcode:accountno" format.
|
|
612
|
+
*
|
|
613
|
+
* **Expected Format:** The msisdn field should contain "SWIFTCODE:ACCOUNTNUMBER"
|
|
614
|
+
*
|
|
615
|
+
* **Process:**
|
|
616
|
+
* 1. Validates country code format
|
|
617
|
+
* 2. Splits msisdn field on ":" delimiter
|
|
618
|
+
* 3. Validates SWIFT code format and existence
|
|
619
|
+
* 4. Looks up bank information
|
|
620
|
+
* 5. Creates contact with parsed information
|
|
621
|
+
*
|
|
622
|
+
* @static
|
|
623
|
+
* @param {PayoutDTO} info - The payout data transfer object
|
|
624
|
+
* @param {string} info.msisdn - Bank info in format "SWIFTCODE:ACCOUNTNUMBER"
|
|
625
|
+
* @param {string} info.countryCode - ISO2 country code
|
|
626
|
+
* @param {string} info.payeeName - The account holder's name
|
|
627
|
+
*
|
|
628
|
+
* @returns {BankContactInfo | undefined} New instance if successful, undefined if parsing fails
|
|
629
|
+
*
|
|
630
|
+
* @example
|
|
631
|
+
* ```typescript
|
|
632
|
+
* const payoutDTO = {
|
|
633
|
+
* msisdn: "CORUTZTZ:0150123456789", // SWIFT:Account format
|
|
634
|
+
* countryCode: "TZ",
|
|
635
|
+
* payeeName: "Jane Smith"
|
|
636
|
+
* };
|
|
637
|
+
*
|
|
638
|
+
* const contact = BankContactInfo.fromPayoutDTO(payoutDTO);
|
|
639
|
+
* if (contact) {
|
|
640
|
+
* console.log(`Payout to: ${contact.displayName}`);
|
|
641
|
+
* console.log(`Bank: ${contact.bank.fullName}`);
|
|
642
|
+
* console.log(`Account: ${contact.accNumber}`);
|
|
643
|
+
* }
|
|
644
|
+
* ```
|
|
645
|
+
*
|
|
646
|
+
* @remarks
|
|
647
|
+
* Returns undefined if:
|
|
648
|
+
* - msisdn doesn't contain exactly one ":" separator
|
|
649
|
+
* - SWIFT code is invalid for the country
|
|
650
|
+
* - Bank lookup fails
|
|
651
|
+
* - Any validation error occurs
|
|
652
|
+
*/
|
|
653
|
+
static fromPayoutDTO(info: PayoutDTO): BankContactInfo | undefined;
|
|
654
|
+
/**
|
|
655
|
+
* Type guard to validate if an unknown object is a valid BankContactInfo instance.
|
|
656
|
+
* Performs comprehensive structural and business logic validation.
|
|
657
|
+
*
|
|
658
|
+
* **Validation Process:**
|
|
659
|
+
* 1. **Structural validation**: Checks required properties exist with correct types
|
|
660
|
+
* 2. **Account name validation**: Uses BankValidation.validateAccountName()
|
|
661
|
+
* 3. **Account number validation**: Uses country-specific BankValidation.validateAccountNumber()
|
|
662
|
+
* 4. **Bank validation**: Ensures bank object passes Bank.is() validation
|
|
663
|
+
*
|
|
664
|
+
* @static
|
|
665
|
+
* @param {unknown} obj - The object to validate
|
|
666
|
+
* @returns {obj is BankContactInfo} Type predicate indicating validity
|
|
667
|
+
*
|
|
668
|
+
* @example
|
|
669
|
+
* ```typescript
|
|
670
|
+
* const unknownData = JSON.parse(bankJsonString);
|
|
671
|
+
*
|
|
672
|
+
* if (BankContactInfo.is(unknownData)) {
|
|
673
|
+
* // TypeScript now knows this is BankContactInfo
|
|
674
|
+
* console.log(unknownData.accName); // ✅ Type-safe access
|
|
675
|
+
* console.log(unknownData.bank.fullName); // ✅ Type-safe
|
|
676
|
+
* console.log(unknownData.accNo); // ✅ Type-safe
|
|
677
|
+
* } else {
|
|
678
|
+
* console.log("Invalid BankContactInfo structure");
|
|
679
|
+
* }
|
|
680
|
+
*
|
|
681
|
+
* // Usage in arrays
|
|
682
|
+
* const bankContacts = jsonArray.filter(BankContactInfo.is);
|
|
683
|
+
* // bankContacts is now typed as BankContactInfo[]
|
|
684
|
+
* ```
|
|
685
|
+
*
|
|
686
|
+
* @remarks
|
|
687
|
+
* - Validates both serialized and live objects
|
|
688
|
+
* - Uses banking industry validation rules through BankValidation
|
|
689
|
+
* - Ensures bank object contains valid SWIFT code and institution data
|
|
690
|
+
* - Returns false for any validation failure (fail-fast approach)
|
|
691
|
+
*/
|
|
692
|
+
static is(obj: unknown): obj is BankContactInfo;
|
|
693
|
+
validate(): boolean;
|
|
694
|
+
/**
|
|
695
|
+
* Gets the bank account holder's name for display purposes.
|
|
696
|
+
*
|
|
697
|
+
* @override
|
|
698
|
+
* @returns {string} The account holder's name
|
|
699
|
+
*/
|
|
700
|
+
get accountName(): string;
|
|
701
|
+
/**
|
|
702
|
+
* Gets the bank account number for display and processing.
|
|
703
|
+
*
|
|
704
|
+
* @override
|
|
705
|
+
* @returns {string} The bank account number as provided
|
|
706
|
+
*/
|
|
707
|
+
get accountNumber(): string;
|
|
708
|
+
/**
|
|
709
|
+
* Gets the localized label for the display name field.
|
|
710
|
+
*
|
|
711
|
+
* @override
|
|
712
|
+
* @returns {string} Always returns "Acc. Name" for bank contacts
|
|
713
|
+
*/
|
|
714
|
+
get accountNameLabel(): string;
|
|
715
|
+
/**
|
|
716
|
+
* Gets the localized label for the account number field.
|
|
717
|
+
*
|
|
718
|
+
* @override
|
|
719
|
+
* @returns {string} Always returns "Bank Acc. No." for bank contacts
|
|
720
|
+
*/
|
|
721
|
+
get accountNumberLabel(): string;
|
|
722
|
+
/**
|
|
723
|
+
* Gets the localized label for the channel field.
|
|
724
|
+
*
|
|
725
|
+
* @override
|
|
726
|
+
* @returns {string} Always returns "Bank" for bank contacts
|
|
727
|
+
*/
|
|
728
|
+
get channelLabel(): string;
|
|
729
|
+
/**
|
|
730
|
+
* Gets the bank's SWIFT code as the channel identifier.
|
|
731
|
+
* This is the programmatic identifier used for bank transfers and API calls.
|
|
732
|
+
*
|
|
733
|
+
* @returns {BankSwiftCode} The bank's SWIFT/BIC code (e.g., "CORUTZTZ", "KCBLKENX")
|
|
734
|
+
*
|
|
735
|
+
* @example
|
|
736
|
+
* ```typescript
|
|
737
|
+
* const contact = new BankContactInfo("John", crdBank, "123456789");
|
|
738
|
+
* console.log(contact.channel); // "CORUTZTZ"
|
|
739
|
+
*
|
|
740
|
+
* // Type-safe usage
|
|
741
|
+
* if (contact.channel === "CORUTZTZ") {
|
|
742
|
+
* console.log("This is a CRDB Bank account");
|
|
743
|
+
* }
|
|
744
|
+
* ```
|
|
745
|
+
*/
|
|
746
|
+
get channelId(): BankSwiftCode;
|
|
747
|
+
/**
|
|
748
|
+
* Gets the bank's short name for display purposes.
|
|
749
|
+
* Provides a human-readable identifier for the banking institution.
|
|
750
|
+
*
|
|
751
|
+
* @returns {string} The bank's abbreviated name (e.g., "CRDB", "KCB", "Equity")
|
|
752
|
+
*
|
|
753
|
+
* @example
|
|
754
|
+
* ```typescript
|
|
755
|
+
* const crdContact = new BankContactInfo("John", crdBank, "123456789");
|
|
756
|
+
* console.log(crdContact.channelDisplayName); // "CRDB"
|
|
757
|
+
*
|
|
758
|
+
* const kcbContact = new BankContactInfo("Jane", kcbBank, "987654321");
|
|
759
|
+
* console.log(kcbContact.channelDisplayName); // "KCB"
|
|
760
|
+
* ```
|
|
761
|
+
*
|
|
762
|
+
* @remarks
|
|
763
|
+
* The short name is maintained by the Bank service and represents
|
|
764
|
+
* the commonly used abbreviation for the banking institution.
|
|
765
|
+
*/
|
|
766
|
+
get channelName(): string;
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Union type representing either a mobile or bank contact.
|
|
770
|
+
* Used for type-safe handling of contact information throughout the application.
|
|
771
|
+
*
|
|
772
|
+
* This discriminated union allows for:
|
|
773
|
+
* - **Type-safe polymorphism**: Handle different contact types with single interface
|
|
774
|
+
* - **Runtime type discrimination**: Use `contact.type` to determine specific type
|
|
775
|
+
* - **Comprehensive validation**: Each type provides its own validation logic
|
|
776
|
+
* - **Consistent API**: Both types implement BaseContactInfo interface
|
|
777
|
+
*
|
|
778
|
+
* @typedef {MobileContactInfo | BankContactInfo} ContactInfo
|
|
779
|
+
*
|
|
780
|
+
* @example
|
|
781
|
+
* ```typescript
|
|
782
|
+
* // Type-safe handling of mixed contact types
|
|
783
|
+
* function processContact(contact: ContactInfo) {
|
|
784
|
+
* console.log(`Processing ${contact.type} contact: ${contact.displayName}`);
|
|
785
|
+
* console.log(`Channel: ${contact.channelDisplayName}`);
|
|
786
|
+
*
|
|
787
|
+
* // Type discrimination for specific behavior
|
|
788
|
+
* if (contact.type === "Mobile") {
|
|
789
|
+
* // TypeScript knows this is MobileContactInfo
|
|
790
|
+
* console.log(`MNO: ${contact.mnoId}`);
|
|
791
|
+
* console.log(`Phone: ${contact.phoneNumber.e164Format}`);
|
|
792
|
+
* } else {
|
|
793
|
+
* // TypeScript knows this is BankContactInfo
|
|
794
|
+
* console.log(`Bank: ${contact.bank.fullName}`);
|
|
795
|
+
* console.log(`SWIFT: ${contact.bank.swiftCode}`);
|
|
796
|
+
* }
|
|
797
|
+
* }
|
|
798
|
+
*
|
|
799
|
+
* // Usage with arrays
|
|
800
|
+
* const contacts: ContactInfo[] = [
|
|
801
|
+
* new MobileContactInfo("John", phoneNumber, TZMNOId.VODACOM),
|
|
802
|
+
* new BankContactInfo("Jane", bank, "123456789")
|
|
803
|
+
* ];
|
|
804
|
+
*
|
|
805
|
+
* contacts.forEach(processContact);
|
|
806
|
+
*
|
|
807
|
+
* // Type guards work seamlessly
|
|
808
|
+
* const mobileContacts = contacts.filter((c): c is MobileContactInfo => c.type === "Mobile");
|
|
809
|
+
* const bankContacts = contacts.filter((c): c is BankContactInfo => c.type === "Bank");
|
|
810
|
+
* ```
|
|
811
|
+
*
|
|
812
|
+
* @see {@link MobileContactInfo} For mobile money contact implementation
|
|
813
|
+
* @see {@link BankContactInfo} For bank transfer contact implementation
|
|
814
|
+
* @see {@link BaseContactInfo} For common interface and behavior
|
|
815
|
+
*/
|
|
816
|
+
export type ContactInfo = MobileContactInfo | BankContactInfo;
|
|
817
|
+
export {};
|