@temboplus/frontend-core 0.2.20-beta.3 → 0.2.20-beta.5

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.
@@ -23,6 +23,11 @@ export declare class Bank {
23
23
  * The ISO 3166-1 alpha-2 country code (e.g., 'TZ', 'KE').
24
24
  */
25
25
  readonly countryCode: ISO2CountryCode;
26
+ /**
27
+ * Optional list of former names the bank was known by.
28
+ * Useful for historical reference and search functionality.
29
+ */
30
+ readonly formerNames?: string[];
26
31
  /**
27
32
  * Creates a new Bank instance.
28
33
  *
@@ -30,8 +35,19 @@ export declare class Bank {
30
35
  * @param shortName The commonly used short name or abbreviation for the bank
31
36
  * @param swiftCode The SWIFT/BIC code for the bank's head office
32
37
  * @param countryCode The ISO 3166-1 alpha-2 country code
38
+ * @param formerNames Optional list of former names the bank was known by
39
+ */
40
+ constructor(fullName: string, shortName: string, swiftCode: TZBankSwiftCode | KEBankSwiftCode, countryCode: ISO2CountryCode, formerNames?: string[]);
41
+ /**
42
+ * Checks if this bank has any former names recorded.
43
+ * @returns True if the bank has at least one former name, false otherwise.
33
44
  */
34
- constructor(fullName: string, shortName: string, swiftCode: TZBankSwiftCode | KEBankSwiftCode, countryCode: ISO2CountryCode);
45
+ hasFormerNames(): boolean;
46
+ /**
47
+ * Gets a display string showing the current name with former names in parentheses.
48
+ * @returns A formatted string, e.g., "Access Bank Tanzania Limited (formerly BancABC)"
49
+ */
50
+ getDisplayNameWithHistory(): string;
35
51
  /**
36
52
  * Returns a string representation of the bank.
37
53
  * @returns A formatted string, e.g., "CRDB BANK PLC (CRDB) - SWIFT: CORUTZTZ [TZ]"
@@ -47,17 +63,19 @@ export declare class Bank {
47
63
  * @returns {string} returns.shortName - The commonly used short name
48
64
  * @returns {string} returns.swiftCode - The SWIFT/BIC code
49
65
  * @returns {ISO2CountryCode} returns.countryCode - The ISO 3166-1 alpha-2 country code
66
+ * @returns {string[] | undefined} returns.formerNames - Optional list of former names
50
67
  *
51
68
  * @example
52
69
  * ```typescript
53
- * const bank = Bank.from("CORUTZTZ", "TZ");
70
+ * const bank = Bank.from("FMBZTZTX", "TZ");
54
71
  * const obj = bank.toObject();
55
72
  * console.log(obj);
56
73
  * // {
57
- * // fullName: "CRDB BANK PLC",
58
- * // shortName: "CRDB",
59
- * // swiftCode: "CORUTZTZ",
60
- * // countryCode: "TZ"
74
+ * // fullName: "Access Bank Tanzania Limited",
75
+ * // shortName: "ABT",
76
+ * // swiftCode: "FMBZTZTX",
77
+ * // countryCode: "TZ",
78
+ * // formerNames: ["BancABC"]
61
79
  * // }
62
80
  * ```
63
81
  */
@@ -66,6 +84,7 @@ export declare class Bank {
66
84
  shortName: string;
67
85
  swiftCode: TZBankSwiftCode | KEBankSwiftCode;
68
86
  countryCode: ISO2CountryCode;
87
+ formerNames?: string[];
69
88
  };
70
89
  /**
71
90
  * Static method to determine if an unknown object is a valid Bank object.
@@ -78,8 +97,8 @@ export declare class Bank {
78
97
  */
79
98
  static is(obj: unknown): obj is Bank;
80
99
  /**
81
- * Serializes the Bank instance to a JSON-compatible object
82
- */
100
+ * Serializes the Bank instance to a JSON-compatible object
101
+ */
83
102
  toJSON(): BankJSON;
84
103
  /**
85
104
  * Serializes the Bank instance to a JSON string
@@ -142,7 +161,6 @@ export declare class BankService {
142
161
  getAllBanks(countryCode: ISO2CountryCode): Bank[];
143
162
  /**
144
163
  * Retrieves all banks for all supported countries.
145
- * @param countryCode The ISO country code.
146
164
  * @returns An array of Bank instances, or empty array.
147
165
  */
148
166
  getAllSupportedBanks(): Bank[];
@@ -151,11 +169,25 @@ export declare class BankService {
151
169
  */
152
170
  detectBank(swiftCode: string): Bank | undefined;
153
171
  /**
154
- * Searches for banks within a specific country by name or SWIFT code.
172
+ * Searches for banks within a specific country by name, SWIFT code, or former names.
155
173
  * @param countryCode The ISO country code.
156
174
  * @param searchTerm The term to search for (case-insensitive).
157
175
  * @param limit Max number of results.
158
176
  * @returns An array of matching Bank instances.
159
177
  */
160
178
  searchBanks(countryCode: ISO2CountryCode, searchTerm: string, limit?: number): Bank[];
179
+ /**
180
+ * Searches for banks across all supported countries by name, SWIFT code, or former names.
181
+ * @param searchTerm The term to search for (case-insensitive).
182
+ * @param limit Max number of results.
183
+ * @returns An array of matching Bank instances from all supported countries.
184
+ */
185
+ searchAllBanks(searchTerm: string, limit?: number): Bank[];
186
+ /**
187
+ * Finds banks that were formerly known by a specific name.
188
+ * @param formerName The former name to search for (case-insensitive).
189
+ * @param countryCode Optional country code to limit the search.
190
+ * @returns An array of Bank instances that match the former name.
191
+ */
192
+ findByFormerName(formerName: string, countryCode?: ISO2CountryCode): Bank[];
161
193
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temboplus/frontend-core",
3
- "version": "0.2.20-beta.3",
3
+ "version": "0.2.20-beta.5",
4
4
  "description": "A JavaScript/TypeScript package providing common utilities and logic shared across front-end TemboPlus projects.",
5
5
  "author": "Okello Gerald",
6
6
  "license": "MIT",