Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fingerprintjs/fingerprintjs-pro-spa

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fingerprintjs/fingerprintjs-pro-spa - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1-test.1

4

dist/fp-pro-spa.cjs.js
/**
* FingerprintJS Pro SPA v1.1.0 - Copyright (c) FingerprintJS, Inc, 2023 (https://fingerprint.com)
* FingerprintJS Pro SPA v1.1.1-test.1 - 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 = "1.1.0";
var version = "1.1.1-test.1";

@@ -256,0 +256,0 @@ const cacheLocationBuilders = {

/**
* FingerprintJS Pro SPA v1.1.0 - Copyright (c) FingerprintJS, Inc, 2023 (https://fingerprint.com)
* FingerprintJS Pro SPA v1.1.1-test.1 - Copyright (c) FingerprintJS, Inc, 2023 (https://fingerprint.com)
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.

@@ -4,0 +4,0 @@ */

/**
* FingerprintJS Pro SPA v1.1.0 - Copyright (c) FingerprintJS, Inc, 2023 (https://fingerprint.com)
* FingerprintJS Pro SPA v1.1.1-test.1 - Copyright (c) FingerprintJS, Inc, 2023 (https://fingerprint.com)
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.

@@ -230,3 +230,3 @@ */

var version = "1.1.0";
var version = "1.1.1-test.1";

@@ -233,0 +233,0 @@ const cacheLocationBuilders = {

{
"name": "@fingerprintjs/fingerprintjs-pro-spa",
"version": "1.1.0",
"version": "1.1.1-test.1",
"description": "FingerprintJS Pro JavaScript agent for Single-Page Applications (SPA)",

@@ -5,0 +5,0 @@ "main": "dist/fp-pro-spa.cjs.js",

@@ -32,4 +32,4 @@ <p align="center">

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.
This library is designed to be used in single-page-application framework wrappers for the Fingerprint Pro JavaScript Agent.
It has multiple built-in caching mechanisms with recommended default settings.

@@ -52,3 +52,3 @@ 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 library uses [Fingerprint Pro](https://fingerprint.com/github/) under the hood, you can view the document for the core technology.
This library uses [Fingerprint Pro](https://fingerprint.com/github/) under the hood.
- To learn more about Fingerprint Pro read our [product documentation](https://dev.fingerprint.com/docs).

@@ -78,3 +78,3 @@ - To learn more about this SDK, there is a [Typedoc-generated SDK Reference](https://fingerprintjs.github.io/fingerprintjs-pro-spa) available.

- Go to [Fingerprint Dashboard](https://dashboard.fingerprint.com/)
- Open the _API keys_ page from the sidebar
- Go to _App settings_ -> _API Keys_.
- Find your _Public_ API key

@@ -84,21 +84,27 @@

Create a `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. You need to specify your public API key and other configuration options based on your chosen region and active integration.
```js
import { FpjsClient } from '@fingerprintjs/fingerprintjs-pro-spa';
import {
FpjsClient,
// defaultEndpoint,
// defaultScriptUrlPattern
} from '@fingerprintjs/fingerprintjs-pro-spa';
// It can receive multiple 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({
loadOptions: {
apiKey: "your-fpjs-public-api-key" // insert your public api key from the dashboard here
apiKey: "<PUBLIC_API_KEY>",
// endpoint: ["<CUSTOM_ENDPOINT>", defaultEndpoint],
// scriptUrlPattern: ["<CUSTOM_SCRIPT_URL>", defaultScriptUrlPattern],
// region: "eu"
}
});
```
You can learn more about different load options here: https://dev.fingerprint.com/docs/js-agent#agent-initialization
You can learn more about different load options here in the [JS Agent documentation](https://dev.fingerprint.com/docs/js-agent#initializing-the-agent).
### 1 - Init the JS 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.
Make sure the initialization has been completed before calling the `getVisitorData` method to avoid errors.
Before you start making identification requests to the Fingerprint Pro API, you need to initialize the JS Agent to allow it to gather browser signals. Make sure the initialization has been completed before calling the `getVisitorData` method to avoid errors.

@@ -118,3 +124,3 @@ ```js

The `getVisitorData` method returns visitor identification data based on the request [options](https://dev.fingerprint.com/docs/js-agent#visitor-identification).
The second parameter `ignoreCache` will make sure that a request to the API be made even if the data is present in cache.
Set `ignoreCache` to `true` to make a request to the API even if the data is present in the cache.

@@ -134,7 +140,5 @@ ```js

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.
The SDK can cache the visitor data in session storage (default), in local storage, or in memory.
You can specify the `cacheLocation` option when creating the Fpjs client.
To use the session storage mode, no additional options need are required as this is the default setting. To configure the SDK to cache data using local storage, set `cacheLocation` as follows:
```js

@@ -159,13 +163,10 @@ const fpjsClient = new FpjsClient({

Cache keys are formed based on the combination of the _GetOptions_, so, for example, API responses for calls with `extendedResult: true` and `extendedResult: false`
will be stored independently.
Cache keys are based on the combination of _GetOptions_. For example, API responses for calls with `extendedResult: true` and `extendedResult: false` are stored independently.
#### Creating a custom cache
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.
The SDK can use a custom cache store implemented inside your application. This is useful when a different data store is more convenient in your environment, such as a hybrid mobile app.
To do this, provide an object to the `cache` property of the SDK configuration.
You can provide an object to the `cache` property of the SDK configuration that implements the following functions. All the functions can return a Promise or a static value.
The object should implement the following functions. Note that all of these functions can optionally return a Promise or a static value.
| Signature | Return type | Description |

@@ -178,13 +179,12 @@ | -------------------------------- | ------------------------------ |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|

**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.
**Note:** The `cache` property takes priority over `cacheLocation` if both are set. A warning is displayed in the console if that happens.
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 export the internal `InMemoryCache`, `LocalStorageCache`, `SessionStorageCache`, and `CacheStub` implementations, so you can wrap your custom cache around these implementations if you wish.
#### Cache time
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.
Use the `cacheTimeInSeconds` client constructor option to set a custom cache time. To ensure high identification accuracy we recommend not to cache visitors data for longer than 24 hours. If you pass a value higher than 86400 (60 * 60 * 24), the `FpjsClient` constructor will throw an error.
## Support + Feedback
For support or to provide feedback, please [raise an issue on our issue tracker](https://github.com/fingerprintjs/fingerprintjs-pro-spa/issues).
For support or to provide feedback, please use [Issues](https://github.com/fingerprintjs/fingerprintjs-pro-spa/issues).

@@ -191,0 +191,0 @@ ## License

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc