Skip to content

Commit

Permalink
Merge pull request #16 from fingerprintjs/update-fpjspro-agent
Browse files Browse the repository at this point in the history
Update fingerprintjs-pro agent to 3.6.0+
  • Loading branch information
ilfa committed Apr 7, 2022
2 parents 62c3822 + 14ed2db commit 3cb308f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Run tests
run: yarn test
- name: Publish if version has been updated
uses: pascalgn/npm-publish-action@1.3.8
uses: pascalgn/npm-publish-action@e05dd3cd13412801d978714d8eac1cb922826da1
with:
tag_name: "v%s"
tag_message: "v%s"
Expand Down
6 changes: 5 additions & 1 deletion __tests__/fpjs-provider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { renderHook } from '@testing-library/react-hooks'
import { FpjsContext } from '../src'
import { createWrapper, getDefaultLoadOptions } from './helpers'
import { CacheLocation, FpjsClient, FpjsClientOptions } from '@fingerprintjs/fingerprintjs-pro-spa'
import * as packageInfo from '../package.json'

jest.mock('@fingerprintjs/fingerprintjs-pro-spa', () => {
return {
Expand All @@ -26,7 +27,10 @@ describe(`FpjsProvider`, () => {
})
expect(FpjsClient).toHaveBeenCalledWith(
expect.objectContaining({
loadOptions: expect.objectContaining({ ...loadOptions }),
loadOptions: expect.objectContaining({
...loadOptions,
integrationInfo: [`fingerprintjs-pro-react/${packageInfo.version}`],
}),
cacheLocation: CacheLocation.LocalStorage,
cachePrefix: 'TEST_PREFIX',
cacheTimeInSeconds: 60 * 15,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"homepage": "https://github.com/fingerprintjs/fingerprintjs-pro-react#readme",
"dependencies": {
"@fingerprintjs/fingerprintjs-pro-spa": "^0.2.4"
"@fingerprintjs/fingerprintjs-pro-spa": "^0.3.1"
},
"devDependencies": {
"@rollup/plugin-json": "^4.1.0",
Expand Down
12 changes: 11 additions & 1 deletion src/fpjs-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { PropsWithChildren, useCallback, useEffect, useMemo, useRef, useState } from 'react'
import FpjsContext from './fpjs-context'
import { FpjsClient, FpjsClientOptions, Agent } from '@fingerprintjs/fingerprintjs-pro-spa'
import * as packageInfo from '../package.json'

interface FpjsProviderOptions extends FpjsClientOptions {
/**
Expand Down Expand Up @@ -35,7 +36,16 @@ export function FpjsProvider<TExtended extends boolean>({
loadOptions,
}: PropsWithChildren<FpjsProviderOptions>) {
const clientOptions = useMemo(() => {
return { cache, cacheTimeInSeconds, cachePrefix, cacheLocation, loadOptions }
return {
cache,
cacheTimeInSeconds,
cachePrefix,
cacheLocation,
loadOptions: {
...loadOptions,
integrationInfo: [...(loadOptions.integrationInfo || []), `fingerprintjs-pro-react/${packageInfo.version}`],
},
}
}, [cache, cacheTimeInSeconds, cachePrefix, cacheLocation, loadOptions])

const [client, setClient] = useState<FpjsClient>(() => new FpjsClient(clientOptions))
Expand Down
26 changes: 9 additions & 17 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -315,26 +315,18 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"

"@fingerprintjs/fingerprintjs-pro-spa@^0.2.4":
version "0.2.4"
resolved "https://registry.yarnpkg.com/@fingerprintjs/fingerprintjs-pro-spa/-/fingerprintjs-pro-spa-0.2.4.tgz#53fc70b26f51c07f34eeaf90bd7f0c21f5925c48"
integrity sha512-aDE8YJuwEIpQkZzrrDZq19E65eH0OVPf9yybCNkXtdsbwFitgZSgsOlfzF5TvnFe/EbWggornDvbxQopQaJu8g==
"@fingerprintjs/fingerprintjs-pro-spa@^0.3.1":
version "0.3.1"
resolved "https://registry.yarnpkg.com/@fingerprintjs/fingerprintjs-pro-spa/-/fingerprintjs-pro-spa-0.3.1.tgz#01d1c4827958233e502870616a4ca8719dd5e20c"
integrity sha512-RPZj9jHBuAOSkHif4X+dYmjA7DMwaiw4W80eUE2oH9KC70+q6I7wT9MLrRO3xf7LyGqxZk2N4Tgd7QJU6v5LvA==
dependencies:
"@fingerprintjs/fingerprintjs-pro" "^3.5.6"
"@fingerprintjs/fingerprintjs-pro" "^3.6.0"
tslib "^2.2.0"

"@fingerprintjs/fingerprintjs-pro@^3.5.6":
version "3.5.6"
resolved "https://registry.yarnpkg.com/@fingerprintjs/fingerprintjs-pro/-/fingerprintjs-pro-3.5.6.tgz#1a57cc940b61ca41693cbcad50593601d8a9185b"
integrity sha512-3Dtj5v1YIVpIKfdJDOqRG7b01D0XFZ1JbnQlCzkttZZkFbgA3Irukg9sZ2ed23opNnO82191x6WwWHDwEwNFyw==
dependencies:
"@fingerprintjs/fingerprintjs" "3.3.3"
tslib "^2.0.1"

"@fingerprintjs/fingerprintjs@3.3.3":
version "3.3.3"
resolved "https://registry.yarnpkg.com/@fingerprintjs/fingerprintjs/-/fingerprintjs-3.3.3.tgz#ead445032c92a79d5f585953019402ed223edc7d"
integrity sha512-HH6KqZnopF3NIXypYG4f2qxoSRmGCSzp81wJMfWjSTtvsX3cAg12RFJcm+a6Az3XadcZUrXKW3p5Dv0wyCUeuA==
"@fingerprintjs/fingerprintjs-pro@^3.6.0":
version "3.6.1"
resolved "https://registry.yarnpkg.com/@fingerprintjs/fingerprintjs-pro/-/fingerprintjs-pro-3.6.1.tgz#0222b2f6b5975fb67c610bfe9abd015163c4393d"
integrity sha512-10A5sNcYRds3VNxDULfLbpRR67ONj8kiz19fSHSm6BpDD7wi0BrjkLmOPEDUTH+jBr88VAHxEIhD39fgL+g89Q==
dependencies:
tslib "^2.0.1"

Expand Down

0 comments on commit 3cb308f

Please sign in to comment.