@mobileai/react-native 0.9.0 → 0.9.2

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 (173) hide show
  1. package/README.md +121 -0
  2. package/lib/module/components/AIAgent.js +248 -53
  3. package/lib/module/components/AIAgent.js.map +1 -1
  4. package/lib/module/components/AIZone.js +140 -0
  5. package/lib/module/components/AIZone.js.map +1 -0
  6. package/lib/module/components/AgentErrorBoundary.js +9 -0
  7. package/lib/module/components/AgentErrorBoundary.js.map +1 -1
  8. package/lib/module/components/HighlightOverlay.js +138 -0
  9. package/lib/module/components/HighlightOverlay.js.map +1 -0
  10. package/lib/module/components/ProactiveHint.js +138 -0
  11. package/lib/module/components/ProactiveHint.js.map +1 -0
  12. package/lib/module/components/cards/InfoCard.js +65 -0
  13. package/lib/module/components/cards/InfoCard.js.map +1 -0
  14. package/lib/module/components/cards/ReviewSummary.js +74 -0
  15. package/lib/module/components/cards/ReviewSummary.js.map +1 -0
  16. package/lib/module/core/AgentRuntime.js +16 -3
  17. package/lib/module/core/AgentRuntime.js.map +1 -1
  18. package/lib/module/core/FiberTreeWalker.js +62 -85
  19. package/lib/module/core/FiberTreeWalker.js.map +1 -1
  20. package/lib/module/core/IdleDetector.js +51 -0
  21. package/lib/module/core/IdleDetector.js.map +1 -0
  22. package/lib/module/core/ZoneRegistry.js +47 -0
  23. package/lib/module/core/ZoneRegistry.js.map +1 -0
  24. package/lib/module/core/systemPrompt.js +2 -0
  25. package/lib/module/core/systemPrompt.js.map +1 -1
  26. package/lib/module/index.js +21 -0
  27. package/lib/module/index.js.map +1 -1
  28. package/lib/module/services/AudioOutputService.js +10 -0
  29. package/lib/module/services/AudioOutputService.js.map +1 -1
  30. package/lib/module/services/flags/FlagService.js +117 -0
  31. package/lib/module/services/flags/FlagService.js.map +1 -0
  32. package/lib/module/services/telemetry/MobileAI.js +66 -0
  33. package/lib/module/services/telemetry/MobileAI.js.map +1 -0
  34. package/lib/module/services/telemetry/PiiScrubber.js +17 -0
  35. package/lib/module/services/telemetry/PiiScrubber.js.map +1 -0
  36. package/lib/module/services/telemetry/TelemetryService.js +260 -0
  37. package/lib/module/services/telemetry/TelemetryService.js.map +1 -0
  38. package/lib/module/services/telemetry/TouchAutoCapture.js +159 -0
  39. package/lib/module/services/telemetry/TouchAutoCapture.js.map +1 -0
  40. package/lib/module/services/telemetry/device.js +19 -0
  41. package/lib/module/services/telemetry/device.js.map +1 -0
  42. package/lib/module/services/telemetry/index.js +9 -0
  43. package/lib/module/services/telemetry/index.js.map +1 -0
  44. package/lib/module/services/telemetry/types.js +2 -0
  45. package/lib/module/services/telemetry/types.js.map +1 -0
  46. package/lib/module/support/CSATSurvey.js +273 -0
  47. package/lib/module/support/CSATSurvey.js.map +1 -0
  48. package/lib/module/support/EscalationSocket.js +92 -0
  49. package/lib/module/support/EscalationSocket.js.map +1 -0
  50. package/lib/module/support/SupportGreeting.js +142 -0
  51. package/lib/module/support/SupportGreeting.js.map +1 -0
  52. package/lib/module/support/escalateTool.js +120 -0
  53. package/lib/module/support/escalateTool.js.map +1 -0
  54. package/lib/module/support/index.js +18 -0
  55. package/lib/module/support/index.js.map +1 -0
  56. package/lib/module/support/supportPrompt.js +47 -0
  57. package/lib/module/support/supportPrompt.js.map +1 -0
  58. package/lib/module/support/types.js +2 -0
  59. package/lib/module/support/types.js.map +1 -0
  60. package/lib/module/tools/guideTool.js +61 -0
  61. package/lib/module/tools/guideTool.js.map +1 -0
  62. package/lib/module/tools/index.js +3 -0
  63. package/lib/module/tools/index.js.map +1 -1
  64. package/lib/module/tools/restoreTool.js +31 -0
  65. package/lib/module/tools/restoreTool.js.map +1 -0
  66. package/lib/module/tools/simplifyTool.js +31 -0
  67. package/lib/module/tools/simplifyTool.js.map +1 -0
  68. package/lib/module/types/jsx.d.js +4 -0
  69. package/lib/module/types/jsx.d.js.map +1 -0
  70. package/lib/typescript/src/components/AIAgent.d.ts +21 -2
  71. package/lib/typescript/src/components/AIAgent.d.ts.map +1 -1
  72. package/lib/typescript/src/components/AIZone.d.ts +16 -0
  73. package/lib/typescript/src/components/AIZone.d.ts.map +1 -0
  74. package/lib/typescript/src/components/AgentErrorBoundary.d.ts +1 -0
  75. package/lib/typescript/src/components/AgentErrorBoundary.d.ts.map +1 -1
  76. package/lib/typescript/src/components/HighlightOverlay.d.ts +10 -0
  77. package/lib/typescript/src/components/HighlightOverlay.d.ts.map +1 -0
  78. package/lib/typescript/src/components/ProactiveHint.d.ts +10 -0
  79. package/lib/typescript/src/components/ProactiveHint.d.ts.map +1 -0
  80. package/lib/typescript/src/components/cards/InfoCard.d.ts +19 -0
  81. package/lib/typescript/src/components/cards/InfoCard.d.ts.map +1 -0
  82. package/lib/typescript/src/components/cards/ReviewSummary.d.ts +19 -0
  83. package/lib/typescript/src/components/cards/ReviewSummary.d.ts.map +1 -0
  84. package/lib/typescript/src/core/AgentRuntime.d.ts +1 -0
  85. package/lib/typescript/src/core/AgentRuntime.d.ts.map +1 -1
  86. package/lib/typescript/src/core/FiberTreeWalker.d.ts.map +1 -1
  87. package/lib/typescript/src/core/IdleDetector.d.ts +27 -0
  88. package/lib/typescript/src/core/IdleDetector.d.ts.map +1 -0
  89. package/lib/typescript/src/core/ZoneRegistry.d.ts +13 -0
  90. package/lib/typescript/src/core/ZoneRegistry.d.ts.map +1 -0
  91. package/lib/typescript/src/core/systemPrompt.d.ts.map +1 -1
  92. package/lib/typescript/src/core/types.d.ts +54 -0
  93. package/lib/typescript/src/core/types.d.ts.map +1 -1
  94. package/lib/typescript/src/index.d.ts +5 -0
  95. package/lib/typescript/src/index.d.ts.map +1 -1
  96. package/lib/typescript/src/services/AudioOutputService.d.ts.map +1 -1
  97. package/lib/typescript/src/services/flags/FlagService.d.ts +25 -0
  98. package/lib/typescript/src/services/flags/FlagService.d.ts.map +1 -0
  99. package/lib/typescript/src/services/telemetry/MobileAI.d.ts +38 -0
  100. package/lib/typescript/src/services/telemetry/MobileAI.d.ts.map +1 -0
  101. package/lib/typescript/src/services/telemetry/PiiScrubber.d.ts +6 -0
  102. package/lib/typescript/src/services/telemetry/PiiScrubber.d.ts.map +1 -0
  103. package/lib/typescript/src/services/telemetry/TelemetryService.d.ts +49 -0
  104. package/lib/typescript/src/services/telemetry/TelemetryService.d.ts.map +1 -0
  105. package/lib/typescript/src/services/telemetry/TouchAutoCapture.d.ts +28 -0
  106. package/lib/typescript/src/services/telemetry/TouchAutoCapture.d.ts.map +1 -0
  107. package/lib/typescript/src/services/telemetry/device.d.ts +7 -0
  108. package/lib/typescript/src/services/telemetry/device.d.ts.map +1 -0
  109. package/lib/typescript/src/services/telemetry/index.d.ts +7 -0
  110. package/lib/typescript/src/services/telemetry/index.d.ts.map +1 -0
  111. package/lib/typescript/src/services/telemetry/types.d.ts +50 -0
  112. package/lib/typescript/src/services/telemetry/types.d.ts.map +1 -0
  113. package/lib/typescript/src/support/CSATSurvey.d.ts +20 -0
  114. package/lib/typescript/src/support/CSATSurvey.d.ts.map +1 -0
  115. package/lib/typescript/src/support/EscalationSocket.d.ts +38 -0
  116. package/lib/typescript/src/support/EscalationSocket.d.ts.map +1 -0
  117. package/lib/typescript/src/support/SupportGreeting.d.ts +19 -0
  118. package/lib/typescript/src/support/SupportGreeting.d.ts.map +1 -0
  119. package/lib/typescript/src/support/escalateTool.d.ts +25 -0
  120. package/lib/typescript/src/support/escalateTool.d.ts.map +1 -0
  121. package/lib/typescript/src/support/index.d.ts +11 -0
  122. package/lib/typescript/src/support/index.d.ts.map +1 -0
  123. package/lib/typescript/src/support/supportPrompt.d.ts +12 -0
  124. package/lib/typescript/src/support/supportPrompt.d.ts.map +1 -0
  125. package/lib/typescript/src/support/types.d.ts +114 -0
  126. package/lib/typescript/src/support/types.d.ts.map +1 -0
  127. package/lib/typescript/src/tools/guideTool.d.ts +4 -0
  128. package/lib/typescript/src/tools/guideTool.d.ts.map +1 -0
  129. package/lib/typescript/src/tools/index.d.ts +3 -0
  130. package/lib/typescript/src/tools/index.d.ts.map +1 -1
  131. package/lib/typescript/src/tools/restoreTool.d.ts +3 -0
  132. package/lib/typescript/src/tools/restoreTool.d.ts.map +1 -0
  133. package/lib/typescript/src/tools/simplifyTool.d.ts +3 -0
  134. package/lib/typescript/src/tools/simplifyTool.d.ts.map +1 -0
  135. package/lib/typescript/src/tools/types.d.ts +2 -0
  136. package/lib/typescript/src/tools/types.d.ts.map +1 -1
  137. package/package.json +5 -1
  138. package/src/components/AIAgent.tsx +253 -15
  139. package/src/components/AIZone.tsx +147 -0
  140. package/src/components/AgentErrorBoundary.tsx +10 -0
  141. package/src/components/HighlightOverlay.tsx +136 -0
  142. package/src/components/ProactiveHint.tsx +145 -0
  143. package/src/components/cards/InfoCard.tsx +58 -0
  144. package/src/components/cards/ReviewSummary.tsx +76 -0
  145. package/src/core/AgentRuntime.ts +18 -0
  146. package/src/core/FiberTreeWalker.ts +71 -93
  147. package/src/core/IdleDetector.ts +72 -0
  148. package/src/core/ZoneRegistry.ts +44 -0
  149. package/src/core/systemPrompt.ts +2 -0
  150. package/src/core/types.ts +60 -0
  151. package/src/index.ts +31 -0
  152. package/src/services/AudioOutputService.ts +13 -0
  153. package/src/services/flags/FlagService.ts +137 -0
  154. package/src/services/telemetry/MobileAI.ts +66 -0
  155. package/src/services/telemetry/PiiScrubber.ts +17 -0
  156. package/src/services/telemetry/TelemetryService.ts +291 -0
  157. package/src/services/telemetry/TouchAutoCapture.ts +165 -0
  158. package/src/services/telemetry/device.ts +16 -0
  159. package/src/services/telemetry/index.ts +13 -0
  160. package/src/services/telemetry/types.ts +75 -0
  161. package/src/support/CSATSurvey.tsx +304 -0
  162. package/src/support/EscalationSocket.ts +113 -0
  163. package/src/support/SupportGreeting.tsx +161 -0
  164. package/src/support/escalateTool.ts +134 -0
  165. package/src/support/index.ts +27 -0
  166. package/src/support/supportPrompt.ts +55 -0
  167. package/src/support/types.ts +141 -0
  168. package/src/tools/guideTool.ts +67 -0
  169. package/src/tools/index.ts +3 -0
  170. package/src/tools/restoreTool.ts +33 -0
  171. package/src/tools/simplifyTool.ts +33 -0
  172. package/src/tools/types.ts +2 -0
  173. package/src/types/jsx.d.ts +20 -0
