@mobileai/react-native 0.9.18 → 0.9.20

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.
Files changed (81) hide show
  1. package/LICENSE +28 -20
  2. package/MobileAIFloatingOverlay.podspec +25 -0
  3. package/android/build.gradle +61 -0
  4. package/android/src/main/AndroidManifest.xml +3 -0
  5. package/android/src/main/java/com/mobileai/overlay/FloatingOverlayView.kt +151 -0
  6. package/android/src/main/java/com/mobileai/overlay/MobileAIOverlayPackage.kt +23 -0
  7. package/android/src/newarch/com/mobileai/overlay/FloatingOverlayViewManager.kt +45 -0
  8. package/android/src/oldarch/com/mobileai/overlay/FloatingOverlayViewManager.kt +29 -0
  9. package/ios/MobileAIFloatingOverlayComponentView.mm +73 -0
  10. package/lib/module/components/AIAgent.js +902 -136
  11. package/lib/module/components/AIConsentDialog.js +439 -0
  12. package/lib/module/components/AgentChatBar.js +828 -134
  13. package/lib/module/components/AgentOverlay.js +2 -1
  14. package/lib/module/components/DiscoveryTooltip.js +21 -9
  15. package/lib/module/components/FloatingOverlayWrapper.js +108 -0
  16. package/lib/module/components/Icons.js +123 -0
  17. package/lib/module/config/endpoints.js +12 -2
  18. package/lib/module/core/AgentRuntime.js +373 -27
  19. package/lib/module/core/FiberAdapter.js +56 -0
  20. package/lib/module/core/FiberTreeWalker.js +186 -80
  21. package/lib/module/core/IdleDetector.js +19 -0
  22. package/lib/module/core/NativeAlertInterceptor.js +191 -0
  23. package/lib/module/core/systemPrompt.js +203 -45
  24. package/lib/module/index.js +3 -0
  25. package/lib/module/providers/GeminiProvider.js +72 -56
  26. package/lib/module/providers/ProviderFactory.js +6 -2
  27. package/lib/module/services/AudioInputService.js +3 -12
  28. package/lib/module/services/AudioOutputService.js +1 -13
  29. package/lib/module/services/ConversationService.js +166 -0
  30. package/lib/module/services/MobileAIKnowledgeRetriever.js +41 -0
  31. package/lib/module/services/VoiceService.js +29 -8
  32. package/lib/module/services/telemetry/MobileAI.js +44 -0
  33. package/lib/module/services/telemetry/TelemetryService.js +13 -1
  34. package/lib/module/services/telemetry/TouchAutoCapture.js +44 -18
  35. package/lib/module/specs/FloatingOverlayNativeComponent.ts +19 -0
  36. package/lib/module/support/CSATSurvey.js +95 -12
  37. package/lib/module/support/EscalationSocket.js +70 -1
  38. package/lib/module/support/ReportedIssueEventSource.js +148 -0
  39. package/lib/module/support/escalateTool.js +4 -2
  40. package/lib/module/support/index.js +1 -0
  41. package/lib/module/support/reportIssueTool.js +127 -0
  42. package/lib/module/support/supportPrompt.js +77 -9
  43. package/lib/module/tools/guideTool.js +2 -1
  44. package/lib/module/tools/longPressTool.js +4 -3
  45. package/lib/module/tools/pickerTool.js +6 -4
  46. package/lib/module/tools/tapTool.js +12 -3
  47. package/lib/module/tools/typeTool.js +19 -10
  48. package/lib/module/utils/logger.js +175 -6
  49. package/lib/typescript/react-native.config.d.ts +11 -0
  50. package/lib/typescript/src/components/AIAgent.d.ts +28 -2
  51. package/lib/typescript/src/components/AIConsentDialog.d.ts +153 -0
  52. package/lib/typescript/src/components/AgentChatBar.d.ts +15 -2
  53. package/lib/typescript/src/components/DiscoveryTooltip.d.ts +3 -1
  54. package/lib/typescript/src/components/FloatingOverlayWrapper.d.ts +51 -0
  55. package/lib/typescript/src/components/Icons.d.ts +8 -0
  56. package/lib/typescript/src/config/endpoints.d.ts +5 -3
  57. package/lib/typescript/src/core/AgentRuntime.d.ts +4 -0
  58. package/lib/typescript/src/core/FiberAdapter.d.ts +25 -0
  59. package/lib/typescript/src/core/FiberTreeWalker.d.ts +2 -0
  60. package/lib/typescript/src/core/IdleDetector.d.ts +11 -0
  61. package/lib/typescript/src/core/NativeAlertInterceptor.d.ts +55 -0
  62. package/lib/typescript/src/core/types.d.ts +106 -1
  63. package/lib/typescript/src/index.d.ts +9 -4
  64. package/lib/typescript/src/providers/GeminiProvider.d.ts +6 -5
  65. package/lib/typescript/src/services/ConversationService.d.ts +55 -0
  66. package/lib/typescript/src/services/MobileAIKnowledgeRetriever.d.ts +9 -0
  67. package/lib/typescript/src/services/telemetry/MobileAI.d.ts +7 -0
  68. package/lib/typescript/src/services/telemetry/TelemetryService.d.ts +1 -1
  69. package/lib/typescript/src/services/telemetry/TouchAutoCapture.d.ts +9 -6
  70. package/lib/typescript/src/services/telemetry/types.d.ts +3 -1
  71. package/lib/typescript/src/specs/FloatingOverlayNativeComponent.d.ts +17 -0
  72. package/lib/typescript/src/support/EscalationSocket.d.ts +17 -0
  73. package/lib/typescript/src/support/ReportedIssueEventSource.d.ts +24 -0
  74. package/lib/typescript/src/support/escalateTool.d.ts +5 -0
  75. package/lib/typescript/src/support/index.d.ts +2 -1
  76. package/lib/typescript/src/support/reportIssueTool.d.ts +20 -0
  77. package/lib/typescript/src/support/types.d.ts +56 -1
  78. package/lib/typescript/src/utils/logger.d.ts +15 -0
  79. package/package.json +20 -5
  80. package/react-native.config.js +12 -0
  81. package/src/specs/FloatingOverlayNativeComponent.ts +19 -0
