From d3fcb1cf4fae969c7a4e9a6d392f9a72eb375410 Mon Sep 17 00:00:00 2001 From: Lucian Date: Wed, 18 Sep 2024 08:42:50 -0600 Subject: [PATCH] fix(app): get rid of intercom user id, use address as name (#2883) --- app/context/datastoreConnectionContext.tsx | 3 +-- app/hooks/useIntercom.tsx | 8 +++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/context/datastoreConnectionContext.tsx b/app/context/datastoreConnectionContext.tsx index b90a5d27dc..7772c837da 100644 --- a/app/context/datastoreConnectionContext.tsx +++ b/app/context/datastoreConnectionContext.tsx @@ -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) { diff --git a/app/hooks/useIntercom.tsx b/app/hooks/useIntercom.tsx index 59c7799bdc..034360c60a 100644 --- a/app/hooks/useIntercom.tsx +++ b/app/hooks/useIntercom.tsx @@ -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, }); }; @@ -28,7 +26,7 @@ export const useIntercom = () => { }, []); const onDisconnect = useCallback(() => { - updateIntercomUserData({ did: undefined, hash: undefined }); + updateIntercomUserData({ address: undefined }); }, []); useEffect(() => {