@@ -5,6 +5,9 @@
5
5
  * Auto-detects interactive elements via React Fiber tree traversal.
6
6
  */
7
7
  export { AIAgent } from './components/AIAgent';
8
+ export { AIZone } from './components/AIZone';
9
+ export { InfoCard } from './components/cards/InfoCard';
10
+ export { ReviewSummary } from './components/cards/ReviewSummary';
8
11
  export { GeminiProvider } from './providers/GeminiProvider';
9
12
  export { OpenAIProvider } from './providers/OpenAIProvider';
10
13
  export { createProvider } from './providers/ProviderFactory';
@@ -16,4 +19,6 @@ export { KnowledgeBaseService } from './services/KnowledgeBaseService';
16
19
  export { logger } from './utils/logger';
17
20
  export type { AgentConfig, AgentMode, ExecutionResult, InteractiveElement, DehydratedScreen, ToolDefinition, ActionDefinition, TokenUsage, KnowledgeEntry, KnowledgeRetriever, KnowledgeBaseConfig, ChatBarTheme, AIMessage, AIProviderName, ScreenMap, ScreenMapEntry, } from './core/types';
18
21
  export type { VoiceServiceConfig, VoiceServiceCallbacks, VoiceStatus, } from './services/VoiceService';
22
+ export { SupportGreeting, CSATSurvey, buildSupportPrompt, createEscalateTool } from './support';
23
+ export type { SupportModeConfig, QuickReply, EscalationConfig, EscalationContext, CSATConfig, CSATRating, BusinessHoursConfig, } from './support';
19
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGvE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,YAAY,EACV,WAAW,EACX,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,cAAc,EACd,SAAS,EACT,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,WAAW,GACZ,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAGjE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAOvE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,YAAY,EACV,WAAW,EACX,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,cAAc,EACd,SAAS,EACT,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,WAAW,GACZ,MAAM,yBAAyB,CAAC;AAYjC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEhG,YAAY,EACV,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,mBAAmB,GACpB,MAAM,WAAW,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AudioOutputService.d.ts","sourceRoot":"","sources":["../../../../src/services/AudioOutputService.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAID,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,UAAU,CAAK;gBAEX,MAAM,GAAE,iBAAsB;IAMpC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IA8DpC,uEAAuE;IACvE,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAwDlC,IAAI,IAAI,IAAI;IAQZ,MAAM,IAAI,IAAI;IAQd,IAAI,OAAO,IAAI,OAAO,CAErB;IAIK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAyBrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAa/B"}
1
+ {"version":3,"file":"AudioOutputService.d.ts","sourceRoot":"","sources":["../../../../src/services/AudioOutputService.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAID,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,UAAU,CAAK;gBAEX,MAAM,GAAE,iBAAsB;IAMpC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IA0EpC,uEAAuE;IACvE,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAwDlC,IAAI,IAAI,IAAI;IAQZ,MAAM,IAAI,IAAI;IAQd,IAAI,OAAO,IAAI,OAAO,CAErB;IAIK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAyBrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAa/B"}
@@ -0,0 +1,25 @@
1
+ export interface FeatureFlagPayload {
2
+ key: string;
3
+ variants: string[];
4
+ rollout: number[];
5
+ }
6
+ export declare class FlagService {
7
+ private hostUrl;
8
+ private assignments;
9
+ private fetched;
10
+ constructor(hostUrl: string);
11
+ /**
12
+ * Fetch feature flags from the dashboard backend
13
+ */
14
+ fetch(analyticsKey: string, userId?: string): Promise<void>;
15
+ /**
16
+ * Deterministically assign a variant using murmurhash.
17
+ */
18
+ private assignVariant;
19
+ private assignAll;
20
+ /** Get a specific flag value */
21
+ getFlag(key: string, defaultValue?: string): string;
22
+ /** Get all active assignments for telemetry */
23
+ getAllFlags(): Record<string, string>;
24
+ }
25
+ //# sourceMappingURL=FlagService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlagService.d.ts","sourceRoot":"","sources":["../../../../../src/services/flags/FlagService.ts"],"names":[],"mappings":"AA0DA,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,qBAAa,WAAW;IAIV,OAAO,CAAC,OAAO;IAH3B,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,OAAO,CAAkB;gBAEb,OAAO,EAAE,MAAM;IAEnC;;OAEG;IACG,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBjE;;OAEG;IACH,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,SAAS;IAajB,gCAAgC;IAChC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM;IAOnD,+CAA+C;IAC/C,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAGtC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * MobileAI — Public static API for consumer event tracking.
3
+ *
4
+ * Usage:
5
+ * import { MobileAI } from '@mobileai/react-native';
6
+ * MobileAI.track('purchase_complete', { total: 29.99 });
7
+ *
8
+ * The TelemetryService instance is injected by the <AIAgent> component.
9
+ * If no analyticsKey is configured, all calls are no-ops.
10
+ */
11
+ import type { TelemetryService } from './TelemetryService';
12
+ export declare const MobileAI: {
13
+ /**
14
+ * Track a custom business event.
15
+ * @param eventName - Name of the event (e.g., 'purchase_complete')
16
+ * @param data - Event-specific key-value data
17
+ */
18
+ track(eventName: string, data?: Record<string, unknown>): void;
19
+ /**
20
+ * Identify the current user (optional, for user-level analytics).
21
+ * @param userId - Unique user identifier (hashed by consumer)
22
+ * @param traits - Optional user traits (plan, role, etc.)
23
+ */
24
+ identify(userId: string, traits?: Record<string, unknown>): void;
25
+ /**
26
+ * Get an assigned feature flag variation for the current device.
27
+ * Deterministic via murmurhash. Call after MobileAI has initialized.
28
+ * @param key Flag key
29
+ * @param defaultValue Fallback if not assigned
30
+ */
31
+ getFlag(key: string, defaultValue?: string): string;
32
+ };
33
+ /**
34
+ * Internal: Bind the TelemetryService instance (called by AIAgent on mount).
35
+ * Not exported to consumers.
36
+ */
37
+ export declare function bindTelemetryService(instance: TelemetryService | null): void;
38
+ //# sourceMappingURL=MobileAI.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MobileAI.d.ts","sourceRoot":"","sources":["../../../../../src/services/telemetry/MobileAI.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAO3D,eAAO,MAAM,QAAQ;IACnB;;;;OAIG;qBACc,MAAM,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAQ,IAAI;IAQlE;;;;OAIG;qBACc,MAAM,WAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAQ,IAAI;IAQpE;;;;;OAKG;iBACU,MAAM,iBAAiB,MAAM,GAAG,MAAM;CAMpD,CAAC;AAEF;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAE5E"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Scrubs common PII patterns from strings.
3
+ * Used by TelemetryService to sanitize auto-captured touch labels.
4
+ */
5
+ export declare function scrubPII(value: string): string;
6
+ //# sourceMappingURL=PiiScrubber.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PiiScrubber.d.ts","sourceRoot":"","sources":["../../../../../src/services/telemetry/PiiScrubber.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ9C"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * TelemetryService — Batches and sends analytics events to MobileAI Cloud.
3
+ *
4
+ * Features:
5
+ * - Event batching (flush every N seconds or N events)
6
+ * - Offline queue with retry on reconnect
7
+ * - Lightweight — no native dependencies
8
+ * - Opt-in only (requires analyticsKey or analyticsProxyUrl)
9
+ */
10
+ import type { TelemetryConfig } from './types';
11
+ import { FlagService } from '../flags/FlagService';
12
+ export declare class TelemetryService {
13
+ private queue;
14
+ private config;
15
+ private sessionId;
16
+ private currentScreen;
17
+ private flushTimer;
18
+ private isFlushing;
19
+ private appStateSubscription;
20
+ /** Public getter for the current screen, used by auto-capture utilities */
21
+ get screen(): string;
22
+ /**
23
+ * True while the AI agent is executing a tool (tap, type, navigate, etc.).
24
+ * The touch interceptor checks this flag to avoid double-counting AI actions
25
+ * as human interactions. Agent steps are already tracked as agent_step events.
26
+ */
27
+ isAgentActing: boolean;
28
+ flags: FlagService;
29
+ /** Set by AgentRuntime before/after each tool execution. */
30
+ setAgentActing(active: boolean): void;
31
+ constructor(config: TelemetryConfig);
32
+ /** Start the telemetry service (call on mount) */
33
+ start(): Promise<void>;
34
+ /** Stop the telemetry service (call on unmount) */
35
+ stop(): Promise<void>;
36
+ /** Track an event (auto or custom) */
37
+ track(type: string, data?: Record<string, unknown>): void;
38
+ /** Update current screen (called by AIAgent on navigation) */
39
+ setScreen(screenName: string): void;
40
+ /** Send queued events to the cloud API */
41
+ flush(): Promise<void>;
42
+ /** Save queued events to AsyncStorage for crash/restart recovery */
43
+ private persistQueue;
44
+ /** Restore queued events from previous session */
45
+ private restoreQueue;
46
+ /** Check if telemetry is configured */
47
+ private isEnabled;
48
+ }
49
+ //# sourceMappingURL=TelemetryService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TelemetryService.d.ts","sourceRoot":"","sources":["../../../../../src/services/telemetry/TelemetryService.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAGV,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AA8BnD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAAwB;IACrC,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,UAAU,CAA+C;IACjE,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,oBAAoB,CAA6D;IAEzF,2EAA2E;IAC3E,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;OAIG;IACH,aAAa,UAAS;IAEf,KAAK,EAAE,WAAW,CAAC;IAE1B,4DAA4D;IAC5D,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;gBAIzB,MAAM,EAAE,eAAe;IAgBnC,kDAAkD;IAC5C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAwC5B,mDAAmD;IAC7C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA0B3B,sCAAsC;IACtC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IAmC7D,8DAA8D;IAC9D,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAcnC,0CAA0C;IACpC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA8C5B,oEAAoE;YACtD,YAAY;IAS1B,kDAAkD;YACpC,YAAY;IAiB1B,uCAAuC;IACvC,OAAO,CAAC,SAAS;CAGlB"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * TouchAutoCapture — Extracts a human-readable label from a React Native
3
+ * touch event target by walking up the native view hierarchy.
4
+ *
5
+ * Used by AIAgent to auto-track every tap in the app without
6
+ * any developer code changes (zero-config analytics).
7
+ *
8
+ * Strategy:
9
+ * 1. Read the touched element's accessibilityLabel (best signal).
10
+ * 2. If none, use React Native's internal _children to find nested text.
11
+ * 3. Fallback to the component's testID.
12
+ * 4. Last resort: "Unknown Element".
13
+ */
14
+ import type { TelemetryService } from './TelemetryService';
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.
18
+ */
19
+ export declare function checkRageClick(label: string, telemetry: TelemetryService): void;
20
+ /**
21
+ * Extract a label from a GestureResponderEvent's native target.
22
+ *
23
+ * @param nativeEvent - The nativeEvent from onStartShouldSetResponderCapture
24
+ * @param rootRef - The root View ref (to resolve relative positions)
25
+ * @returns A descriptive label string for the tapped element
26
+ */
27
+ export declare function extractTouchLabel(nativeEvent: any): string;
28
+ //# sourceMappingURL=TouchAutoCapture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TouchAutoCapture.d.ts","sourceRoot":"","sources":["../../../../../src/services/telemetry/TouchAutoCapture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAM3D;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAgB/E;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,GAAG,GAAG,MAAM,CA6D1D"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Deterministic device ID based on platform info.
3
+ * This ensures analytics and flags remain consistent across sessions
4
+ * without collecting PII hardware identifiers.
5
+ */
6
+ export declare function getDeviceId(): string;
7
+ //# sourceMappingURL=device.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../../../../src/services/telemetry/device.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAQpC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Telemetry module barrel export.
3
+ */
4
+ export { TelemetryService } from './TelemetryService';
5
+ export { MobileAI, bindTelemetryService } from './MobileAI';
6
+ export type { TelemetryEvent, TelemetryBatch, TelemetryConfig, AutoEventType, EventType, } from './types';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/telemetry/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC5D,YAAY,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACb,SAAS,GACV,MAAM,SAAS,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Telemetry types for the MobileAI analytics module.
3
+ *
4
+ * Events are split into two categories:
5
+ * 1. Auto-captured: SDK captures these without consumer code
6
+ * 2. Consumer-tracked: via MobileAI.track() API
7
+ */
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';
10
+ /** All event types (auto + custom) */
11
+ export type EventType = AutoEventType | string;
12
+ export interface TelemetryEvent {
13
+ /** Event type identifier */
14
+ type: EventType;
15
+ /** Event-specific data */
16
+ data: Record<string, unknown>;
17
+ /** ISO 8601 timestamp (auto-set by SDK) */
18
+ timestamp: string;
19
+ /** Current screen name (auto-attached) */
20
+ screen: string;
21
+ /** Session ID (auto-generated per app lifecycle) */
22
+ sessionId: string;
23
+ }
24
+ export interface TelemetryBatch {
25
+ /** Publishable analytics key */
26
+ analyticsKey: string;
27
+ /** App identifier (bundle ID / package name) */
28
+ appId: string;
29
+ /** Hashed user/device identifier */
30
+ deviceId: string;
31
+ /** SDK version */
32
+ sdkVersion: string;
33
+ /** Batch of events */
34
+ events: TelemetryEvent[];
35
+ }
36
+ export interface TelemetryConfig {
37
+ /** Publishable analytics key (mobileai_pub_xxx) */
38
+ analyticsKey?: string;
39
+ /** Proxy URL for enterprise customers (replaces direct cloud API) */
40
+ analyticsProxyUrl?: string;
41
+ /** Custom headers for proxy requests */
42
+ analyticsProxyHeaders?: Record<string, string>;
43
+ /** Flush interval in ms (default: 30000) */
44
+ flushIntervalMs?: number;
45
+ /** Max events before auto-flush (default: 50) */
46
+ maxBatchSize?: number;
47
+ /** Enable debug logging for telemetry (default: false) */
48
+ debug?: boolean;
49
+ }
50
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/services/telemetry/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,gCAAgC;AAChC,MAAM,MAAM,aAAa,GACrB,aAAa,GACb,aAAa,GACb,cAAc,GACd,eAAe,GACf,eAAe,GACf,aAAa,GACb,eAAe,GACf,YAAY,GACZ,gBAAgB,GAChB,YAAY,GACZ,iBAAiB,GACjB,gBAAgB,GAChB,eAAe,CAAC;AAEpB,sCAAsC;AACtC,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,MAAM,CAAC;AAI/C,MAAM,WAAW,cAAc;IAC7B,4BAA4B;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;CACnB;AAID,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B;AAID,MAAM,WAAW,eAAe;IAC9B,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,wCAAwC;IACxC,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C,4CAA4C;IAC5C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * CSAT Survey — Customer Satisfaction component.
3
+ *
4
+ * Shown after a support conversation ends (or after idle timeout).
5
+ * Supports three rating types: emoji, stars, thumbs.
6
+ */
7
+ import type { CSATConfig, CSATRating } from './types';
8
+ interface CSATSurveyProps {
9
+ config: CSATConfig;
10
+ metadata: CSATRating['metadata'];
11
+ onDismiss: () => void;
12
+ theme?: {
13
+ primaryColor?: string;
14
+ textColor?: string;
15
+ backgroundColor?: string;
16
+ };
17
+ }
18
+ export declare function CSATSurvey({ config, metadata, onDismiss, theme, }: CSATSurveyProps): import("react/jsx-runtime").JSX.Element;
19
+ export {};
20
+ //# sourceMappingURL=CSATSurvey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CSATSurvey.d.ts","sourceRoot":"","sources":["../../../../src/support/CSATSurvey.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEtD,UAAU,eAAe;IACvB,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IACjC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE;QACN,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAYD,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,QAAQ,EACR,SAAS,EACT,KAAK,GACN,EAAE,eAAe,2CAqKjB"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * EscalationSocket — manages a WebSocket connection to the MobileAI platform
3
+ * for receiving real-time replies from human support agents.
4
+ *
5
+ * Lifecycle:
6
+ * 1. SDK calls escalate_to_human → POST /api/v1/escalations → gets { ticketId, wsUrl }
7
+ * 2. EscalationSocket.connect(wsUrl) opens a WS connection
8
+ * 3. Platform pushes { type: 'reply', ticketId, reply } when agent responds
9
+ * 4. onReply callback fires → shown in chat UI as "👤 Human Agent: <reply>"
10
+ * 5. disconnect() on chat close / unmount
11
+ *
12
+ * Handles:
13
+ * - Server heartbeat pings (type: 'ping') — acknowledged silently
14
+ * - Auto-reconnect on unexpected close (max 3 attempts, exponential backoff)
15
+ */
16
+ export type SocketReplyHandler = (reply: string) => void;
17
+ interface EscalationSocketOptions {
18
+ onReply: SocketReplyHandler;
19
+ onError?: (error: Event) => void;
20
+ maxReconnectAttempts?: number;
21
+ }
22
+ export declare class EscalationSocket {
23
+ private ws;
24
+ private wsUrl;
25
+ private reconnectAttempts;
26
+ private reconnectTimer;
27
+ private intentionalClose;
28
+ private readonly onReply;
29
+ private readonly onError?;
30
+ private readonly maxReconnectAttempts;
31
+ constructor(options: EscalationSocketOptions);
32
+ connect(wsUrl: string): void;
33
+ disconnect(): void;
34
+ private openConnection;
35
+ private scheduleReconnect;
36
+ }
37
+ export {};
38
+ //# sourceMappingURL=EscalationSocket.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EscalationSocket.d.ts","sourceRoot":"","sources":["../../../../src/support/EscalationSocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AAEzD,UAAU,uBAAuB;IAC/B,OAAO,EAAE,kBAAkB,CAAC;IAC5B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,cAAc,CAA8C;IACpE,OAAO,CAAC,gBAAgB,CAAS;IAEjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAyB;IAClD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;gBAElC,OAAO,EAAE,uBAAuB;IAM5C,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAM5B,UAAU,IAAI,IAAI;IAYlB,OAAO,CAAC,cAAc;IAuCtB,OAAO,CAAC,iBAAiB;CAc1B"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Support Greeting & Quick Replies — shown when chat opens in support mode.
3
+ *
4
+ * Renders a welcome message with an avatar and quick reply buttons
5
+ * that pre-fill the user's first message.
6
+ */
7
+ import type { SupportModeConfig } from './types';
8
+ interface SupportGreetingProps {
9
+ config: SupportModeConfig;
10
+ onQuickReply: (message: string) => void;
11
+ theme?: {
12
+ primaryColor?: string;
13
+ textColor?: string;
14
+ backgroundColor?: string;
15
+ };
16
+ }
17
+ export declare function SupportGreeting({ config, onQuickReply, theme, }: SupportGreetingProps): import("react/jsx-runtime").JSX.Element | null;
18
+ export {};
19
+ //# sourceMappingURL=SupportGreeting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SupportGreeting.d.ts","sourceRoot":"","sources":["../../../../src/support/SupportGreeting.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,UAAU,oBAAoB;IAC5B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,KAAK,CAAC,EAAE;QACN,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAED,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,YAAY,EACZ,KAAK,GACN,EAAE,oBAAoB,kDAgEtB"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Escalate tool — hands off the conversation to a human agent.
3
+ *
4
+ * Providers:
5
+ * - 'mobileai' (default when analyticsKey present):
6
+ * POSTs to MobileAI /api/v1/escalations → gets ticketId + wsUrl
7
+ * Opens WebSocket via EscalationSocket → agent reply pushed in real time
8
+ * - 'custom': fires the consumer's onEscalate callback (backward compatible)
9
+ */
10
+ import type { ToolDefinition } from '../core/types';
11
+ import type { EscalationConfig, EscalationContext } from './types';
12
+ export interface EscalationToolDeps {
13
+ config: EscalationConfig;
14
+ analyticsKey?: string;
15
+ getContext: () => Omit<EscalationContext, 'conversationSummary'>;
16
+ getHistory: () => Array<{
17
+ role: string;
18
+ content: string;
19
+ }>;
20
+ onHumanReply?: (reply: string) => void;
21
+ }
22
+ export declare function createEscalateTool(deps: EscalationToolDeps): ToolDefinition;
23
+ /** @deprecated Use createEscalateTool({ config, analyticsKey, getContext, getHistory }) */
24
+ export declare function createEscalateTool(config: EscalationConfig, getContext: () => Omit<EscalationContext, 'conversationSummary'>): ToolDefinition;
25
+ //# sourceMappingURL=escalateTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escalateTool.d.ts","sourceRoot":"","sources":["../../../../src/support/escalateTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAKnE,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,gBAAgB,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,IAAI,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAAC;IACjE,UAAU,EAAE,MAAM,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3D,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,GAAG,cAAc,CAAC;AAC7E,2FAA2F;AAC3F,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,MAAM,IAAI,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,GAC/D,cAAc,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Support Mode — barrel export.
3
+ */
4
+ export type { SupportModeConfig, QuickReply, EscalationConfig, EscalationContext, CSATConfig, CSATRating, BusinessHoursConfig, } from './types';
5
+ export { buildSupportPrompt } from './supportPrompt';
6
+ export { createEscalateTool } from './escalateTool';
7
+ export { EscalationSocket } from './EscalationSocket';
8
+ export type { SocketReplyHandler } from './EscalationSocket';
9
+ export { SupportGreeting } from './SupportGreeting';
10
+ export { CSATSurvey } from './CSATSurvey';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/support/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EACV,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Support Mode prompt — injected into the system prompt when support mode is enabled.
3
+ *
4
+ * Uses POSITIVE framing (what TO DO) instead of negative rules (per user's prompt engineering rules).
5
+ */
6
+ import type { SupportModeConfig } from './types';
7
+ /**
8
+ * Build the support mode system prompt addition.
9
+ * This gets appended to the main system prompt when support mode is active.
10
+ */
11
+ export declare function buildSupportPrompt(config: SupportModeConfig): string;
12
+ //# sourceMappingURL=supportPrompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supportPrompt.d.ts","sourceRoot":"","sources":["../../../../src/support/supportPrompt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CA0CpE"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Support Mode — types and configuration.
3
+ *
4
+ * Transforms the AI agent into a customer support assistant with:
5
+ * - Custom greeting message
6
+ * - Quick reply suggestions
7
+ * - Human escalation capability
8
+ * - CSAT (Customer Satisfaction) collection after conversation
9
+ */
10
+ export interface SupportModeConfig {
11
+ /** Enable support mode. Default: false */
12
+ enabled: boolean;
13
+ /** Greeting message shown when the chat opens */
14
+ greeting?: {
15
+ /** Main greeting text (e.g., "Hi! 👋 How can I help you today?") */
16
+ message: string;
17
+ /** Agent name shown above the greeting (e.g., "MobileAI Support") */
18
+ agentName?: string;
19
+ /** Avatar URL for the support agent */
20
+ avatarUrl?: string;
21
+ };
22
+ /** Quick reply buttons shown below the greeting */
23
+ quickReplies?: QuickReply[];
24
+ /** Escalation configuration */
25
+ escalation?: EscalationConfig;
26
+ /** CSAT survey configuration */
27
+ csat?: CSATConfig;
28
+ /** Business hours (optional — shows offline message outside hours) */
29
+ businessHours?: BusinessHoursConfig;
30
+ /**
31
+ * Additional system prompt context for the support persona.
32
+ * Merged with the base system prompt.
33
+ * Example: "You are a friendly support agent for FeedYum food delivery app."
34
+ */
35
+ systemContext?: string;
36
+ /**
37
+ * Topics the AI should NOT attempt to resolve — escalate immediately.
38
+ * Example: ['billing dispute', 'account deletion', 'legal']
39
+ */
40
+ autoEscalateTopics?: string[];
41
+ }
42
+ export interface QuickReply {
43
+ /** Display text on the button */
44
+ label: string;
45
+ /** Message sent when tapped (defaults to label if not set) */
46
+ message?: string;
47
+ /** Icon emoji (optional) */
48
+ icon?: string;
49
+ }
50
+ export interface EscalationConfig {
51
+ /**
52
+ * Where to route the escalation.
53
+ * - 'mobileai' (default when analyticsKey is set): ticket goes to MobileAI
54
+ * dashboard inbox via POST /api/v1/escalations + WebSocket reply delivery.
55
+ * - 'custom': fires the onEscalate callback — wire to Intercom, Zendesk, etc.
56
+ */
57
+ provider?: 'mobileai' | 'custom';
58
+ /**
59
+ * Callback when user requests human support (required when provider='custom').
60
+ * Use this to open a live chat widget, send email, etc.
61
+ */
62
+ onEscalate?: (context: EscalationContext) => void;
63
+ /** Label for the escalate button. Default: "Talk to a human" */
64
+ buttonLabel?: string;
65
+ /** Message shown to user when escalated. Default: "Connecting you to a human agent..." */
66
+ escalationMessage?: string;
67
+ }
68
+ export interface EscalationContext {
69
+ /** Summary of the conversation so far */
70
+ conversationSummary: string;
71
+ /** Current screen the user is on */
72
+ currentScreen: string;
73
+ /** User's original question/issue */
74
+ originalQuery: string;
75
+ /** Number of AI steps taken before escalation */
76
+ stepsBeforeEscalation: number;
77
+ }
78
+ export interface CSATConfig {
79
+ /** Enable CSAT survey after conversation. Default: true if support mode enabled */
80
+ enabled?: boolean;
81
+ /** Question text. Default: "How was your experience?" */
82
+ question?: string;
83
+ /** Rating type. Default: 'emoji' */
84
+ ratingType?: 'stars' | 'emoji' | 'thumbs';
85
+ /** Callback when user submits rating */
86
+ onSubmit: (rating: CSATRating) => void;
87
+ /** Show after N seconds of inactivity. Default: 10 */
88
+ showAfterIdleSeconds?: number;
89
+ }
90
+ export interface CSATRating {
91
+ /** Numeric score (1-5 for stars/emoji, 0-1 for thumbs) */
92
+ score: number;
93
+ /** Optional text feedback */
94
+ feedback?: string;
95
+ /** Conversation metadata */
96
+ metadata: {
97
+ conversationDuration: number;
98
+ stepsCount: number;
99
+ wasEscalated: boolean;
100
+ screen: string;
101
+ };
102
+ }
103
+ export interface BusinessHoursConfig {
104
+ /** Timezone (IANA format, e.g., 'Africa/Cairo') */
105
+ timezone: string;
106
+ /** Schedule per day of week (0=Sunday, 6=Saturday) */
107
+ schedule: Record<number, {
108
+ start: string;
109
+ end: string;
110
+ } | null>;
111
+ /** Message shown outside business hours */
112
+ offlineMessage?: string;
113
+ }
114
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/support/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,WAAW,iBAAiB;IAChC,0CAA0C;IAC1C,OAAO,EAAE,OAAO,CAAC;IAEjB,iDAAiD;IACjD,QAAQ,CAAC,EAAE;QACT,oEAAoE;QACpE,OAAO,EAAE,MAAM,CAAC;QAChB,qEAAqE;QACrE,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,uCAAuC;QACvC,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IAEF,mDAAmD;IACnD,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC;IAE5B,+BAA+B;IAC/B,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAE9B,gCAAgC;IAChC,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB,sEAAsE;IACtE,aAAa,CAAC,EAAE,mBAAmB,CAAC;IAEpC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAID,MAAM,WAAW,UAAU;IACzB,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAID,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IAEjC;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAElD,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,0FAA0F;IAC1F,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oCAAoC;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAID,MAAM,WAAW,UAAU;IACzB,mFAAmF;IACnF,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,oCAAoC;IACpC,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;IAE1C,wCAAwC;IACxC,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAEvC,sDAAsD;IACtD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,UAAU;IACzB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4BAA4B;IAC5B,QAAQ,EAAE;QACR,oBAAoB,EAAE,MAAM,CAAC;QAC7B,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,OAAO,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAID,MAAM,WAAW,mBAAmB;IAClC,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IAChE,2CAA2C;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
@@ -0,0 +1,4 @@
1
+ import type { ToolDefinition } from '../core/types';
2
+ import type { ToolContext } from './types';
3
+ export declare function createGuideTool(context: ToolContext): ToolDefinition;
4
+ //# sourceMappingURL=guideTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guideTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/guideTool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CA6DpE"}
@@ -12,5 +12,8 @@ export { createSliderTool } from './sliderTool';
12
12
  export { createPickerTool } from './pickerTool';
13
13
  export { createDatePickerTool } from './datePickerTool';
14
14
  export { createKeyboardTool } from './keyboardTool';
15
+ export { createGuideTool } from './guideTool';
16
+ export { createSimplifyTool } from './simplifyTool';
17
+ export { createRestoreTool } from './restoreTool';
15
18
  export type { AgentTool, ToolContext, ToolParameter } from './types';
16
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ToolDefinition } from '../core/types';
2
+ export declare function createRestoreTool(): ToolDefinition;
3
+ //# sourceMappingURL=restoreTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restoreTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/restoreTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAIpD,wBAAgB,iBAAiB,IAAI,cAAc,CA4BlD"}
@@ -0,0 +1,3 @@
1
+ import type { ToolDefinition } from '../core/types';
2
+ export declare function createSimplifyTool(): ToolDefinition;
3
+ //# sourceMappingURL=simplifyTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simplifyTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/simplifyTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAIpD,wBAAgB,kBAAkB,IAAI,cAAc,CA4BnD"}
@@ -43,5 +43,7 @@ export interface ToolContext {
43
43
  buildNestedParams?: (path: string[], params?: any) => any;
44
44
  /** Capture screenshot (optional) */
45
45
  captureScreenshot?: () => Promise<string | null>;
46
+ /** Get the most recently dehydrated screen (with layout coords) */
47
+ getLastDehydratedRoot?: () => any;
46
48
  }
47
49
  //# sourceMappingURL=types.d.ts.map