Passing custom attributes

Passing the slate user id and username as a custom Intercom attribute.

Also added the popup toggle in the ApplicationUserControls, so the popup closes when the user opens intercom
This commit is contained in:
jasonleyser 2021-06-29 10:48:21 -06:00 committed by Martina
parent b935e1855b
commit b07bfd0f35
2 changed files with 17 additions and 4 deletions

View File

@ -107,12 +107,16 @@ const OpenIntercom = ({ user }) => {
return (
<span
style={{ cursor: "pointer" }}
style={{ cursor: "pointer", display: "block" }}
onClick={() => {
onTogglePopup();
update({
name: user.data.name,
username: user.username,
email: user.email,
customAttributes: {
slate_userid: user.id,
username: user.username,
},
});
show();
}}
@ -234,7 +238,13 @@ export class ApplicationUserControlsPopup extends React.Component {
],
[
{
text: <OpenIntercom style={{ display: "block" }} user={this.props.viewer} />,
text: (
<OpenIntercom
style={{ display: "block" }}
user={this.props.viewer}
onTogglePopup={this.props.onTogglePopup}
/>
),
},
{
text: "Sign out",

View File

@ -286,8 +286,11 @@ const OpenIntercom = ({ user }) => {
onClick={() => {
update({
name: user.data.name,
username: user.username,
email: user.email,
customAttributes: {
slate_userid: user.id,
username: user.username
}
});
show()
}