mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 14:17:13 +01:00
Merge branch 'dev' into analytics
This commit is contained in:
commit
6bcc349a6e
7 changed files with 53 additions and 23 deletions
|
|
@ -7,7 +7,7 @@ export function useFilterQuery<T = any>({
|
|||
queryKey,
|
||||
queryFn,
|
||||
...options
|
||||
}: UseQueryOptions): FilterQueryResult<T> {
|
||||
}: Omit<UseQueryOptions, 'queryFn'> & { queryFn: (params?: object) => any }): FilterQueryResult<T> {
|
||||
const [params, setParams] = useState<T | SearchFilter>({
|
||||
query: '',
|
||||
page: 1,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { useMemo } from 'react';
|
||||
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
||||
import { buildUrl } from 'next-basics';
|
||||
import { buildUrl, safeDecodeURIComponent } from 'next-basics';
|
||||
|
||||
export function useNavigation(): {
|
||||
pathname: string;
|
||||
|
|
@ -16,7 +16,7 @@ export function useNavigation(): {
|
|||
const obj = {};
|
||||
|
||||
for (const [key, value] of params.entries()) {
|
||||
obj[key] = decodeURIComponent(value);
|
||||
obj[key] = safeDecodeURIComponent(value);
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { StatusLight } from 'react-basics';
|
||||
import { safeDecodeURIComponent } from 'next-basics';
|
||||
import { colord } from 'colord';
|
||||
import classNames from 'classnames';
|
||||
import { LegendItem } from 'chart.js/auto';
|
||||
|
|
@ -31,7 +32,7 @@ export function Legend({
|
|||
onClick={() => onClick(item)}
|
||||
>
|
||||
<StatusLight color={color.alpha(color.alpha() + 0.2).toHex()}>
|
||||
<span className={locale}>{text}</span>
|
||||
<span className={locale}>{safeDecodeURIComponent(text)}</span>
|
||||
</StatusLight>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import clickhouse from 'lib/clickhouse';
|
||||
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||||
import prisma from 'lib/prisma';
|
||||
import { safeDecodeURIComponent } from 'next-basics';
|
||||
|
||||
export async function getUTM(
|
||||
...args: [
|
||||
|
|
@ -44,6 +45,7 @@ async function relationalQuery(
|
|||
where website_id = {{websiteId::uuid}}
|
||||
and created_at between {{startDate}} and {{endDate}}
|
||||
and url_query is not null
|
||||
and event_type = 1
|
||||
group by 1
|
||||
`,
|
||||
{
|
||||
|
|
@ -82,6 +84,7 @@ async function clickhouseQuery(
|
|||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
and url_query != ''
|
||||
and event_type = 1
|
||||
group by 1
|
||||
`,
|
||||
{
|
||||
|
|
@ -99,7 +102,7 @@ function parseParameters(data: any[]) {
|
|||
|
||||
for (const [key, value] of searchParams) {
|
||||
if (key.match(/^utm_(\w+)$/)) {
|
||||
const name = decodeURIComponent(value);
|
||||
const name = safeDecodeURIComponent(value);
|
||||
if (!obj[key]) {
|
||||
obj[key] = { [name]: +num };
|
||||
} else if (!obj[key][name]) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue