@masterteam/system-settings 0.0.17 → 0.0.19

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