import { ChangeDetectorRef, OnInit } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { MatFormFieldDefaultOptions } from '@angular/material/form-field'; import { MatSelectChange } from '@angular/material/select'; import { ActivatedRoute, Router } from '@angular/router'; import { ApplicationUser, Role, RoleType } from '@mtna/core-user-ui'; import { CanDestroyNotify } from '@mtna/lib-ui'; import { BaseUserService } from '@mtna/lib-ui/base-user-service'; import { MtnaLogger } from '@mtna/lib-ui/logger'; import { Observable } from 'rxjs'; import { AccountMode, MtnaUserAccountConfig, UserAccountConfig } from './models'; import { StateService } from './store/state.service'; import * as i0 from "@angular/core"; declare const _BaseClass: import("@mtna/lib-ui").CanDestroyNotifyCtor & { new (): {}; }; /** * MTNA component for adding and editing user settings. * Receives a UserAccountConfig for implementing custom fields, validation, and routing. * * @author Chase Moore */ export declare class MtnaUserAccountComponent extends _BaseClass implements CanDestroyNotify, OnInit { private activeRoute; private changeDetectorRef; private dialog; private logger; private router; private stateService; private userService; protected config?: MtnaUserAccountConfig | undefined; outlineAppearance: boolean; /** Path to navigate on discard of changes. Used when mode is ADD */ cancelPath?: string; /** The config object for the mtna-user-account. */ userAccountConfig?: UserAccountConfig; /** * A custom function for settings values onto the user. * This function is given the FormGroup values & the consumer must determine how to extract those and place them onto the user object. * @note This should be provided if custom fields are projected into the form. */ extractUserValues?: (values: { [id: string]: unknown; }) => Partial | null; /** The mode for determining which controls are available to the user. * Defaults to 'SETTINGS', the most restrictive. @note this gets set upon update of the state. */ mode: AccountMode; /** Form for the basic user account information. */ userForm: FormGroup; /** Map of icons to display beside the form fields. */ fieldIcons: { [fieldName: string]: string; }; /** Map of internationalized labels for the form fields. */ fieldNames: { [fieldName: string]: string; }; saveButtonText: { [mode: string]: string; }; /** Whether the organizations & role types are currently being loaded. */ loadingOrgsAndRoles$: Observable; /** Whether the user is currently being loaded. */ loadingUser$: Observable; /** Whether the user is currently being updated. */ updatingUser$: Observable; /** Whether the user information is currently loading or updating. */ userInProgress$: Observable; filteredOrganizations$: Observable; resettingPassword$: Observable; mode$: Observable<"ADD" | "EDIT" | "SETTINGS">; user$: Observable>; userId$: Observable; roles$: Observable; constructor(activeRoute: ActivatedRoute, changeDetectorRef: ChangeDetectorRef, dialog: MatDialog, logger: MtnaLogger, router: Router, stateService: StateService, userService: BaseUserService, defaultFieldOptions?: MatFormFieldDefaultOptions, config?: MtnaUserAccountConfig | undefined); /** * Filters the available organizations that include the given string. It will also include the string as an option, in case * the user is entering an unprovided organization. * @param search The search string to check against * @returns Void. This function makes use of an observable to pass the filtered data. */ filterOrganizations(search: string | undefined): void; /** * Updates the state when an organization is selected. * This is to ensure the selected organization exists as a real option (in case the org was written in). * @param change MatSelectChange containing the selected org value. */ handleSelectOrg(change: MatSelectChange): void; /** Navigates user back to user-management */ goToUserCenter(): void; /** * Refreshes the cached users upon successful change of this user's account status. * @param changeHttpResponse the response returned from the api */ handleAccountStatusChange(): void; /** * Emits passwordReset event. If a reset, just sends PasswordReset of type 'reset' else * emits PasswordReset of type 'change' along with the old password and new password. */ handleAdminPasswordReset(): void; /** * Emits the save event when user clicks save. Checks if the user is valid, sets * the user's organization and then emits the user. */ handleConfirm(oldUser: ApplicationUser): void; /** Handles discarding changes made by the user. */ handleDiscard(): void; /** Sets any provided custom validator functions for the form controls */ initFormControlValidators(): void; /** Sets up the organizations select and roles for the user. */ ngOnInit(): void; /** Comparator for a Mat-Select in the user account form. */ _compareOptions(o1: string | Role, o2: string | Role): boolean; /** * Subscribes to the password reset notifier, in order to show a password dialog when appropriate. * @param mode The current Accountmode of this component. */ protected _subscribeToPasswordResetNotifications(mode: AccountMode): void; /** * Updates the values of formcontrols representing the user's roles. * @param roles All the available RoleType's available to apply a value. Each has its own formcontrol. * @param mode The current AccountMode of the page. * @param user The current user values */ protected _updateRoleControls(roles: RoleType[], mode: AccountMode, user?: ApplicationUser): void; /** * Updates the persisted formcontrols of user information. * @param user The current user, to apply the values to the formcontrols. * @param mode The current AccountMode of the page; for determining whether to enable the organization. */ protected _updateUserControls(user: Partial, mode: AccountMode): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export {};