Skip to content

Commit

Permalink
Merge pull request #224 from zimmerman-team/chore/livesseion
Browse files Browse the repository at this point in the history
chore: use livesession sdk
  • Loading branch information
Psami-wondah committed Sep 5, 2024
2 parents 330e23b + 42dbe7d commit ec02f57
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@draft-js-plugins/text-alignment": "^2.0.1",
"@draft-js-plugins/undo": "^4.1.3",
"@hookform/resolvers": "^3.3.0",
"@livesession/sdk": "^1.1.4",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.57",
Expand Down
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
</script>
<!-- end of linkedIn track tag -->
<!-- LiveSession.io code -->
<script type="text/javascript">
<!-- <script type="text/javascript">
if (
window.location.hostname === "dataxplorer.org" ||
window.location.hostname === "www.dataxplorer.org"
Expand Down Expand Up @@ -195,7 +195,7 @@
__ls("init", "2db6e1f8.99b8c0c5", { keystrokes: false });
__ls("newPageView");
}
</script>
</script> -->
<!-- END LiveSession.io code -->
</head>
<body>
Expand Down
2 changes: 2 additions & 0 deletions src/app/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import React, { Suspense, lazy } from "react";
import { socialAuth } from "app/utils/socialAuth";
import { useScrollToTop } from "app/hooks/useScrollToTop";
import { useRouteListener } from "app/hooks/useRouteListener";
import { PageLoader } from "app/modules/common/page-loader";
import { RouteWithAppBar } from "app/utils/RouteWithAppBar";
import { Route, Switch, useHistory } from "react-router-dom";
Expand Down Expand Up @@ -216,6 +217,7 @@ const IntercomBootupComponent = () => {

export function MainRoutes() {
useScrollToTop();
useRouteListener();

return (
<Auth0ProviderWithRedirectCallback
Expand Down
16 changes: 16 additions & 0 deletions src/app/hooks/useRouteListener.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";
import ls from "@livesession/sdk";
import { useLocation } from "react-router-dom";

export const useRouteListener = () => {
const location = useLocation();

React.useEffect(() => {
if (window.location.hostname === "dataxplorer.org") {
ls.init(process.env.REACT_APP_LIVE_SESSION_ID as string);
ls.newPageView();
}
}, [location.pathname]);

return null;
};
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1729,6 +1729,11 @@
resolved "https://registry.yarnpkg.com/@juggle/resize-observer/-/resize-observer-3.4.0.tgz#08d6c5e20cf7e4cc02fd181c4b0c225cd31dbb60"
integrity sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==

"@livesession/sdk@^1.1.4":
version "1.1.4"
resolved "https://registry.yarnpkg.com/@livesession/sdk/-/sdk-1.1.4.tgz#e8c020faffe4b51308a6b0bf404a1871f246a595"
integrity sha512-xyiDd3M9wx5k586BIQRcVxSJP5/2XWF9Ca1seLGRSaFoV8o270p5Mn5kpceZFN4STzlYubiMcrPZFFSNWEceVw==

"@material-ui/core@^4.11.3":
version "4.12.3"
resolved "https://registry.npmjs.org/@material-ui/core/-/core-4.12.3.tgz"
Expand Down

0 comments on commit ec02f57

Please sign in to comment.