Options
All
  • Public
  • Public/Protected
  • All
Menu

Provider that polls the CMA skill-agents API via a shared util-worker web worker and emits paged results via skillAgentsEvent. Using the worker offloads the HTTP fetch and JSON parsing off the main thread, preventing UI jank when the assigned-agents list is large (hundreds or thousands of agents).

example
provider.startPolling(skillId);
provider.skillAgentsEvent.subscribe((response) => { ... });
provider.stopPolling();

Hierarchy

  • CXoneSkillAgentsProvider

Index

Constructors

Properties

acdSession: ACDSessionManager = ACDSessionManager.instance
apiParser: SkillApiParser = ...
currentPageSize: number = DEFAULT_PAGE_SIZE
currentPollingInterval: number = 5000
currentSearchString: string = ''
currentSkillId: number
currentUpdatedSince: string = INITIAL_UPDATED_SINCE
logger: Logger = ...
pollingTimer: Timer

Timer handle for the main-thread polling interval (worker fires single-shot per tick).

pollingWorker: any

The running web worker instance (util-worker).

skillAgentsEvent: Subject<SkillAgentsApiResponse> = ...

Subject that emits the active agent list after each poll cycle.

totalRecords: number
urlUtilsService: UrlUtilsService = ...
utilService: HttpUtilService = ...

Methods

  • buildRequestParams(skillId: number): { id: string; request: HttpRequestInit; url: string }[]
  • Builds the requestParams array expected by the util-worker directory-polling handler. Constructs the skill-agents API URL with all required query params and the auth header.

    example
    this.buildRequestParams(skillId)
    

    Parameters

    • skillId: number

      Skill identifier for the query

    Returns { id: string; request: HttpRequestInit; url: string }[]

    Array of one request descriptor, or null on failure

  • clearIdb(): Promise<void>
  • handleSkillAgentsApiResp(skillAgentsData: Map<string, { status: string; value: unknown }>): Promise<void>
  • Handles the worker response: fetches the full active list, merges with any existing IDB cache (so polling updates state in-place), writes the full list back to IDB

    Parameters

    • skillAgentsData: Map<string, { status: string; value: unknown }>

      The Map<id, {status, value}> posted by the worker

    Returns Promise<void>

  • initWorker(): void
  • loadMore(): Promise<void>
  • restartWorker(): void
  • searchAgents(searchString: string): Promise<void>
  • sendWorkerRequest(skillId: number): void
  • Sends a single (non-repeating) directory-polling message to the live worker. Always re-builds the request params from scratch so updatedSince is fixed at epoch.

    example
    this.sendWorkerRequest(skillId)
    

    Parameters

    • skillId: number

      Skill identifier to fetch agents for

    Returns void

  • startPolling(skillId: number, pollingInterval?: number): void
  • Start polling for agents assigned to the given skill. Any currently running poll (and its worker) is stopped first. Page size starts at DEFAULT_PAGE_SIZE and only grows when loadMore() is called.

    example
    startPolling(skillId, 5000)
    

    Parameters

    • skillId: number

      The skill identifier to poll agents for

    • pollingInterval: number = 5000

      Milliseconds between polls (default 5000)

    Returns void

  • startWorkerPolling(skillId: number, pollingInterval: number): void
  • stopPolling(): void
  • terminateWorker(): void

Generated using TypeDoc