@appilots/sdk
v0.13.0
Published
AI-powered chat component and navigation SDK for React Native apps
Downloads
774
Maintainers
Readme
@appilots/sdk
AI-powered chat component and navigation SDK for React Native apps.
Installation
npm install @appilots/sdk
# or
yarn add @appilots/sdk
# or
pnpm add @appilots/sdkQuick Start
import { AppilotsProvider, AppilotsNavigationContainer, AppilotsChat } from '@appilots/sdk';
import { NavigationContainer } from '@react-navigation/native';
function App() {
return (
<AppilotsProvider
config={{
projectId: 'your-project-id',
}}
>
<AppilotsNavigationContainer>
<NavigationContainer>{/* Your app screens */}</NavigationContainer>
</AppilotsNavigationContainer>
<AppilotsChat />
</AppilotsProvider>
);
}What happens when Appilots breaks
The SDK renders inside your app, so a bug of ours must never become an outage of yours. Both render surfaces sit behind an error boundary:
- If the provider throws, your app keeps rendering. The assistant
goes inert —
AppilotsChatrenders nothing, anduseAppilots()keeps returning a context (withdegraded: true) so your own code does not throw either. - If the chat throws, only the chat disappears.
- If the auto-tracking interceptor throws on some element, that element renders untouched; the agent just does not see it.
In every case we log a console.error that says plainly it is our bug,
not yours, and the failure is reported to the Appilots dashboard on the
next session so we find out without you having to file anything.
Degradation lasts for the session — a surface that crashed once usually crashes again, and an assistant blinking in and out of your product is worse than an absent one. An exception thrown by your components is never swallowed: it propagates to your own error boundary as it would without us.
Native confirmation dialogs
When the user approves a destructive action on the chat's confirm card
and your code then calls Alert.alert to double-check, the SDK answers
that dialog once on their behalf — otherwise they are asked the same
question twice and the second dialog is one the agent cannot press.
Doing that means briefly replacing Alert.alert, a global that belongs
to your app. The replacement is refcounted, restored even if the action
throws, answers at most one dialog, never presses a style: 'cancel'
button, and expires about a second after the press so unrelated alerts
(background sync, push handlers) are never touched. To turn it off and
show your own dialog instead:
<AppilotsProvider config={{ projectId: '…', suppressNativeConfirm: false }}>Documentation
Full documentation available at docs.appilots.com
