clarion-shared-types 1.0.76 → 1.0.77

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.
Files changed (67) hide show
  1. package/README.md +72 -2
  2. package/dist/cjs/index.js +1 -0
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/modules/country/constants/country-defaults.const.js +20 -0
  5. package/dist/cjs/modules/country/constants/country-defaults.const.js.map +1 -0
  6. package/dist/cjs/modules/country/constants/supported-countries.const.js +64 -0
  7. package/dist/cjs/modules/country/constants/supported-countries.const.js.map +1 -0
  8. package/dist/cjs/modules/country/constants/supported-currencies.const.js +36 -0
  9. package/dist/cjs/modules/country/constants/supported-currencies.const.js.map +1 -0
  10. package/dist/cjs/modules/country/enums/calling-code.enum.js +19 -0
  11. package/dist/cjs/modules/country/enums/calling-code.enum.js.map +1 -0
  12. package/dist/cjs/modules/country/enums/country-code.enum.js +21 -0
  13. package/dist/cjs/modules/country/enums/country-code.enum.js.map +1 -0
  14. package/dist/cjs/modules/country/enums/currency-code.enum.js +20 -0
  15. package/dist/cjs/modules/country/enums/currency-code.enum.js.map +1 -0
  16. package/dist/cjs/modules/country/index.js +32 -0
  17. package/dist/cjs/modules/country/index.js.map +1 -0
  18. package/dist/cjs/modules/country/interfaces/geo-coordinates.js +3 -0
  19. package/dist/cjs/modules/country/interfaces/geo-coordinates.js.map +1 -0
  20. package/dist/cjs/modules/country/interfaces/map-bounds.js +3 -0
  21. package/dist/cjs/modules/country/interfaces/map-bounds.js.map +1 -0
  22. package/dist/cjs/modules/country/interfaces/supported-country-config.js +3 -0
  23. package/dist/cjs/modules/country/interfaces/supported-country-config.js.map +1 -0
  24. package/dist/cjs/modules/country/interfaces/supported-currency-config.js +3 -0
  25. package/dist/cjs/modules/country/interfaces/supported-currency-config.js.map +1 -0
  26. package/dist/cjs/modules/country/utils/country.util.js +60 -0
  27. package/dist/cjs/modules/country/utils/country.util.js.map +1 -0
  28. package/dist/esm/index.js +1 -0
  29. package/dist/esm/index.js.map +1 -1
  30. package/dist/esm/modules/country/constants/country-defaults.const.js +17 -0
  31. package/dist/esm/modules/country/constants/country-defaults.const.js.map +1 -0
  32. package/dist/esm/modules/country/constants/supported-countries.const.js +61 -0
  33. package/dist/esm/modules/country/constants/supported-countries.const.js.map +1 -0
  34. package/dist/esm/modules/country/constants/supported-currencies.const.js +33 -0
  35. package/dist/esm/modules/country/constants/supported-currencies.const.js.map +1 -0
  36. package/dist/esm/modules/country/enums/calling-code.enum.js +16 -0
  37. package/dist/esm/modules/country/enums/calling-code.enum.js.map +1 -0
  38. package/dist/esm/modules/country/enums/country-code.enum.js +18 -0
  39. package/dist/esm/modules/country/enums/country-code.enum.js.map +1 -0
  40. package/dist/esm/modules/country/enums/currency-code.enum.js +17 -0
  41. package/dist/esm/modules/country/enums/currency-code.enum.js.map +1 -0
  42. package/dist/esm/modules/country/index.js +16 -0
  43. package/dist/esm/modules/country/index.js.map +1 -0
  44. package/dist/esm/modules/country/interfaces/geo-coordinates.js +2 -0
  45. package/dist/esm/modules/country/interfaces/geo-coordinates.js.map +1 -0
  46. package/dist/esm/modules/country/interfaces/map-bounds.js +2 -0
  47. package/dist/esm/modules/country/interfaces/map-bounds.js.map +1 -0
  48. package/dist/esm/modules/country/interfaces/supported-country-config.js +2 -0
  49. package/dist/esm/modules/country/interfaces/supported-country-config.js.map +1 -0
  50. package/dist/esm/modules/country/interfaces/supported-currency-config.js +2 -0
  51. package/dist/esm/modules/country/interfaces/supported-currency-config.js.map +1 -0
  52. package/dist/esm/modules/country/utils/country.util.js +51 -0
  53. package/dist/esm/modules/country/utils/country.util.js.map +1 -0
  54. package/dist/types/index.d.ts +1 -0
  55. package/dist/types/modules/country/constants/country-defaults.const.d.ts +15 -0
  56. package/dist/types/modules/country/constants/supported-countries.const.d.ts +13 -0
  57. package/dist/types/modules/country/constants/supported-currencies.const.d.ts +11 -0
  58. package/dist/types/modules/country/enums/calling-code.enum.d.ts +14 -0
  59. package/dist/types/modules/country/enums/country-code.enum.d.ts +16 -0
  60. package/dist/types/modules/country/enums/currency-code.enum.d.ts +15 -0
  61. package/dist/types/modules/country/index.d.ts +11 -0
  62. package/dist/types/modules/country/interfaces/geo-coordinates.d.ts +12 -0
  63. package/dist/types/modules/country/interfaces/map-bounds.d.ts +16 -0
  64. package/dist/types/modules/country/interfaces/supported-country-config.d.ts +39 -0
  65. package/dist/types/modules/country/interfaces/supported-currency-config.d.ts +19 -0
  66. package/dist/types/modules/country/utils/country.util.d.ts +27 -0
  67. package/package.json +4 -3
