Skip to content

Commit

Permalink
Corrected amazon-connect-streams Agent::onMuteToggle and tests. (Defi…
Browse files Browse the repository at this point in the history
…nitelyTyped#36065)

* Added amazon-connect-streams from v1.3

* Updated Project header to URL for Amazon Connect Streams

* Set strictNullChecks to 'true'

* Corrected amazon-connect-streams onMuteToggle callback object.
  • Loading branch information
andyhopp authored and rbuckton committed Jun 11, 2019
1 parent 23bfb7e commit e94ce02
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion types/amazon-connect-streams/amazon-connect-streams-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ connect.core.initCCP(elem, { ccpUrl: "" }); // $ExpectType void

// Types for below tests
let agentCallback: connect.AgentCallback = () => {};
let muteCallback: connect.MuteCallback = () => {};
let agentConfiguration: connect.AgentConfiguration;
let successFailOptions: connect.SuccessFailOptions;
let agentState: connect.AgentState;
Expand All @@ -20,7 +21,7 @@ connect.agent(agent => {
agent.onOffline(agentCallback); // $ExpectType: void
agent.onError(agentCallback); // $ExpectType: void
agent.onAfterCallWork(agentCallback); // $ExpectType: void
agent.onMuteToggle(agentCallback); // $ExpectType: void
agent.onMuteToggle(muteCallback); // $ExpectType: void
agent.getState(); // $ExpectType: AgentState
agent.getStateDuration(); // $ExpectType: number
agent.getContacts(""); // $ExpectType: connect.Contact[]
Expand Down
15 changes: 14 additions & 1 deletion types/amazon-connect-streams/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ declare namespace connect {
*/
type AgentCallback = (agent: Agent) => void;

/**
*
* A callback to receive agent details
*
* @param agent An Agent object containing information about the currently
* signed-in agent.
*/
type MuteCallback = (muteState: MuteState) => void;

/**
* Register a callback to receive agent details
*
Expand Down Expand Up @@ -223,6 +232,10 @@ declare namespace connect {
queueARN?: string;
}

interface MuteState {
muted: boolean;
}

interface Agent {
/**
* Subscribe a method to be called whenever Contact information is about to be updated.
Expand Down Expand Up @@ -273,7 +286,7 @@ declare namespace connect {
*
* @param callback A callback to receive updates on agent mute state
*/
onMuteToggle(callback: AgentCallback): void;
onMuteToggle(callback: MuteCallback): void;

/**
* Get the agent's current AgentState object indicating their availability state type.
Expand Down

0 comments on commit e94ce02

Please sign in to comment.