2023-07-16 09:47:10 +03:00
|
|
|
import type { ShlinkVisitsSummary } from '../../../api/types';
|
2023-07-24 21:14:59 +03:00
|
|
|
import type { Order } from '../../../src/utils/helpers/ordering';
|
|
|
|
import type { Nullable, OptionalString } from '../../../src/utils/utils';
|
2020-08-24 19:52:52 +03:00
|
|
|
|
2023-03-13 11:05:54 +03:00
|
|
|
export interface DeviceLongUrls {
|
|
|
|
android?: OptionalString;
|
|
|
|
ios?: OptionalString;
|
|
|
|
desktop?: OptionalString;
|
|
|
|
}
|
|
|
|
|
2021-03-27 11:49:47 +03:00
|
|
|
export interface EditShortUrlData {
|
|
|
|
longUrl?: string;
|
2023-03-13 11:05:54 +03:00
|
|
|
deviceLongUrls?: DeviceLongUrls;
|
2020-08-24 19:52:52 +03:00
|
|
|
tags?: string[];
|
2021-10-17 13:35:11 +03:00
|
|
|
title?: string | null;
|
2021-06-24 21:13:06 +03:00
|
|
|
validSince?: Date | string | null;
|
|
|
|
validUntil?: Date | string | null;
|
2021-03-27 11:49:47 +03:00
|
|
|
maxVisits?: number | null;
|
|
|
|
validateUrl?: boolean;
|
2021-06-23 20:52:19 +03:00
|
|
|
crawlable?: boolean;
|
2021-10-13 23:50:48 +03:00
|
|
|
forwardQuery?: boolean;
|
2021-03-27 11:49:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ShortUrlData extends EditShortUrlData {
|
|
|
|
longUrl: string;
|
|
|
|
customSlug?: string;
|
2020-08-24 19:52:52 +03:00
|
|
|
shortCodeLength?: number;
|
|
|
|
domain?: string;
|
|
|
|
findIfExists?: boolean;
|
|
|
|
}
|
|
|
|
|
2022-11-06 21:12:41 +03:00
|
|
|
export interface ShortUrlIdentifier {
|
|
|
|
shortCode: string;
|
|
|
|
domain?: OptionalString;
|
|
|
|
}
|
|
|
|
|
2020-08-24 19:52:52 +03:00
|
|
|
export interface ShortUrl {
|
|
|
|
shortCode: string;
|
|
|
|
shortUrl: string;
|
|
|
|
longUrl: string;
|
2023-03-13 11:05:54 +03:00
|
|
|
deviceLongUrls?: Required<DeviceLongUrls>, // Optional only before Shlink 3.5.0
|
2020-08-30 10:59:14 +03:00
|
|
|
dateCreated: string;
|
2022-12-18 21:26:30 +03:00
|
|
|
/** @deprecated */
|
|
|
|
visitsCount: number; // Deprecated since Shlink 3.4.0
|
2023-03-18 12:29:49 +03:00
|
|
|
visitsSummary?: ShlinkVisitsSummary; // Optional only before Shlink 3.4.0
|
2020-08-24 19:52:52 +03:00
|
|
|
meta: Required<Nullable<ShortUrlMeta>>;
|
|
|
|
tags: string[];
|
|
|
|
domain: string | null;
|
2021-03-05 16:20:49 +03:00
|
|
|
title?: string | null;
|
2021-06-23 20:52:19 +03:00
|
|
|
crawlable?: boolean;
|
2021-10-13 23:50:48 +03:00
|
|
|
forwardQuery?: boolean;
|
2020-08-24 19:52:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ShortUrlMeta {
|
|
|
|
validSince?: string;
|
|
|
|
validUntil?: string;
|
|
|
|
maxVisits?: number;
|
|
|
|
}
|
2020-08-26 21:37:36 +03:00
|
|
|
|
|
|
|
export interface ShortUrlModalProps {
|
|
|
|
shortUrl: ShortUrl;
|
|
|
|
isOpen: boolean;
|
|
|
|
toggle: () => void;
|
|
|
|
}
|
2020-08-27 19:31:56 +03:00
|
|
|
|
2021-12-25 12:24:37 +03:00
|
|
|
export const SHORT_URLS_ORDERABLE_FIELDS = {
|
2021-12-24 15:47:27 +03:00
|
|
|
dateCreated: 'Created at',
|
|
|
|
shortCode: 'Short URL',
|
|
|
|
longUrl: 'Long URL',
|
|
|
|
title: 'Title',
|
|
|
|
visits: 'Visits',
|
|
|
|
};
|
|
|
|
|
2021-12-25 12:24:37 +03:00
|
|
|
export type ShortUrlsOrderableFields = keyof typeof SHORT_URLS_ORDERABLE_FIELDS;
|
2021-12-24 15:47:27 +03:00
|
|
|
|
2021-12-25 12:24:37 +03:00
|
|
|
export type ShortUrlsOrder = Order<ShortUrlsOrderableFields>;
|
2022-03-13 20:56:42 +03:00
|
|
|
|
|
|
|
export interface ExportableShortUrl {
|
|
|
|
createdAt: string;
|
|
|
|
title: string;
|
|
|
|
shortUrl: string;
|
2023-04-21 10:36:51 +03:00
|
|
|
domain?: string;
|
|
|
|
shortCode: string;
|
2022-03-13 20:56:42 +03:00
|
|
|
longUrl: string;
|
|
|
|
tags: string;
|
|
|
|
visits: number;
|
|
|
|
}
|
2022-12-23 22:00:59 +03:00
|
|
|
|
|
|
|
export interface ShortUrlsFilter {
|
|
|
|
excludeBots?: boolean;
|
2022-12-29 00:58:47 +03:00
|
|
|
excludeMaxVisitsReached?: boolean;
|
|
|
|
excludePastValidUntil?: boolean;
|
2022-12-23 22:00:59 +03:00
|
|
|
}
|