@temboplus/frontend-core 0.1.0 → 0.2.1
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 +33 -44
- package/esm/src/models/amount/amount.d.ts.map +1 -1
- package/esm/src/models/amount/amount.js +0 -1
- package/esm/src/models/phone_number/index.d.ts +1 -1
- package/esm/src/models/phone_number/index.d.ts.map +1 -1
- package/esm/src/models/phone_number/index.js +1 -1
- package/esm/src/models/phone_number/network_operator.d.ts +30 -0
- package/esm/src/models/phone_number/network_operator.d.ts.map +1 -0
- package/esm/src/models/phone_number/network_operator.js +44 -0
- package/esm/src/models/phone_number/phone_number.d.ts +9 -8
- package/esm/src/models/phone_number/phone_number.d.ts.map +1 -1
- package/esm/src/models/phone_number/phone_number.js +15 -14
- package/package.json +2 -2
- package/script/src/models/amount/amount.d.ts.map +1 -1
- package/script/src/models/amount/amount.js +0 -1
- package/script/src/models/phone_number/index.d.ts +1 -1
- package/script/src/models/phone_number/index.d.ts.map +1 -1
- package/script/src/models/phone_number/index.js +1 -1
- package/script/src/models/phone_number/network_operator.d.ts +30 -0
- package/script/src/models/phone_number/network_operator.d.ts.map +1 -0
- package/script/src/models/phone_number/network_operator.js +47 -0
- package/script/src/models/phone_number/phone_number.d.ts +9 -8
- package/script/src/models/phone_number/phone_number.d.ts.map +1 -1
- package/script/src/models/phone_number/phone_number.js +15 -14
- package/esm/src/models/phone_number/telecom.d.ts +0 -25
- package/esm/src/models/phone_number/telecom.d.ts.map +0 -1
- package/esm/src/models/phone_number/telecom.js +0 -44
- package/script/src/models/phone_number/telecom.d.ts +0 -25
- package/script/src/models/phone_number/telecom.d.ts.map +0 -1
- package/script/src/models/phone_number/telecom.js +0 -47
package/README.md
CHANGED
|
@@ -1,72 +1,61 @@
|
|
|
1
1
|
# @temboplus/frontend-core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A foundational JavaScript/TypeScript library that powers TemboPlus front-end applications. This library provides essential tools and data models that ensure consistency across all TemboPlus projects.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## What's Inside
|
|
6
6
|
|
|
7
|
-
The
|
|
7
|
+
The library contains:
|
|
8
8
|
|
|
9
|
-
* Utilities
|
|
10
|
-
* Models
|
|
9
|
+
* **Utilities**: Ready-to-use helper functions for common development tasks
|
|
10
|
+
* **Data Models**: Standardized structures for handling data like phone numbers, amounts, and bank details
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Working with Data Models
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
Each model class implements three validation methods with distinct purposes:
|
|
14
|
+
Each data model in our library (PhoneNumber, Amount, and Bank) comes with three key validation methods to ensure your data is always correct and reliable.
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
### 1. Checking Object Types with `is`
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
Use this when you want to verify if an object is a valid model instance.
|
|
20
19
|
|
|
21
20
|
```typescript
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*Usage Example:*
|
|
28
|
-
```typescript
|
|
29
|
-
if (PhoneNumber.is(unknownObject)) {
|
|
30
|
-
// TypeScript now recognizes unknownObject as PhoneNumber
|
|
31
|
-
const phone = unknownObject;
|
|
21
|
+
// Example: Checking if an object is a valid phone number
|
|
22
|
+
if (PhoneNumber.is(someObject)) {
|
|
23
|
+
// If true, someObject is confirmed to be a PhoneNumber
|
|
24
|
+
const phoneNumber = someObject;
|
|
25
|
+
console.log(phoneNumber.label);
|
|
32
26
|
}
|
|
33
27
|
```
|
|
34
28
|
|
|
35
|
-
|
|
29
|
+
### 2. Validating Input Data with `canConstruct`
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
```typescript
|
|
40
|
-
public static canConstruct(input?: unknown): boolean
|
|
41
|
-
```
|
|
31
|
+
Before creating a new instance, use this to check if your input data is valid.
|
|
42
32
|
|
|
43
|
-
*Usage Example:*
|
|
44
33
|
```typescript
|
|
34
|
+
// Example: Validating user input before creating an Amount
|
|
45
35
|
if (Amount.canConstruct(userInput)) {
|
|
46
|
-
|
|
36
|
+
// Input is valid, safe to create a new Amount
|
|
37
|
+
const amount = Amount.from(userInput);
|
|
47
38
|
}
|
|
48
39
|
```
|
|
49
40
|
|
|
50
|
-
|
|
41
|
+
### 3. Verifying Instance Data with `validate`
|
|
51
42
|
|
|
52
|
-
|
|
43
|
+
Use this to ensure an existing instance's data remains valid after changes.
|
|
53
44
|
|
|
54
45
|
```typescript
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
throw new Error('Invalid bank instance');
|
|
46
|
+
// Example: Checking if bank data is still valid
|
|
47
|
+
const bank = new Bank(bankData);
|
|
48
|
+
if (bank.validate()) {
|
|
49
|
+
// Bank instance is valid
|
|
50
|
+
processBankTransaction(bank);
|
|
51
|
+
} else {
|
|
52
|
+
showError("Invalid bank information");
|
|
63
53
|
}
|
|
64
54
|
```
|
|
65
55
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
- The `is` method should be used when working with unknown objects that might be instances of your model classes
|
|
69
|
-
- Use `canConstruct` before attempting to create new instances from external data
|
|
70
|
-
- The `validate` method should be called after any operation that might affect the internal state of an instance
|
|
71
|
-
- These methods work together to provide type safety both at compile time and runtime
|
|
56
|
+
## Best Practices
|
|
72
57
|
|
|
58
|
+
* **Type Checking**: Use `is` when working with data from external sources or APIs
|
|
59
|
+
* **Safe Creation**: Always use `canConstruct` before creating new instances
|
|
60
|
+
* **Data Integrity**: Call `validate` after operations that modify instance data
|
|
61
|
+
* **Error Prevention**: These methods help catch issues early in development
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amount.d.ts","sourceRoot":"","sources":["../../../../src/src/models/amount/amount.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY,QAA2C,CAAC;AAE9D,cAAM,MAAM;IACV,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAE9B,OAAO;IAKP;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS;
|
|
1
|
+
{"version":3,"file":"amount.d.ts","sourceRoot":"","sources":["../../../../src/src/models/amount/amount.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY,QAA2C,CAAC;AAE9D,cAAM,MAAM;IACV,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAE9B,OAAO;IAKP;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS;IA0BvD;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;OAEG;IACH,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED;;OAEG;IACH,IAAI,qBAAqB,IAAI,MAAM,CAKlC;IAED;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,OAAO;IAS5D;;;;;;;;;;;;;;;OAeG;WACW,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM;IAsB7C;;;OAGG;IACI,QAAQ,IAAI,OAAO;CAO3B;AAuGD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents available mobile network operators in Tanzania
|
|
3
|
+
* @enum {string}
|
|
4
|
+
*/
|
|
5
|
+
export declare enum NetworkOperator {
|
|
6
|
+
VODACOM = "Vodacom",
|
|
7
|
+
AIRTEL = "Airtel",
|
|
8
|
+
TIGO = "Tigo",
|
|
9
|
+
HALOTEL = "Halotel"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Defines the structure for a mobile network operator's information
|
|
13
|
+
*/
|
|
14
|
+
export interface NetworkOperatorInfo {
|
|
15
|
+
/** Unique identifier for the network operator */
|
|
16
|
+
id: NetworkOperator;
|
|
17
|
+
/** List of mobile number prefixes assigned to this operator */
|
|
18
|
+
mobileNumberPrefixes: string[];
|
|
19
|
+
/** Display name of the network operator */
|
|
20
|
+
displayName: string;
|
|
21
|
+
/** Mobile money service name offered by the operator */
|
|
22
|
+
mobileMoneyService: string;
|
|
23
|
+
/** Brand color associated with the operator */
|
|
24
|
+
brandColor: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Comprehensive information about mobile network operators and their services
|
|
28
|
+
*/
|
|
29
|
+
export declare const NETWORK_OPERATOR_CONFIG: Record<NetworkOperator, NetworkOperatorInfo>;
|
|
30
|
+
//# sourceMappingURL=network_operator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network_operator.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/network_operator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,eAAe;IACzB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,iDAAiD;IACjD,EAAE,EAAE,eAAe,CAAC;IAEpB,+DAA+D;IAC/D,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAE/B,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IAEpB,wDAAwD;IACxD,kBAAkB,EAAE,MAAM,CAAC;IAE3B,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAC1C,eAAe,EACf,mBAAmB,CA8BpB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents available mobile network operators in Tanzania
|
|
3
|
+
* @enum {string}
|
|
4
|
+
*/
|
|
5
|
+
export var NetworkOperator;
|
|
6
|
+
(function (NetworkOperator) {
|
|
7
|
+
NetworkOperator["VODACOM"] = "Vodacom";
|
|
8
|
+
NetworkOperator["AIRTEL"] = "Airtel";
|
|
9
|
+
NetworkOperator["TIGO"] = "Tigo";
|
|
10
|
+
NetworkOperator["HALOTEL"] = "Halotel";
|
|
11
|
+
})(NetworkOperator || (NetworkOperator = {}));
|
|
12
|
+
/**
|
|
13
|
+
* Comprehensive information about mobile network operators and their services
|
|
14
|
+
*/
|
|
15
|
+
export const NETWORK_OPERATOR_CONFIG = {
|
|
16
|
+
[NetworkOperator.VODACOM]: {
|
|
17
|
+
id: NetworkOperator.VODACOM,
|
|
18
|
+
mobileNumberPrefixes: ["74", "75", "76"],
|
|
19
|
+
displayName: "Vodacom",
|
|
20
|
+
mobileMoneyService: "M-Pesa",
|
|
21
|
+
brandColor: "red",
|
|
22
|
+
},
|
|
23
|
+
[NetworkOperator.AIRTEL]: {
|
|
24
|
+
id: NetworkOperator.AIRTEL,
|
|
25
|
+
mobileNumberPrefixes: ["78", "79", "68", "69"],
|
|
26
|
+
displayName: "Airtel",
|
|
27
|
+
mobileMoneyService: "Airtel Money",
|
|
28
|
+
brandColor: "volcano",
|
|
29
|
+
},
|
|
30
|
+
[NetworkOperator.TIGO]: {
|
|
31
|
+
id: NetworkOperator.TIGO,
|
|
32
|
+
mobileNumberPrefixes: ["71", "65", "67", "77"],
|
|
33
|
+
displayName: "Yas",
|
|
34
|
+
mobileMoneyService: "Mixx",
|
|
35
|
+
brandColor: "blue",
|
|
36
|
+
},
|
|
37
|
+
[NetworkOperator.HALOTEL]: {
|
|
38
|
+
id: NetworkOperator.HALOTEL,
|
|
39
|
+
mobileNumberPrefixes: ["62", "61"],
|
|
40
|
+
displayName: "Halotel",
|
|
41
|
+
mobileMoneyService: "HaloPesa",
|
|
42
|
+
brandColor: "orange",
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -14,22 +14,23 @@
|
|
|
14
14
|
*
|
|
15
15
|
* 2. Valid numbers must:
|
|
16
16
|
* - Have exactly 9 digits after removing prefixes
|
|
17
|
-
* - Start with a valid
|
|
17
|
+
* - Start with a valid network operator prefix
|
|
18
18
|
* - Contain only numeric characters
|
|
19
19
|
*
|
|
20
|
-
* 3. Each
|
|
20
|
+
* 3. Each network operator has specific prefixes:
|
|
21
21
|
* - Vodacom: 71, 74, 75, etc.
|
|
22
22
|
* - Airtel: 68, 69, etc.
|
|
23
23
|
* - Tigo: 65, 67, etc.
|
|
24
|
+
* - Halotel: 62, etc.
|
|
24
25
|
*
|
|
25
26
|
* ## Solution
|
|
26
27
|
* The PhoneNumber class provides:
|
|
27
28
|
* 1. Parsing and validation of different input formats
|
|
28
29
|
* 2. Standardized storage in compact format
|
|
29
30
|
* 3. Formatting options for display and API use
|
|
30
|
-
* 4.
|
|
31
|
+
* 4. Network operator identification
|
|
31
32
|
*/
|
|
32
|
-
import { type
|
|
33
|
+
import { type NetworkOperatorInfo } from "./network_operator.js";
|
|
33
34
|
/**
|
|
34
35
|
* Enumeration for various mobile number formats.
|
|
35
36
|
* @enum {string}
|
|
@@ -68,11 +69,11 @@ export declare class PhoneNumber {
|
|
|
68
69
|
*/
|
|
69
70
|
get label(): string;
|
|
70
71
|
/**
|
|
71
|
-
* Derives the
|
|
72
|
+
* Derives the network operator information associated with the phone number by checking its prefix.
|
|
72
73
|
*
|
|
73
|
-
* @returns The `
|
|
74
|
+
* @returns The `NetworkOperatorInfo` object that matches the phone number prefix.
|
|
74
75
|
*/
|
|
75
|
-
get
|
|
76
|
+
get networkOperator(): NetworkOperatorInfo;
|
|
76
77
|
/**
|
|
77
78
|
* Creates a `PhoneNumber` instance from a given string.
|
|
78
79
|
*
|
|
@@ -105,7 +106,7 @@ export declare class PhoneNumber {
|
|
|
105
106
|
* Validates:
|
|
106
107
|
* - Has required compactNumber property
|
|
107
108
|
* - compactNumber is a 9-digit string
|
|
108
|
-
* - Prefix matches a valid
|
|
109
|
+
* - Prefix matches a valid network operator
|
|
109
110
|
*/
|
|
110
111
|
static is(obj: unknown): obj is PhoneNumber;
|
|
111
112
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone_number.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/phone_number.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"phone_number.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/phone_number.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AAE/B;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B,IAAI,QAAQ,CAAE,mCAAmC;IACjD,KAAK,SAAS,CAAE,oCAAoC;IACpD,EAAE,MAAM,CAAE,iCAAiC;IAC3C,IAAI,KAAK;CACV;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;gBACS,aAAa,EAAE,MAAM;IAIjC;;;;;OAKG;IACH,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM;IAIvD;;;;OAIG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;;;OAIG;IACH,IAAI,eAAe,IAAI,mBAAmB,CAMzC;IAED;;;;;OAKG;WACW,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAqCtD;;;;;OAKG;WACW,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;IAW1D;;;;;;;;;;;;;;;;;;;OAmBG;WACW,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,WAAW;IAYlD;;;OAGG;IACI,QAAQ,IAAI,OAAO;CAO3B"}
|
|
@@ -14,22 +14,23 @@
|
|
|
14
14
|
*
|
|
15
15
|
* 2. Valid numbers must:
|
|
16
16
|
* - Have exactly 9 digits after removing prefixes
|
|
17
|
-
* - Start with a valid
|
|
17
|
+
* - Start with a valid network operator prefix
|
|
18
18
|
* - Contain only numeric characters
|
|
19
19
|
*
|
|
20
|
-
* 3. Each
|
|
20
|
+
* 3. Each network operator has specific prefixes:
|
|
21
21
|
* - Vodacom: 71, 74, 75, etc.
|
|
22
22
|
* - Airtel: 68, 69, etc.
|
|
23
23
|
* - Tigo: 65, 67, etc.
|
|
24
|
+
* - Halotel: 62, etc.
|
|
24
25
|
*
|
|
25
26
|
* ## Solution
|
|
26
27
|
* The PhoneNumber class provides:
|
|
27
28
|
* 1. Parsing and validation of different input formats
|
|
28
29
|
* 2. Standardized storage in compact format
|
|
29
30
|
* 3. Formatting options for display and API use
|
|
30
|
-
* 4.
|
|
31
|
+
* 4. Network operator identification
|
|
31
32
|
*/
|
|
32
|
-
import {
|
|
33
|
+
import { NETWORK_OPERATOR_CONFIG, } from "./network_operator.js";
|
|
33
34
|
/**
|
|
34
35
|
* Enumeration for various mobile number formats.
|
|
35
36
|
* @enum {string}
|
|
@@ -80,13 +81,13 @@ export class PhoneNumber {
|
|
|
80
81
|
return this.getNumberWithFormat(MobileNumberFormat.s255);
|
|
81
82
|
}
|
|
82
83
|
/**
|
|
83
|
-
* Derives the
|
|
84
|
+
* Derives the network operator information associated with the phone number by checking its prefix.
|
|
84
85
|
*
|
|
85
|
-
* @returns The `
|
|
86
|
+
* @returns The `NetworkOperatorInfo` object that matches the phone number prefix.
|
|
86
87
|
*/
|
|
87
|
-
get
|
|
88
|
-
const
|
|
89
|
-
const result = Object.values(
|
|
88
|
+
get networkOperator() {
|
|
89
|
+
const prefix = this.compactNumber.substring(0, 2);
|
|
90
|
+
const result = Object.values(NETWORK_OPERATOR_CONFIG).find((operator) => operator.mobileNumberPrefixes.includes(prefix));
|
|
90
91
|
return result;
|
|
91
92
|
}
|
|
92
93
|
/**
|
|
@@ -120,10 +121,10 @@ export class PhoneNumber {
|
|
|
120
121
|
// Validate that the compact number length is correct.
|
|
121
122
|
if (compactNumber.length !== 9)
|
|
122
123
|
return;
|
|
123
|
-
// Check if the compact number matches any
|
|
124
|
-
const
|
|
125
|
-
const
|
|
126
|
-
if (!
|
|
124
|
+
// Check if the compact number matches any network operator prefix.
|
|
125
|
+
const prefix = compactNumber.substring(0, 2);
|
|
126
|
+
const operator = Object.values(NETWORK_OPERATOR_CONFIG).find((op) => op.mobileNumberPrefixes.includes(prefix));
|
|
127
|
+
if (!operator)
|
|
127
128
|
return;
|
|
128
129
|
return new PhoneNumber(compactNumber);
|
|
129
130
|
}
|
|
@@ -164,7 +165,7 @@ export class PhoneNumber {
|
|
|
164
165
|
* Validates:
|
|
165
166
|
* - Has required compactNumber property
|
|
166
167
|
* - compactNumber is a 9-digit string
|
|
167
|
-
* - Prefix matches a valid
|
|
168
|
+
* - Prefix matches a valid network operator
|
|
168
169
|
*/
|
|
169
170
|
static is(obj) {
|
|
170
171
|
if (!obj || typeof obj !== "object")
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temboplus/frontend-core",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"description": "A JavaScript/TypeScript package providing common utilities and logic shared across
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "A JavaScript/TypeScript package providing common utilities and logic shared across front-end TemboPlus projects.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/TemboPlus-Frontend/frontend-core-js.git"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amount.d.ts","sourceRoot":"","sources":["../../../../src/src/models/amount/amount.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY,QAA2C,CAAC;AAE9D,cAAM,MAAM;IACV,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAE9B,OAAO;IAKP;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS;
|
|
1
|
+
{"version":3,"file":"amount.d.ts","sourceRoot":"","sources":["../../../../src/src/models/amount/amount.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY,QAA2C,CAAC;AAE9D,cAAM,MAAM;IACV,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAE9B,OAAO;IAKP;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS;IA0BvD;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;OAEG;IACH,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED;;OAEG;IACH,IAAI,qBAAqB,IAAI,MAAM,CAKlC;IAED;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,OAAO;IAS5D;;;;;;;;;;;;;;;OAeG;WACW,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM;IAsB7C;;;OAGG;IACI,QAAQ,IAAI,OAAO;CAO3B;AAuGD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC"}
|
|
@@ -16,4 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./antd_validator.js"), exports);
|
|
18
18
|
__exportStar(require("./phone_number.js"), exports);
|
|
19
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./network_operator.js"), exports);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents available mobile network operators in Tanzania
|
|
3
|
+
* @enum {string}
|
|
4
|
+
*/
|
|
5
|
+
export declare enum NetworkOperator {
|
|
6
|
+
VODACOM = "Vodacom",
|
|
7
|
+
AIRTEL = "Airtel",
|
|
8
|
+
TIGO = "Tigo",
|
|
9
|
+
HALOTEL = "Halotel"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Defines the structure for a mobile network operator's information
|
|
13
|
+
*/
|
|
14
|
+
export interface NetworkOperatorInfo {
|
|
15
|
+
/** Unique identifier for the network operator */
|
|
16
|
+
id: NetworkOperator;
|
|
17
|
+
/** List of mobile number prefixes assigned to this operator */
|
|
18
|
+
mobileNumberPrefixes: string[];
|
|
19
|
+
/** Display name of the network operator */
|
|
20
|
+
displayName: string;
|
|
21
|
+
/** Mobile money service name offered by the operator */
|
|
22
|
+
mobileMoneyService: string;
|
|
23
|
+
/** Brand color associated with the operator */
|
|
24
|
+
brandColor: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Comprehensive information about mobile network operators and their services
|
|
28
|
+
*/
|
|
29
|
+
export declare const NETWORK_OPERATOR_CONFIG: Record<NetworkOperator, NetworkOperatorInfo>;
|
|
30
|
+
//# sourceMappingURL=network_operator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network_operator.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/network_operator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,eAAe;IACzB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,iDAAiD;IACjD,EAAE,EAAE,eAAe,CAAC;IAEpB,+DAA+D;IAC/D,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAE/B,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IAEpB,wDAAwD;IACxD,kBAAkB,EAAE,MAAM,CAAC;IAE3B,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAC1C,eAAe,EACf,mBAAmB,CA8BpB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NETWORK_OPERATOR_CONFIG = exports.NetworkOperator = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Represents available mobile network operators in Tanzania
|
|
6
|
+
* @enum {string}
|
|
7
|
+
*/
|
|
8
|
+
var NetworkOperator;
|
|
9
|
+
(function (NetworkOperator) {
|
|
10
|
+
NetworkOperator["VODACOM"] = "Vodacom";
|
|
11
|
+
NetworkOperator["AIRTEL"] = "Airtel";
|
|
12
|
+
NetworkOperator["TIGO"] = "Tigo";
|
|
13
|
+
NetworkOperator["HALOTEL"] = "Halotel";
|
|
14
|
+
})(NetworkOperator || (exports.NetworkOperator = NetworkOperator = {}));
|
|
15
|
+
/**
|
|
16
|
+
* Comprehensive information about mobile network operators and their services
|
|
17
|
+
*/
|
|
18
|
+
exports.NETWORK_OPERATOR_CONFIG = {
|
|
19
|
+
[NetworkOperator.VODACOM]: {
|
|
20
|
+
id: NetworkOperator.VODACOM,
|
|
21
|
+
mobileNumberPrefixes: ["74", "75", "76"],
|
|
22
|
+
displayName: "Vodacom",
|
|
23
|
+
mobileMoneyService: "M-Pesa",
|
|
24
|
+
brandColor: "red",
|
|
25
|
+
},
|
|
26
|
+
[NetworkOperator.AIRTEL]: {
|
|
27
|
+
id: NetworkOperator.AIRTEL,
|
|
28
|
+
mobileNumberPrefixes: ["78", "79", "68", "69"],
|
|
29
|
+
displayName: "Airtel",
|
|
30
|
+
mobileMoneyService: "Airtel Money",
|
|
31
|
+
brandColor: "volcano",
|
|
32
|
+
},
|
|
33
|
+
[NetworkOperator.TIGO]: {
|
|
34
|
+
id: NetworkOperator.TIGO,
|
|
35
|
+
mobileNumberPrefixes: ["71", "65", "67", "77"],
|
|
36
|
+
displayName: "Yas",
|
|
37
|
+
mobileMoneyService: "Mixx",
|
|
38
|
+
brandColor: "blue",
|
|
39
|
+
},
|
|
40
|
+
[NetworkOperator.HALOTEL]: {
|
|
41
|
+
id: NetworkOperator.HALOTEL,
|
|
42
|
+
mobileNumberPrefixes: ["62", "61"],
|
|
43
|
+
displayName: "Halotel",
|
|
44
|
+
mobileMoneyService: "HaloPesa",
|
|
45
|
+
brandColor: "orange",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -14,22 +14,23 @@
|
|
|
14
14
|
*
|
|
15
15
|
* 2. Valid numbers must:
|
|
16
16
|
* - Have exactly 9 digits after removing prefixes
|
|
17
|
-
* - Start with a valid
|
|
17
|
+
* - Start with a valid network operator prefix
|
|
18
18
|
* - Contain only numeric characters
|
|
19
19
|
*
|
|
20
|
-
* 3. Each
|
|
20
|
+
* 3. Each network operator has specific prefixes:
|
|
21
21
|
* - Vodacom: 71, 74, 75, etc.
|
|
22
22
|
* - Airtel: 68, 69, etc.
|
|
23
23
|
* - Tigo: 65, 67, etc.
|
|
24
|
+
* - Halotel: 62, etc.
|
|
24
25
|
*
|
|
25
26
|
* ## Solution
|
|
26
27
|
* The PhoneNumber class provides:
|
|
27
28
|
* 1. Parsing and validation of different input formats
|
|
28
29
|
* 2. Standardized storage in compact format
|
|
29
30
|
* 3. Formatting options for display and API use
|
|
30
|
-
* 4.
|
|
31
|
+
* 4. Network operator identification
|
|
31
32
|
*/
|
|
32
|
-
import { type
|
|
33
|
+
import { type NetworkOperatorInfo } from "./network_operator.js";
|
|
33
34
|
/**
|
|
34
35
|
* Enumeration for various mobile number formats.
|
|
35
36
|
* @enum {string}
|
|
@@ -68,11 +69,11 @@ export declare class PhoneNumber {
|
|
|
68
69
|
*/
|
|
69
70
|
get label(): string;
|
|
70
71
|
/**
|
|
71
|
-
* Derives the
|
|
72
|
+
* Derives the network operator information associated with the phone number by checking its prefix.
|
|
72
73
|
*
|
|
73
|
-
* @returns The `
|
|
74
|
+
* @returns The `NetworkOperatorInfo` object that matches the phone number prefix.
|
|
74
75
|
*/
|
|
75
|
-
get
|
|
76
|
+
get networkOperator(): NetworkOperatorInfo;
|
|
76
77
|
/**
|
|
77
78
|
* Creates a `PhoneNumber` instance from a given string.
|
|
78
79
|
*
|
|
@@ -105,7 +106,7 @@ export declare class PhoneNumber {
|
|
|
105
106
|
* Validates:
|
|
106
107
|
* - Has required compactNumber property
|
|
107
108
|
* - compactNumber is a 9-digit string
|
|
108
|
-
* - Prefix matches a valid
|
|
109
|
+
* - Prefix matches a valid network operator
|
|
109
110
|
*/
|
|
110
111
|
static is(obj: unknown): obj is PhoneNumber;
|
|
111
112
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone_number.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/phone_number.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"phone_number.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/phone_number.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AAE/B;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B,IAAI,QAAQ,CAAE,mCAAmC;IACjD,KAAK,SAAS,CAAE,oCAAoC;IACpD,EAAE,MAAM,CAAE,iCAAiC;IAC3C,IAAI,KAAK;CACV;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;gBACS,aAAa,EAAE,MAAM;IAIjC;;;;;OAKG;IACH,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM;IAIvD;;;;OAIG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;;;OAIG;IACH,IAAI,eAAe,IAAI,mBAAmB,CAMzC;IAED;;;;;OAKG;WACW,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAqCtD;;;;;OAKG;WACW,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;IAW1D;;;;;;;;;;;;;;;;;;;OAmBG;WACW,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,WAAW;IAYlD;;;OAGG;IACI,QAAQ,IAAI,OAAO;CAO3B"}
|
|
@@ -15,24 +15,25 @@
|
|
|
15
15
|
*
|
|
16
16
|
* 2. Valid numbers must:
|
|
17
17
|
* - Have exactly 9 digits after removing prefixes
|
|
18
|
-
* - Start with a valid
|
|
18
|
+
* - Start with a valid network operator prefix
|
|
19
19
|
* - Contain only numeric characters
|
|
20
20
|
*
|
|
21
|
-
* 3. Each
|
|
21
|
+
* 3. Each network operator has specific prefixes:
|
|
22
22
|
* - Vodacom: 71, 74, 75, etc.
|
|
23
23
|
* - Airtel: 68, 69, etc.
|
|
24
24
|
* - Tigo: 65, 67, etc.
|
|
25
|
+
* - Halotel: 62, etc.
|
|
25
26
|
*
|
|
26
27
|
* ## Solution
|
|
27
28
|
* The PhoneNumber class provides:
|
|
28
29
|
* 1. Parsing and validation of different input formats
|
|
29
30
|
* 2. Standardized storage in compact format
|
|
30
31
|
* 3. Formatting options for display and API use
|
|
31
|
-
* 4.
|
|
32
|
+
* 4. Network operator identification
|
|
32
33
|
*/
|
|
33
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
35
|
exports.PhoneNumber = exports.MobileNumberFormat = void 0;
|
|
35
|
-
const
|
|
36
|
+
const network_operator_js_1 = require("./network_operator.js");
|
|
36
37
|
/**
|
|
37
38
|
* Enumeration for various mobile number formats.
|
|
38
39
|
* @enum {string}
|
|
@@ -83,13 +84,13 @@ class PhoneNumber {
|
|
|
83
84
|
return this.getNumberWithFormat(MobileNumberFormat.s255);
|
|
84
85
|
}
|
|
85
86
|
/**
|
|
86
|
-
* Derives the
|
|
87
|
+
* Derives the network operator information associated with the phone number by checking its prefix.
|
|
87
88
|
*
|
|
88
|
-
* @returns The `
|
|
89
|
+
* @returns The `NetworkOperatorInfo` object that matches the phone number prefix.
|
|
89
90
|
*/
|
|
90
|
-
get
|
|
91
|
-
const
|
|
92
|
-
const result = Object.values(
|
|
91
|
+
get networkOperator() {
|
|
92
|
+
const prefix = this.compactNumber.substring(0, 2);
|
|
93
|
+
const result = Object.values(network_operator_js_1.NETWORK_OPERATOR_CONFIG).find((operator) => operator.mobileNumberPrefixes.includes(prefix));
|
|
93
94
|
return result;
|
|
94
95
|
}
|
|
95
96
|
/**
|
|
@@ -123,10 +124,10 @@ class PhoneNumber {
|
|
|
123
124
|
// Validate that the compact number length is correct.
|
|
124
125
|
if (compactNumber.length !== 9)
|
|
125
126
|
return;
|
|
126
|
-
// Check if the compact number matches any
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
if (!
|
|
127
|
+
// Check if the compact number matches any network operator prefix.
|
|
128
|
+
const prefix = compactNumber.substring(0, 2);
|
|
129
|
+
const operator = Object.values(network_operator_js_1.NETWORK_OPERATOR_CONFIG).find((op) => op.mobileNumberPrefixes.includes(prefix));
|
|
130
|
+
if (!operator)
|
|
130
131
|
return;
|
|
131
132
|
return new PhoneNumber(compactNumber);
|
|
132
133
|
}
|
|
@@ -167,7 +168,7 @@ class PhoneNumber {
|
|
|
167
168
|
* Validates:
|
|
168
169
|
* - Has required compactNumber property
|
|
169
170
|
* - compactNumber is a 9-digit string
|
|
170
|
-
* - Prefix matches a valid
|
|
171
|
+
* - Prefix matches a valid network operator
|
|
171
172
|
*/
|
|
172
173
|
static is(obj) {
|
|
173
174
|
if (!obj || typeof obj !== "object")
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enumeration for telecom identifiers.
|
|
3
|
-
* @enum {string}
|
|
4
|
-
*/
|
|
5
|
-
export declare enum TelecomID {
|
|
6
|
-
vodacom = "vodacom",
|
|
7
|
-
airtel = "airtel",
|
|
8
|
-
tigo = "tigo",
|
|
9
|
-
halotel = "halotel"
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Interface representing a telecom provider.
|
|
13
|
-
*/
|
|
14
|
-
export interface Telecom {
|
|
15
|
-
id: TelecomID;
|
|
16
|
-
prefixes: string[];
|
|
17
|
-
label: string;
|
|
18
|
-
company: string;
|
|
19
|
-
color: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Details for each telecom provider including prefixes and branding information.
|
|
23
|
-
*/
|
|
24
|
-
export declare const telecomDetails: Record<TelecomID, Telecom>;
|
|
25
|
-
//# sourceMappingURL=telecom.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telecom.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/telecom.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,SAAS;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,SAAS,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CA6BrD,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enumeration for telecom identifiers.
|
|
3
|
-
* @enum {string}
|
|
4
|
-
*/
|
|
5
|
-
export var TelecomID;
|
|
6
|
-
(function (TelecomID) {
|
|
7
|
-
TelecomID["vodacom"] = "vodacom";
|
|
8
|
-
TelecomID["airtel"] = "airtel";
|
|
9
|
-
TelecomID["tigo"] = "tigo";
|
|
10
|
-
TelecomID["halotel"] = "halotel";
|
|
11
|
-
})(TelecomID || (TelecomID = {}));
|
|
12
|
-
/**
|
|
13
|
-
* Details for each telecom provider including prefixes and branding information.
|
|
14
|
-
*/
|
|
15
|
-
export const telecomDetails = {
|
|
16
|
-
vodacom: {
|
|
17
|
-
id: TelecomID.vodacom,
|
|
18
|
-
prefixes: ["74", "75", "76"],
|
|
19
|
-
label: "Vodacom",
|
|
20
|
-
company: "M-Pesa",
|
|
21
|
-
color: "red",
|
|
22
|
-
},
|
|
23
|
-
airtel: {
|
|
24
|
-
id: TelecomID.airtel,
|
|
25
|
-
prefixes: ["78", "79", "68", "69"],
|
|
26
|
-
label: "Airtel",
|
|
27
|
-
company: "Airtel-Money",
|
|
28
|
-
color: "volcano",
|
|
29
|
-
},
|
|
30
|
-
tigo: {
|
|
31
|
-
id: TelecomID.tigo,
|
|
32
|
-
prefixes: ["71", "65", "67", "77"],
|
|
33
|
-
label: "Tigo",
|
|
34
|
-
company: "Tigo-Pesa",
|
|
35
|
-
color: "blue",
|
|
36
|
-
},
|
|
37
|
-
halotel: {
|
|
38
|
-
id: TelecomID.halotel,
|
|
39
|
-
prefixes: ["62", "61"],
|
|
40
|
-
label: "Halotel",
|
|
41
|
-
company: "Halo-Pesa",
|
|
42
|
-
color: "orange",
|
|
43
|
-
},
|
|
44
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enumeration for telecom identifiers.
|
|
3
|
-
* @enum {string}
|
|
4
|
-
*/
|
|
5
|
-
export declare enum TelecomID {
|
|
6
|
-
vodacom = "vodacom",
|
|
7
|
-
airtel = "airtel",
|
|
8
|
-
tigo = "tigo",
|
|
9
|
-
halotel = "halotel"
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Interface representing a telecom provider.
|
|
13
|
-
*/
|
|
14
|
-
export interface Telecom {
|
|
15
|
-
id: TelecomID;
|
|
16
|
-
prefixes: string[];
|
|
17
|
-
label: string;
|
|
18
|
-
company: string;
|
|
19
|
-
color: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Details for each telecom provider including prefixes and branding information.
|
|
23
|
-
*/
|
|
24
|
-
export declare const telecomDetails: Record<TelecomID, Telecom>;
|
|
25
|
-
//# sourceMappingURL=telecom.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telecom.d.ts","sourceRoot":"","sources":["../../../../src/src/models/phone_number/telecom.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,SAAS;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,SAAS,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CA6BrD,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.telecomDetails = exports.TelecomID = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Enumeration for telecom identifiers.
|
|
6
|
-
* @enum {string}
|
|
7
|
-
*/
|
|
8
|
-
var TelecomID;
|
|
9
|
-
(function (TelecomID) {
|
|
10
|
-
TelecomID["vodacom"] = "vodacom";
|
|
11
|
-
TelecomID["airtel"] = "airtel";
|
|
12
|
-
TelecomID["tigo"] = "tigo";
|
|
13
|
-
TelecomID["halotel"] = "halotel";
|
|
14
|
-
})(TelecomID || (exports.TelecomID = TelecomID = {}));
|
|
15
|
-
/**
|
|
16
|
-
* Details for each telecom provider including prefixes and branding information.
|
|
17
|
-
*/
|
|
18
|
-
exports.telecomDetails = {
|
|
19
|
-
vodacom: {
|
|
20
|
-
id: TelecomID.vodacom,
|
|
21
|
-
prefixes: ["74", "75", "76"],
|
|
22
|
-
label: "Vodacom",
|
|
23
|
-
company: "M-Pesa",
|
|
24
|
-
color: "red",
|
|
25
|
-
},
|
|
26
|
-
airtel: {
|
|
27
|
-
id: TelecomID.airtel,
|
|
28
|
-
prefixes: ["78", "79", "68", "69"],
|
|
29
|
-
label: "Airtel",
|
|
30
|
-
company: "Airtel-Money",
|
|
31
|
-
color: "volcano",
|
|
32
|
-
},
|
|
33
|
-
tigo: {
|
|
34
|
-
id: TelecomID.tigo,
|
|
35
|
-
prefixes: ["71", "65", "67", "77"],
|
|
36
|
-
label: "Tigo",
|
|
37
|
-
company: "Tigo-Pesa",
|
|
38
|
-
color: "blue",
|
|
39
|
-
},
|
|
40
|
-
halotel: {
|
|
41
|
-
id: TelecomID.halotel,
|
|
42
|
-
prefixes: ["62", "61"],
|
|
43
|
-
label: "Halotel",
|
|
44
|
-
company: "Halo-Pesa",
|
|
45
|
-
color: "orange",
|
|
46
|
-
},
|
|
47
|
-
};
|