@webex/contact-center 3.10.0-next.16 → 3.10.0-next.18

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.
Files changed (74) hide show
  1. package/dist/cc.js +1 -1
  2. package/dist/cc.js.map +1 -1
  3. package/dist/config.js.map +1 -1
  4. package/dist/constants.js.map +1 -1
  5. package/dist/index.js +17 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/logger-proxy.js.map +1 -1
  8. package/dist/metrics/MetricsManager.js +2 -1
  9. package/dist/metrics/MetricsManager.js.map +1 -1
  10. package/dist/metrics/behavioral-events.js.map +1 -1
  11. package/dist/metrics/constants.js.map +1 -1
  12. package/dist/services/AddressBook.js +2 -3
  13. package/dist/services/AddressBook.js.map +1 -1
  14. package/dist/services/EntryPoint.js +2 -3
  15. package/dist/services/EntryPoint.js.map +1 -1
  16. package/dist/services/Queue.js +2 -3
  17. package/dist/services/Queue.js.map +1 -1
  18. package/dist/services/WebCallingService.js +1 -1
  19. package/dist/services/WebCallingService.js.map +1 -1
  20. package/dist/services/agent/index.js +1 -2
  21. package/dist/services/agent/index.js.map +1 -1
  22. package/dist/services/agent/types.js +10 -0
  23. package/dist/services/agent/types.js.map +1 -1
  24. package/dist/services/config/Util.js.map +1 -1
  25. package/dist/services/config/constants.js.map +1 -1
  26. package/dist/services/config/index.js +1 -1
  27. package/dist/services/config/index.js.map +1 -1
  28. package/dist/services/config/types.js.map +1 -1
  29. package/dist/services/constants.js.map +1 -1
  30. package/dist/services/core/Err.js.map +1 -1
  31. package/dist/services/core/GlobalTypes.js.map +1 -1
  32. package/dist/services/core/Utils.js +2 -3
  33. package/dist/services/core/Utils.js.map +1 -1
  34. package/dist/services/core/WebexRequest.js +1 -2
  35. package/dist/services/core/WebexRequest.js.map +1 -1
  36. package/dist/services/core/aqm-reqs.js +2 -3
  37. package/dist/services/core/aqm-reqs.js.map +1 -1
  38. package/dist/services/core/constants.js.map +1 -1
  39. package/dist/services/core/types.js.map +1 -1
  40. package/dist/services/core/websocket/WebSocketManager.js +1 -2
  41. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  42. package/dist/services/core/websocket/connection-service.js +1 -1
  43. package/dist/services/core/websocket/connection-service.js.map +1 -1
  44. package/dist/services/core/websocket/keepalive.worker.js.map +1 -1
  45. package/dist/services/core/websocket/types.js.map +1 -1
  46. package/dist/services/index.js +1 -1
  47. package/dist/services/index.js.map +1 -1
  48. package/dist/services/task/AutoWrapup.js +1 -1
  49. package/dist/services/task/AutoWrapup.js.map +1 -1
  50. package/dist/services/task/TaskManager.js +18 -11
  51. package/dist/services/task/TaskManager.js.map +1 -1
  52. package/dist/services/task/TaskUtils.js.map +1 -1
  53. package/dist/services/task/constants.js.map +1 -1
  54. package/dist/services/task/contact.js +0 -2
  55. package/dist/services/task/contact.js.map +1 -1
  56. package/dist/services/task/dialer.js.map +1 -1
  57. package/dist/services/task/index.js +1 -1
  58. package/dist/services/task/index.js.map +1 -1
  59. package/dist/services/task/types.js +360 -0
  60. package/dist/services/task/types.js.map +1 -1
  61. package/dist/types/services/task/types.d.ts +11 -0
  62. package/dist/types.js +5 -0
  63. package/dist/types.js.map +1 -1
  64. package/dist/utils/PageCache.js +1 -1
  65. package/dist/utils/PageCache.js.map +1 -1
  66. package/dist/webex-config.js.map +1 -1
  67. package/dist/webex.js +2 -2
  68. package/dist/webex.js.map +1 -1
  69. package/package.json +8 -8
  70. package/src/services/task/TaskManager.ts +21 -8
  71. package/src/services/task/types.ts +12 -0
  72. package/test/unit/spec/services/task/TaskManager.ts +89 -3
  73. package/umd/contact-center.min.js +2 -2
  74. package/umd/contact-center.min.js.map +1 -1
