Feature: As an end-user, I should be able to see the list of agents in the widget. (#461)
Co-authored-by: Pranav Raj S <pranavrajs@gmail.com>
This commit is contained in:
parent
33e0bd434b
commit
83b0bb4062
20 changed files with 406 additions and 34 deletions
|
@ -18,3 +18,20 @@ export const IFrameHelper = {
|
|||
);
|
||||
},
|
||||
};
|
||||
|
||||
export const getAvailableAgentsText = (agents = []) => {
|
||||
const count = agents.length;
|
||||
if (count === 1) {
|
||||
const [agent] = agents;
|
||||
return `${agent.name} is available`;
|
||||
}
|
||||
|
||||
if (count === 2) {
|
||||
const [first, second] = agents;
|
||||
return `${first.name} and ${second.name} is available`;
|
||||
}
|
||||
|
||||
const [agent] = agents;
|
||||
const rest = agents.length - 1;
|
||||
return `${agent.name} and ${rest} others are available`;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue