2
0
Files
bot/apps/builder/src/components/SupportBubble.tsx

36 lines
1003 B
TypeScript
Raw Normal View History

import { useTypebot } from '@/features/editor'
import { useUser } from '@/features/account'
import { useWorkspace } from '@/features/workspace'
import React from 'react'
import { Bubble } from '@typebot.io/react'
import { planToReadable } from '@/features/billing'
import { isCloudProdInstance } from '@/utils/helpers'
2022-02-14 11:33:38 +01:00
export const SupportBubble = () => {
const { typebot } = useTypebot()
const { user } = useUser()
2022-05-13 15:22:44 -07:00
const { workspace } = useWorkspace()
2022-02-14 11:33:38 +01:00
if (!isCloudProdInstance) return null
2022-02-14 11:33:38 +01:00
return (
<Bubble
apiHost="https://viewer.typebot.io"
typebot="typebot-support"
prefilledVariables={{
'User ID': user?.id,
'First name': user?.name?.split(' ')[0] ?? undefined,
Email: user?.email ?? undefined,
'Typebot ID': typebot?.id,
'Avatar URL': user?.image ?? undefined,
Plan: planToReadable(workspace?.plan),
}}
theme={{
chatWindow: {
backgroundColor: '#fff',
},
}}
/>
)
2022-02-14 11:33:38 +01:00
}