@temboplus/afloat 0.1.77-beta.22 → 0.1.77-beta.25

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.
@@ -1,5 +1,5 @@
1
- import { ContactInfo, MobileContactInfo, BankContactInfo } from "../contact/contact-info.model.js";
2
1
  import z from "zod";
2
+ import { BankBeneficiaryInfo, BeneficiaryInfo, MobileBeneficiaryInfo } from "../beneficiary/beneficiary-info.model.js";
3
3
  /** Prefix for Ecobank mobile transfer narrations */
4
4
  export declare const ECOBANK_PREFIX = "MOBILE TRANSFER ";
5
5
  /** V2 format prefix for payout narrations using contact details */
@@ -49,7 +49,7 @@ export type NarrationJSON = z.infer<typeof NarrationJSONSchema>;
49
49
  *
50
50
  * // Extract contact details from narration
51
51
  * const existingNarration = new Narration("PAYOUT +255123456789 JOHN DOE");
52
- * const contactInfo = existingNarration.getContactDetails();
52
+ * const contactInfo = existingNarration.getBeneficiaryDetails();
53
53
  * // Returns: MobileContactInfo instance
54
54
  * ```
55
55
  */
@@ -80,21 +80,21 @@ export declare class Narration {
80
80
  * Generates the default payout narration based on contact information using the V2 format.
81
81
  * Automatically determines whether to generate mobile or bank narration based on contact type.
82
82
  *
83
- * @param data - Contact information (either MobileContactInfo or BankContactInfo)
83
+ * @param data - Contact information (either MobileBeneficiaryInfo or BankBeneficiaryInfo)
84
84
  * @returns Formatted default narration string in uppercase using V2 format, or empty string if contact type is unrecognized
85
85
  *
86
86
  * @example
87
87
  * ```typescript
88
- * const mobileContact = new MobileContactInfo("John Doe", phoneNumber);
88
+ * const mobileContact = new MobileBeneficiaryInfo("John Doe", phoneNumber);
89
89
  * const narration = Narration.generateDefaultPayoutNarration(mobileContact);
90
90
  * // Returns: "PAYOUT +255123456789 JOHN DOE"
91
91
  *
92
- * const bankContact = new BankContactInfo("Jane Smith", bank, "1234567890");
92
+ * const bankContact = new BankBeneficiaryInfo("Jane Smith", bank, "1234567890");
93
93
  * const narration = Narration.generateDefaultPayoutNarration(bankContact);
94
94
  * // Returns: "PAYOUT CORUTZTZ 1234567890 JANE SMITH"
95
95
  * ```
96
96
  */
97
- static generateDefaultPayoutNarration(data: ContactInfo): string;
97
+ static generateDefaultPayoutNarration(data: BeneficiaryInfo): string;
98
98
  /**
99
99
  * Generates a V2 standardized mobile money payout narration with contact details.
100
100
  * Format: "PAY {phone_number} {name}"
@@ -104,12 +104,12 @@ export declare class Narration {
104
104
  *
105
105
  * @example
106
106
  * ```typescript
107
- * const contact = new MobileContactInfo("John Doe", phoneNumber);
107
+ * const contact = new MobileBeneficiaryInfo("John Doe", phoneNumber);
108
108
  * const narration = Narration.generateMobilePayoutNarrationV2(contact);
109
109
  * // Returns: "PAYOUT +255123456789 JOHN DOE"
110
110
  * ```
111
111
  */
112
- static generateMobilePayoutNarrationV2(data: MobileContactInfo): string;
112
+ static generateMobilePayoutNarrationV2(data: MobileBeneficiaryInfo): string;
113
113
  /**
114
114
  * Generates a V2 standardized bank payout narration with contact details.
115
115
  * Format: "PAY {swift_code} {account_number} {account_name}"
@@ -119,32 +119,32 @@ export declare class Narration {
119
119
  *
120
120
  * @example
121
121
  * ```typescript
122
- * const contact = new BankContactInfo("Jane Smith", bank, "1234567890");
122
+ * const contact = new BankBeneficiaryInfo("Jane Smith", bank, "1234567890");
123
123
  * const narration = Narration.generateBankPayoutNarrationV2(contact);
124
124
  * // Returns: "PAYOUT CORUTZTZ 1234567890 JANE SMITH"
