Skip to content

Commit

Permalink
fix(app): get rid of intercom user id, use address as name (#2883)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucianHymer authored Sep 18, 2024
1 parent bd39264 commit d3fcb1c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 1 addition & 2 deletions app/context/datastoreConnectionContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ export const useDatastoreConnection = () => {
try {
const authResponse = await axios.post(`${CERAMIC_CACHE_ENDPOINT}/authenticate`, payloadForVerifier);
const accessToken = authResponse.data?.access as string;
const intercomUserHash = authResponse.data?.intercom_user_hash as string;
updateIntercomUserData({ did, hash: intercomUserHash });
updateIntercomUserData({ address });
setConnectedAddress(address);
return accessToken;
} catch (error) {
Expand Down
8 changes: 3 additions & 5 deletions app/hooks/useIntercom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ import React, { useCallback, useEffect } from "react";
// --- Utils & configs
import { useWeb3ModalAccount } from "@web3modal/ethers/react";
import Intercom, { boot, shutdown } from "@intercom/messenger-js-sdk";
import { DID } from "dids";

const INTERCOM_APP_ID = process.env.NEXT_PUBLIC_INTERCOM_APP_ID || "";

export const updateIntercomUserData = ({ did, hash }: { did?: DID; hash?: string }) => {
export const updateIntercomUserData = ({ address }: { address?: string }) => {
shutdown();
boot({
app_id: INTERCOM_APP_ID,
user_id: did?.id,
user_hash: hash,
name: address,
});
};

Expand All @@ -28,7 +26,7 @@ export const useIntercom = () => {
}, []);

const onDisconnect = useCallback(() => {
updateIntercomUserData({ did: undefined, hash: undefined });
updateIntercomUserData({ address: undefined });
}, []);

useEffect(() => {
Expand Down

0 comments on commit d3fcb1c

Please sign in to comment.