mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 07:37:11 +01:00
Updated hooks. Changed url, host to path, hostname.
This commit is contained in:
parent
25a9c011b3
commit
543674c7f2
146 changed files with 23348 additions and 2533 deletions
|
|
@ -25,15 +25,17 @@ export const DEFAULT_DATE_COMPARE = 'prev';
|
|||
export const REALTIME_RANGE = 30;
|
||||
export const REALTIME_INTERVAL = 10000;
|
||||
|
||||
export const FILTER_COMBINED = 'filter-combined';
|
||||
export const FILTER_RAW = 'filter-raw';
|
||||
export const FILTER_DAY = 'filter-day';
|
||||
export const FILTER_RANGE = 'filter-range';
|
||||
export const FILTER_REFERRERS = 'filter-referrers';
|
||||
export const FILTER_PAGES = 'filter-pages';
|
||||
|
||||
export const UNIT_TYPES = ['year', 'month', 'hour', 'day', 'minute'];
|
||||
export const EVENT_COLUMNS = ['url', 'entry', 'exit', 'referrer', 'title', 'query', 'event', 'tag'];
|
||||
export const EVENT_COLUMNS = [
|
||||
'path',
|
||||
'entry',
|
||||
'exit',
|
||||
'referrer',
|
||||
'title',
|
||||
'query',
|
||||
'event',
|
||||
'tag',
|
||||
];
|
||||
|
||||
export const SESSION_COLUMNS = [
|
||||
'browser',
|
||||
|
|
@ -44,15 +46,15 @@ export const SESSION_COLUMNS = [
|
|||
'country',
|
||||
'city',
|
||||
'region',
|
||||
'host',
|
||||
'hostname',
|
||||
];
|
||||
|
||||
export const FILTER_COLUMNS = {
|
||||
url: 'url_path',
|
||||
path: 'url_path',
|
||||
entry: 'url_path',
|
||||
exit: 'url_path',
|
||||
referrer: 'referrer_domain',
|
||||
host: 'hostname',
|
||||
hostname: 'hostname',
|
||||
title: 'page_title',
|
||||
query: 'url_query',
|
||||
os: 'os',
|
||||
|
|
@ -69,7 +71,7 @@ export const FILTER_COLUMNS = {
|
|||
export const COLLECTION_TYPE = {
|
||||
event: 'event',
|
||||
identify: 'identify',
|
||||
};
|
||||
} as const;
|
||||
|
||||
export const EVENT_TYPE = {
|
||||
pageView: 1,
|
||||
|
|
@ -107,28 +109,6 @@ export const DATA_TYPES = {
|
|||
[DATA_TYPE.boolean]: 'boolean',
|
||||
[DATA_TYPE.date]: 'date',
|
||||
[DATA_TYPE.array]: 'array',
|
||||
};
|
||||
|
||||
export const REPORT_TYPES = {
|
||||
funnel: 'funnel',
|
||||
goals: 'goal',
|
||||
insights: 'insight',
|
||||
retention: 'retention',
|
||||
utm: 'utm',
|
||||
journey: 'journey',
|
||||
revenue: 'revenue',
|
||||
attribution: 'attribution',
|
||||
} as const;
|
||||
|
||||
export const REPORT_PARAMETERS = {
|
||||
fields: 'fields',
|
||||
filters: 'filters',
|
||||
groups: 'groups',
|
||||
} as const;
|
||||
|
||||
export const KAFKA_TOPIC = {
|
||||
event: 'event',
|
||||
eventData: 'event_data',
|
||||
} as const;
|
||||
|
||||
export const ROLES = {
|
||||
|
|
@ -199,7 +179,7 @@ export const THEME_COLORS = {
|
|||
line: '#3a3a3a',
|
||||
fill: '#191919',
|
||||
},
|
||||
};
|
||||
} as const;
|
||||
|
||||
export const CHART_COLORS = [
|
||||
'#2680eb',
|
||||
|
|
@ -263,7 +243,7 @@ export const OS_NAMES = {
|
|||
'Mac OS': 'macOS',
|
||||
'Sun OS': 'SunOS',
|
||||
'Windows 10': 'Windows 10/11',
|
||||
};
|
||||
} as const;
|
||||
|
||||
export const BROWSERS = {
|
||||
android: 'Android',
|
||||
|
|
@ -294,7 +274,7 @@ export const BROWSERS = {
|
|||
silk: 'Silk',
|
||||
searchbot: 'Searchbot',
|
||||
yandexbrowser: 'Yandex',
|
||||
};
|
||||
} as const;
|
||||
|
||||
export const IP_ADDRESS_HEADERS = [
|
||||
'cf-connecting-ip',
|
||||
|
|
|
|||
|
|
@ -42,18 +42,18 @@ export async function request(
|
|||
});
|
||||
}
|
||||
|
||||
export async function httpGet(url: string, params: object = {}, headers: object = {}) {
|
||||
return request('GET', buildUrl(url, params), undefined, headers);
|
||||
export async function httpGet(path: string, params: object = {}, headers: object = {}) {
|
||||
return request('GET', buildUrl(path, params), undefined, headers);
|
||||
}
|
||||
|
||||
export async function httpDelete(url: string, params: object = {}, headers: object = {}) {
|
||||
return request('DELETE', buildUrl(url, params), undefined, headers);
|
||||
export async function httpDelete(path: string, params: object = {}, headers: object = {}) {
|
||||
return request('DELETE', buildUrl(path, params), undefined, headers);
|
||||
}
|
||||
|
||||
export async function httpPost(url: string, params: object = {}, headers: object = {}) {
|
||||
return request('POST', url, JSON.stringify(params), headers);
|
||||
export async function httpPost(path: string, params: object = {}, headers: object = {}) {
|
||||
return request('POST', path, JSON.stringify(params), headers);
|
||||
}
|
||||
|
||||
export async function httpPut(url: string, params: object = {}, headers: object = {}) {
|
||||
return request('PUT', url, JSON.stringify(params), headers);
|
||||
export async function httpPut(path: string, params: object = {}, headers: object = {}) {
|
||||
return request('PUT', path, JSON.stringify(params), headers);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { isValidTimezone } from '@/lib/date';
|
|||
import { UNIT_TYPES } from './constants';
|
||||
|
||||
export const filterParams = {
|
||||
url: z.string().optional(),
|
||||
path: z.string().optional(),
|
||||
referrer: z.string().optional(),
|
||||
title: z.string().optional(),
|
||||
query: z.string().optional(),
|
||||
|
|
@ -14,7 +14,7 @@ export const filterParams = {
|
|||
region: z.string().optional(),
|
||||
city: z.string().optional(),
|
||||
tag: z.string().optional(),
|
||||
host: z.string().optional(),
|
||||
hostname: z.string().optional(),
|
||||
language: z.string().optional(),
|
||||
event: z.string().optional(),
|
||||
};
|
||||
|
|
@ -55,7 +55,7 @@ export const urlOrPathParam = z.string().refine(
|
|||
);
|
||||
|
||||
export const fieldsParam = z.enum([
|
||||
'url',
|
||||
'path',
|
||||
'referrer',
|
||||
'title',
|
||||
'query',
|
||||
|
|
@ -66,7 +66,7 @@ export const fieldsParam = z.enum([
|
|||
'region',
|
||||
'city',
|
||||
'tag',
|
||||
'host',
|
||||
'hostname',
|
||||
'language',
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +1,16 @@
|
|||
import { Dispatch, SetStateAction } from 'react';
|
||||
import { UseQueryOptions } from '@tanstack/react-query';
|
||||
import {
|
||||
COLLECTION_TYPE,
|
||||
DATA_TYPE,
|
||||
EVENT_TYPE,
|
||||
KAFKA_TOPIC,
|
||||
PERMISSIONS,
|
||||
REPORT_TYPES,
|
||||
ROLES,
|
||||
} from './constants';
|
||||
import { DATA_TYPE, PERMISSIONS, ROLES } from './constants';
|
||||
import { TIME_UNIT } from './date';
|
||||
|
||||
type ObjectValues<T> = T[keyof T];
|
||||
export type ObjectValues<T> = T[keyof T];
|
||||
|
||||
export type ReactQueryOptions<T> = Omit<UseQueryOptions<T, Error, T>, 'queryKey' | 'queryFn'>;
|
||||
|
||||
export type TimeUnit = ObjectValues<typeof TIME_UNIT>;
|
||||
export type Permission = ObjectValues<typeof PERMISSIONS>;
|
||||
export type CollectionType = ObjectValues<typeof COLLECTION_TYPE>;
|
||||
export type Role = ObjectValues<typeof ROLES>;
|
||||
export type EventType = ObjectValues<typeof EVENT_TYPE>;
|
||||
export type DynamicDataType = ObjectValues<typeof DATA_TYPE>;
|
||||
export type KafkaTopic = ObjectValues<typeof KAFKA_TOPIC>;
|
||||
export type ReportType = ObjectValues<typeof REPORT_TYPES>;
|
||||
|
||||
export interface PageParams {
|
||||
search?: string;
|
||||
|
|
@ -63,71 +53,6 @@ export interface Auth {
|
|||
};
|
||||
}
|
||||
|
||||
export interface User {
|
||||
id: string;
|
||||
username: string;
|
||||
password?: string;
|
||||
role: string;
|
||||
createdAt?: Date;
|
||||
}
|
||||
|
||||
export interface Website {
|
||||
id: string;
|
||||
userId: string;
|
||||
resetAt: Date;
|
||||
name: string;
|
||||
domain: string;
|
||||
shareId: string;
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
export interface Share {
|
||||
id: string;
|
||||
token: string;
|
||||
}
|
||||
|
||||
export interface WebsiteActive {
|
||||
x: number;
|
||||
}
|
||||
|
||||
export interface WebsiteMetric {
|
||||
x: string;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export interface WebsiteEventMetric {
|
||||
x: string;
|
||||
t: string;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export interface WebsiteEventData {
|
||||
eventName?: string;
|
||||
propertyName: string;
|
||||
dataType: number;
|
||||
propertyValue?: string;
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface WebsitePageviews {
|
||||
pageviews: {
|
||||
t: string;
|
||||
y: number;
|
||||
};
|
||||
sessions: {
|
||||
t: string;
|
||||
y: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface WebsiteStats {
|
||||
pageviews: { value: number; prev: number };
|
||||
visitors: { value: number; prev: number };
|
||||
visits: { value: number; prev: number };
|
||||
bounces: { value: number; prev: number };
|
||||
totaltime: { value: number; prev: number };
|
||||
}
|
||||
|
||||
export interface DateRange {
|
||||
value: string;
|
||||
startDate: Date;
|
||||
|
|
@ -209,5 +134,3 @@ export interface InputItem {
|
|||
icon: any;
|
||||
seperator?: boolean;
|
||||
}
|
||||
|
||||
export type ReactQueryOptions<T> = Omit<UseQueryOptions<T, Error, T>, 'queryKey' | 'queryFn'>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue