mirror of
https://github.com/strapi/strapi.git
synced 2025-09-27 01:09:49 +00:00
chore: track registered widgets (#23412)
This commit is contained in:
parent
0abebb3869
commit
f345ada2ce
@ -6,6 +6,7 @@ import { useInitQuery, useTelemetryPropertiesQuery } from '../services/admin';
|
|||||||
|
|
||||||
import { useAppInfo } from './AppInfo';
|
import { useAppInfo } from './AppInfo';
|
||||||
import { useAuth } from './Auth';
|
import { useAuth } from './Auth';
|
||||||
|
import { useStrapiApp } from './StrapiApp';
|
||||||
|
|
||||||
export interface TelemetryProperties {
|
export interface TelemetryProperties {
|
||||||
useTypescriptOnServer?: boolean;
|
useTypescriptOnServer?: boolean;
|
||||||
@ -39,6 +40,7 @@ export interface TrackingProviderProps {
|
|||||||
|
|
||||||
const TrackingProvider = ({ children }: TrackingProviderProps) => {
|
const TrackingProvider = ({ children }: TrackingProviderProps) => {
|
||||||
const token = useAuth('App', (state) => state.token);
|
const token = useAuth('App', (state) => state.token);
|
||||||
|
const getAllWidgets = useStrapiApp('TrackingProvider', (state) => state.widgets.getAll);
|
||||||
const { data: initData } = useInitQuery();
|
const { data: initData } = useInitQuery();
|
||||||
const { uuid } = initData ?? {};
|
const { uuid } = initData ?? {};
|
||||||
|
|
||||||
@ -57,7 +59,11 @@ const TrackingProvider = ({ children }: TrackingProviderProps) => {
|
|||||||
event,
|
event,
|
||||||
userId: '',
|
userId: '',
|
||||||
eventPropeties: {},
|
eventPropeties: {},
|
||||||
groupProperties: { ...data, projectId: uuid },
|
groupProperties: {
|
||||||
|
...data,
|
||||||
|
projectId: uuid,
|
||||||
|
registeredWidgets: getAllWidgets().map((widget) => widget.uid),
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@ -68,7 +74,7 @@ const TrackingProvider = ({ children }: TrackingProviderProps) => {
|
|||||||
// silence is golden
|
// silence is golden
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [data, uuid]);
|
}, [data, uuid, getAllWidgets]);
|
||||||
|
|
||||||
const value = React.useMemo(
|
const value = React.useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user