@temboplus/frontend-core 0.2.9 → 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/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/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
|
@@ -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
|
@@ -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
|