@masterteam/system-settings 0.0.17 → 0.0.18

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.
@@ -4,6 +4,8 @@ import * as _angular_core from '@angular/core';
4
4
  import { OnInit, InjectionToken, EnvironmentProviders } from '@angular/core';
5
5
  import { DatePicker } from 'primeng/datepicker';
6
6
  import { ModalService } from '@masterteam/components/modal';
7
+ import { Observable } from 'rxjs';
8
+ import * as _masterteam_system_settings from '@masterteam/system-settings';
7
9
  import { Routes } from '@angular/router';
8
10
 
9
11
  type SystemSettingPrimitive = string | number | boolean | null;
@@ -491,8 +493,12 @@ type EmailDeliveryPermission = (typeof EMAIL_DELIVERY_PERMISSIONS)[keyof typeof
491
493
  interface EmailDeliveryOptions {
492
494
  apiBasePath: string;
493
495
  notificationApiBasePath: string;
496
+ currentUserAccessibilitiesApiPath: string;
494
497
  permissionKeys: readonly string[];
495
498
  }
499
+ interface EmailDeliveryAccessibility {
500
+ moduleKey: string;
501
+ }
496
502
  interface EmailProviderAuthenticationModeDescriptor {
497
503
  key: string;
498
504
  displayName: string;
@@ -844,7 +850,209 @@ declare const DEFAULT_EMAIL_DELIVERY_OPTIONS: EmailDeliveryOptions;
844
850
  declare const EMAIL_DELIVERY_OPTIONS: InjectionToken<EmailDeliveryOptions>;
845
851
  declare function provideEmailDelivery(options?: Partial<EmailDeliveryOptions>): EnvironmentProviders;
846
852
 
853
+ /**
854
+ * Resolves the signed-in user's real application accessibilities.
855
+ *
856
+ * `permissionKeys` describes which accessibility the feature requires; it is
857
+ * never a list of permissions granted to the user. The grant comes only from
858
+ * the authenticated `me/accessibilities` endpoint used by the host backend.
859
+ */
860
+ declare class EmailDeliveryAccessService {
861
+ private readonly http;
862
+ private readonly options;
863
+ private request$;
864
+ readonly keys: _angular_core.WritableSignal<readonly string[]>;
865
+ readonly loading: _angular_core.WritableSignal<boolean>;
866
+ readonly loaded: _angular_core.WritableSignal<boolean>;
867
+ readonly error: _angular_core.WritableSignal<unknown>;
868
+ hasPermission(permission: EmailDeliveryPermission): boolean;
869
+ load(force?: boolean): Observable<readonly string[]>;
870
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<EmailDeliveryAccessService, never>;
871
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<EmailDeliveryAccessService>;
872
+ }
873
+
874
+ declare function createEmailTestRequestId(): string;
875
+ declare function parseEmailTestRecipients(value: string | null): string[];
876
+ declare function areEmailTestRecipientsValid(value: unknown, maximumRecipients?: number, maximumAddressLength?: number): boolean;
877
+ declare function collectEmailTemplatePlaceholders(...templates: Array<string | null | undefined>): string[];
878
+ interface EmailTemplatePlaceholderProperty {
879
+ key: string;
880
+ name?: string | null;
881
+ nameEn?: string | null;
882
+ nameAr?: string | null;
883
+ }
884
+ interface EmailTemplatePlaceholderField {
885
+ key: string;
886
+ label: string;
887
+ }
888
+ /**
889
+ * Maps saved template keys to the localized labels returned by the property
890
+ * catalog while preserving the original keys used in test metadata.
891
+ */
892
+ declare function buildEmailTemplatePlaceholderFields(keys: readonly string[], properties: readonly EmailTemplatePlaceholderProperty[], language?: string): EmailTemplatePlaceholderField[];
893
+ declare function isEmailTestRequestPending(state: string): boolean;
894
+
895
+ declare class EmailDeliveryFacade {
896
+ private readonly access;
897
+ private readonly api;
898
+ private readonly transloco;
899
+ private readonly toast;
900
+ private initialized;
901
+ private attemptsLoaded;
902
+ readonly status: _angular_core.WritableSignal<EmailDeliveryStatus | null>;
903
+ readonly providers: _angular_core.WritableSignal<EmailProviderDescriptor[]>;
904
+ readonly errorCatalog: _angular_core.WritableSignal<EmailErrorCatalogEntry[]>;
905
+ readonly connections: _angular_core.WritableSignal<EmailConnectionSummary[]>;
906
+ readonly selectedConnection: _angular_core.WritableSignal<EmailConnectionDetails | null>;
907
+ readonly attempts: _angular_core.WritableSignal<EmailDeliveryAttempt[]>;
908
+ readonly attemptsNextCursor: _angular_core.WritableSignal<string | null>;
909
+ readonly attemptStatusFilter: _angular_core.WritableSignal<string | null>;
910
+ readonly quarantine: _angular_core.WritableSignal<EmailFinalizationQuarantineItem[]>;
911
+ readonly quarantineNextCursor: _angular_core.WritableSignal<string | null>;
912
+ readonly hostEvidence: _angular_core.WritableSignal<EmailHostEvidenceItem[]>;
913
+ readonly hostEvidenceNextCursor: _angular_core.WritableSignal<string | null>;
914
+ readonly hostEvidenceScanBudgetExhausted: _angular_core.WritableSignal<boolean>;
915
+ readonly statusLoading: _angular_core.WritableSignal<boolean>;
916
+ readonly catalogLoading: _angular_core.WritableSignal<boolean>;
917
+ readonly connectionsLoading: _angular_core.WritableSignal<boolean>;
918
+ readonly detailsLoading: _angular_core.WritableSignal<boolean>;
919
+ readonly attemptsLoading: _angular_core.WritableSignal<boolean>;
920
+ readonly quarantineLoading: _angular_core.WritableSignal<boolean>;
921
+ readonly hostEvidenceLoading: _angular_core.WritableSignal<boolean>;
922
+ readonly mutationLoading: _angular_core.WritableSignal<string | null>;
923
+ readonly lastConnectionTest: _angular_core.WritableSignal<EmailSendResult | null>;
924
+ readonly lastConnectionTestRequestId: _angular_core.WritableSignal<string | null>;
925
+ readonly permissionsLoading: _angular_core.WritableSignal<boolean>;
926
+ readonly permissionsLoaded: _angular_core.WritableSignal<boolean>;
927
+ readonly permissionsError: _angular_core.WritableSignal<unknown>;
928
+ readonly activeConnection: _angular_core.Signal<EmailConnectionSummary | undefined>;
929
+ readonly managementAvailable: _angular_core.Signal<boolean>;
930
+ initialize(): void;
931
+ hasPermission(permission: EmailDeliveryPermission): boolean;
932
+ loadPermissions(force?: boolean): Observable<readonly string[]>;
933
+ loadStatus(): Observable<EmailDeliveryStatus>;
934
+ loadCatalog(): Observable<{
935
+ providers: EmailProviderDescriptor[];
936
+ errors: EmailErrorCatalogEntry[];
937
+ }>;
938
+ loadConnections(): Observable<EmailConnectionSummary[]>;
939
+ loadConnection(id: string): Observable<EmailConnectionDetails>;
940
+ createConnection(request: EmailConnectionCreateRequest): Observable<EmailConnectionDetails>;
941
+ updateConnection(id: string, request: EmailConnectionUpdateRequest): Observable<EmailConnectionDetails>;
942
+ deleteConnection(id: string, concurrencyToken: string): Observable<void>;
943
+ validateConnection(id: string): Observable<EmailConnectionValidationResult>;
944
+ sendConnectionTest(id: string, request: EmailConnectionTestRequest): Observable<EmailSendResult>;
945
+ retrieveConnectionTest(connectionId: string, testRequestId: string): Observable<EmailConnectionTestResult>;
946
+ sendTemplateTest(eventId: number, templateId: number, request: {
947
+ testRequestId: string;
948
+ emails: string[];
949
+ metadata: Record<string, string>;
950
+ }): Observable<EmailUserTestDispatchResult>;
951
+ sendAlertTest(alertId: number, request: {
952
+ testRequestId: string;
953
+ emails: string[];
954
+ metadata: Record<string, string>;
955
+ }): Observable<EmailUserTestDispatchResult>;
956
+ retrieveUserTest(testRequestId: string): Observable<EmailUserTestDispatchResult>;
957
+ bindConnection(id: string, purpose?: string): Observable<void>;
958
+ unbindConnection(id: string, purpose?: string): Observable<void>;
959
+ startAuthorization(id: string, kind: 'delegated' | 'admin-consent'): Observable<EmailAuthorizationStartResult>;
960
+ revokeAuthorization(id: string): Observable<void>;
961
+ loadAttempts(reset?: boolean, status?: string | null): Observable<_masterteam_system_settings.EmailAttemptPage>;
962
+ replayAttempt(attempt: EmailDeliveryAttempt, request: EmailAttemptReplayRequest): Observable<EmailAttemptReplayResult>;
963
+ loadQuarantine(reset?: boolean): Observable<_masterteam_system_settings.EmailFinalizationQuarantinePage>;
964
+ decideQuarantine(item: EmailFinalizationQuarantineItem, action: 'retry' | 'acknowledge', reason: string): Observable<EmailFinalizationQuarantineItem>;
965
+ loadHostEvidence(reset?: boolean): Observable<_masterteam_system_settings.EmailHostEvidencePage>;
966
+ exportHostEvidence(evidenceOccurrenceId: string): Observable<EmailEvidenceDownload>;
967
+ decideHostEvidence(item: EmailHostEvidenceItem, action: 'repair' | 'acknowledge', reason: string): Observable<EmailHostEvidenceItem>;
968
+ rebuildEvidenceIndex(take: number): Observable<EmailEvidenceRebuildResult>;
969
+ providerByKey(key: string | null | undefined): EmailProviderDescriptor | null;
970
+ describeCode(code: string | null | undefined): string;
971
+ /**
972
+ * The one sentence every failure path shows. It prefers the backend's stable
973
+ * code, falls back to the transport status the contract assigns a required
974
+ * behaviour to (401/403/409/422/428/429/503), and always appends the
975
+ * correlation ID when one is available — that identifier is what support asks
976
+ * for, and it is the only part of a failure this page is allowed to keep.
977
+ */
978
+ describeError(error: unknown): string;
979
+ errorAction(error: unknown): string | null;
980
+ showError(error: unknown): void;
981
+ /**
982
+ * A `409` means the server state moved under this page. The contract requires
983
+ * reloading it rather than re-submitting over it, so every mutation that can
984
+ * conflict routes through here: the latest connection, list and readiness are
985
+ * pulled back before the caller sees the rejection.
986
+ */
987
+ private reloadOnConflict;
988
+ private describeFailure;
989
+ private translateCode;
990
+ private translateStatus;
991
+ takePendingAuthorizationConnection(): string | null;
992
+ /**
993
+ * A completed controlled test writes its own Activity row, so the loaded
994
+ * Activity list is stale the moment the test returns. Only refresh once
995
+ * Activity has been opened — before that its own load covers it, and the
996
+ * status filter in effect there is preserved.
997
+ */
998
+ private refreshActivity;
999
+ private refreshConnection;
1000
+ private rememberAuthorizationConnection;
1001
+ private showSuccess;
1002
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<EmailDeliveryFacade, never>;
1003
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<EmailDeliveryFacade>;
1004
+ }
1005
+
1006
+ type EmailUserTestKind = 'template' | 'alert';
1007
+ interface MetadataControl {
1008
+ key: string;
1009
+ label: string;
1010
+ control: FormControl<string>;
1011
+ }
1012
+ declare class EmailUserTestDialog {
1013
+ readonly kind: _angular_core.InputSignal<EmailUserTestKind>;
1014
+ readonly eventId: _angular_core.InputSignal<number | null>;
1015
+ readonly templateId: _angular_core.InputSignal<number | null>;
1016
+ readonly alertId: _angular_core.InputSignal<number | null>;
1017
+ readonly sourceLabel: _angular_core.InputSignal<string>;
1018
+ readonly placeholderKeys: _angular_core.InputSignal<readonly string[]>;
1019
+ readonly placeholderFields: _angular_core.InputSignal<readonly EmailTemplatePlaceholderField[]>;
1020
+ protected readonly modal: ModalService;
1021
+ private readonly ref;
1022
+ private readonly destroyRef;
1023
+ private readonly transloco;
1024
+ protected readonly facade: EmailDeliveryFacade;
1025
+ protected readonly recipients: FormControl<string>;
1026
+ protected readonly metadataControls: _angular_core.WritableSignal<MetadataControl[]>;
1027
+ protected readonly testRequestId: _angular_core.WritableSignal<string>;
1028
+ protected readonly timedOut: _angular_core.WritableSignal<boolean>;
1029
+ protected readonly polling: _angular_core.WritableSignal<boolean>;
1030
+ protected readonly result: _angular_core.WritableSignal<EmailUserTestDispatchResult | null>;
1031
+ private pollIndex;
1032
+ constructor();
1033
+ protected canSubmit(): boolean;
1034
+ protected submit(): void;
1035
+ protected retrieve(): void;
1036
+ protected close(): void;
1037
+ private operation;
1038
+ private hasValidTarget;
1039
+ private acceptResult;
1040
+ /**
1041
+ * Retrieval in progress is not the same thing as a lost result. A `202` and a
1042
+ * pending request state are the normal accepted path, so they only raise
1043
+ * `polling`; `timedOut` is reserved for the poll budget running out or a
1044
+ * retrieval that failed, which are the states that actually ask the operator
1045
+ * to act.
1046
+ */
1047
+ private startPolling;
1048
+ private schedulePoll;
1049
+ private retrieveStoredResult;
1050
+ protected t(key: string): string;
1051
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<EmailUserTestDialog, never>;
1052
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<EmailUserTestDialog, "mt-email-user-test-dialog", never, { "kind": { "alias": "kind"; "required": true; "isSignal": true; }; "eventId": { "alias": "eventId"; "required": false; "isSignal": true; }; "templateId": { "alias": "templateId"; "required": false; "isSignal": true; }; "alertId": { "alias": "alertId"; "required": false; "isSignal": true; }; "sourceLabel": { "alias": "sourceLabel"; "required": false; "isSignal": true; }; "placeholderKeys": { "alias": "placeholderKeys"; "required": false; "isSignal": true; }; "placeholderFields": { "alias": "placeholderFields"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1053
+ }
1054
+
847
1055
  declare const EMAIL_DELIVERY_ROUTES: Routes;
848
1056
 
849
- export { DEFAULT_DATE_FORMAT_OPTIONS, DEFAULT_EMAIL_DELIVERY_OPTIONS, DEFAULT_GENERAL_CONFIGURATION, DEFAULT_TIME_FORMAT_OPTIONS, DOTNET_DAY_DEFINITIONS, EMAIL_DELIVERY_ATTEMPT_STATUSES, EMAIL_DELIVERY_OPTIONS, EMAIL_DELIVERY_PERMISSIONS, EMAIL_DELIVERY_ROUTES, EMAIL_USER_INITIATED_TEST_OPERATION_KIND, EXPLORE_DEFAULT_VIEW_OPTIONS, FIXED_CURRENCIES, GENERAL_CONFIGURATION_SETTING_KEY, RATE_SOURCE_OPTIONS, SCHEDULE_ITEM_TYPE_OPTIONS, SystemSettings, SystemSettingsHolidayEditor, TIMESHEET_FREQUENCY_OPTIONS, WEEKEND_DAY_DEFINITIONS, isConnectionTestAttempt, provideEmailDelivery };
850
- export type { ApiResponse, AppResponse, CurrencyCatalogItem, CurrencySettingValue, CurrencyUnitLabel, EmailAttemptPage, EmailAttemptReplayRequest, EmailAttemptReplayResult, EmailAuthorizationStartResult, EmailConnectionCreateRequest, EmailConnectionDetails, EmailConnectionRecord, EmailConnectionSummary, EmailConnectionTestRequest, EmailConnectionTestResult, EmailConnectionUpdateRequest, EmailConnectionValidationResult, EmailCredentialMutation, EmailCredentialOperation, EmailCredentialStatus, EmailCredentialStorageKind, EmailDeliveryAttempt, EmailDeliveryOptions, EmailDeliveryPermission, EmailDeliveryProblem, EmailDeliveryStatus, EmailErrorCatalogEntry, EmailEvidenceDecisionRequest, EmailEvidenceDownload, EmailEvidenceRebuildResult, EmailFinalizationQuarantineItem, EmailFinalizationQuarantinePage, EmailHostEvidenceItem, EmailHostEvidencePage, EmailProviderActionDescriptor, EmailProviderAuthenticationModeDescriptor, EmailProviderDescriptor, EmailProviderFieldDescriptor, EmailSafeDiagnostic, EmailSendResult, EmailUserTestDispatchResult, ExploreDefaultView, FormatSchemaOption, GeneralConfigurationSettingValue, GlobalWorkingHoursSettingValue, HolidayItem, HolidayTableRow, HolidaysSettingValue, IconSelectOption, ScheduleItemTypeOption, SelectOption, SystemSetting, SystemSettingObject, SystemSettingPrimitive, SystemSettingValue, SystemSettingsForm, SystemSettingsFormatSchema, SystemSettingsSnapshot, TimeSheetFrequency, TimeSheetPolicySettingValue, TimezoneRegionOption, TimezoneSettingValue, UpdateSystemSettingItem, WeekendDayOption, WeekendSettingValue };
1057
+ export { DEFAULT_DATE_FORMAT_OPTIONS, DEFAULT_EMAIL_DELIVERY_OPTIONS, DEFAULT_GENERAL_CONFIGURATION, DEFAULT_TIME_FORMAT_OPTIONS, DOTNET_DAY_DEFINITIONS, EMAIL_DELIVERY_ATTEMPT_STATUSES, EMAIL_DELIVERY_OPTIONS, EMAIL_DELIVERY_PERMISSIONS, EMAIL_DELIVERY_ROUTES, EMAIL_USER_INITIATED_TEST_OPERATION_KIND, EXPLORE_DEFAULT_VIEW_OPTIONS, EmailDeliveryAccessService, EmailUserTestDialog, FIXED_CURRENCIES, GENERAL_CONFIGURATION_SETTING_KEY, RATE_SOURCE_OPTIONS, SCHEDULE_ITEM_TYPE_OPTIONS, SystemSettings, SystemSettingsHolidayEditor, TIMESHEET_FREQUENCY_OPTIONS, WEEKEND_DAY_DEFINITIONS, areEmailTestRecipientsValid, buildEmailTemplatePlaceholderFields, collectEmailTemplatePlaceholders, createEmailTestRequestId, isConnectionTestAttempt, isEmailTestRequestPending, parseEmailTestRecipients, provideEmailDelivery };
1058
+ export type { ApiResponse, AppResponse, CurrencyCatalogItem, CurrencySettingValue, CurrencyUnitLabel, EmailAttemptPage, EmailAttemptReplayRequest, EmailAttemptReplayResult, EmailAuthorizationStartResult, EmailConnectionCreateRequest, EmailConnectionDetails, EmailConnectionRecord, EmailConnectionSummary, EmailConnectionTestRequest, EmailConnectionTestResult, EmailConnectionUpdateRequest, EmailConnectionValidationResult, EmailCredentialMutation, EmailCredentialOperation, EmailCredentialStatus, EmailCredentialStorageKind, EmailDeliveryAccessibility, EmailDeliveryAttempt, EmailDeliveryOptions, EmailDeliveryPermission, EmailDeliveryProblem, EmailDeliveryStatus, EmailErrorCatalogEntry, EmailEvidenceDecisionRequest, EmailEvidenceDownload, EmailEvidenceRebuildResult, EmailFinalizationQuarantineItem, EmailFinalizationQuarantinePage, EmailHostEvidenceItem, EmailHostEvidencePage, EmailProviderActionDescriptor, EmailProviderAuthenticationModeDescriptor, EmailProviderDescriptor, EmailProviderFieldDescriptor, EmailSafeDiagnostic, EmailSendResult, EmailTemplatePlaceholderField, EmailTemplatePlaceholderProperty, EmailUserTestDispatchResult, EmailUserTestKind, ExploreDefaultView, FormatSchemaOption, GeneralConfigurationSettingValue, GlobalWorkingHoursSettingValue, HolidayItem, HolidayTableRow, HolidaysSettingValue, IconSelectOption, ScheduleItemTypeOption, SelectOption, SystemSetting, SystemSettingObject, SystemSettingPrimitive, SystemSettingValue, SystemSettingsForm, SystemSettingsFormatSchema, SystemSettingsSnapshot, TimeSheetFrequency, TimeSheetPolicySettingValue, TimezoneRegionOption, TimezoneSettingValue, UpdateSystemSettingItem, WeekendDayOption, WeekendSettingValue };