grm-shared-library 1.1.181 → 1.1.183
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 +72 -2
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/modules/country/constants/country-defaults.const.js +20 -0
- package/dist/cjs/modules/country/constants/country-defaults.const.js.map +1 -0
- package/dist/cjs/modules/country/constants/supported-countries.const.js +64 -0
- package/dist/cjs/modules/country/constants/supported-countries.const.js.map +1 -0
- package/dist/cjs/modules/country/constants/supported-currencies.const.js +36 -0
- package/dist/cjs/modules/country/constants/supported-currencies.const.js.map +1 -0
- package/dist/cjs/modules/country/dtos/country-scope.dto.js +47 -0
- package/dist/cjs/modules/country/dtos/country-scope.dto.js.map +1 -0
- package/dist/cjs/modules/country/enums/calling-code.enum.js +19 -0
- package/dist/cjs/modules/country/enums/calling-code.enum.js.map +1 -0
- package/dist/cjs/modules/country/enums/country-code.enum.js +21 -0
- package/dist/cjs/modules/country/enums/country-code.enum.js.map +1 -0
- package/dist/cjs/modules/country/enums/currency-code.enum.js +20 -0
- package/dist/cjs/modules/country/enums/currency-code.enum.js.map +1 -0
- package/dist/cjs/modules/country/index.js +34 -0
- package/dist/cjs/modules/country/index.js.map +1 -0
- package/dist/cjs/modules/country/interfaces/geo-coordinates.js +3 -0
- package/dist/cjs/modules/country/interfaces/geo-coordinates.js.map +1 -0
- package/dist/cjs/modules/country/interfaces/map-bounds.js +3 -0
- package/dist/cjs/modules/country/interfaces/map-bounds.js.map +1 -0
- package/dist/cjs/modules/country/interfaces/supported-country-config.js +3 -0
- package/dist/cjs/modules/country/interfaces/supported-country-config.js.map +1 -0
- package/dist/cjs/modules/country/interfaces/supported-currency-config.js +3 -0
- package/dist/cjs/modules/country/interfaces/supported-currency-config.js.map +1 -0
- package/dist/cjs/modules/country/utils/country.util.js +60 -0
- package/dist/cjs/modules/country/utils/country.util.js.map +1 -0
- package/dist/cjs/modules/notification/enums/email-provider-name.enum.js +15 -0
- package/dist/cjs/modules/notification/enums/email-provider-name.enum.js.map +1 -0
- package/dist/cjs/modules/notification/enums/notification-channel.enum.js +15 -0
- package/dist/cjs/modules/notification/enums/notification-channel.enum.js.map +1 -0
- package/dist/cjs/modules/notification/enums/notification-overall-status.enum.js +16 -0
- package/dist/cjs/modules/notification/enums/notification-overall-status.enum.js.map +1 -0
- package/dist/cjs/modules/notification/enums/provider-failure-reason.enum.js +28 -0
- package/dist/cjs/modules/notification/enums/provider-failure-reason.enum.js.map +1 -0
- package/dist/cjs/modules/notification/enums/sms-provider-name.enum.js +14 -0
- package/dist/cjs/modules/notification/enums/sms-provider-name.enum.js.map +1 -0
- package/dist/cjs/modules/notification/index.js +32 -0
- package/dist/cjs/modules/notification/index.js.map +1 -0
- package/dist/cjs/modules/notification/interfaces/email-send-request.js +3 -0
- package/dist/cjs/modules/notification/interfaces/email-send-request.js.map +1 -0
- package/dist/cjs/modules/notification/interfaces/email-send-result.js +3 -0
- package/dist/cjs/modules/notification/interfaces/email-send-result.js.map +1 -0
- package/dist/cjs/modules/notification/interfaces/notification-dispatch-result.js +3 -0
- package/dist/cjs/modules/notification/interfaces/notification-dispatch-result.js.map +1 -0
- package/dist/cjs/modules/notification/interfaces/per-channel-result.js +3 -0
- package/dist/cjs/modules/notification/interfaces/per-channel-result.js.map +1 -0
- package/dist/cjs/modules/notification/interfaces/provider-attempt.js +3 -0
- package/dist/cjs/modules/notification/interfaces/provider-attempt.js.map +1 -0
- package/dist/cjs/modules/notification/interfaces/sms-send-request.js +3 -0
- package/dist/cjs/modules/notification/interfaces/sms-send-request.js.map +1 -0
- package/dist/cjs/modules/notification/interfaces/sms-send-result.js +3 -0
- package/dist/cjs/modules/notification/interfaces/sms-send-result.js.map +1 -0
- package/dist/cjs/modules/permission/data/permissions.data.js +66 -0
- package/dist/cjs/modules/permission/data/permissions.data.js.map +1 -1
- package/dist/cjs/modules/permission/enums/permission-actions.enum.js +58 -0
- package/dist/cjs/modules/permission/enums/permission-actions.enum.js.map +1 -1
- package/dist/cjs/modules/permission/enums/permissions-module.enum.js +2 -0
- package/dist/cjs/modules/permission/enums/permissions-module.enum.js.map +1 -1
- package/dist/cjs/modules/role/constants/roles-by-scope.js +3 -1
- package/dist/cjs/modules/role/constants/roles-by-scope.js.map +1 -1
- package/dist/cjs/modules/role/enums/role.enum.js +2 -0
- package/dist/cjs/modules/role/enums/role.enum.js.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/modules/country/constants/country-defaults.const.js +17 -0
- package/dist/esm/modules/country/constants/country-defaults.const.js.map +1 -0
- package/dist/esm/modules/country/constants/supported-countries.const.js +61 -0
- package/dist/esm/modules/country/constants/supported-countries.const.js.map +1 -0
- package/dist/esm/modules/country/constants/supported-currencies.const.js +33 -0
- package/dist/esm/modules/country/constants/supported-currencies.const.js.map +1 -0
- package/dist/esm/modules/country/dtos/country-scope.dto.js +43 -0
- package/dist/esm/modules/country/dtos/country-scope.dto.js.map +1 -0
- package/dist/esm/modules/country/enums/calling-code.enum.js +16 -0
- package/dist/esm/modules/country/enums/calling-code.enum.js.map +1 -0
- package/dist/esm/modules/country/enums/country-code.enum.js +18 -0
- package/dist/esm/modules/country/enums/country-code.enum.js.map +1 -0
- package/dist/esm/modules/country/enums/currency-code.enum.js +17 -0
- package/dist/esm/modules/country/enums/currency-code.enum.js.map +1 -0
- package/dist/esm/modules/country/index.js +18 -0
- package/dist/esm/modules/country/index.js.map +1 -0
- package/dist/esm/modules/country/interfaces/geo-coordinates.js +2 -0
- package/dist/esm/modules/country/interfaces/geo-coordinates.js.map +1 -0
- package/dist/esm/modules/country/interfaces/map-bounds.js +2 -0
- package/dist/esm/modules/country/interfaces/map-bounds.js.map +1 -0
- package/dist/esm/modules/country/interfaces/supported-country-config.js +2 -0
- package/dist/esm/modules/country/interfaces/supported-country-config.js.map +1 -0
- package/dist/esm/modules/country/interfaces/supported-currency-config.js +2 -0
- package/dist/esm/modules/country/interfaces/supported-currency-config.js.map +1 -0
- package/dist/esm/modules/country/utils/country.util.js +51 -0
- package/dist/esm/modules/country/utils/country.util.js.map +1 -0
- package/dist/esm/modules/notification/enums/email-provider-name.enum.js +12 -0
- package/dist/esm/modules/notification/enums/email-provider-name.enum.js.map +1 -0
- package/dist/esm/modules/notification/enums/notification-channel.enum.js +12 -0
- package/dist/esm/modules/notification/enums/notification-channel.enum.js.map +1 -0
- package/dist/esm/modules/notification/enums/notification-overall-status.enum.js +13 -0
- package/dist/esm/modules/notification/enums/notification-overall-status.enum.js.map +1 -0
- package/dist/esm/modules/notification/enums/provider-failure-reason.enum.js +25 -0
- package/dist/esm/modules/notification/enums/provider-failure-reason.enum.js.map +1 -0
- package/dist/esm/modules/notification/enums/sms-provider-name.enum.js +11 -0
- package/dist/esm/modules/notification/enums/sms-provider-name.enum.js.map +1 -0
- package/dist/esm/modules/notification/index.js +16 -0
- package/dist/esm/modules/notification/index.js.map +1 -0
- package/dist/esm/modules/notification/interfaces/email-send-request.js +2 -0
- package/dist/esm/modules/notification/interfaces/email-send-request.js.map +1 -0
- package/dist/esm/modules/notification/interfaces/email-send-result.js +2 -0
- package/dist/esm/modules/notification/interfaces/email-send-result.js.map +1 -0
- package/dist/esm/modules/notification/interfaces/notification-dispatch-result.js +2 -0
- package/dist/esm/modules/notification/interfaces/notification-dispatch-result.js.map +1 -0
- package/dist/esm/modules/notification/interfaces/per-channel-result.js +2 -0
- package/dist/esm/modules/notification/interfaces/per-channel-result.js.map +1 -0
- package/dist/esm/modules/notification/interfaces/provider-attempt.js +2 -0
- package/dist/esm/modules/notification/interfaces/provider-attempt.js.map +1 -0
- package/dist/esm/modules/notification/interfaces/sms-send-request.js +2 -0
- package/dist/esm/modules/notification/interfaces/sms-send-request.js.map +1 -0
- package/dist/esm/modules/notification/interfaces/sms-send-result.js +2 -0
- package/dist/esm/modules/notification/interfaces/sms-send-result.js.map +1 -0
- package/dist/esm/modules/permission/data/permissions.data.js +66 -0
- package/dist/esm/modules/permission/data/permissions.data.js.map +1 -1
- package/dist/esm/modules/permission/enums/permission-actions.enum.js +58 -0
- package/dist/esm/modules/permission/enums/permission-actions.enum.js.map +1 -1
- package/dist/esm/modules/permission/enums/permissions-module.enum.js +2 -0
- package/dist/esm/modules/permission/enums/permissions-module.enum.js.map +1 -1
- package/dist/esm/modules/role/constants/roles-by-scope.js +3 -1
- package/dist/esm/modules/role/constants/roles-by-scope.js.map +1 -1
- package/dist/esm/modules/role/enums/role.enum.js +2 -0
- package/dist/esm/modules/role/enums/role.enum.js.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/modules/country/constants/country-defaults.const.d.ts +15 -0
- package/dist/types/modules/country/constants/supported-countries.const.d.ts +13 -0
- package/dist/types/modules/country/constants/supported-currencies.const.d.ts +11 -0
- package/dist/types/modules/country/dtos/country-scope.dto.d.ts +13 -0
- package/dist/types/modules/country/enums/calling-code.enum.d.ts +14 -0
- package/dist/types/modules/country/enums/country-code.enum.d.ts +16 -0
- package/dist/types/modules/country/enums/currency-code.enum.d.ts +15 -0
- package/dist/types/modules/country/index.d.ts +12 -0
- package/dist/types/modules/country/interfaces/geo-coordinates.d.ts +12 -0
- package/dist/types/modules/country/interfaces/map-bounds.d.ts +16 -0
- package/dist/types/modules/country/interfaces/supported-country-config.d.ts +39 -0
- package/dist/types/modules/country/interfaces/supported-currency-config.d.ts +19 -0
- package/dist/types/modules/country/utils/country.util.d.ts +27 -0
- package/dist/types/modules/notification/enums/email-provider-name.enum.d.ts +10 -0
- package/dist/types/modules/notification/enums/notification-channel.enum.d.ts +10 -0
- package/dist/types/modules/notification/enums/notification-overall-status.enum.d.ts +11 -0
- package/dist/types/modules/notification/enums/provider-failure-reason.enum.d.ts +23 -0
- package/dist/types/modules/notification/enums/sms-provider-name.enum.d.ts +9 -0
- package/dist/types/modules/notification/index.d.ts +12 -0
- package/dist/types/modules/notification/interfaces/email-send-request.d.ts +35 -0
- package/dist/types/modules/notification/interfaces/email-send-result.d.ts +22 -0
- package/dist/types/modules/notification/interfaces/notification-dispatch-result.d.ts +26 -0
- package/dist/types/modules/notification/interfaces/per-channel-result.d.ts +22 -0
- package/dist/types/modules/notification/interfaces/provider-attempt.d.ts +25 -0
- package/dist/types/modules/notification/interfaces/sms-send-request.d.ts +18 -0
- package/dist/types/modules/notification/interfaces/sms-send-result.d.ts +22 -0
- package/dist/types/modules/permission/enums/permission-actions.enum.d.ts +57 -1
- package/dist/types/modules/permission/enums/permissions-module.enum.d.ts +3 -1
- package/dist/types/modules/role/enums/role.enum.d.ts +2 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,2 +1,72 @@
|
|
|
1
|
-
# grm-shared-library
|
|
2
|
-
|
|
1
|
+
# grm-shared-library
|
|
2
|
+
|
|
3
|
+
Common code for GRM — shared types, enums, interfaces, DTOs and constants for the
|
|
4
|
+
Clarion / Upesy backend NestJS microservices.
|
|
5
|
+
|
|
6
|
+
## Country & Currency (multi-country foundation)
|
|
7
|
+
|
|
8
|
+
Platform-level primitives for country-aware emergency response, newsfeed,
|
|
9
|
+
notifications, billing, maps and admin. This is the shared source of truth so
|
|
10
|
+
services stop hard-coding Kenya-specific values.
|
|
11
|
+
|
|
12
|
+
**Supported countries** (ISO 3166-1 alpha-2):
|
|
13
|
+
|
|
14
|
+
| Code | Country | Calling code | Currency | Symbol | Decimals | Timezone | Locale |
|
|
15
|
+
|------|----------|--------------|----------|--------|----------|------------------------|---------|
|
|
16
|
+
| `KE` | Kenya | `+254` | `KES` | `KSh` | 2 | `Africa/Nairobi` | `en-KE` |
|
|
17
|
+
| `UG` | Uganda | `+256` | `UGX` | `USh` | 0 | `Africa/Kampala` | `en-UG` |
|
|
18
|
+
| `TZ` | Tanzania | `+255` | `TZS` | `TSh` | 0 | `Africa/Dar_es_Salaam` | `en-TZ` |
|
|
19
|
+
|
|
20
|
+
**Supported currencies** (ISO 4217): `KES`, `UGX`, `TZS`.
|
|
21
|
+
|
|
22
|
+
### Importing
|
|
23
|
+
|
|
24
|
+
Everything is re-exported from the package root:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import {
|
|
28
|
+
CountryCode,
|
|
29
|
+
CurrencyCode,
|
|
30
|
+
CallingCode,
|
|
31
|
+
SupportedCountryConfig,
|
|
32
|
+
SupportedCurrencyConfig,
|
|
33
|
+
SUPPORTED_COUNTRIES, // readonly SupportedCountryConfig[]
|
|
34
|
+
SUPPORTED_COUNTRIES_BY_CODE, // Record<CountryCode, SupportedCountryConfig>
|
|
35
|
+
SUPPORTED_CURRENCIES,
|
|
36
|
+
SUPPORTED_CURRENCIES_BY_CODE,
|
|
37
|
+
DEFAULT_COUNTRY_CODE, // CountryCode.KE
|
|
38
|
+
DEFAULT_CURRENCY_CODE, // CurrencyCode.KES
|
|
39
|
+
CountryScopeDto, // optional { countryCode?, currencyCode? } request scope
|
|
40
|
+
getSupportedCountryConfig,
|
|
41
|
+
getSupportedCurrencyConfig,
|
|
42
|
+
getCurrencyForCountry,
|
|
43
|
+
getCallingCodeForCountry,
|
|
44
|
+
getCountryByCallingCode,
|
|
45
|
+
isSupportedCountryCode,
|
|
46
|
+
isSupportedCurrencyCode,
|
|
47
|
+
} from 'grm-shared-library';
|
|
48
|
+
|
|
49
|
+
getCurrencyForCountry(CountryCode.UG); // CurrencyCode.UGX
|
|
50
|
+
getCallingCodeForCountry(CountryCode.TZ); // '+255'
|
|
51
|
+
isSupportedCountryCode('US'); // false
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Backward compatibility
|
|
55
|
+
|
|
56
|
+
**Kenya (`KE` / `KES`) is the default market.** Wherever a country or currency is
|
|
57
|
+
not explicit, fall back to `DEFAULT_COUNTRY_CODE` / `DEFAULT_CURRENCY_CODE` /
|
|
58
|
+
`DEFAULT_TIMEZONE` / `DEFAULT_LOCALE`. Existing Kenyan users, packages, posts,
|
|
59
|
+
incidents, OTPs, notifications and billing flows are unaffected.
|
|
60
|
+
|
|
61
|
+
### Scope
|
|
62
|
+
|
|
63
|
+
This package provides the country/currency **primitives only**. Country
|
|
64
|
+
detection (GPS / IP / phone-number inference) and country-aware business logic
|
|
65
|
+
(phone login, newsfeed filtering, multi-currency billing, SMS routing, map
|
|
66
|
+
filtering) are delivered in later phases and should build on top of these types.
|
|
67
|
+
|
|
68
|
+
### Tests
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm test # compiles src/modules/country and runs the country/currency suite
|
|
72
|
+
```
|
package/dist/cjs/index.js
CHANGED
|
@@ -31,7 +31,9 @@ __exportStar(require("./modules/sms/index"), exports);
|
|
|
31
31
|
__exportStar(require("./modules/gis/index"), exports);
|
|
32
32
|
__exportStar(require("./modules/socket/index"), exports);
|
|
33
33
|
__exportStar(require("./modules/web-notification/index"), exports);
|
|
34
|
+
__exportStar(require("./modules/notification/index"), exports);
|
|
34
35
|
__exportStar(require("./modules/chat/index"), exports);
|
|
36
|
+
__exportStar(require("./modules/country/index"), exports);
|
|
35
37
|
// Interfaces
|
|
36
38
|
__exportStar(require("./interfaces/server-message"), exports);
|
|
37
39
|
__exportStar(require("./interfaces/i-request-with-user"), exports);
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,UAAU;AACV,uDAAqC;AACrC,+DAA6C;AAC7C,yDAAuC;AACvC,6DAA2C;AAC3C,uDAAqC;AACrC,uDAAqC;AACrC,iEAA+C;AAC/C,wDAAsC;AACtC,gEAA8C;AAC9C,2DAAyC;AACzC,2DAAyC;AACzC,sDAAoC;AACpC,sDAAoC;AACpC,sDAAoC;AACpC,yDAAuC;AACvC,mEAAiD;AACjD,uDAAqC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,UAAU;AACV,uDAAqC;AACrC,+DAA6C;AAC7C,yDAAuC;AACvC,6DAA2C;AAC3C,uDAAqC;AACrC,uDAAqC;AACrC,iEAA+C;AAC/C,wDAAsC;AACtC,gEAA8C;AAC9C,2DAAyC;AACzC,2DAAyC;AACzC,sDAAoC;AACpC,sDAAoC;AACpC,sDAAoC;AACpC,yDAAuC;AACvC,mEAAiD;AACjD,+DAA6C;AAC7C,uDAAqC;AACrC,0DAAwC;AAExC,aAAa;AACb,8DAA4C;AAC5C,mEAAiD;AACjD,8DAA4C;AAC5C,2DAAyC;AACzC,0DAAwC;AAExC,YAAY;AACZ,2DAAyC;AAEzC,QAAQ;AACR,gDAA8B;AAE9B,YAAY;AACZ,+DAA6C;AAC7C,wFAAsE;AAEtE,aAAa;AACb,qDAAmC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_LOCALE = exports.DEFAULT_TIMEZONE = exports.DEFAULT_CALLING_CODE = exports.DEFAULT_CURRENCY_CODE = exports.DEFAULT_COUNTRY_CODE = void 0;
|
|
4
|
+
const calling_code_enum_1 = require("../enums/calling-code.enum");
|
|
5
|
+
const country_code_enum_1 = require("../enums/country-code.enum");
|
|
6
|
+
const currency_code_enum_1 = require("../enums/currency-code.enum");
|
|
7
|
+
/**
|
|
8
|
+
* Platform defaults.
|
|
9
|
+
*
|
|
10
|
+
* Kenya remains the default / backward-compatible market: existing users,
|
|
11
|
+
* packages, posts, incidents, OTPs, notifications and billing flows continue
|
|
12
|
+
* to behave exactly as they did before multi-country support was introduced.
|
|
13
|
+
* Use these constants wherever a country/currency is not (yet) explicit.
|
|
14
|
+
*/
|
|
15
|
+
exports.DEFAULT_COUNTRY_CODE = country_code_enum_1.CountryCode.KE;
|
|
16
|
+
exports.DEFAULT_CURRENCY_CODE = currency_code_enum_1.CurrencyCode.KES;
|
|
17
|
+
exports.DEFAULT_CALLING_CODE = calling_code_enum_1.CallingCode.KE;
|
|
18
|
+
exports.DEFAULT_TIMEZONE = 'Africa/Nairobi';
|
|
19
|
+
exports.DEFAULT_LOCALE = 'en-KE';
|
|
20
|
+
//# sourceMappingURL=country-defaults.const.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country-defaults.const.js","sourceRoot":"","sources":["../../../../../src/modules/country/constants/country-defaults.const.ts"],"names":[],"mappings":";;;AAAA,kEAAyD;AACzD,kEAAyD;AACzD,oEAA2D;AAE3D;;;;;;;GAOG;AACU,QAAA,oBAAoB,GAAgB,+BAAW,CAAC,EAAE,CAAC;AACnD,QAAA,qBAAqB,GAAiB,iCAAY,CAAC,GAAG,CAAC;AACvD,QAAA,oBAAoB,GAAW,+BAAW,CAAC,EAAE,CAAC;AAC9C,QAAA,gBAAgB,GAAG,gBAAgB,CAAC;AACpC,QAAA,cAAc,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SUPPORTED_COUNTRIES = exports.SUPPORTED_COUNTRIES_BY_CODE = void 0;
|
|
4
|
+
const calling_code_enum_1 = require("../enums/calling-code.enum");
|
|
5
|
+
const country_code_enum_1 = require("../enums/country-code.enum");
|
|
6
|
+
const currency_code_enum_1 = require("../enums/currency-code.enum");
|
|
7
|
+
/**
|
|
8
|
+
* Supported countries keyed by ISO 3166-1 alpha-2 code (source of truth,
|
|
9
|
+
* O(1) lookup).
|
|
10
|
+
*
|
|
11
|
+
* The `Record<CountryCode, ...>` typing enforces at compile time that every
|
|
12
|
+
* country code has a configuration entry. Map centers are the capital cities;
|
|
13
|
+
* bounds are approximate country bounding boxes and can be refined later.
|
|
14
|
+
*/
|
|
15
|
+
exports.SUPPORTED_COUNTRIES_BY_CODE = {
|
|
16
|
+
[country_code_enum_1.CountryCode.KE]: {
|
|
17
|
+
code: country_code_enum_1.CountryCode.KE,
|
|
18
|
+
name: 'Kenya',
|
|
19
|
+
callingCode: calling_code_enum_1.CallingCode.KE,
|
|
20
|
+
currencyCode: currency_code_enum_1.CurrencyCode.KES,
|
|
21
|
+
currencySymbol: 'KSh',
|
|
22
|
+
currencyDecimalPlaces: 2,
|
|
23
|
+
timezone: 'Africa/Nairobi',
|
|
24
|
+
defaultLocale: 'en-KE',
|
|
25
|
+
googleMapsRegion: 'KE',
|
|
26
|
+
defaultMapCenter: { lat: -1.2921, lng: 36.8219 }, // Nairobi
|
|
27
|
+
defaultMapZoom: 6,
|
|
28
|
+
mapBounds: { north: 5.019, south: -4.72, east: 41.899, west: 33.909 },
|
|
29
|
+
enabled: true,
|
|
30
|
+
},
|
|
31
|
+
[country_code_enum_1.CountryCode.UG]: {
|
|
32
|
+
code: country_code_enum_1.CountryCode.UG,
|
|
33
|
+
name: 'Uganda',
|
|
34
|
+
callingCode: calling_code_enum_1.CallingCode.UG,
|
|
35
|
+
currencyCode: currency_code_enum_1.CurrencyCode.UGX,
|
|
36
|
+
currencySymbol: 'USh',
|
|
37
|
+
currencyDecimalPlaces: 0,
|
|
38
|
+
timezone: 'Africa/Kampala',
|
|
39
|
+
defaultLocale: 'en-UG',
|
|
40
|
+
googleMapsRegion: 'UG',
|
|
41
|
+
defaultMapCenter: { lat: 0.3476, lng: 32.5825 }, // Kampala
|
|
42
|
+
defaultMapZoom: 6,
|
|
43
|
+
mapBounds: { north: 4.234, south: -1.482, east: 35.036, west: 29.573 },
|
|
44
|
+
enabled: true,
|
|
45
|
+
},
|
|
46
|
+
[country_code_enum_1.CountryCode.TZ]: {
|
|
47
|
+
code: country_code_enum_1.CountryCode.TZ,
|
|
48
|
+
name: 'Tanzania',
|
|
49
|
+
callingCode: calling_code_enum_1.CallingCode.TZ,
|
|
50
|
+
currencyCode: currency_code_enum_1.CurrencyCode.TZS,
|
|
51
|
+
currencySymbol: 'TSh',
|
|
52
|
+
currencyDecimalPlaces: 0,
|
|
53
|
+
timezone: 'Africa/Dar_es_Salaam',
|
|
54
|
+
defaultLocale: 'en-TZ',
|
|
55
|
+
googleMapsRegion: 'TZ',
|
|
56
|
+
defaultMapCenter: { lat: -6.7924, lng: 39.2083 }, // Dar es Salaam
|
|
57
|
+
defaultMapZoom: 6,
|
|
58
|
+
mapBounds: { north: -0.984, south: -11.761, east: 40.444, west: 29.327 },
|
|
59
|
+
enabled: true,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
/** Supported countries as an array (convenient for iteration / pickers). */
|
|
63
|
+
exports.SUPPORTED_COUNTRIES = Object.values(exports.SUPPORTED_COUNTRIES_BY_CODE);
|
|
64
|
+
//# sourceMappingURL=supported-countries.const.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supported-countries.const.js","sourceRoot":"","sources":["../../../../../src/modules/country/constants/supported-countries.const.ts"],"names":[],"mappings":";;;AAAA,kEAAyD;AACzD,kEAAyD;AACzD,oEAA2D;AAG3D;;;;;;;GAOG;AACU,QAAA,2BAA2B,GAA0D;IAC9F,CAAC,+BAAW,CAAC,EAAE,CAAC,EAAE;QACd,IAAI,EAAE,+BAAW,CAAC,EAAE;QACpB,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,+BAAW,CAAC,EAAE;QAC3B,YAAY,EAAE,iCAAY,CAAC,GAAG;QAC9B,cAAc,EAAE,KAAK;QACrB,qBAAqB,EAAE,CAAC;QACxB,QAAQ,EAAE,gBAAgB;QAC1B,aAAa,EAAE,OAAO;QACtB,gBAAgB,EAAE,IAAI;QACtB,gBAAgB,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,UAAU;QAC5D,cAAc,EAAE,CAAC;QACjB,SAAS,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;QACrE,OAAO,EAAE,IAAI;KAChB;IACD,CAAC,+BAAW,CAAC,EAAE,CAAC,EAAE;QACd,IAAI,EAAE,+BAAW,CAAC,EAAE;QACpB,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,+BAAW,CAAC,EAAE;QAC3B,YAAY,EAAE,iCAAY,CAAC,GAAG;QAC9B,cAAc,EAAE,KAAK;QACrB,qBAAqB,EAAE,CAAC;QACxB,QAAQ,EAAE,gBAAgB;QAC1B,aAAa,EAAE,OAAO;QACtB,gBAAgB,EAAE,IAAI;QACtB,gBAAgB,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,UAAU;QAC3D,cAAc,EAAE,CAAC;QACjB,SAAS,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;QACtE,OAAO,EAAE,IAAI;KAChB;IACD,CAAC,+BAAW,CAAC,EAAE,CAAC,EAAE;QACd,IAAI,EAAE,+BAAW,CAAC,EAAE;QACpB,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,+BAAW,CAAC,EAAE;QAC3B,YAAY,EAAE,iCAAY,CAAC,GAAG;QAC9B,cAAc,EAAE,KAAK;QACrB,qBAAqB,EAAE,CAAC;QACxB,QAAQ,EAAE,sBAAsB;QAChC,aAAa,EAAE,OAAO;QACtB,gBAAgB,EAAE,IAAI;QACtB,gBAAgB,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,gBAAgB;QAClE,cAAc,EAAE,CAAC;QACjB,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;QACxE,OAAO,EAAE,IAAI;KAChB;CACJ,CAAC;AAEF,4EAA4E;AAC/D,QAAA,mBAAmB,GAC5B,MAAM,CAAC,MAAM,CAAC,mCAA2B,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SUPPORTED_CURRENCIES = exports.SUPPORTED_CURRENCIES_BY_CODE = void 0;
|
|
4
|
+
const currency_code_enum_1 = require("../enums/currency-code.enum");
|
|
5
|
+
/**
|
|
6
|
+
* Supported currencies keyed by ISO 4217 code (source of truth, O(1) lookup).
|
|
7
|
+
*
|
|
8
|
+
* The `Record<CurrencyCode, ...>` typing enforces at compile time that every
|
|
9
|
+
* currency code has a configuration entry.
|
|
10
|
+
*/
|
|
11
|
+
exports.SUPPORTED_CURRENCIES_BY_CODE = {
|
|
12
|
+
[currency_code_enum_1.CurrencyCode.KES]: {
|
|
13
|
+
code: currency_code_enum_1.CurrencyCode.KES,
|
|
14
|
+
name: 'Kenyan Shilling',
|
|
15
|
+
symbol: 'KSh',
|
|
16
|
+
decimalPlaces: 2,
|
|
17
|
+
enabled: true,
|
|
18
|
+
},
|
|
19
|
+
[currency_code_enum_1.CurrencyCode.UGX]: {
|
|
20
|
+
code: currency_code_enum_1.CurrencyCode.UGX,
|
|
21
|
+
name: 'Ugandan Shilling',
|
|
22
|
+
symbol: 'USh',
|
|
23
|
+
decimalPlaces: 0,
|
|
24
|
+
enabled: true,
|
|
25
|
+
},
|
|
26
|
+
[currency_code_enum_1.CurrencyCode.TZS]: {
|
|
27
|
+
code: currency_code_enum_1.CurrencyCode.TZS,
|
|
28
|
+
name: 'Tanzanian Shilling',
|
|
29
|
+
symbol: 'TSh',
|
|
30
|
+
decimalPlaces: 0,
|
|
31
|
+
enabled: true,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
/** Supported currencies as an array (convenient for iteration / pickers). */
|
|
35
|
+
exports.SUPPORTED_CURRENCIES = Object.values(exports.SUPPORTED_CURRENCIES_BY_CODE);
|
|
36
|
+
//# sourceMappingURL=supported-currencies.const.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supported-currencies.const.js","sourceRoot":"","sources":["../../../../../src/modules/country/constants/supported-currencies.const.ts"],"names":[],"mappings":";;;AAAA,oEAA2D;AAG3D;;;;;GAKG;AACU,QAAA,4BAA4B,GAA4D;IACjG,CAAC,iCAAY,CAAC,GAAG,CAAC,EAAE;QAChB,IAAI,EAAE,iCAAY,CAAC,GAAG;QACtB,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,KAAK;QACb,aAAa,EAAE,CAAC;QAChB,OAAO,EAAE,IAAI;KAChB;IACD,CAAC,iCAAY,CAAC,GAAG,CAAC,EAAE;QAChB,IAAI,EAAE,iCAAY,CAAC,GAAG;QACtB,IAAI,EAAE,kBAAkB;QACxB,MAAM,EAAE,KAAK;QACb,aAAa,EAAE,CAAC;QAChB,OAAO,EAAE,IAAI;KAChB;IACD,CAAC,iCAAY,CAAC,GAAG,CAAC,EAAE;QAChB,IAAI,EAAE,iCAAY,CAAC,GAAG;QACtB,IAAI,EAAE,oBAAoB;QAC1B,MAAM,EAAE,KAAK;QACb,aAAa,EAAE,CAAC;QAChB,OAAO,EAAE,IAAI;KAChB;CACJ,CAAC;AAEF,6EAA6E;AAChE,QAAA,oBAAoB,GAC7B,MAAM,CAAC,MAAM,CAAC,oCAA4B,CAAC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CountryScopeDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const country_code_enum_1 = require("../enums/country-code.enum");
|
|
16
|
+
const currency_code_enum_1 = require("../enums/currency-code.enum");
|
|
17
|
+
/**
|
|
18
|
+
* Reusable, optional country/currency scope for requests and queries.
|
|
19
|
+
*
|
|
20
|
+
* Compose or extend this into country-aware DTOs (newsfeed posts, service
|
|
21
|
+
* packages, billing queries, ...). Both fields are optional so existing
|
|
22
|
+
* single-country (Kenya) requests remain valid without any change.
|
|
23
|
+
*/
|
|
24
|
+
class CountryScopeDto {
|
|
25
|
+
}
|
|
26
|
+
exports.CountryScopeDto = CountryScopeDto;
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
29
|
+
description: 'ISO 3166-1 alpha-2 country code the request is scoped to',
|
|
30
|
+
enum: country_code_enum_1.CountryCode,
|
|
31
|
+
example: country_code_enum_1.CountryCode.KE,
|
|
32
|
+
}),
|
|
33
|
+
(0, class_validator_1.IsOptional)(),
|
|
34
|
+
(0, class_validator_1.IsEnum)(country_code_enum_1.CountryCode),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], CountryScopeDto.prototype, "countryCode", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
39
|
+
description: 'ISO 4217 currency code the request is scoped to',
|
|
40
|
+
enum: currency_code_enum_1.CurrencyCode,
|
|
41
|
+
example: currency_code_enum_1.CurrencyCode.KES,
|
|
42
|
+
}),
|
|
43
|
+
(0, class_validator_1.IsOptional)(),
|
|
44
|
+
(0, class_validator_1.IsEnum)(currency_code_enum_1.CurrencyCode),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], CountryScopeDto.prototype, "currencyCode", void 0);
|
|
47
|
+
//# sourceMappingURL=country-scope.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country-scope.dto.js","sourceRoot":"","sources":["../../../../../src/modules/country/dtos/country-scope.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAsD;AACtD,qDAAqD;AACrD,kEAAyD;AACzD,oEAA2D;AAE3D;;;;;;GAMG;AACH,MAAa,eAAe;CAkB3B;AAlBD,0CAkBC;AAVG;IAPC,IAAA,6BAAmB,EAAC;QACjB,WAAW,EAAE,0DAA0D;QACvE,IAAI,EAAE,+BAAW;QACjB,OAAO,EAAE,+BAAW,CAAC,EAAE;KAC1B,CAAC;IACD,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,EAAC,+BAAW,CAAC;;oDACM;AAS1B;IAPC,IAAA,6BAAmB,EAAC;QACjB,WAAW,EAAE,iDAAiD;QAC9D,IAAI,EAAE,iCAAY;QAClB,OAAO,EAAE,iCAAY,CAAC,GAAG;KAC5B,CAAC;IACD,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,EAAC,iCAAY,CAAC;;qDACO"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CallingCode = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* E.164 country calling codes, keyed by ISO 3166-1 alpha-2 country code.
|
|
6
|
+
*
|
|
7
|
+
* Kept as a string enum so the value (e.g. '+254') can be used directly when
|
|
8
|
+
* composing phone numbers, and the key (e.g. KE) aligns with {@link CountryCode}.
|
|
9
|
+
*/
|
|
10
|
+
var CallingCode;
|
|
11
|
+
(function (CallingCode) {
|
|
12
|
+
/** Kenya */
|
|
13
|
+
CallingCode["KE"] = "+254";
|
|
14
|
+
/** Uganda */
|
|
15
|
+
CallingCode["UG"] = "+256";
|
|
16
|
+
/** Tanzania */
|
|
17
|
+
CallingCode["TZ"] = "+255";
|
|
18
|
+
})(CallingCode || (exports.CallingCode = CallingCode = {}));
|
|
19
|
+
//# sourceMappingURL=calling-code.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calling-code.enum.js","sourceRoot":"","sources":["../../../../../src/modules/country/enums/calling-code.enum.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,IAAY,WAOX;AAPD,WAAY,WAAW;IACnB,YAAY;IACZ,0BAAW,CAAA;IACX,aAAa;IACb,0BAAW,CAAA;IACX,eAAe;IACf,0BAAW,CAAA;AACf,CAAC,EAPW,WAAW,2BAAX,WAAW,QAOtB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CountryCode = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Supported country codes.
|
|
6
|
+
*
|
|
7
|
+
* ISO 3166-1 alpha-2 country codes. These are the platform-level identifiers
|
|
8
|
+
* for every country the Clarion / Upesy platform operates in.
|
|
9
|
+
*
|
|
10
|
+
* Kenya (KE) is the default/backward-compatible market.
|
|
11
|
+
*/
|
|
12
|
+
var CountryCode;
|
|
13
|
+
(function (CountryCode) {
|
|
14
|
+
/** Kenya */
|
|
15
|
+
CountryCode["KE"] = "KE";
|
|
16
|
+
/** Uganda */
|
|
17
|
+
CountryCode["UG"] = "UG";
|
|
18
|
+
/** Tanzania */
|
|
19
|
+
CountryCode["TZ"] = "TZ";
|
|
20
|
+
})(CountryCode || (exports.CountryCode = CountryCode = {}));
|
|
21
|
+
//# sourceMappingURL=country-code.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country-code.enum.js","sourceRoot":"","sources":["../../../../../src/modules/country/enums/country-code.enum.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,IAAY,WAOX;AAPD,WAAY,WAAW;IACnB,YAAY;IACZ,wBAAS,CAAA;IACT,aAAa;IACb,wBAAS,CAAA;IACT,eAAe;IACf,wBAAS,CAAA;AACb,CAAC,EAPW,WAAW,2BAAX,WAAW,QAOtB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CurrencyCode = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Supported currency codes.
|
|
6
|
+
*
|
|
7
|
+
* ISO 4217 currency codes for the markets the platform operates in.
|
|
8
|
+
*
|
|
9
|
+
* KES (Kenyan Shilling) is the default/backward-compatible currency.
|
|
10
|
+
*/
|
|
11
|
+
var CurrencyCode;
|
|
12
|
+
(function (CurrencyCode) {
|
|
13
|
+
/** Kenyan Shilling */
|
|
14
|
+
CurrencyCode["KES"] = "KES";
|
|
15
|
+
/** Ugandan Shilling */
|
|
16
|
+
CurrencyCode["UGX"] = "UGX";
|
|
17
|
+
/** Tanzanian Shilling */
|
|
18
|
+
CurrencyCode["TZS"] = "TZS";
|
|
19
|
+
})(CurrencyCode || (exports.CurrencyCode = CurrencyCode = {}));
|
|
20
|
+
//# sourceMappingURL=currency-code.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency-code.enum.js","sourceRoot":"","sources":["../../../../../src/modules/country/enums/currency-code.enum.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,IAAY,YAOX;AAPD,WAAY,YAAY;IACpB,sBAAsB;IACtB,2BAAW,CAAA;IACX,uBAAuB;IACvB,2BAAW,CAAA;IACX,yBAAyB;IACzB,2BAAW,CAAA;AACf,CAAC,EAPW,YAAY,4BAAZ,YAAY,QAOvB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// Enums
|
|
18
|
+
__exportStar(require("./enums/country-code.enum"), exports);
|
|
19
|
+
__exportStar(require("./enums/currency-code.enum"), exports);
|
|
20
|
+
__exportStar(require("./enums/calling-code.enum"), exports);
|
|
21
|
+
// Interfaces
|
|
22
|
+
__exportStar(require("./interfaces/geo-coordinates"), exports);
|
|
23
|
+
__exportStar(require("./interfaces/map-bounds"), exports);
|
|
24
|
+
__exportStar(require("./interfaces/supported-currency-config"), exports);
|
|
25
|
+
__exportStar(require("./interfaces/supported-country-config"), exports);
|
|
26
|
+
// Constants
|
|
27
|
+
__exportStar(require("./constants/supported-currencies.const"), exports);
|
|
28
|
+
__exportStar(require("./constants/supported-countries.const"), exports);
|
|
29
|
+
__exportStar(require("./constants/country-defaults.const"), exports);
|
|
30
|
+
// DTOs
|
|
31
|
+
__exportStar(require("./dtos/country-scope.dto"), exports);
|
|
32
|
+
// Utilities
|
|
33
|
+
__exportStar(require("./utils/country.util"), exports);
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/country/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,QAAQ;AACR,4DAA0C;AAC1C,6DAA2C;AAC3C,4DAA0C;AAE1C,aAAa;AACb,+DAA6C;AAC7C,0DAAwC;AACxC,yEAAuD;AACvD,wEAAsD;AAEtD,YAAY;AACZ,yEAAuD;AACvD,wEAAsD;AACtD,qEAAmD;AAEnD,OAAO;AACP,2DAAyC;AAEzC,YAAY;AACZ,uDAAqC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geo-coordinates.js","sourceRoot":"","sources":["../../../../../src/modules/country/interfaces/geo-coordinates.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-bounds.js","sourceRoot":"","sources":["../../../../../src/modules/country/interfaces/map-bounds.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supported-country-config.js","sourceRoot":"","sources":["../../../../../src/modules/country/interfaces/supported-country-config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supported-currency-config.js","sourceRoot":"","sources":["../../../../../src/modules/country/interfaces/supported-currency-config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSupportedCountryCode = isSupportedCountryCode;
|
|
4
|
+
exports.isSupportedCurrencyCode = isSupportedCurrencyCode;
|
|
5
|
+
exports.getSupportedCountryConfig = getSupportedCountryConfig;
|
|
6
|
+
exports.getSupportedCurrencyConfig = getSupportedCurrencyConfig;
|
|
7
|
+
exports.getCurrencyForCountry = getCurrencyForCountry;
|
|
8
|
+
exports.getCallingCodeForCountry = getCallingCodeForCountry;
|
|
9
|
+
exports.getCountryByCallingCode = getCountryByCallingCode;
|
|
10
|
+
const supported_countries_const_1 = require("../constants/supported-countries.const");
|
|
11
|
+
const supported_currencies_const_1 = require("../constants/supported-currencies.const");
|
|
12
|
+
/**
|
|
13
|
+
* Country / currency helper utilities.
|
|
14
|
+
*
|
|
15
|
+
* These are intentionally simple, synchronous and dependency-free so they can
|
|
16
|
+
* be reused across every backend microservice without pulling in extra deps.
|
|
17
|
+
*/
|
|
18
|
+
/** Type guard: is `value` a supported ISO 3166-1 alpha-2 country code? */
|
|
19
|
+
function isSupportedCountryCode(value) {
|
|
20
|
+
return (typeof value === 'string' &&
|
|
21
|
+
Object.prototype.hasOwnProperty.call(supported_countries_const_1.SUPPORTED_COUNTRIES_BY_CODE, value));
|
|
22
|
+
}
|
|
23
|
+
/** Type guard: is `value` a supported ISO 4217 currency code? */
|
|
24
|
+
function isSupportedCurrencyCode(value) {
|
|
25
|
+
return (typeof value === 'string' &&
|
|
26
|
+
Object.prototype.hasOwnProperty.call(supported_currencies_const_1.SUPPORTED_CURRENCIES_BY_CODE, value));
|
|
27
|
+
}
|
|
28
|
+
/** Get the full config for a supported country, or `undefined` if unsupported. */
|
|
29
|
+
function getSupportedCountryConfig(countryCode) {
|
|
30
|
+
return isSupportedCountryCode(countryCode)
|
|
31
|
+
? supported_countries_const_1.SUPPORTED_COUNTRIES_BY_CODE[countryCode]
|
|
32
|
+
: undefined;
|
|
33
|
+
}
|
|
34
|
+
/** Get the full config for a supported currency, or `undefined` if unsupported. */
|
|
35
|
+
function getSupportedCurrencyConfig(currencyCode) {
|
|
36
|
+
return isSupportedCurrencyCode(currencyCode)
|
|
37
|
+
? supported_currencies_const_1.SUPPORTED_CURRENCIES_BY_CODE[currencyCode]
|
|
38
|
+
: undefined;
|
|
39
|
+
}
|
|
40
|
+
/** Resolve the currency used by a supported country, or `undefined`. */
|
|
41
|
+
function getCurrencyForCountry(countryCode) {
|
|
42
|
+
var _a;
|
|
43
|
+
return (_a = getSupportedCountryConfig(countryCode)) === null || _a === void 0 ? void 0 : _a.currencyCode;
|
|
44
|
+
}
|
|
45
|
+
/** Resolve the E.164 calling code (e.g. '+254') for a supported country, or `undefined`. */
|
|
46
|
+
function getCallingCodeForCountry(countryCode) {
|
|
47
|
+
var _a;
|
|
48
|
+
return (_a = getSupportedCountryConfig(countryCode)) === null || _a === void 0 ? void 0 : _a.callingCode;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Reverse lookup: find the supported country whose E.164 calling code matches
|
|
52
|
+
* `callingCode` (e.g. '+254' -> Kenya), or `undefined` if none match.
|
|
53
|
+
*/
|
|
54
|
+
function getCountryByCallingCode(callingCode) {
|
|
55
|
+
if (!callingCode) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
return supported_countries_const_1.SUPPORTED_COUNTRIES.find((country) => country.callingCode === callingCode);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=country.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country.util.js","sourceRoot":"","sources":["../../../../../src/modules/country/utils/country.util.ts"],"names":[],"mappings":";;AAeA,wDAKC;AAGD,0DAKC;AAGD,8DAMC;AAGD,gEAMC;AAGD,sDAIC;AAGD,4DAIC;AAMD,0DAOC;AAzED,sFAA0G;AAC1G,wFAAuF;AAMvF;;;;;GAKG;AAEH,0EAA0E;AAC1E,SAAgB,sBAAsB,CAAC,KAAc;IACjD,OAAO,CACH,OAAO,KAAK,KAAK,QAAQ;QACzB,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,uDAA2B,EAAE,KAAK,CAAC,CAC3E,CAAC;AACN,CAAC;AAED,iEAAiE;AACjE,SAAgB,uBAAuB,CAAC,KAAc;IAClD,OAAO,CACH,OAAO,KAAK,KAAK,QAAQ;QACzB,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,yDAA4B,EAAE,KAAK,CAAC,CAC5E,CAAC;AACN,CAAC;AAED,kFAAkF;AAClF,SAAgB,yBAAyB,CACrC,WAAsC;IAEtC,OAAO,sBAAsB,CAAC,WAAW,CAAC;QACtC,CAAC,CAAC,uDAA2B,CAAC,WAAW,CAAC;QAC1C,CAAC,CAAC,SAAS,CAAC;AACpB,CAAC;AAED,mFAAmF;AACnF,SAAgB,0BAA0B,CACtC,YAAuC;IAEvC,OAAO,uBAAuB,CAAC,YAAY,CAAC;QACxC,CAAC,CAAC,yDAA4B,CAAC,YAAY,CAAC;QAC5C,CAAC,CAAC,SAAS,CAAC;AACpB,CAAC;AAED,wEAAwE;AACxE,SAAgB,qBAAqB,CACjC,WAAsC;;IAEtC,OAAO,MAAA,yBAAyB,CAAC,WAAW,CAAC,0CAAE,YAAY,CAAC;AAChE,CAAC;AAED,4FAA4F;AAC5F,SAAgB,wBAAwB,CACpC,WAAsC;;IAEtC,OAAO,MAAA,yBAAyB,CAAC,WAAW,CAAC,0CAAE,WAAW,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CACnC,WAAsC;IAEtC,IAAI,CAAC,WAAW,EAAE,CAAC;QACf,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,+CAAmB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,KAAK,WAAW,CAAC,CAAC;AACtF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmailProviderName = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Identifiers for the email providers the notification service can dispatch through.
|
|
6
|
+
* TWILIO_SENDGRID is the Twilio email provider (SendGrid API).
|
|
7
|
+
* Provider order/fallback is configuration-driven; new providers can be appended.
|
|
8
|
+
*/
|
|
9
|
+
var EmailProviderName;
|
|
10
|
+
(function (EmailProviderName) {
|
|
11
|
+
EmailProviderName["TWILIO_SENDGRID"] = "twilio_sendgrid";
|
|
12
|
+
EmailProviderName["MAILGUN"] = "mailgun";
|
|
13
|
+
EmailProviderName["SES"] = "ses";
|
|
14
|
+
})(EmailProviderName || (exports.EmailProviderName = EmailProviderName = {}));
|
|
15
|
+
//# sourceMappingURL=email-provider-name.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-provider-name.enum.js","sourceRoot":"","sources":["../../../../../src/modules/notification/enums/email-provider-name.enum.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IACzB,wDAAmC,CAAA;IACnC,wCAAmB,CAAA;IACnB,gCAAW,CAAA;AACf,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationChannel = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Delivery channels supported by the clarion-notification service.
|
|
6
|
+
* Used to key per-channel dispatch results.
|
|
7
|
+
*/
|
|
8
|
+
var NotificationChannel;
|
|
9
|
+
(function (NotificationChannel) {
|
|
10
|
+
NotificationChannel["SMS"] = "SMS";
|
|
11
|
+
NotificationChannel["EMAIL"] = "EMAIL";
|
|
12
|
+
NotificationChannel["PUSH"] = "PUSH";
|
|
13
|
+
NotificationChannel["WEB"] = "WEB";
|
|
14
|
+
})(NotificationChannel || (exports.NotificationChannel = NotificationChannel = {}));
|
|
15
|
+
//# sourceMappingURL=notification-channel.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-channel.enum.js","sourceRoot":"","sources":["../../../../../src/modules/notification/enums/notification-channel.enum.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC3B,kCAAW,CAAA;IACX,sCAAe,CAAA;IACf,oCAAa,CAAA;IACb,kCAAW,CAAA;AACf,CAAC,EALW,mBAAmB,mCAAnB,mBAAmB,QAK9B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationOverallStatus = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Aggregate status for a multi-channel notification dispatch.
|
|
6
|
+
* - SUCCESS: every attempted channel succeeded.
|
|
7
|
+
* - PARTIAL_SUCCESS: at least one channel succeeded and at least one failed.
|
|
8
|
+
* - FAILED: no attempted channel succeeded.
|
|
9
|
+
*/
|
|
10
|
+
var NotificationOverallStatus;
|
|
11
|
+
(function (NotificationOverallStatus) {
|
|
12
|
+
NotificationOverallStatus["SUCCESS"] = "SUCCESS";
|
|
13
|
+
NotificationOverallStatus["PARTIAL_SUCCESS"] = "PARTIAL_SUCCESS";
|
|
14
|
+
NotificationOverallStatus["FAILED"] = "FAILED";
|
|
15
|
+
})(NotificationOverallStatus || (exports.NotificationOverallStatus = NotificationOverallStatus = {}));
|
|
16
|
+
//# sourceMappingURL=notification-overall-status.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-overall-status.enum.js","sourceRoot":"","sources":["../../../../../src/modules/notification/enums/notification-overall-status.enum.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,IAAY,yBAIX;AAJD,WAAY,yBAAyB;IACjC,gDAAmB,CAAA;IACnB,gEAAmC,CAAA;IACnC,8CAAiB,CAAA;AACrB,CAAC,EAJW,yBAAyB,yCAAzB,yBAAyB,QAIpC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProviderFailureReason = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Normalized classification of why a provider attempt failed.
|
|
6
|
+
* Drives fallback behaviour: VALIDATION / CONFIG_MISSING are non-retryable
|
|
7
|
+
* (no fallback), the remainder are provider-level failures that trigger fallback.
|
|
8
|
+
*/
|
|
9
|
+
var ProviderFailureReason;
|
|
10
|
+
(function (ProviderFailureReason) {
|
|
11
|
+
/** Malformed/invalid request (bad recipient, missing body/subject). Do not fall back. */
|
|
12
|
+
ProviderFailureReason["VALIDATION"] = "VALIDATION";
|
|
13
|
+
/** Provider is not configured/enabled. Skip provider (try next), not a send failure. */
|
|
14
|
+
ProviderFailureReason["CONFIG_MISSING"] = "CONFIG_MISSING";
|
|
15
|
+
/** Authentication/authorization failure with the provider. */
|
|
16
|
+
ProviderFailureReason["AUTH"] = "AUTH";
|
|
17
|
+
/** Provider rate limited the request. */
|
|
18
|
+
ProviderFailureReason["RATE_LIMIT"] = "RATE_LIMIT";
|
|
19
|
+
/** Request timed out. */
|
|
20
|
+
ProviderFailureReason["TIMEOUT"] = "TIMEOUT";
|
|
21
|
+
/** Network/connection error reaching the provider. */
|
|
22
|
+
ProviderFailureReason["NETWORK"] = "NETWORK";
|
|
23
|
+
/** Provider returned a server-side/processing error. */
|
|
24
|
+
ProviderFailureReason["PROVIDER_ERROR"] = "PROVIDER_ERROR";
|
|
25
|
+
/** Unclassified failure. */
|
|
26
|
+
ProviderFailureReason["UNKNOWN"] = "UNKNOWN";
|
|
27
|
+
})(ProviderFailureReason || (exports.ProviderFailureReason = ProviderFailureReason = {}));
|
|
28
|
+
//# sourceMappingURL=provider-failure-reason.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-failure-reason.enum.js","sourceRoot":"","sources":["../../../../../src/modules/notification/enums/provider-failure-reason.enum.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,IAAY,qBAiBX;AAjBD,WAAY,qBAAqB;IAC7B,yFAAyF;IACzF,kDAAyB,CAAA;IACzB,wFAAwF;IACxF,0DAAiC,CAAA;IACjC,8DAA8D;IAC9D,sCAAa,CAAA;IACb,yCAAyC;IACzC,kDAAyB,CAAA;IACzB,yBAAyB;IACzB,4CAAmB,CAAA;IACnB,sDAAsD;IACtD,4CAAmB,CAAA;IACnB,wDAAwD;IACxD,0DAAiC,CAAA;IACjC,4BAA4B;IAC5B,4CAAmB,CAAA;AACvB,CAAC,EAjBW,qBAAqB,qCAArB,qBAAqB,QAiBhC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SmsProviderName = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Identifiers for the SMS providers the notification service can dispatch through.
|
|
6
|
+
* Provider order/fallback is configuration-driven; new providers can be appended.
|
|
7
|
+
*/
|
|
8
|
+
var SmsProviderName;
|
|
9
|
+
(function (SmsProviderName) {
|
|
10
|
+
SmsProviderName["TWILIO"] = "twilio";
|
|
11
|
+
SmsProviderName["UWAZII"] = "uwazii";
|
|
12
|
+
SmsProviderName["AFRICASTALKING"] = "africastalking";
|
|
13
|
+
})(SmsProviderName || (exports.SmsProviderName = SmsProviderName = {}));
|
|
14
|
+
//# sourceMappingURL=sms-provider-name.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sms-provider-name.enum.js","sourceRoot":"","sources":["../../../../../src/modules/notification/enums/sms-provider-name.enum.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,IAAY,eAIX;AAJD,WAAY,eAAe;IACvB,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;IACjB,oDAAiC,CAAA;AACrC,CAAC,EAJW,eAAe,+BAAf,eAAe,QAI1B"}
|