Options
All
  • Public
  • Public/Protected
  • All
Menu

Directory Provider Class

Hierarchy

  • CXoneDirectoryProvider

Index

Constructors

  • Create a directory provider.

    example

    -- Const provider = new CXoneDirectoryProvider();

    Returns CXoneDirectoryProvider

Properties

acdSession: ACDSessionManager = ACDSessionManager.instance
baseUri: string = ''
currentEntities: DirectoryEntities[]
directoryAdapter: CXoneDirectoryAdapter = ...
directoryBase: CXoneDirectory = ...
entity: DirectoryEntities[] = []
entityCounts: { addressBookList: number; agentList: number; skillList: number; teamList: number; totalAddressBookCount: number; totalAgentCount: number; totalSkillCount: number; totalTeamCount: number } = ...

Type declaration

  • addressBookList: number
  • agentList: number
  • skillList: number
  • teamList: number
  • totalAddressBookCount: number
  • totalAgentCount: number
  • totalSkillCount: number
  • totalTeamCount: number
entityPollingFlag: { SkillActivity: boolean; addressBookList: boolean; agentList: boolean; skillList: boolean; teamList: boolean } = ...

Type declaration

  • SkillActivity: boolean
  • addressBookList: boolean
  • agentList: boolean
  • skillList: boolean
  • teamList: boolean
favroiteAgentList: AgentStateResponse[] = []
isFreshRequest: boolean = false
lastAddressBookEntriesArray: { addressBookEntryId: number; addressBookId: number; firstName: string; lastName: string }[] = []
lastAddressBookSearchEntriesMap: Map<number, number> = ...
limit: number = -1
logger: Logger = ...
mediaType: number = undefined
offset: number = -1
pollingOptions: PollingOptions = undefined
pollingWorker: any
searchText: string = ''
teamId: string = ''
totalSearchResultCount: { addressBookList: number; agentList: number; skillList: number; teamList: number } = ...

Type declaration

  • addressBookList: number
  • agentList: number
  • skillList: number
  • teamList: number
utilService: HttpUtilService = ...

