Skip to content

Commit

Permalink
feat: export fingerprintjs-pro as FingerprintJSPro, deprecate destruc…
Browse files Browse the repository at this point in the history
…tured exports from this library
  • Loading branch information
TheUnderScorer committed Oct 9, 2023
1 parent 73064be commit 5361a76
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 6 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,16 @@ 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`,
// which contains the public API key
const fpjsClient = new FpjsClient({
loadOptions: {
apiKey: "<PUBLIC_API_KEY>",
// endpoint: ["<CUSTOM_ENDPOINT>", defaultEndpoint],
// scriptUrlPattern: ["<CUSTOM_SCRIPT_URL>", defaultScriptUrlPattern],
// endpoint: ["<CUSTOM_ENDPOINT>", FingerprintJSPro.defaultEndpoint],
// scriptUrlPattern: ["<CUSTOM_SCRIPT_URL>", FingerprintJSPro.defaultScriptUrlPattern],
// region: "eu"
}
});
Expand Down
63 changes: 61 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TExtended extends boolean, TIP = unknown> = FingerprintJSPro.GetOptions<TExtended, TIP>

/**
* @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

0 comments on commit 5361a76

Please sign in to comment.