package/README.md CHANGED
@@ -1,2 +1,72 @@
1
- # clarion-shared-types
2
- Shared pure types
1
+ # clarion-shared-types
2
+
3
+ Shared pure TypeScript types for the Clarion **admin** web frontend
4
+ (`clarion-admin`, Angular). Frontend-safe: no NestJS / class-validator / runtime
5
+ framework dependencies.
6
+
7
+ ## Country & Currency (multi-country foundation)
8
+
9
+ Platform-level, Angular-safe primitives for country-aware admin forms, pickers,
10
+ billing and maps. Mirrors the backend `grm-shared-library` country module so the
11
+ same codes and configuration are used end to end.
12
+
13
+ **Supported countries** (ISO 3166-1 alpha-2):
14
+
15
+ | Code | Country | Calling code | Currency | Symbol | Decimals | Timezone | Locale |
16
+ |------|----------|--------------|----------|--------|----------|------------------------|---------|
17
+ | `KE` | Kenya | `+254` | `KES` | `KSh` | 2 | `Africa/Nairobi` | `en-KE` |
18
+ | `UG` | Uganda | `+256` | `UGX` | `USh` | 0 | `Africa/Kampala` | `en-UG` |
19
+ | `TZ` | Tanzania | `+255` | `TZS` | `TSh` | 0 | `Africa/Dar_es_Salaam` | `en-TZ` |
20
+
21
+ **Supported currencies** (ISO 4217): `KES`, `UGX`, `TZS`.
22
+
23
+ ### Importing
24
+
25
+ Everything is re-exported from the package root:
26
+
27
+ ```ts
28
+ import {
29
+ CountryCode,
30
+ CurrencyCode,
31
+ CallingCode,
32
+ SupportedCountryConfig,
33
+ SupportedCurrencyConfig,
34
+ SUPPORTED_COUNTRIES, // readonly SupportedCountryConfig[] — ideal for *ngFor pickers
35
+ SUPPORTED_COUNTRIES_BY_CODE, // Record<CountryCode, SupportedCountryConfig>
36
+ SUPPORTED_CURRENCIES,
37
+ SUPPORTED_CURRENCIES_BY_CODE,
38
+ DEFAULT_COUNTRY_CODE, // CountryCode.KE
39
+ DEFAULT_CURRENCY_CODE, // CurrencyCode.KES
40
+ getSupportedCountryConfig,
41
+ getSupportedCurrencyConfig,
42
+ getCurrencyForCountry,
43
+ getCallingCodeForCountry,
44
+ getCountryByCallingCode,
45
+ isSupportedCountryCode,
46
+ isSupportedCurrencyCode,
47
+ } from 'clarion-shared-types';
48
+
49
+ // Country picker options
50
+ SUPPORTED_COUNTRIES.map((c) => ({ label: c.name, value: c.code }));
51
+ ```
52
+
53
+ > Note: `SUPPORTED_COUNTRIES` is an array (picker-friendly). Prefer the array or
54
+ > the helper functions over indexing `SUPPORTED_COUNTRIES_BY_CODE` directly, to
55
+ > stay compatible with the admin's `noPropertyAccessFromIndexSignature` setting.
56
+
57
+ ### Backward compatibility
58
+
59
+ **Kenya (`KE` / `KES`) is the default market.** Use `DEFAULT_COUNTRY_CODE` /
60
+ `DEFAULT_CURRENCY_CODE` wherever a country/currency is not explicit. Existing
61
+ admin flows are unaffected.
62
+
63
+ ### Scope
64
+
65
+ Primitives only. The country picker UI, country-scoped admin forms and country
66
+ detection are delivered in later phases and should build on 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
@@ -32,6 +32,7 @@ __exportStar(require("./modules/socket/index"), exports);
32
32
  __exportStar(require("./modules/web-notification/index"), exports);
33
33
  __exportStar(require("./modules/notification/index"), exports);
34
34
  __exportStar(require("./modules/chat/index"), exports);
35
+ __exportStar(require("./modules/country/index"), exports);
35
36
  // Interfaces
36
37
  __exportStar(require("./modules/common/interfaces/server-message"), exports);
37
38
  __exportStar(require("./modules/common/interfaces/pagination"), exports);
