WxCC Agent Desktop JS-API
WxCC Agent Desktop JS API modules set
Root module (Desktop) includes:
- Config module
- I18N module
- Actions module
- Logger service module
- ShortcutKey service module
- AQM/Notifs agent-contact service layer API module for WxCC Agent Desktop.
- AQM/Notifs agent-state service layer API module for WxCC Agent Desktop.
- AQM/Notifs dialer service layer API module for WxCC Agent Desktop.
- AQM/Notifs screenpop service layer API module for WxCC Agent Desktop.
Desktop module
Desktop module contains sub-modules:
import { Desktop } from "@wxcc-desktop/sdk";
const {
config,
actions,
logger,
shortcutKey,
i18n,
agentContact,
agentStateInfo,
dialer,
screenpop
} = Desktop;
Desktop.logger sub-module
Desktop.logger sub-module is intended to create & maintain client-side logger's instances for third-party widgets.
import { Desktop } from "@wxcc-desktop/sdk";
const logerOne = Desktop.logger.createLogger("for-service-one");
const logerTwo = Desktop.logger.createLogger("for-service-two");
logerOne.info("Info test");
logerTwo.warn("Warn test");
logerOne.error("Error test");
Desktop.logger.browserDownloadLogsJson("for-service-one");
Desktop.logger.browserDownloadLogsText("for-service-one");
Desktop.logger.getLogsCollection("for-service-one");
Desktop.logger.getLogsJsonUrl("for-service-one");
Desktop.logger.getLogsTextUrl("for-service-one");
Desktop.logger.cleanupPrefixedLogs("for-service-one");
Desktop.i18n sub-module
Desktop.i18n sub-module is intended to create & maintain client-side i18n & lit-element i18nMixin instances for third-party widgets.
Desktop.i18n instantinating object is described in: https://www.i18next.com/overview/api#instance-creation
i18n instance backend configuration described in: https://github.com/i18next/i18next-http-backend
i18n instance languageDetector configuration described in: https://github.com/i18next/i18next-browser-languageDetector
i18n instance init options are described in: https://www.i18next.com/overview/configuration-options
import { Desktop } from "@wxcc-desktop/sdk";
import { customElement, LitElement } from "lit-element";
import { html } from "lit-html";
type CreateOptions = {
logger?:
| {
log(...args: any[]): void;
warn(...args: any[]): void;
error(...args: any[]): void;
}
| ReturnType<typof Desktop.createLogger>;
backend?: Backend
languageDetector?: LanguageDetector
};
const i18n = Desktop.i18n.createInstance(createOptions?: CreateOptions)
const i18nMixin = Desktop.i18n.createMixin({ i18n })
console.log(Desktop.i18n.DEFAULT_INIT_OPTIONS);
if (!i18n.isInitialized) {
const initOptions = Desktop.i18n.getMergedInitOptions(Desktop.i18n.DEFAULT_INIT_OPTIONS || {}, {
defaultNS: "my-ns",
ns: ["my-ns"],
fallbackLng: "en",
backend: {
loadPath: "/.../path-to-locales/.../{{lng}}/{{ns}}.json"
}
});
i18n.init(initOptions).catch(err => console.log(err));
}
@customElement("my-awesome-component")
export class MyAwesomeComponent extends i18nMixin(LitElement) {
render() {
return html`
<p>${i18n.t("my-ns:key1")}</p>
<p>${this.t("my-ns:key2")}</p>`
}
}
Desktop.actions sub-module
Desktop.actions sub-module is intended to make a calls into and/or get data from AgentX store.
import { Desktop } from "@wxcc-desktop/sdk";
Desktop.actions.fireGeneralSilentNotification({...})
const [ status, reason, mode ]: [ Notifications.ItemMeta.Status, Notifications.ItemMeta.StatusChangeEventReason, Notifications.ItemMeta.Mode ] = await Desktop.actions.fireGeneralAutoDismissNotification({...})
const [ status, reason, mode ]: [ Notifications.ItemMeta.Status, Notifications.ItemMeta.StatusChangeEventReason, Notifications.ItemMeta.Mode ] = await Desktop.actions.fireGeneralAcknowledgeNotification({...})
Desktop.actions.addCustomTask({...})
const currentTaskMap = await Desktop.actions.getTaskMap()
const queue = await Desktop.actions.getMediaTypeQueue("telephony" | "social" | "email" | "chat")
const accessToken = await Desktop.actions.getToken()
const idelCodes = await Desktop.actions.getIdleCodes()
const wrapUpCodes = await Desktop.actions.getWrapUpCodes()
const toggle = Desktop.actions.toggleMiximizeRestore(e: Event)
Desktop.shortcutKey sub-module
Desktop.shortcutKey sub-module is intended to register and call shortcut keys actions from widgets.
import { Desktop } from "@wxcc-desktop/sdk";
console.log(Desktop.shortcutKey.DEFAULT_SHORTCUT_KEYS);
console.log(Desktop.shortcutKey.MODIFIERS);
console.log(Desktop.shortcutKey.REGISTERED_KEYS);
console.log(Desktop.shortcutKey.getRegisteredKeys());
Desktop.shortcutKey.listenKeyPress((event) => {...});
Desktop.shortcutKey.listenKeyConflict((event) => {...});
Desktop.shortcutKey.listenConflictResolved(() => {});
Desktop.shortcutKey.register([ {...}, {...}, ... ]);
Desktop.shortcutKey.unregisterKeys('widget-one-example');
Desktop.agentContact sub-module
Desktop.agentContact sub-module is intended to make aqm requests and listen to notifs events related to agent-contact entity.
import { Desktop } from "@wxcc-desktop/sdk";
await Desktop.agentContact.accept({ ... });
await Desktop.agentContact.consultAccept({ ... });
await Desktop.agentContact.buddyAgents({ ... });
await Desktop.agentContact.end({ ... });
await Desktop.agentContact.consultEnd({ ... });
await Desktop.agentContact.cancelCtq({ ... });
await Desktop.agentContact.wrapup({ ... });
await Desktop.agentContact.vteamTransfer({ ... });
await Desktop.agentContact.blindTransfer({ ... });
await Desktop.agentContact.hold({ ... });
await Desktop.agentContact.unHold({ ... });
await Desktop.agentContact.consult({ ... });
await Desktop.agentContact.decline({ ... });
await Desktop.agentContact.consultTransfer({ ... });
await Desktop.agentContact.vteamList({ ... });
await Desktop.agentContact.pauseRecording({ ... });
await Desktop.agentContact.resumeRecording({ ... });
Desktop.agentContact.addEventListener("eAgentContact", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentContactAssigned", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentContactEnded", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentContactWrappedUp", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentOfferContact", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentOfferContactRona", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentOfferConsult", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentWrapup", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentContactHeld", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentContactUnHeld", msg => console.log(msg));
Desktop.agentContact.addEventListener("eCallRecordingStarted", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentConsultCreated", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentConsultConferenced", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentConsultEnded", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentCtqCancelled", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentConsulting", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentConsultFailed", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentConsultEndFailed", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentCtqFailed", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentCtqCancelFailed", msg => console.log(msg));
Desktop.agentContact.addEventListener("eAgentConsultConferenceEndFailed", msg => console.log(msg));
const listener = msg => console.log(msg);
Desktop.agentContact.addEventListener("eAgentContact", listener);
Desktop.agentContact.removeEventListener("eAgentContact", listener);
Desktop.agentContact.addOnceEventListener("eAgentContact", listener);
Desktop.agentContact.removeOnceEventListener("eAgentContact", listener);
Desktop.agentContact.removeAllEventListeners();
Desktop.agentStateInfo sub-module
Desktop.agentStateInfo sub-module is intended to listen for latest data updates for data:
type LatestInfoData = {
teamId?: string;
teamName?: string;
dn?: string;
status?: string;
subStatus?: string;
idleCodes?: Service.Aqm.Configs.Entity[];
wrapupCodes?: Service.Aqm.Configs.Entity[];
outDialRegex?: string;
isOutboundEnabledForTenant?: boolean;
isOutboundEnabledForAgent?: boolean;
};
import { Desktop } from "@wxcc-desktop/sdk";
const latestData: LatestInfoData = Desktop.agentStateInfo.latestData;
Desktop.agentStateInfo.addEventListener("updated", updatedList =>
console.log(updatedList)
);
await Desktop.agentStateInfo.stateChange({ ... });
await Desktop.agentStateInfo.fetchAddressBooks({ ... });
Desktop.dialer sub-module
Desktop.dialer sub-module is intended to make aqm requests and listen to notifs events related to dialer entity.
import { Desktop } from "@wxcc-desktop/sdk";
await Desktop.dialer.startOutdial({ ... });
Desktop.dialer.addEventListener("eOutdialFailed", msg => console.log(msg));
const listener = msg => console.log(msg);
Desktop.dialer.addEventListener("eOutdialFailed", listener);
Desktop.dialer.removeEventListener("eOutdialFailed", listener);
Desktop.dialer.addOnceEventListener("eOutdialFailed", listener);
Desktop.dialer.removeOnceEventListener("eOutdialFailed", listener);
Desktop.dialer.removeAllEventListeners();
Desktop.screenpop sub-module
Desktop.screenpop sub-module is intended to make aqm requests and listen to notifs events related to screenpop entity.
import { Desktop } from "@wxcc-desktop/sdk";
Desktop.screenpop.addEventListener("eScreenPop", msg => console.log(msg));
const listener = msg => console.log(msg);
Desktop.screenpop.addEventListener("eScreenPop", listener);
Desktop.screenpop.removeEventListener("eScreenPop", listener);
Desktop.screenpop.addOnceEventListener("eScreenPop", listener);
Desktop.screenpop.removeOnceEventListener("eScreenPop", listener);
Desktop.screenpop.removeAllEventListeners();
Publishing the wxcc-desktop/js-api
For publishing internally to Internal Cisco Repository: yarn npm:publish:internal
For publishing to both Internal and public Repo : yarn publish:external
publish:all responsible for publishing in both first internal repository and then to the external public repository npmjs