import { ITeamUserRole, ITeamUser, ITeamUserPermission, ISubTenantUser, SortByEnum, ISearchUserQueryParamsV2, QueryFilter, QuerySort, IRole, IUsersV3Data, ITemporaryUserConfiguration, IAddUser, FronteggApiError, ISearchUserQueryParamsV3, IAccountEnvironment, IEnvironmentRoleAssignment } from '@frontegg/rest-api'; import { GroupsState } from '../GroupsState/interfaces'; import { LoaderIndicatorState, WithCallback } from '../../interfaces'; import { ApplicationsState } from '../ApplicationsState/interfaces'; export declare enum TeamStateKeys { USERS = "USERS", STATS = "STATS", UPDATE_USER = "UPDATE_USER", DELETE_USER = "DELETE_USER", RESEND_ACTIVATE_LINK = "RESEND_ACTIVATE_LINK", RESEND_INVITATION_LINK = "RESEND_INVITATION_LINK", ROLES_AND_PERMISSIONS = "ROLES_AND_PERMISSIONS", CREATE_TOKEN_LINK = "CREATE_TOKEN_LINK", GET_TOKEN_LINK = "GET_TOKEN_LINK", UPDATE_TOKEN_LINK = "UPDATE_TOKEN_LINK", DELETE_TOKEN_LINK = "DELETE_TOKEN_LINK", CONFIG_TOKEN_LINK = "CONFIG_TOKEN_LINK", CONFIG_TEMPORARY_USERS = "CONFIG_TEMPORARY_USERS", UPDATE_USER_EXPIRATION_TIME = "UPDATE_USER_EXPIRATION_TIME", ENVIRONMENTS = "ENVIRONMENTS" } export type TeamStateIndicator = { key: TeamStateKeys; value: string | boolean | FronteggApiError; }; type BaseDialogState = { open?: boolean; onClose?: (data?: any) => void; }; export type AddUserDialogState = BaseDialogState & { loading?: boolean; error?: boolean | string | FronteggApiError; }; export type EnableDisableUserDialogState = BaseDialogState & { loading?: boolean; error?: FronteggApiError; }; export type ISetAddUserDialog = Omit; export type DeleteUserDialogState = BaseDialogState & { loading?: boolean; error?: boolean | FronteggApiError; userId?: string; email?: string; }; export type ISetDeleteUserDialog = Omit; export type LoadRolesAndPermissionsPayload = WithCallback<{}, { roles: ITeamUserRole[]; permissions: ITeamUserPermission[]; }>; export interface ITeamStateUser extends ITeamUser { groups?: GroupsState['groups']; applications?: ApplicationsState['userApplications']; emails?: Array<{ email: string; isPrimary: boolean; }>; } export interface TeamState { loaders: LoaderIndicatorState; errors: LoaderIndicatorState; users: ITeamStateUser[]; allUsers: ISubTenantUser[]; allUsersQueryParams: { _offset: number; _limit: number; _filter: string | null; _sortBy: string; _order: 'ASC' | 'DESC'; }; pageOffset: number; pageSize: number; totalPages: number; roles: ITeamUserRole[]; permissions: ITeamUserPermission[]; environments: IAccountEnvironment[]; environmentsTenantId?: string; environmentRolesEnabledForTenantId?: string; filter?: QueryFilter[]; sort?: QuerySort[]; filterV2?: string; sortV2?: SortByEnum; totalItems?: number; addedThisWeek?: number; shouldShowSubTenantUsersIfReseller?: boolean; addUserDialogState: AddUserDialogState; deleteUserDialogState: DeleteUserDialogState; lockUserDialogState: DeleteUserDialogState; inviteTokenState?: InviteTokenState; enableUserDialogState: EnableDisableUserDialogState; disableUserDialogState: EnableDisableUserDialogState; temporaryUsersConfig?: ITemporaryUserConfiguration; } export interface InviteTokenState { id?: string; vendorId?: string; tenantId?: string; userId?: string; token?: string; expires?: Date; shouldSendEmail?: boolean; tenantInvitationsAllowed?: boolean; emailsEnabled?: boolean; roleIds?: string[]; } export interface IAddUsers { emails: string[]; roleIds: string[]; environmentRoles?: IEnvironmentRoleAssignment[]; expirationInSeconds?: number; } export interface BulkInvintationData { unallowedEmails: string[]; allowedEmails: string[]; } export interface IGetUsersV2Payload { pageSize?: ISearchUserQueryParamsV2['_limit']; pageOffset?: ISearchUserQueryParamsV2['_offset']; filter?: ISearchUserQueryParamsV2['_filter']; sort?: ISearchUserQueryParamsV2['_sortBy']; order?: ISearchUserQueryParamsV2['_order']; shouldShowSubTenantUsersIfReseller?: ISearchUserQueryParamsV2['_includeSubTenants']; shouldLoadApps?: boolean; shouldLoadRoles?: boolean; } export interface IGetUsersV3Payload { pageSize?: ISearchUserQueryParamsV3['_limit']; pageOffset?: ISearchUserQueryParamsV3['_offset']; email?: ISearchUserQueryParamsV3['_email']; namePrefix?: ISearchUserQueryParamsV3['_namePrefix']; sort?: ISearchUserQueryParamsV3['_sortBy']; order?: ISearchUserQueryParamsV3['_order']; shouldShowSubTenantUsersIfReseller?: ISearchUserQueryParamsV3['_includeSubTenants']; shouldLoadApps?: boolean; shouldLoadRoles?: boolean; shouldLoadEmails?: boolean; identifier?: ISearchUserQueryParamsV3['_identifier']; identifierType?: ISearchUserQueryParamsV3['_identifierType']; } export interface IBaseUserSearchPayload { _limit?: number; _offset?: number; shouldLoadApps?: boolean; shouldLoadRoles?: boolean; shouldLoadEmails?: boolean; shouldShowSubTenantUsersIfReseller?: boolean; } export interface ILoadUsersByGetPhoneNumberV2Payload extends IBaseUserSearchPayload { _phoneNumber: string; } export interface ILoadUsersByGetUsernamesV1Payload extends IBaseUserSearchPayload { _usernamePrefix: string; } export interface ILoadUsersByGetEmailsV1Payload extends IBaseUserSearchPayload { _email: string; } export interface ILoadUsersByRolesV1Payload extends IBaseUserSearchPayload { _roleIds: string[]; } export interface ISearchUsersByAnyFieldPayload extends Partial { callback?: (users: ITeamUser[] | null, error?: any) => void; } export interface IUserV3 extends IUsersV3Data { roles?: IRole[]; } export interface AddUserPayload extends IAddUser { appIds: string[]; } export {};