@@ -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,gEAA8C;AAC9C,2DAAyC;AACzC,2DAAyC;AACzC,sDAAoC;AACpC,sDAAoC;AACpC,sDAAoC;AACpC,yDAAuC;AACvC,mEAAiD;AACjD,+DAA6C;AAC7C,uDAAqC;AAErC,aAAa;AACb,6EAA2D;AAC3D,yEAAuD"}
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,gEAA8C;AAC9C,2DAAyC;AACzC,2DAAyC;AACzC,sDAAoC;AACpC,sDAAoC;AACpC,sDAAoC;AACpC,yDAAuC;AACvC,mEAAiD;AACjD,+DAA6C;AAC7C,uDAAqC;AACrC,0DAAwC;AAExC,aAAa;AACb,6EAA2D;AAC3D,yEAAuD"}
@@ -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,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,32 @@
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
+ // Utilities
31
+ __exportStar(require("./utils/country.util"), exports);
32
+ //# 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,YAAY;AACZ,uDAAqC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=geo-coordinates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geo-coordinates.js","sourceRoot":"","sources":["../../../../../src/modules/country/interfaces/geo-coordinates.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=map-bounds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map-bounds.js","sourceRoot":"","sources":["../../../../../src/modules/country/interfaces/map-bounds.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=supported-country-config.js.map
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=supported-currency-config.js.map
@@ -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 the admin frontend 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"}
package/dist/esm/index.js CHANGED
@@ -16,6 +16,7 @@ export * from './modules/socket/index';
16
16
  export * from './modules/web-notification/index';
17
17
  export * from './modules/notification/index';
18
18
  export * from './modules/chat/index';
19
+ export * from './modules/country/index';
19
20
  // Interfaces
20
21
  export * from './modules/common/interfaces/server-message';
21
22
  export * from './modules/common/interfaces/pagination';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AAErC,aAAa;AACb,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wCAAwC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AAExC,aAAa;AACb,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wCAAwC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { CallingCode } from '../enums/calling-code.enum';
