Skip to content

Commit bf447d2

Browse files
bidahclaude
andcommitted
✨ feat: add Intercom chat widget to project pages
Integrates Intercom messenger on p/[id] pages with user identity (id, name, email, createdAt). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 64a237c commit bf447d2

5 files changed

Lines changed: 60 additions & 15 deletions

File tree

‎.gitignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,7 @@ remotion/
6767

6868
# Screen references
6969
screen_references/
70+
71+
# Claude Code
72+
.claude/scheduled_tasks.lock
73+
.claude/worktrees/

‎apps/web/app/(app)/p/[id]/project-page-wrapper.tsx‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22

33
import dynamic from 'next/dynamic'
44
import Loading from './loading'
5+
import { IntercomWidget } from '@/components/intercom-widget'
56

67
const ProjectPage = dynamic(
78
() => import('./project-page').then((mod) => mod.ProjectPageInternal),
89
{ ssr: false, loading: () => <Loading /> },
910
)
1011

1112
export function ProjectPageWrapper({ opencodeEnabled, template }: { opencodeEnabled: boolean; template: 'expo-testing' | 'react-native-expo' }) {
12-
return <ProjectPage opencodeEnabled={opencodeEnabled} template={template} />
13+
return (
14+
<>
15+
<IntercomWidget />
16+
<ProjectPage opencodeEnabled={opencodeEnabled} template={template} />
17+
</>
18+
)
1319
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use client'
2+
3+
import Intercom from '@intercom/messenger-js-sdk'
4+
import { useEffect } from 'react'
5+
import { useSession } from '@/lib/auth/client'
6+
7+
export function IntercomWidget() {
8+
const { data: session } = useSession()
9+
const user = session?.user
10+
11+
useEffect(() => {
12+
if (user) {
13+
Intercom({
14+
app_id: 'tuks5afn',
15+
user_id: user.id,
16+
name: user.name,
17+
email: user.email,
18+
created_at: user.createdAt ? Math.floor(new Date(user.createdAt).getTime() / 1000) : undefined,
19+
})
20+
} else {
21+
Intercom({ app_id: 'tuks5afn' })
22+
}
23+
}, [user])
24+
25+
return null
26+
}

‎apps/web/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@heroui/system": "^2.4.23",
2929
"@heroui/tabs": "^2.2.24",
3030
"@heroui/theme": "^2.4.23",
31+
"@intercom/messenger-js-sdk": "^0.0.18",
3132
"@monaco-editor/react": "^4.7.0",
3233
"@neondatabase/serverless": "^1.0.1",
3334
"@octokit/rest": "^22.0.0",

‎pnpm-lock.yaml‎

Lines changed: 22 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)