125
125
  * ```
126
126
  */
127
- static generateBankPayoutNarrationV2(data: BankContactInfo): string;
127
+ static generateBankPayoutNarrationV2(data: BankBeneficiaryInfo): string;
128
128
  /**
129
129
  * Extracts contact information from the narration text.
130
130
  * Supports V2 (PAY format), V1, and legacy formats for comprehensive contact detection.
131
131
  *
132
- * @returns Parsed ContactInfo (BankContactInfo or MobileContactInfo) if successful, undefined otherwise
132
+ * @returns Parsed BeneficiaryInfo (BankBeneficiaryInfo or MobileBeneficiaryInfo) if successful, undefined otherwise
133
133
  *
134
134
  * @example
135
135
  * ```typescript
136
136
  * // V2 format
137
137
  * const v2Narration = new Narration("PAYOUT +255123456789 JOHN DOE");
138
- * const v2Contact = v2Narration.getContactDetails();
138
+ * const v2Contact = v2Narration.getBeneficiaryDetails();
139
139
  * // Returns: MobileContactInfo instance
140
140
  *
141
141
  * // V1 format
142
142
  * const v1Narration = new Narration("PAYOUT TO BANK CRDB 1234567890 Jane Smith");
143
- * const v1Contact = v1Narration.getContactDetails();
143
+ * const v1Contact = v1Narration.getBeneficiaryDetails();
144
144
  * // Returns: BankContactInfo instance
145
145
  * ```
146
146
  */
147
- getContactDetails: () => ContactInfo | undefined;
147
+ getBeneficiaryDetails: () => BeneficiaryInfo | undefined;
148
148
  /**
149
149
  * Extracts bank contact information from the narration text.
150
150
  * Handles V2 format (PAY with SWIFT code and details), V1 format, and legacy format.
@@ -154,20 +154,20 @@ export declare class Narration {
154
154
  * V1 format: "PAYOUT TO BANK {bank_name} {account_number} {account_name}"
155
155
  * Legacy format: "TO_BANK => {json_object}"
156
156
  *
157
- * @returns BankContactInfo if parsing is successful, undefined otherwise
157
+ * @returns BankBeneficiaryInfo if parsing is successful, undefined otherwise
158
158
  *
159
159
  * @example
160
160
  * ```typescript
161
161
  * // V2 format
162
162
  * const v2Narration = new Narration("PAYOUT CORUTZTZ 1234567890 JANE SMITH");
163
- * const v2Contact = v2Narration.getBankContactDetails();
163
+ * const v2Contact = v2Narration.getBankBeneficiaryDetails();
164
164
  *
165
165
  * // V1 format
166
166
  * const v1Narration = new Narration("PAYOUT TO BANK CRDB 1234567890 Jane Smith");
167
- * const v1Contact = v1Narration.getBankContactDetails();
167
+ * const v1Contact = v1Narration.getBankBeneficiaryDetails();
168
168
  * ```
169
169
  */
170
- getBankContactDetails: () => BankContactInfo | undefined;
170
+ getBankBeneficiaryDetails: () => BankBeneficiaryInfo | undefined;
171
171
  /**
172
172
  * Extracts mobile contact information from the narration text.
173
173
  * Handles V2 format (PAY with phone number and name), V1 format, and legacy format.
@@ -177,20 +177,20 @@ export declare class Narration {
177
177
  * V1 format: "PAYOUT TO MOBILE {phone_number} {name}"
178
178
  * Legacy format: "TO_MOMO => {json_object}"
179
179
  *
180
- * @returns MobileContactInfo if parsing is successful, undefined otherwise
180
+ * @returns MobileBeneficiaryInfo if parsing is successful, undefined otherwise
181
181
  *
182
182
  * @example
183
183
  * ```typescript
184
184
  * // V2 format
185
185
  * const v2Narration = new Narration("PAYOUT +255123456789 JOHN DOE");
186
- * const v2Contact = v2Narration.getMobileContactDetails();
186
+ * const v2Contact = v2Narration.getMobileBeneficiaryDetails();
187
187
  *
188
188
  * // V1 format
189
189
  * const v1Narration = new Narration("PAYOUT TO MOBILE +255123456789 John Doe");