2
+ import { CountryCode } from '../enums/country-code.enum';
3
+ import { CurrencyCode } from '../enums/currency-code.enum';
4
+ /**
5
+ * Platform defaults.
6
+ *
7
+ * Kenya remains the default / backward-compatible market: existing users,
8
+ * packages, posts, incidents, OTPs, notifications and billing flows continue
9
+ * to behave exactly as they did before multi-country support was introduced.
10
+ * Use these constants wherever a country/currency is not (yet) explicit.
11
+ */
12
+ export const DEFAULT_COUNTRY_CODE = CountryCode.KE;
13
+ export const DEFAULT_CURRENCY_CODE = CurrencyCode.KES;
14
+ export const DEFAULT_CALLING_CODE = CallingCode.KE;
15
+ export const DEFAULT_TIMEZONE = 'Africa/Nairobi';
16
+ export const DEFAULT_LOCALE = 'en-KE';
17
+ //# 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,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAgB,WAAW,CAAC,EAAE,CAAC;AAChE,MAAM,CAAC,MAAM,qBAAqB,GAAiB,YAAY,CAAC,GAAG,CAAC;AACpE,MAAM,CAAC,MAAM,oBAAoB,GAAW,WAAW,CAAC,EAAE,CAAC;AAC3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AACjD,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { CallingCode } from '../enums/calling-code.enum';
2
+ import { CountryCode } from '../enums/country-code.enum';
3
+ import { CurrencyCode } from '../enums/currency-code.enum';
4
+ /**
5
+ * Supported countries keyed by ISO 3166-1 alpha-2 code (source of truth,
6
+ * O(1) lookup).
7
+ *
8
+ * The `Record<CountryCode, ...>` typing enforces at compile time that every
9
+ * country code has a configuration entry. Map centers are the capital cities;
10
+ * bounds are approximate country bounding boxes and can be refined later.
11
+ */
12
+ export const SUPPORTED_COUNTRIES_BY_CODE = {
13
+ [CountryCode.KE]: {
14
+ code: CountryCode.KE,
15
+ name: 'Kenya',
16
+ callingCode: CallingCode.KE,
17
+ currencyCode: CurrencyCode.KES,
18
+ currencySymbol: 'KSh',
19
+ currencyDecimalPlaces: 2,
20
+ timezone: 'Africa/Nairobi',
21
+ defaultLocale: 'en-KE',
22
+ googleMapsRegion: 'KE',
23
+ defaultMapCenter: { lat: -1.2921, lng: 36.8219 }, // Nairobi
24
+ defaultMapZoom: 6,
25
+ mapBounds: { north: 5.019, south: -4.72, east: 41.899, west: 33.909 },
26
+ enabled: true,
27
+ },
28
+ [CountryCode.UG]: {
29
+ code: CountryCode.UG,
30
+ name: 'Uganda',
31
+ callingCode: CallingCode.UG,
32
+ currencyCode: CurrencyCode.UGX,
33
+ currencySymbol: 'USh',
34
+ currencyDecimalPlaces: 0,
35
+ timezone: 'Africa/Kampala',
36
+ defaultLocale: 'en-UG',
37
+ googleMapsRegion: 'UG',
38
+ defaultMapCenter: { lat: 0.3476, lng: 32.5825 }, // Kampala
39
+ defaultMapZoom: 6,
40
+ mapBounds: { north: 4.234, south: -1.482, east: 35.036, west: 29.573 },
41
+ enabled: true,
42
+ },
43
+ [CountryCode.TZ]: {
44
+ code: CountryCode.TZ,
45
+ name: 'Tanzania',
46
+ callingCode: CallingCode.TZ,
47
+ currencyCode: CurrencyCode.TZS,
48
+ currencySymbol: 'TSh',
49
+ currencyDecimalPlaces: 0,
50
+ timezone: 'Africa/Dar_es_Salaam',
51
+ defaultLocale: 'en-TZ',
52
+ googleMapsRegion: 'TZ',
53
+ defaultMapCenter: { lat: -6.7924, lng: 39.2083 }, // Dar es Salaam
54
+ defaultMapZoom: 6,
55
+ mapBounds: { north: -0.984, south: -11.761, east: 40.444, west: 29.327 },
56
+ enabled: true,
57
+ },
58
+ };
59
+ /** Supported countries as an array (convenient for iteration / pickers). */
60
+ export const SUPPORTED_COUNTRIES = Object.values(SUPPORTED_COUNTRIES_BY_CODE);
61
+ //# 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,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAA0D;IAC9F,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE;QACd,IAAI,EAAE,WAAW,CAAC,EAAE;QACpB,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,WAAW,CAAC,EAAE;QAC3B,YAAY,EAAE,YAAY,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,WAAW,CAAC,EAAE,CAAC,EAAE;QACd,IAAI,EAAE,WAAW,CAAC,EAAE;QACpB,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,WAAW,CAAC,EAAE;QAC3B,YAAY,EAAE,YAAY,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,WAAW,CAAC,EAAE,CAAC,EAAE;QACd,IAAI,EAAE,WAAW,CAAC,EAAE;QACpB,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,WAAW,CAAC,EAAE;QAC3B,YAAY,EAAE,YAAY,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;AAC5E,MAAM,CAAC,MAAM,mBAAmB,GAC5B,MAAM,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { CurrencyCode } from '../enums/currency-code.enum';
2
+ /**
3
+ * Supported currencies keyed by ISO 4217 code (source of truth, O(1) lookup).
4
+ *
5
+ * The `Record<CurrencyCode, ...>` typing enforces at compile time that every
6
+ * currency code has a configuration entry.
7
+ */
8
+ export const SUPPORTED_CURRENCIES_BY_CODE = {
9
+ [CurrencyCode.KES]: {
10
+ code: CurrencyCode.KES,
11
+ name: 'Kenyan Shilling',
12
+ symbol: 'KSh',
13
+ decimalPlaces: 2,
14
+ enabled: true,
15
+ },
16
+ [CurrencyCode.UGX]: {
17
+ code: CurrencyCode.UGX,
18
+ name: 'Ugandan Shilling',
19
+ symbol: 'USh',
20
+ decimalPlaces: 0,
21
+ enabled: true,
22
+ },
23
+ [CurrencyCode.TZS]: {
24
+ code: CurrencyCode.TZS,
25
+ name: 'Tanzanian Shilling',
26
+ symbol: 'TSh',
27
+ decimalPlaces: 0,
28
+ enabled: true,
29
+ },
30
+ };
31
+ /** Supported currencies as an array (convenient for iteration / pickers). */
32
+ export const SUPPORTED_CURRENCIES = Object.values(SUPPORTED_CURRENCIES_BY_CODE);
33
+ //# 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,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAA4D;IACjG,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE;QAChB,IAAI,EAAE,YAAY,CAAC,GAAG;QACtB,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,KAAK;QACb,aAAa,EAAE,CAAC;QAChB,OAAO,EAAE,IAAI;KAChB;IACD,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE;QAChB,IAAI,EAAE,YAAY,CAAC,GAAG;QACtB,IAAI,EAAE,kBAAkB;QACxB,MAAM,EAAE,KAAK;QACb,aAAa,EAAE,CAAC;QAChB,OAAO,EAAE,IAAI;KAChB;IACD,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE;QAChB,IAAI,EAAE,YAAY,CAAC,GAAG;QACtB,IAAI,EAAE,oBAAoB;QAC1B,MAAM,EAAE,KAAK;QACb,aAAa,EAAE,CAAC;QAChB,OAAO,EAAE,IAAI;KAChB;CACJ,CAAC;AAEF,6EAA6E;AAC7E,MAAM,CAAC,MAAM,oBAAoB,GAC7B,MAAM,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * E.164 country calling codes, keyed by ISO 3166-1 alpha-2 country code.
3
+ *
4
+ * Kept as a string enum so the value (e.g. '+254') can be used directly when
5
+ * composing phone numbers, and the key (e.g. KE) aligns with {@link CountryCode}.
6
+ */
7
+ export var CallingCode;
8
+ (function (CallingCode) {
9
+ /** Kenya */
10
+ CallingCode["KE"] = "+254";
11
+ /** Uganda */
12
+ CallingCode["UG"] = "+256";
13
+ /** Tanzania */
14
+ CallingCode["TZ"] = "+255";
15
+ })(CallingCode || (CallingCode = {}));
16
+ //# 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,MAAM,CAAN,IAAY,WAOX;AAPD,WAAY,WAAW;IACnB,YAAY;IACZ,0BAAW,CAAA;IACX,aAAa;IACb,0BAAW,CAAA;IACX,eAAe;IACf,0BAAW,CAAA;AACf,CAAC,EAPW,WAAW,KAAX,WAAW,QAOtB"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Supported country codes.
3
+ *
4
+ * ISO 3166-1 alpha-2 country codes. These are the platform-level identifiers
5
+ * for every country the Clarion / Upesy platform operates in.
6
+ *
7
+ * Kenya (KE) is the default/backward-compatible market.
8
+ */
9
+ export var CountryCode;
10
+ (function (CountryCode) {
11
+ /** Kenya */
12
+ CountryCode["KE"] = "KE";
13
+ /** Uganda */
14
+ CountryCode["UG"] = "UG";
15
+ /** Tanzania */
16
+ CountryCode["TZ"] = "TZ";
17
+ })(CountryCode || (CountryCode = {}));
18
+ //# 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,MAAM,CAAN,IAAY,WAOX;AAPD,WAAY,WAAW;IACnB,YAAY;IACZ,wBAAS,CAAA;IACT,aAAa;IACb,wBAAS,CAAA;IACT,eAAe;IACf,wBAAS,CAAA;AACb,CAAC,EAPW,WAAW,KAAX,WAAW,QAOtB"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Supported currency codes.
3
+ *
4
+ * ISO 4217 currency codes for the markets the platform operates in.
5
+ *
6
+ * KES (Kenyan Shilling) is the default/backward-compatible currency.
7
+ */
8
+ export var CurrencyCode;
9
+ (function (CurrencyCode) {
10
+ /** Kenyan Shilling */
11
+ CurrencyCode["KES"] = "KES";
12
+ /** Ugandan Shilling */
13
+ CurrencyCode["UGX"] = "UGX";
14
+ /** Tanzanian Shilling */
15
+ CurrencyCode["TZS"] = "TZS";
16
+ })(CurrencyCode || (CurrencyCode = {}));
17
+ //# 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,MAAM,CAAN,IAAY,YAOX;AAPD,WAAY,YAAY;IACpB,sBAAsB;IACtB,2BAAW,CAAA;IACX,uBAAuB;IACvB,2BAAW,CAAA;IACX,yBAAyB;IACzB,2BAAW,CAAA;AACf,CAAC,EAPW,YAAY,KAAZ,YAAY,QAOvB"}
@@ -0,0 +1,16 @@
1
+ // Enums
2
+ export * from './enums/country-code.enum';
3
+ export * from './enums/currency-code.enum';
4
+ export * from './enums/calling-code.enum';
5
+ // Interfaces
6
+ export * from './interfaces/geo-coordinates';
7
+ export * from './interfaces/map-bounds';
8
+ export * from './interfaces/supported-currency-config';
9
+ export * from './interfaces/supported-country-config';
10
+ // Constants
11
+ export * from './constants/supported-currencies.const';
12
+ export * from './constants/supported-countries.const';
13
+ export * from './constants/country-defaults.const';
14
+ // Utilities
15
+ export * from './utils/country.util';
16
+ //# 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,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAE1C,aAAa;AACb,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC;AAEtD,YAAY;AACZ,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC;AAEnD,YAAY;AACZ,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=geo-coordinates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geo-coordinates.js","sourceRoot":"","sources":["../../../../../src/modules/country/interfaces/geo-coordinates.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=map-bounds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map-bounds.js","sourceRoot":"","sources":["../../../../../src/modules/country/interfaces/map-bounds.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=supported-country-config.js.map
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=supported-currency-config.js.map
@@ -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,51 @@
1
+ import { SUPPORTED_COUNTRIES, SUPPORTED_COUNTRIES_BY_CODE } from '../constants/supported-countries.const';
2
+ import { SUPPORTED_CURRENCIES_BY_CODE } from '../constants/supported-currencies.const';
3
+ /**
4
+ * Country / currency helper utilities.
5
+ *
6
+ * These are intentionally simple, synchronous and dependency-free so they can
7
+ * be reused across the admin frontend without pulling in extra deps.
8
+ */
9
+ /** Type guard: is `value` a supported ISO 3166-1 alpha-2 country code? */
10
+ export function isSupportedCountryCode(value) {
11
+ return (typeof value === 'string' &&
12
+ Object.prototype.hasOwnProperty.call(SUPPORTED_COUNTRIES_BY_CODE, value));
13
+ }
14
+ /** Type guard: is `value` a supported ISO 4217 currency code? */
15
+ export function isSupportedCurrencyCode(value) {
16
+ return (typeof value === 'string' &&
17
+ Object.prototype.hasOwnProperty.call(SUPPORTED_CURRENCIES_BY_CODE, value));
18
+ }
19
+ /** Get the full config for a supported country, or `undefined` if unsupported. */
20
+ export function getSupportedCountryConfig(countryCode) {
21
+ return isSupportedCountryCode(countryCode)
22
+ ? SUPPORTED_COUNTRIES_BY_CODE[countryCode]
23
+ : undefined;
24
+ }
25
+ /** Get the full config for a supported currency, or `undefined` if unsupported. */
26
+ export function getSupportedCurrencyConfig(currencyCode) {
27
+ return isSupportedCurrencyCode(currencyCode)
28
+ ? SUPPORTED_CURRENCIES_BY_CODE[currencyCode]
29
+ : undefined;
30
+ }
31
+ /** Resolve the currency used by a supported country, or `undefined`. */
32
+ export function getCurrencyForCountry(countryCode) {
33
+ var _a;
34
+ return (_a = getSupportedCountryConfig(countryCode)) === null || _a === void 0 ? void 0 : _a.currencyCode;
35
+ }
36
+ /** Resolve the E.164 calling code (e.g. '+254') for a supported country, or `undefined`. */
37
+ export function getCallingCodeForCountry(countryCode) {
38
+ var _a;
39
+ return (_a = getSupportedCountryConfig(countryCode)) === null || _a === void 0 ? void 0 : _a.callingCode;
40
+ }
41
+ /**
42
+ * Reverse lookup: find the supported country whose E.164 calling code matches
43
+ * `callingCode` (e.g. '+254' -> Kenya), or `undefined` if none match.
44
+ */
45
+ export function getCountryByCallingCode(callingCode) {
46
+ if (!callingCode) {
47
+ return undefined;
48
+ }
49
+ return SUPPORTED_COUNTRIES.find((country) => country.callingCode === callingCode);
50
+ }
51
+ //# 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":"AAAA,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAC1G,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AAMvF;;;;;GAKG;AAEH,0EAA0E;AAC1E,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACjD,OAAO,CACH,OAAO,KAAK,KAAK,QAAQ;QACzB,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAC3E,CAAC;AACN,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,uBAAuB,CAAC,KAAc;IAClD,OAAO,CACH,OAAO,KAAK,KAAK,QAAQ;QACzB,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAC5E,CAAC;AACN,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,yBAAyB,CACrC,WAAsC;IAEtC,OAAO,sBAAsB,CAAC,WAAW,CAAC;QACtC,CAAC,CAAC,2BAA2B,CAAC,WAAW,CAAC;QAC1C,CAAC,CAAC,SAAS,CAAC;AACpB,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,0BAA0B,CACtC,YAAuC;IAEvC,OAAO,uBAAuB,CAAC,YAAY,CAAC;QACxC,CAAC,CAAC,4BAA4B,CAAC,YAAY,CAAC;QAC5C,CAAC,CAAC,SAAS,CAAC;AACpB,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,qBAAqB,CACjC,WAAsC;;IAEtC,OAAO,MAAA,yBAAyB,CAAC,WAAW,CAAC,0CAAE,YAAY,CAAC;AAChE,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,wBAAwB,CACpC,WAAsC;;IAEtC,OAAO,MAAA,yBAAyB,CAAC,WAAW,CAAC,0CAAE,WAAW,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACnC,WAAsC;IAEtC,IAAI,CAAC,WAAW,EAAE,CAAC;QACf,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,KAAK,WAAW,CAAC,CAAC;AACtF,CAAC"}
@@ -15,5 +15,6 @@ export * from './modules/socket/index';
15
15
  export * from './modules/web-notification/index';
16
16
  export * from './modules/notification/index';
17
17
  export * from './modules/chat/index';
18
+ export * from './modules/country/index';
18
19
  export * from './modules/common/interfaces/server-message';
19
20
  export * from './modules/common/interfaces/pagination';
@@ -0,0 +1,15 @@
1
+ import { CountryCode } from '../enums/country-code.enum';
2
+ import { CurrencyCode } from '../enums/currency-code.enum';
3
+ /**
4
+ * Platform defaults.
5
+ *
6
+ * Kenya remains the default / backward-compatible market: existing users,
7
+ * packages, posts, incidents, OTPs, notifications and billing flows continue
8
+ * to behave exactly as they did before multi-country support was introduced.
9
+ * Use these constants wherever a country/currency is not (yet) explicit.
10
+ */
11
+ export declare const DEFAULT_COUNTRY_CODE: CountryCode;
12
+ export declare const DEFAULT_CURRENCY_CODE: CurrencyCode;
13
+ export declare const DEFAULT_CALLING_CODE: string;
14
+ export declare const DEFAULT_TIMEZONE = "Africa/Nairobi";
15
+ export declare const DEFAULT_LOCALE = "en-KE";
@@ -0,0 +1,13 @@
1
+ import { CountryCode } from '../enums/country-code.enum';
2
+ import { SupportedCountryConfig } from '../interfaces/supported-country-config';
3
+ /**
4
+ * Supported countries keyed by ISO 3166-1 alpha-2 code (source of truth,
5
+ * O(1) lookup).
6
+ *
7
+ * The `Record<CountryCode, ...>` typing enforces at compile time that every
8
+ * country code has a configuration entry. Map centers are the capital cities;
9
+ * bounds are approximate country bounding boxes and can be refined later.
10
+ */
11
+ export declare const SUPPORTED_COUNTRIES_BY_CODE: Readonly<Record<CountryCode, SupportedCountryConfig>>;
12
+ /** Supported countries as an array (convenient for iteration / pickers). */
13
+ export declare const SUPPORTED_COUNTRIES: readonly SupportedCountryConfig[];
@@ -0,0 +1,11 @@
1
+ import { CurrencyCode } from '../enums/currency-code.enum';
2
+ import { SupportedCurrencyConfig } from '../interfaces/supported-currency-config';
3
+ /**
4
+ * Supported currencies keyed by ISO 4217 code (source of truth, O(1) lookup).
5
+ *
6
+ * The `Record<CurrencyCode, ...>` typing enforces at compile time that every
7
+ * currency code has a configuration entry.
8
+ */
9
+ export declare const SUPPORTED_CURRENCIES_BY_CODE: Readonly<Record<CurrencyCode, SupportedCurrencyConfig>>;
10
+ /** Supported currencies as an array (convenient for iteration / pickers). */
11
+ export declare const SUPPORTED_CURRENCIES: readonly SupportedCurrencyConfig[];
@@ -0,0 +1,14 @@
1
+ /**
2
+ * E.164 country calling codes, keyed by ISO 3166-1 alpha-2 country code.
3
+ *
4
+ * Kept as a string enum so the value (e.g. '+254') can be used directly when
5
+ * composing phone numbers, and the key (e.g. KE) aligns with {@link CountryCode}.
6
+ */
7
+ export declare enum CallingCode {
8
+ /** Kenya */
9
+ KE = "+254",
10
+ /** Uganda */
11
+ UG = "+256",
12
+ /** Tanzania */
13
+ TZ = "+255"
14
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Supported country codes.
3
+ *
4
+ * ISO 3166-1 alpha-2 country codes. These are the platform-level identifiers
5
+ * for every country the Clarion / Upesy platform operates in.
6
+ *
7
+ * Kenya (KE) is the default/backward-compatible market.
8
+ */
9
+ export declare enum CountryCode {
10
+ /** Kenya */
11
+ KE = "KE",
12
+ /** Uganda */
13
+ UG = "UG",
14
+ /** Tanzania */
15
+ TZ = "TZ"
16
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Supported currency codes.
3
+ *
4
+ * ISO 4217 currency codes for the markets the platform operates in.
5
+ *
6
+ * KES (Kenyan Shilling) is the default/backward-compatible currency.
7
+ */
8
+ export declare enum CurrencyCode {
9
+ /** Kenyan Shilling */
10
+ KES = "KES",
11
+ /** Ugandan Shilling */
12
+ UGX = "UGX",
13
+ /** Tanzanian Shilling */
14
+ TZS = "TZS"
15
+ }
@@ -0,0 +1,11 @@
1
+ export * from './enums/country-code.enum';
2
+ export * from './enums/currency-code.enum';
3
+ export * from './enums/calling-code.enum';
4
+ export * from './interfaces/geo-coordinates';
5
+ export * from './interfaces/map-bounds';
6
+ export * from './interfaces/supported-currency-config';
7
+ export * from './interfaces/supported-country-config';
8
+ export * from './constants/supported-currencies.const';
9
+ export * from './constants/supported-countries.const';
10
+ export * from './constants/country-defaults.const';
11
+ export * from './utils/country.util';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A simple latitude/longitude pair (WGS84 decimal degrees).
3
+ *
4
+ * Used for country-level map defaults (e.g. the default map center). Kept
5
+ * dependency-free so it is reusable across backend, admin and mobile.
6
+ */
7
+ export interface GeoCoordinates {
8
+ /** Latitude in decimal degrees, range -90..90. */
9
+ lat: number;
10
+ /** Longitude in decimal degrees, range -180..180. */
11
+ lng: number;
12
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * A rectangular geographic bounding box.
3
+ *
4
+ * Field names match the Google Maps `LatLngBoundsLiteral` shape so the value
5
+ * can be passed straight to the Maps JS SDK / Flutter map bounds restriction.
6
+ */
7
+ export interface MapBounds {
8
+ /** Northernmost latitude (max lat). */
9
+ north: number;
10
+ /** Southernmost latitude (min lat). */
11
+ south: number;
12
+ /** Easternmost longitude (max lng). */
13
+ east: number;
14
+ /** Westernmost longitude (min lng). */
15
+ west: number;
16
+ }
@@ -0,0 +1,39 @@
1
+ import { CountryCode } from '../enums/country-code.enum';
2
+ import { CurrencyCode } from '../enums/currency-code.enum';
3
+ import { GeoCoordinates } from './geo-coordinates';
4
+ import { MapBounds } from './map-bounds';
5
+ /**
6
+ * Full platform configuration for a supported country/market.
7
+ *
8
+ * This is the single source of truth that country-aware features (billing,
9
+ * newsfeed, notifications, maps, admin, mobile) should read from instead of
10
+ * hard-coding Kenya-specific values.
11
+ */
12
+ export interface SupportedCountryConfig {
13
+ /** ISO 3166-1 alpha-2 country code, e.g. 'KE'. */
14
+ code: CountryCode;
15
+ /** Human-readable country name, e.g. 'Kenya'. */
16
+ name: string;
17
+ /** E.164 calling code, e.g. '+254'. */
18
+ callingCode: string;
19
+ /** ISO 4217 currency code used in this country. */
20
+ currencyCode: CurrencyCode;
21
+ /** Currency display symbol, e.g. 'KSh'. */
22
+ currencySymbol: string;
23
+ /** Number of minor-unit decimal digits for the currency. */
24
+ currencyDecimalPlaces: number;
25
+ /** IANA timezone identifier, e.g. 'Africa/Nairobi'. */
26
+ timezone: string;
27
+ /** BCP-47 default locale, e.g. 'en-KE'. */
28
+ defaultLocale: string;
29
+ /** Google Maps region bias (ccTLD), e.g. 'KE'. */
30
+ googleMapsRegion: string;
31
+ /** Default map center (typically the capital city). */
32
+ defaultMapCenter: GeoCoordinates;
33
+ /** Default map zoom level for a country-wide view. */
34
+ defaultMapZoom: number;
35
+ /** Approximate geographic bounding box for the country. */
36
+ mapBounds: MapBounds;
37
+ /** Whether the country is currently enabled for use. */
38
+ enabled: boolean;
39
+ }
@@ -0,0 +1,19 @@
1
+ import { CurrencyCode } from '../enums/currency-code.enum';
2
+ /**
3
+ * Configuration describing a currency the platform supports.
4
+ *
5
+ * `decimalPlaces` is the number of minor-unit digits (e.g. KES has 2, UGX/TZS
6
+ * have 0) and should drive money formatting and minor-unit conversions.
7
+ */
8
+ export interface SupportedCurrencyConfig {
9
+ /** ISO 4217 currency code. */
10
+ code: CurrencyCode;
11
+ /** Human-readable currency name, e.g. 'Kenyan Shilling'. */
12
+ name: string;
13
+ /** Display symbol, e.g. 'KSh'. */
14
+ symbol: string;
15
+ /** Number of minor-unit decimal digits, e.g. 2 for KES, 0 for UGX/TZS. */
16
+ decimalPlaces: number;
17
+ /** Whether the currency is currently enabled for use. */
18
+ enabled: boolean;
19
+ }
@@ -0,0 +1,27 @@
1
+ import { CountryCode } from '../enums/country-code.enum';
2
+ import { CurrencyCode } from '../enums/currency-code.enum';
3
+ import { SupportedCountryConfig } from '../interfaces/supported-country-config';
4
+ import { SupportedCurrencyConfig } from '../interfaces/supported-currency-config';
5
+ /**
6
+ * Country / currency helper utilities.
7
+ *
8
+ * These are intentionally simple, synchronous and dependency-free so they can
9
+ * be reused across the admin frontend without pulling in extra deps.
10
+ */
11
+ /** Type guard: is `value` a supported ISO 3166-1 alpha-2 country code? */
12
+ export declare function isSupportedCountryCode(value: unknown): value is CountryCode;
13
+ /** Type guard: is `value` a supported ISO 4217 currency code? */
14
+ export declare function isSupportedCurrencyCode(value: unknown): value is CurrencyCode;
15
+ /** Get the full config for a supported country, or `undefined` if unsupported. */
16
+ export declare function getSupportedCountryConfig(countryCode: string | null | undefined): SupportedCountryConfig | undefined;
17
+ /** Get the full config for a supported currency, or `undefined` if unsupported. */
18
+ export declare function getSupportedCurrencyConfig(currencyCode: string | null | undefined): SupportedCurrencyConfig | undefined;
19
+ /** Resolve the currency used by a supported country, or `undefined`. */
20
+ export declare function getCurrencyForCountry(countryCode: string | null | undefined): CurrencyCode | undefined;
21
+ /** Resolve the E.164 calling code (e.g. '+254') for a supported country, or `undefined`. */
22
+ export declare function getCallingCodeForCountry(countryCode: string | null | undefined): string | undefined;
23
+ /**
24
+ * Reverse lookup: find the supported country whose E.164 calling code matches
25
+ * `callingCode` (e.g. '+254' -> Kenya), or `undefined` if none match.
26
+ */
27
+ export declare function getCountryByCallingCode(callingCode: string | null | undefined): SupportedCountryConfig | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clarion-shared-types",
3
- "version": "1.0.76",
3
+ "version": "1.0.77",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -20,13 +20,14 @@
20
20
  "dist/**/*"
21
21
  ],
22
22
  "scripts": {
23
- "clean": "rimraf dist",
23
+ "clean": "rimraf dist dist-test",
24
24
  "build:cjs": "tsc -p tsconfig.cjs.json",
25
25
  "build:esm": "tsc -p tsconfig.esm.json",
26
26
  "build:types": "tsc -p tsconfig.types.json",
27
27
  "build": "npm run clean && npm run build:types && npm run build:cjs && npm run build:esm",
28
28
  "prepublishOnly": "npm run build",
29
- "test": "echo \"Error: no test specified\" && exit 1"
29
+ "pretest": "rimraf dist-test",
30
+ "test": "tsc -p tsconfig.spec.json && node dist-test/modules/country/__tests__/country.spec.js"
30
31
  },
31
32
  "keywords": [],
32
33
  "author": "vince_lawino",