diff --git a/docs/samples/contact-center/app.js b/docs/samples/contact-center/app.js index 1fe940d324d..9106e4ee135 100644 --- a/docs/samples/contact-center/app.js +++ b/docs/samples/contact-center/app.js @@ -168,7 +168,6 @@ async function fetchBuddyAgents() { } } -// Modify doAgentLogin to show buddy agents box on successful login function doAgentLogin() { webex.cc.stationLogin({teamId: teamsDropdown.value, loginOption: agentDeviceType, dialNumber: dialNumber.value}).then((response) => { console.log('Agent Logged in successfully', response); @@ -177,7 +176,6 @@ function doAgentLogin() { }); } -// Modify logoutAgent to hide buddy agents box on logout function logoutAgent() { webex.cc.stationLogout({logoutReason: 'logout'}).then((response) => { console.log('Agent logged out successfully', response); diff --git a/packages/@webex/plugin-cc/src/cc.ts b/packages/@webex/plugin-cc/src/cc.ts index 73faf193fb1..4ac60117447 100644 --- a/packages/@webex/plugin-cc/src/cc.ts +++ b/packages/@webex/plugin-cc/src/cc.ts @@ -10,6 +10,7 @@ import { WelcomeEvent, STATION_LOGIN_TYPE, GetBuddyAgentsOptions, + BUDDY_AGENT_MEDIA_TYPE, } from './types'; import {READY, CC_FILE} from './constants'; import Agent from './features/Agent'; @@ -161,21 +162,20 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter } /** - * @param options + * @param options - GetBuddyAgentsOptions * @returns Promise * @throws Error * @example * const buddyAgents = await webex.cc.getBuddyAgents({ * agentProfileId: 'selfAgentProfileId', - * mediaType: 'telephony', - * state: 'Available', + * mediaType: BUDDY_AGENT_MEDIA_TYPE.TELEPHONY, + * state: BuddyAgentState.AVAILABLE, * }); */ public async getBuddyAgents({ options = { agentProfileId: this.agentConfig.agentProfileId, - mediaType: 'telephony', - state: undefined, + mediaType: BUDDY_AGENT_MEDIA_TYPE.TELEPHONY, }, }: { options: GetBuddyAgentsOptions; diff --git a/packages/@webex/plugin-cc/src/services/HttpRequest.ts b/packages/@webex/plugin-cc/src/services/HttpRequest.ts index 179e766e8bc..d3df6dc8860 100644 --- a/packages/@webex/plugin-cc/src/services/HttpRequest.ts +++ b/packages/@webex/plugin-cc/src/services/HttpRequest.ts @@ -100,14 +100,18 @@ class HttpRequest { Object.keys(payload).forEach((key) => payload[key] === undefined && delete payload[key]); // Send the service request - const response = await this.webex.request({ + const response: IHttpResponse = await this.webex.request({ service, resource, method, body: payload, }); + const trackingid = response.headers.get('trackingid'); + this.webex.logger.log( - `Service request sent successfully. Response: ${JSON.stringify(response)}` + `Service request sent successfully to ${service}/${resource} with payload: ${JSON.stringify( + payload + )}, Request TrackingID: ${trackingid}` ); // Listen for the event diff --git a/packages/@webex/plugin-cc/src/types.ts b/packages/@webex/plugin-cc/src/types.ts index 0847b4f21c2..872632f5eea 100644 --- a/packages/@webex/plugin-cc/src/types.ts +++ b/packages/@webex/plugin-cc/src/types.ts @@ -149,8 +149,22 @@ export interface SubscribeRequest { export type EventResult = IAgentProfile; -export type BuddyAgentMediaType = 'telephony' | 'chat' | 'social' | 'email'; -export type BuddyAgentState = 'Available' | 'Idle'; +export const BUDDY_AGENT_MEDIA_TYPE = { + TELEPHONY: 'telephony', + CHAT: 'chat', + SOCIAL: 'social', + EMAIL: 'email', +} as const; + +export type BuddyAgentMediaType = Enum; + +export const BUDDY_AGENT_STATE = { + AVAILABLE: 'Available', + IDLE: 'Idle', +} as const; + +export type BuddyAgentState = Enum; + export type GetBuddyAgentsOptions = { agentProfileId?: string; mediaType: BuddyAgentMediaType;