190
- * const v1Contact = v1Narration.getMobileContactDetails();
190
+ * const v1Contact = v1Narration.getMobileBeneficiaryDetails();
191
191
  * ```
192
192
  */
193
- getMobileContactDetails: () => MobileContactInfo | undefined;
193
+ getMobileBeneficiaryDetails: () => MobileBeneficiaryInfo | undefined;
194
194
  /**
195
195
  * Type guard to check if an unknown object is a valid Narration instance.
196
196
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temboplus/afloat",
3
- "version": "0.1.77-beta.22",
3
+ "version": "0.1.77-beta.25",
4
4
  "description": "A foundational library for Temboplus-Afloat projects.",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
@@ -40,7 +40,7 @@
40
40
  "@ts-rest/core": "^3.52.1",
41
41
  "tslib": "^2.8.1",
42
42
  "uuid": "^11.1.0",
43
- "zod": "^4.1.13",
43
+ "zod": "^3.24.2",
44
44
  "zustand": "^5.0.9"
45
45
  },
46
46
  "devDependencies": {
@@ -58,6 +58,6 @@
58
58
  "typescript": "^5.9.3"
59
59
  },
60
60
  "dependencies": {
61
- "@temboplus/frontend-core": "^0.2.20-beta.7"
61
+ "@temboplus/frontend-core": "^0.2.20-beta.8"
62
62
  }
63
63
  }
@@ -1,488 +0,0 @@
1
- import { ContactType, ContactDTO } from "@/modules/contact/contact.dtos.js";
2
- import { PayoutDTO } from "@/modules/payout/payout.dtos.js";
3
- import { Bank, ISO2CountryCode, PhoneNumber } from "@temboplus/frontend-core";
4
- import type { BankSwiftCode, MNOId } from "@temboplus/frontend-core";
5
- import { z } from "zod";
6
- export declare const MobileContactInfoJSONSchema: z.ZodObject<{
7
- type: z.ZodLiteral<"Mobile">;
8
- name: z.ZodString;
9
- phoneNumber: z.ZodString;
10
- mnoId: z.ZodString;
11
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
12
- }, "strip", z.ZodTypeAny, {
13
- type: "Mobile";
14
- name: string;
15
- version: string;
16
- phoneNumber: string;
17
- mnoId: string;
18
- }, {
19
- type: "Mobile";
20
- name: string;
21
- phoneNumber: string;
22
- mnoId: string;
23
- version?: string | undefined;
24
- }>;
25
- export declare const BankContactInfoJSONSchema: z.ZodObject<{
26
- type: z.ZodLiteral<"Bank">;
27
- accName: z.ZodString;
28
- swiftCode: z.ZodString;
29
- countryCode: z.ZodString;
30
- accNo: z.ZodString;
31
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
32
- }, "strip", z.ZodTypeAny, {
33
- type: "Bank";
34
- version: string;
35
- countryCode: string;
36
- accName: string;
37
- swiftCode: string;
38
- accNo: string;
39
- }, {
40
- type: "Bank";
41
- countryCode: string;
42
- accName: string;
43
- swiftCode: string;
44
- accNo: string;
45
- version?: string | undefined;
46
- }>;
47
- export declare const ContactInfoJSONSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
48
- type: z.ZodLiteral<"Mobile">;
49
- name: z.ZodString;
50
- phoneNumber: z.ZodString;
51
- mnoId: z.ZodString;
52
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
53
- }, "strip", z.ZodTypeAny, {
54
- type: "Mobile";
55
- name: string;
56
- version: string;
57
- phoneNumber: string;
58
- mnoId: string;
59
- }, {
60
- type: "Mobile";
61
- name: string;
62
- phoneNumber: string;
63
- mnoId: string;
64
- version?: string | undefined;
65
- }>, z.ZodObject<{
66
- type: z.ZodLiteral<"Bank">;
67
- accName: z.ZodString;
68
- swiftCode: z.ZodString;
69
- countryCode: z.ZodString;
70
- accNo: z.ZodString;
71
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
72
- }, "strip", z.ZodTypeAny, {
73
- type: "Bank";
74
- version: string;
75
- countryCode: string;
76
- accName: string;
77
- swiftCode: string;
78
- accNo: string;
79
- }, {
80
- type: "Bank";
81
- countryCode: string;
82
- accName: string;
83
- swiftCode: string;
84
- accNo: string;
85
- version?: string | undefined;
86
- }>]>;
87
- export type MobileContactInfoJSON = z.infer<typeof MobileContactInfoJSONSchema>;
88
- export type BankContactInfoJSON = z.infer<typeof BankContactInfoJSONSchema>;
89
- export type ContactInfoJSON = z.infer<typeof ContactInfoJSONSchema>;
90
- /**
91
- * Abstract base class that provides a common interface for different types of contact information.
92
- * This class defines the structure and validation requirements for both mobile and bank contacts.
93
- *
94
- * Serves as the foundation for type-safe contact handling throughout the application,
95
- * ensuring consistent behavior between mobile money and bank transfer contacts.
96
- *
97
- * **Country Code Handling:**
98
- * The country code is always derived from the underlying domain objects (PhoneNumber or Bank)
99
- * rather than being passed as a separate parameter, ensuring consistency and single source of truth.
100
- *
101
- * @abstract
102
- * @class BaseContactInfo
103
- *
104
- * @property {ContactType} type - The type of contact (either "Mobile" or "Bank")
105
- * @property {ISO2CountryCode} countryCode - The ISO2 country code derived from PhoneNumber or Bank
106
- *
107
- * @example
108
- * ```typescript
109
- * // Cannot instantiate directly - use concrete implementations
110
- * const mobileContact = MobileContactInfo.from({ name: "John Doe", phoneNumber });
111
- * const bankContact = BankContactInfo.from({ accName: "Jane Smith", bank, accNo: "123456789" });
112
- *
113
- * // Polymorphic usage
114
- * function processContact(contact: BaseContactInfo) {
115
- * console.log(`Processing ${contact.type} contact: ${contact.displayName}`);
116
- * console.log(`Channel: ${contact.channelDisplayName}`);
117
- * console.log(`Country: ${contact.countryCode}`); // Always available
118
- * }
119
- * ```
120
- */
121
- declare abstract class BaseContactInfo {
122
- readonly type: ContactType;
123
- readonly countryCode: ISO2CountryCode;
124
- /**
125
- * Creates a new instance of BaseContactInfo.
126
- * Protected constructor ensures only subclasses can instantiate.
127
- *
128
- * @protected
129
- * @param {ContactType} type - The type of contact to create ("Mobile" or "Bank")
130
- * @param {ISO2CountryCode} countryCode - The ISO2 country code derived from domain objects
131
- */
132
- constructor(type: ContactType, countryCode: ISO2CountryCode);
133
- /**
134
- * Gets the typed channel identifier for the contact.
135
- * Returns MNO ID for mobile contacts, SWIFT code for bank contacts.
136
- *
137
- * @abstract
138
- * @returns {MNOId | BankSwiftCode} The typed channel identifier
139
- *
140
- * @example
141
- * ```typescript
142
- * const mobileChannel: MNOId = mobileContact.channelId; // "VODACOM", "SAFARICOM", etc.
143
- * const bankChannel: BankSwiftCode = bankContact.channelId; // "CORUTZTZ", "KCBLKENX", etc.
144
- * ```
145
- */
146
- abstract get channelId(): MNOId | BankSwiftCode;
147
- /**
148
- * Gets the human-readable channel name for display purposes.
149
- * Returns mobile money service name for mobile contacts, bank short name for bank contacts.
150
- *
151
- * @abstract
152
- * @returns {string} The display-friendly channel name
153
- *
154
- * @example
155
- * ```typescript
156
- * console.log(mobileContact.channelName); // "M-Pesa", "Airtel Money", etc.
157
- * console.log(bankContact.channelName); // "CRDB", "KCB", etc.
158
- * ```
159
- */
160
- abstract get channelName(): string;
161
- /**
162
- * Gets the primary display name for the contact.
163
- *
164
- * @abstract
165
- * @returns {string} The contact's display name (personal name for mobile, account name for bank)
166
- */
167
- abstract get accountName(): string;
168
- /**
169
- * Gets the primary account/identification number for the contact.
170
- *
171
- * @abstract
172
- * @returns {string} The contact's number (phone number for mobile, account number for bank)
173
- */
174
- abstract get accountNumber(): string;
175
- /**
176
- * Gets the localized label for the display name field.
177
- *
178
- * @abstract
179
- * @returns {string} The appropriate label for the display name based on contact type
180
- */
181
- abstract get accountNameLabel(): string;
182
- /**
183
- * Gets the localized label for the account number field.
184
- *
185
- * @abstract
186
- * @returns {string} The appropriate label for the account number based on contact type
187
- */
188
- abstract get accountNumberLabel(): string;
189
- /**
190
- * Gets the localized label for the channel field.
191
- *
192
- * @abstract
193
- * @returns {string} The appropriate label for the channel based on contact type
194
- */
195
- abstract get channelLabel(): string;
196
- /**
197
- * Validates that all contact information is consistent and correct.
198
- *
199
- * @abstract
200
- * @returns {boolean} True if the contact information is valid
201
- */
202
- abstract validate(): boolean;
203
- /**
204
- * Serializes the ContactInfo instance to a JSON-compatible object
205
- */
206
- abstract toJSON(): ContactInfoJSON;
207
- /**
208
- * Converts the ContactInfo instance to a JSON string.
209
- */
210
- toJSONString(): string;
211
- get isMobile(): boolean;
212
- get isBank(): boolean;
213
- get displayName(): string;
214
- }
215
- /**
216
- * Implementation of BaseContactInfo for mobile phone contacts.
217
- * Handles storage, validation, and display of contact details specific to mobile money services.
218
- *
219
- * This class properly delegates MNO-related logic to country-specific implementations,
220
- * supporting both countries with Mobile Number Portability (MNP) and those without.
221
- * The country code is always derived from the PhoneNumber object, ensuring consistency.
222
- *
223
- * **Key Features:**
224
- * - Automatic MNO detection for countries without MNP (e.g., Tanzania)
225
- * - Explicit MNO requirement for countries with MNP (e.g., Kenya)
226
- * - Country-specific validation through MNOUtils delegation
227
- * - Comprehensive error handling with structured context
228
- * - Country code derived from PhoneNumber (single source of truth)
229
- *
230
- * **MNP Handling:**
231
- * - **Tanzania (no MNP)**: MNO is always auto-detected from phone number prefix, ignoring any provided MNO
232
- * - **Kenya (has MNP)**: MNO must be explicitly provided as numbers can be ported
233
- *
234
- * @extends BaseContactInfo
235
- * @class MobileContactInfo
236
- *
237
- * @property {string} name - The contact's personal name
238
- * @property {PhoneNumber} phoneNumber - The validated phone number object
239
- * @property {MNOId} mnoId - The mobile network operator identifier (always available after construction)
240
- *
241
- * @example
242
- * ```typescript
243
- * // Preferred: Use static factory method
244
- * const tzContact = MobileContactInfo.from({
245
- * name: "John Doe",
246
- * phoneNumber: tzPhoneNumber
247
- * });
248
- * console.log(tzContact?.channelName); // "M-Pesa" (Vodacom's service)
249
- *
250
- * // From JSON
251
- * const jsonContact = MobileContactInfo.fromJSON(jsonString);
252
- * ```
253
- */
254
- export declare class MobileContactInfo extends BaseContactInfo {
255
- readonly name: string;
256
- readonly phoneNumber: PhoneNumber;
257
- readonly mnoId: MNOId;
258
- /**
259
- * Creates a new mobile contact with comprehensive validation.
260
- *
261
- * **Validation Process:**
262
- * 1. Validates name is non-empty
263
- * 2. Validates phone number structure
264
- * 3. Extracts country code from PhoneNumber object
265
- * 4. Handles MNO validation based on country MNP status
266
- *
267
- * @deprecated Use {@link MobileContactInfo.from} static factory method instead
268
- * @param {string} name - The contact's personal name (required, non-empty)
269
- * @param {PhoneNumber} phoneNumber - The validated phone number object (contains country code)
270
- * @param {MNOId} [mnoId] - MNO ID. Required for MNP countries (KE), ignored for non-MNP countries (TZ)
271
- *
272
- * @throws {ContactInfoError} When any validation fails
273
- */
274
- constructor(name: string, phoneNumber: PhoneNumber, mnoId?: MNOId);
275
- /**
276
- * Creates a MobileContactInfo instance from data object.
277
- * This is the preferred method for creating instances.
278
- *
279
- * @static
280
- * @param {Object} data - The mobile contact data
281
- * @param {string} data.name - The contact's personal name
282
- * @param {PhoneNumber} data.phoneNumber - The validated phone number object
283
- * @param {MNOId} [data.mnoId] - MNO ID (required for MNP countries)
284
- *
285
- * @returns {MobileContactInfo | undefined} New instance if successful, undefined if validation fails
286
- *
287
- * @example
288
- * ```typescript
289
- * const contact = MobileContactInfo.from({
290
- * name: "John Doe",
291
- * phoneNumber: tzPhone,
292
- * mnoId: TZMNOId.VODACOM // Optional for TZ, required for KE
293
- * });
294
- * ```
295
- */
296
- static from(data: {
297
- name: string;
298
- phoneNumber: PhoneNumber;
299
- mnoId?: MNOId;
300
- }): MobileContactInfo | undefined;
301
- /**
302
- * Creates a MobileContactInfo instance from a ContactDTO object.
303
- * Handles validation and MNO extraction from the DTO's channel field.
304
- *
305
- * @static
306
- * @param {ContactDTO} info - The contact data transfer object
307
- * @returns {MobileContactInfo | undefined} New instance if successful, undefined if validation fails
308
- *
309
- * @example
310
- * ```typescript
311
- * const contactDTO = {
312
- * type: "Mobile",
313
- * accountNo: "+255712345678",
314
- * displayName: "John Doe",
315
- * channel: "VODACOM"
316
- * };
317
- *
318
- * const contact = MobileContactInfo.fromContactDTO(contactDTO);
319
- * ```
320
- */
321
- static fromContactDTO(info: ContactDTO): MobileContactInfo | undefined;
322
- /**
323
- * Creates a MobileContactInfo instance from a PayoutDTO object.
324
- * Extracts mobile contact information from payout data structure.
325
- *
326
- * @static
327
- * @param {PayoutDTO} info - The payout data transfer object
328
- * @returns {MobileContactInfo | undefined} New instance if successful, undefined if parsing fails
329
- *
330
- * @example
331
- * ```typescript
332
- * const payoutDTO = {
333
- * msisdn: "+255712345678",
334
- * countryCode: "TZ",
335
- * payeeName: "John Doe",
336
- * channel: "VODACOM"
337
- * };
338
- *
339
- * const contact = MobileContactInfo.fromPayoutDTO(payoutDTO);
340
- * ```
341
- */
342
- static fromPayoutDTO(info: PayoutDTO): MobileContactInfo | undefined;
343
- /**
344
- * Type guard to validate if an unknown object is a valid MobileContactInfo instance.
345
- *
346
- * @static
347
- * @param {unknown} obj - The object to validate
348
- * @returns {obj is MobileContactInfo} Type predicate indicating validity
349
- *
350
- * @example
351
- * ```typescript
352
- * if (MobileContactInfo.is(unknownData)) {
353
- * console.log(unknownData.name); // Type-safe access
354
- * }
355
- * ```
356
- */
357
- static is(obj: unknown): obj is MobileContactInfo;
358
- /**
359
- * Validates that all contact information is consistent and correct.
360
- *
361
- * @returns {boolean} True if all validations pass, false otherwise
362
- */
363
- validate(): boolean;
364
- /**
365
- * Provides detailed validation results with specific error and warning information.
366
- *
367
- * @returns {Object} Detailed validation results
368
- */
369
- getValidationDetails(): {
370
- isValid: boolean;
371
- errors: string[];
372
- warnings: string[];
373
- };
374
- get accountName(): string;
375
- get accountNumber(): string;
376
- get accountNameLabel(): string;
377
- get accountNumberLabel(): string;
378
- get channelLabel(): string;
379
- get channelId(): MNOId;
380
- get channelName(): string;
381
- toJSON(): MobileContactInfoJSON;
382
- static fromJSON(json: MobileContactInfoJSON | string): MobileContactInfo | undefined;
383
- static fromJSONString(jsonString: string): MobileContactInfo | undefined;
384
- static isMobileContactInfoJSON(obj: unknown): obj is MobileContactInfoJSON;
385
- }
386
- /**
387
- * Implementation of BaseContactInfo for bank account contacts.
388
- * Handles storage, validation, and display of contact details specific to bank transfers.
389
- *
390
- * @extends BaseContactInfo
391
- * @class BankContactInfo
392
- *
393
- * @example
394
- * ```typescript
395
- * const bank = Bank.from("CORUTZTZ", "TZ");
396
- * const contact = BankContactInfo.from({
397
- * accName: "John Doe",
398
- * bank,
399
- * accNo: "0150123456789"
400
- * });
401
- * ```
402
- */
403
- export declare class BankContactInfo extends BaseContactInfo {
404
- readonly accName: string;
405
- readonly bank: Bank;
406
- readonly accNo: string;
407
- /**
408
- * Creates a new bank contact with comprehensive validation.
409
- *
410
- * @deprecated Use {@link BankContactInfo.from} static factory method instead
411
- * @param {string} accName - The bank account holder's name
412
- * @param {Bank} bank - The bank institution object
413
- * @param {string} accNo - The bank account number
414
- *
415
- * @throws {ContactInfoError} When validation fails
416
- */
417
- constructor(accName: string, bank: Bank, accNo: string);
418
- /**
419
- * Creates a BankContactInfo instance from data object.
420
- * This is the preferred method for creating instances.
421
- *
422
- * @static
423
- * @param {Object} data - The bank contact data
424
- * @param {string} data.accName - The account holder's name
425
- * @param {Bank} data.bank - The bank institution object
426
- * @param {string} data.accNo - The bank account number
427
- *
428
- * @returns {BankContactInfo | undefined} New instance if successful, undefined if validation fails
429
- *
430
- * @example
431
- * ```typescript
432
- * const bank = Bank.from("CORUTZTZ", "TZ");
433
- * const contact = BankContactInfo.from({
434
- * accName: "John Doe",
435
- * bank,
436
- * accNo: "0150123456789"
437
- * });
438
- * ```
439
- */
440
- static from(data: {
441
- accName: string;
442
- bank: Bank;
443
- accNo: string;
444
- }): BankContactInfo | undefined;
445
- /**
446
- * Creates a BankContactInfo instance from a ContactDTO object.
447
- *
448
- * @static
449
- * @param {ContactDTO} info - The contact data transfer object
450
- * @returns {BankContactInfo | undefined} New instance if successful, undefined if validation fails
451
- */
452
- static fromContactDTO(info: ContactDTO): BankContactInfo | undefined;
453
- /**
454
- * Creates a BankContactInfo instance from a PayoutDTO object.
455
- *
456
- * @static
457
- * @param {PayoutDTO} info - The payout data transfer object
458
- * @returns {BankContactInfo | undefined} New instance if successful, undefined if parsing fails
459
- */
460
- static fromPayoutDTO(info: PayoutDTO): BankContactInfo | undefined;
461
- /**
462
- * Type guard to validate if an unknown object is a valid BankContactInfo instance.
463
- *
464
- * @static
465
- * @param {unknown} obj - The object to validate
466
- * @returns {obj is BankContactInfo} Type predicate indicating validity
467
- */
468
- static is(obj: unknown): obj is BankContactInfo;
469
- validate(): boolean;
470
- get accountName(): string;
471
- get accountNumber(): string;
472
- get accountNameLabel(): string;
473
- get accountNumberLabel(): string;
474
- get channelLabel(): string;
475
- get channelId(): BankSwiftCode;
476
- get channelName(): string;
477
- toJSON(): BankContactInfoJSON;
478
- static fromJSON(json: BankContactInfoJSON | string): BankContactInfo | undefined;
479
- static fromJSONString(jsonString: string): BankContactInfo | undefined;
480
- static isBankContactInfoJSON(obj: unknown): obj is BankContactInfoJSON;
481
- }
482
- /**
483
- * Union type representing either a mobile or bank contact.
484
- *
485
- * @typedef {MobileContactInfo | BankContactInfo} ContactInfo
486
- */
487
- export type ContactInfo = MobileContactInfo | BankContactInfo;
488
- export {};
@@ -1,16 +0,0 @@
1
- import { ContactInfo } from "@/modules/contact/contact-info.model.js";
2
- import { ContactInputDTO } from "./contact.dtos.js";
3
- /**
4
- * Factory for resolving and validating a raw `ContactInput` into a typed and valid version.
5
- */
6
- export declare class ValidatedContactInputFactory {
7
- private handlers;
8
- /**
9
- * Resolves a raw contact input into a valid and strongly-typed `ContactInput`.
10
- *
11
- * @param {ContactInputDTO} data - The unvalidated input object
12
- * @returns {ContactInputDTO} - A valid and converted input ready for use
13
- * @throws {Error} - If the input cannot be handled by any handler
14
- */
15
- resolve(data: ContactInfo): ContactInputDTO;
16
- }