diff --git a/.env b/.env index 556d86c..ac60ba1 100644 --- a/.env +++ b/.env @@ -1,2 +1,9 @@ -VITE_FOO=bar +# Feature flags VITE_FEATURE_MIXPANEL=true +VITE_FEATURE_CHATWOOT=false + +VITE_FOO=bar + +# chat woot +VITE_CHATWOOT_TOKEN=jmoXp9BPMSPEYHeJX5YKT15Q +VITE_CHATWOOT_URL=https://app.chatwoot.com diff --git a/src/App.tsx b/src/App.tsx index 29ce22c..f070c74 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,6 +2,7 @@ import './App.css' import { Center } from '@chakra-ui/react' import { createBrowserRouter, RouterProvider } from 'react-router-dom' +import { ChatwootButton } from 'components/Chatwoot' import { SelectPair } from 'components/SelectPair' import { Status } from 'components/Status/Status' import { TradeInput } from 'components/TradeInput' @@ -27,6 +28,7 @@ function App() { return (
+
) } diff --git a/src/components/Chatwoot.tsx b/src/components/Chatwoot.tsx new file mode 100644 index 0000000..19b54f3 --- /dev/null +++ b/src/components/Chatwoot.tsx @@ -0,0 +1,38 @@ +import { Button } from '@chakra-ui/react' +import { useCallback, useEffect } from 'react' + +export const ChatwootButton: React.FC = () => { + const chatWootEnabled = import.meta.env.VITE_FEATURE_CHATWOOT + useEffect(() => { + if (!chatWootEnabled) return // Add Chatwoot Settings + ;(window as any).chatwootSettings = { + hideMessageBubble: true, + position: 'left', // This can be left or right + locale: 'en', // Language to be set + type: 'standard', // [standard, expanded_bubble] + } + + // Paste the script from inbox settings except the