@@ -6,6 +6,7 @@
6
6
  */
7
7
  export { AIAgent } from './components/AIAgent';
8
8
  export { AIZone } from './components/AIZone';
9
+ export { AIConsentDialog, useAIConsent } from './components/AIConsentDialog';
9
10
  export { InfoCard } from './components/cards/InfoCard';
10
11
  export { ReviewSummary } from './components/cards/ReviewSummary';
11
12
  export { GeminiProvider } from './providers/GeminiProvider';
@@ -16,11 +17,15 @@ export { VoiceService } from './services/VoiceService';
16
17
  export { AudioInputService } from './services/AudioInputService';
17
18
  export { AudioOutputService } from './services/AudioOutputService';
18
19
  export { KnowledgeBaseService } from './services/KnowledgeBaseService';
20
+ export { createMobileAIKnowledgeRetriever } from './services/MobileAIKnowledgeRetriever';
19
21
  export { MobileAI } from './services/telemetry';
20
22
  export { logger } from './utils/logger';
21
- export type { AgentConfig, AgentMode, ExecutionResult, InteractiveElement, DehydratedScreen, ToolDefinition, ActionDefinition, TokenUsage, KnowledgeEntry, KnowledgeRetriever, KnowledgeBaseConfig, ChatBarTheme, AIMessage, AIProviderName, ScreenMap, ScreenMapEntry, InteractionMode, } from './core/types';
23
+ export type { AgentConfig, AgentMode, ExecutionResult, InteractiveElement, DehydratedScreen, ToolDefinition, ActionDefinition, TokenUsage, KnowledgeEntry, KnowledgeRetriever, KnowledgeBaseConfig, ChatBarTheme, AIMessage, AIProviderName, ScreenMap, ScreenMapEntry, InteractionMode, ConversationSummary, } from './core/types';
24
+ export type { MobileAIKnowledgeRetrieverOptions } from './services/MobileAIKnowledgeRetriever';
25
+ export type { AIConsentConfig } from './components/AIConsentDialog';
22
26
  export type { VoiceServiceConfig, VoiceServiceCallbacks, VoiceStatus, } from './services/VoiceService';