Methods

  • clearCopilotDB(): Promise<void>
  • Used to clear the copilot store data from the index db

    example
    clearCopilotDB();
    

    Returns Promise<void>

  • clearDigitalDB(): Promise<void>
  • Used to clear the digital store data from the index db

    example
    clearDigitalDB();
    

    Returns Promise<void>

  • clearDirectoryDB(): Promise<void>
  • Used to clear the directory store data from the index db

    example
    clearDirectoryDB();
    

    Returns Promise<void>

  • Used to filter the data from the address book List on the basis of search text and handle the pagination based on the offset and limit if requested

    Parameters

    • searchText: string

      string value on which search will be performed

    • addressBookList: AddressBooks[]

      list of addressBook

    Returns AddressBooks[]

  • Used to update the team list in index DB as per the new list

    Parameters

    • agentList: AgentStateResponse[]

      new agent list response

    • teamId: string

      teamId on which we need to filter agents

    Returns AgentStateResponse[]

  • Used to filter out the skill list based on current mediaType

    Parameters

    Returns SkillEvent[]

  • getAgentStateOrDefault(agentStateName: string): number
  • example

    getAgentState(agentState)

    Parameters

    • agentStateName: string

      string

    Returns number

    agentState - number

  • getDirectoryData(entity: DirectoryEntities[], pollingOptions?: PollingOptions, offset?: number, limit?: number, searchText?: string, teamId?: string, mediaType?: number, shouldFetchAllAgents?: boolean): Promise<void>
  • Used to handle the directory data request

    example
    getDirectoryData(true, ["agentList"], 1, 14, '');
    

    Parameters

    • entity: DirectoryEntities[]

      requested entity array for directory data

    • Optional pollingOptions: PollingOptions
    • Optional offset: number

      start index for the pagination data, should be greater than 0

    • Optional limit: number

      end index for the pagination data, should be greater than 0

    • Optional searchText: string

      search string in case for search request, search will happen on fields depending on entity requested. If requested entity is agentList then search will happen based on fields - (firstName, lastName, userName). If requested entity is skillList then search will happen based on field - (skillName). If requested entity is addressBookList then search will happen based on field - (firstName, lastName, mobile, phone, email). If requested entity is teamList then search will happen based on field - (teamName).

    • Optional teamId: string
    • Optional mediaType: number
    • Optional shouldFetchAllAgents: boolean

      flag to get all agent list including logged-in user

    Returns Promise<void>

  • getDirectoryPollingConfig(): any
  • Returns any

  • Used to retrieve agent list from index DB and filter out favorites

    example

    directoryProvider.getFavorites(searchText);

    Parameters

    • agentName: string

    Returns Promise<AgentStateResponse[]>

  • Used to handle the agentList pagination for the search result if the search text is matched and then returns only the data based on offset and limit

    Parameters

    • searchText: string

      search string

    • agentList: AgentStateResponse[]

      array of agentList

    • Optional shouldFetchAllAgents: boolean

      flag to get all agent list including logged-in user

    Returns AgentStateResponse[]

  • Used to handle the skillList pagination for the search result if the search text is matched and then returns only the data based on offset and limit

    Parameters

    • searchText: string

      search string

    • skillList: SkillEvent[]

      array of skill

    Returns SkillEvent[]

  • getFilteredTeamList(searchText: string, teamList: Team[]): Team[]
  • Used to handle the teamList pagination for the search result if the search text is matched and then returns only the data based on offset and limit

    Parameters

    • searchText: string

      search string

    • teamList: Team[]

    Returns Team[]

  • merge, sort and paginate addressBookList data

    example
    this.handleAddressBookList(addressBookList);
    

    Parameters

    Returns AddressBooksEntries[]

  • Used to handle the pagination based on the offset and limit in case of normal directory request flow without search request

    Parameters

    Returns Promise<DirectoryResponse>

  • handleDirectoryResponse(response: any, shouldFetchAllAgents?: boolean): Promise<void>
  • Callback method which will passed on to the worker and will be executed after the polling api response then will publish to the subject subscriber with the directory data

    example
    handleDirectoryResponse(data);
    

    Parameters

    • response: any

      agent state api response object

    • Optional shouldFetchAllAgents: boolean

      -flag to get all agent list including logged-in user

    Returns Promise<void>

  • initUtilWorker(): void
  • Use to initializing the util worker and will return the method inside the worker

    example
    this.initDirectoryWorker();
    

    Returns void

  • isNewSearchedRequest(newSearchText?: string, newOffset?: number, newLimit?: number, newEntity?: DirectoryEntities[], newTeamId?: string, newMediaType?: number): boolean
  • Used to check if the current request is a new search request or the already searched request

    Parameters

    • Optional newSearchText: string

      search string

    • Optional newOffset: number

      start index for pagination

    • Optional newLimit: number

      last index for pagination

    • Optional newEntity: DirectoryEntities[]

      entity array

    • Optional newTeamId: string
    • Optional newMediaType: number

    Returns boolean

    boolean stating if true that means its a new search request

  • Used to check from the requested entity to find out if any of the entity is still needed to be polled and if so returns that entity

    Parameters

    Returns DirectoryEntities[]

  • Used to publish the directory response to the subscriber also updating the total record for each entity before publishing

    Parameters

    • directoryResponse: DirectoryResponse

      directory response which needs to be published

    • isUpdate: boolean = false

      this boolean flag will help us to identify if the request is for update or not

    Returns void

  • Published finan output of directory data

    example
    this.publishFinalDirectoryData(directoryResponse);
    

    Parameters

    Returns void

  • Used to initiate the polling for directory data

    example
    const directoryProvider = new CXoneDirectoryProvider();
    this.directoryProvider.startPolling();

    Parameters

    • Optional pollingOptions: PollingOptions

      Polling options

    • entity: DirectoryEntities[] = ...

      List of entities to be polled

    • Optional shouldFetchAllAgents: boolean

      flag to get all agent list including logged-in user

    Returns void

  • restartWorker(): void
  • Use to restart worker

    example
    this.restartWorker();
    

    Returns void

  • searchDirectoryData(searchText: string, entities?: string[], shouldFetchAllAgents?: boolean): Promise<DirectoryResponse>
  • Used to get the search result for the directory entities from indexDB. if entities array is passed then the result will be included for those entities if not passed then result will include all the entities

    Parameters

    • searchText: string

      text on the basis of which the search will be performed

    • Optional entities: string[]

      array of requested entity options for search

    • Optional shouldFetchAllAgents: boolean

      flag to get all agent list including logged-in user

    Returns Promise<DirectoryResponse>

  • Used to set the directory base instance to access the subject from the base class

    example

    Parameters

    Returns void

  • example

    sortAgentList(agentlist, searchText)

    Parameters

    • agentList: AgentStateResponse[]

      list of agent

    • Optional searchText: string

      used to sort data by position of the searchText.

    Returns AgentStateResponse[]

    sorted Agent List

  • Use to sort the index db data for agents, skills and teams in ascending order

    example
    @param list - new list response
    @param type - which directory entity (agents, skills or teams)
    this.sortResponse(list, type)

    Parameters

    Returns any

  • terminateDirectoryWorker(): void
  • Use to terminate the directory worker

    example
    this.terminateDirectoryWorker
    

    Returns void

  • terminatePolling(): void
  • Used to terminate the polling of agent state

    example
    const directoryProvider = new CXoneDirectoryProvider();
    this.directoryProvider.terminatePolling();

    Returns void

  • Used to toggle the favorite marker for agent and store it in Index DB

    example

    directoryProvider.toggleFavorite(agent);

    Parameters

    Returns Promise<void>

  • Used to update the addressBook list for search response matching new Response from the polling update with the existing search response saved in the index db

    Parameters

    • newAddressBooks: AddressBooks[]

      -new response for the updated addressBook data

    Returns AddressBooks[]

  • Used to update the address list in index DB as per the new list

    Parameters

    • addressBookList: AddressBooks[]

      new address book list response

    Returns Promise<AddressBooks[]>

  • Used to update the flag based on the entity array passed, this will ensure that the passed entities has been already polled

    Parameters

    Returns void

  • Used to update the skill list for search response matching new Response from the polling update with the existing search response saved in the index db

    Parameters

    • currentSearchSkillList: SkillEvent[]

      saved skill list from the index db

    • newSkillList: SkillEvent[]

      new response for the updated skill data

    Returns SkillEvent[]

  • updateSearchTeamList(currentSearchTeamList: Team[], newTeamList: Team[]): Team[]
  • Used to update the search team list for search response matching new Response from the polling update with the existing search response saved in the index db

    Parameters

    • currentSearchTeamList: Team[]

      saved team list from the index db

    • newTeamList: Team[]

    Returns Team[]

  • Used to update the skill list in index DB as per the new list

    Parameters

    Returns Promise<SkillEvent[]>

  • updateTeamListInDB(teamList: Team[]): Promise<Team[]>
  • Used to update the team list in index DB as per the new list

    Parameters

    • teamList: Team[]

      new team list response

    Returns Promise<Team[]>

Generated using TypeDoc