diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cad55c..d01dadb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 1.0.4 + +## Improvements +Exposing package `types` entry. + # 1.0.3 ## Improvements diff --git a/package.json b/package.json index cfd2700..7c5e183 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "perimeterx-axios-interceptor", - "version": "1.0.3", + "version": "1.0.4", "description": "🧱 Intercept requests which are blocked by PerimeterX - pop up the challenge and retry the request", "keywords": [ "perimeterx", @@ -28,6 +28,7 @@ "tester": "node ./tools/tester/index.js" }, "main": "index.js", + "types": "types.d.ts", "devDependencies": { "@fiverr/eslint-config-fiverr": "^3.2.2", "@lets/wait": "^2.0.2", diff --git a/types.d.ts b/types.d.ts new file mode 100644 index 0000000..24ead01 --- /dev/null +++ b/types.d.ts @@ -0,0 +1,25 @@ +import { AxiosInstance, AxiosError } from 'axios'; + +interface FilterOptions { + path: string; + appId?: string; +} + +export interface PerimeterXInterceptorConfig { + filter: (options: FilterOptions) => boolean; + onintercept: (request: Request) => void; + onignore: (request: Request) => void; + onsuccess: (request: Request) => void; + onfailure: (request: Request, error: AxiosError) => void; + onerror: (error: AxiosError) => void; + modalConfig: { + timeout: number; + } +} + +export declare const attach: ( + axiosInstance: AxiosInstance, + config: PerimeterXInterceptorConfig +) => void; + +export declare const detach: (axiosInstance: AxiosInstance) => void;