@w0s/report-same-referrer
Version:
Send referrer error information to endpoints
34 lines • 908 B
TypeScript
type URLPart = 'origin' | 'host' | 'hostname';
export interface Option {
fetch: Readonly<FetchOption>;
validate?: Readonly<ValidateOption>;
}
export interface FetchOption {
endpoint: string | URL;
param: Readonly<{
documentURL: string;
referrer: string;
}>;
contentType?: 'application/x-www-form-urlencoded' | 'application/json';
headers?: HeadersInit;
}
export interface ValidateOption {
referrer?: Readonly<{
comparePart?: URLPart;
sames?: readonly string[];
}>;
ua?: Readonly<{
denys?: readonly RegExp[];
allows?: readonly RegExp[];
}>;
}
/**
* Send referrer error information to endpoints
*
* @param options - Options
*
* @returns Fetch result
*/
declare const _default: (options: Readonly<Option>) => Promise<Response | undefined>;
export default _default;
//# sourceMappingURL=reportSameReferrer.d.ts.map