-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(generator): implemente useovhtracking hook
ref: MANAGER-13929 Signed-off-by: Alex Boungnaseng <alex.boungnaseng.ext@corp.ovh.com>
- Loading branch information
1 parent
b512795
commit eb0daf0
Showing
11 changed files
with
70 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/manager/core/generator/app/conditional-templates/onboarding/index.tsx.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 0 additions & 86 deletions
86
packages/manager/core/generator/app/templates/src/hooks/useCustomTracking.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 6 additions & 14 deletions
20
packages/manager/core/generator/app/templates/src/pages/layout.tsx.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,32 @@ | ||
import React, { useEffect, useContext } from 'react'; | ||
import { defineCurrentPage } from '@ovh-ux/request-tagger'; | ||
import { Outlet, useLocation, useMatches } from 'react-router-dom'; | ||
import { useRouting } from '@ovh-ux/manager-react-shell-client'; | ||
import { ShellContext } from '@ovh-ux/manager-react-shell-client'; | ||
|
||
import { | ||
useOvhCustomTracking, | ||
} from '@/hooks/useCustomTracking'; | ||
useOvhTracking, | ||
useRouteSynchro, | ||
} from '@ovh-ux/manager-react-shell-client'; | ||
|
||
export default function Layout() { | ||
const location = useLocation(); | ||
const routing = useRouting(); | ||
const { shell } = useContext(ShellContext); | ||
const matches = useMatches(); | ||
const { trackClick } = useOvhCustomTracking(); | ||
const { trackCurrentPage } = useOvhTracking(); | ||
useRouteSynchro(); | ||
|
||
useEffect(() => { | ||
const match = matches.slice(-1); | ||
defineCurrentPage(`app.{{appName}}-${match[0]?.id}`); | ||
}, [location]); | ||
|
||
useEffect(() => { | ||
trackPage(); | ||
trackCurrentPage(); | ||
}, [location]); | ||
|
||
useEffect(() => { | ||
shell.ux.hidePreloader(); | ||
}, []); | ||
|
||
useEffect(() => { | ||
routing.stopListenForHashChange(); | ||
}, []); | ||
|
||
useEffect(() => { | ||
routing.onHashChange(); | ||
}, [location]); | ||
|
||
return <Outlet />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
packages/manager/core/generator/app/templates/src/tracking.constant.ts.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
export const LEVEL2 = '86'; | ||
export const UNIVERSE = '{{universe}}'; | ||
export const SUBUNIVERSE = '{{subuniverse}}'; | ||
export const SUB_UNIVERSE = '{{subuniverse}}'; | ||
export const APP_NAME = '{{appName}}' | ||
export const PAGE_PREFIX = [UNIVERSE, SUBUNIVERSE, APP_NAME].join('::'); |
Oops, something went wrong.