|
|
|
@ -45,9 +45,9 @@ export function withPerformanceLogging<TFunc extends (...args: any[]) => Promise |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export async function isNewUser(userId: number) { |
|
|
|
export async function isNewUser() { |
|
|
|
try { |
|
|
|
try { |
|
|
|
const { createdAt } = await getBackendSrv().get(`/api/users/${userId}`); |
|
|
|
const { createdAt } = await getBackendSrv().get(`/api/user`); |
|
|
|
|
|
|
|
|
|
|
|
const limitDateForNewUser = dateTime().subtract(USER_CREATION_MIN_DAYS, 'days'); |
|
|
|
const limitDateForNewUser = dateTime().subtract(USER_CREATION_MIN_DAYS, 'days'); |
|
|
|
const userCreationDate = dateTime(createdAt); |
|
|
|
const userCreationDate = dateTime(createdAt); |
|
|
|
@ -61,7 +61,7 @@ export async function isNewUser(userId: number) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const trackNewAlerRuleFormSaved = async (props: AlertRuleTrackingProps) => { |
|
|
|
export const trackNewAlerRuleFormSaved = async (props: AlertRuleTrackingProps) => { |
|
|
|
const isNew = await isNewUser(props.user_id); |
|
|
|
const isNew = await isNewUser(); |
|
|
|
if (isNew) { |
|
|
|
if (isNew) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -69,7 +69,7 @@ export const trackNewAlerRuleFormSaved = async (props: AlertRuleTrackingProps) = |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export const trackNewAlerRuleFormCancelled = async (props: AlertRuleTrackingProps) => { |
|
|
|
export const trackNewAlerRuleFormCancelled = async (props: AlertRuleTrackingProps) => { |
|
|
|
const isNew = await isNewUser(props.user_id); |
|
|
|
const isNew = await isNewUser(); |
|
|
|
if (isNew) { |
|
|
|
if (isNew) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -77,7 +77,7 @@ export const trackNewAlerRuleFormCancelled = async (props: AlertRuleTrackingProp |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export const trackNewAlerRuleFormError = async (props: AlertRuleTrackingProps & { error: string }) => { |
|
|
|
export const trackNewAlerRuleFormError = async (props: AlertRuleTrackingProps & { error: string }) => { |
|
|
|
const isNew = await isNewUser(props.user_id); |
|
|
|
const isNew = await isNewUser(); |
|
|
|
if (isNew) { |
|
|
|
if (isNew) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|