@temboplus/frontend-core 0.2.8 → 0.2.10
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/esm/src/models/bank/bank.d.ts +1 -1
- package/esm/src/models/bank/bank.d.ts.map +1 -1
- package/esm/src/models/bank/bank.js +5 -6
- package/esm/src/models/phone_number/format.d.ts +6 -7
- package/esm/src/models/phone_number/format.d.ts.map +1 -1
- package/esm/src/models/phone_number/format.js +6 -7
- package/esm/src/models/phone_number/global/phone_number.d.ts +1 -0
- package/esm/src/models/phone_number/global/phone_number.d.ts.map +1 -1
- package/esm/src/models/phone_number/global/phone_number.js +6 -0
- package/esm/src/models/phone_number/tz/phone_number.d.ts +6 -0
- package/esm/src/models/phone_number/tz/phone_number.d.ts.map +1 -1
- package/esm/src/models/phone_number/tz/phone_number.js +12 -0
- package/package.json +1 -1
- package/script/src/models/bank/bank.d.ts +1 -1
- package/script/src/models/bank/bank.d.ts.map +1 -1
- package/script/src/models/bank/bank.js +5 -6
- package/script/src/models/phone_number/format.d.ts +6 -7
- package/script/src/models/phone_number/format.d.ts.map +1 -1
- package/script/src/models/phone_number/format.js +6 -7
- package/script/src/models/phone_number/global/phone_number.d.ts +1 -0
- package/script/src/models/phone_number/global/phone_number.d.ts.map +1 -1
- package/script/src/models/phone_number/global/phone_number.js +6 -0
- package/script/src/models/phone_number/tz/phone_number.d.ts +6 -0
- package/script/src/models/phone_number/tz/phone_number.d.ts.map +1 -1
- package/script/src/models/phone_number/tz/phone_number.js +12 -0
|
@@ -76,7 +76,7 @@ export declare class Bank {
|
|
|
76
76
|
* @param {string} _shortName - The short name or abbreviated name of the bank
|
|
77
77
|
* @param {string} _swiftCode - The SWIFT code associated with the bank
|
|
78
78
|
*/
|
|
79
|
-
constructor(_fullName: string, _shortName: string, _swiftCode: string);
|
|
79
|
+
constructor(token: symbol, _fullName: string, _shortName: string, _swiftCode: string);
|
|
80
80
|
/**
|
|
81
81
|
* Gets the full name of the bank.
|
|
82
82
|
* @returns {string} The full name of the bank
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bank.d.ts","sourceRoot":"","sources":["../../../../src/src/models/bank/bank.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;
|
|
1
|
+
{"version":3,"file":"bank.d.ts","sourceRoot":"","sources":["../../../../src/src/models/bank/bank.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAMH;;;GAGG;AACH,qBAAa,IAAI;IAoDb,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,UAAU;IApD7B,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAC3B,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IAC1B,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IAC1B,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IAC9B,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAC3B,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IAC1B,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IAC1B,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IAC5B,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAC3B,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;IAClC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IAC1B,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IAC1B,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IAC1B,MAAM,CAAC,QAAQ,CAAC,KAAK,EAA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AQ/C;CACH"}
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* indexing without being directly exposed to external code.
|
|
23
23
|
*/
|
|
24
24
|
import file from "../../data/banks_tz.js";
|
|
25
|
+
const BankToken = Symbol("BankToken");
|
|
25
26
|
/**
|
|
26
27
|
* Represents a bank with essential details.
|
|
27
28
|
* @class Bank
|
|
@@ -35,7 +36,7 @@ export class Bank {
|
|
|
35
36
|
* @param {string} _shortName - The short name or abbreviated name of the bank
|
|
36
37
|
* @param {string} _swiftCode - The SWIFT code associated with the bank
|
|
37
38
|
*/
|
|
38
|
-
constructor(_fullName, _shortName, _swiftCode) {
|
|
39
|
+
constructor(token, _fullName, _shortName, _swiftCode) {
|
|
39
40
|
Object.defineProperty(this, "_fullName", {
|
|
40
41
|
enumerable: true,
|
|
41
42
|
configurable: true,
|
|
@@ -54,10 +55,8 @@ export class Bank {
|
|
|
54
55
|
writable: true,
|
|
55
56
|
value: _swiftCode
|
|
56
57
|
});
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (!callerIsService) {
|
|
60
|
-
throw new Error("Bank instances cannot be created directly. Use Bank.from() or access via Bank.CRDB, Bank.NMB, etc.");
|
|
58
|
+
if (token !== BankToken) {
|
|
59
|
+
throw new Error("Bank can only be instantiated by BankService.");
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
62
|
/**
|
|
@@ -281,7 +280,7 @@ export class BankService {
|
|
|
281
280
|
initialize() {
|
|
282
281
|
try {
|
|
283
282
|
const data = JSON.parse(JSON.stringify(file));
|
|
284
|
-
const banks = Object.values(data).map((b) => new Bank(b.fullName, b.shortName, b.swiftCode));
|
|
283
|
+
const banks = Object.values(data).map((b) => new Bank(BankToken, b.fullName, b.shortName, b.swiftCode));
|
|
285
284
|
const swiftCodeRecord = {};
|
|
286
285
|
const nameRecord = {};
|
|
287
286
|
const shortNameRecord = {};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enumeration for various phone number formats
|
|
3
|
-
*/
|
|
4
1
|
export declare enum PhoneNumberFormat {
|
|
5
|
-
/** E.164 format with plus sign (e.g., +
|
|
2
|
+
/** E.164 format with plus sign, no spaces (e.g., +255612345678) */
|
|
3
|
+
E164 = "E164",
|
|
4
|
+
/** International human-readable format with spaces (e.g., +255 612 345 678) */
|
|
6
5
|
INTERNATIONAL = "INTERNATIONAL",
|
|
7
|
-
/** National format
|
|
6
|
+
/** National human-readable format (e.g., 0612 345 678) */
|
|
8
7
|
NATIONAL = "NATIONAL",
|
|
9
|
-
/**
|
|
8
|
+
/** Raw digits of the national number (e.g., 612345678) */
|
|
10
9
|
COMPACT = "COMPACT",
|
|
11
|
-
/** RFC3966 format (e.g., tel:+
|
|
10
|
+
/** RFC3966 URI format (e.g., tel:+255612345678) */
|
|
12
11
|
RFC3966 = "RFC3966"
|
|
13
12
|
}
|
|
14
13
|
//# sourceMappingURL=format.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/format.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/format.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B,mEAAmE;IACnE,IAAI,SAAS;IAEb,+EAA+E;IAC/E,aAAa,kBAAkB;IAE/B,0DAA0D;IAC1D,QAAQ,aAAa;IAErB,0DAA0D;IAC1D,OAAO,YAAY;IAEnB,mDAAmD;IACnD,OAAO,YAAY;CACpB"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enumeration for various phone number formats
|
|
3
|
-
*/
|
|
4
1
|
export var PhoneNumberFormat;
|
|
5
2
|
(function (PhoneNumberFormat) {
|
|
6
|
-
/** E.164 format with plus sign (e.g., +
|
|
3
|
+
/** E.164 format with plus sign, no spaces (e.g., +255612345678) */
|
|
4
|
+
PhoneNumberFormat["E164"] = "E164";
|
|
5
|
+
/** International human-readable format with spaces (e.g., +255 612 345 678) */
|
|
7
6
|
PhoneNumberFormat["INTERNATIONAL"] = "INTERNATIONAL";
|
|
8
|
-
/** National format
|
|
7
|
+
/** National human-readable format (e.g., 0612 345 678) */
|
|
9
8
|
PhoneNumberFormat["NATIONAL"] = "NATIONAL";
|
|
10
|
-
/**
|
|
9
|
+
/** Raw digits of the national number (e.g., 612345678) */
|
|
11
10
|
PhoneNumberFormat["COMPACT"] = "COMPACT";
|
|
12
|
-
/** RFC3966 format (e.g., tel:+
|
|
11
|
+
/** RFC3966 URI format (e.g., tel:+255612345678) */
|
|
13
12
|
PhoneNumberFormat["RFC3966"] = "RFC3966";
|
|
14
13
|
})(PhoneNumberFormat || (PhoneNumberFormat = {}));
|
|
@@ -80,6 +80,7 @@ export declare class PhoneNumber {
|
|
|
80
80
|
* @returns The formatted phone number string
|
|
81
81
|
*/
|
|
82
82
|
getWithFormat(format: PhoneNumberFormat): string;
|
|
83
|
+
private formatE164;
|
|
83
84
|
/**
|
|
84
85
|
* Formats the phone number in international format
|
|
85
86
|
* Returns +{dial_code}{compactNumber} format
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone_number.d.ts","sourceRoot":"","sources":["../../../../../src/src/models/phone_number/global/phone_number.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAKnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAEvC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB,oCAAoC;IACpC,OAAO,CAAC,QAAQ,CAAU;IAC1B,gEAAgE;IAChE,OAAO,CAAC,cAAc,CAAS;IAE/B;;;;;;OAMG;IACH,OAAO;IAKP;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,eAAe,CAEjC;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAKrB;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED;;OAEG;IACH,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED;;;OAGG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"phone_number.d.ts","sourceRoot":"","sources":["../../../../../src/src/models/phone_number/global/phone_number.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAKnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAEvC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB,oCAAoC;IACpC,OAAO,CAAC,QAAQ,CAAU;IAC1B,gEAAgE;IAChE,OAAO,CAAC,cAAc,CAAS;IAE/B;;;;;;OAMG;IACH,OAAO;IAKP;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,eAAe,CAEjC;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAKrB;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED;;OAEG;IACH,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED;;;OAGG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;IAuBhD,OAAO,CAAC,UAAU;IAIlB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAI3B;;;OAGG;IACH,OAAO,CAAC,aAAa;IAIrB;;;;;OAKG;IACH,QAAQ,IAAI,OAAO;IAuCnB;;;;;;;;;OASG;WACW,IAAI,CAChB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,uBAAuB,GAChC,WAAW,GAAG,SAAS;IAsG1B;;;;;;;;;;;;;OAaG;WACW,eAAe,CAC3B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,OAAO,GACf,WAAW,GAAG,SAAS;IA0D1B;;;;;;OAMG;WACW,YAAY,CACxB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO;IAsBV;;;;;;OAMG;WACW,uBAAuB,CACnC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,GACvB,OAAO;IAaV;;;;;OAKG;WACW,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,WAAW;IA2BlD;;;;;;;;;OASG;WACW,UAAU,CACtB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,GAAG,SAAS;CAwDvB"}
|
|
@@ -92,6 +92,9 @@ export class PhoneNumber {
|
|
|
92
92
|
*/
|
|
93
93
|
getWithFormat(format) {
|
|
94
94
|
switch (format) {
|
|
95
|
+
case PhoneNumberFormat.E164:
|
|
96
|
+
// Format: +{dial_code}{compactNumber}
|
|
97
|
+
return this.formatE164();
|
|
95
98
|
case PhoneNumberFormat.INTERNATIONAL:
|
|
96
99
|
// Format: +{dial_code}{compactNumber}
|
|
97
100
|
return this.formatInternational();
|
|
@@ -109,6 +112,9 @@ export class PhoneNumber {
|
|
|
109
112
|
return this.formattedNumber;
|
|
110
113
|
}
|
|
111
114
|
}
|
|
115
|
+
formatE164() {
|
|
116
|
+
return `+${this.dialCode}${this._compactNumber}`;
|
|
117
|
+
}
|
|
112
118
|
/**
|
|
113
119
|
* Formats the phone number in international format
|
|
114
120
|
* Returns +{dial_code}{compactNumber} format
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* Tanzania's phone number system requires specific validation and formatting rules:
|
|
8
8
|
*
|
|
9
9
|
* 1. Phone numbers can be entered in multiple formats:
|
|
10
|
+
* - E164 format: "+255712345678"
|
|
10
11
|
* - International format: "+255712345678"
|
|
11
12
|
* - Local format with country code: "255712345678"
|
|
12
13
|
* - Local format with leading zero: "0712345678"
|
|
@@ -64,6 +65,11 @@ export declare class TZPhoneNumber {
|
|
|
64
65
|
* @returns The formatted phone number string
|
|
65
66
|
*/
|
|
66
67
|
getWithFormat(format: PhoneNumberFormat): string;
|
|
68
|
+
/**
|
|
69
|
+
* Formats the phone number in international format with spaces
|
|
70
|
+
* Format: +255XXXXXXXXX
|
|
71
|
+
*/
|
|
72
|
+
private formatE164;
|
|
67
73
|
/**
|
|
68
74
|
* Formats the phone number in international format with spaces
|
|
69
75
|
* Format: +255 XXX XXX XXX
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone_number.d.ts","sourceRoot":"","sources":["../../../../../src/src/models/phone_number/tz/phone_number.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"phone_number.d.ts","sourceRoot":"","sources":["../../../../../src/src/models/phone_number/tz/phone_number.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD;;GAEG;AACH,qBAAa,aAAa;IACxB;;OAEG;IACH,OAAO,CAAC,cAAc,CAAS;IAE/B;;;;;OAKG;IACH,OAAO;IAIP;;OAEG;IACH,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;IAsBhD;;;OAGG;IACH,OAAO,CAAC,UAAU;IAKlB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAQ3B;;;OAGG;IACH,OAAO,CAAC,cAAc;IAMtB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAIrB;;;;OAIG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;;;OAIG;IACH,IAAI,eAAe,IAAI,mBAAmB,CAMzC;IAED;;;;;OAKG;WACW,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAyC5D;;;;;OAKG;WACW,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;IAW1D;;;;;;;;;;;;;;;;;;;OAmBG;WACW,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,aAAa;IAYpD;;;OAGG;IACI,QAAQ,IAAI,OAAO;CAO3B"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* Tanzania's phone number system requires specific validation and formatting rules:
|
|
8
8
|
*
|
|
9
9
|
* 1. Phone numbers can be entered in multiple formats:
|
|
10
|
+
* - E164 format: "+255712345678"
|
|
10
11
|
* - International format: "+255712345678"
|
|
11
12
|
* - Local format with country code: "255712345678"
|
|
12
13
|
* - Local format with leading zero: "0712345678"
|
|
@@ -74,6 +75,9 @@ export class TZPhoneNumber {
|
|
|
74
75
|
*/
|
|
75
76
|
getWithFormat(format) {
|
|
76
77
|
switch (format) {
|
|
78
|
+
case PhoneNumberFormat.E164:
|
|
79
|
+
// Format: +255XXXXXXXXX
|
|
80
|
+
return this.formatE164();
|
|
77
81
|
case PhoneNumberFormat.INTERNATIONAL:
|
|
78
82
|
// Format: +255 XXX XXX XXX
|
|
79
83
|
return this.formatInternational();
|
|
@@ -90,6 +94,14 @@ export class TZPhoneNumber {
|
|
|
90
94
|
return `+255${this._compactNumber}`;
|
|
91
95
|
}
|
|
92
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Formats the phone number in international format with spaces
|
|
99
|
+
* Format: +255XXXXXXXXX
|
|
100
|
+
*/
|
|
101
|
+
formatE164() {
|
|
102
|
+
const num = this._compactNumber;
|
|
103
|
+
return `+255${num}`;
|
|
104
|
+
}
|
|
93
105
|
/**
|
|
94
106
|
* Formats the phone number in international format with spaces
|
|
95
107
|
* Format: +255 XXX XXX XXX
|
package/package.json
CHANGED
|
@@ -76,7 +76,7 @@ export declare class Bank {
|
|
|
76
76
|
* @param {string} _shortName - The short name or abbreviated name of the bank
|
|
77
77
|
* @param {string} _swiftCode - The SWIFT code associated with the bank
|
|
78
78
|
*/
|
|
79
|
-
constructor(_fullName: string, _shortName: string, _swiftCode: string);
|
|
79
|
+
constructor(token: symbol, _fullName: string, _shortName: string, _swiftCode: string);
|
|
80
80
|
/**
|
|
81
81
|
* Gets the full name of the bank.
|
|
82
82
|
* @returns {string} The full name of the bank
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bank.d.ts","sourceRoot":"","sources":["../../../../src/src/models/bank/bank.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;
|
|
1
|
+
{"version":3,"file":"bank.d.ts","sourceRoot":"","sources":["../../../../src/src/models/bank/bank.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAMH;;;GAGG;AACH,qBAAa,IAAI;IAoDb,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,UAA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,CAAC,MAAM,EAAE,IAAI,CAAC;IAItC;;;OAGG;IACH,mBAAmB,IAAI,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC;IAIxC;;;;OAIG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAKlD;;;;OAIG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAqChD;;;;OAIG;IACH,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;IAKpD;;;;OAIG;IACH,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;IAKlD;;;;;OAKG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW,GAAG,IAAI,EAAE;IAetD;;;;;;;OAOG;IACH,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,OAAO;IAQ1C;;;OAGG;IACH,gBAAgB,IAAI,MAAM,EAAE;IAI5B;;;;OAIG;IACH,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAIlD;;;;;OAKG;IACH,iBAAiB,eAAgB,MAAM,KAAG,OAAO,CAQ/C;CACH"}
|
|
@@ -28,6 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.BankService = exports.SWIFT_CODE_REGEX = exports.Bank = void 0;
|
|
30
30
|
const banks_tz_js_1 = __importDefault(require("../../data/banks_tz.js"));
|
|
31
|
+
const BankToken = Symbol("BankToken");
|
|
31
32
|
/**
|
|
32
33
|
* Represents a bank with essential details.
|
|
33
34
|
* @class Bank
|
|
@@ -41,7 +42,7 @@ class Bank {
|
|
|
41
42
|
* @param {string} _shortName - The short name or abbreviated name of the bank
|
|
42
43
|
* @param {string} _swiftCode - The SWIFT code associated with the bank
|
|
43
44
|
*/
|
|
44
|
-
constructor(_fullName, _shortName, _swiftCode) {
|
|
45
|
+
constructor(token, _fullName, _shortName, _swiftCode) {
|
|
45
46
|
Object.defineProperty(this, "_fullName", {
|
|
46
47
|
enumerable: true,
|
|
47
48
|
configurable: true,
|
|
@@ -60,10 +61,8 @@ class Bank {
|
|
|
60
61
|
writable: true,
|
|
61
62
|
value: _swiftCode
|
|
62
63
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (!callerIsService) {
|
|
66
|
-
throw new Error("Bank instances cannot be created directly. Use Bank.from() or access via Bank.CRDB, Bank.NMB, etc.");
|
|
64
|
+
if (token !== BankToken) {
|
|
65
|
+
throw new Error("Bank can only be instantiated by BankService.");
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
68
|
/**
|
|
@@ -288,7 +287,7 @@ class BankService {
|
|
|
288
287
|
initialize() {
|
|
289
288
|
try {
|
|
290
289
|
const data = JSON.parse(JSON.stringify(banks_tz_js_1.default));
|
|
291
|
-
const banks = Object.values(data).map((b) => new Bank(b.fullName, b.shortName, b.swiftCode));
|
|
290
|
+
const banks = Object.values(data).map((b) => new Bank(BankToken, b.fullName, b.shortName, b.swiftCode));
|
|
292
291
|
const swiftCodeRecord = {};
|
|
293
292
|
const nameRecord = {};
|
|
294
293
|
const shortNameRecord = {};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enumeration for various phone number formats
|
|
3
|
-
*/
|
|
4
1
|
export declare enum PhoneNumberFormat {
|
|
5
|
-
/** E.164 format with plus sign (e.g., +
|
|
2
|
+
/** E.164 format with plus sign, no spaces (e.g., +255612345678) */
|
|
3
|
+
E164 = "E164",
|
|
4
|
+
/** International human-readable format with spaces (e.g., +255 612 345 678) */
|
|
6
5
|
INTERNATIONAL = "INTERNATIONAL",
|
|
7
|
-
/** National format
|
|
6
|
+
/** National human-readable format (e.g., 0612 345 678) */
|
|
8
7
|
NATIONAL = "NATIONAL",
|
|
9
|
-
/**
|
|
8
|
+
/** Raw digits of the national number (e.g., 612345678) */
|
|
10
9
|
COMPACT = "COMPACT",
|
|
11
|
-
/** RFC3966 format (e.g., tel:+
|
|
10
|
+
/** RFC3966 URI format (e.g., tel:+255612345678) */
|
|
12
11
|
RFC3966 = "RFC3966"
|
|
13
12
|
}
|
|
14
13
|
//# sourceMappingURL=format.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/format.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/format.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B,mEAAmE;IACnE,IAAI,SAAS;IAEb,+EAA+E;IAC/E,aAAa,kBAAkB;IAE/B,0DAA0D;IAC1D,QAAQ,aAAa;IAErB,0DAA0D;IAC1D,OAAO,YAAY;IAEnB,mDAAmD;IACnD,OAAO,YAAY;CACpB"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PhoneNumberFormat = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Enumeration for various phone number formats
|
|
6
|
-
*/
|
|
7
4
|
var PhoneNumberFormat;
|
|
8
5
|
(function (PhoneNumberFormat) {
|
|
9
|
-
/** E.164 format with plus sign (e.g., +
|
|
6
|
+
/** E.164 format with plus sign, no spaces (e.g., +255612345678) */
|
|
7
|
+
PhoneNumberFormat["E164"] = "E164";
|
|
8
|
+
/** International human-readable format with spaces (e.g., +255 612 345 678) */
|
|
10
9
|
PhoneNumberFormat["INTERNATIONAL"] = "INTERNATIONAL";
|
|
11
|
-
/** National format
|
|
10
|
+
/** National human-readable format (e.g., 0612 345 678) */
|
|
12
11
|
PhoneNumberFormat["NATIONAL"] = "NATIONAL";
|
|
13
|
-
/**
|
|
12
|
+
/** Raw digits of the national number (e.g., 612345678) */
|
|
14
13
|
PhoneNumberFormat["COMPACT"] = "COMPACT";
|
|
15
|
-
/** RFC3966 format (e.g., tel:+
|
|
14
|
+
/** RFC3966 URI format (e.g., tel:+255612345678) */
|
|
16
15
|
PhoneNumberFormat["RFC3966"] = "RFC3966";
|
|
17
16
|
})(PhoneNumberFormat || (exports.PhoneNumberFormat = PhoneNumberFormat = {}));
|
|
@@ -80,6 +80,7 @@ export declare class PhoneNumber {
|
|
|
80
80
|
* @returns The formatted phone number string
|
|
81
81
|
*/
|
|
82
82
|
getWithFormat(format: PhoneNumberFormat): string;
|
|
83
|
+
private formatE164;
|
|
83
84
|
/**
|
|
84
85
|
* Formats the phone number in international format
|
|
85
86
|
* Returns +{dial_code}{compactNumber} format
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone_number.d.ts","sourceRoot":"","sources":["../../../../../src/src/models/phone_number/global/phone_number.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAKnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAEvC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB,oCAAoC;IACpC,OAAO,CAAC,QAAQ,CAAU;IAC1B,gEAAgE;IAChE,OAAO,CAAC,cAAc,CAAS;IAE/B;;;;;;OAMG;IACH,OAAO;IAKP;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,eAAe,CAEjC;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAKrB;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED;;OAEG;IACH,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED;;;OAGG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"phone_number.d.ts","sourceRoot":"","sources":["../../../../../src/src/models/phone_number/global/phone_number.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAKnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAEvC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB,oCAAoC;IACpC,OAAO,CAAC,QAAQ,CAAU;IAC1B,gEAAgE;IAChE,OAAO,CAAC,cAAc,CAAS;IAE/B;;;;;;OAMG;IACH,OAAO;IAKP;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,eAAe,CAEjC;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAKrB;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED;;OAEG;IACH,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED;;;OAGG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;IAuBhD,OAAO,CAAC,UAAU;IAIlB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAI3B;;;OAGG;IACH,OAAO,CAAC,aAAa;IAIrB;;;;;OAKG;IACH,QAAQ,IAAI,OAAO;IAuCnB;;;;;;;;;OASG;WACW,IAAI,CAChB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,uBAAuB,GAChC,WAAW,GAAG,SAAS;IAsG1B;;;;;;;;;;;;;OAaG;WACW,eAAe,CAC3B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,OAAO,GACf,WAAW,GAAG,SAAS;IA0D1B;;;;;;OAMG;WACW,YAAY,CACxB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO;IAsBV;;;;;;OAMG;WACW,uBAAuB,CACnC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,GACvB,OAAO;IAaV;;;;;OAKG;WACW,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,WAAW;IA2BlD;;;;;;;;;OASG;WACW,UAAU,CACtB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,GAAG,SAAS;CAwDvB"}
|
|
@@ -95,6 +95,9 @@ class PhoneNumber {
|
|
|
95
95
|
*/
|
|
96
96
|
getWithFormat(format) {
|
|
97
97
|
switch (format) {
|
|
98
|
+
case format_js_1.PhoneNumberFormat.E164:
|
|
99
|
+
// Format: +{dial_code}{compactNumber}
|
|
100
|
+
return this.formatE164();
|
|
98
101
|
case format_js_1.PhoneNumberFormat.INTERNATIONAL:
|
|
99
102
|
// Format: +{dial_code}{compactNumber}
|
|
100
103
|
return this.formatInternational();
|
|
@@ -112,6 +115,9 @@ class PhoneNumber {
|
|
|
112
115
|
return this.formattedNumber;
|
|
113
116
|
}
|
|
114
117
|
}
|
|
118
|
+
formatE164() {
|
|
119
|
+
return `+${this.dialCode}${this._compactNumber}`;
|
|
120
|
+
}
|
|
115
121
|
/**
|
|
116
122
|
* Formats the phone number in international format
|
|
117
123
|
* Returns +{dial_code}{compactNumber} format
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* Tanzania's phone number system requires specific validation and formatting rules:
|
|
8
8
|
*
|
|
9
9
|
* 1. Phone numbers can be entered in multiple formats:
|
|
10
|
+
* - E164 format: "+255712345678"
|
|
10
11
|
* - International format: "+255712345678"
|
|
11
12
|
* - Local format with country code: "255712345678"
|
|
12
13
|
* - Local format with leading zero: "0712345678"
|
|
@@ -64,6 +65,11 @@ export declare class TZPhoneNumber {
|
|
|
64
65
|
* @returns The formatted phone number string
|
|
65
66
|
*/
|
|
66
67
|
getWithFormat(format: PhoneNumberFormat): string;
|
|
68
|
+
/**
|
|
69
|
+
* Formats the phone number in international format with spaces
|
|
70
|
+
* Format: +255XXXXXXXXX
|
|
71
|
+
*/
|
|
72
|
+
private formatE164;
|
|
67
73
|
/**
|
|
68
74
|
* Formats the phone number in international format with spaces
|
|
69
75
|
* Format: +255 XXX XXX XXX
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone_number.d.ts","sourceRoot":"","sources":["../../../../../src/src/models/phone_number/tz/phone_number.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"phone_number.d.ts","sourceRoot":"","sources":["../../../../../src/src/models/phone_number/tz/phone_number.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD;;GAEG;AACH,qBAAa,aAAa;IACxB;;OAEG;IACH,OAAO,CAAC,cAAc,CAAS;IAE/B;;;;;OAKG;IACH,OAAO;IAIP;;OAEG;IACH,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;IAsBhD;;;OAGG;IACH,OAAO,CAAC,UAAU;IAKlB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAQ3B;;;OAGG;IACH,OAAO,CAAC,cAAc;IAMtB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAIrB;;;;OAIG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;;;OAIG;IACH,IAAI,eAAe,IAAI,mBAAmB,CAMzC;IAED;;;;;OAKG;WACW,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAyC5D;;;;;OAKG;WACW,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;IAW1D;;;;;;;;;;;;;;;;;;;OAmBG;WACW,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,aAAa;IAYpD;;;OAGG;IACI,QAAQ,IAAI,OAAO;CAO3B"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* Tanzania's phone number system requires specific validation and formatting rules:
|
|
9
9
|
*
|
|
10
10
|
* 1. Phone numbers can be entered in multiple formats:
|
|
11
|
+
* - E164 format: "+255712345678"
|
|
11
12
|
* - International format: "+255712345678"
|
|
12
13
|
* - Local format with country code: "255712345678"
|
|
13
14
|
* - Local format with leading zero: "0712345678"
|
|
@@ -77,6 +78,9 @@ class TZPhoneNumber {
|
|
|
77
78
|
*/
|
|
78
79
|
getWithFormat(format) {
|
|
79
80
|
switch (format) {
|
|
81
|
+
case format_js_1.PhoneNumberFormat.E164:
|
|
82
|
+
// Format: +255XXXXXXXXX
|
|
83
|
+
return this.formatE164();
|
|
80
84
|
case format_js_1.PhoneNumberFormat.INTERNATIONAL:
|
|
81
85
|
// Format: +255 XXX XXX XXX
|
|
82
86
|
return this.formatInternational();
|
|
@@ -93,6 +97,14 @@ class TZPhoneNumber {
|
|
|
93
97
|
return `+255${this._compactNumber}`;
|
|
94
98
|
}
|
|
95
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Formats the phone number in international format with spaces
|
|
102
|
+
* Format: +255XXXXXXXXX
|
|
103
|
+
*/
|
|
104
|
+
formatE164() {
|
|
105
|
+
const num = this._compactNumber;
|
|
106
|
+
return `+255${num}`;
|
|
107
|
+
}
|
|
96
108
|
/**
|
|
97
109
|
* Formats the phone number in international format with spaces
|
|
98
110
|
* Format: +255 XXX XXX XXX
|