This guide helps you migrate your React Native Fraud Prevention integration to version 3.x.
Version 3.x includes breaking changes that will cause runtime errors if not addressed. Review all changes before upgrading. For the full release history, see Changelog.
Breaking changes:
setUserId()is renamed tosetAuthenticatedUser().initializeIOS()now requiresbaseUrlas a mandatory parameter.- Android native Fraud Prevention SDK dependency
com.ts.sdk:accountprotectionupdated to3.0.0.
New features:
claimedUserIdandclaimedUserIdTypeparameters intriggerAction()for typed user identification (claimUserIdis deprecated).- Optional
locationConfigparameter intriggerAction()for controlling location data collection. - Optional
customAttributesparameter intriggerAction()for sending additional contextual data. getSessionToken()for obtaining a device session token for backend integrations.logPageLoad()for tracking screen navigation as part of behavioral data collection.TSClaimedUserIdTypeenum for specifying the type of claimed user ID.
Android (app/build.gradle):
Before:
dependencies {
implementation "com.ts.sdk:accountprotection:2.1.+"
}After:
dependencies {
implementation "com.ts.sdk:accountprotection:3.+"
}npm:
npm install react-native-ts-accountprotection@^3.0.0iOS: Navigate to your iOS project directory and run pod install to install the React Native module's iOS CocoaPods dependencies.
The setUserId() function has been renamed to setAuthenticatedUser(). Update all occurrences in your code.
Before:
import { setUserId } from 'react-native-ts-accountprotection';
await setUserId(username);After:
import { setAuthenticatedUser } from 'react-native-ts-accountprotection';
await setAuthenticatedUser(username);If you initialize the React Native iOS module with explicit parameters using initializeIOS(), baseUrl is now a required parameter. The baseUrl value must include the /risk-collect/ path.
Before:
import { initializeIOS } from 'react-native-ts-accountprotection';
await initializeIOS('YOUR_CLIENT_ID');After:
import { initializeIOS } from 'react-native-ts-accountprotection';
await initializeIOS('YOUR_CLIENT_ID', 'https://api.transmitsecurity.io/risk-collect/');If you initialize using initializeSDKIOS() with a TransmitSecurity.plist file, no changes are needed for initialization.
The claimUserId parameter is deprecated. Use claimedUserId and claimedUserIdType instead. The function also accepts two new optional parameters: locationConfig and customAttributes.
Before:
const response = await triggerAction(TSAction.login, {
correlationId: "CORRELATION_ID",
claimUserId: "CLAIMED_USER_ID",
referenceUserId: "REFERENCE_USER_ID"
});After:
import { TSClaimedUserIdType } from 'react-native-ts-accountprotection';
const response = await triggerAction(
TSAction.login,
{
correlationId: "CORRELATION_ID",
claimedUserId: "91e25bea0c...", // hashed email
claimedUserIdType: TSClaimedUserIdType.email,
referenceUserId: "REFERENCE_USER_ID"
},
{ mode: "default" }, // locationConfig (optional)
{ userLevel: "premium" } // customAttributes (optional)
);Update your imports to reflect the renamed function and new exports:
Before:
import { triggerAction, setUserId, clearUser, TSAction } from 'react-native-ts-accountprotection';After:
import { triggerAction, setAuthenticatedUser, clearUser, TSAction, TSClaimedUserIdType } from 'react-native-ts-accountprotection';- Verify all SDK functionality works as expected.
- Check for any runtime errors related to renamed methods.
- Confirm that
triggerAction()returns action tokens as expected with the new parameter structure.