@@ -9,10 +9,13 @@ import { usePostHog } from 'posthog-js/react'
99import { useShortcutStore } from '@/lib/stores/shortcutStore'
1010import { useConnectedStore } from '@/lib/stores/connectedStore'
1111import { useProfile } from '@/api/hooks/useProfile'
12+ import { useLicenseWithDevices } from '@/api/hooks/useLicense'
1213import { useWorkerPolling } from '@/hooks/useWorkerPolling'
1314import { useCreateNotification , useGetNotificationBySentId } from '@/api/hooks/useNotifications'
1415import { isFocusScheduleFeatureEnabled } from '@/lib/utils/environment.util'
1516
17+
18+
1619export const useInitializeAppState = ( ) => {
1720 useProfile ( )
1821 useWorkerPolling ( )
@@ -21,6 +24,7 @@ export const useInitializeAppState = () => {
2124 const { beginCheckForUpdates } = useUpdate ( )
2225 const { user } = useAuth ( )
2326 const { profile } = useProfile ( )
27+ const { data : licenseData } = useLicenseWithDevices ( user ?. id || null )
2428 const { setConnected } = useConnectedStore ( )
2529 const { loadShortcutFromStorage } = useShortcutStore ( )
2630 const { mutate : createNotification } = useCreateNotification ( )
@@ -50,15 +54,19 @@ export const useInitializeAppState = () => {
5054 init ( )
5155 } , [ ] )
5256
57+
5358 useEffect ( ( ) => {
5459 if ( user && profile ?. latitude && profile ?. longitude ) {
5560 setConnected ( true )
5661 posthog . identify ( user . id , {
5762 email : user . email ,
63+ created_at : user . created_at ,
64+ subscription_status : licenseData ?. license ?. status || 'free' ,
65+ last_check_in : profile . last_check_in ,
66+ full_name : user . user_metadata ?. full_name
5867 } )
5968 }
60-
61- } , [ user , posthog , profile ] )
69+ } , [ user , posthog , profile , licenseData ] )
6270
6371
6472
0 commit comments