@fingerprintjs/fingerprintjs-pro-spa
Advanced tools
Comparing version 0.7.0 to 1.0.0-test.1
/** | ||
* FingerprintJS Pro SPA v0.6.0 - Copyright (c) FingerprintJS, Inc, 2022 (https://fingerprint.com) | ||
* FingerprintJS Pro SPA v0.7.0 - Copyright (c) FingerprintJS, Inc, 2023 (https://fingerprint.com) | ||
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. | ||
@@ -253,3 +253,3 @@ */ | ||
var version = "0.6.0"; | ||
var version = "0.7.0"; | ||
@@ -256,0 +256,0 @@ const cacheLocationBuilders = { |
/** | ||
* FingerprintJS Pro SPA v0.6.0 - Copyright (c) FingerprintJS, Inc, 2022 (https://fingerprint.com) | ||
* FingerprintJS Pro SPA v0.7.0 - Copyright (c) FingerprintJS, Inc, 2023 (https://fingerprint.com) | ||
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. | ||
@@ -10,3 +10,3 @@ */ | ||
declare type VisitorData<TExtended extends boolean = false> = TExtended extends false ? FingerprintJS.GetResult : FingerprintJS.ExtendedGetResult; | ||
type VisitorData<TExtended extends boolean = false> = TExtended extends false ? FingerprintJS.GetResult : FingerprintJS.ExtendedGetResult; | ||
declare enum CacheLocation { | ||
@@ -42,5 +42,5 @@ Memory = "memory", | ||
declare type CacheEntry<TExtended extends boolean = false> = VisitorData<TExtended>; | ||
declare type Cacheable<TExtended extends boolean = false> = WrappedCacheEntry<TExtended>; | ||
declare type WrappedCacheEntry<TExtended extends boolean = false> = { | ||
type CacheEntry<TExtended extends boolean = false> = VisitorData<TExtended>; | ||
type Cacheable<TExtended extends boolean = false> = WrappedCacheEntry<TExtended>; | ||
type WrappedCacheEntry<TExtended extends boolean = false> = { | ||
body: CacheEntry<TExtended>; | ||
@@ -50,5 +50,5 @@ expiresAt: number; | ||
declare class CacheKey<TExtended extends boolean> { | ||
tag: unknown; | ||
tag: {} | null; | ||
linkedId: string | null; | ||
extendedResult: boolean | NonNullable<TExtended>; | ||
extendedResult: boolean | TExtended; | ||
constructor(options: GetOptions<TExtended>); | ||
@@ -61,3 +61,3 @@ /** | ||
} | ||
declare type MaybePromise<T> = Promise<T> | T; | ||
type MaybePromise<T> = Promise<T> | T; | ||
interface ICache { | ||
@@ -64,0 +64,0 @@ set<T = WrappedCacheEntry>(key: string, entry: T): MaybePromise<void>; |
/** | ||
* FingerprintJS Pro SPA v0.6.0 - Copyright (c) FingerprintJS, Inc, 2022 (https://fingerprint.com) | ||
* FingerprintJS Pro SPA v0.7.0 - Copyright (c) FingerprintJS, Inc, 2023 (https://fingerprint.com) | ||
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. | ||
@@ -229,3 +229,3 @@ */ | ||
var version = "0.6.0"; | ||
var version = "0.7.0"; | ||
@@ -232,0 +232,0 @@ const cacheLocationBuilders = { |
{ | ||
"name": "@fingerprintjs/fingerprintjs-pro-spa", | ||
"version": "0.7.0", | ||
"version": "1.0.0-test.1", | ||
"description": "FingerprintJS Pro JavaScript agent for Single-Page Applications (SPA)", | ||
@@ -27,2 +27,3 @@ "main": "dist/fp-pro-spa.cjs.js", | ||
"test": "jest", | ||
"test:coverage": "jest --coverage", | ||
"test:dts": "tsc --noEmit --isolatedModules dist/fp-pro-spa.d.ts", | ||
@@ -54,4 +55,4 @@ "release": "semantic-release", | ||
"dependencies": { | ||
"@fingerprintjs/fingerprintjs-pro": "^3.8.1", | ||
"tslib": "^2.2.0" | ||
"@fingerprintjs/fingerprintjs-pro": "^3.8.2", | ||
"tslib": "^2.5.0" | ||
}, | ||
@@ -67,14 +68,16 @@ "devDependencies": { | ||
"@semantic-release/npm": "9.0.1", | ||
"@types/jest": "^27.0.1", | ||
"@typescript-eslint/eslint-plugin": "^5.10.1", | ||
"@typescript-eslint/parser": "^5.10.1", | ||
"@types/jest": "^28.1.8", | ||
"@types/node": "^18.14.6", | ||
"@typescript-eslint/eslint-plugin": "^5.54.1", | ||
"@typescript-eslint/parser": "^5.54.1", | ||
"commitizen": "^4.2.4", | ||
"conventional-changelog-conventionalcommits": "^5.0.0", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint": "^8.7.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint": "^8.35.0", | ||
"eslint-config-prettier": "^8.7.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"husky": "^8.0.1", | ||
"jest": "^28.1.3", | ||
"jest-environment-jsdom": "^28.1.3", | ||
"lint-staged": "^13.0.2", | ||
"jest": "^27.5.1", | ||
"prettier": "^2.5.1", | ||
@@ -86,6 +89,6 @@ "rimraf": "^3.0.2", | ||
"semantic-release": "19.0.3", | ||
"ts-jest": "^27.1.3", | ||
"typescript": "^4.4.2", | ||
"typedoc": "^0.22.17" | ||
"ts-jest": "^28.0.8", | ||
"typedoc": "^0.23.26", | ||
"typescript": "^4.9.5" | ||
} | ||
} |
@@ -1,15 +0,40 @@ | ||
# @fingerprintjs/fingerprintjs-pro-spa | ||
<p align="center"> | ||
<a href="https://fingerprint.com"> | ||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="https://fingerprintjs.github.io/home/resources/logo_light.svg" /> | ||
<source media="(prefers-color-scheme: light)" srcset="https://fingerprintjs.github.io/home/resources/logo_dark.svg" /> | ||
<img src="https://fingerprintjs.github.io/home/resources/logo_dark.svg" alt="Fingerprint logo" width="312px" /> | ||
</picture> | ||
</a> | ||
<p align="center"> | ||
<a href="https://www.npmjs.com/package/@fingerprintjs/fingerprintjs-pro-spa"> | ||
<img src="https://img.shields.io/npm/v/@fingerprintjs/fingerprintjs-pro-spa.svg" alt="Current NPM version"> | ||
</a> | ||
<a href="https://fingerprintjs.github.io/fingerprintjs-pro-spa/coverage/"> | ||
<img src="https://fingerprintjs.github.io/fingerprintjs-pro-spa/coverage/badges.svg" alt="coverage"> | ||
</a> | ||
<a href="https://www.npmjs.com/package/@fingerprintjs/fingerprintjs-pro-spa"> | ||
<img src="https://img.shields.io/npm/dm/@fingerprintjs/fingerprintjs-pro-spa.svg" alt="Monthly downloads from NPM"> | ||
</a> | ||
<a href="https://opensource.org/licenses/MIT"> | ||
<img src="https://img.shields.io/:license-mit-blue.svg" alt="MIT license"> | ||
</a> | ||
<a href="https://discord.gg/39EpE2neBg"> | ||
<img src="https://img.shields.io/discord/852099967190433792?style=logo&label=Discord&logo=Discord&logoColor=white" alt="Discord server"> | ||
</a> | ||
<a href="https://fingerprintjs.github.io/fingerprintjs-pro-spa"> | ||
<img src="https://img.shields.io/badge/-Documentation-green" alt="Documentation"> | ||
</a> | ||
[![npm](https://img.shields.io/npm/v/@fingerprintjs/fingerprintjs-pro-spa.svg?style=flat)](https://www.npmjs.com/package/@fingerprintjs/fingerprintjs-pro-spa) | ||
[![License](https://img.shields.io/:license-mit-blue.svg?style=flat)](https://opensource.org/licenses/MIT) | ||
[![License](https://img.shields.io/badge/-Documentation-green)](https://fingerprintjs.github.io/fingerprintjs-pro-spa) | ||
This library was designed to be used in SPA framework wrappers for the FingerprintJS Pro Javascript Agent. | ||
It also has several built-in caching mechanism that are optimized according to the official recommendations. | ||
If just need the [JS agent](https://github.com/fingerprintjs/fingerprintjs), you can use it directly, without this wrapper. | ||
If you're looking for a dedicated React integration, you can find it [here](https://github.com/fingerprintjs/fingerprintjs-pro-react). | ||
# Fingerprint Pro SPA | ||
**This SDK works with FingerprintJS Pro, it will not work with the OSS version!** | ||
This library was designed to be used in SPA framework wrappers for the Fingerprint Pro JavaScript Agent. | ||
It also has several built-in caching mechanisms that are optimized according to the official recommendations. | ||
If you just need the Fingerprint Pro [JS agent](https://www.npmjs.com/package/@fingerprintjs/fingerprintjs-pro), you can use it directly, without this wrapper. If you're looking for a framework-specific integration, we have dedicated SDKs for [React (including Next, Preact)](https://github.com/fingerprintjs/fingerprintjs-pro-react), [Vue](https://github.com/fingerprintjs/fingerprintjs-pro-vue), [Svelte](https://github.com/fingerprintjs/fingerprintjs-pro-svelte) and [Angular](https://github.com/fingerprintjs/fingerprintjs-pro-angular). | ||
**This SDK works with Fingerprint Pro, it will not work with the open-source FingerprintJS version!** | ||
Learn more about the [difference between Pro and OSS](https://dev.fingerprint.com/docs/pro-vs-open-source). | ||
If you'd like to have a similar SPA wrapper for the OSS version of FingerprintJS, consider [raising and issue on our issue tracker](https://github.com/fingerprintjs/fingerprintjs-pro-spa/issues). | ||
If you'd like to have a similar SPA wrapper for the OSS version of FingerprintJS, consider [raising an issue in our issue tracker](https://github.com/fingerprintjs/fingerprintjs-pro-spa/issues). | ||
@@ -22,3 +47,2 @@ ## Table of Contents | ||
- [Support + Feedback](#support--feedback) | ||
- [What is FingerprintJS](#what-is-fingerprintjs) | ||
- [License](#license) | ||
@@ -28,4 +52,5 @@ | ||
This library uses [FingerprintJS Pro](https://fingerprint.com/github/) under the hood, you can view the document for the core technology. | ||
- [Documentation](https://dev.fingerprint.com/docs) | ||
This library uses [Fingerprint Pro](https://fingerprint.com/github/) under the hood, you can view the document for the core technology. | ||
- To learn more about Fingerprint Pro read our [product documentation](https://dev.fingerprint.com/docs). | ||
- To learn more about this SDK, there is a [Typedoc-generated SDK Reference](https://fingerprintjs.github.io/fingerprintjs-pro-spa) available. | ||
@@ -48,7 +73,7 @@ ## Installation | ||
### FingerprintJS public API key | ||
### Fingerprint Pro public API key | ||
In order to identify visitors you'll need a FingerprintJS Pro account (you can [sign up for free](https://dashboard.fingerprint.com/signup/)). | ||
In order to identify visitors you'll need a Fingerprint Pro account (you can [sign up for free](https://dashboard.fingerprint.com/signup/)). | ||
- Go to [FingerprintJS Dashboard](https://dashboard.fingerprint.com/) | ||
- Go to [Fingerprint Dashboard](https://dashboard.fingerprint.com/) | ||
- Open the _API keys_ page from the sidebar | ||
@@ -59,3 +84,3 @@ - Find your _Public_ API key | ||
Create an `FpjsClient` instance before rendering or initializing your application. You should only have one instance of the client. | ||
Create a `FpjsClient` instance before rendering or initializing your application. You should only have one instance of the client. | ||
@@ -65,3 +90,3 @@ ```js | ||
// It can receive mulptiple parameters but the only required one is `loadOptions`, which contains the public API key | ||
// It can receive multiple parameters but the only required one is `loadOptions`, which contains the public API key | ||
const fpjsClient = new FpjsClient({ | ||
@@ -77,3 +102,3 @@ loadOptions: { | ||
Before you start making identification requests to the FingerprintJS Pro API, you need to initialize the Agent | ||
Before you start making identification requests to the Fingerprint Pro API, you need to initialize the Agent | ||
to allow it to gather browser signals. | ||
@@ -110,3 +135,3 @@ Make sure the initialization has been completed before calling the `getVisitorData` method to avoid errors. | ||
The SDK can be configured to cache the visitor data in memory, in session storage or in local storage. | ||
The SDK can be configured to cache the visitor data in memory, in session storage, or in local storage. | ||
The default is in session storage. This setting can be controlled using the `cacheLocation` option when creating the Fpjs client. | ||
@@ -140,3 +165,3 @@ | ||
The SDK can be configured to use a custom cache store that is implemented by your application. This is useful if you are using this SDK in an environment where a different data storage is more convenient, such as potentially a hybrid mobile app. | ||
The SDK can be configured to use a custom cache store that is implemented by your application. This is useful if you are using this SDK in an environment where a different data store is more convenient, such as a hybrid mobile app. | ||
@@ -152,14 +177,10 @@ To do this, provide an object to the `cache` property of the SDK configuration. | ||
| `remove(key)` | Promise<void> or void | Removes a single item from the cache at the specified key, or no-op if the item was not found | | ||
| `allKeys()` | Promise<string[]> or string [] | Returns the list of all keys. By default the keys we use are prefixed with `@fpjs@client@` but you can pass your own custom prefix as an option when you create the FpjsClient | | ||
| `allKeys()` | Promise<string[]> or string [] | Returns the list of all keys. By default, the keys we use are prefixed with `@fpjs@client@` but you can pass your own custom prefix as an option when you create the FpjsClient | | ||
**Note:** The `cache` property takes precedence over the `cacheLocation` property if both are set. A warning is displayed in the console if this scenario occurs. | ||
We also export the internal `InMemoryCache`, `LocalStorageCache`, `SessionStorageCache` and `CacheStub` implementations, so you can wrap your custom cache around these implementations if you wish. | ||
We also export the internal `InMemoryCache`, `LocalStorageCache`, `SessionStorageCache`, and `CacheStub` implementations, so you can wrap your custom cache around these implementations if you wish. | ||
## Documentation | ||
You can find API reference [here](https://fingerprintjs.github.io/fingerprintjs-pro-spa/). | ||
#### Cache time | ||
Fpjs client receives `cacheTimeInSeconds` as one of the options. In order to ensure high identification accuracy we recommend that the visitor data is not cached for longer than 24 hours. | ||
Fpjs client receives `cacheTimeInSeconds` as one of the options. To ensure high identification accuracy we recommend that the visitor data is not cached for longer than 24 hours. | ||
For that reason, if you pass a value higher than 86400 (60 * 60 * 24), the FpjsClient constructor will throw an error. | ||
@@ -171,21 +192,4 @@ | ||
## What is FingerprintJS? | ||
### FingerprintJS Pro is the fraud detection API for your business | ||
FingerprintJS Pro is a combination of a JavaScript agent that runs in the browser and a server-side storage and API system | ||
that securely identifies visitors and stores all the information you need to detect fraud. | ||
### JavaScript agent | ||
FingerprintJS Pro does not calculate fingerprints in the browser. Instead, it uses a lightweight JavaScript agent that collects multiple device signals and sends them to our servers. | ||
This helps prevent reverse engineering and spoofing of an identifier by advanced bots. The agent is hosted at edge locations around the world. It is only 12 KB in size and 20 ms away from your users. | ||
### Server-side identification system | ||
Server-side identification system provides a platform that processes and stores page views and events to identify your website visitors. | ||
It also provides many helpful features that are explained in more detail on dedicated documentation pages. | ||
Learn more on our [official documentation page](https://dev.fingerprint.com/docs/introduction) | ||
## License | ||
This project is licensed under the MIT license. See the [LICENSE](https://github.com/fingerprintjs/fingerprintjs-pro-spa/blob/master/LICENSE) file for more info. | ||
This project is licensed under the MIT license. See the [LICENSE](https://github.com/fingerprintjs/fingerprintjs-pro-spa/blob/master/LICENSE) file for more information. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43816
186
31
Updatedtslib@^2.5.0