package/dist/types.js CHANGED
@@ -110,10 +110,15 @@ const HTTP_METHODS = exports.HTTP_METHODS = {
110
110
  * @ignore
111
111
  */
112
112
  let LOGGING_LEVEL = exports.LOGGING_LEVEL = /*#__PURE__*/function (LOGGING_LEVEL) {
113
+ /** Critical failures that require immediate attention */
113
114
  LOGGING_LEVEL["error"] = "ERROR";
115
+ /** Important issues that don't prevent the system from working */
114
116
  LOGGING_LEVEL["warn"] = "WARN";
117
+ /** General informational logs */
115
118
  LOGGING_LEVEL["log"] = "LOG";
119
+ /** Detailed information about system operation */
116
120
  LOGGING_LEVEL["info"] = "INFO";
121
+ /** Highly detailed diagnostic information */
117
122
  LOGGING_LEVEL["trace"] = "TRACE";
118
123
  return LOGGING_LEVEL;
119
124
  }({});
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["HTTP_METHODS","exports","GET","POST","PATCH","PUT","DELETE","LOGGING_LEVEL","LoginOption","AGENT_DN","EXTENSION","BROWSER"],"sources":["types.ts"],"sourcesContent":["import {CallingClientConfig} from '@webex/calling';\nimport {\n SubmitBehavioralEvent,\n SubmitOperationalEvent,\n SubmitBusinessEvent,\n} from '@webex/internal-plugin-metrics/src/metrics.types';\nimport * as Agent from './services/agent/types';\nimport * as Contact from './services/task/types';\nimport {Profile} from './services/config/types';\nimport {PaginatedResponse, BaseSearchParams} from './utils/PageCache';\n\n/**\n * Generic type for converting a const enum object into a union type of its values.\n * @template T The enum object type\n * @internal\n * @ignore\n */\ntype Enum<T extends Record<string, unknown>> = T[keyof T];\n\n/**\n * HTTP methods supported by WebexRequest.\n * @enum {string}\n * @public\n * @example\n * const method: HTTP_METHODS = HTTP_METHODS.GET;\n * @ignore\n */\nexport const HTTP_METHODS = {\n /** HTTP GET method for retrieving data */\n GET: 'GET',\n /** HTTP POST method for creating resources */\n POST: 'POST',\n /** HTTP PATCH method for partial updates */\n PATCH: 'PATCH',\n /** HTTP PUT method for complete updates */\n PUT: 'PUT',\n /** HTTP DELETE method for removing resources */\n DELETE: 'DELETE',\n} as const;\n\n/**\n * Union type of HTTP methods.\n * @public\n * @example\n * function makeRequest(method: HTTP_METHODS) { ... }\n * @ignore\n */\nexport type HTTP_METHODS = Enum<typeof HTTP_METHODS>;\n\n/**\n * Payload for making requests to Webex APIs.\n * @public\n * @example\n * const payload: WebexRequestPayload = {\n * service: 'identity',\n * resource: '/users',\n * method: HTTP_METHODS.GET\n * };\n * @ignore\n */\nexport type WebexRequestPayload = {\n /** Service name to target */\n service?: string;\n /** Resource path within the service */\n resource?: string;\n /** HTTP method to use */\n method?: HTTP_METHODS;\n /** Full URI if not using service/resource pattern */\n uri?: string;\n /** Whether to add authorization header */\n addAuthHeader?: boolean;\n /** Custom headers to include in request */\n headers?: {\n [key: string]: string | null;\n };\n /** Request body data */\n body?: object;\n /** Expected response status code */\n statusCode?: number;\n /** Whether to parse response as JSON */\n json?: boolean;\n};\n\n/**\n * Event listener function type.\n * @internal\n * @ignore\n */\ntype Listener = (e: string, data?: unknown) => void;\n\n/**\n * Event listener removal function type.\n * @internal\n * @ignore\n */\ntype ListenerOff = (e: string) => void;\n\n/**\n * Service host configuration.\n * @internal\n * @ignore\n */\ntype ServiceHost = {\n /** Host URL/domain for the service */\n host: string;\n /** Time-to-live in seconds */\n ttl: number;\n /** Priority level for load balancing (lower is higher priority) */\n priority: number;\n /** Unique identifier for this host */\n id: string;\n /** Whether this is the home cluster for the user */\n homeCluster?: boolean;\n};\n\n/**\n * Configuration options for the Contact Center Plugin.\n * @interface CCPluginConfig\n * @public\n * @example\n * const config: CCPluginConfig = {\n * allowMultiLogin: true,\n * allowAutomatedRelogin: false,\n * clientType: 'browser',\n * isKeepAliveEnabled: true,\n * force: false,\n * metrics: { clientName: 'myClient', clientType: 'browser' },\n * logging: { enable: true, verboseEvents: false },\n * callingClientConfig: { ... }\n * };\n */\nexport interface CCPluginConfig {\n /** Whether to allow multiple logins from different devices */\n allowMultiLogin: boolean;\n /** Whether to automatically attempt relogin on connection loss */\n allowAutomatedRelogin: boolean;\n /** The type of client making the connection */\n clientType: string;\n /** Whether to enable keep-alive messages */\n isKeepAliveEnabled: boolean;\n /** Whether to force registration */\n force: boolean;\n /** Metrics configuration */\n metrics: {\n /** Name of the client for metrics */\n clientName: string;\n /** Type of client for metrics */\n clientType: string;\n };\n /** Logging configuration */\n logging: {\n /** Whether to enable logging */\n enable: boolean;\n /** Whether to log verbose events */\n verboseEvents: boolean;\n };\n /** Configuration for the calling client */\n callingClientConfig: CallingClientConfig;\n}\n\n/**\n * Logger interface for standardized logging throughout the plugin.\n * @public\n * @example\n * logger.log('This is a log message');\n * logger.error('This is an error message');\n * @ignore\n */\nexport type Logger = {\n /** Log general messages */\n log: (payload: string) => void;\n /** Log error messages */\n error: (payload: string) => void;\n /** Log warning messages */\n warn: (payload: string) => void;\n /** Log informational messages */\n info: (payload: string) => void;\n /** Log detailed trace messages */\n trace: (payload: string) => void;\n /** Log debug messages */\n debug: (payload: string) => void;\n};\n\n/**\n * Contextual information for log entries.\n * @public\n * @ignore\n */\nexport interface LogContext {\n /** Module name where the log originated */\n module?: string;\n /** Method name where the log originated */\n method?: string;\n interactionId?: string;\n trackingId?: string;\n /** Additional structured data to include in logs */\n data?: Record<string, any>;\n /** Error object to include in logs */\n error?: Error | unknown;\n}\n\n/**\n * Available logging severity levels.\n * @enum {string}\n * @public\n * @example\n * const level: LOGGING_LEVEL = LOGGING_LEVEL.error;\n * @ignore\n */\nexport enum LOGGING_LEVEL {\n /** Critical failures that require immediate attention */\n error = 'ERROR',\n /** Important issues that don't prevent the system from working */\n warn = 'WARN',\n /** General informational logs */\n log = 'LOG',\n /** Detailed information about system operation */\n info = 'INFO',\n /** Highly detailed diagnostic information */\n trace = 'TRACE',\n}\n\n/**\n * Metadata for log uploads.\n * @public\n * @example\n * const meta: LogsMetaData = { feedbackId: 'fb123', correlationId: 'corr456' };\n * @ignore\n */\nexport type LogsMetaData = {\n /** Optional feedback ID to associate with logs */\n feedbackId?: string;\n /** Optional correlation ID to track related operations */\n correlationId?: string;\n};\n\n/**\n * Response from uploading logs to the server.\n * @public\n * @example\n * const response: UploadLogsResponse = { trackingid: 'track123', url: 'https://...', userId: 'user1' };\n */\nexport type UploadLogsResponse = {\n /** Tracking ID for the upload request */\n trackingid?: string;\n /** URL where the logs can be accessed */\n url?: string;\n /** ID of the user who uploaded logs */\n userId?: string;\n /** Feedback ID associated with the logs */\n feedbackId?: string;\n /** Correlation ID for tracking related operations */\n correlationId?: string;\n};\n\n/**\n * Internal Webex SDK interfaces needed for plugin integration.\n * @internal\n * @ignore\n */\ninterface IWebexInternal {\n /** Mercury service for real-time messaging */\n mercury: {\n /** Register an event listener */\n on: Listener;\n /** Remove an event listener */\n off: ListenerOff;\n /** Establish a connection to the Mercury service */\n connect: () => Promise<void>;\n /** Disconnect from the Mercury service */\n disconnect: () => Promise<void>;\n /** Whether Mercury is currently connected */\n connected: boolean;\n /** Whether Mercury is in the process of connecting */\n connecting: boolean;\n };\n /** Device information */\n device: {\n /** Current WDM URL */\n url: string;\n /** Current user's ID */\n userId: string;\n /** Current organization ID */\n orgId: string;\n /** Device version */\n version: string;\n /** Calling behavior configuration */\n callingBehavior: string;\n };\n /** Presence service */\n presence: unknown;\n /** Services discovery and management */\n services: {\n /** Get a service URL by name */\n get: (service: string) => string;\n /** Wait for service catalog to be loaded */\n waitForCatalog: (service: string) => Promise<void>;\n /** Host catalog for service discovery */\n _hostCatalog: Record<string, ServiceHost[]>;\n /** Service URLs cache */\n _serviceUrls: {\n /** Mobius calling service */\n mobius: string;\n /** Identity service */\n identity: string;\n /** Janus media server */\n janus: string;\n /** WDM (WebEx Device Management) service */\n wdm: string;\n /** BroadWorks IDP proxy service */\n broadworksIdpProxy: string;\n /** Hydra API service */\n hydra: string;\n /** Mercury API service */\n mercuryApi: string;\n /** UC Management gateway service */\n 'ucmgmt-gateway': string;\n /** Contacts service */\n contactsService: string;\n };\n };\n /** Metrics collection services */\n newMetrics: {\n /** Submit behavioral events (user actions) */\n submitBehavioralEvent: SubmitBehavioralEvent;\n /** Submit operational events (system operations) */\n submitOperationalEvent: SubmitOperationalEvent;\n /** Submit business events (business outcomes) */\n submitBusinessEvent: SubmitBusinessEvent;\n };\n /** Support functionality */\n support: {\n /** Submit logs to server */\n submitLogs: (\n metaData: LogsMetaData,\n logs: string,\n options: {\n /** Whether to submit full logs or just differences */\n type: 'diff' | 'full';\n }\n ) => Promise<UploadLogsResponse>;\n };\n}\n\n/**\n * Interface representing the WebexSDK core functionality.\n * @interface WebexSDK\n * @public\n * @example\n * const sdk: WebexSDK = ...;\n * sdk.request({ service: 'identity', resource: '/users', method: HTTP_METHODS.GET });\n * @ignore\n */\nexport interface WebexSDK {\n /** Version of the WebexSDK */\n version: string;\n /** Whether the SDK can authorize requests */\n canAuthorize: boolean;\n /** Credentials management */\n credentials: {\n /** Get the user token for authentication */\n getUserToken: () => Promise<string>;\n /** Get the organization ID */\n getOrgId: () => string;\n };\n /** Whether the SDK is ready for use */\n ready: boolean;\n /** Make a request to the Webex APIs */\n request: <T>(payload: WebexRequestPayload) => Promise<T>;\n /** Register a one-time event handler */\n once: (event: string, callBack: () => void) => void;\n /** Internal plugins and services */\n internal: IWebexInternal;\n /** Logger instance */\n logger: Logger;\n}\n\n/**\n * An interface for the `ContactCenter` class.\n * The `ContactCenter` package is designed to provide a set of APIs to perform various operations for the Agent flow within Webex Contact Center.\n * @public\n * @example\n * const cc: IContactCenter = ...;\n * cc.register().then(profile => { ... });\n * @ignore\n */\nexport interface IContactCenter {\n /**\n * Initialize the CC SDK by setting up the contact center mercury connection.\n * This establishes WebSocket connectivity for real-time communication.\n *\n * @returns A Promise that resolves to the agent's profile upon successful registration\n * @public\n * @example\n * cc.register().then(profile => { ... });\n */\n register(): Promise<Profile>;\n}\n\n/**\n * Generic HTTP response structure.\n * @public\n * @example\n * const response: IHttpResponse = { body: {}, statusCode: 200, method: 'GET', headers: {}, url: '...' };\n * @ignore\n */\nexport interface IHttpResponse {\n /** Response body content */\n body: any;\n /** HTTP status code */\n statusCode: number;\n /** HTTP method used for the request */\n method: string;\n /** Response headers */\n headers: Headers;\n /** Request URL */\n url: string;\n}\n\n/**\n * Supported login options for agent authentication.\n * @public\n * @example\n * const option: LoginOption = LoginOption.AGENT_DN;\n * @ignore\n */\nexport const LoginOption = {\n /** Login using agent's direct number */\n AGENT_DN: 'AGENT_DN',\n /** Login using an extension number */\n EXTENSION: 'EXTENSION',\n /** Login using browser WebRTC capabilities */\n BROWSER: 'BROWSER',\n} as const;\n\n/**\n * Union type of login options.\n * @public\n * @example\n * function login(option: LoginOption) { ... }\n * @ignore\n */\nexport type LoginOption = Enum<typeof LoginOption>;\n\n/**\n * Request payload for subscribing to the contact center websocket.\n * @public\n * @example\n * const req: SubscribeRequest = { force: true, isKeepAliveEnabled: true, clientType: 'browser', allowMultiLogin: false };\n * @ignore\n */\nexport type SubscribeRequest = {\n /** Whether to force connection even if another exists */\n force: boolean;\n /** Whether to send keepalive messages */\n isKeepAliveEnabled: boolean;\n /** Type of client connecting */\n clientType: string;\n /** Whether to allow login from multiple devices */\n allowMultiLogin: boolean;\n};\n\n/**\n * Represents the response from getListOfTeams method.\n * Teams are groups of agents that can be managed together.\n * @public\n * @example\n * const team: Team = { id: 'team1', name: 'Support', desktopLayoutId: 'layout1' };\n * @ignore\n */\nexport type Team = {\n /**\n * Unique identifier of the team.\n */\n id: string;\n\n /**\n * Display name of the team.\n */\n name: string;\n\n /**\n * Associated desktop layout ID for the team.\n * Controls how the agent desktop is displayed for team members.\n */\n desktopLayoutId?: string;\n};\n\n/**\n * Represents the request to perform agent login.\n * @public\n * @example\n * const login: AgentLogin = { dialNumber: '1234', teamId: 'team1', loginOption: LoginOption.AGENT_DN };\n */\nexport type AgentLogin = {\n /**\n * A dialNumber field contains the number to dial such as a route point or extension.\n * Required for AGENT_DN and EXTENSION login options.\n */\n dialNumber?: string;\n\n /**\n * The unique ID representing a team of users.\n * The agent must belong to this team.\n */\n teamId: string;\n\n /**\n * The loginOption field specifies the type of login method.\n * Controls how calls are delivered to the agent.\n */\n loginOption: LoginOption;\n};\n\n/**\n * Represents the request to update agent profile settings.\n * @public\n * @example\n * const update: AgentProfileUpdate = { loginOption: LoginOption.BROWSER, dialNumber: '5678' };\n */\nexport type AgentProfileUpdate = Pick<AgentLogin, 'loginOption' | 'dialNumber' | 'teamId'>;\n\n/**\n * Union type for all possible request body types.\n * @internal\n * @ignore\n */\nexport type RequestBody =\n | SubscribeRequest\n | Agent.Logout\n | Agent.UserStationLogin\n | Agent.StateChange\n | Agent.BuddyAgents\n | Contact.HoldResumePayload\n | Contact.ResumeRecordingPayload\n | Contact.ConsultPayload\n | Contact.ConsultEndAPIPayload // API Payload accepts only QueueId wheres SDK API allows more params\n | Contact.TransferPayLoad\n | Contact.ConsultTransferPayLoad\n | Contact.cancelCtq\n | Contact.WrapupPayLoad\n | Contact.DialerPayload;\n\n/**\n * Represents the options to fetch buddy agents for the logged in agent.\n * Buddy agents are other agents who can be consulted or transfered to.\n * @public\n * @example\n * const opts: BuddyAgents = { mediaType: 'telephony', state: 'Available' };\n * @ignore\n */\nexport type BuddyAgents = {\n /**\n * The media type channel to filter buddy agents.\n * Determines which channel capability the returned agents must have.\n */\n mediaType: 'telephony' | 'chat' | 'social' | 'email';\n\n /**\n * Optional filter for agent state.\n * If specified, returns only agents in that state.\n * If omitted, returns both available and idle agents.\n */\n state?: 'Available' | 'Idle';\n};\n\n/**\n * Generic error structure for Contact Center SDK errors.\n * Contains detailed information about the error context.\n * @public\n * @example\n * const err: GenericError = new Error('Failed');\n * err.details = { type: 'ERR', orgId: 'org1', trackingId: 'track1', data: {} };\n * @ignore\n */\nexport interface GenericError extends Error {\n /** Structured details about the error */\n details: {\n /** Error type identifier */\n type: string;\n /** Organization ID where the error occurred */\n orgId: string;\n /** Unique tracking ID for the error */\n trackingId: string;\n /** Additional error context data */\n data: Record<string, any>;\n };\n}\n\n/**\n * Response type for station login operations.\n * Either a success response with agent details or an error.\n * @public\n * @example\n * function handleLogin(resp: StationLoginResponse) { ... }\n */\nexport type StationLoginResponse = Agent.StationLoginSuccessResponse | Error;\n\n/**\n * Response type for station logout operations.\n * Either a success response with logout details or an error.\n * @public\n * @example\n * function handleLogout(resp: StationLogoutResponse) { ... }\n */\nexport type StationLogoutResponse = Agent.LogoutSuccess | Error;\n\n/**\n * Response type for station relogin operations.\n * Either a success response with relogin details or an error.\n * @public\n * @example\n * function handleReLogin(resp: StationReLoginResponse) { ... }\n * @ignore\n */\nexport type StationReLoginResponse = Agent.ReloginSuccess | Error;\n\n/**\n * Response type for agent state change operations.\n * Either a success response with state change details or an error.\n * @public\n * @example\n * function handleStateChange(resp: SetStateResponse) { ... }\n * @ignore\n */\nexport type SetStateResponse = Agent.StateChangeSuccess | Error;\n\n/**\n * AddressBook types\n */\nexport interface AddressBookEntry {\n id: string;\n organizationId?: string;\n version?: number;\n name: string;\n number: string;\n createdTime?: number;\n lastUpdatedTime?: number;\n}\n\nexport type AddressBookEntriesResponse = PaginatedResponse<AddressBookEntry>;\n\nexport interface AddressBookEntrySearchParams extends BaseSearchParams {\n addressBookId?: string;\n}\n\n/**\n * EntryPointRecord types\n */\nexport interface EntryPointRecord {\n id: string;\n name: string;\n description?: string;\n type: string;\n isActive: boolean;\n orgId: string;\n createdAt?: string;\n updatedAt?: string;\n settings?: Record<string, any>;\n}\n\nexport type EntryPointListResponse = PaginatedResponse<EntryPointRecord>;\nexport type EntryPointSearchParams = BaseSearchParams;\n\n/**\n * Queue types\n */\nexport interface QueueSkillRequirement {\n organizationId?: string;\n id?: string;\n version?: number;\n skillId: string;\n skillName?: string;\n skillType?: string;\n condition: string;\n skillValue: string;\n createdTime?: number;\n lastUpdatedTime?: number;\n}\n\nexport interface QueueAgent {\n id: string;\n ciUserId?: string;\n}\n\nexport interface AgentGroup {\n teamId: string;\n}\n\nexport interface CallDistributionGroup {\n agentGroups: AgentGroup[];\n order: number;\n duration?: number;\n}\n\nexport interface AssistantSkillMapping {\n assistantSkillId?: string;\n assistantSkillUpdatedTime?: number;\n}\n\n/**\n * Configuration for a contact service queue\n * @public\n */\nexport interface ContactServiceQueue {\n /** Organization ID */\n organizationId?: string;\n /** Unique identifier for the queue */\n id?: string;\n /** Version of the queue */\n version?: number;\n /** Name of the Contact Service Queue */\n name: string;\n /** Description of the queue */\n description?: string;\n /** Queue type (INBOUND, OUTBOUND) */\n queueType: 'INBOUND' | 'OUTBOUND';\n /** Whether to check agent availability */\n checkAgentAvailability: boolean;\n /** Channel type (TELEPHONY, EMAIL, SOCIAL_CHANNEL, CHAT, etc.) */\n channelType: 'TELEPHONY' | 'EMAIL' | 'FAX' | 'CHAT' | 'VIDEO' | 'OTHERS' | 'SOCIAL_CHANNEL';\n /** Social channel type for SOCIAL_CHANNEL channelType */\n socialChannelType?:\n | 'MESSAGEBIRD'\n | 'MESSENGER'\n | 'WHATSAPP'\n | 'APPLE_BUSINESS_CHAT'\n | 'GOOGLE_BUSINESS_MESSAGES';\n /** Service level threshold in seconds */\n serviceLevelThreshold: number;\n /** Maximum number of simultaneous contacts */\n maxActiveContacts: number;\n /** Maximum time in queue in seconds */\n maxTimeInQueue: number;\n /** Default music in queue media file ID */\n defaultMusicInQueueMediaFileId: string;\n /** Timezone for routing strategies */\n timezone?: string;\n /** Whether the queue is active */\n active: boolean;\n /** Whether outdial campaign is enabled */\n outdialCampaignEnabled?: boolean;\n /** Whether monitoring is permitted */\n monitoringPermitted: boolean;\n /** Whether parking is permitted */\n parkingPermitted: boolean;\n /** Whether recording is permitted */\n recordingPermitted: boolean;\n /** Whether recording all calls is permitted */\n recordingAllCallsPermitted: boolean;\n /** Whether pausing recording is permitted */\n pauseRecordingPermitted: boolean;\n /** Recording pause duration in seconds */\n recordingPauseDuration?: number;\n /** Control flow script URL */\n controlFlowScriptUrl: string;\n /** IVR requeue URL */\n ivrRequeueUrl: string;\n /** Overflow number for telephony */\n overflowNumber?: string;\n /** Vendor ID */\n vendorId?: string;\n /** Routing type */\n routingType: 'LONGEST_AVAILABLE_AGENT' | 'SKILLS_BASED' | 'CIRCULAR' | 'LINEAR';\n /** Skills-based routing type */\n skillBasedRoutingType?: 'LONGEST_AVAILABLE_AGENT' | 'BEST_AVAILABLE_AGENT';\n /** Queue routing type */\n queueRoutingType: 'TEAM_BASED' | 'SKILL_BASED' | 'AGENT_BASED';\n /** Queue skill requirements */\n queueSkillRequirements?: QueueSkillRequirement[];\n /** List of agents for agent-based queue */\n agents?: QueueAgent[];\n /** Call distribution groups */\n callDistributionGroups: CallDistributionGroup[];\n /** XSP version */\n xspVersion?: string;\n /** Subscription ID */\n subscriptionId?: string;\n /** Assistant skill mapping */\n assistantSkill?: AssistantSkillMapping;\n /** Whether this is a system default queue */\n systemDefault?: boolean;\n /** User who last updated agents list */\n agentsLastUpdatedByUserName?: string;\n /** Email of user who last updated agents list */\n agentsLastUpdatedByUserEmailPrefix?: string;\n /** When agents list was last updated */\n agentsLastUpdatedTime?: number;\n /** Creation timestamp in epoch millis */\n createdTime?: number;\n /** Last updated timestamp in epoch millis */\n lastUpdatedTime?: number;\n}\n\nexport type ContactServiceQueuesResponse = PaginatedResponse<ContactServiceQueue>;\n\nexport interface ContactServiceQueueSearchParams extends BaseSearchParams {\n desktopProfileFilter?: boolean;\n provisioningView?: boolean;\n singleObjectResponse?: boolean;\n}\n\n/**\n * Response type for buddy agents query operations.\n * Either a success response with list of buddy agents or an error.\n * @public\n * @example\n * function handleBuddyAgents(resp: BuddyAgentsResponse) { ... }\n */\nexport type BuddyAgentsResponse = Agent.BuddyAgentsSuccess | Error;\n\n/**\n * Response type for device type update operations.\n * Either a success response with update confirmation or an error.\n * @public\n * @example\n * function handleUpdateDeviceType(resp: UpdateDeviceTypeResponse) { ... }\n */\nexport type UpdateDeviceTypeResponse = Agent.DeviceTypeUpdateSuccess | Error;\n"],"mappings":";;;;;;AAWA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG;EAC1B;EACAE,GAAG,EAAE,KAAK;EACV;EACAC,IAAI,EAAE,MAAM;EACZ;EACAC,KAAK,EAAE,OAAO;EACd;EACAC,GAAG,EAAE,KAAK;EACV;EACAC,MAAM,EAAE;AACV,CAAU;;AAEV;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwBA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA8BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAQYC,aAAa,GAAAN,OAAA,CAAAM,aAAA,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAazB;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AAqFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAyBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,WAAW,GAAAP,OAAA,CAAAO,WAAA,GAAG;EACzB;EACAC,QAAQ,EAAE,UAAU;EACpB;EACAC,SAAS,EAAE,WAAW;EACtB;EACAC,OAAO,EAAE;AACX,CAAU;;AAEV;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA;AACA;AACA;AACA;AACA;AACA;;AAqBA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAiBA;AACA;AACA;;AAgBA;AACA;AACA;;AAkCA;AACA;AACA;AACA;;AAmGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA"}
1
+ {"version":3,"names":["HTTP_METHODS","exports","GET","POST","PATCH","PUT","DELETE","LOGGING_LEVEL","LoginOption","AGENT_DN","EXTENSION","BROWSER"],"sources":["types.ts"],"sourcesContent":["import {CallingClientConfig} from '@webex/calling';\nimport {\n SubmitBehavioralEvent,\n SubmitOperationalEvent,\n SubmitBusinessEvent,\n} from '@webex/internal-plugin-metrics/src/metrics.types';\nimport * as Agent from './services/agent/types';\nimport * as Contact from './services/task/types';\nimport {Profile} from './services/config/types';\nimport {PaginatedResponse, BaseSearchParams} from './utils/PageCache';\n\n/**\n * Generic type for converting a const enum object into a union type of its values.\n * @template T The enum object type\n * @internal\n * @ignore\n */\ntype Enum<T extends Record<string, unknown>> = T[keyof T];\n\n/**\n * HTTP methods supported by WebexRequest.\n * @enum {string}\n * @public\n * @example\n * const method: HTTP_METHODS = HTTP_METHODS.GET;\n * @ignore\n */\nexport const HTTP_METHODS = {\n /** HTTP GET method for retrieving data */\n GET: 'GET',\n /** HTTP POST method for creating resources */\n POST: 'POST',\n /** HTTP PATCH method for partial updates */\n PATCH: 'PATCH',\n /** HTTP PUT method for complete updates */\n PUT: 'PUT',\n /** HTTP DELETE method for removing resources */\n DELETE: 'DELETE',\n} as const;\n\n/**\n * Union type of HTTP methods.\n * @public\n * @example\n * function makeRequest(method: HTTP_METHODS) { ... }\n * @ignore\n */\nexport type HTTP_METHODS = Enum<typeof HTTP_METHODS>;\n\n/**\n * Payload for making requests to Webex APIs.\n * @public\n * @example\n * const payload: WebexRequestPayload = {\n * service: 'identity',\n * resource: '/users',\n * method: HTTP_METHODS.GET\n * };\n * @ignore\n */\nexport type WebexRequestPayload = {\n /** Service name to target */\n service?: string;\n /** Resource path within the service */\n resource?: string;\n /** HTTP method to use */\n method?: HTTP_METHODS;\n /** Full URI if not using service/resource pattern */\n uri?: string;\n /** Whether to add authorization header */\n addAuthHeader?: boolean;\n /** Custom headers to include in request */\n headers?: {\n [key: string]: string | null;\n };\n /** Request body data */\n body?: object;\n /** Expected response status code */\n statusCode?: number;\n /** Whether to parse response as JSON */\n json?: boolean;\n};\n\n/**\n * Event listener function type.\n * @internal\n * @ignore\n */\ntype Listener = (e: string, data?: unknown) => void;\n\n/**\n * Event listener removal function type.\n * @internal\n * @ignore\n */\ntype ListenerOff = (e: string) => void;\n\n/**\n * Service host configuration.\n * @internal\n * @ignore\n */\ntype ServiceHost = {\n /** Host URL/domain for the service */\n host: string;\n /** Time-to-live in seconds */\n ttl: number;\n /** Priority level for load balancing (lower is higher priority) */\n priority: number;\n /** Unique identifier for this host */\n id: string;\n /** Whether this is the home cluster for the user */\n homeCluster?: boolean;\n};\n\n/**\n * Configuration options for the Contact Center Plugin.\n * @interface CCPluginConfig\n * @public\n * @example\n * const config: CCPluginConfig = {\n * allowMultiLogin: true,\n * allowAutomatedRelogin: false,\n * clientType: 'browser',\n * isKeepAliveEnabled: true,\n * force: false,\n * metrics: { clientName: 'myClient', clientType: 'browser' },\n * logging: { enable: true, verboseEvents: false },\n * callingClientConfig: { ... }\n * };\n */\nexport interface CCPluginConfig {\n /** Whether to allow multiple logins from different devices */\n allowMultiLogin: boolean;\n /** Whether to automatically attempt relogin on connection loss */\n allowAutomatedRelogin: boolean;\n /** The type of client making the connection */\n clientType: string;\n /** Whether to enable keep-alive messages */\n isKeepAliveEnabled: boolean;\n /** Whether to force registration */\n force: boolean;\n /** Metrics configuration */\n metrics: {\n /** Name of the client for metrics */\n clientName: string;\n /** Type of client for metrics */\n clientType: string;\n };\n /** Logging configuration */\n logging: {\n /** Whether to enable logging */\n enable: boolean;\n /** Whether to log verbose events */\n verboseEvents: boolean;\n };\n /** Configuration for the calling client */\n callingClientConfig: CallingClientConfig;\n}\n\n/**\n * Logger interface for standardized logging throughout the plugin.\n * @public\n * @example\n * logger.log('This is a log message');\n * logger.error('This is an error message');\n * @ignore\n */\nexport type Logger = {\n /** Log general messages */\n log: (payload: string) => void;\n /** Log error messages */\n error: (payload: string) => void;\n /** Log warning messages */\n warn: (payload: string) => void;\n /** Log informational messages */\n info: (payload: string) => void;\n /** Log detailed trace messages */\n trace: (payload: string) => void;\n /** Log debug messages */\n debug: (payload: string) => void;\n};\n\n/**\n * Contextual information for log entries.\n * @public\n * @ignore\n */\nexport interface LogContext {\n /** Module name where the log originated */\n module?: string;\n /** Method name where the log originated */\n method?: string;\n interactionId?: string;\n trackingId?: string;\n /** Additional structured data to include in logs */\n data?: Record<string, any>;\n /** Error object to include in logs */\n error?: Error | unknown;\n}\n\n/**\n * Available logging severity levels.\n * @enum {string}\n * @public\n * @example\n * const level: LOGGING_LEVEL = LOGGING_LEVEL.error;\n * @ignore\n */\nexport enum LOGGING_LEVEL {\n /** Critical failures that require immediate attention */\n error = 'ERROR',\n /** Important issues that don't prevent the system from working */\n warn = 'WARN',\n /** General informational logs */\n log = 'LOG',\n /** Detailed information about system operation */\n info = 'INFO',\n /** Highly detailed diagnostic information */\n trace = 'TRACE',\n}\n\n/**\n * Metadata for log uploads.\n * @public\n * @example\n * const meta: LogsMetaData = { feedbackId: 'fb123', correlationId: 'corr456' };\n * @ignore\n */\nexport type LogsMetaData = {\n /** Optional feedback ID to associate with logs */\n feedbackId?: string;\n /** Optional correlation ID to track related operations */\n correlationId?: string;\n};\n\n/**\n * Response from uploading logs to the server.\n * @public\n * @example\n * const response: UploadLogsResponse = { trackingid: 'track123', url: 'https://...', userId: 'user1' };\n */\nexport type UploadLogsResponse = {\n /** Tracking ID for the upload request */\n trackingid?: string;\n /** URL where the logs can be accessed */\n url?: string;\n /** ID of the user who uploaded logs */\n userId?: string;\n /** Feedback ID associated with the logs */\n feedbackId?: string;\n /** Correlation ID for tracking related operations */\n correlationId?: string;\n};\n\n/**\n * Internal Webex SDK interfaces needed for plugin integration.\n * @internal\n * @ignore\n */\ninterface IWebexInternal {\n /** Mercury service for real-time messaging */\n mercury: {\n /** Register an event listener */\n on: Listener;\n /** Remove an event listener */\n off: ListenerOff;\n /** Establish a connection to the Mercury service */\n connect: () => Promise<void>;\n /** Disconnect from the Mercury service */\n disconnect: () => Promise<void>;\n /** Whether Mercury is currently connected */\n connected: boolean;\n /** Whether Mercury is in the process of connecting */\n connecting: boolean;\n };\n /** Device information */\n device: {\n /** Current WDM URL */\n url: string;\n /** Current user's ID */\n userId: string;\n /** Current organization ID */\n orgId: string;\n /** Device version */\n version: string;\n /** Calling behavior configuration */\n callingBehavior: string;\n };\n /** Presence service */\n presence: unknown;\n /** Services discovery and management */\n services: {\n /** Get a service URL by name */\n get: (service: string) => string;\n /** Wait for service catalog to be loaded */\n waitForCatalog: (service: string) => Promise<void>;\n /** Host catalog for service discovery */\n _hostCatalog: Record<string, ServiceHost[]>;\n /** Service URLs cache */\n _serviceUrls: {\n /** Mobius calling service */\n mobius: string;\n /** Identity service */\n identity: string;\n /** Janus media server */\n janus: string;\n /** WDM (WebEx Device Management) service */\n wdm: string;\n /** BroadWorks IDP proxy service */\n broadworksIdpProxy: string;\n /** Hydra API service */\n hydra: string;\n /** Mercury API service */\n mercuryApi: string;\n /** UC Management gateway service */\n 'ucmgmt-gateway': string;\n /** Contacts service */\n contactsService: string;\n };\n };\n /** Metrics collection services */\n newMetrics: {\n /** Submit behavioral events (user actions) */\n submitBehavioralEvent: SubmitBehavioralEvent;\n /** Submit operational events (system operations) */\n submitOperationalEvent: SubmitOperationalEvent;\n /** Submit business events (business outcomes) */\n submitBusinessEvent: SubmitBusinessEvent;\n };\n /** Support functionality */\n support: {\n /** Submit logs to server */\n submitLogs: (\n metaData: LogsMetaData,\n logs: string,\n options: {\n /** Whether to submit full logs or just differences */\n type: 'diff' | 'full';\n }\n ) => Promise<UploadLogsResponse>;\n };\n}\n\n/**\n * Interface representing the WebexSDK core functionality.\n * @interface WebexSDK\n * @public\n * @example\n * const sdk: WebexSDK = ...;\n * sdk.request({ service: 'identity', resource: '/users', method: HTTP_METHODS.GET });\n * @ignore\n */\nexport interface WebexSDK {\n /** Version of the WebexSDK */\n version: string;\n /** Whether the SDK can authorize requests */\n canAuthorize: boolean;\n /** Credentials management */\n credentials: {\n /** Get the user token for authentication */\n getUserToken: () => Promise<string>;\n /** Get the organization ID */\n getOrgId: () => string;\n };\n /** Whether the SDK is ready for use */\n ready: boolean;\n /** Make a request to the Webex APIs */\n request: <T>(payload: WebexRequestPayload) => Promise<T>;\n /** Register a one-time event handler */\n once: (event: string, callBack: () => void) => void;\n /** Internal plugins and services */\n internal: IWebexInternal;\n /** Logger instance */\n logger: Logger;\n}\n\n/**\n * An interface for the `ContactCenter` class.\n * The `ContactCenter` package is designed to provide a set of APIs to perform various operations for the Agent flow within Webex Contact Center.\n * @public\n * @example\n * const cc: IContactCenter = ...;\n * cc.register().then(profile => { ... });\n * @ignore\n */\nexport interface IContactCenter {\n /**\n * Initialize the CC SDK by setting up the contact center mercury connection.\n * This establishes WebSocket connectivity for real-time communication.\n *\n * @returns A Promise that resolves to the agent's profile upon successful registration\n * @public\n * @example\n * cc.register().then(profile => { ... });\n */\n register(): Promise<Profile>;\n}\n\n/**\n * Generic HTTP response structure.\n * @public\n * @example\n * const response: IHttpResponse = { body: {}, statusCode: 200, method: 'GET', headers: {}, url: '...' };\n * @ignore\n */\nexport interface IHttpResponse {\n /** Response body content */\n body: any;\n /** HTTP status code */\n statusCode: number;\n /** HTTP method used for the request */\n method: string;\n /** Response headers */\n headers: Headers;\n /** Request URL */\n url: string;\n}\n\n/**\n * Supported login options for agent authentication.\n * @public\n * @example\n * const option: LoginOption = LoginOption.AGENT_DN;\n * @ignore\n */\nexport const LoginOption = {\n /** Login using agent's direct number */\n AGENT_DN: 'AGENT_DN',\n /** Login using an extension number */\n EXTENSION: 'EXTENSION',\n /** Login using browser WebRTC capabilities */\n BROWSER: 'BROWSER',\n} as const;\n\n/**\n * Union type of login options.\n * @public\n * @example\n * function login(option: LoginOption) { ... }\n * @ignore\n */\nexport type LoginOption = Enum<typeof LoginOption>;\n\n/**\n * Request payload for subscribing to the contact center websocket.\n * @public\n * @example\n * const req: SubscribeRequest = { force: true, isKeepAliveEnabled: true, clientType: 'browser', allowMultiLogin: false };\n * @ignore\n */\nexport type SubscribeRequest = {\n /** Whether to force connection even if another exists */\n force: boolean;\n /** Whether to send keepalive messages */\n isKeepAliveEnabled: boolean;\n /** Type of client connecting */\n clientType: string;\n /** Whether to allow login from multiple devices */\n allowMultiLogin: boolean;\n};\n\n/**\n * Represents the response from getListOfTeams method.\n * Teams are groups of agents that can be managed together.\n * @public\n * @example\n * const team: Team = { id: 'team1', name: 'Support', desktopLayoutId: 'layout1' };\n * @ignore\n */\nexport type Team = {\n /**\n * Unique identifier of the team.\n */\n id: string;\n\n /**\n * Display name of the team.\n */\n name: string;\n\n /**\n * Associated desktop layout ID for the team.\n * Controls how the agent desktop is displayed for team members.\n */\n desktopLayoutId?: string;\n};\n\n/**\n * Represents the request to perform agent login.\n * @public\n * @example\n * const login: AgentLogin = { dialNumber: '1234', teamId: 'team1', loginOption: LoginOption.AGENT_DN };\n */\nexport type AgentLogin = {\n /**\n * A dialNumber field contains the number to dial such as a route point or extension.\n * Required for AGENT_DN and EXTENSION login options.\n */\n dialNumber?: string;\n\n /**\n * The unique ID representing a team of users.\n * The agent must belong to this team.\n */\n teamId: string;\n\n /**\n * The loginOption field specifies the type of login method.\n * Controls how calls are delivered to the agent.\n */\n loginOption: LoginOption;\n};\n\n/**\n * Represents the request to update agent profile settings.\n * @public\n * @example\n * const update: AgentProfileUpdate = { loginOption: LoginOption.BROWSER, dialNumber: '5678' };\n */\nexport type AgentProfileUpdate = Pick<AgentLogin, 'loginOption' | 'dialNumber' | 'teamId'>;\n\n/**\n * Union type for all possible request body types.\n * @internal\n * @ignore\n */\nexport type RequestBody =\n | SubscribeRequest\n | Agent.Logout\n | Agent.UserStationLogin\n | Agent.StateChange\n | Agent.BuddyAgents\n | Contact.HoldResumePayload\n | Contact.ResumeRecordingPayload\n | Contact.ConsultPayload\n | Contact.ConsultEndAPIPayload // API Payload accepts only QueueId wheres SDK API allows more params\n | Contact.TransferPayLoad\n | Contact.ConsultTransferPayLoad\n | Contact.cancelCtq\n | Contact.WrapupPayLoad\n | Contact.DialerPayload;\n\n/**\n * Represents the options to fetch buddy agents for the logged in agent.\n * Buddy agents are other agents who can be consulted or transfered to.\n * @public\n * @example\n * const opts: BuddyAgents = { mediaType: 'telephony', state: 'Available' };\n * @ignore\n */\nexport type BuddyAgents = {\n /**\n * The media type channel to filter buddy agents.\n * Determines which channel capability the returned agents must have.\n */\n mediaType: 'telephony' | 'chat' | 'social' | 'email';\n\n /**\n * Optional filter for agent state.\n * If specified, returns only agents in that state.\n * If omitted, returns both available and idle agents.\n */\n state?: 'Available' | 'Idle';\n};\n\n/**\n * Generic error structure for Contact Center SDK errors.\n * Contains detailed information about the error context.\n * @public\n * @example\n * const err: GenericError = new Error('Failed');\n * err.details = { type: 'ERR', orgId: 'org1', trackingId: 'track1', data: {} };\n * @ignore\n */\nexport interface GenericError extends Error {\n /** Structured details about the error */\n details: {\n /** Error type identifier */\n type: string;\n /** Organization ID where the error occurred */\n orgId: string;\n /** Unique tracking ID for the error */\n trackingId: string;\n /** Additional error context data */\n data: Record<string, any>;\n };\n}\n\n/**\n * Response type for station login operations.\n * Either a success response with agent details or an error.\n * @public\n * @example\n * function handleLogin(resp: StationLoginResponse) { ... }\n */\nexport type StationLoginResponse = Agent.StationLoginSuccessResponse | Error;\n\n/**\n * Response type for station logout operations.\n * Either a success response with logout details or an error.\n * @public\n * @example\n * function handleLogout(resp: StationLogoutResponse) { ... }\n */\nexport type StationLogoutResponse = Agent.LogoutSuccess | Error;\n\n/**\n * Response type for station relogin operations.\n * Either a success response with relogin details or an error.\n * @public\n * @example\n * function handleReLogin(resp: StationReLoginResponse) { ... }\n * @ignore\n */\nexport type StationReLoginResponse = Agent.ReloginSuccess | Error;\n\n/**\n * Response type for agent state change operations.\n * Either a success response with state change details or an error.\n * @public\n * @example\n * function handleStateChange(resp: SetStateResponse) { ... }\n * @ignore\n */\nexport type SetStateResponse = Agent.StateChangeSuccess | Error;\n\n/**\n * AddressBook types\n */\nexport interface AddressBookEntry {\n id: string;\n organizationId?: string;\n version?: number;\n name: string;\n number: string;\n createdTime?: number;\n lastUpdatedTime?: number;\n}\n\nexport type AddressBookEntriesResponse = PaginatedResponse<AddressBookEntry>;\n\nexport interface AddressBookEntrySearchParams extends BaseSearchParams {\n addressBookId?: string;\n}\n\n/**\n * EntryPointRecord types\n */\nexport interface EntryPointRecord {\n id: string;\n name: string;\n description?: string;\n type: string;\n isActive: boolean;\n orgId: string;\n createdAt?: string;\n updatedAt?: string;\n settings?: Record<string, any>;\n}\n\nexport type EntryPointListResponse = PaginatedResponse<EntryPointRecord>;\nexport type EntryPointSearchParams = BaseSearchParams;\n\n/**\n * Queue types\n */\nexport interface QueueSkillRequirement {\n organizationId?: string;\n id?: string;\n version?: number;\n skillId: string;\n skillName?: string;\n skillType?: string;\n condition: string;\n skillValue: string;\n createdTime?: number;\n lastUpdatedTime?: number;\n}\n\nexport interface QueueAgent {\n id: string;\n ciUserId?: string;\n}\n\nexport interface AgentGroup {\n teamId: string;\n}\n\nexport interface CallDistributionGroup {\n agentGroups: AgentGroup[];\n order: number;\n duration?: number;\n}\n\nexport interface AssistantSkillMapping {\n assistantSkillId?: string;\n assistantSkillUpdatedTime?: number;\n}\n\n/**\n * Configuration for a contact service queue\n * @public\n */\nexport interface ContactServiceQueue {\n /** Organization ID */\n organizationId?: string;\n /** Unique identifier for the queue */\n id?: string;\n /** Version of the queue */\n version?: number;\n /** Name of the Contact Service Queue */\n name: string;\n /** Description of the queue */\n description?: string;\n /** Queue type (INBOUND, OUTBOUND) */\n queueType: 'INBOUND' | 'OUTBOUND';\n /** Whether to check agent availability */\n checkAgentAvailability: boolean;\n /** Channel type (TELEPHONY, EMAIL, SOCIAL_CHANNEL, CHAT, etc.) */\n channelType: 'TELEPHONY' | 'EMAIL' | 'FAX' | 'CHAT' | 'VIDEO' | 'OTHERS' | 'SOCIAL_CHANNEL';\n /** Social channel type for SOCIAL_CHANNEL channelType */\n socialChannelType?:\n | 'MESSAGEBIRD'\n | 'MESSENGER'\n | 'WHATSAPP'\n | 'APPLE_BUSINESS_CHAT'\n | 'GOOGLE_BUSINESS_MESSAGES';\n /** Service level threshold in seconds */\n serviceLevelThreshold: number;\n /** Maximum number of simultaneous contacts */\n maxActiveContacts: number;\n /** Maximum time in queue in seconds */\n maxTimeInQueue: number;\n /** Default music in queue media file ID */\n defaultMusicInQueueMediaFileId: string;\n /** Timezone for routing strategies */\n timezone?: string;\n /** Whether the queue is active */\n active: boolean;\n /** Whether outdial campaign is enabled */\n outdialCampaignEnabled?: boolean;\n /** Whether monitoring is permitted */\n monitoringPermitted: boolean;\n /** Whether parking is permitted */\n parkingPermitted: boolean;\n /** Whether recording is permitted */\n recordingPermitted: boolean;\n /** Whether recording all calls is permitted */\n recordingAllCallsPermitted: boolean;\n /** Whether pausing recording is permitted */\n pauseRecordingPermitted: boolean;\n /** Recording pause duration in seconds */\n recordingPauseDuration?: number;\n /** Control flow script URL */\n controlFlowScriptUrl: string;\n /** IVR requeue URL */\n ivrRequeueUrl: string;\n /** Overflow number for telephony */\n overflowNumber?: string;\n /** Vendor ID */\n vendorId?: string;\n /** Routing type */\n routingType: 'LONGEST_AVAILABLE_AGENT' | 'SKILLS_BASED' | 'CIRCULAR' | 'LINEAR';\n /** Skills-based routing type */\n skillBasedRoutingType?: 'LONGEST_AVAILABLE_AGENT' | 'BEST_AVAILABLE_AGENT';\n /** Queue routing type */\n queueRoutingType: 'TEAM_BASED' | 'SKILL_BASED' | 'AGENT_BASED';\n /** Queue skill requirements */\n queueSkillRequirements?: QueueSkillRequirement[];\n /** List of agents for agent-based queue */\n agents?: QueueAgent[];\n /** Call distribution groups */\n callDistributionGroups: CallDistributionGroup[];\n /** XSP version */\n xspVersion?: string;\n /** Subscription ID */\n subscriptionId?: string;\n /** Assistant skill mapping */\n assistantSkill?: AssistantSkillMapping;\n /** Whether this is a system default queue */\n systemDefault?: boolean;\n /** User who last updated agents list */\n agentsLastUpdatedByUserName?: string;\n /** Email of user who last updated agents list */\n agentsLastUpdatedByUserEmailPrefix?: string;\n /** When agents list was last updated */\n agentsLastUpdatedTime?: number;\n /** Creation timestamp in epoch millis */\n createdTime?: number;\n /** Last updated timestamp in epoch millis */\n lastUpdatedTime?: number;\n}\n\nexport type ContactServiceQueuesResponse = PaginatedResponse<ContactServiceQueue>;\n\nexport interface ContactServiceQueueSearchParams extends BaseSearchParams {\n desktopProfileFilter?: boolean;\n provisioningView?: boolean;\n singleObjectResponse?: boolean;\n}\n\n/**\n * Response type for buddy agents query operations.\n * Either a success response with list of buddy agents or an error.\n * @public\n * @example\n * function handleBuddyAgents(resp: BuddyAgentsResponse) { ... }\n */\nexport type BuddyAgentsResponse = Agent.BuddyAgentsSuccess | Error;\n\n/**\n * Response type for device type update operations.\n * Either a success response with update confirmation or an error.\n * @public\n * @example\n * function handleUpdateDeviceType(resp: UpdateDeviceTypeResponse) { ... }\n */\nexport type UpdateDeviceTypeResponse = Agent.DeviceTypeUpdateSuccess | Error;\n"],"mappings":";;;;;;AAWA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG;EAC1B;EACAE,GAAG,EAAE,KAAK;EACV;EACAC,IAAI,EAAE,MAAM;EACZ;EACAC,KAAK,EAAE,OAAO;EACd;EACAC,GAAG,EAAE,KAAK;EACV;EACAC,MAAM,EAAE;AACV,CAAU;;AAEV;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwBA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA8BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAQYC,aAAa,GAAAN,OAAA,CAAAM,aAAA,0BAAbA,aAAa;EACvB;EADUA,aAAa;EAGvB;EAHUA,aAAa;EAKvB;EALUA,aAAa;EAOvB;EAPUA,aAAa;EASvB;EATUA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAazB;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AAqFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAyBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,WAAW,GAAAP,OAAA,CAAAO,WAAA,GAAG;EACzB;EACAC,QAAQ,EAAE,UAAU;EACpB;EACAC,SAAS,EAAE,WAAW;EACtB;EACAC,OAAO,EAAE;AACX,CAAU;;AAEV;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA;AACA;AACA;AACA;AACA;AACA;;AAqBA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAiBA;AACA;AACA;;AAgBA;AACA;AACA;;AAkCA;AACA;AACA;AACA;;AAmGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = exports.PageCache = exports.PAGINATION_DEFAULTS = void 0;
7
7
  var _loggerProxy = _interopRequireDefault(require("../logger-proxy"));
8
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
9
  /**
10
10
  * Common pagination metadata interface used across all APIs.
11
11
  * @public
@@ -1 +1 @@
1
- {"version":3,"names":["_loggerProxy","_interopRequireDefault","require","obj","__esModule","default","PAGINATION_DEFAULTS","exports","PAGE","PAGE_SIZE","DEFAULT_CACHE_TTL_MINUTES","PageCache","cache","Map","constructor","apiName","canUseCache","params","search","filter","attributes","sortBy","buildCacheKey","orgId","page","pageSize","getCachedPage","cacheKey","cachedEntry","get","now","Date","cacheAge","timestamp","LoggerProxy","log","module","method","delete","cachePage","data","meta","cacheEntry","totalMeta","totalPages","totalRecords","totalItems","undefined","set","length","clearCache","cacheSize","size","clear","getCacheSize","_default"],"sources":["PageCache.ts"],"sourcesContent":["import LoggerProxy from '../logger-proxy';\n\n/**\n * Common pagination metadata interface used across all APIs.\n * @public\n * @template T - Additional metadata properties specific to the API\n */\nexport interface PaginationMeta {\n /** Organization ID */\n orgid?: string;\n /** Current page number */\n page?: number;\n /** Page size for current data set */\n pageSize?: number;\n /** Number of pages */\n totalPages?: number;\n /** Total number of items */\n totalRecords?: number;\n /** Total number of items (alias for compatibility) */\n totalItems?: number;\n /** Current page number (alias for compatibility) */\n currentPage?: number;\n /** Map of pagination links */\n links?: Record<string, string>;\n}\n\n/**\n * Common paginated response interface used across all APIs.\n * @public\n * @template T - The type of data items in the response\n */\nexport interface PaginatedResponse<T> {\n /** Array of data items */\n data: T[];\n /** Pagination metadata */\n meta: PaginationMeta;\n}\n\n/**\n * Common search and pagination parameters interface.\n * @public\n */\nexport interface BaseSearchParams {\n /** Search keyword */\n search?: string;\n /** Filter criteria using RSQL syntax */\n filter?: string;\n /** Attributes to be returned */\n attributes?: string;\n /** Page number (starts from 0) */\n page?: number;\n /** Number of items per page */\n pageSize?: number;\n /** Sort field */\n sortBy?: string;\n /** Sort direction */\n sortOrder?: 'asc' | 'desc';\n}\n\n/**\n * Default pagination constants used across all APIs.\n * @public\n */\nexport const PAGINATION_DEFAULTS = {\n /** Default page number */\n PAGE: 0,\n /** Default page size */\n PAGE_SIZE: 100,\n} as const;\n\n/**\n * Interface for cached page entry with metadata\n * @public\n */\nexport interface PageCacheEntry<T> {\n /** Cached data items for this page */\n data: T[];\n /** Timestamp when this page was cached */\n timestamp: number;\n /** Total metadata if available */\n totalMeta?: {\n totalPages?: number;\n totalRecords?: number;\n };\n}\n\n/**\n * Interface for cache validation parameters\n * @public\n */\nexport interface CacheValidationParams {\n /** Search query parameter */\n search?: string;\n /** Filter parameter */\n filter?: string;\n /** Attributes parameter */\n attributes?: string;\n /** Sort by parameter */\n sortBy?: string;\n}\n\n/**\n * Default cache TTL in minutes\n */\nconst DEFAULT_CACHE_TTL_MINUTES = 5;\n\n/**\n * Page cache utility class for managing paginated API response caching.\n * Provides consistent caching behavior across all Contact Center APIs.\n *\n * @class PageCache\n * @public\n * @template T - The type of data items being cached\n * @example\n * ```typescript\n * // Create a cache instance for a specific data type\n * const cache = new PageCache<AddressBookEntry>('AddressBook');\n *\n * // Check if we can use cache (no search/filter parameters)\n * if (cache.canUseCache({ search, filter })) {\n * const cacheKey = cache.buildCacheKey(orgId, page, pageSize);\n * const cachedPage = cache.getCachedPage(cacheKey);\n *\n * if (cachedPage) {\n * return cachedPage.data;\n * }\n * }\n *\n * // Cache API response\n * cache.cachePage(cacheKey, responseData, responseMeta);\n * ```\n */\nexport class PageCache<T> {\n private cache: Map<string, PageCacheEntry<T>> = new Map();\n private apiName: string;\n\n /**\n * Creates an instance of PageCache\n * @param {string} apiName - Name of the API using this cache (for logging)\n * @public\n */\n constructor(apiName: string) {\n this.apiName = apiName;\n }\n\n /**\n * Checks if cache can be used for the given parameters.\n * Cache is only used for simple pagination without search/filter/attributes/sort.\n * @param {CacheValidationParams} params - Parameters to validate\n * @returns {boolean} True if cache can be used\n * @public\n */\n public canUseCache(params: CacheValidationParams): boolean {\n const {search, filter, attributes, sortBy} = params;\n\n return !search && !filter && !attributes && !sortBy;\n }\n\n /**\n * Builds a cache key for the given parameters\n * @param {string} orgId - Organization ID\n * @param {number} page - Page number\n * @param {number} pageSize - Page size\n * @returns {string} Cache key\n * @public\n */\n public buildCacheKey(orgId: string, page: number, pageSize: number): string {\n return `${orgId}:${page}:${pageSize}`;\n }\n\n /**\n * Gets a cached page if it exists and is valid\n * @param {string} cacheKey - Cache key to look up\n * @returns {PageCacheEntry<T> | null} Cached page entry or null if not found/expired\n * @public\n */\n public getCachedPage(cacheKey: string): PageCacheEntry<T> | null {\n const cachedEntry = this.cache.get(cacheKey);\n\n if (!cachedEntry) {\n return null;\n }\n\n // Check if cache entry is expired\n const now = Date.now();\n const cacheAge = (now - cachedEntry.timestamp) / (1000 * 60); // in minutes\n\n if (cacheAge >= DEFAULT_CACHE_TTL_MINUTES) {\n LoggerProxy.log(`Cache entry expired for key: ${cacheKey}`, {\n module: this.apiName,\n method: 'getCachedPage',\n });\n this.cache.delete(cacheKey);\n\n return null;\n }\n\n return cachedEntry;\n }\n\n /**\n * Caches a page of data with metadata\n * @param {string} cacheKey - Cache key\n * @param {T[]} data - Data items to cache\n * @param {any} meta - Metadata from API response\n * @public\n */\n public cachePage(cacheKey: string, data: T[], meta?: any): void {\n const cacheEntry: PageCacheEntry<T> = {\n data,\n timestamp: Date.now(),\n totalMeta: meta\n ? {\n totalPages: meta.totalPages,\n totalRecords: meta.totalRecords || meta.totalItems,\n }\n : undefined,\n };\n\n this.cache.set(cacheKey, cacheEntry);\n\n LoggerProxy.log(`Cached page with ${data.length} items for key: ${cacheKey}`, {\n module: this.apiName,\n method: 'cachePage',\n });\n }\n\n /**\n * Clears all cached entries\n * @public\n */\n public clearCache(): void {\n const cacheSize = this.cache.size;\n this.cache.clear();\n\n LoggerProxy.log(`Cleared ${cacheSize} cache entries`, {\n module: this.apiName,\n method: 'clearCache',\n });\n }\n\n /**\n * Gets the current number of cached entries\n * @returns {number} Number of cached entries\n * @public\n */\n public getCacheSize(): number {\n return this.cache.size;\n }\n}\n\nexport default PageCache;\n"],"mappings":"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"}
1
+ {"version":3,"names":["_loggerProxy","_interopRequireDefault","require","e","__esModule","default","PAGINATION_DEFAULTS","exports","PAGE","PAGE_SIZE","DEFAULT_CACHE_TTL_MINUTES","PageCache","cache","Map","constructor","apiName","canUseCache","params","search","filter","attributes","sortBy","buildCacheKey","orgId","page","pageSize","getCachedPage","cacheKey","cachedEntry","get","now","Date","cacheAge","timestamp","LoggerProxy","log","module","method","delete","cachePage","data","meta","cacheEntry","totalMeta","totalPages","totalRecords","totalItems","undefined","set","length","clearCache","cacheSize","size","clear","getCacheSize","_default"],"sources":["PageCache.ts"],"sourcesContent":["import LoggerProxy from '../logger-proxy';\n\n/**\n * Common pagination metadata interface used across all APIs.\n * @public\n * @template T - Additional metadata properties specific to the API\n */\nexport interface PaginationMeta {\n /** Organization ID */\n orgid?: string;\n /** Current page number */\n page?: number;\n /** Page size for current data set */\n pageSize?: number;\n /** Number of pages */\n totalPages?: number;\n /** Total number of items */\n totalRecords?: number;\n /** Total number of items (alias for compatibility) */\n totalItems?: number;\n /** Current page number (alias for compatibility) */\n currentPage?: number;\n /** Map of pagination links */\n links?: Record<string, string>;\n}\n\n/**\n * Common paginated response interface used across all APIs.\n * @public\n * @template T - The type of data items in the response\n */\nexport interface PaginatedResponse<T> {\n /** Array of data items */\n data: T[];\n /** Pagination metadata */\n meta: PaginationMeta;\n}\n\n/**\n * Common search and pagination parameters interface.\n * @public\n */\nexport interface BaseSearchParams {\n /** Search keyword */\n search?: string;\n /** Filter criteria using RSQL syntax */\n filter?: string;\n /** Attributes to be returned */\n attributes?: string;\n /** Page number (starts from 0) */\n page?: number;\n /** Number of items per page */\n pageSize?: number;\n /** Sort field */\n sortBy?: string;\n /** Sort direction */\n sortOrder?: 'asc' | 'desc';\n}\n\n/**\n * Default pagination constants used across all APIs.\n * @public\n */\nexport const PAGINATION_DEFAULTS = {\n /** Default page number */\n PAGE: 0,\n /** Default page size */\n PAGE_SIZE: 100,\n} as const;\n\n/**\n * Interface for cached page entry with metadata\n * @public\n */\nexport interface PageCacheEntry<T> {\n /** Cached data items for this page */\n data: T[];\n /** Timestamp when this page was cached */\n timestamp: number;\n /** Total metadata if available */\n totalMeta?: {\n totalPages?: number;\n totalRecords?: number;\n };\n}\n\n/**\n * Interface for cache validation parameters\n * @public\n */\nexport interface CacheValidationParams {\n /** Search query parameter */\n search?: string;\n /** Filter parameter */\n filter?: string;\n /** Attributes parameter */\n attributes?: string;\n /** Sort by parameter */\n sortBy?: string;\n}\n\n/**\n * Default cache TTL in minutes\n */\nconst DEFAULT_CACHE_TTL_MINUTES = 5;\n\n/**\n * Page cache utility class for managing paginated API response caching.\n * Provides consistent caching behavior across all Contact Center APIs.\n *\n * @class PageCache\n * @public\n * @template T - The type of data items being cached\n * @example\n * ```typescript\n * // Create a cache instance for a specific data type\n * const cache = new PageCache<AddressBookEntry>('AddressBook');\n *\n * // Check if we can use cache (no search/filter parameters)\n * if (cache.canUseCache({ search, filter })) {\n * const cacheKey = cache.buildCacheKey(orgId, page, pageSize);\n * const cachedPage = cache.getCachedPage(cacheKey);\n *\n * if (cachedPage) {\n * return cachedPage.data;\n * }\n * }\n *\n * // Cache API response\n * cache.cachePage(cacheKey, responseData, responseMeta);\n * ```\n */\nexport class PageCache<T> {\n private cache: Map<string, PageCacheEntry<T>> = new Map();\n private apiName: string;\n\n /**\n * Creates an instance of PageCache\n * @param {string} apiName - Name of the API using this cache (for logging)\n * @public\n */\n constructor(apiName: string) {\n this.apiName = apiName;\n }\n\n /**\n * Checks if cache can be used for the given parameters.\n * Cache is only used for simple pagination without search/filter/attributes/sort.\n * @param {CacheValidationParams} params - Parameters to validate\n * @returns {boolean} True if cache can be used\n * @public\n */\n public canUseCache(params: CacheValidationParams): boolean {\n const {search, filter, attributes, sortBy} = params;\n\n return !search && !filter && !attributes && !sortBy;\n }\n\n /**\n * Builds a cache key for the given parameters\n * @param {string} orgId - Organization ID\n * @param {number} page - Page number\n * @param {number} pageSize - Page size\n * @returns {string} Cache key\n * @public\n */\n public buildCacheKey(orgId: string, page: number, pageSize: number): string {\n return `${orgId}:${page}:${pageSize}`;\n }\n\n /**\n * Gets a cached page if it exists and is valid\n * @param {string} cacheKey - Cache key to look up\n * @returns {PageCacheEntry<T> | null} Cached page entry or null if not found/expired\n * @public\n */\n public getCachedPage(cacheKey: string): PageCacheEntry<T> | null {\n const cachedEntry = this.cache.get(cacheKey);\n\n if (!cachedEntry) {\n return null;\n }\n\n // Check if cache entry is expired\n const now = Date.now();\n const cacheAge = (now - cachedEntry.timestamp) / (1000 * 60); // in minutes\n\n if (cacheAge >= DEFAULT_CACHE_TTL_MINUTES) {\n LoggerProxy.log(`Cache entry expired for key: ${cacheKey}`, {\n module: this.apiName,\n method: 'getCachedPage',\n });\n this.cache.delete(cacheKey);\n\n return null;\n }\n\n return cachedEntry;\n }\n\n /**\n * Caches a page of data with metadata\n * @param {string} cacheKey - Cache key\n * @param {T[]} data - Data items to cache\n * @param {any} meta - Metadata from API response\n * @public\n */\n public cachePage(cacheKey: string, data: T[], meta?: any): void {\n const cacheEntry: PageCacheEntry<T> = {\n data,\n timestamp: Date.now(),\n totalMeta: meta\n ? {\n totalPages: meta.totalPages,\n totalRecords: meta.totalRecords || meta.totalItems,\n }\n : undefined,\n };\n\n this.cache.set(cacheKey, cacheEntry);\n\n LoggerProxy.log(`Cached page with ${data.length} items for key: ${cacheKey}`, {\n module: this.apiName,\n method: 'cachePage',\n });\n }\n\n /**\n * Clears all cached entries\n * @public\n */\n public clearCache(): void {\n const cacheSize = this.cache.size;\n this.cache.clear();\n\n LoggerProxy.log(`Cleared ${cacheSize} cache entries`, {\n module: this.apiName,\n method: 'clearCache',\n });\n }\n\n /**\n * Gets the current number of cached entries\n * @returns {number} Number of cached entries\n * @public\n */\n public getCacheSize(): number {\n return this.cache.size;\n }\n}\n\nexport default PageCache;\n"],"mappings":"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","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_webexCore","require","_default","exports","default","hydra","process","env","HYDRA_SERVICE_URL","hydraServiceUrl","credentials","device","validateDomains","ephemeral","storage","boundedAdapter","MemoryStoreAdapter","unboundedAdapter"],"sources":["webex-config.ts"],"sourcesContent":["import {MemoryStoreAdapter} from '@webex/webex-core';\n\n/**\n * Default Webex SDK configuration for Contact Center integration.\n *\n * @public\n * @example\n * import webexConfig from './webex-config';\n * const hydraUrl = webexConfig.hydra;\n */\nexport default {\n /**\n * URL for the Hydra API service.\n * @type {string}\n * @public\n * @default process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1'\n */\n hydra: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',\n /**\n * Alias for the Hydra API service URL.\n * @type {string}\n * @public\n * @default process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1'\n */\n hydraServiceUrl: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',\n /**\n * Credentials configuration (empty by default).\n * @type {object}\n * @public\n */\n credentials: {},\n /**\n * Device configuration options.\n * @type {object}\n * @public\n * @property {boolean} validateDomains - Whether to validate device domains.\n * @property {boolean} ephemeral - Whether the device is ephemeral.\n */\n device: {\n validateDomains: true,\n ephemeral: true,\n },\n /**\n * Storage configuration for the SDK.\n * @type {object}\n * @public\n * @property {typeof MemoryStoreAdapter} boundedAdapter - Adapter for bounded storage.\n * @property {typeof MemoryStoreAdapter} unboundedAdapter - Adapter for unbounded storage.\n */\n storage: {\n boundedAdapter: MemoryStoreAdapter,\n unboundedAdapter: MemoryStoreAdapter,\n },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAQe;EACb;AACF;AACA;AACA;AACA;AACA;EACEC,KAAK,EAAEC,OAAO,CAACC,GAAG,CAACC,iBAAiB,IAAI,+BAA+B;EACvE;AACF;AACA;AACA;AACA;AACA;EACEC,eAAe,EAAEH,OAAO,CAACC,GAAG,CAACC,iBAAiB,IAAI,+BAA+B;EACjF;AACF;AACA;AACA;AACA;EACEE,WAAW,EAAE,CAAC,CAAC;EACf;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,MAAM,EAAE;IACNC,eAAe,EAAE,IAAI;IACrBC,SAAS,EAAE;EACb,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,OAAO,EAAE;IACPC,cAAc,EAAEC,6BAAkB;IAClCC,gBAAgB,EAAED;EACpB;AACF,CAAC"}
1
+ {"version":3,"names":["_webexCore","require","_default","exports","default","hydra","process","env","HYDRA_SERVICE_URL","hydraServiceUrl","credentials","device","validateDomains","ephemeral","storage","boundedAdapter","MemoryStoreAdapter","unboundedAdapter"],"sources":["webex-config.ts"],"sourcesContent":["import {MemoryStoreAdapter} from '@webex/webex-core';\n\n/**\n * Default Webex SDK configuration for Contact Center integration.\n *\n * @public\n * @example\n * import webexConfig from './webex-config';\n * const hydraUrl = webexConfig.hydra;\n */\nexport default {\n /**\n * URL for the Hydra API service.\n * @type {string}\n * @public\n * @default process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1'\n */\n hydra: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',\n /**\n * Alias for the Hydra API service URL.\n * @type {string}\n * @public\n * @default process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1'\n */\n hydraServiceUrl: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',\n /**\n * Credentials configuration (empty by default).\n * @type {object}\n * @public\n */\n credentials: {},\n /**\n * Device configuration options.\n * @type {object}\n * @public\n * @property {boolean} validateDomains - Whether to validate device domains.\n * @property {boolean} ephemeral - Whether the device is ephemeral.\n */\n device: {\n validateDomains: true,\n ephemeral: true,\n },\n /**\n * Storage configuration for the SDK.\n * @type {object}\n * @public\n * @property {typeof MemoryStoreAdapter} boundedAdapter - Adapter for bounded storage.\n * @property {typeof MemoryStoreAdapter} unboundedAdapter - Adapter for unbounded storage.\n */\n storage: {\n boundedAdapter: MemoryStoreAdapter,\n unboundedAdapter: MemoryStoreAdapter,\n },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAQe;EACb;AACF;AACA;AACA;AACA;AACA;EACEC,KAAK,EAAEC,OAAO,CAACC,GAAG,CAACC,iBAAiB,IAAI,+BAA+B;EACvE;AACF;AACA;AACA;AACA;AACA;EACEC,eAAe,EAAEH,OAAO,CAACC,GAAG,CAACC,iBAAiB,IAAI,+BAA+B;EACjF;AACF;AACA;AACA;AACA;EACEE,WAAW,EAAE,CAAC,CAAC;EACf;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,MAAM,EAAE;IACNC,eAAe,EAAE,IAAI;IACrBC,SAAS,EAAE;EACb,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,OAAO,EAAE;IACPC,cAAc,EAAEC,6BAAkB;IAClCC,gBAAgB,EAAED;EACpB;AACF,CAAC","ignoreList":[]}
package/dist/webex.js CHANGED
@@ -13,7 +13,7 @@ require("@webex/plugin-logger");
13
13
  require("@webex/internal-plugin-support");
14
14
  require("./index");
15
15
  var _webexConfig = _interopRequireDefault(require("./webex-config"));
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
17
  /**
18
18
  * Ensures global Buffer is defined, which is required for SDK functionality in some environments.
19
19
  * @ignore
@@ -29,7 +29,7 @@ if (!global.Buffer) {
29
29
  */
30
30
  const Webex = _webexCore.default.extend({
31
31
  webex: true,
32
- version: `3.10.0-next.16`
32
+ version: `3.10.0-next.18`
33
33
  });
34
34
 
35
35
  /**
package/dist/webex.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_merge","_interopRequireDefault","require","_webexCore","_safeBuffer","_webexConfig","obj","__esModule","default","global","Buffer","Webex","WebexCore","extend","webex","version","init","attrs","config","merge","_default","exports"],"sources":["webex.js"],"sourcesContent":["import merge from 'lodash/merge';\nimport WebexCore from '@webex/webex-core';\nimport {Buffer} from 'safe-buffer';\nimport '@webex/plugin-authorization';\nimport '@webex/internal-plugin-mercury';\nimport '@webex/plugin-logger';\nimport '@webex/internal-plugin-support';\n\nimport './index';\n\nimport config from './webex-config';\n\n/**\n * Ensures global Buffer is defined, which is required for SDK functionality in some environments.\n * @ignore\n */\nif (!global.Buffer) {\n global.Buffer = Buffer;\n}\n\n/**\n * Webex SDK class extended from the core SDK.\n * Includes custom configuration and plugin registration for CC (Contact Center) use cases.\n * @ignore\n */\nconst Webex = WebexCore.extend({\n webex: true,\n version: PACKAGE_VERSION,\n});\n\n/**\n * Initializes a new Webex instance with merged configuration.\n *\n * @param {Object} [attrs={}] - Initialization attributes.\n * @param {Object} [attrs.config] - Optional custom config to override defaults.\n * @param {Object} [attrs.config.logger] - Logging configuration.\n * @param {string} [attrs.config.logger.level='info'] - Logging level (e.g., 'debug', 'info').\n * @param {string} [attrs.config.logger.bufferLogLevel='log'] - Log buffering level for log uploads.\n * @param {Object} [attrs.config.cc] - Contact Center (CC) specific configurations.\n * @param {boolean} [attrs.config.cc.allowMultiLogin=false] - Whether to allow multiple logins.\n * @param {boolean} [attrs.config.cc.allowAutomatedRelogin=true] - Whether to allow automated re-login.\n * @param {string} [attrs.config.cc.clientType='WebexCCSDK'] - Type of the client.\n * @param {boolean} [attrs.config.cc.isKeepAliveEnabled=false] - Whether to enable keep-alive functionality.\n * @param {boolean} [attrs.config.cc.force=true] - Whether to force specific CC configurations.\n * @param {Object} [attrs.config.cc.metrics] - Metrics configuration for CC.\n * @param {string} [attrs.config.cc.metrics.clientName='WEBEX_JS_SDK'] - Metrics client name.\n * @param {string} [attrs.config.cc.metrics.clientType='WebexCCSDK'] - Metrics client type.\n * @returns {Webex} A new Webex instance.\n *\n * @see {@link https://developer.webex.com/meeting/docs/sdks/webex-meetings-sdk-web-quickstart#webex-object-attribute-reference} - Webex Object Attribute Reference for SDK Configuration.\n *\n * This configuration merges the default `webex-config` with any custom configuration provided as `attrs.config`.\n * The merged configuration governs various SDK behaviors, such as authorization, logging, and CC-specific settings.\n *\n * @example <caption>Basic Usage</caption>\n * import Webex from '@webex/contact-center';\n *\n * // Initialize Webex SDK with default configuration\n * const webex = Webex.init();\n *\n * @example <caption>Custom Configuration</caption>\n * import Webex from '@webex/contact-center';\n *\n * const customConfig = {\n * logger: {\n * level: 'debug', // Enable debug logging\n * bufferLogLevel: 'log', // Used for upload logs\n * },\n * credentials: {\n * client_id: 'your-client-id', // Replace with your Webex application's client ID\n * client_secret: 'your-client-secret', // Replace with your Webex application's client secret\n * redirect_uri: 'https://your-redirect-uri', // Replace with your app's redirect URI\n * },\n * cc: {\n * allowMultiLogin: false, // Disallow multiple logins\n * allowAutomatedRelogin: true, // Enable automated re-login\n * clientType: 'WebexCCSDK', // Specify the Contact Center client type\n * isKeepAliveEnabled: false, // Disable keep-alive functionality\n * force: true, // Force CC-specific configurations\n * metrics: {\n * clientName: 'WEBEX_JS_SDK', // Metrics client name\n * clientType: 'WebexCCSDK', // Metrics client type\n * },\n * },\n * };\n *\n * // Initialize Webex SDK with custom configuration\n * const webex = Webex.init({ config: customConfig });\n */\nWebex.init = function init(attrs = {}) {\n attrs.config = merge({}, config, attrs.config);\n\n return new Webex(attrs);\n};\n\nexport default Webex;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEAA,OAAA;AAEA,IAAAG,YAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEpC;AACA;AACA;AACA;AACA,IAAI,CAACG,MAAM,CAACC,MAAM,EAAE;EAClBD,MAAM,CAACC,MAAM,GAAGA,kBAAM;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAK,GAAGC,kBAAS,CAACC,MAAM,CAAC;EAC7BC,KAAK,EAAE,IAAI;EACXC,OAAO;AACT,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAJ,KAAK,CAACK,IAAI,GAAG,SAASA,IAAIA,CAACC,KAAK,GAAG,CAAC,CAAC,EAAE;EACrCA,KAAK,CAACC,MAAM,GAAG,IAAAC,cAAK,EAAC,CAAC,CAAC,EAAED,oBAAM,EAAED,KAAK,CAACC,MAAM,CAAC;EAE9C,OAAO,IAAIP,KAAK,CAACM,KAAK,CAAC;AACzB,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAb,OAAA,GAEaG,KAAK"}
1
+ {"version":3,"names":["_merge","_interopRequireDefault","require","_webexCore","_safeBuffer","_webexConfig","e","__esModule","default","global","Buffer","Webex","WebexCore","extend","webex","version","init","attrs","config","merge","_default","exports"],"sources":["webex.js"],"sourcesContent":["import merge from 'lodash/merge';\nimport WebexCore from '@webex/webex-core';\nimport {Buffer} from 'safe-buffer';\nimport '@webex/plugin-authorization';\nimport '@webex/internal-plugin-mercury';\nimport '@webex/plugin-logger';\nimport '@webex/internal-plugin-support';\n\nimport './index';\n\nimport config from './webex-config';\n\n/**\n * Ensures global Buffer is defined, which is required for SDK functionality in some environments.\n * @ignore\n */\nif (!global.Buffer) {\n global.Buffer = Buffer;\n}\n\n/**\n * Webex SDK class extended from the core SDK.\n * Includes custom configuration and plugin registration for CC (Contact Center) use cases.\n * @ignore\n */\nconst Webex = WebexCore.extend({\n webex: true,\n version: PACKAGE_VERSION,\n});\n\n/**\n * Initializes a new Webex instance with merged configuration.\n *\n * @param {Object} [attrs={}] - Initialization attributes.\n * @param {Object} [attrs.config] - Optional custom config to override defaults.\n * @param {Object} [attrs.config.logger] - Logging configuration.\n * @param {string} [attrs.config.logger.level='info'] - Logging level (e.g., 'debug', 'info').\n * @param {string} [attrs.config.logger.bufferLogLevel='log'] - Log buffering level for log uploads.\n * @param {Object} [attrs.config.cc] - Contact Center (CC) specific configurations.\n * @param {boolean} [attrs.config.cc.allowMultiLogin=false] - Whether to allow multiple logins.\n * @param {boolean} [attrs.config.cc.allowAutomatedRelogin=true] - Whether to allow automated re-login.\n * @param {string} [attrs.config.cc.clientType='WebexCCSDK'] - Type of the client.\n * @param {boolean} [attrs.config.cc.isKeepAliveEnabled=false] - Whether to enable keep-alive functionality.\n * @param {boolean} [attrs.config.cc.force=true] - Whether to force specific CC configurations.\n * @param {Object} [attrs.config.cc.metrics] - Metrics configuration for CC.\n * @param {string} [attrs.config.cc.metrics.clientName='WEBEX_JS_SDK'] - Metrics client name.\n * @param {string} [attrs.config.cc.metrics.clientType='WebexCCSDK'] - Metrics client type.\n * @returns {Webex} A new Webex instance.\n *\n * @see {@link https://developer.webex.com/meeting/docs/sdks/webex-meetings-sdk-web-quickstart#webex-object-attribute-reference} - Webex Object Attribute Reference for SDK Configuration.\n *\n * This configuration merges the default `webex-config` with any custom configuration provided as `attrs.config`.\n * The merged configuration governs various SDK behaviors, such as authorization, logging, and CC-specific settings.\n *\n * @example <caption>Basic Usage</caption>\n * import Webex from '@webex/contact-center';\n *\n * // Initialize Webex SDK with default configuration\n * const webex = Webex.init();\n *\n * @example <caption>Custom Configuration</caption>\n * import Webex from '@webex/contact-center';\n *\n * const customConfig = {\n * logger: {\n * level: 'debug', // Enable debug logging\n * bufferLogLevel: 'log', // Used for upload logs\n * },\n * credentials: {\n * client_id: 'your-client-id', // Replace with your Webex application's client ID\n * client_secret: 'your-client-secret', // Replace with your Webex application's client secret\n * redirect_uri: 'https://your-redirect-uri', // Replace with your app's redirect URI\n * },\n * cc: {\n * allowMultiLogin: false, // Disallow multiple logins\n * allowAutomatedRelogin: true, // Enable automated re-login\n * clientType: 'WebexCCSDK', // Specify the Contact Center client type\n * isKeepAliveEnabled: false, // Disable keep-alive functionality\n * force: true, // Force CC-specific configurations\n * metrics: {\n * clientName: 'WEBEX_JS_SDK', // Metrics client name\n * clientType: 'WebexCCSDK', // Metrics client type\n * },\n * },\n * };\n *\n * // Initialize Webex SDK with custom configuration\n * const webex = Webex.init({ config: customConfig });\n */\nWebex.init = function init(attrs = {}) {\n attrs.config = merge({}, config, attrs.config);\n\n return new Webex(attrs);\n};\n\nexport default Webex;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEAA,OAAA;AAEA,IAAAG,YAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC;AACA;AACA;AACA;AACA,IAAI,CAACG,MAAM,CAACC,MAAM,EAAE;EAClBD,MAAM,CAACC,MAAM,GAAGA,kBAAM;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAK,GAAGC,kBAAS,CAACC,MAAM,CAAC;EAC7BC,KAAK,EAAE,IAAI;EACXC,OAAO;AACT,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAJ,KAAK,CAACK,IAAI,GAAG,SAASA,IAAIA,CAACC,KAAK,GAAG,CAAC,CAAC,EAAE;EACrCA,KAAK,CAACC,MAAM,GAAG,IAAAC,cAAK,EAAC,CAAC,CAAC,EAAED,oBAAM,EAAED,KAAK,CAACC,MAAM,CAAC;EAE9C,OAAO,IAAIP,KAAK,CAACM,KAAK,CAAC;AACzB,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAb,OAAA,GAEaG,KAAK","ignoreList":[]}
package/package.json CHANGED
@@ -45,13 +45,13 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@types/platform": "1.3.4",
48
- "@webex/calling": "3.10.0-next.13",
49
- "@webex/internal-plugin-mercury": "3.10.0-next.3",
50
- "@webex/internal-plugin-metrics": "3.10.0-next.3",
51
- "@webex/internal-plugin-support": "3.10.0-next.3",
52
- "@webex/plugin-authorization": "3.10.0-next.3",
53
- "@webex/plugin-logger": "3.10.0-next.3",
54
- "@webex/webex-core": "3.10.0-next.3",
48
+ "@webex/calling": "3.10.0-next.14",
49
+ "@webex/internal-plugin-mercury": "3.10.0-next.4",
50
+ "@webex/internal-plugin-metrics": "3.10.0-next.4",
51
+ "@webex/internal-plugin-support": "3.10.0-next.4",
52
+ "@webex/plugin-authorization": "3.10.0-next.4",
53
+ "@webex/plugin-logger": "3.10.0-next.4",
54
+ "@webex/webex-core": "3.10.0-next.4",
55
55
  "jest-html-reporters": "3.0.11",
56
56
  "lodash": "^4.17.21"
57
57
  },
@@ -80,5 +80,5 @@
80
80
  "typedoc": "^0.25.0",
81
81
  "typescript": "4.9.5"
82
82
  },
83
- "version": "3.10.0-next.16"
83
+ "version": "3.10.0-next.18"
84
84
  }
@@ -201,15 +201,22 @@ export default class TaskManager extends EventEmitter {
201
201
  this.emit(TASK_EVENTS.TASK_OFFER_CONTACT, task);
202
202
  break;
203
203
  case CC_EVENTS.AGENT_OUTBOUND_FAILED:
204
- // We don't have to emit any event here since this will be result of promise.
205
- if (task.data) {
206
- this.removeTaskFromCollection(task);
207
- }
204
+ task = this.updateTaskData(task, payload.data);
205
+ this.metricsManager.trackEvent(
206
+ METRIC_EVENT_NAMES.TASK_OUTDIAL_FAILED,
207
+ {
208
+ ...MetricsManager.getCommonTrackingFieldForAQMResponse(payload.data),
209
+ taskId: payload.data.interactionId,
210
+ reason: payload.data.reasonCode || payload.data.reason,
211
+ },
212
+ ['behavioral', 'operational']
213
+ );
208
214
  LoggerProxy.log(`Agent outbound failed for task`, {
209
215
  module: TASK_MANAGER_FILE,
210
216
  method: METHODS.REGISTER_TASK_LISTENERS,
211
- interactionId: payload.data?.interactionId,
217
+ interactionId: payload.data.interactionId,
212
218
  });
219
+ task.emit(TASK_EVENTS.TASK_OUTDIAL_FAILED, payload.data.reason ?? 'UNKNOWN_REASON');
213
220
  break;
214
221
  case CC_EVENTS.AGENT_CONTACT_ASSIGNED:
215
222
  task = this.updateTaskData(task, payload.data);
@@ -553,9 +560,15 @@ export default class TaskManager extends EventEmitter {
553
560
  this.webCallingService.cleanUpCall();
554
561
  }
555
562
 
556
- if (task.data.interaction.state === 'new' || isSecondaryEpDnAgent(task.data.interaction)) {
557
- // Only remove tasks in 'new' state or isSecondaryEpDnAgent immediately. For other states,
558
- // retain tasks until they complete wrap-up, unless the task disconnected before being answered.
563
+ const isOutdial = task.data.interaction.outboundType === 'OUTDIAL';
564
+ const isNew = task.data.interaction.state === 'new';
565
+ const isTerminated = task.data.interaction.isTerminated;
566
+
567
+ // For OUTDIAL: only remove if NOT terminated (user-declined, no wrap-up follows)
568
+ // If terminated, keep task for wrap-up flow (CONTACT_ENDED → AGENT_WRAPUP)
569
+ // For non-OUTDIAL: remove if state is 'new'
570
+ // Always remove if secondary EpDn agent
571
+ if ((isNew && !(isOutdial && isTerminated)) || isSecondaryEpDnAgent(task.data.interaction)) {
559
572
  this.removeTaskFromCollection(task);
560
573
  }
561
574
  }
@@ -347,6 +347,18 @@ export enum TASK_EVENTS {
347
347
  */
348
348
  TASK_REJECT = 'task:rejected',
349
349
 
350
+ /**
351
+ * Triggered when an outdial call fails
352
+ * @example
353
+ * ```typescript
354
+ * task.on(TASK_EVENTS.TASK_OUTDIAL_FAILED, (reason: string) => {
355
+ * console.log('Outdial failed:', reason);
356
+ * // Handle outdial failure
357
+ * });
358
+ * ```
359
+ */
360
+ TASK_OUTDIAL_FAILED = 'task:outdialFailed',
361
+
350
362
  /**
351
363
  * Triggered when a task is populated with data
352
364
  * @example
@@ -673,14 +673,36 @@ describe('TaskManager', () => {
673
673
  expect(taskUpdateTaskDataSpy).toHaveBeenCalledWith(payload.data);
674
674
  });
675
675
 
676
- it('should remove currentTask from taskCollection on AGENT_OUTBOUND_FAILED event', () => {
676
+ it('should NOT remove OUTDIAL task from taskCollection on AGENT_OUTBOUND_FAILED when terminated (wrap-up flow)', () => {
677
+ const task = taskManager.getTask(taskId);
678
+ task.updateTaskData = jest.fn().mockImplementation((newData) => {
679
+ task.data = {
680
+ ...task.data,
681
+ ...newData,
682
+ interaction: {
683
+ ...task.data.interaction,
684
+ ...newData.interaction,
685
+ outboundType: 'OUTDIAL',
686
+ state: 'new',
687
+ isTerminated: true,
688
+ },
689
+ };
690
+ return task;
691
+ });
692
+ task.unregisterWebCallListeners = jest.fn();
693
+ const removeTaskSpy = jest.spyOn(taskManager, 'removeTaskFromCollection');
694
+
677
695
  const payload = {
678
696
  data: {
679
697
  type: CC_EVENTS.AGENT_OUTBOUND_FAILED,
680
698
  agentId: '723a8ffb-a26e-496d-b14a-ff44fb83b64f',
681
699
  eventTime: 1733211616959,
682
700
  eventType: 'RoutingMessage',
683
- interaction: {},
701
+ interaction: {
702
+ outboundType: 'OUTDIAL',
703
+ state: 'new',
704
+ isTerminated: true,
705
+ },
684
706
  interactionId: taskId,
685
707
  orgId: '6ecef209-9a34-4ed1-a07a-7ddd1dbe925a',
686
708
  trackingId: '575c0ec2-618c-42af-a61c-53aeb0a221ee',
@@ -688,14 +710,78 @@ describe('TaskManager', () => {
688
710
  destAgentId: 'ebeb893b-ba67-4f36-8418-95c7492b28c2',
689
711
  owner: '723a8ffb-a26e-496d-b14a-ff44fb83b64f',
690
712
  queueMgr: 'aqm',
713
+ reason: 'CUSTOMER_BUSY',
714
+ reasonCode: 1022,
691
715
  },
692
716
  };
693
717
 
694
- taskManager.taskCollection[taskId] = taskManager.getTask(taskId);
718
+ webSocketManagerMock.emit('message', JSON.stringify(payload));
719
+
720
+ expect(taskManager.getTask(taskId)).toBeDefined();
721
+ expect(removeTaskSpy).not.toHaveBeenCalled();
722
+ });
723
+
724
+ it('should emit TASK_OUTDIAL_FAILED event on AGENT_OUTBOUND_FAILED', () => {
725
+ const task = taskManager.getTask(taskId);
726
+ task.updateTaskData = jest.fn().mockReturnValue(task);
727
+ const taskEmitSpy = jest.spyOn(task, 'emit');
728
+ const payload = {
729
+ data: {
730
+ type: CC_EVENTS.AGENT_OUTBOUND_FAILED,
731
+ interactionId: taskId,
732
+ reason: 'CUSTOMER_BUSY',
733
+ },
734
+ };
735
+ webSocketManagerMock.emit('message', JSON.stringify(payload));
736
+ expect(taskEmitSpy).toHaveBeenCalledWith(TASK_EVENTS.TASK_OUTDIAL_FAILED, 'CUSTOMER_BUSY');
737
+ });
738
+
739
+ it('should remove OUTDIAL task from taskCollection on AGENT_CONTACT_ASSIGN_FAILED when NOT terminated (user-declined)', () => {
740
+ const task = taskManager.getTask(taskId);
741
+ task.updateTaskData = jest.fn().mockImplementation((newData) => {
742
+ task.data = {
743
+ ...task.data,
744
+ ...newData,
745
+ interaction: {
746
+ ...task.data.interaction,
747
+ ...newData.interaction,
748
+ outboundType: 'OUTDIAL',
749
+ state: 'new',
750
+ isTerminated: false,
751
+ },
752
+ };
753
+ return task;
754
+ });
755
+ task.unregisterWebCallListeners = jest.fn();
756
+ const removeTaskSpy = jest.spyOn(taskManager, 'removeTaskFromCollection');
757
+
758
+ const payload = {
759
+ data: {
760
+ type: CC_EVENTS.AGENT_CONTACT_ASSIGN_FAILED,
761
+ agentId: '723a8ffb-a26e-496d-b14a-ff44fb83b64f',
762
+ eventTime: 1733211616959,
763
+ eventType: 'RoutingMessage',
764
+ interaction: {
765
+ outboundType: 'OUTDIAL',
766
+ state: 'new',
767
+ isTerminated: false,
768
+ },
769
+ interactionId: taskId,
770
+ orgId: '6ecef209-9a34-4ed1-a07a-7ddd1dbe925a',
771
+ trackingId: '575c0ec2-618c-42af-a61c-53aeb0a221ee',
772
+ mediaResourceId: '0ae913a4-c857-4705-8d49-76dd3dde75e4',
773
+ destAgentId: 'ebeb893b-ba67-4f36-8418-95c7492b28c2',
774
+ owner: '723a8ffb-a26e-496d-b14a-ff44fb83b64f',
775
+ queueMgr: 'aqm',
776
+ reason: 'USER_DECLINED',
777
+ reasonCode: 156,
778
+ },
779
+ };
695
780
 
696
781
  webSocketManagerMock.emit('message', JSON.stringify(payload));
697
782
 
698
783
  expect(taskManager.getTask(taskId)).toBeUndefined();
784
+ expect(removeTaskSpy).toHaveBeenCalled();
699
785
  });
700
786
 
701
787
  it('handle AGENT_OFFER_CONSULT event', () => {