UNPKG

@playkit-js/dynamic-watermark

Version:
39 lines (36 loc) 812 B
import { http } from './http'; const TIMEOUT = 3000; export const createWebhook = (url: string) => { return { get: async () => { return Promise.race([ new Promise((_, reject) => { setTimeout(() => { reject(); }, TIMEOUT); }), http.head(url), ]); }, reportViolation: async ({ uiConfId, userId, ipAddress, }: { uiConfId: number | string | undefined | null; userId: string | undefined | null; ipAddress: string; }) => { await http.post(url, { body: { uiconfId: uiConfId, userId, timestamp: new Date().toISOString(), ipAddress, pageUrl: window.location.href, }, responseType: 'raw', }); }, }; };