Repository navigation
[INTER-2190] Migrate to API V4 - #267
Conversation
INTER-2392
INTER-2394 INTER-2393
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success85 tests passing in 5 suites. Report generated by 🧪jest coverage report action from 294c0cd Show full coverage report
|
There was a problem hiding this comment.
🟡 Changes recommended
Request-option handling, stale responses, native tag consistency, error metadata, and migration documentation remain incorrect.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Migrates the SDK and its native/web integrations to Fingerprint API v4.
Changes:
- Replaces legacy providers and agents with
FingerprintProvider,start(), anduseFingerprint(). - Introduces snake_case responses and unified
FingerprintErrorhandling. - Upgrades native, web, and E2E dependencies and tests.
File summaries
| File | Description |
|---|---|
.changeset/v4-api-migration.md |
Documents breaking migration. |
README.md |
Updates public usage guide. |
pnpm-lock.yaml |
Locks the v4 web agent. |
sdk/README.md |
Updates SDK documentation. |
sdk/RNFingerprintjsPro.podspec |
Upgrades iOS dependency. |
sdk/package.json |
Replaces web peer dependency. |
sdk/src/useVisitorData.ts |
Redesigns query hook. |
sdk/src/useFingerprint.ts |
Adds client hook. |
sdk/src/unwrapError.web.ts |
Normalizes web errors. |
sdk/src/unwrapError.ts |
Normalizes native errors. |
sdk/src/types.ts |
Defines v4 public types. |
sdk/src/specs/NativeRNFingerprintjsPro.ts |
Updates native contract. |
sdk/src/index.ts |
Exports new API. |
sdk/src/FingerprintProvider.tsx |
Adds redesigned provider. |
sdk/src/FingerprintJsProProvider.tsx |
Removes legacy provider. |
sdk/src/FingerprintJsProContext.ts |
Removes legacy context. |
sdk/src/FingerprintJsProAgent.web.ts |
Removes legacy web agent. |
sdk/src/FingerprintJsProAgent.ts |
Removes legacy native agent. |
sdk/src/FingerprintContext.ts |
Adds new context. |
sdk/src/FingerprintClient.web.ts |
Implements web client. |
sdk/src/FingerprintClient.ts |
Implements native client. |
sdk/src/errors.ts |
Introduces unified errors. |
sdk/ios/RNFingerprintjsPro.xcodeproj/project.pbxproj |
Links iOS v4 package. |
sdk/ios/RNFingerprintjsPro.swift |
Migrates Swift bridge. |
sdk/ios/RNFingerprintjsPro.mm |
Updates Objective-C bridge. |
sdk/ios/JSONTypeConvertor.swift |
Updates SDK import. |
sdk/ios/FPJSError+React.swift |
Maps v4 error codes. |
sdk/android/src/main/java/com/fingerprintjs/reactnative/RNFingerprintjsProModule.kt |
Migrates Android bridge. |
sdk/android/settings.gradle |
Updates Kotlin plugin. |
sdk/android/fingerprint.gradle |
Selects Android SDK v4. |
sdk/android/build.gradle |
Updates Android dependency. |
sdk/__tests__/useVisitorData.test.ts |
Tests redesigned hook. |
sdk/__tests__/setup.ts |
Updates native mocks. |
sdk/__tests__/helpers.tsx |
Uses new provider. |
sdk/__tests__/FingerprintProvider.test.ts |
Tests new provider. |
sdk/__tests__/FingerprintJsProProvider.test.ts |
Removes legacy tests. |
sdk/__tests__/FingerprintClient.test.ts |
Tests native client. |
sdk/__tests__/errors.test.ts |
Tests unified errors. |
e2e-app/pnpm-workspace.yaml |
Normalizes workspace configuration. |
e2e-app/pnpm-lock.yaml |
Locks migrated dependencies. |
e2e-app/package.json |
Updates agent and server SDK. |
e2e-app/e2e/ids.ts |
Adds error-code identifier. |
e2e-app/e2e/identify.ts |
Handles v4 results. |
e2e-app/e2e/identification.test.ts |
Migrates native E2E tests. |
e2e-app/e2e-web/identification.test.ts |
Migrates web E2E tests. |
e2e-app/App.tsx |
Uses the new SDK API. |
Review details
Files not reviewed (2)
- e2e-app/pnpm-lock.yaml: Generated file
- pnpm-lock.yaml: Generated file
- Files reviewed: 43/46 changed files
- Comments generated: 6
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
80ac83e to
80fd3b9
Compare
🚀 Following releases will be created using changesets from this PR:@fingerprintjs/fingerprintjs-pro-react-native@4.0.0-rc.1Major Changes
|
kevinmia
left a comment
There was a problem hiding this comment.
Did a did a scan for any leftover references and verified that both comments from Juraj's review are addressed. Unit tests and manual testing passed
INTER-2190 Migrate to API v4
Migrates the SDK to Fingerprint API v4 and realigns the public API with
@fingerprint/react. This is a breaking change on every platform (web, iOS, Android) and ships as a major release (see.changeset/v4-api-migration.md).Note
Stacked on top of the new-arch PR (
feature/INTER-970-new-arch). Review/merge that one first.What changed
Renamed / restructured public API
FingerprintJsProProvider→FingerprintProvider.new FingerprintJsProAgent(...)→start(options), returning a client with a singleget(options)method.getVisitorId/getVisitorDataare removed.useFingerprint()to read the client from context.getData(tags, linkedId, options)collapses into a single options object:getData({ tags, linkedId, timeout }).useVisitorDatabehaviordata/isLoading/isFetched/error) similar to React SDK.getDataalways throws on error; thethrowOnErroroption is removed.immediatenow defaults tofalse.Grouped provider / start options
android(allowUseOfLocationData,locationTimeoutMillis),ios(allowUseOfLocationData), andweb(storageKeyPrefix,urlHashing,remoteControlDetection,cache).locationTimeoutMillisAndroidmoves toandroid.locationTimeoutMillis.endpointUrl+fallbackEndpointUrlsare replaced by a singleendpoints(string or string[]).snake_case response
FingerprintResponse(visitor_id,event_id,suspect_score?,sealed_result), matching the Server API v4 and JS agent.requestId→event_id,confidence→suspect_score,sealedResult→sealed_result.ipLocation,firstSeenAt, etc.) and theextendedResponseFormatoption are removed (v4 always returns the flat format).Single error type
FingerprintError({ name, code, event_id }) plus anisFingerprintErrortype guard. Discriminate onerror.code(e.g.too_many_requests).Web
@fingerprint/agent(v4) instead of@fingerprintjs/fingerprintjs-pro-spa.@fingerprint/agentbecomes the web peer dependency.Native
Migration highlights
Full before/after guide (provider, hook, imperative client, options, errors, web peer dep) is in
.changeset/v4-api-migration.md.Validation
FingerprintProvider.test.ts,FingerprintClient.test.ts,useVisitorData.test.ts,errors.test.ts).@fingerprint/node-sdk.