React Native SDK for Fetch 3.0.0

This major version is a rewrite on top of the CoreDataDome SDK for React Native. See the migration guide to migrate from 2.x.

Breaking changes

  • Rename the package from @datadome/react-native-datadome to @datadome/react-native-datadome-fetch
  • Add @datadome/react-native-core-datadome as a peer dependency, which must be installed alongside this package
  • Replace DataDomeFetch and the DataDome singleton (DataDome.configure, DataDome.getInstance) with createDataDomeFetch(dataDome), which takes a DataDome client created with new DataDome({ clientKey }) and returns a fetch-compatible function
  • Remove the datadome request option: the returned function now adds the DataDome headers to every request and checks every response for a challenge
  • Remove DataDomeModal, DataDomeModule and enableVerboseLogs
  • Remove the react-native-webview peer dependency: challenges are now presented natively by the CoreDataDome SDK
  • Require React Native 0.85 or newer with the New Architecture, iOS 15.1 or newer and Android API 24 or newer

Changes

  • Accept a string, URL or Request as input, and a Headers object, an array of pairs or a plain object as headers
  • Return the server response as is when the CoreDataDome SDK fails, so a DataDome error never fails the app's request
  • Rewrite the package in TypeScript, and re-export DataDome, ResponseValidationStatus, DataDomeConfiguration and DataDomeCookie from the CoreDataDome SDK