From 81e57afcf495ffcc8ab232245d291223df2b85a3 Mon Sep 17 00:00:00 2001 From: Nafees Nazik <84864519+G3root@users.noreply.github.com> Date: Tue, 23 May 2023 04:32:54 +0530 Subject: [PATCH] fix: user undefined (#9022) --- packages/features/ee/support/lib/intercom/useIntercom.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/features/ee/support/lib/intercom/useIntercom.ts b/packages/features/ee/support/lib/intercom/useIntercom.ts index bbf6391f37..76e7a68e1d 100644 --- a/packages/features/ee/support/lib/intercom/useIntercom.ts +++ b/packages/features/ee/support/lib/intercom/useIntercom.ts @@ -35,9 +35,9 @@ export const useIntercom = () => { } hookData.boot({ - name: data?.name ?? "", - email: data?.email, - userId: String(data?.id), + ...(data && data?.name && { name: data.name }), + ...(data && data?.email && { email: data.email }), + ...(data && data?.id && { userId: data.id }), createdAt: String(dayjs(data?.createdDate).unix()), ...(userHash && { userHash }), customAttributes: { @@ -50,6 +50,7 @@ export const useIntercom = () => { has_paid_plan: hasPaidPlan, has_team_plan: hasTeamPlan, metadata: data?.metadata, + is_logged_in: !!data, }, }); hookData.show();