Skip to content

Commit

Permalink
Fix agent icon for messages and header (#149)
Browse files Browse the repository at this point in the history
* Set banner as initial of agent name

* Add build files

* Add build files

* Add alias flag to determine when to use agent name icon

* Add build files
  • Loading branch information
bhardwajaditya authored Jun 21, 2022
1 parent 470f732 commit ca92216
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 9 deletions.
2 changes: 2 additions & 0 deletions build/63.chunk.61a2a.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build/63.chunk.61a2a.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions build/63.chunk.eb080.js

This file was deleted.

1 change: 0 additions & 1 deletion build/63.chunk.eb080.js.map

This file was deleted.

4 changes: 2 additions & 2 deletions build/bundle.1675e.js → build/bundle.fa2ae.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/bundle.1675e.js.map → build/bundle.fa2ae.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html><head><meta charset="utf-8"><title></title><meta name="viewport" content="width=device-width,initial-scale=1"></head><body><script src="livechat/0.chunk.16385.js"></script><script src="livechat/polyfills.caf00.js"></script><script src="livechat/vendors~bundle.chunk.76887.js"></script><script src="livechat/bundle.1675e.js"></script></body></html>
<!doctype html><html><head><meta charset="utf-8"><title></title><meta name="viewport" content="width=device-width,initial-scale=1"></head><body><script src="livechat/0.chunk.16385.js"></script><script src="livechat/polyfills.caf00.js"></script><script src="livechat/vendors~bundle.chunk.76887.js"></script><script src="livechat/bundle.fa2ae.js"></script></body></html>
6 changes: 5 additions & 1 deletion src/lib/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ const transformAgentInformationOnMessage = (message) => {
return { ...message, u: { _id: message.u._id } };
}

if (message && message.u && message.u._id !== user._id && message.customFields && message.customFields.salesforceAgentName) {
return { ...message, alias: true, u: { ...message.u, name: message.customFields.salesforceAgentName } };
}

return message;
};

Expand All @@ -239,7 +243,7 @@ const handleMessageCustomFields = async (message) => {
}
if (message.customFields.salesforceAgentName) {
const { agent } = store.state;
await store.setState({ agent: { ...agent, name: message.customFields.salesforceAgentName } });
await store.setState({ agent: { ...agent, name: message.customFields.salesforceAgentName, alias: true } });
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/routes/Chat/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ export const ChatConnector = ({ ref, ...props }) => (
phone: (agent.phone && agent.phone[0] && agent.phone[0].phoneNumber) || (agent.customFields && agent.customFields.phone),
avatar: agent.username ? {
description: agent.username,
src: getAvatarUrl(agent.username),
src: getAvatarUrl((agent.alias && agent.name) || agent.username),
} : undefined,
} : undefined}
room={room}
Expand Down

0 comments on commit ca92216

Please sign in to comment.