clarion-shared-types 1.0.128 → 1.0.129

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 CHANGED
@@ -1,119 +1,119 @@
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
- ```
73
-
74
- ## Organization notification settings
75
-
76
- `src/modules/notification` mirrors the backend contract for an organization's
77
- notification settings (branding, email senders, SMS senders) that clarion-admin's
78
- **Notification Settings** page renders. The backend source of truth is
79
- `grm-shared-library/src/modules/notification`; clarion-notification owns the data.
80
-
81
- - Enums: `SmsSenderType`, `NotificationSenderStatus`, `EmailSenderVerificationStatus` /
82
- `Method`, `NotificationSenderSource`, `NotificationBrandingSource`.
83
- - Shapes: `OrganizationNotificationSettings`, `ResolvedNotificationBranding` (with the
84
- per-field `sources` the page uses to say "inherited from…"), `OrganizationEmailSender`,
85
- `OrganizationSmsSender`, `SmsProviderDescriptor`, and plain request interfaces in
86
- place of the backend's class-validator DTOs.
87
- - Rules: `validateSmsSenderId`, `SMS_SENDER_ID_PATTERNS` / `_HINTS`,
88
- `BRAND_COLOUR_PATTERN`, `contrastRatioWithWhite` with `MIN_PRIMARY_COLOUR_CONTRAST`
89
- and `MIN_ACCENT_COLOUR_CONTRAST`.
90
-
91
- **The rules must stay byte-identical to the backend's.** The form validates with
92
- these so the user is told before they submit; the API validates with its own copy and
93
- is the one that counts. `notification-settings.spec.ts` pins the regex sources and
94
- thresholds so a drift fails here rather than as a form that accepts what the API
95
- rejects.
96
-
97
- ## Alert intake (SMS / WhatsApp / email channels)
98
-
99
- `src/modules/alert-intake` mirrors the backend contract for how the public reaches an
100
- organization without the app, which clarion-admin's **Alert Channels** page renders.
101
- The backend source of truth is `grm-shared-library/src/modules/alert-intake`;
102
- clarion-alerts owns the data.
103
-
104
- - Enums: `AlertIntakeChannel`, `AlertIntakeProvider`, `AlertIntakeSecretSource`,
105
- `AlertIntakeEmergencyPolicy`, `AlertIntakeRouteMatch`, `AlertIntakeWebhookVerification`,
106
- `AlertIntakeRejectionReason`.
107
- - Shapes: `OrganizationAlertIntakeSettings`, `AlertIntakeConnection` (never carries a
108
- credential - `secretsConfigured` says which secrets exist), `AlertIntakeRoute`,
109
- `AlertIntakePlatformFallback`, `AlertIntakeProviderDescriptor` (the server-driven
110
- form), `AlertIntakePlatformConnection`, and plain request interfaces
111
- (`CreateAlertIntakeConnection`, `UpdateAlertIntakeConnection`, `CreateAlertIntakeRoute`,
112
- `UpdateAlertIntakeRoute`) in place of the backend's class-validator DTOs.
113
- - Rules: `ALERT_INTAKE_KEYWORD_PATTERN`, `normaliseAlertIntakeKeyword`,
114
- `extractAlertIntakeKeyword`, `stripAlertIntakeKeyword` and the `MAX_ALERT_INTAKE_*` limits.
115
-
116
- The enum file and the util file are byte-identical copies of the backend's;
117
- `alert-intake.spec.ts` pins the values so a drift fails here rather than as a form the
118
- API refuses. Permission actions `read:alert-intake`, `manage:alert-intake` and
119
- `manage:alert-intake-platform` (Super-Admin only) are mirrored in `PermissionActions`.
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
+ ```
73
+
74
+ ## Organization notification settings
75
+
76
+ `src/modules/notification` mirrors the backend contract for an organization's
77
+ notification settings (branding, email senders, SMS senders) that clarion-admin's
78
+ **Notification Settings** page renders. The backend source of truth is
79
+ `grm-shared-library/src/modules/notification`; clarion-notification owns the data.
80
+
81
+ - Enums: `SmsSenderType`, `NotificationSenderStatus`, `EmailSenderVerificationStatus` /
82
+ `Method`, `NotificationSenderSource`, `NotificationBrandingSource`.
83
+ - Shapes: `OrganizationNotificationSettings`, `ResolvedNotificationBranding` (with the
84
+ per-field `sources` the page uses to say "inherited from…"), `OrganizationEmailSender`,
85
+ `OrganizationSmsSender`, `SmsProviderDescriptor`, and plain request interfaces in
86
+ place of the backend's class-validator DTOs.
87
+ - Rules: `validateSmsSenderId`, `SMS_SENDER_ID_PATTERNS` / `_HINTS`,
88
+ `BRAND_COLOUR_PATTERN`, `contrastRatioWithWhite` with `MIN_PRIMARY_COLOUR_CONTRAST`
89
+ and `MIN_ACCENT_COLOUR_CONTRAST`.
90
+
91
+ **The rules must stay byte-identical to the backend's.** The form validates with
92
+ these so the user is told before they submit; the API validates with its own copy and
93
+ is the one that counts. `notification-settings.spec.ts` pins the regex sources and
94
+ thresholds so a drift fails here rather than as a form that accepts what the API
95
+ rejects.
96
+
97
+ ## Alert intake (SMS / WhatsApp / email channels)
98
+
99
+ `src/modules/alert-intake` mirrors the backend contract for how the public reaches an
100
+ organization without the app, which clarion-admin's **Alert Channels** page renders.
101
+ The backend source of truth is `grm-shared-library/src/modules/alert-intake`;
102
+ clarion-alerts owns the data.
103
+
104
+ - Enums: `AlertIntakeChannel`, `AlertIntakeProvider`, `AlertIntakeSecretSource`,
105
+ `AlertIntakeEmergencyPolicy`, `AlertIntakeRouteMatch`, `AlertIntakeWebhookVerification`,
106
+ `AlertIntakeRejectionReason`.
107
+ - Shapes: `OrganizationAlertIntakeSettings`, `AlertIntakeConnection` (never carries a
108
+ credential - `secretsConfigured` says which secrets exist), `AlertIntakeRoute`,
109
+ `AlertIntakePlatformFallback`, `AlertIntakeProviderDescriptor` (the server-driven
110
+ form), `AlertIntakePlatformConnection`, and plain request interfaces
111
+ (`CreateAlertIntakeConnection`, `UpdateAlertIntakeConnection`, `CreateAlertIntakeRoute`,
112
+ `UpdateAlertIntakeRoute`) in place of the backend's class-validator DTOs.
113
+ - Rules: `ALERT_INTAKE_KEYWORD_PATTERN`, `normaliseAlertIntakeKeyword`,
114
+ `extractAlertIntakeKeyword`, `stripAlertIntakeKeyword` and the `MAX_ALERT_INTAKE_*` limits.
115
+
116
+ The enum file and the util file are byte-identical copies of the backend's;
117
+ `alert-intake.spec.ts` pins the values so a drift fails here rather than as a form the
118
+ API refuses. Permission actions `read:alert-intake`, `manage:alert-intake` and
119
+ `manage:alert-intake-platform` (Super-Admin only) are mirrored in `PermissionActions`.
@@ -49,6 +49,8 @@ export interface PartnerIntegrationDto {
49
49
  partnerContactName: string | null;
50
50
  partnerContactPhone: string | null;
51
51
  partnerContactEmail: string | null;
52
+ /** The partner's logo in clarion-dms. Null: the app shows no "Powered by" for this partnership. */
53
+ logoUrl: string | null;
52
54
  lastHealthCheckAt: string | null;
53
55
  lastSuccessAt: string | null;
54
56
  lastErrorAt: string | null;
@@ -86,6 +88,8 @@ export interface CreatePartnerIntegrationDto {
86
88
  partnerContactName?: string;
87
89
  partnerContactPhone?: string;
88
90
  partnerContactEmail?: string;
91
+ /** The https address clarion-dms returned for the upload. Null on an update removes it. */
92
+ logoUrl?: string | null;
89
93
  }
90
94
  /**
91
95
  * `providerCode` and `organizationId` are deliberately absent: changing either
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clarion-shared-types",
3
- "version": "1.0.128",
3
+ "version": "1.0.129",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",