mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 08:07:12 +01:00
Fix TypeScript type errors across multiple files
Some checks failed
Node.js CI / build (push) Has been cancelled
Some checks failed
Node.js CI / build (push) Has been cancelled
This commit is contained in:
parent
860e6390f1
commit
a3733b0424
12 changed files with 38 additions and 15 deletions
|
|
@ -42,7 +42,7 @@ export function Funnel({ id, name, type, parameters, websiteId }) {
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
title={formatMessage(labels.funnel)}
|
title={formatMessage(labels.funnel)}
|
||||||
variant="modal"
|
variant="sheet"
|
||||||
style={{ minHeight: 300, minWidth: 400 }}
|
style={{ minHeight: 300, minWidth: 400 }}
|
||||||
>
|
>
|
||||||
<FunnelEditForm id={id} websiteId={websiteId} onClose={close} />
|
<FunnelEditForm id={id} websiteId={websiteId} onClose={close} />
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ export function FunnelAddButton({ websiteId }: { websiteId: string }) {
|
||||||
</Button>
|
</Button>
|
||||||
<Modal>
|
<Modal>
|
||||||
<Dialog
|
<Dialog
|
||||||
variant="modal"
|
variant="sheet"
|
||||||
title={formatMessage(labels.funnel)}
|
title={formatMessage(labels.funnel)}
|
||||||
style={{ minHeight: 375, minWidth: 600 }}
|
style={{ minHeight: 375, minWidth: 600 }}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ export function Goal({ id, name, type, parameters, websiteId, startDate, endDate
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
title={formatMessage(labels.goal)}
|
title={formatMessage(labels.goal)}
|
||||||
variant="modal"
|
variant="sheet"
|
||||||
style={{ minHeight: 300, minWidth: 400 }}
|
style={{ minHeight: 300, minWidth: 400 }}
|
||||||
>
|
>
|
||||||
<GoalEditForm id={id} websiteId={websiteId} onClose={close} />
|
<GoalEditForm id={id} websiteId={websiteId} onClose={close} />
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,11 @@ export function WebsiteChart({
|
||||||
|
|
||||||
const chartData = useMemo(() => {
|
const chartData = useMemo(() => {
|
||||||
if (data) {
|
if (data) {
|
||||||
const result = {
|
const result: {
|
||||||
|
pageviews: any[];
|
||||||
|
sessions: any[];
|
||||||
|
compare?: { pageviews: any[]; sessions: any[] };
|
||||||
|
} = {
|
||||||
pageviews,
|
pageviews,
|
||||||
sessions,
|
sessions,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import {
|
||||||
} from '@umami/react-zen';
|
} from '@umami/react-zen';
|
||||||
import { Fragment } from 'react';
|
import { Fragment } from 'react';
|
||||||
import { useMessages, useNavigation } from '@/components/hooks';
|
import { useMessages, useNavigation } from '@/components/hooks';
|
||||||
import { Edit, More, Share } from '@/components/icons';
|
import { Edit, Ellipsis, Share } from '@/components/icons';
|
||||||
|
|
||||||
export function WebsiteMenu({ websiteId }: { websiteId: string }) {
|
export function WebsiteMenu({ websiteId }: { websiteId: string }) {
|
||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
|
|
@ -33,7 +33,7 @@ export function WebsiteMenu({ websiteId }: { websiteId: string }) {
|
||||||
<MenuTrigger>
|
<MenuTrigger>
|
||||||
<Button variant="quiet">
|
<Button variant="quiet">
|
||||||
<Icon>
|
<Icon>
|
||||||
<More />
|
<Ellipsis />
|
||||||
</Icon>
|
</Icon>
|
||||||
</Button>
|
</Button>
|
||||||
<Popover placement="bottom">
|
<Popover placement="bottom">
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ interface UseMessages {
|
||||||
messages: typeof messages;
|
messages: typeof messages;
|
||||||
labels: typeof labels;
|
labels: typeof labels;
|
||||||
getMessage: (id: string) => string;
|
getMessage: (id: string) => string;
|
||||||
getErrorMessage: (error: ApiError) => string | undefined;
|
getErrorMessage: (error: string | Error | ApiError) => string | undefined;
|
||||||
FormattedMessage: typeof FormattedMessage;
|
FormattedMessage: typeof FormattedMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -26,12 +26,16 @@ export function useMessages(): UseMessages {
|
||||||
return message ? formatMessage(message) : id;
|
return message ? formatMessage(message) : id;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getErrorMessage = (error: ApiError) => {
|
const getErrorMessage = (error: string | Error | ApiError) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const code = error?.code;
|
if (typeof error === 'string') {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
const code = (error as ApiError)?.code;
|
||||||
|
|
||||||
return code ? getMessage(code) : error?.message || 'Unknown error';
|
return code ? getMessage(code) : error?.message || 'Unknown error';
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ export function LanguageButton() {
|
||||||
</Icon>
|
</Icon>
|
||||||
</Button>
|
</Button>
|
||||||
<Popover placement="bottom end">
|
<Popover placement="bottom end">
|
||||||
<Dialog variant="menu">
|
<Dialog variant="sheet">
|
||||||
<Grid columns="repeat(3, minmax(200px, 1fr))" overflow="hidden">
|
<Grid columns="repeat(3, minmax(200px, 1fr))" overflow="hidden">
|
||||||
{items.map(({ value, label }) => {
|
{items.map(({ value, label }) => {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
15
src/declaration.d.ts
vendored
15
src/declaration.d.ts
vendored
|
|
@ -16,3 +16,18 @@ declare module 'semver';
|
||||||
declare module 'tsup';
|
declare module 'tsup';
|
||||||
declare module 'uuid';
|
declare module 'uuid';
|
||||||
declare module '@umami/esbuild-plugin-css-modules';
|
declare module '@umami/esbuild-plugin-css-modules';
|
||||||
|
|
||||||
|
interface UmamiTracker {
|
||||||
|
track: {
|
||||||
|
(): Promise<string>;
|
||||||
|
(eventName: string): Promise<string>;
|
||||||
|
(eventName: string, obj: Record<string, any>): Promise<string>;
|
||||||
|
(properties: Record<string, any>): Promise<string>;
|
||||||
|
(eventFunction: (props: Record<string, any>) => Record<string, any>): Promise<string>;
|
||||||
|
};
|
||||||
|
identify: (data: Record<string, any>) => Promise<string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Window {
|
||||||
|
umami: UmamiTracker;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ export const KAFKA = 'kafka';
|
||||||
export const KAFKA_PRODUCER = 'kafka-producer';
|
export const KAFKA_PRODUCER = 'kafka-producer';
|
||||||
|
|
||||||
// Fixes issue with converting bigint values
|
// Fixes issue with converting bigint values
|
||||||
BigInt.prototype.toJSON = function () {
|
(BigInt.prototype as any).toJSON = function () {
|
||||||
return Number(this);
|
return Number(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import {
|
||||||
|
|
||||||
export function getFragmentChildren(children: ReactNode) {
|
export function getFragmentChildren(children: ReactNode) {
|
||||||
return (children as ReactElement)?.type === Fragment
|
return (children as ReactElement)?.type === Fragment
|
||||||
? (children as ReactElement).props.children
|
? (children as ReactElement<{ children: ReactNode }>).props.children
|
||||||
: children;
|
: children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ export async function parseRequest(
|
||||||
const url = new URL(request.url);
|
const url = new URL(request.url);
|
||||||
let query = Object.fromEntries(url.searchParams);
|
let query = Object.fromEntries(url.searchParams);
|
||||||
let body = await getJsonBody(request);
|
let body = await getJsonBody(request);
|
||||||
let error: () => undefined | undefined;
|
let error: (() => Response) | undefined;
|
||||||
let auth = null;
|
let auth = null;
|
||||||
|
|
||||||
if (schema) {
|
if (schema) {
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ async function relationalQuery(
|
||||||
endStepQuery: string;
|
endStepQuery: string;
|
||||||
params: Record<string, string>;
|
params: Record<string, string>;
|
||||||
} {
|
} {
|
||||||
const params = {};
|
const params: Record<string, string> = {};
|
||||||
let sequenceQuery = '';
|
let sequenceQuery = '';
|
||||||
let startStepQuery = '';
|
let startStepQuery = '';
|
||||||
let endStepQuery = '';
|
let endStepQuery = '';
|
||||||
|
|
@ -172,7 +172,7 @@ async function clickhouseQuery(
|
||||||
endStepQuery: string;
|
endStepQuery: string;
|
||||||
params: Record<string, string>;
|
params: Record<string, string>;
|
||||||
} {
|
} {
|
||||||
const params = {};
|
const params: Record<string, string> = {};
|
||||||
let sequenceQuery = '';
|
let sequenceQuery = '';
|
||||||
let startStepQuery = '';
|
let startStepQuery = '';
|
||||||
let endStepQuery = '';
|
let endStepQuery = '';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue