Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

refactor: remove obsolete client analytics APIs (#1269)

Goldflag995c49e8643f
diff --git a/client/src/api/analytics/endpoints/errors.ts b/client/src/api/analytics/endpoints/errors.ts
index 76c824284..ab3142a72 100644
--- a/client/src/api/analytics/endpoints/errors.ts
+++ b/client/src/api/analytics/endpoints/errors.ts
@@ -1,5 +1,5 @@
import { TimeBucket } from "@rybbit/shared";
-import { CommonApiParams, PaginationParams } from "./types";
+import { CommonApiParams } from "./types";
// Error Name Item type
export type ErrorNameItem = {
@@ -16,9 +16,6 @@ export type ErrorNamesPaginatedResponse = {
totalCount: number;
};
-// Non-paginated response (standard format)
-export type ErrorNamesStandardResponse = ErrorNameItem[];
-
// Error Event type
export type ErrorEvent = {
timestamp: string;
@@ -50,21 +47,12 @@ export type ErrorEventsPaginatedResponse = {
totalCount: number;
};
-// Non-paginated response (standard format)
-export type ErrorEventsStandardResponse = ErrorEvent[];
-
// Error bucketed response (time series)
export type GetErrorBucketedResponse = {
time: string;
error_count: number;
}[];
-export interface ErrorNamesParams extends CommonApiParams, PaginationParams {}
-
-export interface ErrorEventsParams extends CommonApiParams, PaginationParams {
- errorMessage: string;
-}
-
export interface ErrorBucketedParams extends CommonApiParams {
errorMessage: string;
bucket: TimeBucket;
diff --git a/client/src/api/analytics/endpoints/index.ts b/client/src/api/analytics/endpoints/index.ts
index 90febaf5f..565e5727f 100644
--- a/client/src/api/analytics/endpoints/index.ts
+++ b/client/src/api/analytics/endpoints/index.ts
@@ -45,13 +45,9 @@ export type {
export type {
ErrorNameItem,
ErrorNamesPaginatedResponse,
- ErrorNamesStandardResponse,
ErrorEvent,
ErrorEventsPaginatedResponse,
- ErrorEventsStandardResponse,
GetErrorBucketedResponse,
- ErrorNamesParams,
- ErrorEventsParams,
ErrorBucketedParams,
} from "./errors";
@@ -155,7 +151,7 @@ export type {
} from "./sessions";
// Users endpoints
-export { fetchUsers, identifyUser, updateUserTraits, deleteUser } from "./users";
+export { identifyUser, updateUserTraits, deleteUser } from "./users";
export type {
UsersResponse,
UserInfo,
@@ -164,9 +160,6 @@ export type {
UserDeviceBreakdown,
LinkedDevice,
UserSessionCountResponse,
- UsersParams,
- UserSessionsParams,
- UserSessionCountParams,
UsersListResponse,
IdentifyUserPayload,
} from "./users";
@@ -182,7 +175,6 @@ export type {
JourneysParams,
PageTitleItem,
PageTitlesPaginatedResponse,
- PageTitlesStandardResponse,
PageTitlesParams,
OrgEventCountResponse,
GetOrgEventCountResponse,
diff --git a/client/src/api/analytics/endpoints/misc.ts b/client/src/api/analytics/endpoints/misc.ts
index 02667baa6..24ede32ea 100644
--- a/client/src/api/analytics/endpoints/misc.ts
+++ b/client/src/api/analytics/endpoints/misc.ts
@@ -38,8 +38,6 @@ export type PageTitlesPaginatedResponse = {
totalCount: number;
};
-export type PageTitlesStandardResponse = PageTitleItem[];
-
// Org event count types
export type OrgEventCountResponse = {
event_date: string;
diff --git a/client/src/api/analytics/endpoints/users.ts b/client/src/api/analytics/endpoints/users.ts
index 2713a1d2d..a75421e4f 100644
--- a/client/src/api/analytics/endpoints/users.ts
+++ b/client/src/api/analytics/endpoints/users.ts
@@ -1,6 +1,4 @@
-import { Filter } from "@rybbit/shared";
import { authedFetch } from "../../utils";
-import { CommonApiParams, PaginationParams, SortParams, toQueryParams } from "./types";
// User response type
export type UsersResponse = {
@@ -108,23 +106,6 @@ export interface UserSessionCountResponse {
sessions: number;
}
-export interface UsersParams extends CommonApiParams, PaginationParams, SortParams {
- pageSize?: number;
- identifiedOnly?: boolean;
- search?: string;
- searchField?: string;
-}
-
-export interface UserSessionsParams extends CommonApiParams {
- userId: string;
-}
-
-export interface UserSessionCountParams {
- userId: string;
- timeZone: string;
- filters?: Filter[];
-}
-
export interface UsersListResponse {
data: UsersResponse[];
totalCount: number;
@@ -132,26 +113,6 @@ export interface UsersListResponse {
pageSize: number;
}
-/**
- * Fetch users list with pagination
- * GET /api/users/:site
- */
-export async function fetchUsers(site: string | number, params: UsersParams): Promise<UsersListResponse> {
- const queryParams = {
- ...toQueryParams(params),
- page: params.page,
- page_size: params.pageSize ?? params.limit,
- sort_by: params.sortBy,
- sort_order: params.sortOrder,
- identified_only: params.identifiedOnly,
- search: params.search || undefined,
- search_field: params.searchField || undefined,
- };
-
- const response = await authedFetch<UsersListResponse>(`/sites/${site}/users`, queryParams);
- return response;
-}
-
export interface IdentifyUserPayload {
anonymousId: string;
userId: string;
diff --git a/client/src/api/analytics/hooks/errors/useGetErrorNames.ts b/client/src/api/analytics/hooks/errors/useGetErrorNames.ts
index 9344099cb..1e5cdc7d1 100644
--- a/client/src/api/analytics/hooks/errors/useGetErrorNames.ts
+++ b/client/src/api/analytics/hooks/errors/useGetErrorNames.ts
@@ -22,17 +22,3 @@ export function useGetErrorNamesPaginated({
staleTime: Infinity,
});
}
-
-// Hook for standard (non-paginated) fetching
-export function useGetErrorNames({
- limit = 10,
- useFilters = true,
-}: Omit<UseGetErrorNamesOptions, "page">): UseQueryResult<ErrorNamesPaginatedResponse> {
- return useAnalyticsQuery<ErrorNamesPaginatedResponse>({
- key: "error-names",
- path: "errors/names",
- useFilters,
- params: { limit },
- staleTime: Infinity,
- });
-}