23
- export type { TelemetryConfig, TelemetryEvent, } from './services/telemetry';
24
- export { SupportGreeting, CSATSurvey, buildSupportPrompt, createEscalateTool, EscalationSocket } from './support';
25
- export type { SupportModeConfig, QuickReply, EscalationConfig, EscalationContext, CSATConfig, CSATRating, BusinessHoursConfig, SupportTicket, } from './support';
27
+ export type { TelemetryConfig, TelemetryEvent } from './services/telemetry';
28
+ export { SupportGreeting, CSATSurvey, buildSupportPrompt, createEscalateTool, EscalationSocket, } from './support';
29
+ export { createReportIssueTool } from './support';
30
+ export type { SupportModeConfig, QuickReply, EscalationConfig, EscalationContext, CSATConfig, CSATRating, BusinessHoursConfig, SupportTicket, ReportedIssue, ReportedIssueCustomerStatus, ReportedIssueStatusUpdate, } from './support';
26
31
  //# sourceMappingURL=index.d.ts.map
@@ -16,15 +16,16 @@ export declare class GeminiProvider implements AIProvider {
16
16
  constructor(apiKey?: string, model?: string, proxyUrl?: string, proxyHeaders?: Record<string, string>);
17
17
  generateContent(systemPrompt: string, userMessage: string, tools: ToolDefinition[], history: AgentStep[], screenshot?: string): Promise<ProviderResult>;
18
18
  /**
19
- * Builds a single `agent_step` function declaration that combines:
20
- * - Structured reasoning fields (previous_goal_eval, memory, plan)
19
+ * Builds a single `agent_step` function declaration that keeps Gemini's
20
+ * served schema intentionally narrow:
21
+ * - Structured reasoning fields
21
22
  * - action_name (enum of all available tool names)
22
- * - All tool parameter fields as flat top-level properties
23
+ * - action_input as a JSON object string
23
24
  *
24
- * Flat schema avoids Gemini's "deeply nested schema" rejection in ANY mode.
25
+ * Flattening every tool parameter into top-level properties can trigger
26
+ * Gemini's "too much branching for serving" error once the toolset grows.
25
27
  */
26
28
  private buildAgentStepDeclaration;
27
- private mapParamType;
28
29
  /**
29
30
  * Builds contents for the generateContent call.
30
31
  * Single-turn: user message + optional screenshot as inlineData.
@@ -0,0 +1,55 @@
1
+ /**
2
+ * ConversationService — backend-persisted AI conversation history.
3
+ *
4
+ * Saves and retrieves AI chat sessions from the MobileAI backend so users
5
+ * can browse and continue previous conversations across app launches.
6
+ *
7
+ * All methods are no-ops when analyticsKey is absent (graceful degradation).
8
+ * All network errors are silently swallowed — history is best-effort and must
9
+ * never break the core agent flow.
10
+ */
11
+ import type { AIMessage, ConversationSummary } from '../core/types';
12
+ interface StartConversationParams {
13
+ analyticsKey: string;
14
+ userId?: string;
15
+ deviceId?: string;
16
+ messages: AIMessage[];
17
+ }
18
+ interface AppendMessagesParams {
19
+ conversationId: string;
20
+ analyticsKey: string;
21
+ messages: AIMessage[];
22
+ }
23
+ interface FetchConversationsParams {
24
+ analyticsKey: string;
25
+ userId?: string;
26
+ deviceId?: string;
27
+ limit?: number;
28
+ }
29
+ interface FetchConversationParams {
30
+ conversationId: string;
31
+ analyticsKey: string;
32
+ }
33
+ /**
34
+ * Start a new conversation on the backend.
35
+ * Call this when the first AI response arrives in a new session.
36
+ * Returns the backend conversationId, or null on failure.
37
+ */
38
+ export declare function startConversation({ analyticsKey, userId, deviceId, messages, }: StartConversationParams): Promise<string | null>;
39
+ /**
40
+ * Append new messages to an existing conversation.
41
+ * Fire-and-forget — call after each exchange (debounce in caller).
42
+ */
43
+ export declare function appendMessages({ conversationId, analyticsKey, messages, }: AppendMessagesParams): Promise<void>;
44
+ /**
45
+ * Fetch the user's conversation list (most-recent-first).
46
+ * Returns empty array on failure — never throws.
47
+ */
48
+ export declare function fetchConversations({ analyticsKey, userId, deviceId, limit, }: FetchConversationsParams): Promise<ConversationSummary[]>;
49
+ /**
50
+ * Fetch the full message history of a single conversation.
51
+ * Returns null on failure.
52
+ */
53
+ export declare function fetchConversation({ conversationId, analyticsKey, }: FetchConversationParams): Promise<AIMessage[] | null>;
54
+ export {};
55
+ //# sourceMappingURL=ConversationService.d.ts.map
@@ -0,0 +1,9 @@
1
+ import type { KnowledgeRetriever } from '../core/types';
2
+ export interface MobileAIKnowledgeRetrieverOptions {
3
+ publishableKey: string;
4
+ baseUrl?: string;
5
+ headers?: Record<string, string>;
6
+ limit?: number;
7
+ }
8
+ export declare function createMobileAIKnowledgeRetriever(options: MobileAIKnowledgeRetrieverOptions): KnowledgeRetriever;
9
+ //# sourceMappingURL=MobileAIKnowledgeRetriever.d.ts.map
@@ -29,6 +29,13 @@ export declare const MobileAI: {
29
29
  * @param defaultValue Fallback if not assigned
30
30
  */
31
31
  getFlag(key: string, defaultValue?: string): string;
32
+ /**
33
+ * Helper function to securely consume a global WOW action limit (like a discount)
34
+ * natively on the MobileAI Server to prevent prompt injection bypasses.
35
+ * @param actionName - The exact registered name of the WOW action
36
+ * @returns true if allowed, false if rejected or error
37
+ */
38
+ consumeWowAction(actionName: string): Promise<boolean>;
32
39
  };
33
40
  /**
34
41
  * Internal: Bind the TelemetryService instance (called by AIAgent on mount).
@@ -11,7 +11,7 @@ import type { TelemetryConfig } from './types';
11
11
  import { FlagService } from '../flags/FlagService';
12
12
  export declare class TelemetryService {
13
13
  private queue;
14
- private config;
14
+ config: TelemetryConfig;
15
15
  private sessionId;
16
16
  private currentScreen;
17
17
  private screenFlow;
@@ -13,16 +13,19 @@
13
13
  */
14
14
  import type { TelemetryService } from './TelemetryService';
15
15
  /**
16
- * Checks if the user is repeatedly tapping the same element in frustration.
17
- * If rage click detected, emits 'rage_click' event to telemetry.
16
+ * Checks if the user is rage-tapping an element.
17
+ *
18
+ * Industry best-practice criteria:
19
+ * 1. Same label tapped 3+ times within 1 second
20
+ * 2. Taps must be on the SAME screen (screen change = not rage, it's navigation)
21
+ * 3. Navigation labels ("Next", "Skip", etc.) are excluded
18
22
  */
19
23
  export declare function checkRageClick(label: string, telemetry: TelemetryService): void;
20
24
  /**
21
- * Extract a label from a GestureResponderEvent's native target.
25
+ * Extract a label from a GestureResponderEvent.
22
26
  *
23
- * @param nativeEvent - The nativeEvent from onStartShouldSetResponderCapture
24
- * @param rootRef - The root View ref (to resolve relative positions)
27
+ * @param event - The GestureResponderEvent from onStartShouldSetResponderCapture
25
28
  * @returns A descriptive label string for the tapped element
26
29
  */
27
- export declare function extractTouchLabel(nativeEvent: any): string;
30
+ export declare function extractTouchLabel(event: any): string;
28
31
  //# sourceMappingURL=TouchAutoCapture.d.ts.map
@@ -6,7 +6,7 @@
6
6
  * 2. Consumer-tracked: via MobileAI.track() API
7
7
  */
8
8
  /** Auto-captured event types */
9
- export type AutoEventType = 'screen_view' | 'user_action' | 'scroll_depth' | 'idle_detected' | 'session_start' | 'session_end' | 'agent_request' | 'agent_step' | 'agent_complete' | 'escalation' | 'knowledge_query' | 'knowledge_miss' | 'csat_response';
9
+ export type AutoEventType = 'screen_view' | 'user_action' | 'scroll_depth' | 'idle_detected' | 'session_start' | 'session_end' | 'agent_request' | 'agent_step' | 'agent_trace' | 'agent_complete' | 'escalation' | 'knowledge_query' | 'knowledge_miss' | 'csat_response' | 'ces_response' | 'agent_first_response' | 'human_first_response' | 'fcr_achieved' | 'engagement_signal' | 'health_signal' | 'onboarding_step';
10
10
  /** All event types (auto + custom) */
11
11
  export type EventType = AutoEventType | string;
12
12
  export interface TelemetryEvent {
@@ -46,5 +46,7 @@ export interface TelemetryConfig {
46
46
  maxBatchSize?: number;
47
47
  /** Enable debug logging for telemetry (default: false) */
48
48
  debug?: boolean;
49
+ /** Callback fired locally whenever an event is tracked (useful for reacting to rage_tap) */
50
+ onEvent?: (event: import('./types').TelemetryEvent) => void;
49
51
  }
50
52
  //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Codegen spec for MobileAIFloatingOverlay native view.
3
+ *
4
+ * This file is required by React Native's Codegen (New Architecture / Fabric).
5
+ * It defines the TypeScript interface for the native view. During the build,
6
+ * Codegen uses this spec to generate C++ glue code that bridges JS and native.
7
+ *
8
+ * Consumers don't use this directly — use FloatingOverlayWrapper.tsx instead.
9
+ *
10
+ * Naming convention: file must end in NativeComponent.ts (Codegen convention).
11
+ */
12
+ import type { ViewProps } from 'react-native';
13
+ export interface NativeProps extends ViewProps {
14
+ }
15
+ declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
16
+ export default _default;
17
+ //# sourceMappingURL=FloatingOverlayNativeComponent.d.ts.map
@@ -12,6 +12,7 @@
12
12
  * Handles:
13
13
  * - Server heartbeat pings (type: 'ping') — acknowledged silently
14
14
  * - Auto-reconnect on unexpected close (max 3 attempts, exponential backoff)
15
+ * - Message queue — buffers sendText calls while connecting, flushes on open
15
16
  */
16
17
  export type SocketReplyHandler = (reply: string, ticketId?: string) => void;
17
18
  interface EscalationSocketOptions {
@@ -27,6 +28,9 @@ export declare class EscalationSocket {
27
28
  private reconnectAttempts;
28
29
  private reconnectTimer;
29
30
  private intentionalClose;
31
+ private _hasErrored;
32
+ /** Messages buffered while the socket is connecting / reconnecting. */
33
+ private messageQueue;
30
34
  private readonly onReply;
31
35
  private readonly onError?;
32
36
  private readonly onTypingChange?;
@@ -34,9 +38,22 @@ export declare class EscalationSocket {
34
38
  private readonly maxReconnectAttempts;
35
39
  constructor(options: EscalationSocketOptions);
36
40
  connect(wsUrl: string): void;
41
+ /** True if the underlying WebSocket is open and ready to send. */
42
+ get isConnected(): boolean;
43
+ /** True if the socket encountered an error (and may not be reliable to reuse). */
44
+ get hasErrored(): boolean;
45
+ /**
46
+ * Send a text message to the live agent.
47
+ *
48
+ * If the socket is currently connecting or reconnecting, the message is
49
+ * buffered and sent automatically once the connection is established.
50
+ * Returns `true` in both cases (connected send + queued send).
51
+ * Returns `false` only if the socket has no URL (was never connected).
52
+ */
37
53
  sendText(text: string): boolean;
38
54
  sendTypingStatus(isTyping: boolean): boolean;
39
55
  disconnect(): void;
56
+ private flushQueue;
40
57
  private openConnection;
41
58
  private scheduleReconnect;
42
59
  }
@@ -0,0 +1,24 @@
1
+ import type { ReportedIssue } from './types';
2
+ export interface ReportedIssueEventSourceOptions {
3
+ url: string;
4
+ onIssueUpdate?: (issue: ReportedIssue) => void;
5
+ onConnected?: () => void;
6
+ onError?: (error: Error) => void;
7
+ }
8
+ export declare class ReportedIssueEventSource {
9
+ private abortController;
10
+ private intentionalClose;
11
+ private reconnectAttempts;
12
+ private reconnectTimer;
13
+ private readonly maxReconnectAttempts;
14
+ private readonly options;
15
+ constructor(options: ReportedIssueEventSourceOptions);
16
+ connect(): void;
17
+ disconnect(): void;
18
+ private openConnection;
19
+ private readStream;
20
+ private readFullResponse;
21
+ private handleEvent;
22
+ private scheduleReconnect;
23
+ }
24
+ //# sourceMappingURL=ReportedIssueEventSource.d.ts.map
@@ -18,6 +18,11 @@ export interface EscalationToolDeps {
18
18
  role: string;
19
19
  content: string;
20
20
  }>;
21
+ getToolCalls?: () => Array<{
22
+ name: string;
23
+ input: Record<string, unknown>;
24
+ output: string;
25
+ }>;
21
26
  getScreenFlow?: () => string[];
22
27
  onHumanReply?: (reply: string, ticketId?: string) => void;
23
28
  onEscalationStarted?: (ticketId: string, socket: EscalationSocket) => void;
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * Support Mode — barrel export.
3
3
  */
4
- export type { SupportModeConfig, QuickReply, EscalationConfig, EscalationContext, CSATConfig, CSATRating, BusinessHoursConfig, SupportTicket, } from './types';
4
+ export type { SupportModeConfig, QuickReply, EscalationConfig, EscalationContext, CSATConfig, CSATRating, BusinessHoursConfig, SupportTicket, ReportedIssue, ReportedIssueCustomerStatus, ReportedIssueStatusUpdate, } from './types';
5
5
  export { buildSupportPrompt } from './supportPrompt';
6
6
  export { createEscalateTool } from './escalateTool';
7
+ export { createReportIssueTool } from './reportIssueTool';
7
8
  export { EscalationSocket } from './EscalationSocket';
8
9
  export type { SocketReplyHandler } from './EscalationSocket';
9
10
  export { EscalationEventSource } from './EscalationEventSource';
@@ -0,0 +1,20 @@
1
+ import type { ToolDefinition } from '../core/types';
2
+ export interface ReportIssueToolDeps {
3
+ analyticsKey?: string;
4
+ getCurrentScreen: () => string;
5
+ getHistory: () => Array<{
6
+ role: string;
7
+ content: string;
8
+ }>;
9
+ getScreenFlow?: () => string[];
10
+ userContext?: {
11
+ userId?: string;
12
+ name?: string;
13
+ email?: string;
14
+ phone?: string;
15
+ plan?: string;
16
+ custom?: Record<string, string | number | boolean>;
17
+ };
18
+ }
19
+ export declare function createReportIssueTool({ analyticsKey, getCurrentScreen, getHistory, getScreenFlow, userContext, }: ReportIssueToolDeps): ToolDefinition | null;
20
+ //# sourceMappingURL=reportIssueTool.d.ts.map
@@ -38,6 +38,31 @@ export interface SupportModeConfig {
38
38
  * Example: ['billing dispute', 'account deletion', 'legal']
39
39
  */
40
40
  autoEscalateTopics?: string[];
41
+ /**
42
+ * Options for the AI's persona and tone.
43
+ */
44
+ persona?: {
45
+ /** The agent's name to use in conversation. */
46
+ agentName?: string;
47
+ /** The tone of the AI (e.g., 'professional', 'casual', 'empathetic'). Default: 'empathetic' */
48
+ tone?: string;
49
+ /** How the AI signs off at the end of a resolution (e.g., 'Best, Support Team') */
50
+ signOff?: string;
51
+ };
52
+ /**
53
+ * Consumer-defined "WOW actions" — special tools the AI can use to surprise/delight
54
+ * the user (e.g. apply discount, extend trial) when they've had a frustrating experience.
55
+ */
56
+ wowActions?: Array<{
57
+ /** Internal name for the tool (e.g., 'apply_discount') */
58
+ name: string;
59
+ /** What the action does */
60
+ description: string;
61
+ /** Instructions specifying exactly when the AI should trigger this action */
62
+ triggerHint: string;
63
+ /** Callback when the AI executes this action */
64
+ handler: (args: Record<string, any>) => Promise<string | void>;
65
+ }>;
41
66
  }
42
67
  export interface QuickReply {
43
68
  /** Display text on the button */
@@ -78,7 +103,9 @@ export interface EscalationContext {
78
103
  export interface CSATConfig {
79
104
  /** Enable CSAT survey after conversation. Default: true if support mode enabled */
80
105
  enabled?: boolean;
81
- /** Question text. Default: "How was your experience?" */
106
+ /** Which survey to show. 'csat' = Customer Satisfaction, 'ces' = Customer Effort Score. Default: 'csat' */
107
+ surveyType?: 'csat' | 'ces';
108
+ /** Question text. Default varies by surveyType ("How was your experience?" or "How easy was it to resolve your issue?") */
82
109
  question?: string;
83
110
  /** Rating type. Default: 'emoji' */
84
111
  ratingType?: 'stars' | 'emoji' | 'thumbs';
@@ -98,6 +125,7 @@ export interface CSATRating {
98
125
  stepsCount: number;
99
126
  wasEscalated: boolean;
100
127
  screen: string;
128
+ ticketId?: string;
101
129
  };
102
130
  }
103
131
  export interface BusinessHoursConfig {
@@ -126,4 +154,31 @@ export interface SupportTicket {
126
154
  /** Number of unread messages (computed by backend = history.length - readMessageCount) */
127
155
  unreadCount?: number;
128
156
  }
157
+ export type ReportedIssueCustomerStatus = 'acknowledged' | 'investigating' | 'answered' | 'resolved' | 'escalated';
158
+ export interface ReportedIssueStatusUpdate {
159
+ id: string;
160
+ status: ReportedIssueCustomerStatus;
161
+ message: string;
162
+ source: 'ai' | 'operator' | 'system';
163
+ timestamp: string;
164
+ }
165
+ export interface ReportedIssue {
166
+ id: string;
167
+ issueType: string;
168
+ complaintSummary: string;
169
+ verificationStatus: string;
170
+ severity: string;
171
+ confidence?: number | null;
172
+ screen: string;
173
+ evidenceSummary?: string | null;
174
+ aiSummary?: string | null;
175
+ recommendedAction?: string | null;
176
+ sourceScreens?: string[] | null;
177
+ screenFlow?: string[] | null;
178
+ customerStatus: ReportedIssueCustomerStatus;
179
+ statusHistory: ReportedIssueStatusUpdate[];
180
+ createdAt: string;
181
+ updatedAt: string;
182
+ linkedEscalationTicketId?: string | null;
183
+ }
129
184
  //# sourceMappingURL=types.d.ts.map
@@ -1,8 +1,23 @@
1
+ export interface LogEntry {
2
+ level: 'info' | 'warn' | 'error' | 'debug';
3
+ context: string;
4
+ args: any[];
5
+ timestamp: number;
6
+ message: string;
7
+ }
1
8
  export declare const logger: {
2
9
  /** Enable or disable all SDK logging. */
3
10
  setEnabled: (value: boolean) => void;
4
11
  /** Check if logging is enabled. */
5
12
  isEnabled: () => boolean;
13
+ /** Return a snapshot of recent SDK log entries. */
14
+ getEntries: () => LogEntry[];
15
+ /** Return recent entries as plain text lines, newest last. */
16
+ getRecentLines: (limit?: number) => string[];
17
+ /** Extract unflushed entries as plain text and clear the unflushed buffer. */
18
+ extractUnflushedLines: () => string[];
19
+ /** Clear the in-memory SDK log history. */
20
+ clearEntries: () => void;
6
21
  info: (context: string, ...args: any[]) => void;
7
22
  warn: (context: string, ...args: any[]) => void;
8
23
  error: (context: string, ...args: any[]) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobileai/react-native",
3
- "version": "0.9.18",
3
+ "version": "0.9.20",
4
4
  "description": "Build autonomous AI agents for React Native and Expo apps. Provides AI-native UI traversal, tool calling, and structured reasoning.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -21,6 +21,7 @@
21
21
  },
22
22
  "files": [
23
23
  "lib",
24
+ "src/specs",
24
25
  "bin",
25
26
  "generate-map.js",
26
27
  "android",
@@ -84,7 +85,7 @@
84
85
  "url": "git+https://github.com/MobileAIAgent/react-native.git"
85
86
  },
86
87
  "author": "Mohamed Salah <mohamed2m2018@gmail.com> (https://example.com)",
87
- "license": "MIT",
88
+ "license": "SEE LICENSE IN LICENSE",
88
89
  "bugs": {
89
90
  "url": "https://github.com/MobileAIAgent/react-native/issues"
90
91
  },
@@ -117,27 +118,33 @@
117
118
  "react-native-builder-bob": "^0.40.18",
118
119
  "react-test-renderer": "^19.2.0",
119
120
  "turbo": "^2.5.6",
120
- "typescript": "^5.9.2"
121
- },
122
- "dependencies": {
121
+ "typescript": "^5.9.2",
123
122
  "@google/genai": "^1.0.0",
124
123
  "react-native-audio-api": "*"
125
124
  },
126
125
  "peerDependencies": {
126
+ "@google/genai": "*",
127
127
  "@react-native-async-storage/async-storage": "*",
128
128
  "expo-speech-recognition": "*",
129
129
  "react": "*",
130
130
  "react-native": "*",
131
131
  "react-native-audio-api": "*",
132
+ "react-native-screens": "*",
132
133
  "react-native-view-shot": "*"
133
134
  },
134
135
  "peerDependenciesMeta": {
136
+ "@google/genai": {
137
+ "optional": true
138
+ },
135
139
  "@react-native-async-storage/async-storage": {
136
140
  "optional": true
137
141
  },
138
142
  "react-native-audio-api": {
139
143
  "optional": true
140
144
  },
145
+ "react-native-screens": {
146
+ "optional": true
147
+ },
141
148
  "react-native-view-shot": {
142
149
  "optional": true
143
150
  },
@@ -145,6 +152,14 @@
145
152
  "optional": true
146
153
  }
147
154
  },
155
+ "codegenConfig": {
156
+ "name": "RNMobileAIOverlaySpec",
157
+ "type": "components",
158
+ "jsSrcsDir": "src/specs",
159
+ "android": {
160
+ "javaPackageName": "com.mobileai.overlay"
161
+ }
162
+ },
148
163
  "workspaces": [
149
164
  "example-react-navigation"
150
165
  ],
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ dependency: {
3
+ platforms: {
4
+ android: {
5
+ sourceDir: './android',
6
+ packageImportPath: 'import com.mobileai.overlay.MobileAIOverlayPackage;',
7
+ packageInstance: 'new MobileAIOverlayPackage()',
8
+ },
9
+ ios: {},
10
+ },
11
+ },
12
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Codegen spec for MobileAIFloatingOverlay native view.
3
+ *
4
+ * This file is required by React Native's Codegen (New Architecture / Fabric).
5
+ * It defines the TypeScript interface for the native view. During the build,
6
+ * Codegen uses this spec to generate C++ glue code that bridges JS and native.
7
+ *
8
+ * Consumers don't use this directly — use FloatingOverlayWrapper.tsx instead.
9
+ *
10
+ * Naming convention: file must end in NativeComponent.ts (Codegen convention).
11
+ */
12
+
13
+ import type { ViewProps } from 'react-native';
14
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
15
+
16
+ export interface NativeProps extends ViewProps {}
17
+
18
+ // Codegen reads this export to generate the native component interfaces.
19
+ export default codegenNativeComponent<NativeProps>('MobileAIFloatingOverlay');