Skip to content

Commit

Permalink
docs(README): remove manually written API reference from readme in fa…
Browse files Browse the repository at this point in the history
…vor of generated one
  • Loading branch information
TheUnderScorer committed Sep 2, 2022
1 parent d55bc4c commit f534021
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 41 deletions.
40 changes: 0 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,46 +178,6 @@ When you use FingerprintJS Pro, you pay for each API call. Our [best practices](

Some fields from the [extendedResult](https://dev.fingerprint.com/docs/js-agent#extendedresult) (e.g `ip` or `lastSeenAt`) might change for the same visitor. If you need to get the current data, it is recommended to pass `ignoreCache=true` inside [getData](#returned-object) function.

## Documentation

This library uses [FingerprintJS Pro agent](https://fingerprint.com/github/) internally. The documentation for the FingerprintJS Pro agent is available on https://dev.fingerprint.com/docs.

### FpjsProvider props
`loadOptions: FingerprintJS.LoadOptions`

Options for the FingerprintJS JS Pro agent `load()` method. Options follow [agent's initialisation properties](https://dev.fingerprint.com/docs/js-agent#agent-initialization).

`cacheLocation?: CacheLocation`

Defines which built-in cache mechanism the client should use. Caching options follow properties defined in [fingerprintjs-pro-spa repository](https://github.com/fingerprintjs/fingerprintjs-pro-spa#caching).

`cache?: ICache`

Custom cache implementation. Takes precedence over the `cacheLocation` property. Caching options follow properties defined in [fingerprintjs-pro-spa repository](https://github.com/fingerprintjs/fingerprintjs-pro-spa#caching).

`cacheTimeInSeconds?: number`

Duration in seconds for which data is stored in the cache. Cannot exceed 86_400 (24h) because caching data for longer than 24 hours can negatively affect identification accuracy. Caching options follow properties defined in [fingerprintjs-pro-spa repository](https://github.com/fingerprintjs/fingerprintjs-pro-spa#caching).

`cachePrefix?: string`

Custom prefix for localStorage and sessionStorage cache keys. Will be ignored if the `cache` is provided. Caching options follow properties defined in [fingerprintjs-pro-spa repository](https://github.com/fingerprintjs/fingerprintjs-pro-spa#caching).

### Hooks
`useVisitorData(getOptions, config)`

`useVisitorData` hook performs identification requests with the FingerprintJS Pro API. The returned object contains information about loading status, errors, and [visitor](https://dev.fingerprint.com/docs/js-agent#extendedresult).

#### Params
- `getOptions: GetOptions<TExtended>` parameter follows parameters of the FingerprintJS Pro's [`get` function](https://dev.fingerprint.com/docs/js-agent#parameters-reference).
- `config: UseVisitorDataConfig`'s property `immediate` determines whether the `getData()` method will be called immediately after the hook mounts or not.

#### Returned object
- `getData: ({ignoreCache?: boolean}) => Promise<VisitorData>` Performs identification request to server and returns visitors data.
- `isLoading: boolean` Indicates `getData` request status.
- `data: VisitorData` Contains visitors data requested after `getData()` call.
- `error: Error` Error information in case the request failed.

### API Reference

You can find API reference [here](https://fingerprintjs.github.io/fingerprintjs-pro-react/).
Expand Down
3 changes: 3 additions & 0 deletions src/fpjs-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export interface GetDataOptions {
}

export interface VisitorQueryContext<TExtended extends boolean> extends VisitorQueryResult<TExtended> {
/**
* Performs identification request to server and returns visitors data.
* */
getData: (getDataOptions?: GetDataOptions) => Promise<VisitorData<TExtended> | void>
}

Expand Down
2 changes: 1 addition & 1 deletion src/use-visitor-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type UseVisitorDataOptions<TExtended extends boolean> = GetOptions<TExten
* getData,
* } = useVisitorData({ extended: true }, { immediate: false });
* ```
* * Use the `useVisitorData` hook in your components to perform identification requests with the FingerprintJS API.
* Use the `useVisitorData` hook in your components to perform identification requests with the FingerprintJS API. The returned object contains information about loading status, errors, and visitor.
*
* @param getOptions options for the `fp.get()` request
* @param config config for the hook
Expand Down

0 comments on commit f534021

Please sign in to comment.