{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"redocly_category":"SDK Reference","product":"Fraud Prevention","type":"markdown"},"seo":{"title":"Functions","description":"Everything about Mosaic Journeys, SDKs, and APIs","siteUrl":"https://developer.transmitsecurity.com/","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"functions","__idx":0},"children":["Functions"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"triggeraction","__idx":1},"children":["triggerAction"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["triggerAction"]},"(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["action"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["options?"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["locationConfig?"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["customAttributes?"]},"): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-ref/react-native-ts-accountprotection/interfaces/tssetactionresponse"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TSSetActionResponse"]}]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Reports a user action event and returns an action token. The action token should be passed to your backend to fetch risk recommendations via the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/openapi/risk/recommendations.openapi/other/getriskrecommendation"},"children":["Recommendation API"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"parameters","__idx":2},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["action"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}," | ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-ref/react-native-ts-accountprotection/enums/tsaction"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TSAction"]}]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The type of user action to report"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["options?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-ref/react-native-ts-accountprotection/interfaces/tsactioneventoptions"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TSActionEventOptions"]}]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Additional context for the action event"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["locationConfig?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Object"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Controls location data collection for this action (see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/risk/report_geolocation"},"children":["Track geolocation"]},")"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["locationConfig.mode"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["One of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"disabled\""]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"default\""]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"forceCurrent\""]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"forceLastKnown\""]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"lastKnown\""]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["locationConfig.validFor?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["number"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["For ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"lastKnown\""]}," mode, return location only if not older than this many minutes"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["customAttributes?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Record<string, any>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Additional contextual data for the action; must match the schema defined in the Portal (see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/risk/action-attributes"},"children":["Custom attributes"]},")"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"returns","__idx":3},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-ref/react-native-ts-accountprotection/interfaces/tssetactionresponse"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TSSetActionResponse"]}]},">"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"example","__idx":4},"children":["Example"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"import { triggerAction, TSAction, TSClaimedUserIdType } from 'react-native-ts-accountprotection';\n\nconst response = await triggerAction(\n  TSAction.login,\n  {\n    correlationId: \"CORRELATION_ID\",\n    claimedUserId: \"91e25bea0c...\", // hashed email\n    claimedUserIdType: TSClaimedUserIdType.email,\n    referenceUserId: \"REFERENCE_USER_ID\"\n  },\n  { mode: \"default\" },\n  { userLevel: \"premium\" }\n);\nconst actionToken = response.actionToken;\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"setauthenticateduser","__idx":5},"children":["setAuthenticatedUser"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["setAuthenticatedUser"]},"(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["userId"]},"): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["boolean"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Sets the user context for all subsequent events in the session (or until the user is explicitly cleared). It should be called only after you've fully authenticated the user (including, for example, any 2FA that was required)."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"parameters-1","__idx":6},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["userId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Opaque identifier of the user in your system"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"returns-1","__idx":7},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["boolean"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Indicates if the call succeeded"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"example-1","__idx":8},"children":["Example"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"import { setAuthenticatedUser } from 'react-native-ts-accountprotection';\n\nawait setAuthenticatedUser(username);\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"clearuser","__idx":9},"children":["clearUser"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["clearUser"]},"(): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["boolean"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Clears the user context for all subsequent events in the mobile session. The user is automatically cleared once the session expires or in case of a new login action."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"returns-2","__idx":10},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["boolean"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Indicates if the call succeeded"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"example-2","__idx":11},"children":["Example"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"import { clearUser } from 'react-native-ts-accountprotection';\n\nawait clearUser();\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"getsessiontoken","__idx":12},"children":["getSessionToken"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["getSessionToken"]},"(): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Returns a device session token that can be used to trigger action events via the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/risk/quick_start_backendapi"},"children":["Backend API"]},". The session token binds user interactions to their device and is required for backend integrations. Call this after SDK initialization and before triggering events."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"returns-3","__idx":13},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The session token."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"example-3","__idx":14},"children":["Example"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"import { getSessionToken } from 'react-native-ts-accountprotection';\n\nconst sessionToken = await getSessionToken();\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"logpageload","__idx":15},"children":["logPageLoad"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["logPageLoad"]},"(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pageName"]},"): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["void"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Tracks screen navigation events for behavioral data collection. Call this whenever the user navigates to a new screen in your app."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"parameters-2","__idx":16},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pageName"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The name of the screen or page the user navigated to"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"returns-4","__idx":17},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["void"]},">"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"example-4","__idx":18},"children":["Example"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"import { logPageLoad } from 'react-native-ts-accountprotection';\n\nawait logPageLoad(\"login-page\");\nawait logPageLoad(\"dashboard\");\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"setloglevel","__idx":19},"children":["setLogLevel"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["setLogLevel"]},"(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isLogEnabled"]},"): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["void"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Enables or disables verbose SDK logging for debugging purposes."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"parameters-3","__idx":20},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isLogEnabled"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["boolean"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Set to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," to enable debug logging"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"returns-5","__idx":21},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["void"]},">"]},{"$$mdtype":"Tag","name":"style","attributes":{},"children":["\ntable th:first-of-type {\n    width: 20%;\n}\ntable th:nth-of-type(2) {\n    width: 20%;\n}\ntable th:nth-of-type(3) {\n    width: 60%;\n}\n"]}]},"headings":[{"value":"Functions","id":"functions","depth":1},{"value":"triggerAction","id":"triggeraction","depth":2},{"value":"Parameters","id":"parameters","depth":3},{"value":"Returns","id":"returns","depth":3},{"value":"Example","id":"example","depth":3},{"value":"setAuthenticatedUser","id":"setauthenticateduser","depth":2},{"value":"Parameters","id":"parameters-1","depth":3},{"value":"Returns","id":"returns-1","depth":3},{"value":"Example","id":"example-1","depth":3},{"value":"clearUser","id":"clearuser","depth":2},{"value":"Returns","id":"returns-2","depth":3},{"value":"Example","id":"example-2","depth":3},{"value":"getSessionToken","id":"getsessiontoken","depth":2},{"value":"Returns","id":"returns-3","depth":3},{"value":"Example","id":"example-3","depth":3},{"value":"logPageLoad","id":"logpageload","depth":2},{"value":"Parameters","id":"parameters-2","depth":3},{"value":"Returns","id":"returns-4","depth":3},{"value":"Example","id":"example-4","depth":3},{"value":"setLogLevel","id":"setloglevel","depth":2},{"value":"Parameters","id":"parameters-3","depth":3},{"value":"Returns","id":"returns-5","depth":3}],"frontmatter":{"seo":{"title":"Functions"}},"lastModified":"2026-04-09T12:29:05.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/sdk-ref/react-native-ts-accountprotection/drs","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}