mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 21:26:40 +00:00
feat(notifications): add notification update posthog telemetry to track
when notifications are clicked / read. also increased popup z index
This commit is contained in:
@@ -3,8 +3,10 @@ import { z } from "zod";
|
|||||||
import { UserNotificationsSchema } from "@app/db/schemas/user-notifications";
|
import { UserNotificationsSchema } from "@app/db/schemas/user-notifications";
|
||||||
import { UnauthorizedError } from "@app/lib/errors";
|
import { UnauthorizedError } from "@app/lib/errors";
|
||||||
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||||
|
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
||||||
|
|
||||||
export const registerNotificationRouter = async (server: FastifyZodProvider) => {
|
export const registerNotificationRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
@@ -97,6 +99,16 @@ export const registerNotificationRouter = async (server: FastifyZodProvider) =>
|
|||||||
...req.body
|
...req.body
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await server.services.telemetry.sendPostHogEvents({
|
||||||
|
event: PostHogEventTypes.NotificationUpdated,
|
||||||
|
distinctId: getTelemetryDistinctId(req),
|
||||||
|
organizationId: req.permission.orgId,
|
||||||
|
properties: {
|
||||||
|
notificationId: req.params.notificationId,
|
||||||
|
...req.body
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return { notification };
|
return { notification };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ export enum PostHogEventTypes {
|
|||||||
IssueSshHostHostCert = "Issue SSH Host Host Certificate",
|
IssueSshHostHostCert = "Issue SSH Host Host Certificate",
|
||||||
SignCert = "Sign PKI Certificate",
|
SignCert = "Sign PKI Certificate",
|
||||||
IssueCert = "Issue PKI Certificate",
|
IssueCert = "Issue PKI Certificate",
|
||||||
InvalidateCache = "Invalidate Cache"
|
InvalidateCache = "Invalidate Cache",
|
||||||
|
NotificationUpdated = "Notification Updated"
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TSecretModifiedEvent = {
|
export type TSecretModifiedEvent = {
|
||||||
@@ -232,6 +233,14 @@ export type TInvalidateCacheEvent = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type TNotificationUpdatedEvent = {
|
||||||
|
event: PostHogEventTypes.NotificationUpdated;
|
||||||
|
properties: {
|
||||||
|
notificationId: string;
|
||||||
|
isRead?: boolean;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export type TPostHogEvent = { distinctId: string; organizationId?: string } & (
|
export type TPostHogEvent = { distinctId: string; organizationId?: string } & (
|
||||||
| TSecretModifiedEvent
|
| TSecretModifiedEvent
|
||||||
| TAdminInitEvent
|
| TAdminInitEvent
|
||||||
@@ -251,4 +260,5 @@ export type TPostHogEvent = { distinctId: string; organizationId?: string } & (
|
|||||||
| TSignCertificateEvent
|
| TSignCertificateEvent
|
||||||
| TIssueCertificateEvent
|
| TIssueCertificateEvent
|
||||||
| TInvalidateCacheEvent
|
| TInvalidateCacheEvent
|
||||||
|
| TNotificationUpdatedEvent
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export const NotificationDropdown = () => {
|
|||||||
<DropdownMenuContent
|
<DropdownMenuContent
|
||||||
align="end"
|
align="end"
|
||||||
side="bottom"
|
side="bottom"
|
||||||
className="mt-3 flex h-[550px] w-[400px] overflow-hidden rounded-lg"
|
className="z-[9999] mt-3 flex h-[550px] w-[400px] overflow-hidden rounded-lg"
|
||||||
>
|
>
|
||||||
<div className="flex w-full flex-col">
|
<div className="flex w-full flex-col">
|
||||||
<div className="flex items-center justify-between border-b border-mineshaft-500 px-3 py-2">
|
<div className="flex items-center justify-between border-b border-mineshaft-500 px-3 py-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user