@temboplus/frontend-core 0.2.4 → 0.2.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.
- package/README.md +12 -7
- package/esm/src/data/countries.d.ts +26 -3
- package/esm/src/data/countries.js +2227 -974
- package/esm/src/models/country/country.d.ts +134 -18
- package/esm/src/models/country/country.d.ts.map +1 -1
- package/esm/src/models/country/country.js +184 -12
- package/esm/src/models/country/service.d.ts +43 -7
- package/esm/src/models/country/service.d.ts.map +1 -1
- package/esm/src/models/country/service.js +197 -98
- package/package.json +1 -1
- package/script/src/data/countries.d.ts +26 -3
- package/script/src/data/countries.js +2227 -974
- package/script/src/models/country/country.d.ts +134 -18
- package/script/src/models/country/country.d.ts.map +1 -1
- package/script/src/models/country/country.js +185 -13
- package/script/src/models/country/service.d.ts +43 -7
- package/script/src/models/country/service.d.ts.map +1 -1
- package/script/src/models/country/service.js +196 -97
package/README.md
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
```markdown
|
|
2
1
|
# @temboplus/frontend-core
|
|
3
2
|
|
|
4
3
|
A robust and versatile JavaScript/TypeScript library designed to streamline the development of TemboPlus front-end applications. This library provides a comprehensive suite of utilities, standardized data models, and services to ensure consistency, efficiency, and maintainability across all TemboPlus projects.
|
|
@@ -18,7 +17,7 @@ This library offers a set of meticulously crafted data models, each designed to
|
|
|
18
17
|
* **TZPhoneNumber:** Specialized phone number handling for Tanzania, including network operator identification.
|
|
19
18
|
* **Amount:** Precise currency value management, with support for formatting and conversion.
|
|
20
19
|
* **Currency:** Detailed currency information, including symbols, formatting rules, and validation.
|
|
21
|
-
* **Country:**
|
|
20
|
+
* **Country:** Enhanced country data handling with ISO-2 and ISO-3 codes, official names, flag emojis, and strongly-typed geographical categorization.
|
|
22
21
|
* **Bank:** Consistent bank account information management.
|
|
23
22
|
|
|
24
23
|
## Report Management with `ReportManager`
|
|
@@ -70,7 +69,7 @@ import { ConfigService } from '@temboplus/frontend-core';
|
|
|
70
69
|
|
|
71
70
|
// Initialize configuration at application startup
|
|
72
71
|
ConfigService.instance.initialize({
|
|
73
|
-
pdfMakerBaseUrl: '
|
|
72
|
+
pdfMakerBaseUrl: 'http://localhost:3000' // Optional: Override default PDF maker base URL.
|
|
74
73
|
});
|
|
75
74
|
```
|
|
76
75
|
|
|
@@ -107,11 +106,17 @@ if (phoneNumber.validate()) {
|
|
|
107
106
|
Convenient static properties are available for accessing common data:
|
|
108
107
|
|
|
109
108
|
```typescript
|
|
110
|
-
import { Country, Currency, Bank } from '@temboplus/frontend-core';
|
|
109
|
+
import { Country, Currency, Bank, CONTINENT, SUB_REGION } from '@temboplus/frontend-core';
|
|
111
110
|
|
|
112
|
-
// Country access
|
|
111
|
+
// Country access with enhanced features
|
|
113
112
|
const tanzania = Country.TZ;
|
|
114
|
-
|
|
113
|
+
console.log(tanzania.flagEmoji); // 🇹🇿
|
|
114
|
+
console.log(tanzania.continent); // CONTINENT.AFRICA
|
|
115
|
+
console.log(tanzania.region); // SUB_REGION.EASTERN_AFRICA
|
|
116
|
+
|
|
117
|
+
// Regional country grouping with type-safe enums
|
|
118
|
+
const africanCountries = Country.getByContinent(CONTINENT.AFRICA);
|
|
119
|
+
const caribbeanCountries = Country.getByRegion(SUB_REGION.CARIBBEAN);
|
|
115
120
|
|
|
116
121
|
// Currency access
|
|
117
122
|
const usd = Currency.USD;
|
|
@@ -149,4 +154,4 @@ console.log(internationalPhone.getWithFormat(PhoneNumberFormat.INTERNATIONAL));
|
|
|
149
154
|
const tanzaniaPhone = TZPhoneNumber.from("0712345678");
|
|
150
155
|
console.log(tanzaniaPhone.getWithFormat(PhoneNumberFormat.INTERNATIONAL)); // +255 712 345 678
|
|
151
156
|
console.log(tanzaniaPhone.networkOperator.name); // "Yas"
|
|
152
|
-
```
|
|
157
|
+
```
|
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
dataset_name: string;
|
|
3
|
+
version: string;
|
|
4
|
+
description: string;
|
|
5
|
+
"source(s)": ({
|
|
6
|
+
name: string;
|
|
7
|
+
url: string;
|
|
8
|
+
} | {
|
|
9
|
+
name: string;
|
|
10
|
+
url: null;
|
|
11
|
+
})[];
|
|
12
|
+
last_updated: string;
|
|
13
|
+
creation_date: string;
|
|
14
|
+
license: string;
|
|
15
|
+
coverage: string;
|
|
16
|
+
contact_info: string;
|
|
17
|
+
notes: string;
|
|
18
|
+
countries: {
|
|
19
|
+
name: string;
|
|
20
|
+
name_official: string;
|
|
21
|
+
iso_2: string;
|
|
22
|
+
iso_3: string;
|
|
23
|
+
flag_emoji: string;
|
|
24
|
+
continent: string;
|
|
25
|
+
region: string;
|
|
26
|
+
}[];
|
|
27
|
+
};
|
|
5
28
|
export default _default;
|
|
6
29
|
//# sourceMappingURL=countries.d.ts.map
|