2022-11-15 09:35:48 +01:00
|
|
|
import { useTypebot } from '@/features/editor'
|
|
|
|
|
import { useUser } from '@/features/account'
|
|
|
|
|
import { useWorkspace } from '@/features/workspace'
|
2023-02-21 15:25:14 +01:00
|
|
|
import React from 'react'
|
|
|
|
|
import { Bubble } from '@typebot.io/react'
|
2022-11-15 09:35:48 +01:00
|
|
|
import { planToReadable } from '@/features/billing'
|
2023-02-21 15:25:14 +01:00
|
|
|
import { isCloudProdInstance } from '@/utils/helpers'
|
2022-02-14 11:33:38 +01:00
|
|
|
|
|
|
|
|
export const SupportBubble = () => {
|
2022-02-18 17:15:18 +01:00
|
|
|
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
|
|
|
|
2023-02-21 15:25:14 +01:00
|
|
|
if (!isCloudProdInstance) return null
|
2022-02-14 11:33:38 +01:00
|
|
|
|
2023-02-21 15:25:14 +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
|
|
|
}
|