-
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(tracking): add use ovh tracking in generator
ref: MANAGER-13929 Signed-off-by: Alex Boungnaseng <alex.boungnaseng.ext@corp.ovh.com>
- Loading branch information
1 parent
625c64e
commit d2c01a6
Showing
12 changed files
with
184 additions
and
60 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
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
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
19 changes: 10 additions & 9 deletions
19
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,31 +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 { | ||
useOvhTracking, | ||
useRouteSynchro, | ||
} from '@ovh-ux/manager-react-shell-client'; | ||
import { LEVEL2 } from './../tracking.constant'; | ||
|
||
export default function Layout() { | ||
const location = useLocation(); | ||
const routing = useRouting(); | ||
const { shell } = useContext(ShellContext); | ||
const matches = useMatches(); | ||
const { trackCurrentPage } = useOvhTracking(); | ||
useRouteSynchro(); | ||
|
||
useEffect(() => { | ||
const match = matches.slice(-1); | ||
defineCurrentPage(`app.{{appName}}-${match[0]?.id}`); | ||
}, [location]); | ||
|
||
useEffect(() => { | ||
shell.ux.hidePreloader(); | ||
}, []); | ||
trackCurrentPage(); | ||
}, [location]); | ||
|
||
useEffect(() => { | ||
routing.stopListenForHashChange(); | ||
shell.ux.hidePreloader(); | ||
}, []); | ||
|
||
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
20 changes: 20 additions & 0 deletions
20
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export const LEVEL2 = { | ||
EU: { | ||
config: { | ||
level2: '{{level2}}', | ||
}, | ||
}, | ||
CA: { | ||
config: { | ||
level2: '{{level2}}', | ||
}, | ||
}, | ||
US: { | ||
config: { | ||
level2: '{{level2}}', | ||
}, | ||
}, | ||
}; | ||
export const UNIVERSE = '{{universe}}'; | ||
export const SUB_UNIVERSE = '{{subuniverse}}'; | ||
export const APP_NAME = '{{appName}}' |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
export const UNIVERSES = [ | ||
'Dedicated', | ||
'Focus', | ||
'Manager', | ||
'Web', | ||
'Server', | ||
'Hub', | ||
'Creation', | ||
'Baremetal', | ||
'HostedPrivatedCloud', | ||
'PublicCloud', | ||
'WebCloud', | ||
'Telecom', | ||
'Sunrise', | ||
'Account-creation', | ||
]; | ||
export const SUB_UNIVERSES = [ | ||
'Dedicated', | ||
'Focus', | ||
'Manager', | ||
'Web', | ||
'Server', | ||
'Hub', | ||
'Creation', | ||
'Network', | ||
'HostedPrivatedCloud', | ||
'PublicCloud', | ||
'WebCloud', | ||
'Telecom', | ||
'Sunrise', | ||
'Account-creation', | ||
]; | ||
export const LEVEL2 = { | ||
0: '', | ||
56: 'ManagerCloud', | ||
57: 'ManagerDedicated', | ||
67: 'Focus', | ||
81: 'Manager', | ||
84: 'ManagerWeb', | ||
85: 'ManagerServer', | ||
86: 'ManagerPublicCloud', | ||
87: 'ManagerTelecom', | ||
88: 'ManagerHub', | ||
95: 'account-creation', | ||
98: 'ManagerHostedPrivateCloud', | ||
}; |
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
Oops, something went wrong.