RECUS DOCS
SDK Reference

RecusAppProvider

The root provider component. Wrap your entire app with this once.

Import

tsx
import { RecusAppProvider } from 'recus-react-native'

Props

PropTypeRequiredDescription
sdkKeystringYour publishable SDK key from the dashboard. Must start with pk_live_ or pk_test_.
userRecusUser | undefinedYour authenticated user. Pass undefined when logged out. Recus is dormant when undefined.
user.userIdstringYour user's ID. This is the primary identifier Recus uses to track onboarding progress.
user.emailstringUser's email address. Shown in the Recus dashboard.
user.namestringUser's display name. Available as {{user.name}} in flow content.
childrenReactNodeYour entire app. Recus never modifies your app's navigation or component tree.
onComplete(values: Record<string, any>) => voidCalled when the user completes a flow. Receives all submitted field values.
onSkip(screenId: string) => voidCalled when the user skips a screen.

Full Example

App.tsx
import { RecusAppProvider } from 'recus-react-native'

export default function App() {
  const { user } = useAuth()

  const handleComplete = (values) => {
    console.log('Onboarding complete:', values)
    // values: { inp_name: "Jane", inp_role: "doctor", ... }
  }

  return (
    <RecusAppProvider
      sdkKey="pk_live_xxxxxxxxxxxxxxxxxxxx"
      user={user ? {
        userId: user.id,
        email:  user.email,
        name:   user.name,
        plan:     user.subscriptionPlan,
        signedUp: user.createdAt,
      } : undefined}
      onComplete={handleComplete}
    >
      <YourApp />
    </RecusAppProvider>
  )
}

Behaviour

When user is undefined

Recus does nothing. Your app renders normally. No API calls are made. Zero performance impact.

When user.userId is set

Recus checks if this user has completed the active mandatory flow. This check is instant on subsequent opens (cached locally). If onboarding is needed → flow appears above your app. If onboarding is done → nothing happens, Recus is invisible.

When the flow is completed

The flow disappears. Your app is visible. The completion state is cached locally. The user will never see this flow again on this device. onComplete is called with all submitted values.

If the Recus API is unavailable

Recus fails silently. Your app continues working normally. Onboarding will not show until the API is reachable again. This is by design — the SDK never breaks your app.