From b5f17dc7a6f706a302d01fc129f5bf7edf6d8471 Mon Sep 17 00:00:00 2001
From: Mo Tarbin <mhed.t91@gmail.com>
Date: Sun, 4 Aug 2024 22:34:49 -0400
Subject: Update dependencies and configuration files to support the use
 OpenReply to do Session replay

---
 src/App.jsx | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'src/App.jsx')

diff --git a/src/App.jsx b/src/App.jsx
index e436ecc..de8a3dd 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -1,5 +1,6 @@
 import NavBar from '@/views/components/NavBar'
 import { Button, Snackbar, Typography, useColorScheme } from '@mui/joy'
+import Tracker from '@openreplay/tracker'
 import { useEffect, useState } from 'react'
 import { Outlet } from 'react-router-dom'
 import { useRegisterSW } from 'virtual:pwa-register/react'
@@ -19,6 +20,8 @@ const remove = className => {
 const intervalMS = 5 * 60 * 1000 // 5 minutes
 
 function App() {
+  startOpenReplay()
+
   const { mode, systemMode } = useColorScheme()
   const [userProfile, setUserProfile] = useState(null)
   const [showUpdateSnackbar, setShowUpdateSnackbar] = useState(true)
@@ -115,4 +118,11 @@ function App() {
   )
 }
 
+const startOpenReplay = () => {
+  if (!import.meta.env.VITE_OPENREPLAY_PROJECT_KEY) return
+  const tracker = new Tracker({
+    projectKey: import.meta.env.VITE_OPENREPLAY_PROJECT_KEY,
+  })
+  tracker.start()
+}
 export default App
-- 
cgit 

