From 77b598e3afbe1b13ab9ec8dd88b0604b586365c4 Mon Sep 17 00:00:00 2001 From: Raith Munro Date: Wed, 2 Jul 2025 11:53:28 +0100 Subject: [PATCH 01/13] Add missing AudioDevice class --- src/main/types.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/types.js b/src/main/types.js index 3eb00fd..508e9c2 100644 --- a/src/main/types.js +++ b/src/main/types.js @@ -182,6 +182,26 @@ export class CustomError extends Error { } } +/** + * Class representing an AudioDevice type + */ +export class AudioDevice { + /** + * Create AudioDevice + * @param {object} param + * @param {string} [param.deviceId] + * @param {string} [param.kind] + * @param {string} [param.label] + * @param {string} [param.groupId] + */ + constructor({ deviceId, kind, label, groupId }) { + this.deviceId = deviceId + this.kind = kind + this.label = label + this.groupId = groupId + } +} + /** * Class representing a Hid Device */ From abfe5e98e994594cf18bab65563fcd91c8d171f5 Mon Sep 17 00:00:00 2001 From: Raith Munro Date: Wed, 2 Jul 2025 11:54:21 +0100 Subject: [PATCH 02/13] Fix setAgentStatus param types --- src/main/types.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/types.js b/src/main/types.js index 508e9c2..83ed8a8 100644 --- a/src/main/types.js +++ b/src/main/types.js @@ -1303,8 +1303,8 @@ export class VendorConnector { /** * Set agent status - * @param {Constants.AGENT_STATUS} agentStatus - * @param {StatusInfo} statusInfo + * @param {string} agentStatus + * @param {AgentStatusInfo} statusInfo * @param {Boolean} enqueueNextState - flag to determine if this status change request should be enqueued if neccessary * @returns {Promise} * From a6f683e2b5f6d1de4d7e11e088d920e2ed81814a Mon Sep 17 00:00:00 2001 From: Raith Munro Date: Wed, 2 Jul 2025 11:54:49 +0100 Subject: [PATCH 03/13] Fix getAudioDevices return type --- src/main/types.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/types.js b/src/main/types.js index 83ed8a8..8e47731 100644 --- a/src/main/types.js +++ b/src/main/types.js @@ -1367,6 +1367,7 @@ export class VendorConnector { /** * Returns a list of valid device IDs that can be used for the speaker and microphone devices. + * @returns {Promise} */ getAudioDevices() { throw new Error('Not implemented'); From 3e9dad5744a12ca4ae0e7dc41c3fa9a074ecb18f Mon Sep 17 00:00:00 2001 From: Raith Munro Date: Wed, 2 Jul 2025 11:55:23 +0100 Subject: [PATCH 04/13] Format --- src/main/types.js | 135 +++++++++++++++++++++++----------------------- 1 file changed, 69 insertions(+), 66 deletions(-) diff --git a/src/main/types.js b/src/main/types.js index 8e47731..744c06f 100644 --- a/src/main/types.js +++ b/src/main/types.js @@ -38,7 +38,7 @@ export const Constants = { RECORDING_TOGGLE: constants.VOICE_EVENT_TYPE.RECORDING_TOGGLE, PARTICIPANTS_SWAPPED: constants.VOICE_EVENT_TYPE.PARTICIPANTS_SWAPPED, PARTICIPANTS_CONFERENCED: constants.VOICE_EVENT_TYPE.PARTICIPANTS_CONFERENCED, - PARTICIPANT_ADDED: constants.VOICE_EVENT_TYPE.PARTICIPANT_ADDED, + PARTICIPANT_ADDED: constants.VOICE_EVENT_TYPE.PARTICIPANT_ADDED, PARTICIPANT_CONNECTED: constants.VOICE_EVENT_TYPE.PARTICIPANT_CONNECTED, PARTICIPANT_REMOVED: constants.VOICE_EVENT_TYPE.PARTICIPANT_REMOVED, AFTER_CALL_WORK_STARTED: constants.VOICE_EVENT_TYPE.AFTER_CALL_WORK_STARTED, @@ -48,9 +48,9 @@ export const Constants = { UPDATE_AUDIO_STATS: constants.VOICE_EVENT_TYPE.UPDATE_AUDIO_STATS, CALL_BARGED_IN: constants.VOICE_EVENT_TYPE.CALL_BARGED_IN, SUPERVISOR_BARGED_IN: constants.VOICE_EVENT_TYPE.SUPERVISOR_BARGED_IN, - SUPERVISOR_CALL_STARTED : constants.VOICE_EVENT_TYPE.SUPERVISOR_CALL_STARTED, + SUPERVISOR_CALL_STARTED: constants.VOICE_EVENT_TYPE.SUPERVISOR_CALL_STARTED, SUPERVISOR_CALL_CONNECTED: constants.VOICE_EVENT_TYPE.SUPERVISOR_CALL_CONNECTED, - SUPERVISOR_HANGUP : constants.VOICE_EVENT_TYPE.SUPERVISOR_HANGUP, + SUPERVISOR_HANGUP: constants.VOICE_EVENT_TYPE.SUPERVISOR_HANGUP, SHOW_TRANSFER_VIEW: constants.VOICE_EVENT_TYPE.SHOW_TRANSFER_VIEW, AUDIO_STATS: constants.VOICE_EVENT_TYPE.AUDIO_STATS, CALL_UPDATED: constants.VOICE_EVENT_TYPE.CALL_UPDATED @@ -165,16 +165,16 @@ export class CustomError extends Error { /** * Class representing a Phone type */ - export class Phone { +export class Phone { /** * Create Phone * @param {object} param * @param {PHONE_TYPE} param.type * @param {string} [param.number] */ - constructor({ type, number}) { + constructor({ type, number }) { Validator.validateEnum(type, Object.values(constants.PHONE_TYPE)); - if(number) { + if (number) { Validator.validateString(number); } this.type = type; @@ -211,17 +211,17 @@ export class HidDevice { * @param productId * @param vendorId */ - constructor({ productId, vendorId }) { - if (productId) { - Validator.validateNumber(productId); - } - if (vendorId) { - Validator.validateNumber(vendorId); - } - - this.productId = productId; - this.vendorId = vendorId; - } + constructor({ productId, vendorId }) { + if (productId) { + Validator.validateNumber(productId); + } + if (vendorId) { + Validator.validateNumber(vendorId); + } + + this.productId = productId; + this.vendorId = vendorId; + } } /** @@ -300,7 +300,7 @@ export class SharedCapabilitiesResult { hasPendingStatusChange = false, hasSFDCPendingState = false, hasAutoAcceptEnabled = false - }){ + }) { Validator.validateBoolean(debugEnabled); Validator.validateBoolean(hasContactSearch); Validator.validateBoolean(hasAgentAvailability); @@ -362,7 +362,7 @@ export class VoiceCapabilitiesResult { hasSetExternalSpeakerDeviceSetting = false, hasGetExternalMicrophoneDeviceSetting = false, hasSetExternalMicrophoneDeviceSetting = false, - canConsult= false, + canConsult = false, isDialPadDisabled = false, isHidSupported = false, isPhoneBookDisabled = false @@ -419,8 +419,8 @@ export class AgentConfigResult { * @param {string} param.speakerDeviceId * @param {string} param.microphoneDeviceId */ - constructor({ phones = [constants.PHONE_TYPE.SOFT_PHONE], selectedPhone = new Phone({type: constants.PHONE_TYPE.SOFT_PHONE}), - speakerDeviceId = '', microphoneDeviceId = ''}) { + constructor({ phones = [constants.PHONE_TYPE.SOFT_PHONE], selectedPhone = new Phone({ type: constants.PHONE_TYPE.SOFT_PHONE }), + speakerDeviceId = '', microphoneDeviceId = '' }) { Validator.validateClassObject(phones, Array); Validator.validateClassObject(selectedPhone, Phone); Validator.validateString(speakerDeviceId); @@ -445,7 +445,7 @@ export class AgentConfig { * @param {string} param.microphoneDeviceId * @param {HidDevice} param.hidDeviceInfo */ - constructor({ selectedPhone,speakerDeviceId, microphoneDeviceId, hidDeviceInfo }) { + constructor({ selectedPhone, speakerDeviceId, microphoneDeviceId, hidDeviceInfo }) { Validator.validateClassObject(selectedPhone, Phone); //Hid device info is optional if (hidDeviceInfo !== undefined) { @@ -509,12 +509,12 @@ export class ParticipantResult { * Class representing result type for getContacts() */ export class ContactsResult { - /** - * Create ContactsResult - * @param {object} param - * @param {Contact[]} [param.contacts] - * @param {Array} [param.contactTypes] - */ + /** + * Create ContactsResult + * @param {object} param + * @param {Contact[]} [param.contacts] + * @param {Array} [param.contactTypes] + */ constructor({ contacts = [], contactTypes = [] }) { if (contacts.length > 0) { contacts.forEach(contact => { @@ -598,7 +598,7 @@ export class HoldToggleResult { * @param {PhoneCall[]} [param.calls] * @param {boolean} param.isCallMerged */ - constructor({ isThirdPartyOnHold, isCustomerOnHold, calls , isCallMerged}) { + constructor({ isThirdPartyOnHold, isCustomerOnHold, calls, isCallMerged }) { if (calls) { Object.values(calls).forEach(call => { Validator.validateClassObject(call, PhoneCall); @@ -614,7 +614,7 @@ export class HoldToggleResult { /** * Class representing result type for getRecordingUrl */ - export class SignedRecordingUrlResult { +export class SignedRecordingUrlResult { /** * Create SignedRecordingUrlResult * @param {object} param @@ -665,6 +665,7 @@ export class InitResult { export class DialOptions { /** * Create DialOptions + * @param {object} param * @param {boolean} [param.isCallback] * @param {boolean} [param.isConsultCall] */ @@ -695,12 +696,14 @@ export class SetAgentConfigResult extends GenericResult { /** * Create AgentConfig * @param {object} param + * @param {boolean} [param.success] + * @param {boolean} [param.isSystemEvent] */ constructor({ success, isSystemEvent = false }) { super({ success }); this.isSystemEvent = isSystemEvent; } - + setIsSystemEvent(isSystemEvent) { this.isSystemEvent = isSystemEvent; } @@ -709,7 +712,7 @@ export class SetAgentConfigResult extends GenericResult { /** * Class representing logout result type */ - export class LogoutResult { +export class LogoutResult { /** * Create LogoutResult * @param {object} param @@ -763,9 +766,9 @@ export class CallInfo { * @param {boolean} [param.endCallDisabled] * @param {string} [param.renderContactId] */ - constructor({ callStateTimestamp = null, isOnHold, isMuted = false, isRecordingPaused = false, initialCallId, queueId = null, queueName = null, queueTimestamp = null, isSoftphoneCall = true, + constructor({ callStateTimestamp = null, isOnHold, isMuted = false, isRecordingPaused = false, initialCallId, queueId = null, queueName = null, queueTimestamp = null, isSoftphoneCall = true, acceptEnabled = true, declineEnabled = true, muteEnabled = true, swapEnabled = true, conferenceEnabled = true, holdEnabled = true, - recordEnabled = true, addCallerEnabled = true, extensionEnabled = true, isReplayable = true, isBargeable = false, isExternalTransfer, + recordEnabled = true, addCallerEnabled = true, extensionEnabled = true, isReplayable = true, isBargeable = false, isExternalTransfer, showMuteButton = true, showRecordButton = true, showAddCallerButton = true, showAddBlindTransferButton = true, showMergeButton = true, showSwapButton = true, removeParticipantVariant = Constants.REMOVE_PARTICIPANT_VARIANT.ALWAYS, additionalFields = null, isMultiParty = false, isHIDCall = false, endCallDisabled = false, renderContactId = null }) { @@ -873,7 +876,7 @@ export class Contact { * @param {string} [param.description] - Contact Description * @param {string} [param.queueWaitTime] - Estimated Queue Wait Time */ - constructor({phoneNumber, id, type, name, listType, prefix, extension, endpointARN, queue, availability, recordId, description, queueWaitTime}) { + constructor({ phoneNumber, id, type, name, listType, prefix, extension, endpointARN, queue, availability, recordId, description, queueWaitTime }) { if (phoneNumber) { Validator.validateString(phoneNumber); } @@ -963,7 +966,7 @@ export class PhoneCallAttributes { Validator.validateEnum(dialerType, Object.values(constants.DIALER_TYPE)); Validator.validateBoolean(isAutoMergeOn); Validator.validateBoolean(isConsultCall); - + this.voiceCallId = voiceCallId; this.participantType = participantType; this.parentId = parentId; @@ -996,7 +999,7 @@ export class PhoneCall { * @param {string} [param.agentStatus] * @param {string} [param.agentARN] */ - constructor({callId, callType, callSubtype, contact, state, callAttributes, phoneNumber, callInfo, reason, closeCallOnError, agentStatus, agentARN }) { + constructor({ callId, callType, callSubtype, contact, state, callAttributes, phoneNumber, callInfo, reason, closeCallOnError, agentStatus, agentARN }) { // TODO: Revisit the required fields if (callId) { Validator.validateString(callId); @@ -1318,8 +1321,8 @@ export class VendorConnector { * @returns {Promise} * */ - getAgentStatus() { - this.logMessageToVendor(constants.LOG_LEVEL.INFO, 'getAgentStatus API is NOT Implemented' ); + getAgentStatus() { + this.logMessageToVendor(constants.LOG_LEVEL.INFO, 'getAgentStatus API is NOT Implemented'); } /** @@ -1353,7 +1356,7 @@ export class VendorConnector { * @param {String} message Message to be logged * @param {Object} payload An optional payload to be logged */ - logMessageToVendor(logLevel, message, payload) {} + logMessageToVendor(logLevel, message, payload) { } /** * To get the Contacts for this workItem's transfer/other channel operation @@ -1405,7 +1408,7 @@ export class Validator { } static validateEnum(value, enumValues) { - const regex = new RegExp(enumValues.join( "|" ), "i"); + const regex = new RegExp(enumValues.join("|"), "i"); if (!regex.test(value)) { throw new Error(`Invalid argument. Expecting a value from ${JSON.stringify(enumValues)} but got ${value}`); } @@ -1425,7 +1428,7 @@ export class Validator { } return this; } - + static validateClassObjects(object, ...classNames) { let isValid = false; for (let i = 0; i < classNames.length; i++) { @@ -1433,7 +1436,7 @@ export class Validator { this.validateClassObject(object, classNames[i]); isValid = true; break; - } catch(e) { + } catch (e) { // continue on } } @@ -1461,7 +1464,7 @@ export class AgentWork { this.workItemId = workItemId; this.workId = workId; } - } +} /** * Class representing an Agent status information. This object is used to represent @@ -1476,7 +1479,7 @@ export class AgentStatusInfo { * @param {string} [param.statusApiName] - The status API name * @param {string} [param.statusName] - The label for this status to be displayed in the UI */ - constructor({statusId, statusApiName, statusName}) { + constructor({ statusId, statusApiName, statusName }) { Validator.validateString(statusId); if (statusApiName) { Validator.validateString(statusApiName); @@ -1502,7 +1505,7 @@ export class AgentVendorStatusInfo { * @param {string} [param.statusType] - The agent's current availability state type * @param {string} [param.statusName] - The name of the agent's current availability state */ - constructor({statusId, statusType, statusName}) { + constructor({ statusId, statusType, statusName }) { if (statusId) { Validator.validateString(statusId); } @@ -1523,14 +1526,14 @@ export class AgentVendorStatusInfo { * Class representing an State Change Result information. This object is used to represent * Agent State Change Infomation */ - export class StateChangeResult { +export class StateChangeResult { /** * Create a StateChangeResult. * @param {object} param * @param {AgentVendorStatusInfo} [param.newVendorStateInfo] - newStateName (e.g 'Available') (required), newStateType (e.g 'routable') * @param {AgentVendorStatusInfo} [param.oldVendorStateInfo] - oldStateName (e.g 'offline'), oldStateType (e.g 'Offline') */ - constructor({newVendorStateInfo, oldVendorStateInfo}) { + constructor({ newVendorStateInfo, oldVendorStateInfo }) { Validator.validateClassObject(newVendorStateInfo, AgentVendorStatusInfo); Validator.validateString(newVendorStateInfo.statusName); if (oldVendorStateInfo) { @@ -1558,7 +1561,7 @@ export class SupervisedCallInfo { * @param {boolean} [param.isBargedIn] - True if the Supervisor has barged in, False if the supervisor is listening in. */ - constructor({callId, voiceCallId, callType, from, to, supervisorName, isBargedIn}) { + constructor({ callId, voiceCallId, callType, from, to, supervisorName, isBargedIn }) { Validator.validateString(callId); this.callId = callId; this.voiceCallId = voiceCallId; @@ -1612,14 +1615,14 @@ export class AudioStatsElement { * @param {StatsInfo} [param.inputChannelStats] - the inputChannel stream stats * @param {StatsInfo} [param.outputChannelStats] - the ouputChannel stream stats */ - constructor({inputChannelStats, outputChannelStats}) { + constructor({ inputChannelStats, outputChannelStats }) { if (inputChannelStats) { Validator.validateClassObject(inputChannelStats, StatsInfo); } if (outputChannelStats) { Validator.validateClassObject(outputChannelStats, StatsInfo); } - + this.inputChannelStats = inputChannelStats; this.outputChannelStats = outputChannelStats; } @@ -1638,7 +1641,7 @@ export class StatsInfo { * @param {number} [param.jitterBufferMillis] - jitter buffer in milliseconds * @param {number} [param.roundTripTimeMillis] - round trip time in milliseconds */ - constructor({packetsCount, packetsLost, jitterBufferMillis, roundTripTimeMillis}) { + constructor({ packetsCount, packetsLost, jitterBufferMillis, roundTripTimeMillis }) { packetsCount = (packetsCount == null || packetsCount < 0) ? 0 : packetsCount; packetsLost = (packetsLost == null || packetsLost < 0) ? 0 : packetsLost; jitterBufferMillis = (jitterBufferMillis == null || jitterBufferMillis < 0) ? 0 : jitterBufferMillis; @@ -1655,13 +1658,13 @@ export class StatsInfo { /** * Class representing supervise call result */ - export class SuperviseCallResult { +export class SuperviseCallResult { /** * Create a SuperviseCallResult * @param {object} param * @param {PhoneCall} param.call */ - constructor({call}) { + constructor({ call }) { Validator.validateClassObject(call, PhoneCall); this.call = call; } @@ -1670,16 +1673,16 @@ export class StatsInfo { /** * Class representing result type for supervisorDisconnected() */ - export class SupervisorHangupResult extends HangupResult { - /** - * Create SupervisorHangupResult - * @param {object} param - * @param {PhoneCall[]|PhoneCall} param.calls - one or more calls when supervisor hangsup - */ +export class SupervisorHangupResult extends HangupResult { + /** + * Create SupervisorHangupResult + * @param {object} param + * @param {PhoneCall[]|PhoneCall} param.calls - one or more calls when supervisor hangsup + */ constructor({ calls }) { super({ calls }); } - } +} /** * Class representing result type for STORAGE_ACCESS_RESULT @@ -1689,7 +1692,7 @@ export class StatsInfo { * @param {number} [param.loginFrameHeight] */ export class ShowStorageAccessResult { - constructor({success= false, showLogin = false, loginFrameHeight = 350 }) { + constructor({ success = false, showLogin = false, loginFrameHeight = 350 }) { this.success = success; this.showLogin = showLogin; this.loginFrameHeight = loginFrameHeight; @@ -1703,17 +1706,17 @@ export class ShowStorageAccessResult { * @param {number} param.limit * @param {number} param.offset * @param {CONTACTS_FILTER_TYPES[]} param.types - */ + */ export class ContactsFilter { constructor(param) { if (param) { - const {contains = null, limit = 50, offset = 0, types = []} = param; + const { contains = null, limit = 50, offset = 0, types = [] } = param; if (contains) { Validator.validateString(contains); } Validator.validateNumber(limit); Validator.validateNumber(offset); - for (const type of types){ + for (const type of types) { Validator.validateEnum(types, Object.values(constants.CONTACTS_FILTER_TYPES)); } this.contains = contains; @@ -1733,7 +1736,7 @@ export class ACWInfo { * @param {string} param.agentWorkId the id of the AgentWork * @param {string} param.workItemId the id of the work item (voice call or messaging session) */ - constructor({agentWorkId, workItemId}) { + constructor({ agentWorkId, workItemId }) { if (agentWorkId) { Validator.validateString(agentWorkId); this.agentWorkId = agentWorkId; From 0f7d20460c2fe58e3e3bcfc334a2c29512f5b3ce Mon Sep 17 00:00:00 2001 From: Raith Munro Date: Mon, 7 Jul 2025 17:43:09 +0100 Subject: [PATCH 05/13] Freeze constants to ensure TS infers their values rather than type string --- src/main/constants.js | 116 +++++++++++++++++++++--------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/src/main/constants.js b/src/main/constants.js index 966ac7f..b902d6c 100644 --- a/src/main/constants.js +++ b/src/main/constants.js @@ -5,8 +5,8 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -export default { - SHARED_MESSAGE_TYPE: { +export default Object.freeze({ + SHARED_MESSAGE_TYPE: Object.freeze({ // Telephony Message Types: sent from SFDC to Telephony Vendor // Framework Message Types SETUP_CONNECTOR: 'SETUP_CONNECTOR', @@ -20,8 +20,8 @@ export default { DOWNLOAD_VENDOR_LOGS: 'DOWNLOAD_VENDOR_LOGS', AGENT_WORK_EVENT: 'AGENT_WORK_EVENT', GET_CONTACTS: 'GET_CONTACTS' - }, - VOICE_MESSAGE_TYPE: { + }), + VOICE_MESSAGE_TYPE: Object.freeze({ ACCEPT_CALL: 'ACCEPT_CALL', DECLINE_CALL: 'DECLINE_CALL', END_CALL: 'END_CALL', @@ -45,8 +45,8 @@ export default { WRAP_UP_CALL: 'WRAP_UP_CALL', AGENT_AVAILABLE: 'AGENT_AVAILABLE', GET_AUDIO_DEVICES: 'GET_AUDIO_DEVICES' - }, - SHARED_EVENT_TYPE: { + }), + SHARED_EVENT_TYPE: Object.freeze({ ERROR: 'ERROR', WARNING: 'WARNING', INFO: 'INFO', @@ -66,8 +66,8 @@ export default { GET_CONTACTS_RESULT: 'GET_CONTACTS_RESULT', AFTER_CONVERSATION_WORK_STARTED: 'AFTER_CONVERSATION_WORK_STARTED', AFTER_CONVERSATION_WORK_ENDED: 'AFTER_CONVERSATION_WORK_ENDED' - }, - VOICE_EVENT_TYPE: { + }), + VOICE_EVENT_TYPE: Object.freeze({ QUEUED_CALL_STARTED: 'QUEUED_CALL_STARTED', CALL_STARTED: 'CALL_STARTED', CALL_CONNECTED: 'CALL_CONNECTED', @@ -99,11 +99,11 @@ export default { GET_AUDIO_DEVICES: 'GET_AUDIO_DEVICES', AUDIO_STATS: 'AUDIO_STATS', CALL_UPDATED: 'CALL_UPDATED' //sent during a call to update call controls - }, - INFO_TYPE: { + }), + INFO_TYPE: Object.freeze({ CAN_NOT_ACCEPT_THE_CALL: 'CAN_NOT_ACCEPT_THE_CALL' - }, - SHARED_ERROR_TYPE: { + }), + SHARED_ERROR_TYPE: Object.freeze({ CUSTOM_ERROR: 'CUSTOM_ERROR', GENERIC_ERROR: 'GENERIC_ERROR', AUTHENTICATION_ERROR: 'AUTHENTICATION_ERROR', @@ -116,8 +116,8 @@ export default { INVALID_STATE_CHANGE_RESULT: 'INVALID_STATE_CHANGE_RESULT', INVALID_STORAGE_ACCESS_RESULT: 'INVALID_STORAGE_ACCESS_RESULT', INVALID_ACW_INFO: 'INVALID_ACW_INFO' - }, - VOICE_ERROR_TYPE: { + }), + VOICE_ERROR_TYPE: Object.freeze({ CAN_NOT_DECLINE_THE_CALL: 'CAN_NOT_DECLINE_THE_CALL', CAN_NOT_END_THE_CALL: 'CAN_NOT_END_THE_CALL', CAN_NOT_HOLD_CALL: 'CAN_NOT_HOLD_CALL', @@ -155,19 +155,19 @@ export default { WEBRTC_ERROR: 'WEBRTC_ERROR', CAN_NOT_GET_AUDIO_DEVICES: 'CAN_NOT_GET_AUDIO_DEVICES', CAN_NOT_UPDATE_CALL: 'CAN_NOT_UPDATE_CALL' - }, - AGENT_STATUS: { + }), + AGENT_STATUS: Object.freeze({ ONLINE: 'Online', OFFLINE: 'Offline', ACW : 'AfterCallWork' - }, - PARTICIPANT_TYPE: { + }), + PARTICIPANT_TYPE: Object.freeze({ AGENT: 'Agent', INITIAL_CALLER: 'Initial_Caller', THIRD_PARTY: 'Third_Party', SUPERVISOR: 'Supervisor' - }, - CALL_TYPE: { + }), + CALL_TYPE: Object.freeze({ INBOUND: 'Inbound', OUTBOUND: 'Outbound', CALLBACK: 'Callback', @@ -176,33 +176,33 @@ export default { INTERNAL_CALL: 'InternalCall', DIALED_CALLBACK: 'DialedCallback', CONSULT: 'Consult' - }, - CALL_SUBTYPE: { + }), + CALL_SUBTYPE: Object.freeze({ PSTN: 'PSTN', WEB_RTC: 'WebRTC' - }, - DIALER_TYPE: { + }), + DIALER_TYPE: Object.freeze({ OUTBOUND_PREVIEW: 'OutboundPreview', NONE: 'None' - }, - CONTACT_TYPE: { + }), + CONTACT_TYPE: Object.freeze({ PHONEBOOK: 'PhoneBook', QUEUE: 'Queue', PHONENUMBER: 'PhoneNumber', AGENT: 'Agent', FLOW: 'Flow' - }, - CONTACT_LIST_TYPE: { + }), + CONTACT_LIST_TYPE: Object.freeze({ TRANSFER: 'Transfer', CONFERENCE: 'Conference', ALL: 'All' - }, - AGENT_CONFIG_TYPE: { + }), + AGENT_CONFIG_TYPE: Object.freeze({ SHOW_AGENT_SETTINGS: 'SHOW_AGENT_SETTINGS', PHONES: 'PHONES', SELECTED_PHONE: 'SELECTED_PHONE' - }, - SHARED_CAPABILITIES_TYPE: { + }), + SHARED_CAPABILITIES_TYPE: Object.freeze({ DEBUG_ENABLED: 'DEBUG_ENABLED', CONTACT_SEARCH: 'CONTACT_SEARCH', VENDOR_PROVIDED_AVAILABILITY: 'VENDOR_PROVIDED_AVAILABILITY', @@ -211,8 +211,8 @@ export default { PENDING_STATUS_CHANGE: 'PENDING_STATUS_CHANGE', SFDC_PENDING_STATE: 'SFDC_PENDING_STATE', AUTO_ACCEPT_ENABLED:'AUTO_ACCEPT_ENABLED' - }, - VOICE_CAPABILITIES_TYPE: { + }), + VOICE_CAPABILITIES_TYPE: Object.freeze({ MUTE: 'MUTE', RECORD: 'RECORD', MERGE: 'MERGE', @@ -231,49 +231,49 @@ export default { DIAL_PAD: 'DIAL_PAD', HAS_HID_SUPPORT: 'HAS_HID_SUPPORT', PHONEBOOK_DISABLE: 'PHONEBOOK_DISABLE' - }, - CALL_STATE: { + }), + CALL_STATE: Object.freeze({ RINGING: 'ringing', CONNECTED: 'connected', TRANSFERRING: 'transferring', TRANSFERRED: 'transferred', ENDED: 'ended' - }, - PHONE_TYPE: { + }), + PHONE_TYPE: Object.freeze({ DESK_PHONE: 'DESK_PHONE', SOFT_PHONE: 'SOFT_PHONE' - }, - HANGUP_REASON: { + }), + HANGUP_REASON: Object.freeze({ PHONE_CALL_ERROR: "error", PHONE_CALL_ENDED: "ended" - }, - AGENT_AVAILABILITY: { + }), + AGENT_AVAILABILITY: Object.freeze({ AVAILABLE: "AVAILABLE", BUSY: "BUSY", OFFLINE: "OFFLINE" - }, - REMOVE_PARTICIPANT_VARIANT: { + }), + REMOVE_PARTICIPANT_VARIANT: Object.freeze({ ALWAYS : 'ALWAYS', NEVER: 'NEVER', ALWAYS_EXCEPT_ON_HOLD: 'ALWAYS_EXCEPT_ON_HOLD' - }, - LOG_LEVEL: { + }), + LOG_LEVEL: Object.freeze({ ERROR: "ERROR", INFO: "INFO" - }, - LOG_SOURCE: { + }), + LOG_SOURCE: Object.freeze({ SYSTEM: "SYSTEM", PARTNER: "PARTNER" - }, - CONTACTS_FILTER_TYPES: { + }), + CONTACTS_FILTER_TYPES: Object.freeze({ AGENT: "AGENT", QUEUE: "QUEUE", CONTACT: "CONTACT", DIRECTORY: "DIRECTORY", FLOW: "FLOW", AVAILABLE: "AVAILABLE" - }, - WORK_EVENT: { + }), + WORK_EVENT: Object.freeze({ ASSIGNED: 'ASSIGNED', ACCEPTED: 'ACCEPTED', DECLINED: 'DECLINED', @@ -281,19 +281,19 @@ export default { CLOSED: 'CLOSED', PAUSED: 'PAUSED', UNPAUSED: 'UNPAUSED' - }, - DIAL_OPTIONS: { + }), + DIAL_OPTIONS: Object.freeze({ CALLBACK: "isCallback=true", CONSULT: "isConsultCall" - }, - HANGUP_STATUS: { + }), + HANGUP_STATUS: Object.freeze({ MISSED_AGENT: "MissedCallAgent", DECLINED: "DeclinedByAgent", FAILED_CONNECT_AGENT: "FailedConnectAgent", FAILED_CONNECT_CUSTOMER: "FailedConnectCustomer", CALLBACK_MISSED_OR_REJECTED: 'CallbackMissedOrRejected' // Used only for Amazon; workaround for https://github.com/amazon-connect/amazon-connect-streams/issues/344 - } -}; + }) +}); /** * Fields in the connector configuration that are logged. From f0ffbf14e451aa016b654e63fe5e35ac21dbee50 Mon Sep 17 00:00:00 2001 From: Raith Munro Date: Wed, 9 Jul 2025 15:29:44 +0100 Subject: [PATCH 06/13] Fix broken generic type syntax --- src/main/types.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/types.js b/src/main/types.js index 744c06f..c0e67d2 100644 --- a/src/main/types.js +++ b/src/main/types.js @@ -1247,7 +1247,7 @@ export class TelephonyConnector { /** * Supervise a call * @param {SupervisedCallInfo} supervisedCallInfo CallInfo of the call to be supervised - * @returns {Promise } + * @returns {Promise} */ superviseCall(supervisedCallInfo) { throw new Error('Not implemented'); @@ -1256,7 +1256,7 @@ export class TelephonyConnector { /** * Supervisor disconnects from a call * @param {SupervisedCallInfo} supervisedCallInfo CallInfo of the supervised call to be disconnected - * @returns {Promise } + * @returns {Promise} */ supervisorDisconnect(supervisedCallInfo) { throw new Error('Not implemented'); @@ -1265,7 +1265,7 @@ export class TelephonyConnector { /** * Supervisor Barges into a ongoing call * @param {SupervisedCallInfo} supervisedCallInfo CallInfo of the supervised call which supervisor barges in - * @returns {Promise } + * @returns {Promise} */ supervisorBargeIn(supervisedCallInfo) { throw new Error('Not implemented'); From abd9410921bfeed819886ee401a328d10fa6503e Mon Sep 17 00:00:00 2001 From: Raith Munro Date: Thu, 10 Jul 2025 08:26:42 +0100 Subject: [PATCH 07/13] Fix? REMOVE_PARTICIPANT_VARIANT constant We believe this should be 'ALWAYS_EXCEPT_WHEN_ON_HOLD' --- src/main/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/constants.js b/src/main/constants.js index b902d6c..64a6d2b 100644 --- a/src/main/constants.js +++ b/src/main/constants.js @@ -255,7 +255,7 @@ export default Object.freeze({ REMOVE_PARTICIPANT_VARIANT: Object.freeze({ ALWAYS : 'ALWAYS', NEVER: 'NEVER', - ALWAYS_EXCEPT_ON_HOLD: 'ALWAYS_EXCEPT_ON_HOLD' + ALWAYS_EXCEPT_WHEN_ON_HOLD: 'ALWAYS_EXCEPT_WHEN_ON_HOLD' }), LOG_LEVEL: Object.freeze({ ERROR: "ERROR", From 242fcb35109cdf1275659b85f3c6530d03eb672f Mon Sep 17 00:00:00 2001 From: Raith Munro Date: Tue, 8 Jul 2025 09:24:26 +0100 Subject: [PATCH 08/13] Use this TS magic to convey the true types. But beware that this might break SF actual use of JSDoc :( --- src/main/types.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/types.js b/src/main/types.js index c0e67d2..3d1b3a7 100644 --- a/src/main/types.js +++ b/src/main/types.js @@ -987,7 +987,7 @@ export class PhoneCall { * Create a PhoneCall. * @param {object} param * @param {string} [param.callId] - The unique callId. This is a required parameter - * @param {CALL_TYPE} [param.callType] - The type of the call, one of the CALL_TYPE values + * @param {typeof Constants.CALL_TYPE[keyof typeof Constants.CALL_TYPE]} [param.callType] - The type of the call, one of the CALL_TYPE values * @param {CALL_SUBTYPE} [param.callSubtype] - The subtype of the call, one of the CALL_SUBTYPE values * @param {Contact} [param.contact] - The Call Target / Contact * @param {string} [param.state] - The state of the call, i.e. ringing, connected, declined, failed From f1369b7ab1df12cc67159489e4aec056c6758754 Mon Sep 17 00:00:00 2001 From: Raith Munro Date: Tue, 8 Jul 2025 10:08:42 +0100 Subject: [PATCH 09/13] Add constants typing to all the other params where I feel it's suitable --- src/main/types.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/types.js b/src/main/types.js index 3d1b3a7..3058b69 100644 --- a/src/main/types.js +++ b/src/main/types.js @@ -169,7 +169,7 @@ export class Phone { /** * Create Phone * @param {object} param - * @param {PHONE_TYPE} param.type + * @param {typeof Constants.PHONE_TYPE[keyof typeof Constants.PHONE_TYPE]} param.type * @param {string} [param.number] */ constructor({ type, number }) { @@ -513,7 +513,7 @@ export class ContactsResult { * Create ContactsResult * @param {object} param * @param {Contact[]} [param.contacts] - * @param {Array} [param.contactTypes] + * @param {Array} [param.contactTypes] */ constructor({ contacts = [], contactTypes = [] }) { if (contacts.length > 0) { @@ -540,7 +540,7 @@ export class PhoneContactsResult extends ContactsResult { * Create PhoneContactsResult * @param {object} param * @param {Contact[]} [param.contacts] - * @param {Array} [param.contactTypes] + * @param {Array} [param.contactTypes] */ constructor({ contacts = [], contactTypes = [] }) { super({ contacts, contactTypes }); @@ -863,15 +863,15 @@ export class Contact { * Create a Contact. * @param {object} param * @param {string} [param.id] - The unique contactId - * @param {("PhoneBook"|"Queue"|"PhoneNumber"|"Agent")} [param.type] - The type of the contact, one of the CONTACT_TYPE values + * @param {("PhoneBook"|"Queue"|"PhoneNumber"|"Agent")} [param.type] - The type of the contact, one of the CONTACT_TYPE values // NOTE: This does not include FLOW! Intentional? * @param {string} [param.name] - The label for this contact to be displayed in the UI - * @param {("Transfer"|"Conference"|"All")} [param.listType] - The type of contact List, one of the CONTACT_LIST_TYPE values. Messaging Only + * @param {typeof Constants.CONTACT_LIST_TYPE[keyof typeof Constants.CONTACT_LIST_TYPE]} [param.listType] - The type of contact List, one of the CONTACT_LIST_TYPE values. Messaging Only * @param {string} [param.phoneNumber] - The phone number associcated with this contact * @param {string} [param.prefix] - Any prefix to be dialed before dialing the number (i.e. +1) * @param {string} [param.extension] - Any extension to be dialed after dialing the number * @param {string} [param.endpointARN] * @param {string} [param.queue] - * @param {string} [param.availability] + * @param {typeof Constants.AGENT_AVAILABILITY[keyof typeof Constants.AGENT_AVAILABILITY]} [param.availability] * @param {string} [param.recordId] - Salesforce RecordId * @param {string} [param.description] - Contact Description * @param {string} [param.queueWaitTime] - Estimated Queue Wait Time @@ -940,8 +940,8 @@ export class PhoneCallAttributes { * Create PhoneCallAttributes. * @param {object} param * @param {string} [param.voiceCallId] - The voice call id - * @param {PARTICIPANT_TYPE} [param.participantType] - The participant type of the call - * @param {DIALER_TYPE} [param.dialerType] - The dialer type of the call + * @param {typeof Constants.PARTICIPANT_TYPE[keyof typeof Constants.PARTICIPANT_TYPE]} [param.participantType] - The participant type of the call + * @param {typeof Constants.DIALER_TYPE[keyof typeof Constants.DIALER_TYPE]} [param.dialerType] - The dialer type of the call * @param {string} [param.parentId] - The parent call id of the call * @param {boolean} [param.isOnHold] * @param {boolean} [param.hasSupervisorBargedIn] @@ -988,7 +988,7 @@ export class PhoneCall { * @param {object} param * @param {string} [param.callId] - The unique callId. This is a required parameter * @param {typeof Constants.CALL_TYPE[keyof typeof Constants.CALL_TYPE]} [param.callType] - The type of the call, one of the CALL_TYPE values - * @param {CALL_SUBTYPE} [param.callSubtype] - The subtype of the call, one of the CALL_SUBTYPE values + * @param {typeof Constants.CALL_SUBTYPE[keyof typeof Constants.CALL_SUBTYPE]} [param.callSubtype] - The subtype of the call, one of the CALL_SUBTYPE values * @param {Contact} [param.contact] - The Call Target / Contact * @param {string} [param.state] - The state of the call, i.e. ringing, connected, declined, failed * @param {PhoneCallAttributes} [param.callAttributes] - Any additional call attributes @@ -1078,7 +1078,7 @@ export class TelephonyConnector { /** * End call * @param {PhoneCall} call - The call to be ended - * @param {AGENT_STATUS} agentStatus + * @param {typeof Constants.AGENT_STATUS[keyof typeof Constants.AGENT_STATUS]} agentStatus * @returns {Promise} * */ @@ -1352,7 +1352,7 @@ export class VendorConnector { /** * Sends the logs with a logLevel and payload to the vendor connector. * Does a no-op, if not implemented. - * @param {String} logLevel Log Level (INFO, WARN, ERROR) + * @param {typeof Constants.LOG_LEVEL[keyof typeof Constants.LOG_LEVEL]} logLevel Log Level (INFO, WARN, ERROR) // Note: LOG_LEVEL constants does not include "WARN" * @param {String} message Message to be logged * @param {Object} payload An optional payload to be logged */ @@ -1456,7 +1456,7 @@ export class AgentWork { * @param {object} param * @param {string} [param.workItemId] - Salesforce agent work item Id * @param {string} [param.workId] - Salesforce work Id - * @param {WORK_EVENT} [param.workEvent] - The work lifecycle event + * @param {typeof Constants.WORK_EVENT[keyof typeof Constants.WORK_EVENT]} [param.workEvent] - The work lifecycle event */ constructor({ workItemId, workId, workEvent }) { Validator.validateEnum(workEvent, Object.values(constants.WORK_EVENT)); @@ -1554,7 +1554,7 @@ export class SupervisedCallInfo { * @param {object} param * @param {string} [param.callId] - The unique supervised vendor call ID (required) * @param {string} [param.voiceCallId] - The supervised salesforce voice call ID - * @param {string} [param.callType] - The type of the call, one of the CALL_TYPE values + * @param {typeof Constants.CALL_TYPE[keyof typeof Constants.CALL_TYPE]} [param.callType] - The type of the call, one of the CALL_TYPE values * @param {string} [param.from] - From phone number (for Inbound calls) * @param {string} [param.to] - To phone number (for Outbound calls) * @param {string} [param.supervisorName] - The supervisor name (shown to the supervised agent on barge in) @@ -1705,7 +1705,7 @@ export class ShowStorageAccessResult { * @param {string} param.contains * @param {number} param.limit * @param {number} param.offset - * @param {CONTACTS_FILTER_TYPES[]} param.types + * @param {Array} param.types */ export class ContactsFilter { constructor(param) { From d694831951e93f63a850209573b6157cb355bb35 Mon Sep 17 00:00:00 2001 From: Raith Munro Date: Tue, 26 Aug 2025 17:08:03 +0100 Subject: [PATCH 10/13] * Fix types of new SetAgentStateResult class * revisit an earlier fix - Constants.AGENT_STATUS is wrong for setAgentStatus, but so is string! Make it simply AGENT_STATUS (which resolves to string anyway) but is a marker to fix it properly in phase 2 * regenerate types --- src/main/types.js | 8 +- ts-declaration/constants.d.ts | 597 ++++++++++++++++------------------ ts-declaration/index.d.ts | 2 +- ts-declaration/types.d.ts | 287 +++++++++------- 4 files changed, 460 insertions(+), 434 deletions(-) diff --git a/src/main/types.js b/src/main/types.js index 7431663..b15eca4 100644 --- a/src/main/types.js +++ b/src/main/types.js @@ -495,7 +495,7 @@ export class ParticipantResult { * @param {Contact} param.contact * @param {string} param.connectionId - optional connectionID representing a call leg. */ - constructor({ initialCallHasEnded, callInfo, callAttributes, phoneNumber, callId, contact = null , connectionId}) { + constructor({ initialCallHasEnded, callInfo, callAttributes, phoneNumber, callId, contact = null, connectionId }) { Validator.validateClassObject(callInfo, CallInfo); this.initialCallHasEnded = initialCallHasEnded; this.callInfo = callInfo; @@ -702,6 +702,8 @@ export class SetAgentStateResult extends GenericResult { /** * Create AgentState * @param {object} param + * @param {boolean} param.success + * @param {boolean} [param.isStatusSyncNeeded] */ constructor({ success, isStatusSyncNeeded = true }) { super({ success }); @@ -716,7 +718,7 @@ export class SetAgentConfigResult extends GenericResult { /** * Create AgentConfig * @param {object} param - * @param {boolean} [param.success] + * @param {boolean} param.success * @param {boolean} [param.isSystemEvent] */ constructor({ success, isSystemEvent = false }) { @@ -1348,7 +1350,7 @@ export class VendorConnector { /** * Set agent status - * @param {string} agentStatus + * @param {AGENT_STATUS} agentStatus * @param {AgentStatusInfo} statusInfo * @param {Boolean} enqueueNextState - flag to determine if this status change request should be enqueued if neccessary * @returns {Promise} diff --git a/ts-declaration/constants.d.ts b/ts-declaration/constants.d.ts index f779f83..5251b97 100644 --- a/ts-declaration/constants.d.ts +++ b/ts-declaration/constants.d.ts @@ -1,313 +1,290 @@ -declare namespace _default { - namespace SHARED_MESSAGE_TYPE { - const SETUP_CONNECTOR: string; - const CONNECTOR_READY: string; - const LOG: string; - const TELEPHONY_EVENT_DISPATCHED: string; - const SET_AGENT_STATUS: string; - const GET_AGENT_STATUS: string; - const LOGOUT: string; - const MESSAGE: string; - const DOWNLOAD_VENDOR_LOGS: string; - const AGENT_WORK_EVENT: string; - const GET_CONTACTS: string; - } - namespace VOICE_MESSAGE_TYPE { - const ACCEPT_CALL: string; - const DECLINE_CALL: string; - const END_CALL: string; - const MUTE: string; - const UNMUTE: string; - const HOLD: string; - const RESUME: string; - const DIAL: string; - const SEND_DIGITS: string; - const GET_PHONE_CONTACTS: string; - const SWAP_PARTICIPANTS: string; - const ADD_PARTICIPANT: string; - const CONFERENCE: string; - const PAUSE_RECORDING: string; - const RESUME_RECORDING: string; - const SUPERVISE_CALL: string; - const SUPERVISOR_BARGE_IN: string; - const SUPERVISOR_DISCONNECT: string; - const SET_AGENT_CONFIG: string; - const GET_SIGNED_RECORDING_URL: string; - const WRAP_UP_CALL: string; - const AGENT_AVAILABLE: string; - const GET_AUDIO_DEVICES: string; - } - namespace SHARED_EVENT_TYPE { - export const ERROR: string; - export const WARNING: string; - export const INFO: string; - export const LOGIN_STARTED: string; - export const LOGIN_RESULT: string; - export const LOGOUT_RESULT: string; - export const SHOW_LOGIN: string; - export const SET_AGENT_STATUS_RESULT: string; - export const GET_AGENT_STATUS_RESULT: string; - const MESSAGE_1: string; - export { MESSAGE_1 as MESSAGE }; - const SET_AGENT_STATUS_1: string; - export { SET_AGENT_STATUS_1 as SET_AGENT_STATUS }; - const GET_AGENT_STATUS_1: string; - export { GET_AGENT_STATUS_1 as GET_AGENT_STATUS }; - export const STATE_CHANGE: string; - export const REMOTE_CONTROLLER: string; - export const SHOW_STORAGE_ACCESS: string; - export const STORAGE_ACCESS_RESULT: string; - export const GET_CONTACTS_RESULT: string; - export const AFTER_CONVERSATION_WORK_STARTED: string; - export const AFTER_CONVERSATION_WORK_ENDED: string; - } - namespace VOICE_EVENT_TYPE { - export const QUEUED_CALL_STARTED: string; - export const CALL_STARTED: string; - export const CALL_CONNECTED: string; - export const CALL_FAILED: string; - export const MUTE_TOGGLE: string; - export const HOLD_TOGGLE: string; - export const PHONE_CONTACTS: string; - export const PARTICIPANT_ADDED: string; - export const PARTICIPANT_CONNECTED: string; - export const PARTICIPANT_REMOVED: string; - export const RECORDING_TOGGLE: string; - export const PARTICIPANTS_SWAPPED: string; - export const PARTICIPANTS_CONFERENCED: string; - export const SIGNED_RECORDING_URL: string; - export const UPDATE_AUDIO_STATS: string; - export const UPDATE_AUDIO_STATS_COMPLETED: string; - export const SUPERVISOR_BARGED_IN: string; - export const SUPERVISOR_CALL_STARTED: string; - export const SUPERVISOR_CALL_CONNECTED: string; - export const SUPERVISOR_HANGUP: string; - export const CALL_BARGED_IN: string; - export const WRAP_UP_ENDED: string; - export const AFTER_CALL_WORK_STARTED: string; - export const AGENT_CONFIG_UPDATED: string; - export const AGENT_ERROR: string; - export const HANGUP: string; - export const SOFTPHONE_ERROR: string; - export const SHOW_TRANSFER_VIEW: string; - const GET_AUDIO_DEVICES_1: string; - export { GET_AUDIO_DEVICES_1 as GET_AUDIO_DEVICES }; - export const AUDIO_STATS: string; - export const CALL_UPDATED: string; - } - namespace INFO_TYPE { - const CAN_NOT_ACCEPT_THE_CALL: string; - } - namespace SHARED_ERROR_TYPE { - const CUSTOM_ERROR: string; - const GENERIC_ERROR: string; - const AUTHENTICATION_ERROR: string; - const INVALID_AGENT_STATUS: string; - const CAN_NOT_GET_AGENT_STATUS: string; - const CAN_NOT_SET_AGENT_STATUS: string; - const LOGIN_REQUIRED: string; - const CAN_NOT_LOG_IN: string; - const CAN_NOT_LOG_OUT: string; - const INVALID_STATE_CHANGE_RESULT: string; - const INVALID_STORAGE_ACCESS_RESULT: string; - const INVALID_ACW_INFO: string; - } - namespace VOICE_ERROR_TYPE { - export const CAN_NOT_DECLINE_THE_CALL: string; - export const CAN_NOT_END_THE_CALL: string; - export const CAN_NOT_HOLD_CALL: string; - export const CAN_NOT_RESUME_CALL: string; - export const CAN_NOT_MUTE_CALL: string; - export const CAN_NOT_UNMUTE_CALL: string; - export const CAN_NOT_TOGGLE_MUTE: string; - export const CAN_NOT_TOGGLE_HOLD: string; - export const CAN_NOT_TOGGLE_RECORD: string; - export const INVALID_PARTICIPANT: string; - export const INVALID_PARAMS: string; - export const CAN_NOT_GET_PHONE_CONTACTS: string; - export const CAN_NOT_SWAP_PARTICIPANTS: string; - export const CAN_NOT_CONFERENCE: string; - export const INVALID_DESTINATION: string; - export const INVALID_PHONE_NUMBER: string; - export const CAN_NOT_HANGUP_PARTICIPANT: string; - export const CAN_NOT_ADD_PARTICIPANT: string; - export const CAN_NOT_CONNECT_PARTICIPANT: string; - export const CAN_NOT_START_THE_CALL: string; - export const CAN_NOT_PAUSE_RECORDING: string; - export const CAN_NOT_RESUME_RECORDING: string; - export const CAN_NOT_SET_AGENT_CONFIG: string; - export const CAN_NOT_SET_CAPABILITIES: string; - export const CAN_NOT_UPDATE_PHONE_NUMBER: string; - export const CAN_NOT_GET_SIGNED_RECORDING_URL: string; - export const CAN_NOT_SUPERVISE_CALL: string; - export const CAN_NOT_DISCONNECT_SUPERVISOR: string; - export const CAN_NOT_BARGE_IN_SUPERVISOR: string; - export const CAN_NOT_BARGE_IN_CALL: string; - const AGENT_ERROR_1: string; - export { AGENT_ERROR_1 as AGENT_ERROR }; - export const MICROPHONE_NOT_SHARED: string; - export const UNSUPPORTED_BROWSER: string; - export const USER_BUSY_ERROR: string; - export const WEBRTC_ERROR: string; - export const CAN_NOT_GET_AUDIO_DEVICES: string; - export const CAN_NOT_UPDATE_CALL: string; - } - namespace AGENT_STATUS { - const ONLINE: string; - const OFFLINE: string; - const ACW: string; - } - namespace PARTICIPANT_TYPE { - const AGENT: string; - const INITIAL_CALLER: string; - const THIRD_PARTY: string; - const SUPERVISOR: string; - } - namespace CALL_TYPE { - export const INBOUND: string; - export const OUTBOUND: string; - export const CALLBACK: string; - const ADD_PARTICIPANT_1: string; - export { ADD_PARTICIPANT_1 as ADD_PARTICIPANT }; - export const TRANSFER: string; - export const INTERNAL_CALL: string; - export const DIALED_CALLBACK: string; - export const CONSULT: string; - } - namespace CALL_SUBTYPE { - const PSTN: string; - const WEB_RTC: string; - } - namespace DIALER_TYPE { - const OUTBOUND_PREVIEW: string; - const NONE: string; - } - namespace CONTACT_TYPE { - export const PHONEBOOK: string; - export const QUEUE: string; - export const PHONENUMBER: string; - const AGENT_1: string; - export { AGENT_1 as AGENT }; - export const FLOW: string; - } - namespace CONTACT_LIST_TYPE { - const TRANSFER_1: string; - export { TRANSFER_1 as TRANSFER }; - const CONFERENCE_1: string; - export { CONFERENCE_1 as CONFERENCE }; - export const ALL: string; - } - namespace AGENT_CONFIG_TYPE { - const SHOW_AGENT_SETTINGS: string; - const PHONES: string; - const SELECTED_PHONE: string; - } - namespace SHARED_CAPABILITIES_TYPE { - const DEBUG_ENABLED: string; - const CONTACT_SEARCH: string; - const VENDOR_PROVIDED_AVAILABILITY: string; - const VENDOR_PROVIDED_QUEUE_WAIT_TIME: string; - const TRANSFER_TO_OMNI_FLOW: string; - const PENDING_STATUS_CHANGE: string; - const SFDC_PENDING_STATE: string; - const AUTO_ACCEPT_ENABLED: string; - } - namespace VOICE_CAPABILITIES_TYPE { - const MUTE_1: string; - export { MUTE_1 as MUTE }; - export const RECORD: string; - export const MERGE: string; - export const SWAP: string; - export const BLIND_TRANSFER: string; - const SIGNED_RECORDING_URL_1: string; - export { SIGNED_RECORDING_URL_1 as SIGNED_RECORDING_URL }; - export const SUPERVISOR_LISTEN_IN: string; - const SUPERVISOR_BARGE_IN_1: string; - export { SUPERVISOR_BARGE_IN_1 as SUPERVISOR_BARGE_IN }; - export const MOS: string; - const PHONEBOOK_1: string; - export { PHONEBOOK_1 as PHONEBOOK }; - export const HAS_GET_EXTERNAL_SPEAKER: string; - export const HAS_SET_EXTERNAL_SPEAKER: string; - export const HAS_GET_EXTERNAL_MICROPHONE: string; - export const HAS_SET_EXTERNAL_MICROPHONE: string; - export const CAN_CONSULT: string; - export const DIAL_PAD: string; - export const HAS_HID_SUPPORT: string; - export const PHONEBOOK_DISABLE: string; - } - namespace CALL_STATE { - const RINGING: string; - const CONNECTED: string; - const TRANSFERRING: string; - const TRANSFERRED: string; - const ENDED: string; - } - namespace PHONE_TYPE { - const DESK_PHONE: string; - const SOFT_PHONE: string; - } - namespace HANGUP_REASON { - const PHONE_CALL_ERROR: string; - const PHONE_CALL_ENDED: string; - } - namespace AGENT_AVAILABILITY { - export const AVAILABLE: string; - export const BUSY: string; - const OFFLINE_1: string; - export { OFFLINE_1 as OFFLINE }; - } - namespace REMOVE_PARTICIPANT_VARIANT { - const ALWAYS: string; - const NEVER: string; - const ALWAYS_EXCEPT_ON_HOLD: string; - } - namespace LOG_LEVEL { - const ERROR_1: string; - export { ERROR_1 as ERROR }; - const INFO_1: string; - export { INFO_1 as INFO }; - } - namespace LOG_SOURCE { - const SYSTEM: string; - const PARTNER: string; - } - namespace CONTACTS_FILTER_TYPES { - const AGENT_2: string; - export { AGENT_2 as AGENT }; - const QUEUE_1: string; - export { QUEUE_1 as QUEUE }; - export const CONTACT: string; - export const DIRECTORY: string; - const FLOW_1: string; - export { FLOW_1 as FLOW }; - const AVAILABLE_1: string; - export { AVAILABLE_1 as AVAILABLE }; - } - namespace WORK_EVENT { - const ASSIGNED: string; - const ACCEPTED: string; - const DECLINED: string; - const COMPLETED: string; - const CLOSED: string; - const PAUSED: string; - const UNPAUSED: string; - } - namespace DIAL_OPTIONS { - const CALLBACK_1: string; - export { CALLBACK_1 as CALLBACK }; - const CONSULT_1: string; - export { CONSULT_1 as CONSULT }; - } - namespace HANGUP_STATUS { - export const MISSED_AGENT: string; - const DECLINED_1: string; - export { DECLINED_1 as DECLINED }; - export const FAILED_CONNECT_AGENT: string; - export const FAILED_CONNECT_CUSTOMER: string; - export const CALLBACK_MISSED_OR_REJECTED: string; - } -} +declare const _default: Readonly<{ + SHARED_MESSAGE_TYPE: Readonly<{ + SETUP_CONNECTOR: "SETUP_CONNECTOR"; + CONNECTOR_READY: "CONNECTOR_READY"; + LOG: "LOG"; + TELEPHONY_EVENT_DISPATCHED: "TELEPHONY_EVENT_DISPATCHED"; + SET_AGENT_STATUS: "SET_AGENT_STATUS"; + GET_AGENT_STATUS: "GET_AGENT_STATUS"; + LOGOUT: "LOGOUT"; + MESSAGE: "MESSAGE"; + DOWNLOAD_VENDOR_LOGS: "DOWNLOAD_VENDOR_LOGS"; + AGENT_WORK_EVENT: "AGENT_WORK_EVENT"; + GET_CONTACTS: "GET_CONTACTS"; + }>; + VOICE_MESSAGE_TYPE: Readonly<{ + ACCEPT_CALL: "ACCEPT_CALL"; + DECLINE_CALL: "DECLINE_CALL"; + END_CALL: "END_CALL"; + MUTE: "MUTE"; + UNMUTE: "UNMUTE"; + HOLD: "HOLD"; + RESUME: "RESUME"; + DIAL: "DIAL"; + SEND_DIGITS: "SEND_DIGITS"; + GET_PHONE_CONTACTS: "GET_PHONE_CONTACTS"; + SWAP_PARTICIPANTS: "SWAP_PARTICIPANTS"; + ADD_PARTICIPANT: "ADD_PARTICIPANT"; + CONFERENCE: "CONFERENCE"; + PAUSE_RECORDING: "PAUSE_RECORDING"; + RESUME_RECORDING: "RESUME_RECORDING"; + SUPERVISE_CALL: "SUPERVISE_CALL"; + SUPERVISOR_BARGE_IN: "SUPERVISOR_BARGE_IN"; + SUPERVISOR_DISCONNECT: "SUPERVISOR_DISCONNECT"; + SET_AGENT_CONFIG: "SET_AGENT_CONFIG"; + GET_SIGNED_RECORDING_URL: "GET_SIGNED_RECORDING_URL"; + WRAP_UP_CALL: "WRAP_UP_CALL"; + AGENT_AVAILABLE: "AGENT_AVAILABLE"; + GET_AUDIO_DEVICES: "GET_AUDIO_DEVICES"; + }>; + SHARED_EVENT_TYPE: Readonly<{ + ERROR: "ERROR"; + WARNING: "WARNING"; + INFO: "INFO"; + LOGIN_STARTED: "LOGIN_STARTED"; + LOGIN_RESULT: "LOGIN_RESULT"; + LOGOUT_RESULT: "LOGOUT_RESULT"; + SHOW_LOGIN: "SHOW_LOGIN"; + SET_AGENT_STATUS_RESULT: "SET_AGENT_STATUS_RESULT"; + GET_AGENT_STATUS_RESULT: "GET_AGENT_STATUS_RESULT"; + MESSAGE: "MESSAGE"; + SET_AGENT_STATUS: "SET_AGENT_STATUS"; + GET_AGENT_STATUS: "GET_AGENT_STATUS"; + STATE_CHANGE: "STATE_CHANGE"; + REMOTE_CONTROLLER: "REMOTE_CONTROLLER"; + SHOW_STORAGE_ACCESS: "SHOW_STORAGE_ACCESS"; + STORAGE_ACCESS_RESULT: "STORAGE_ACCESS_RESULT"; + GET_CONTACTS_RESULT: "GET_CONTACTS_RESULT"; + AFTER_CONVERSATION_WORK_STARTED: "AFTER_CONVERSATION_WORK_STARTED"; + AFTER_CONVERSATION_WORK_ENDED: "AFTER_CONVERSATION_WORK_ENDED"; + }>; + VOICE_EVENT_TYPE: Readonly<{ + QUEUED_CALL_STARTED: "QUEUED_CALL_STARTED"; + CALL_STARTED: "CALL_STARTED"; + CALL_CONNECTED: "CALL_CONNECTED"; + CALL_FAILED: "CALL_FAILED"; + MUTE_TOGGLE: "MUTE_TOGGLE"; + HOLD_TOGGLE: "HOLD_TOGGLE"; + PHONE_CONTACTS: "PHONE_CONTACTS"; + PARTICIPANT_ADDED: "PARTICIPANT_ADDED"; + PARTICIPANT_CONNECTED: "PARTICIPANT_CONNECTED"; + PARTICIPANT_REMOVED: "PARTICIPANT_REMOVED"; + RECORDING_TOGGLE: "RECORDING_TOGGLE"; + PARTICIPANTS_SWAPPED: "PARTICIPANTS_SWAPPED"; + PARTICIPANTS_CONFERENCED: "PARTICIPANTS_CONFERENCED"; + SIGNED_RECORDING_URL: "SIGNED_RECORDING_URL"; + UPDATE_AUDIO_STATS: "UPDATE_AUDIO_STATS"; + UPDATE_AUDIO_STATS_COMPLETED: "UPDATE_AUDIO_STATS_COMPLETED"; + SUPERVISOR_BARGED_IN: "SUPERVISOR_BARGED_IN"; + SUPERVISOR_CALL_STARTED: "SUPERVISOR_CALL_STARTED"; + SUPERVISOR_CALL_CONNECTED: "SUPERVISOR_CALL_CONNECTED"; + SUPERVISOR_HANGUP: "SUPERVISOR_HANGUP"; + CALL_BARGED_IN: "CALL_BARGED_IN"; + WRAP_UP_ENDED: "WRAP_UP_ENDED"; + AFTER_CALL_WORK_STARTED: "AFTER_CALL_WORK_STARTED"; + AGENT_CONFIG_UPDATED: "AGENT_CONFIG_UPDATED"; + AGENT_ERROR: "AGENT_ERROR"; + HANGUP: "HANGUP"; + SOFTPHONE_ERROR: "SOFTPHONE_ERROR"; + SHOW_TRANSFER_VIEW: "SHOW_TRANSFER_VIEW"; + GET_AUDIO_DEVICES: "GET_AUDIO_DEVICES"; + AUDIO_STATS: "AUDIO_STATS"; + CALL_UPDATED: "CALL_UPDATED"; + }>; + INFO_TYPE: Readonly<{ + CAN_NOT_ACCEPT_THE_CALL: "CAN_NOT_ACCEPT_THE_CALL"; + }>; + SHARED_ERROR_TYPE: Readonly<{ + CUSTOM_ERROR: "CUSTOM_ERROR"; + GENERIC_ERROR: "GENERIC_ERROR"; + AUTHENTICATION_ERROR: "AUTHENTICATION_ERROR"; + INVALID_AGENT_STATUS: "INVALID_AGENT_STATUS"; + CAN_NOT_GET_AGENT_STATUS: "CAN_NOT_GET_AGENT_STATUS"; + CAN_NOT_SET_AGENT_STATUS: "CAN_NOT_SET_AGENT_STATUS"; + LOGIN_REQUIRED: "LOGIN_REQUIRED"; + CAN_NOT_LOG_IN: "CAN_NOT_LOG_IN"; + CAN_NOT_LOG_OUT: "CAN_NOT_LOG_OUT"; + INVALID_STATE_CHANGE_RESULT: "INVALID_STATE_CHANGE_RESULT"; + INVALID_STORAGE_ACCESS_RESULT: "INVALID_STORAGE_ACCESS_RESULT"; + INVALID_ACW_INFO: "INVALID_ACW_INFO"; + }>; + VOICE_ERROR_TYPE: Readonly<{ + CAN_NOT_DECLINE_THE_CALL: "CAN_NOT_DECLINE_THE_CALL"; + CAN_NOT_END_THE_CALL: "CAN_NOT_END_THE_CALL"; + CAN_NOT_HOLD_CALL: "CAN_NOT_HOLD_CALL"; + CAN_NOT_RESUME_CALL: "CAN_NOT_RESUME_CALL"; + CAN_NOT_MUTE_CALL: "CAN_NOT_MUTE_CALL"; + CAN_NOT_UNMUTE_CALL: "CAN_NOT_UNMUTE_CALL"; + CAN_NOT_TOGGLE_MUTE: "CAN_NOT_TOGGLE_MUTE"; + CAN_NOT_TOGGLE_HOLD: "CAN_NOT_TOGGLE_HOLD"; + CAN_NOT_TOGGLE_RECORD: "CAN_NOT_TOGGLE_RECORD"; + INVALID_PARTICIPANT: "INVALID_PARTICIPANT"; + INVALID_PARAMS: "INVALID_PARAMS"; + CAN_NOT_GET_PHONE_CONTACTS: "CAN_NOT_GET_PHONE_CONTACTS"; + CAN_NOT_SWAP_PARTICIPANTS: "CAN_NOT_SWAP_PARTICIPANTS"; + CAN_NOT_CONFERENCE: "CAN_NOT_CONFERENCE"; + INVALID_DESTINATION: "INVALID_DESTINATION"; + INVALID_PHONE_NUMBER: "INVALID_PHONE_NUMBER"; + CAN_NOT_HANGUP_PARTICIPANT: "CAN_NOT_HANGUP_PARTICIPANT"; + CAN_NOT_ADD_PARTICIPANT: "CAN_NOT_ADD_PARTICIPANT"; + CAN_NOT_CONNECT_PARTICIPANT: "CAN_NOT_CONNECT_PARTICIPANT"; + CAN_NOT_START_THE_CALL: "CAN_NOT_START_THE_CALL"; + CAN_NOT_PAUSE_RECORDING: "CAN_NOT_PAUSE_RECORDING"; + CAN_NOT_RESUME_RECORDING: "CAN_NOT_RESUME_RECORDING"; + CAN_NOT_SET_AGENT_CONFIG: "CAN_NOT_SET_AGENT_CONFIG"; + CAN_NOT_SET_CAPABILITIES: "CAN_NOT_SET_CAPABILITIES"; + CAN_NOT_UPDATE_PHONE_NUMBER: "CAN_NOT_UPDATE_PHONE_NUMBER"; + CAN_NOT_GET_SIGNED_RECORDING_URL: "CAN_NOT_GET_SIGNED_RECORDING_URL"; + CAN_NOT_SUPERVISE_CALL: "CAN_NOT_SUPERVISE_CALL"; + CAN_NOT_DISCONNECT_SUPERVISOR: "CAN_NOT_DISCONNECT_SUPERVISOR"; + CAN_NOT_BARGE_IN_SUPERVISOR: "CAN_NOT_BARGE_IN_SUPERVISOR"; + CAN_NOT_BARGE_IN_CALL: "CAN_NOT_BARGE_IN_CALL"; + AGENT_ERROR: "AGENT_ERROR"; + MICROPHONE_NOT_SHARED: "MICROPHONE_NOT_SHARED"; + UNSUPPORTED_BROWSER: "UNSUPPORTED_BROWSER"; + USER_BUSY_ERROR: "USER_BUSY_ERROR"; + WEBRTC_ERROR: "WEBRTC_ERROR"; + CAN_NOT_GET_AUDIO_DEVICES: "CAN_NOT_GET_AUDIO_DEVICES"; + CAN_NOT_UPDATE_CALL: "CAN_NOT_UPDATE_CALL"; + }>; + AGENT_STATUS: Readonly<{ + ONLINE: "Online"; + OFFLINE: "Offline"; + ACW: "AfterCallWork"; + }>; + PARTICIPANT_TYPE: Readonly<{ + AGENT: "Agent"; + INITIAL_CALLER: "Initial_Caller"; + THIRD_PARTY: "Third_Party"; + SUPERVISOR: "Supervisor"; + }>; + CALL_TYPE: Readonly<{ + INBOUND: "Inbound"; + OUTBOUND: "Outbound"; + CALLBACK: "Callback"; + ADD_PARTICIPANT: "AddParticipant"; + TRANSFER: "Transfer"; + INTERNAL_CALL: "InternalCall"; + DIALED_CALLBACK: "DialedCallback"; + CONSULT: "Consult"; + }>; + CALL_SUBTYPE: Readonly<{ + PSTN: "PSTN"; + WEB_RTC: "WebRTC"; + }>; + DIALER_TYPE: Readonly<{ + OUTBOUND_PREVIEW: "OutboundPreview"; + NONE: "None"; + }>; + CONTACT_TYPE: Readonly<{ + PHONEBOOK: "PhoneBook"; + QUEUE: "Queue"; + PHONENUMBER: "PhoneNumber"; + AGENT: "Agent"; + FLOW: "Flow"; + }>; + CONTACT_LIST_TYPE: Readonly<{ + TRANSFER: "Transfer"; + CONFERENCE: "Conference"; + ALL: "All"; + }>; + AGENT_CONFIG_TYPE: Readonly<{ + SHOW_AGENT_SETTINGS: "SHOW_AGENT_SETTINGS"; + PHONES: "PHONES"; + SELECTED_PHONE: "SELECTED_PHONE"; + }>; + SHARED_CAPABILITIES_TYPE: Readonly<{ + DEBUG_ENABLED: "DEBUG_ENABLED"; + CONTACT_SEARCH: "CONTACT_SEARCH"; + VENDOR_PROVIDED_AVAILABILITY: "VENDOR_PROVIDED_AVAILABILITY"; + VENDOR_PROVIDED_QUEUE_WAIT_TIME: "VENDOR_PROVIDED_QUEUE_WAIT_TIME"; + TRANSFER_TO_OMNI_FLOW: "TRANSFER_TO_OMNI_FLOW"; + PENDING_STATUS_CHANGE: "PENDING_STATUS_CHANGE"; + SFDC_PENDING_STATE: "SFDC_PENDING_STATE"; + AUTO_ACCEPT_ENABLED: "AUTO_ACCEPT_ENABLED"; + }>; + VOICE_CAPABILITIES_TYPE: Readonly<{ + MUTE: "MUTE"; + RECORD: "RECORD"; + MERGE: "MERGE"; + SWAP: "SWAP"; + BLIND_TRANSFER: "BLIND_TRANSFER"; + SIGNED_RECORDING_URL: "SIGNED_RECORDING_URL"; + SUPERVISOR_LISTEN_IN: "SUPERVISOR_LISTEN_IN"; + SUPERVISOR_BARGE_IN: "SUPERVISOR_BARGE_IN"; + MOS: "MOS"; + PHONEBOOK: "PHONEBOOK"; + HAS_GET_EXTERNAL_SPEAKER: "HAS_GET_EXTERNAL_SPEAKER"; + HAS_SET_EXTERNAL_SPEAKER: "HAS_SET_EXTERNAL_SPEAKER"; + HAS_GET_EXTERNAL_MICROPHONE: "HAS_GET_EXTERNAL_MICROPHONE"; + HAS_SET_EXTERNAL_MICROPHONE: "HAS_SET_EXTERNAL_MICROPHONE"; + CAN_CONSULT: "CAN_CONSULT"; + DIAL_PAD: "DIAL_PAD"; + HAS_HID_SUPPORT: "HAS_HID_SUPPORT"; + PHONEBOOK_DISABLE: "PHONEBOOK_DISABLE"; + }>; + CALL_STATE: Readonly<{ + RINGING: "ringing"; + CONNECTED: "connected"; + TRANSFERRING: "transferring"; + TRANSFERRED: "transferred"; + ENDED: "ended"; + }>; + PHONE_TYPE: Readonly<{ + DESK_PHONE: "DESK_PHONE"; + SOFT_PHONE: "SOFT_PHONE"; + }>; + HANGUP_REASON: Readonly<{ + PHONE_CALL_ERROR: "error"; + PHONE_CALL_ENDED: "ended"; + }>; + AGENT_AVAILABILITY: Readonly<{ + AVAILABLE: "AVAILABLE"; + BUSY: "BUSY"; + OFFLINE: "OFFLINE"; + }>; + REMOVE_PARTICIPANT_VARIANT: Readonly<{ + ALWAYS: "ALWAYS"; + NEVER: "NEVER"; + ALWAYS_EXCEPT_WHEN_ON_HOLD: "ALWAYS_EXCEPT_WHEN_ON_HOLD"; + }>; + LOG_LEVEL: Readonly<{ + ERROR: "ERROR"; + INFO: "INFO"; + }>; + LOG_SOURCE: Readonly<{ + SYSTEM: "SYSTEM"; + PARTNER: "PARTNER"; + }>; + CONTACTS_FILTER_TYPES: Readonly<{ + AGENT: "AGENT"; + QUEUE: "QUEUE"; + CONTACT: "CONTACT"; + DIRECTORY: "DIRECTORY"; + FLOW: "FLOW"; + AVAILABLE: "AVAILABLE"; + }>; + WORK_EVENT: Readonly<{ + ASSIGNED: "ASSIGNED"; + ACCEPTED: "ACCEPTED"; + DECLINED: "DECLINED"; + COMPLETED: "COMPLETED"; + CLOSED: "CLOSED"; + PAUSED: "PAUSED"; + UNPAUSED: "UNPAUSED"; + }>; + DIAL_OPTIONS: Readonly<{ + CALLBACK: "isCallback=true"; + CONSULT: "isConsultCall"; + }>; + HANGUP_STATUS: Readonly<{ + MISSED_AGENT: "MissedCallAgent"; + DECLINED: "DeclinedByAgent"; + FAILED_CONNECT_AGENT: "FailedConnectAgent"; + FAILED_CONNECT_CUSTOMER: "FailedConnectCustomer"; + CALLBACK_MISSED_OR_REJECTED: "CallbackMissedOrRejected"; + }>; +}>; export default _default; /** * Fields in the connector configuration that are logged. diff --git a/ts-declaration/index.d.ts b/ts-declaration/index.d.ts index ccb3a4e..4b936fa 100644 --- a/ts-declaration/index.d.ts +++ b/ts-declaration/index.d.ts @@ -1,3 +1,3 @@ export { log } from "./logger.js"; export { initializeConnector, publishEvent, publishError, publishLog } from "./baseConnector.js"; -export { Constants, ActiveCallsResult, AgentConfigResult, AgentConfig, SharedCapabilitiesResult, VoiceCapabilitiesResult, RecordingToggleResult, ParticipantResult, SignedRecordingUrlResult, ContactsResult, PhoneContactsResult, CallResult, HangupResult, HoldToggleResult, InitResult, GenericResult, MuteToggleResult, LogoutResult, CallInfo, PhoneCall, PhoneCallAttributes, Contact, Phone, AgentStatusInfo, AudioStatsElement, AudioStats, StatsInfo, VendorConnector, TelephonyConnector, SuperviseCallResult, SupervisorHangupResult, SupervisedCallInfo, AgentVendorStatusInfo, StateChangeResult, CustomError, AgentWork, ShowStorageAccessResult, DialOptions, ContactsFilter, AudioDevicesResult, ACWInfo, SetAgentConfigResult, HidDevice } from "./types.js"; +export { Constants, ActiveCallsResult, AgentConfigResult, AgentConfig, SharedCapabilitiesResult, VoiceCapabilitiesResult, RecordingToggleResult, ParticipantResult, SignedRecordingUrlResult, ContactsResult, PhoneContactsResult, CallResult, HangupResult, HoldToggleResult, InitResult, GenericResult, MuteToggleResult, LogoutResult, CallInfo, PhoneCall, PhoneCallAttributes, Contact, Phone, AgentStatusInfo, AudioStatsElement, AudioStats, StatsInfo, VendorConnector, TelephonyConnector, SuperviseCallResult, SupervisorHangupResult, SupervisedCallInfo, AgentVendorStatusInfo, StateChangeResult, CustomError, AgentWork, ShowStorageAccessResult, DialOptions, ContactsFilter, AudioDevicesResult, ACWInfo, SetAgentConfigResult, SetAgentStateResult, HidDevice } from "./types.js"; diff --git a/ts-declaration/types.d.ts b/ts-declaration/types.d.ts index 97cad4c..cfb8587 100644 --- a/ts-declaration/types.d.ts +++ b/ts-declaration/types.d.ts @@ -1,146 +1,146 @@ export namespace Constants { namespace SHARED_EVENT_TYPE { - const LOGIN_RESULT: string; - const LOGOUT_RESULT: string; - const MESSAGE: string; - const SET_AGENT_STATUS: string; - const GET_AGENT_STATUS: string; - const STATE_CHANGE: string; - const STORAGE_ACCESS_RESULT: string; - const GET_CONTACTS_RESULT: string; - const AFTER_CONVERSATION_WORK_STARTED: string; - const AFTER_CONVERSATION_WORK_ENDED: string; + const LOGIN_RESULT: "LOGIN_RESULT"; + const LOGOUT_RESULT: "LOGOUT_RESULT"; + const MESSAGE: "MESSAGE"; + const SET_AGENT_STATUS: "SET_AGENT_STATUS"; + const GET_AGENT_STATUS: "GET_AGENT_STATUS"; + const STATE_CHANGE: "STATE_CHANGE"; + const STORAGE_ACCESS_RESULT: "STORAGE_ACCESS_RESULT"; + const GET_CONTACTS_RESULT: "GET_CONTACTS_RESULT"; + const AFTER_CONVERSATION_WORK_STARTED: "AFTER_CONVERSATION_WORK_STARTED"; + const AFTER_CONVERSATION_WORK_ENDED: "AFTER_CONVERSATION_WORK_ENDED"; } namespace VOICE_EVENT_TYPE { - const CALL_STARTED: string; - const QUEUED_CALL_STARTED: string; - const CALL_CONNECTED: string; - const HANGUP: string; - const MUTE_TOGGLE: string; - const HOLD_TOGGLE: string; - const RECORDING_TOGGLE: string; - const PARTICIPANTS_SWAPPED: string; - const PARTICIPANTS_CONFERENCED: string; - const PARTICIPANT_ADDED: string; - const PARTICIPANT_CONNECTED: string; - const PARTICIPANT_REMOVED: string; - const AFTER_CALL_WORK_STARTED: string; - const WRAP_UP_ENDED: string; - const AGENT_ERROR: string; - const SOFTPHONE_ERROR: string; - const UPDATE_AUDIO_STATS: string; - const CALL_BARGED_IN: string; - const SUPERVISOR_BARGED_IN: string; - const SUPERVISOR_CALL_STARTED: string; - const SUPERVISOR_CALL_CONNECTED: string; - const SUPERVISOR_HANGUP: string; - const SHOW_TRANSFER_VIEW: string; - const AUDIO_STATS: string; - const CALL_UPDATED: string; + const CALL_STARTED: "CALL_STARTED"; + const QUEUED_CALL_STARTED: "QUEUED_CALL_STARTED"; + const CALL_CONNECTED: "CALL_CONNECTED"; + const HANGUP: "HANGUP"; + const MUTE_TOGGLE: "MUTE_TOGGLE"; + const HOLD_TOGGLE: "HOLD_TOGGLE"; + const RECORDING_TOGGLE: "RECORDING_TOGGLE"; + const PARTICIPANTS_SWAPPED: "PARTICIPANTS_SWAPPED"; + const PARTICIPANTS_CONFERENCED: "PARTICIPANTS_CONFERENCED"; + const PARTICIPANT_ADDED: "PARTICIPANT_ADDED"; + const PARTICIPANT_CONNECTED: "PARTICIPANT_CONNECTED"; + const PARTICIPANT_REMOVED: "PARTICIPANT_REMOVED"; + const AFTER_CALL_WORK_STARTED: "AFTER_CALL_WORK_STARTED"; + const WRAP_UP_ENDED: "WRAP_UP_ENDED"; + const AGENT_ERROR: "AGENT_ERROR"; + const SOFTPHONE_ERROR: "SOFTPHONE_ERROR"; + const UPDATE_AUDIO_STATS: "UPDATE_AUDIO_STATS"; + const CALL_BARGED_IN: "CALL_BARGED_IN"; + const SUPERVISOR_BARGED_IN: "SUPERVISOR_BARGED_IN"; + const SUPERVISOR_CALL_STARTED: "SUPERVISOR_CALL_STARTED"; + const SUPERVISOR_CALL_CONNECTED: "SUPERVISOR_CALL_CONNECTED"; + const SUPERVISOR_HANGUP: "SUPERVISOR_HANGUP"; + const SHOW_TRANSFER_VIEW: "SHOW_TRANSFER_VIEW"; + const AUDIO_STATS: "AUDIO_STATS"; + const CALL_UPDATED: "CALL_UPDATED"; } namespace SHARED_ERROR_TYPE { - const GENERIC_ERROR: string; - const INVALID_AGENT_STATUS: string; + const GENERIC_ERROR: "GENERIC_ERROR"; + const INVALID_AGENT_STATUS: "INVALID_AGENT_STATUS"; } namespace VOICE_ERROR_TYPE { - const INVALID_PARTICIPANT: string; - const INVALID_DESTINATION: string; - const CAN_NOT_UPDATE_PHONE_NUMBER: string; - const INVALID_PARAMS: string; + const INVALID_PARTICIPANT: "INVALID_PARTICIPANT"; + const INVALID_DESTINATION: "INVALID_DESTINATION"; + const CAN_NOT_UPDATE_PHONE_NUMBER: "CAN_NOT_UPDATE_PHONE_NUMBER"; + const INVALID_PARAMS: "INVALID_PARAMS"; } const AGENT_STATUS: { - ONLINE: string; - OFFLINE: string; - ACW: string; + ONLINE: "Online"; + OFFLINE: "Offline"; + ACW: "AfterCallWork"; }; const PARTICIPANT_TYPE: { - AGENT: string; - INITIAL_CALLER: string; - THIRD_PARTY: string; - SUPERVISOR: string; + AGENT: "Agent"; + INITIAL_CALLER: "Initial_Caller"; + THIRD_PARTY: "Third_Party"; + SUPERVISOR: "Supervisor"; }; const CALL_TYPE: { - INBOUND: string; - OUTBOUND: string; - CALLBACK: string; - ADD_PARTICIPANT: string; - TRANSFER: string; - INTERNAL_CALL: string; - DIALED_CALLBACK: string; - CONSULT: string; + INBOUND: "Inbound"; + OUTBOUND: "Outbound"; + CALLBACK: "Callback"; + ADD_PARTICIPANT: "AddParticipant"; + TRANSFER: "Transfer"; + INTERNAL_CALL: "InternalCall"; + DIALED_CALLBACK: "DialedCallback"; + CONSULT: "Consult"; }; const CALL_SUBTYPE: { - PSTN: string; - WEB_RTC: string; + PSTN: "PSTN"; + WEB_RTC: "WebRTC"; }; const DIALER_TYPE: { - OUTBOUND_PREVIEW: string; - NONE: string; + OUTBOUND_PREVIEW: "OutboundPreview"; + NONE: "None"; }; const CONTACT_TYPE: { - PHONEBOOK: string; - QUEUE: string; - PHONENUMBER: string; - AGENT: string; - FLOW: string; + PHONEBOOK: "PhoneBook"; + QUEUE: "Queue"; + PHONENUMBER: "PhoneNumber"; + AGENT: "Agent"; + FLOW: "Flow"; }; const CONTACT_LIST_TYPE: { - TRANSFER: string; - CONFERENCE: string; - ALL: string; + TRANSFER: "Transfer"; + CONFERENCE: "Conference"; + ALL: "All"; }; const CALL_STATE: { - RINGING: string; - CONNECTED: string; - TRANSFERRING: string; - TRANSFERRED: string; - ENDED: string; + RINGING: "ringing"; + CONNECTED: "connected"; + TRANSFERRING: "transferring"; + TRANSFERRED: "transferred"; + ENDED: "ended"; }; const HANGUP_REASON: { - PHONE_CALL_ERROR: string; - PHONE_CALL_ENDED: string; + PHONE_CALL_ERROR: "error"; + PHONE_CALL_ENDED: "ended"; }; const PHONE_TYPE: { - DESK_PHONE: string; - SOFT_PHONE: string; + DESK_PHONE: "DESK_PHONE"; + SOFT_PHONE: "SOFT_PHONE"; }; const AGENT_AVAILABILITY: { - AVAILABLE: string; - BUSY: string; - OFFLINE: string; + AVAILABLE: "AVAILABLE"; + BUSY: "BUSY"; + OFFLINE: "OFFLINE"; }; const REMOVE_PARTICIPANT_VARIANT: { - ALWAYS: string; - NEVER: string; - ALWAYS_EXCEPT_ON_HOLD: string; + ALWAYS: "ALWAYS"; + NEVER: "NEVER"; + ALWAYS_EXCEPT_WHEN_ON_HOLD: "ALWAYS_EXCEPT_WHEN_ON_HOLD"; }; const LOG_LEVEL: { - ERROR: string; - INFO: string; + ERROR: "ERROR"; + INFO: "INFO"; }; const CONTACTS_FILTER_TYPES: { - AGENT: string; - QUEUE: string; - CONTACT: string; - DIRECTORY: string; - FLOW: string; - AVAILABLE: string; + AGENT: "AGENT"; + QUEUE: "QUEUE"; + CONTACT: "CONTACT"; + DIRECTORY: "DIRECTORY"; + FLOW: "FLOW"; + AVAILABLE: "AVAILABLE"; }; const WORK_EVENT: { - ASSIGNED: string; - ACCEPTED: string; - DECLINED: string; - COMPLETED: string; - CLOSED: string; - PAUSED: string; - UNPAUSED: string; + ASSIGNED: "ASSIGNED"; + ACCEPTED: "ACCEPTED"; + DECLINED: "DECLINED"; + COMPLETED: "COMPLETED"; + CLOSED: "CLOSED"; + PAUSED: "PAUSED"; + UNPAUSED: "UNPAUSED"; }; const HANGUP_STATUS: { - MISSED_AGENT: string; - DECLINED: string; - FAILED_CONNECT_AGENT: string; - FAILED_CONNECT_CUSTOMER: string; - CALLBACK_MISSED_OR_REJECTED: string; + MISSED_AGENT: "MissedCallAgent"; + DECLINED: "DeclinedByAgent"; + FAILED_CONNECT_AGENT: "FailedConnectAgent"; + FAILED_CONNECT_CUSTOMER: "FailedConnectCustomer"; + CALLBACK_MISSED_OR_REJECTED: "CallbackMissedOrRejected"; }; } /** @@ -179,6 +179,29 @@ export class Phone { type: string; number: string; } +/** + * Class representing an AudioDevice type + */ +export class AudioDevice { + /** + * Create AudioDevice + * @param {object} param + * @param {string} [param.deviceId] + * @param {string} [param.kind] + * @param {string} [param.label] + * @param {string} [param.groupId] + */ + constructor({ deviceId, kind, label, groupId }: { + deviceId?: string; + kind?: string; + label?: string; + groupId?: string; + }); + deviceId: string; + kind: string; + label: string; + groupId: string; +} /** * Class representing a Hid Device */ @@ -428,14 +451,16 @@ export class ParticipantResult { * @param {string} param.phoneNumber * @param {string} param.callId * @param {Contact} param.contact + * @param {string} param.connectionId - optional connectionID representing a call leg. */ - constructor({ initialCallHasEnded, callInfo, callAttributes, phoneNumber, callId, contact }: { + constructor({ initialCallHasEnded, callInfo, callAttributes, phoneNumber, callId, contact, connectionId }: { initialCallHasEnded: boolean; callInfo: CallInfo; callAttributes?: PhoneCallAttributes; phoneNumber: string; callId: string; contact: Contact; + connectionId: string; }); initialCallHasEnded: boolean; callInfo: CallInfo; @@ -443,6 +468,7 @@ export class ParticipantResult { phoneNumber: string; callId: string; contact: Contact; + connectionId: string; } /** * Class representing result type for getContacts() @@ -570,12 +596,16 @@ export class InitResult { export class DialOptions { /** * Create DialOptions + * @param {object} param * @param {boolean} [param.isCallback] * @param {boolean} [param.isConsultCall] */ - constructor({ isCallback, isConsultCall }?: boolean); - isCallback: any; - isConsultCall: any; + constructor({ isCallback, isConsultCall }: { + isCallback?: boolean; + isConsultCall?: boolean; + }); + isCallback: boolean; + isConsultCall: boolean; } /** * Class representing generic result type @@ -598,9 +628,14 @@ export class SetAgentStateResult extends GenericResult { /** * Create AgentState * @param {object} param + * @param {boolean} param.success + * @param {boolean} [param.isStatusSyncNeeded] */ - constructor({ success, isStatusSyncNeeded }: object); - isStatusSyncNeeded: any; + constructor({ success, isStatusSyncNeeded }: { + success: boolean; + isStatusSyncNeeded?: boolean; + }); + isStatusSyncNeeded: boolean; } /** * Class representing result type for setAgentConfig() @@ -609,9 +644,14 @@ export class SetAgentConfigResult extends GenericResult { /** * Create AgentConfig * @param {object} param + * @param {boolean} param.success + * @param {boolean} [param.isSystemEvent] */ - constructor({ success, isSystemEvent }: object); - isSystemEvent: any; + constructor({ success, isSystemEvent }: { + success: boolean; + isSystemEvent?: boolean; + }); + isSystemEvent: boolean; setIsSystemEvent(isSystemEvent: any): void; } /** @@ -835,6 +875,7 @@ export class PhoneCall { * Create a PhoneCall. * @param {object} param * @param {string} [param.callId] - The unique callId. This is a required parameter + * @param {string} [param.connectionId] - optional connectionID representing a call leg. * @param {CALL_TYPE} [param.callType] - The type of the call, one of the CALL_TYPE values * @param {CALL_SUBTYPE} [param.callSubtype] - The subtype of the call, one of the CALL_SUBTYPE values * @param {Contact} [param.contact] - The Call Target / Contact . TODO: to be deprecated, replace with toContact @@ -849,8 +890,9 @@ export class PhoneCall { * @param {Contact} [param.fromContact] - This is optional, and being populated when dialing/consulting a contact or adding a participant * @param {Contact} [param.toContact] - This is currently the same as param.contact (just rename) */ - constructor({ callId, callType, callSubtype, contact, state, callAttributes, phoneNumber, callInfo, reason, closeCallOnError, agentStatus, agentARN, fromContact, toContact }: { + constructor({ callId, callType, callSubtype, contact, state, callAttributes, phoneNumber, callInfo, reason, closeCallOnError, agentStatus, agentARN, fromContact, toContact, connectionId }: { callId?: string; + connectionId?: string; callType?: string; callSubtype?: string; contact?: Contact; @@ -866,6 +908,7 @@ export class PhoneCall { toContact?: Contact; }); callId: string; + connectionId: string; callType: string; callSubtype: string; phoneNumber: string; @@ -1022,19 +1065,19 @@ export class TelephonyConnector { /** * Supervise a call * @param {SupervisedCallInfo} supervisedCallInfo CallInfo of the call to be supervised - * @returns {Promise } + * @returns {Promise} */ superviseCall(supervisedCallInfo: SupervisedCallInfo): Promise; /** * Supervisor disconnects from a call * @param {SupervisedCallInfo} supervisedCallInfo CallInfo of the supervised call to be disconnected - * @returns {Promise } + * @returns {Promise} */ supervisorDisconnect(supervisedCallInfo: SupervisedCallInfo): Promise; /** * Supervisor Barges into a ongoing call * @param {SupervisedCallInfo} supervisedCallInfo CallInfo of the supervised call which supervisor barges in - * @returns {Promise } + * @returns {Promise} */ supervisorBargeIn(supervisedCallInfo: SupervisedCallInfo): Promise; } @@ -1063,13 +1106,13 @@ export class VendorConnector { onAgentWorkEvent(agentWork: AgentWork): void; /** * Set agent status - * @param {Constants.AGENT_STATUS} agentStatus - * @param {StatusInfo} statusInfo + * @param {AGENT_STATUS} agentStatus + * @param {AgentStatusInfo} statusInfo * @param {Boolean} enqueueNextState - flag to determine if this status change request should be enqueued if neccessary * @returns {Promise} * */ - setAgentStatus(agentStatus: Constants.AGENT_STATUS, statusInfo: StatusInfo, enqueueNextState: boolean): Promise; + setAgentStatus(agentStatus: string, statusInfo: AgentStatusInfo, enqueueNextState: boolean): Promise; /** * Get agent status * @returns {Promise} @@ -1108,8 +1151,9 @@ export class VendorConnector { getContacts(filter: ContactsFilter, workItemId: string): Promise; /** * Returns a list of valid device IDs that can be used for the speaker and microphone devices. + * @returns {Promise} */ - getAudioDevices(): void; + getAudioDevices(): Promise; /** * Get shared capabilities * @returns {Promise} @@ -1215,6 +1259,7 @@ export class SupervisedCallInfo { * Create a AgentStatusInfo. * @param {object} param * @param {string} [param.callId] - The unique supervised vendor call ID (required) + * @param {string} [param.connectionId] - optional connectionID representing a call leg. * @param {string} [param.voiceCallId] - The supervised salesforce voice call ID * @param {string} [param.callType] - The type of the call, one of the CALL_TYPE values * @param {string} [param.from] - From phone number (for Inbound calls) @@ -1222,8 +1267,9 @@ export class SupervisedCallInfo { * @param {string} [param.supervisorName] - The supervisor name (shown to the supervised agent on barge in) * @param {boolean} [param.isBargedIn] - True if the Supervisor has barged in, False if the supervisor is listening in. */ - constructor({ callId, voiceCallId, callType, from, to, supervisorName, isBargedIn }: { + constructor({ callId, voiceCallId, callType, from, to, supervisorName, isBargedIn, connectionId }: { callId?: string; + connectionId?: string; voiceCallId?: string; callType?: string; from?: string; @@ -1238,6 +1284,7 @@ export class SupervisedCallInfo { to: string; supervisorName: string; isBargedIn: boolean; + connectionId: string; } /** * Class representing a Audio Stats, which contains array of AudioStats. This object is used to calculate the MOS Score From 59c42975c47115462c3428065c8fdaa7dbcfb77b Mon Sep 17 00:00:00 2001 From: Raith Munro Date: Tue, 26 Aug 2025 17:14:22 +0100 Subject: [PATCH 11/13] Fix setAgentStatus to use Constants.AGENT_STATUS --- src/main/types.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/types.js b/src/main/types.js index b4cbad8..6e36cd3 100644 --- a/src/main/types.js +++ b/src/main/types.js @@ -1350,7 +1350,7 @@ export class VendorConnector { /** * Set agent status - * @param {AGENT_STATUS} agentStatus + * @param {typeof Constants.AGENT_STATUS[keyof typeof Constants.AGENT_STATUS]} agentStatus * @param {AgentStatusInfo} statusInfo * @param {Boolean} enqueueNextState - flag to determine if this status change request should be enqueued if neccessary * @returns {Promise} From 6884489bd9134c3d380ad50f5964c59484033e6f Mon Sep 17 00:00:00 2001 From: Raith Munro Date: Tue, 26 Aug 2025 17:14:38 +0100 Subject: [PATCH 12/13] Regenerate types --- ts-declaration/types.d.ts | 74 +++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/ts-declaration/types.d.ts b/ts-declaration/types.d.ts index cfb8587..037adfc 100644 --- a/ts-declaration/types.d.ts +++ b/ts-declaration/types.d.ts @@ -169,14 +169,14 @@ export class Phone { /** * Create Phone * @param {object} param - * @param {PHONE_TYPE} param.type + * @param {typeof Constants.PHONE_TYPE[keyof typeof Constants.PHONE_TYPE]} param.type * @param {string} [param.number] */ constructor({ type, number }: { - type: string; + type: "DESK_PHONE" | "SOFT_PHONE"; number?: string; }); - type: string; + type: "DESK_PHONE" | "SOFT_PHONE"; number: string; } /** @@ -478,14 +478,14 @@ export class ContactsResult { * Create ContactsResult * @param {object} param * @param {Contact[]} [param.contacts] - * @param {Array} [param.contactTypes] + * @param {Array} [param.contactTypes] */ constructor({ contacts, contactTypes }: { contacts?: Contact[]; - contactTypes?: any[]; + contactTypes?: ("Agent" | "PhoneBook" | "Queue" | "PhoneNumber" | "Flow")[]; }); contacts: Contact[]; - contactTypes: any[]; + contactTypes: ("Agent" | "PhoneBook" | "Queue" | "PhoneNumber" | "Flow")[]; } /** * Class representing result type for getPhoneContacts() @@ -790,15 +790,15 @@ export class Contact { * Create a Contact. * @param {object} param * @param {string} [param.id] - The unique contactId - * @param {("PhoneBook"|"Queue"|"PhoneNumber"|"Agent")} [param.type] - The type of the contact, one of the CONTACT_TYPE values + * @param {("PhoneBook"|"Queue"|"PhoneNumber"|"Agent")} [param.type] - The type of the contact, one of the CONTACT_TYPE values // NOTE: This does not include FLOW! Intentional? * @param {string} [param.name] - The label for this contact to be displayed in the UI - * @param {("Transfer"|"Conference"|"All")} [param.listType] - The type of contact List, one of the CONTACT_LIST_TYPE values. Messaging Only + * @param {typeof Constants.CONTACT_LIST_TYPE[keyof typeof Constants.CONTACT_LIST_TYPE]} [param.listType] - The type of contact List, one of the CONTACT_LIST_TYPE values. Messaging Only * @param {string} [param.phoneNumber] - The phone number associcated with this contact * @param {string} [param.prefix] - Any prefix to be dialed before dialing the number (i.e. +1) * @param {string} [param.extension] - Any extension to be dialed after dialing the number * @param {string} [param.endpointARN] * @param {string} [param.queue] - * @param {string} [param.availability] + * @param {typeof Constants.AGENT_AVAILABILITY[keyof typeof Constants.AGENT_AVAILABILITY]} [param.availability] * @param {string} [param.recordId] - Salesforce RecordId * @param {string} [param.description] - Contact Description * @param {string} [param.queueWaitTime] - Estimated Queue Wait Time @@ -807,13 +807,13 @@ export class Contact { id?: string; type?: ("PhoneBook" | "Queue" | "PhoneNumber" | "Agent"); name?: string; - listType?: ("Transfer" | "Conference" | "All"); + listType?: "Transfer" | "Conference" | "All"; phoneNumber?: string; prefix?: string; extension?: string; endpointARN?: string; queue?: string; - availability?: string; + availability?: "OFFLINE" | "AVAILABLE" | "BUSY"; recordId?: string; description?: string; queueWaitTime?: string; @@ -827,7 +827,7 @@ export class Contact { extension: string; endpointARN: string; queue: string; - availability: string; + availability: "OFFLINE" | "AVAILABLE" | "BUSY"; queueWaitTime: string; recordId: string; description: string; @@ -840,8 +840,8 @@ export class PhoneCallAttributes { * Create PhoneCallAttributes. * @param {object} param * @param {string} [param.voiceCallId] - The voice call id - * @param {PARTICIPANT_TYPE} [param.participantType] - The participant type of the call - * @param {DIALER_TYPE} [param.dialerType] - The dialer type of the call + * @param {typeof Constants.PARTICIPANT_TYPE[keyof typeof Constants.PARTICIPANT_TYPE]} [param.participantType] - The participant type of the call + * @param {typeof Constants.DIALER_TYPE[keyof typeof Constants.DIALER_TYPE]} [param.dialerType] - The dialer type of the call * @param {string} [param.parentId] - The parent call id of the call * @param {boolean} [param.isOnHold] * @param {boolean} [param.hasSupervisorBargedIn] @@ -850,8 +850,8 @@ export class PhoneCallAttributes { */ constructor({ voiceCallId, participantType, dialerType, parentId, isOnHold, hasSupervisorBargedIn, isAutoMergeOn, isConsultCall }: { voiceCallId?: string; - participantType?: string; - dialerType?: string; + participantType?: "Agent" | "Initial_Caller" | "Third_Party" | "Supervisor"; + dialerType?: "OutboundPreview" | "None"; parentId?: string; isOnHold?: boolean; hasSupervisorBargedIn?: boolean; @@ -859,10 +859,10 @@ export class PhoneCallAttributes { isConsultCall?: boolean; }); voiceCallId: string; - participantType: string; + participantType: "Agent" | "Initial_Caller" | "Third_Party" | "Supervisor"; parentId: string; isOnHold: boolean; - dialerType: string; + dialerType: "OutboundPreview" | "None"; hasSupervisorBargedIn: boolean; isAutoMergeOn: boolean; isConsultCall: boolean; @@ -876,8 +876,8 @@ export class PhoneCall { * @param {object} param * @param {string} [param.callId] - The unique callId. This is a required parameter * @param {string} [param.connectionId] - optional connectionID representing a call leg. - * @param {CALL_TYPE} [param.callType] - The type of the call, one of the CALL_TYPE values - * @param {CALL_SUBTYPE} [param.callSubtype] - The subtype of the call, one of the CALL_SUBTYPE values + * @param {typeof Constants.CALL_TYPE[keyof typeof Constants.CALL_TYPE]} [param.callType] - The type of the call, one of the CALL_TYPE values + * @param {typeof Constants.CALL_SUBTYPE[keyof typeof Constants.CALL_SUBTYPE]} [param.callSubtype] - The subtype of the call, one of the CALL_SUBTYPE values * @param {Contact} [param.contact] - The Call Target / Contact . TODO: to be deprecated, replace with toContact * @param {string} [param.state] - The state of the call, i.e. ringing, connected, declined, failed * @param {PhoneCallAttributes} [param.callAttributes] - Any additional call attributes @@ -893,8 +893,8 @@ export class PhoneCall { constructor({ callId, callType, callSubtype, contact, state, callAttributes, phoneNumber, callInfo, reason, closeCallOnError, agentStatus, agentARN, fromContact, toContact, connectionId }: { callId?: string; connectionId?: string; - callType?: string; - callSubtype?: string; + callType?: "Inbound" | "Outbound" | "Callback" | "AddParticipant" | "Transfer" | "InternalCall" | "DialedCallback" | "Consult"; + callSubtype?: "PSTN" | "WebRTC"; contact?: Contact; state?: string; callAttributes?: PhoneCallAttributes; @@ -909,8 +909,8 @@ export class PhoneCall { }); callId: string; connectionId: string; - callType: string; - callSubtype: string; + callType: "Inbound" | "Outbound" | "Callback" | "AddParticipant" | "Transfer" | "InternalCall" | "DialedCallback" | "Consult"; + callSubtype: "PSTN" | "WebRTC"; phoneNumber: string; callInfo: CallInfo; contact: Contact; @@ -950,11 +950,11 @@ export class TelephonyConnector { /** * End call * @param {PhoneCall} call - The call to be ended - * @param {AGENT_STATUS} agentStatus + * @param {typeof Constants.AGENT_STATUS[keyof typeof Constants.AGENT_STATUS]} agentStatus * @returns {Promise} * */ - endCall(call: PhoneCall, agentStatus: string): Promise; + endCall(call: PhoneCall, agentStatus: "Online" | "Offline" | "AfterCallWork"): Promise; /** * Mute call * @param {PhoneCall} call (an optional participant call to mute) @@ -1106,13 +1106,13 @@ export class VendorConnector { onAgentWorkEvent(agentWork: AgentWork): void; /** * Set agent status - * @param {AGENT_STATUS} agentStatus + * @param {typeof Constants.AGENT_STATUS[keyof typeof Constants.AGENT_STATUS]} agentStatus * @param {AgentStatusInfo} statusInfo * @param {Boolean} enqueueNextState - flag to determine if this status change request should be enqueued if neccessary * @returns {Promise} * */ - setAgentStatus(agentStatus: string, statusInfo: AgentStatusInfo, enqueueNextState: boolean): Promise; + setAgentStatus(agentStatus: "Online" | "Offline" | "AfterCallWork", statusInfo: AgentStatusInfo, enqueueNextState: boolean): Promise; /** * Get agent status * @returns {Promise} @@ -1137,11 +1137,11 @@ export class VendorConnector { /** * Sends the logs with a logLevel and payload to the vendor connector. * Does a no-op, if not implemented. - * @param {String} logLevel Log Level (INFO, WARN, ERROR) + * @param {typeof Constants.LOG_LEVEL[keyof typeof Constants.LOG_LEVEL]} logLevel Log Level (INFO, WARN, ERROR) // Note: LOG_LEVEL constants does not include "WARN" * @param {String} message Message to be logged * @param {Object} payload An optional payload to be logged */ - logMessageToVendor(logLevel: string, message: string, payload: any): void; + logMessageToVendor(logLevel: "ERROR" | "INFO", message: string, payload: any): void; /** * To get the Contacts for this workItem's transfer/other channel operation * @param {ContactsFilter} filter It has fields like the search term and contact Type @@ -1178,14 +1178,14 @@ export class AgentWork { * @param {object} param * @param {string} [param.workItemId] - Salesforce agent work item Id * @param {string} [param.workId] - Salesforce work Id - * @param {WORK_EVENT} [param.workEvent] - The work lifecycle event + * @param {typeof Constants.WORK_EVENT[keyof typeof Constants.WORK_EVENT]} [param.workEvent] - The work lifecycle event */ constructor({ workItemId, workId, workEvent }: { workItemId?: string; workId?: string; - workEvent?: string; + workEvent?: "ASSIGNED" | "ACCEPTED" | "DECLINED" | "COMPLETED" | "CLOSED" | "PAUSED" | "UNPAUSED"; }); - workEvent: string; + workEvent: "ASSIGNED" | "ACCEPTED" | "DECLINED" | "COMPLETED" | "CLOSED" | "PAUSED" | "UNPAUSED"; workItemId: string; workId: string; } @@ -1261,7 +1261,7 @@ export class SupervisedCallInfo { * @param {string} [param.callId] - The unique supervised vendor call ID (required) * @param {string} [param.connectionId] - optional connectionID representing a call leg. * @param {string} [param.voiceCallId] - The supervised salesforce voice call ID - * @param {string} [param.callType] - The type of the call, one of the CALL_TYPE values + * @param {typeof Constants.CALL_TYPE[keyof typeof Constants.CALL_TYPE]} [param.callType] - The type of the call, one of the CALL_TYPE values * @param {string} [param.from] - From phone number (for Inbound calls) * @param {string} [param.to] - To phone number (for Outbound calls) * @param {string} [param.supervisorName] - The supervisor name (shown to the supervised agent on barge in) @@ -1271,7 +1271,7 @@ export class SupervisedCallInfo { callId?: string; connectionId?: string; voiceCallId?: string; - callType?: string; + callType?: "Inbound" | "Outbound" | "Callback" | "AddParticipant" | "Transfer" | "InternalCall" | "DialedCallback" | "Consult"; from?: string; to?: string; supervisorName?: string; @@ -1279,7 +1279,7 @@ export class SupervisedCallInfo { }); callId: string; voiceCallId: string; - callType: string; + callType: "Inbound" | "Outbound" | "Callback" | "AddParticipant" | "Transfer" | "InternalCall" | "DialedCallback" | "Consult"; from: string; to: string; supervisorName: string; @@ -1389,7 +1389,7 @@ export class ShowStorageAccessResult { * @param {string} param.contains * @param {number} param.limit * @param {number} param.offset - * @param {CONTACTS_FILTER_TYPES[]} param.types + * @param {Array} param.types */ export class ContactsFilter { constructor(param: any); From bcca94c9a567e47995d861a1a44794ad892f2df7 Mon Sep 17 00:00:00 2001 From: Raith Munro Date: Thu, 28 Aug 2025 16:55:29 +0100 Subject: [PATCH 13/13] Fix publishEvent eventType allowed values --- src/main/baseConnector.js | 2 +- ts-declaration/baseConnector.d.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/baseConnector.js b/src/main/baseConnector.js index d057808..c8c1246 100644 --- a/src/main/baseConnector.js +++ b/src/main/baseConnector.js @@ -992,7 +992,7 @@ export function publishError({ eventType, error }) { /** * Publish an event to Sfdc. The event payload will be verified to be the correct type before being published. * @param {object} param - * @param {("LOGIN_RESULT"|"LOGOUT_RESULT"|"CALL_STARTED"|"QUEUED_CALL_STARTED"|"CALL_CONNECTED"|"HANGUP"|"PARTICIPANT_CONNECTED"|"PARTICIPANT_ADDED"|"PARTICIPANTS_SWAPPED"|"PARTICIPANTS_CONFERENCED"|"MESSAGE"|"MUTE_TOGGLE"|"HOLD_TOGGLE"|"RECORDING_TOGGLE")} param.eventType Event type to publish + * @param {("AFTER_CALL_WORK_STARTED"|"AFTER_CONVERSATION_WORK_ENDED"|"AFTER_CONVERSATION_WORK_STARTED"|"AGENT_CONFIG_UPDATED"|"AGENT_ERROR"|"AUDIO_STATS"|"CALL_BARGED_IN"|"CALL_CONNECTED"|"CALL_FAILED"|"CALL_STARTED"|"CALL_UPDATED"|"ERROR"|"GET_AGENT_STATUS_RESULT"|"GET_AGENT_STATUS"|"GET_AUDIO_DEVICES"|"GET_CONTACTS_RESULT"|"HANGUP"|"HOLD_TOGGLE"|"INFO"|"LOGIN_RESULT"|"LOGIN_STARTED"|"LOGOUT_RESULT"|"MESSAGE"|"MUTE_TOGGLE"|"PARTICIPANT_ADDED"|"PARTICIPANT_CONNECTED"|"PARTICIPANT_REMOVED"|"PARTICIPANT_REMOVED"|"PARTICIPANTS_CONFERENCED"|"PARTICIPANTS_SWAPPED"|"PHONE_CONTACTS"|"QUEUED_CALL_STARTED"|"RECORDING_TOGGLE"|"REMOTE_CONTROLLER"|"SET_AGENT_STATUS_RESULT"|"SET_AGENT_STATUS"|"SHOW_LOGIN"|"SHOW_STORAGE_ACCESS"|"SHOW_TRANSFER_VIEW"|"SIGNED_RECORDING_URL"|"SOFTPHONE_ERROR"|"STATE_CHANGE"|"STORAGE_ACCESS_RESULT"|"SUPERVISOR_BARGED_IN"|"SUPERVISOR_CALL_CONNECTED"|"SUPERVISOR_CALL_STARTED"|"SUPERVISOR_HANGUP"|"UPDATE_AUDIO_STATS_COMPLETED"|"UPDATE_AUDIO_STATS"|"WARNING"|"WRAP_UP_ENDED")} param.eventType Event type to publish * @param {object} param.payload Payload for the event. Must to be an object of the payload class associated with the EVENT_TYPE else the event is NOT dispatched * @param {boolean} param.registerLog Boolean to opt out of registering logs for events * LOGIN_RESULT - GenericResult diff --git a/ts-declaration/baseConnector.d.ts b/ts-declaration/baseConnector.d.ts index 347b7d8..3f98efa 100644 --- a/ts-declaration/baseConnector.d.ts +++ b/ts-declaration/baseConnector.d.ts @@ -28,7 +28,7 @@ export function publishError({ eventType, error }: { /** * Publish an event to Sfdc. The event payload will be verified to be the correct type before being published. * @param {object} param - * @param {("LOGIN_RESULT"|"LOGOUT_RESULT"|"CALL_STARTED"|"QUEUED_CALL_STARTED"|"CALL_CONNECTED"|"HANGUP"|"PARTICIPANT_CONNECTED"|"PARTICIPANT_ADDED"|"PARTICIPANTS_SWAPPED"|"PARTICIPANTS_CONFERENCED"|"MESSAGE"|"MUTE_TOGGLE"|"HOLD_TOGGLE"|"RECORDING_TOGGLE")} param.eventType Event type to publish + * @param {("AFTER_CALL_WORK_STARTED"|"AFTER_CONVERSATION_WORK_ENDED"|"AFTER_CONVERSATION_WORK_STARTED"|"AGENT_CONFIG_UPDATED"|"AGENT_ERROR"|"AUDIO_STATS"|"CALL_BARGED_IN"|"CALL_CONNECTED"|"CALL_FAILED"|"CALL_STARTED"|"CALL_UPDATED"|"ERROR"|"GET_AGENT_STATUS_RESULT"|"GET_AGENT_STATUS"|"GET_AUDIO_DEVICES"|"GET_CONTACTS_RESULT"|"HANGUP"|"HOLD_TOGGLE"|"INFO"|"LOGIN_RESULT"|"LOGIN_STARTED"|"LOGOUT_RESULT"|"MESSAGE"|"MUTE_TOGGLE"|"PARTICIPANT_ADDED"|"PARTICIPANT_CONNECTED"|"PARTICIPANT_REMOVED"|"PARTICIPANT_REMOVED"|"PARTICIPANTS_CONFERENCED"|"PARTICIPANTS_SWAPPED"|"PHONE_CONTACTS"|"QUEUED_CALL_STARTED"|"RECORDING_TOGGLE"|"REMOTE_CONTROLLER"|"SET_AGENT_STATUS_RESULT"|"SET_AGENT_STATUS"|"SHOW_LOGIN"|"SHOW_STORAGE_ACCESS"|"SHOW_TRANSFER_VIEW"|"SIGNED_RECORDING_URL"|"SOFTPHONE_ERROR"|"STATE_CHANGE"|"STORAGE_ACCESS_RESULT"|"SUPERVISOR_BARGED_IN"|"SUPERVISOR_CALL_CONNECTED"|"SUPERVISOR_CALL_STARTED"|"SUPERVISOR_HANGUP"|"UPDATE_AUDIO_STATS_COMPLETED"|"UPDATE_AUDIO_STATS"|"WARNING"|"WRAP_UP_ENDED")} param.eventType Event type to publish * @param {object} param.payload Payload for the event. Must to be an object of the payload class associated with the EVENT_TYPE else the event is NOT dispatched * @param {boolean} param.registerLog Boolean to opt out of registering logs for events * LOGIN_RESULT - GenericResult @@ -48,7 +48,7 @@ export function publishError({ eventType, error }: { * AUDIO_STATS - AudioStats */ export function publishEvent({ eventType, payload, registerLog }: { - eventType: ("LOGIN_RESULT" | "LOGOUT_RESULT" | "CALL_STARTED" | "QUEUED_CALL_STARTED" | "CALL_CONNECTED" | "HANGUP" | "PARTICIPANT_CONNECTED" | "PARTICIPANT_ADDED" | "PARTICIPANTS_SWAPPED" | "PARTICIPANTS_CONFERENCED" | "MESSAGE" | "MUTE_TOGGLE" | "HOLD_TOGGLE" | "RECORDING_TOGGLE"); + eventType: ("AFTER_CALL_WORK_STARTED" | "AFTER_CONVERSATION_WORK_ENDED" | "AFTER_CONVERSATION_WORK_STARTED" | "AGENT_CONFIG_UPDATED" | "AGENT_ERROR" | "AUDIO_STATS" | "CALL_BARGED_IN" | "CALL_CONNECTED" | "CALL_FAILED" | "CALL_STARTED" | "CALL_UPDATED" | "ERROR" | "GET_AGENT_STATUS_RESULT" | "GET_AGENT_STATUS" | "GET_AUDIO_DEVICES" | "GET_CONTACTS_RESULT" | "HANGUP" | "HOLD_TOGGLE" | "INFO" | "LOGIN_RESULT" | "LOGIN_STARTED" | "LOGOUT_RESULT" | "MESSAGE" | "MUTE_TOGGLE" | "PARTICIPANT_ADDED" | "PARTICIPANT_CONNECTED" | "PARTICIPANT_REMOVED" | "PARTICIPANT_REMOVED" | "PARTICIPANTS_CONFERENCED" | "PARTICIPANTS_SWAPPED" | "PHONE_CONTACTS" | "QUEUED_CALL_STARTED" | "RECORDING_TOGGLE" | "REMOTE_CONTROLLER" | "SET_AGENT_STATUS_RESULT" | "SET_AGENT_STATUS" | "SHOW_LOGIN" | "SHOW_STORAGE_ACCESS" | "SHOW_TRANSFER_VIEW" | "SIGNED_RECORDING_URL" | "SOFTPHONE_ERROR" | "STATE_CHANGE" | "STORAGE_ACCESS_RESULT" | "SUPERVISOR_BARGED_IN" | "SUPERVISOR_CALL_CONNECTED" | "SUPERVISOR_CALL_STARTED" | "SUPERVISOR_HANGUP" | "UPDATE_AUDIO_STATS_COMPLETED" | "UPDATE_AUDIO_STATS" | "WARNING" | "WRAP_UP_ENDED"); payload: object; registerLog: boolean; }): Promise;