@fingerprintjs/fingerprintjs-pro-svelte
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -1,2 +0,2 @@ | ||
const pkgVersion = '2.2.0'; | ||
const pkgVersion = '2.2.1'; | ||
const pkgName = 'fingerprintjs-pro-svelte'; | ||
@@ -3,0 +3,0 @@ export function getOptions(options) { |
@@ -19,2 +19,2 @@ import type { FpjsSvelteQueryOptions } from './types'; | ||
* */ | ||
export declare function useVisitorData<TExtended extends boolean>({ ignoreCache: defaultIgnoreCache, ...options }: UseVisitorDataOptions<TExtended>, { immediate }?: FpjsSvelteQueryOptions): UseGetVisitorDataResult<TExtended>; | ||
export declare function useVisitorData<TExtended extends boolean>(topLevelOptions: UseVisitorDataOptions<TExtended>, { immediate }?: FpjsSvelteQueryOptions): UseGetVisitorDataResult<TExtended>; |
@@ -20,3 +20,3 @@ import { writable } from 'svelte/store'; | ||
* */ | ||
export function useVisitorData({ ignoreCache: defaultIgnoreCache, ...options }, { immediate = true } = {}) { | ||
export function useVisitorData(topLevelOptions, { immediate = true } = {}) { | ||
const dataValue = writable(undefined); | ||
@@ -28,3 +28,6 @@ const loadingValue = writable(false); | ||
loadingValue.set(true); | ||
const ignoreCache = typeof getDataOptions?.ignoreCache === 'boolean' ? getDataOptions.ignoreCache : defaultIgnoreCache; | ||
const { ignoreCache, ...options } = { | ||
...(topLevelOptions ?? {}), | ||
...(getDataOptions ?? {}), | ||
}; | ||
try { | ||
@@ -31,0 +34,0 @@ const result = await context.getVisitorData(options, ignoreCache); |
/// <reference types="svelte" /> | ||
import type { GetOptions, VisitorData } from '@fingerprintjs/fingerprintjs-pro-spa'; | ||
import type { FingerprintJSPro, VisitorData } from '@fingerprintjs/fingerprintjs-pro-spa'; | ||
import type { FpjsVisitorQueryData, GetDataOptions } from './types'; | ||
@@ -11,4 +11,4 @@ import type { Writable } from 'svelte/store'; | ||
* */ | ||
getData: (options?: GetDataOptions) => Promise<VisitorData<TExtended> | undefined>; | ||
getData: (options?: UseVisitorDataOptions<TExtended>) => Promise<VisitorData<TExtended> | undefined>; | ||
}; | ||
export type UseVisitorDataOptions<TExtended extends boolean> = GetOptions<TExtended> & Partial<GetDataOptions>; | ||
export type UseVisitorDataOptions<TExtended extends boolean> = FingerprintJSPro.GetOptions<TExtended> & Partial<GetDataOptions>; |
{ | ||
"name": "@fingerprintjs/fingerprintjs-pro-svelte", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "FingerprintJS Pro integration for Svelte", | ||
@@ -5,0 +5,0 @@ "author": "Fingerprint, Inc (https://fingerprint.com)", |
@@ -63,3 +63,3 @@ <p align="center"> | ||
<script> | ||
import { FpjsProvider, /* defaultEndpoint, defaultScriptUrlPattern */ } from '@fingerprintjs/fingerprintjs-pro-svelte' | ||
import { FpjsProvider, FingerprintJSPro } from '@fingerprintjs/fingerprintjs-pro-svelte' | ||
import VisitorData from './VisitorData.svelte' | ||
@@ -70,5 +70,11 @@ | ||
apiKey: '<YOUR_API_KEY>', | ||
// region: 'eu', | ||
// endpoint: ['metrics.yourwebsite.com', defaultEndpoint], | ||
// scriptUrlPattern: ['metrics.yourwebsite.com/agent-path', defaultScriptUrlPattern], | ||
endpoint: [ | ||
// "https://metrics.yourwebsite.com", | ||
FingerprintJSPro.defaultEndpoint | ||
], | ||
scriptUrlPattern: [ | ||
// "https://metrics.yourwebsite.com/web/v<version>/<apiKey>/loader_v<loaderVersion>.js", | ||
FingerprintJSPro.defaultScriptUrlPattern | ||
], | ||
// region: 'eu', | ||
}, | ||
@@ -120,2 +126,21 @@ }; | ||
## Linking and tagging information | ||
The `visitorId` provided by Fingerprint Identification is especially useful when combined with information you already know about your users, for example, account IDs, order IDs, etc. To learn more about various applications of the `linkedId` and `tag`, see [Linking and tagging information](https://dev.fingerprint.com/docs/tagging-information). | ||
Associate the visitor ID with your data using the `linkedId` or `tag` parameter of the options object passed into the `useVisitorData()` hook: | ||
```html | ||
<script> | ||
import { useVisitorData } from '@fingerprintjs/fingerprintjs-pro-svelte'; | ||
const { getData, data, isLoading, error } = useVisitorData({ | ||
linkedId: 'user_1234', | ||
tag: { | ||
userAction: 'login', | ||
analyticsId: 'UA-5555-1111-1', | ||
}, | ||
}); | ||
</script> | ||
``` | ||
## Caching strategy | ||
@@ -122,0 +147,0 @@ |
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
24504
251
175