@appilots/sdk 0.7.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,7 +15,8 @@ pnpm add @appilots/sdk
15
15
  ## Quick Start
16
16
 
17
17
  ```tsx
18
- import { AppilotsProvider, AppilotsChat } from '@appilots/sdk';
18
+ import { AppilotsProvider, AppilotsNavigationContainer, AppilotsChat } from '@appilots/sdk';
19
+ import { NavigationContainer } from '@react-navigation/native';
19
20
 
20
21
  function App() {
21
22
  return (
@@ -24,15 +25,56 @@ function App() {
24
25
  projectId: 'your-project-id',
25
26
  }}
26
27
  >
27
- <NavigationContainer>
28
- {/* Your app screens */}
29
- </NavigationContainer>
28
+ <AppilotsNavigationContainer>
29
+ <NavigationContainer>{/* Your app screens */}</NavigationContainer>
30
+ </AppilotsNavigationContainer>
30
31
  <AppilotsChat />
31
32
  </AppilotsProvider>
32
33
  );
33
34
  }
34
35
  ```
35
36
 
37
+ ## What happens when Appilots breaks
38
+
39
+ The SDK renders inside your app, so a bug of ours must never become an
40
+ outage of yours. Both render surfaces sit behind an error boundary:
41
+
42
+ - If the **provider** throws, your app keeps rendering. The assistant
43
+ goes inert — `AppilotsChat` renders nothing, and `useAppilots()` keeps
44
+ returning a context (with `degraded: true`) so your own code does not
45
+ throw either.
46
+ - If the **chat** throws, only the chat disappears.
47
+ - If the **auto-tracking interceptor** throws on some element, that
48
+ element renders untouched; the agent just does not see it.
49
+
50
+ In every case we log a `console.error` that says plainly it is our bug,
51
+ not yours, and the failure is reported to the Appilots dashboard on the
52
+ next session so we find out without you having to file anything.
53
+
54
+ Degradation lasts for the session — a surface that crashed once usually
55
+ crashes again, and an assistant blinking in and out of your product is
56
+ worse than an absent one. An exception thrown by **your** components is
57
+ never swallowed: it propagates to your own error boundary as it would
58
+ without us.
59
+
60
+ ## Native confirmation dialogs
61
+
62
+ When the user approves a destructive action on the chat's confirm card
63
+ and your code then calls `Alert.alert` to double-check, the SDK answers
64
+ that dialog once on their behalf — otherwise they are asked the same
65
+ question twice and the second dialog is one the agent cannot press.
66
+
67
+ Doing that means briefly replacing `Alert.alert`, a global that belongs
68
+ to your app. The replacement is refcounted, restored even if the action
69
+ throws, answers at most one dialog, never presses a `style: 'cancel'`
70
+ button, and expires about a second after the press so unrelated alerts
71
+ (background sync, push handlers) are never touched. To turn it off and
72
+ show your own dialog instead:
73
+
74
+ ```tsx
75
+ <AppilotsProvider config={{ projectId: '…', suppressNativeConfirm: false }}>
76
+ ```
77
+
36
78
  ## Documentation
37
79
 
38
80
  Full documentation available at [docs.appilots.com](https://docs.appilots.com)
@@ -0,0 +1,5 @@
1
+ {
2
+ "sourceHash": "cb3f70407bf9512b",
3
+ "gitSha": "00511f555d4bc51c481138de6dc3ad90ce2e60e3",
4
+ "builtAt": "2026-08-24T18:34:11.310Z"
5
+ }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkDZ7QRFHD_js = require('./chunk-DZ7QRFHD.js');
3
+ var chunkYB77RYCC_js = require('./chunk-YB77RYCC.js');
4
4
  var React = require('react');
5
5
 
6
6
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -15,24 +15,27 @@ function getActiveRouteName(state) {
15
15
  return route.name;
16
16
  }
17
17
  function AppilotsNavigationContainer({ children }) {
18
- const { emit } = chunkDZ7QRFHD_js.useAppilotsContext();
18
+ const { emit } = chunkYB77RYCC_js.useAppilotsContext();
19
19
  const internalRef = React.useRef(null);
20
- const handleRef = React.useCallback((instance) => {
21
- internalRef.current = instance;
22
- chunkDZ7QRFHD_js.setNavigationRef(instance);
23
- const childRef = children.ref;
24
- if (typeof childRef === "function") childRef(instance);
25
- else if (childRef && typeof childRef === "object") childRef.current = instance;
26
- if (instance) {
27
- console.log("[Appilots] NavigationContainer ref captured");
28
- }
29
- }, [children]);
20
+ const handleRef = React.useCallback(
21
+ (instance) => {
22
+ internalRef.current = instance;
23
+ chunkYB77RYCC_js.setNavigationRef(instance);
24
+ const childRef = children.ref;
25
+ if (typeof childRef === "function") childRef(instance);
26
+ else if (childRef && typeof childRef === "object") childRef.current = instance;
27
+ if (instance) {
28
+ chunkYB77RYCC_js.appilotsDebugLog("NavigationContainer ref captured");
29
+ }
30
+ },
31
+ [children]
32
+ );
30
33
  const handleStateChange = React.useCallback(
31
34
  (state) => {
32
35
  const routeName = getActiveRouteName(state);
33
36
  if (routeName) {
34
- console.log(`[Appilots] Screen changed \u2192 "${routeName}"`);
35
- chunkDZ7QRFHD_js.setCurrentScreen(routeName);
37
+ chunkYB77RYCC_js.appilotsDebugLog(`Screen changed \u2192 "${routeName}"`);
38
+ chunkYB77RYCC_js.setCurrentScreen(routeName);
36
39
  emit({
37
40
  type: "navigation:change",
38
41
  timestamp: Date.now(),
@@ -47,8 +50,8 @@ function AppilotsNavigationContainer({ children }) {
47
50
  const timer = setTimeout(() => {
48
51
  const route = internalRef.current?.getCurrentRoute?.();
49
52
  if (route?.name) {
50
- console.log(`[Appilots] Initial screen \u2192 "${route.name}"`);
51
- chunkDZ7QRFHD_js.setCurrentScreen(route.name);
53
+ chunkYB77RYCC_js.appilotsDebugLog(`Initial screen \u2192 "${route.name}"`);
54
+ chunkYB77RYCC_js.setCurrentScreen(route.name);
52
55
  emit({
53
56
  type: "navigation:change",
54
57
  timestamp: Date.now(),