From 5361a76ae82935c8d350d39a51227aba6f4d5e33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20=C5=BBydek?= Date: Mon, 9 Oct 2023 17:45:34 +0300 Subject: [PATCH] feat: export fingerprintjs-pro as FingerprintJSPro, deprecate destructured exports from this library --- README.md | 7 +++--- src/index.ts | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 220e7bc..8867c13 100644 --- a/README.md +++ b/README.md @@ -83,8 +83,7 @@ Create a `FpjsClient` instance before rendering or initializing your application ```js import { FpjsClient, - // defaultEndpoint, - // defaultScriptUrlPattern + FingerprintJSPro } from '@fingerprintjs/fingerprintjs-pro-spa'; // It can receive multiple parameters but the only required one is `loadOptions`, @@ -92,8 +91,8 @@ import { const fpjsClient = new FpjsClient({ loadOptions: { apiKey: "", - // endpoint: ["", defaultEndpoint], - // scriptUrlPattern: ["", defaultScriptUrlPattern], + // endpoint: ["", FingerprintJSPro.defaultEndpoint], + // scriptUrlPattern: ["", FingerprintJSPro.defaultScriptUrlPattern], // region: "eu" } }); diff --git a/src/index.ts b/src/index.ts index 33b48b8..993260a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,5 +2,64 @@ export { ICache, Cacheable, LocalStorageCache, SessionStorageCache, InMemoryCach export * from './client' export * from './global' -export { defaultEndpoint, defaultTlsEndpoint, defaultScriptUrlPattern } from '@fingerprintjs/fingerprintjs-pro' -export type { Agent, LoadOptions, GetOptions, GetResult, ExtendedGetResult } from '@fingerprintjs/fingerprintjs-pro' +import * as FingerprintJSPro from '@fingerprintjs/fingerprintjs-pro' + +/** + * @deprecated + * + * Use `FingerprintJSPro.defaultEndpoint` instead, this export will be removed in the next major version + * */ +const defaultEndpoint = FingerprintJSPro.defaultEndpoint + +/** + * @deprecated + * + * Use `FingerprintJSPro.defaultTlsEndpoint` instead, this export will be removed in the next major version + */ +const defaultTlsEndpoint = FingerprintJSPro.defaultTlsEndpoint + +/** + * @deprecated + * + * Use `FingerprintJSPro.defaultScriptUrlPattern` instead, this export will be removed in the next major version + */ +const defaultScriptUrlPattern = FingerprintJSPro.defaultScriptUrlPattern + +export { defaultEndpoint, defaultTlsEndpoint, defaultScriptUrlPattern } + +export { FingerprintJSPro } + +/** + * @deprecated + * + * Use `FingerprintJSPro.Agent` instead, this export will be removed in the next major version + * */ +export type Agent = FingerprintJSPro.Agent + +/** + * @deprecated + * + * Use `FingerprintJSPro.GetOptions` instead, this export will be removed in the next major version + */ +export type GetOptions = FingerprintJSPro.GetOptions + +/** + * @deprecated + * + * Use `FingerprintJSPro.GetResult` instead, this export will be removed in the next major version + */ +export type GetResult = FingerprintJSPro.GetResult + +/** + * @deprecated + * + * Use `FingerprintJSPro.LoadOptions` instead, this export will be removed in the next major version + */ +export type LoadOptions = FingerprintJSPro.LoadOptions + +/** + * @deprecated + * + * Use `FingerprintJSPro.ExtendedGetResult` instead, this export will be removed in the next major version + */ +export type ExtendedGetResult = FingerprintJSPro.ExtendedGetResult