@mobileai/react-native 0.9.17 → 0.9.19
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/LICENSE +28 -20
- package/MobileAIFloatingOverlay.podspec +25 -0
- package/android/build.gradle +61 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/com/mobileai/overlay/FloatingOverlayView.kt +151 -0
- package/android/src/main/java/com/mobileai/overlay/MobileAIOverlayPackage.kt +23 -0
- package/android/src/newarch/com/mobileai/overlay/FloatingOverlayViewManager.kt +45 -0
- package/android/src/oldarch/com/mobileai/overlay/FloatingOverlayViewManager.kt +29 -0
- package/ios/MobileAIFloatingOverlayComponentView.mm +73 -0
- package/lib/module/components/AIAgent.js +902 -136
- package/lib/module/components/AIConsentDialog.js +439 -0
- package/lib/module/components/AgentChatBar.js +828 -134
- package/lib/module/components/AgentOverlay.js +2 -1
- package/lib/module/components/DiscoveryTooltip.js +21 -9
- package/lib/module/components/FloatingOverlayWrapper.js +108 -0
- package/lib/module/components/Icons.js +123 -0
- package/lib/module/config/endpoints.js +12 -2
- package/lib/module/core/AgentRuntime.js +373 -27
- package/lib/module/core/FiberAdapter.js +56 -0
- package/lib/module/core/FiberTreeWalker.js +186 -80
- package/lib/module/core/IdleDetector.js +19 -0
- package/lib/module/core/NativeAlertInterceptor.js +191 -0
- package/lib/module/core/systemPrompt.js +203 -45
- package/lib/module/index.js +3 -0
- package/lib/module/providers/GeminiProvider.js +72 -56
- package/lib/module/providers/ProviderFactory.js +6 -2
- package/lib/module/services/AudioInputService.js +3 -12
- package/lib/module/services/AudioOutputService.js +1 -13
- package/lib/module/services/ConversationService.js +166 -0
- package/lib/module/services/MobileAIKnowledgeRetriever.js +41 -0
- package/lib/module/services/VoiceService.js +29 -8
- package/lib/module/services/telemetry/MobileAI.js +44 -0
- package/lib/module/services/telemetry/TelemetryService.js +13 -1
- package/lib/module/services/telemetry/TouchAutoCapture.js +44 -18
- package/lib/module/specs/FloatingOverlayNativeComponent.ts +19 -0
- package/lib/module/support/CSATSurvey.js +95 -12
- package/lib/module/support/EscalationSocket.js +70 -1
- package/lib/module/support/ReportedIssueEventSource.js +148 -0
- package/lib/module/support/escalateTool.js +4 -2
- package/lib/module/support/index.js +1 -0
- package/lib/module/support/reportIssueTool.js +127 -0
- package/lib/module/support/supportPrompt.js +77 -9
- package/lib/module/tools/guideTool.js +2 -1
- package/lib/module/tools/longPressTool.js +4 -3
- package/lib/module/tools/pickerTool.js +6 -4
- package/lib/module/tools/tapTool.js +12 -3
- package/lib/module/tools/typeTool.js +19 -10
- package/lib/module/utils/logger.js +175 -6
- package/lib/typescript/react-native.config.d.ts +11 -0
- package/lib/typescript/src/components/AIAgent.d.ts +28 -2
- package/lib/typescript/src/components/AIConsentDialog.d.ts +153 -0
- package/lib/typescript/src/components/AgentChatBar.d.ts +15 -2
- package/lib/typescript/src/components/DiscoveryTooltip.d.ts +3 -1
- package/lib/typescript/src/components/FloatingOverlayWrapper.d.ts +51 -0
- package/lib/typescript/src/components/Icons.d.ts +8 -0
- package/lib/typescript/src/config/endpoints.d.ts +5 -3
- package/lib/typescript/src/core/AgentRuntime.d.ts +4 -0
- package/lib/typescript/src/core/FiberAdapter.d.ts +25 -0
- package/lib/typescript/src/core/FiberTreeWalker.d.ts +2 -0
- package/lib/typescript/src/core/IdleDetector.d.ts +11 -0
- package/lib/typescript/src/core/NativeAlertInterceptor.d.ts +55 -0
- package/lib/typescript/src/core/types.d.ts +106 -1
- package/lib/typescript/src/index.d.ts +9 -4
- package/lib/typescript/src/providers/GeminiProvider.d.ts +6 -5
- package/lib/typescript/src/services/ConversationService.d.ts +55 -0
- package/lib/typescript/src/services/MobileAIKnowledgeRetriever.d.ts +9 -0
- package/lib/typescript/src/services/telemetry/MobileAI.d.ts +7 -0
- package/lib/typescript/src/services/telemetry/TelemetryService.d.ts +1 -1
- package/lib/typescript/src/services/telemetry/TouchAutoCapture.d.ts +9 -6
- package/lib/typescript/src/services/telemetry/types.d.ts +3 -1
- package/lib/typescript/src/specs/FloatingOverlayNativeComponent.d.ts +17 -0
- package/lib/typescript/src/support/EscalationSocket.d.ts +17 -0
- package/lib/typescript/src/support/ReportedIssueEventSource.d.ts +24 -0
- package/lib/typescript/src/support/escalateTool.d.ts +5 -0
- package/lib/typescript/src/support/index.d.ts +2 -1
- package/lib/typescript/src/support/reportIssueTool.d.ts +20 -0
- package/lib/typescript/src/support/types.d.ts +56 -1
- package/lib/typescript/src/utils/logger.d.ts +15 -0
- package/package.json +20 -9
- package/react-native.config.js +12 -0
- package/lib/module/__cli_tmp__.js.map +0 -1
- package/lib/module/components/AIAgent.js.map +0 -1
- package/lib/module/components/AIZone.js.map +0 -1
- package/lib/module/components/AgentChatBar.js.map +0 -1
- package/lib/module/components/AgentErrorBoundary.js.map +0 -1
- package/lib/module/components/AgentOverlay.js.map +0 -1
- package/lib/module/components/DiscoveryTooltip.js.map +0 -1
- package/lib/module/components/HighlightOverlay.js.map +0 -1
- package/lib/module/components/Icons.js.map +0 -1
- package/lib/module/components/ProactiveHint.js.map +0 -1
- package/lib/module/components/cards/InfoCard.js.map +0 -1
- package/lib/module/components/cards/ReviewSummary.js.map +0 -1
- package/lib/module/config/endpoints.js.map +0 -1
- package/lib/module/core/ActionRegistry.js.map +0 -1
- package/lib/module/core/AgentRuntime.js.map +0 -1
- package/lib/module/core/FiberTreeWalker.js.map +0 -1
- package/lib/module/core/IdleDetector.js.map +0 -1
- package/lib/module/core/MCPBridge.js.map +0 -1
- package/lib/module/core/ScreenDehydrator.js.map +0 -1
- package/lib/module/core/ZoneRegistry.js.map +0 -1
- package/lib/module/core/systemPrompt.js.map +0 -1
- package/lib/module/core/types.js.map +0 -1
- package/lib/module/hooks/useAction.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/plugin/withAppIntents.js.map +0 -1
- package/lib/module/providers/GeminiProvider.js.map +0 -1
- package/lib/module/providers/OpenAIProvider.js.map +0 -1
- package/lib/module/providers/ProviderFactory.js.map +0 -1
- package/lib/module/services/AudioInputService.js.map +0 -1
- package/lib/module/services/AudioOutputService.js.map +0 -1
- package/lib/module/services/KnowledgeBaseService.js.map +0 -1
- package/lib/module/services/VoiceService.js.map +0 -1
- package/lib/module/services/flags/FlagService.js.map +0 -1
- package/lib/module/services/telemetry/MobileAI.js.map +0 -1
- package/lib/module/services/telemetry/PiiScrubber.js.map +0 -1
- package/lib/module/services/telemetry/TelemetryService.js.map +0 -1
- package/lib/module/services/telemetry/TouchAutoCapture.js.map +0 -1
- package/lib/module/services/telemetry/device.js.map +0 -1
- package/lib/module/services/telemetry/deviceMetadata.js.map +0 -1
- package/lib/module/services/telemetry/index.js.map +0 -1
- package/lib/module/services/telemetry/types.js.map +0 -1
- package/lib/module/support/CSATSurvey.js.map +0 -1
- package/lib/module/support/EscalationEventSource.js.map +0 -1
- package/lib/module/support/EscalationSocket.js.map +0 -1
- package/lib/module/support/SupportChatModal.js.map +0 -1
- package/lib/module/support/SupportGreeting.js.map +0 -1
- package/lib/module/support/TicketStore.js.map +0 -1
- package/lib/module/support/escalateTool.js.map +0 -1
- package/lib/module/support/index.js.map +0 -1
- package/lib/module/support/supportPrompt.js.map +0 -1
- package/lib/module/support/types.js.map +0 -1
- package/lib/module/tools/datePickerTool.js.map +0 -1
- package/lib/module/tools/guideTool.js.map +0 -1
- package/lib/module/tools/index.js.map +0 -1
- package/lib/module/tools/keyboardTool.js.map +0 -1
- package/lib/module/tools/longPressTool.js.map +0 -1
- package/lib/module/tools/pickerTool.js.map +0 -1
- package/lib/module/tools/restoreTool.js.map +0 -1
- package/lib/module/tools/scrollTool.js.map +0 -1
- package/lib/module/tools/simplifyTool.js.map +0 -1
- package/lib/module/tools/sliderTool.js.map +0 -1
- package/lib/module/tools/tapTool.js.map +0 -1
- package/lib/module/tools/typeTool.js.map +0 -1
- package/lib/module/tools/types.js.map +0 -1
- package/lib/module/types/jsx.d.js.map +0 -1
- package/lib/module/utils/audioUtils.js.map +0 -1
- package/lib/module/utils/logger.js.map +0 -1
- package/lib/typescript/babel.config.d.ts.map +0 -1
- package/lib/typescript/bin/generate-map.d.cts.map +0 -1
- package/lib/typescript/eslint.config.d.mts.map +0 -1
- package/lib/typescript/generate-map.d.ts.map +0 -1
- package/lib/typescript/src/__cli_tmp__.d.ts.map +0 -1
- package/lib/typescript/src/components/AIAgent.d.ts.map +0 -1
- package/lib/typescript/src/components/AIZone.d.ts.map +0 -1
- package/lib/typescript/src/components/AgentChatBar.d.ts.map +0 -1
- package/lib/typescript/src/components/AgentErrorBoundary.d.ts.map +0 -1
- package/lib/typescript/src/components/AgentOverlay.d.ts.map +0 -1
- package/lib/typescript/src/components/DiscoveryTooltip.d.ts.map +0 -1
- package/lib/typescript/src/components/HighlightOverlay.d.ts.map +0 -1
- package/lib/typescript/src/components/Icons.d.ts.map +0 -1
- package/lib/typescript/src/components/ProactiveHint.d.ts.map +0 -1
- package/lib/typescript/src/components/cards/InfoCard.d.ts.map +0 -1
- package/lib/typescript/src/components/cards/ReviewSummary.d.ts.map +0 -1
- package/lib/typescript/src/config/endpoints.d.ts.map +0 -1
- package/lib/typescript/src/core/ActionRegistry.d.ts.map +0 -1
- package/lib/typescript/src/core/AgentRuntime.d.ts.map +0 -1
- package/lib/typescript/src/core/FiberTreeWalker.d.ts.map +0 -1
- package/lib/typescript/src/core/IdleDetector.d.ts.map +0 -1
- package/lib/typescript/src/core/MCPBridge.d.ts.map +0 -1
- package/lib/typescript/src/core/ScreenDehydrator.d.ts.map +0 -1
- package/lib/typescript/src/core/ZoneRegistry.d.ts.map +0 -1
- package/lib/typescript/src/core/systemPrompt.d.ts.map +0 -1
- package/lib/typescript/src/core/types.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useAction.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/plugin/withAppIntents.d.ts.map +0 -1
- package/lib/typescript/src/providers/GeminiProvider.d.ts.map +0 -1
- package/lib/typescript/src/providers/OpenAIProvider.d.ts.map +0 -1
- package/lib/typescript/src/providers/ProviderFactory.d.ts.map +0 -1
- package/lib/typescript/src/services/AudioInputService.d.ts.map +0 -1
- package/lib/typescript/src/services/AudioOutputService.d.ts.map +0 -1
- package/lib/typescript/src/services/KnowledgeBaseService.d.ts.map +0 -1
- package/lib/typescript/src/services/VoiceService.d.ts.map +0 -1
- package/lib/typescript/src/services/flags/FlagService.d.ts.map +0 -1
- package/lib/typescript/src/services/telemetry/MobileAI.d.ts.map +0 -1
- package/lib/typescript/src/services/telemetry/PiiScrubber.d.ts.map +0 -1
- package/lib/typescript/src/services/telemetry/TelemetryService.d.ts.map +0 -1
- package/lib/typescript/src/services/telemetry/TouchAutoCapture.d.ts.map +0 -1
- package/lib/typescript/src/services/telemetry/device.d.ts.map +0 -1
- package/lib/typescript/src/services/telemetry/deviceMetadata.d.ts.map +0 -1
- package/lib/typescript/src/services/telemetry/index.d.ts.map +0 -1
- package/lib/typescript/src/services/telemetry/types.d.ts.map +0 -1
- package/lib/typescript/src/support/CSATSurvey.d.ts.map +0 -1
- package/lib/typescript/src/support/EscalationEventSource.d.ts.map +0 -1
- package/lib/typescript/src/support/EscalationSocket.d.ts.map +0 -1
- package/lib/typescript/src/support/SupportChatModal.d.ts.map +0 -1
- package/lib/typescript/src/support/SupportGreeting.d.ts.map +0 -1
- package/lib/typescript/src/support/TicketStore.d.ts.map +0 -1
- package/lib/typescript/src/support/escalateTool.d.ts.map +0 -1
- package/lib/typescript/src/support/index.d.ts.map +0 -1
- package/lib/typescript/src/support/supportPrompt.d.ts.map +0 -1
- package/lib/typescript/src/support/types.d.ts.map +0 -1
- package/lib/typescript/src/tools/datePickerTool.d.ts.map +0 -1
- package/lib/typescript/src/tools/guideTool.d.ts.map +0 -1
- package/lib/typescript/src/tools/index.d.ts.map +0 -1
- package/lib/typescript/src/tools/keyboardTool.d.ts.map +0 -1
- package/lib/typescript/src/tools/longPressTool.d.ts.map +0 -1
- package/lib/typescript/src/tools/pickerTool.d.ts.map +0 -1
- package/lib/typescript/src/tools/restoreTool.d.ts.map +0 -1
- package/lib/typescript/src/tools/scrollTool.d.ts.map +0 -1
- package/lib/typescript/src/tools/simplifyTool.d.ts.map +0 -1
- package/lib/typescript/src/tools/sliderTool.d.ts.map +0 -1
- package/lib/typescript/src/tools/tapTool.d.ts.map +0 -1
- package/lib/typescript/src/tools/typeTool.d.ts.map +0 -1
- package/lib/typescript/src/tools/types.d.ts.map +0 -1
- package/lib/typescript/src/utils/audioUtils.d.ts.map +0 -1
- package/lib/typescript/src/utils/logger.d.ts.map +0 -1
- package/src/__cli_tmp__.tsx +0 -9
- package/src/cli/analyzers/chain-analyzer.ts +0 -183
- package/src/cli/extractors/ai-extractor.ts +0 -6
- package/src/cli/extractors/ast-extractor.ts +0 -551
- package/src/cli/generate-intents.ts +0 -140
- package/src/cli/generate-map.ts +0 -121
- package/src/cli/generate-swift.ts +0 -116
- package/src/cli/scanners/expo-scanner.ts +0 -203
- package/src/cli/scanners/rn-scanner.ts +0 -445
- package/src/components/AIAgent.tsx +0 -1716
- package/src/components/AIZone.tsx +0 -147
- package/src/components/AgentChatBar.tsx +0 -1143
- package/src/components/AgentErrorBoundary.tsx +0 -78
- package/src/components/AgentOverlay.tsx +0 -73
- package/src/components/DiscoveryTooltip.tsx +0 -148
- package/src/components/HighlightOverlay.tsx +0 -136
- package/src/components/Icons.tsx +0 -253
- package/src/components/ProactiveHint.tsx +0 -145
- package/src/components/cards/InfoCard.tsx +0 -58
- package/src/components/cards/ReviewSummary.tsx +0 -76
- package/src/config/endpoints.ts +0 -22
- package/src/core/ActionRegistry.ts +0 -105
- package/src/core/AgentRuntime.ts +0 -1471
- package/src/core/FiberTreeWalker.ts +0 -930
- package/src/core/IdleDetector.ts +0 -72
- package/src/core/MCPBridge.ts +0 -163
- package/src/core/ScreenDehydrator.ts +0 -53
- package/src/core/ZoneRegistry.ts +0 -44
- package/src/core/systemPrompt.ts +0 -431
- package/src/core/types.ts +0 -521
- package/src/hooks/useAction.ts +0 -182
- package/src/index.ts +0 -83
- package/src/plugin/withAppIntents.ts +0 -98
- package/src/providers/GeminiProvider.ts +0 -357
- package/src/providers/OpenAIProvider.ts +0 -379
- package/src/providers/ProviderFactory.ts +0 -36
- package/src/services/AudioInputService.ts +0 -226
- package/src/services/AudioOutputService.ts +0 -236
- package/src/services/KnowledgeBaseService.ts +0 -156
- package/src/services/VoiceService.ts +0 -451
- package/src/services/flags/FlagService.ts +0 -137
- package/src/services/telemetry/MobileAI.ts +0 -66
- package/src/services/telemetry/PiiScrubber.ts +0 -17
- package/src/services/telemetry/TelemetryService.ts +0 -323
- package/src/services/telemetry/TouchAutoCapture.ts +0 -165
- package/src/services/telemetry/device.ts +0 -93
- package/src/services/telemetry/deviceMetadata.ts +0 -13
- package/src/services/telemetry/index.ts +0 -13
- package/src/services/telemetry/types.ts +0 -75
- package/src/support/CSATSurvey.tsx +0 -304
- package/src/support/EscalationEventSource.ts +0 -190
- package/src/support/EscalationSocket.ts +0 -152
- package/src/support/SupportChatModal.tsx +0 -563
- package/src/support/SupportGreeting.tsx +0 -161
- package/src/support/TicketStore.ts +0 -100
- package/src/support/escalateTool.ts +0 -174
- package/src/support/index.ts +0 -29
- package/src/support/supportPrompt.ts +0 -55
- package/src/support/types.ts +0 -155
- package/src/tools/datePickerTool.ts +0 -60
- package/src/tools/guideTool.ts +0 -76
- package/src/tools/index.ts +0 -20
- package/src/tools/keyboardTool.ts +0 -30
- package/src/tools/longPressTool.ts +0 -61
- package/src/tools/pickerTool.ts +0 -115
- package/src/tools/restoreTool.ts +0 -33
- package/src/tools/scrollTool.ts +0 -156
- package/src/tools/simplifyTool.ts +0 -33
- package/src/tools/sliderTool.ts +0 -65
- package/src/tools/tapTool.ts +0 -93
- package/src/tools/typeTool.ts +0 -113
- package/src/tools/types.ts +0 -58
- package/src/types/jsx.d.ts +0 -20
- package/src/utils/audioUtils.ts +0 -54
- package/src/utils/logger.ts +0 -38
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
|
2
|
-
import { View, Animated, StyleSheet, Text, Pressable } from 'react-native';
|
|
3
|
-
|
|
4
|
-
interface ProactiveHintProps {
|
|
5
|
-
stage: 'hidden' | 'pulse' | 'badge';
|
|
6
|
-
badgeText?: string;
|
|
7
|
-
onDismiss: () => void;
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function ProactiveHint({ stage, badgeText = "Need help?", onDismiss, children }: ProactiveHintProps) {
|
|
12
|
-
const pulseAnim = useRef(new Animated.Value(1)).current;
|
|
13
|
-
const opacityAnim = useRef(new Animated.Value(0)).current;
|
|
14
|
-
const badgeScale = useRef(new Animated.Value(0)).current;
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
// Pulse animation logic
|
|
18
|
-
if (stage === 'pulse') {
|
|
19
|
-
Animated.loop(
|
|
20
|
-
Animated.sequence([
|
|
21
|
-
Animated.parallel([
|
|
22
|
-
Animated.timing(pulseAnim, {
|
|
23
|
-
toValue: 1.3,
|
|
24
|
-
duration: 1500,
|
|
25
|
-
useNativeDriver: true,
|
|
26
|
-
}),
|
|
27
|
-
Animated.timing(opacityAnim, {
|
|
28
|
-
toValue: 0,
|
|
29
|
-
duration: 1500,
|
|
30
|
-
useNativeDriver: true,
|
|
31
|
-
}),
|
|
32
|
-
]),
|
|
33
|
-
Animated.timing(pulseAnim, {
|
|
34
|
-
toValue: 1,
|
|
35
|
-
duration: 0,
|
|
36
|
-
useNativeDriver: true,
|
|
37
|
-
}),
|
|
38
|
-
Animated.timing(opacityAnim, {
|
|
39
|
-
toValue: 0.8,
|
|
40
|
-
duration: 0,
|
|
41
|
-
useNativeDriver: true,
|
|
42
|
-
}),
|
|
43
|
-
])
|
|
44
|
-
).start();
|
|
45
|
-
} else {
|
|
46
|
-
pulseAnim.stopAnimation();
|
|
47
|
-
opacityAnim.stopAnimation();
|
|
48
|
-
pulseAnim.setValue(1);
|
|
49
|
-
opacityAnim.setValue(0);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Badge animation logic
|
|
53
|
-
if (stage === 'badge') {
|
|
54
|
-
Animated.spring(badgeScale, {
|
|
55
|
-
toValue: 1,
|
|
56
|
-
friction: 5,
|
|
57
|
-
tension: 100,
|
|
58
|
-
useNativeDriver: true,
|
|
59
|
-
}).start();
|
|
60
|
-
} else {
|
|
61
|
-
badgeScale.setValue(0);
|
|
62
|
-
}
|
|
63
|
-
}, [stage, pulseAnim, opacityAnim, badgeScale]);
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<View style={styles.container}>
|
|
67
|
-
{/* Badge State */}
|
|
68
|
-
{stage === 'badge' && (
|
|
69
|
-
<Animated.View style={[styles.badgeContainer, { transform: [{ scale: badgeScale }] }]}>
|
|
70
|
-
<Text style={styles.badgeText}>{badgeText}</Text>
|
|
71
|
-
<Pressable hitSlop={10} style={styles.closeButton} onPress={onDismiss}>
|
|
72
|
-
<Text style={styles.closeText}>×</Text>
|
|
73
|
-
</Pressable>
|
|
74
|
-
</Animated.View>
|
|
75
|
-
)}
|
|
76
|
-
|
|
77
|
-
{/* Pulse effect under children */}
|
|
78
|
-
{stage === 'pulse' && (
|
|
79
|
-
<Animated.View
|
|
80
|
-
style={[
|
|
81
|
-
styles.pulseRing,
|
|
82
|
-
{
|
|
83
|
-
transform: [{ scale: pulseAnim }],
|
|
84
|
-
opacity: opacityAnim,
|
|
85
|
-
},
|
|
86
|
-
]}
|
|
87
|
-
/>
|
|
88
|
-
)}
|
|
89
|
-
|
|
90
|
-
{/* The main FAB or children */}
|
|
91
|
-
{children}
|
|
92
|
-
</View>
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const styles = StyleSheet.create({
|
|
97
|
-
container: {
|
|
98
|
-
alignItems: 'center',
|
|
99
|
-
justifyContent: 'center',
|
|
100
|
-
},
|
|
101
|
-
pulseRing: {
|
|
102
|
-
position: 'absolute',
|
|
103
|
-
width: 60,
|
|
104
|
-
height: 60,
|
|
105
|
-
borderRadius: 30,
|
|
106
|
-
backgroundColor: '#7B68EE',
|
|
107
|
-
},
|
|
108
|
-
badgeContainer: {
|
|
109
|
-
position: 'absolute',
|
|
110
|
-
bottom: 70, // Float above the FAB
|
|
111
|
-
right: 0,
|
|
112
|
-
flexDirection: 'row',
|
|
113
|
-
alignItems: 'center',
|
|
114
|
-
backgroundColor: '#ffffff',
|
|
115
|
-
paddingHorizontal: 12,
|
|
116
|
-
paddingVertical: 8,
|
|
117
|
-
borderRadius: 20,
|
|
118
|
-
shadowColor: '#000',
|
|
119
|
-
shadowOffset: { width: 0, height: 2 },
|
|
120
|
-
shadowOpacity: 0.15,
|
|
121
|
-
shadowRadius: 4,
|
|
122
|
-
elevation: 4,
|
|
123
|
-
minWidth: 120,
|
|
124
|
-
},
|
|
125
|
-
badgeText: {
|
|
126
|
-
color: '#333333',
|
|
127
|
-
fontSize: 14,
|
|
128
|
-
fontWeight: '500',
|
|
129
|
-
marginRight: 8,
|
|
130
|
-
},
|
|
131
|
-
closeButton: {
|
|
132
|
-
justifyContent: 'center',
|
|
133
|
-
alignItems: 'center',
|
|
134
|
-
width: 20,
|
|
135
|
-
height: 20,
|
|
136
|
-
borderRadius: 10,
|
|
137
|
-
backgroundColor: '#f0f0f0',
|
|
138
|
-
},
|
|
139
|
-
closeText: {
|
|
140
|
-
fontSize: 14,
|
|
141
|
-
color: '#666',
|
|
142
|
-
fontWeight: 'bold',
|
|
143
|
-
marginTop: -2,
|
|
144
|
-
},
|
|
145
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { View, Text, StyleSheet } from 'react-native';
|
|
2
|
-
|
|
3
|
-
interface InfoCardProps {
|
|
4
|
-
title?: string;
|
|
5
|
-
body?: string;
|
|
6
|
-
icon?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Built-in card template for AI injection.
|
|
11
|
-
*
|
|
12
|
-
* IMPORTANT: displayName must be set explicitly here.
|
|
13
|
-
* In production/minified builds, the function name is mangled (e.g. `a`, `b`),
|
|
14
|
-
* so `injectCardTool` cannot identify templates by inferred name alone.
|
|
15
|
-
* Always look up templates by `T.displayName`, never by `T.name`.
|
|
16
|
-
*/
|
|
17
|
-
export function InfoCard({ title = 'Info', body = '', icon = 'ℹ️' }: InfoCardProps) {
|
|
18
|
-
return (
|
|
19
|
-
<View style={styles.container}>
|
|
20
|
-
<Text style={styles.icon}>{icon}</Text>
|
|
21
|
-
<View style={styles.content}>
|
|
22
|
-
<Text style={styles.title}>{title}</Text>
|
|
23
|
-
{body ? <Text style={styles.body}>{body}</Text> : null}
|
|
24
|
-
</View>
|
|
25
|
-
</View>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Must be explicit — minification mangles function.name in production builds.
|
|
30
|
-
InfoCard.displayName = 'InfoCard';
|
|
31
|
-
|
|
32
|
-
const styles = StyleSheet.create({
|
|
33
|
-
container: {
|
|
34
|
-
flexDirection: 'row',
|
|
35
|
-
alignItems: 'flex-start',
|
|
36
|
-
backgroundColor: '#f0f7ff',
|
|
37
|
-
borderRadius: 10,
|
|
38
|
-
padding: 12,
|
|
39
|
-
gap: 10,
|
|
40
|
-
},
|
|
41
|
-
icon: {
|
|
42
|
-
fontSize: 22,
|
|
43
|
-
},
|
|
44
|
-
content: {
|
|
45
|
-
flex: 1,
|
|
46
|
-
},
|
|
47
|
-
title: {
|
|
48
|
-
fontWeight: '600',
|
|
49
|
-
fontSize: 14,
|
|
50
|
-
color: '#1a1a2e',
|
|
51
|
-
marginBottom: 2,
|
|
52
|
-
},
|
|
53
|
-
body: {
|
|
54
|
-
fontSize: 13,
|
|
55
|
-
color: '#444',
|
|
56
|
-
lineHeight: 18,
|
|
57
|
-
},
|
|
58
|
-
});
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { View, Text, StyleSheet } from 'react-native';
|
|
2
|
-
|
|
3
|
-
interface ReviewSummaryProps {
|
|
4
|
-
rating?: number; // 0-5
|
|
5
|
-
reviewCount?: number;
|
|
6
|
-
headline?: string;
|
|
7
|
-
sentiment?: 'positive' | 'neutral' | 'negative';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Built-in card template that shows a product/service review summary.
|
|
12
|
-
* Injected by the AI agent to surface social proof at decision points.
|
|
13
|
-
*
|
|
14
|
-
* IMPORTANT: displayName is set explicitly to survive minification.
|
|
15
|
-
* The injectCardTool resolves templates by `T.displayName`, not `T.name`.
|
|
16
|
-
*/
|
|
17
|
-
export function ReviewSummary({
|
|
18
|
-
rating = 0,
|
|
19
|
-
reviewCount = 0,
|
|
20
|
-
headline = 'Customer Reviews',
|
|
21
|
-
sentiment = 'neutral',
|
|
22
|
-
}: ReviewSummaryProps) {
|
|
23
|
-
const stars = Math.round(Math.min(5, Math.max(0, rating)));
|
|
24
|
-
const filled = '★'.repeat(stars);
|
|
25
|
-
const empty = '☆'.repeat(5 - stars);
|
|
26
|
-
|
|
27
|
-
const sentimentColor: Record<ReviewSummaryProps['sentiment'] & string, string> = {
|
|
28
|
-
positive: '#16a34a',
|
|
29
|
-
neutral: '#6b7280',
|
|
30
|
-
negative: '#dc2626',
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<View style={styles.container}>
|
|
35
|
-
<Text style={styles.headline}>{headline}</Text>
|
|
36
|
-
<View style={styles.row}>
|
|
37
|
-
<Text style={[styles.stars, { color: sentimentColor[sentiment] }]}>
|
|
38
|
-
{filled}{empty}
|
|
39
|
-
</Text>
|
|
40
|
-
<Text style={styles.meta}>
|
|
41
|
-
{rating.toFixed(1)} · {reviewCount.toLocaleString()} reviews
|
|
42
|
-
</Text>
|
|
43
|
-
</View>
|
|
44
|
-
</View>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Explicit — function.name is mangled in minified production builds.
|
|
49
|
-
ReviewSummary.displayName = 'ReviewSummary';
|
|
50
|
-
|
|
51
|
-
const styles = StyleSheet.create({
|
|
52
|
-
container: {
|
|
53
|
-
backgroundColor: '#fffbeb',
|
|
54
|
-
borderRadius: 10,
|
|
55
|
-
padding: 12,
|
|
56
|
-
},
|
|
57
|
-
headline: {
|
|
58
|
-
fontWeight: '600',
|
|
59
|
-
fontSize: 13,
|
|
60
|
-
color: '#1a1a2e',
|
|
61
|
-
marginBottom: 6,
|
|
62
|
-
},
|
|
63
|
-
row: {
|
|
64
|
-
flexDirection: 'row',
|
|
65
|
-
alignItems: 'center',
|
|
66
|
-
gap: 8,
|
|
67
|
-
},
|
|
68
|
-
stars: {
|
|
69
|
-
fontSize: 18,
|
|
70
|
-
letterSpacing: 1,
|
|
71
|
-
},
|
|
72
|
-
meta: {
|
|
73
|
-
fontSize: 12,
|
|
74
|
-
color: '#6b7280',
|
|
75
|
-
},
|
|
76
|
-
});
|
package/src/config/endpoints.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SDK Endpoint Configuration
|
|
3
|
-
*
|
|
4
|
-
* All MobileAI backend URLs live here.
|
|
5
|
-
* Change these to point to a self-hosted or staging server.
|
|
6
|
-
*
|
|
7
|
-
* Enterprise customers: use the `analyticsProxyUrl` prop on <AIAgent>
|
|
8
|
-
* to route telemetry through your own backend without touching this file.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const MOBILEAI_BASE = 'http://localhost:3001';
|
|
12
|
-
|
|
13
|
-
export const ENDPOINTS = {
|
|
14
|
-
/** Telemetry event ingest — receives batched SDK events */
|
|
15
|
-
telemetryIngest: `${MOBILEAI_BASE}/api/v1/events`,
|
|
16
|
-
|
|
17
|
-
/** Feature flag sync — fetches remote flags for this analyticsKey */
|
|
18
|
-
featureFlags: `${MOBILEAI_BASE}/api/v1/flags`,
|
|
19
|
-
|
|
20
|
-
/** Live agent escalation (support handoff) */
|
|
21
|
-
escalation: `${MOBILEAI_BASE}`,
|
|
22
|
-
} as const;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { ActionDefinition, ActionParameterDef } from './types';
|
|
2
|
-
|
|
3
|
-
export interface MCPToolDeclaration {
|
|
4
|
-
name: string;
|
|
5
|
-
description: string;
|
|
6
|
-
inputSchema: {
|
|
7
|
-
type: string;
|
|
8
|
-
properties: Record<string, any>;
|
|
9
|
-
required: string[];
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* A central registry for all actions registered via `useAction`.
|
|
15
|
-
* This acts as the single source of truth for:
|
|
16
|
-
* 1. The in-app AI Agent (AgentRuntime)
|
|
17
|
-
* 2. The MCP Server (external agents)
|
|
18
|
-
* 3. iOS App Intents (Siri)
|
|
19
|
-
* 4. Android AppFunctions (Gemini)
|
|
20
|
-
*/
|
|
21
|
-
export class ActionRegistry {
|
|
22
|
-
private actions = new Map<string, ActionDefinition>();
|
|
23
|
-
private listeners = new Set<() => void>();
|
|
24
|
-
|
|
25
|
-
/** Register a new action definition */
|
|
26
|
-
register(action: ActionDefinition): void {
|
|
27
|
-
this.actions.set(action.name, action);
|
|
28
|
-
this.notify();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** Unregister an action by name */
|
|
32
|
-
unregister(name: string): void {
|
|
33
|
-
this.actions.delete(name);
|
|
34
|
-
this.notify();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** Get a specific action by name */
|
|
38
|
-
get(name: string): ActionDefinition | undefined {
|
|
39
|
-
return this.actions.get(name);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** Get all registered actions */
|
|
43
|
-
getAll(): ActionDefinition[] {
|
|
44
|
-
return Array.from(this.actions.values());
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** Clear all registered actions (useful for testing) */
|
|
48
|
-
clear(): void {
|
|
49
|
-
this.actions.clear();
|
|
50
|
-
this.notify();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Subscribe to changes (e.g. when a new screen mounts and registers actions).
|
|
55
|
-
* Useful for the MCP server to re-announce tools.
|
|
56
|
-
*/
|
|
57
|
-
onChange(listener: () => void): () => void {
|
|
58
|
-
this.listeners.add(listener);
|
|
59
|
-
return () => {
|
|
60
|
-
this.listeners.delete(listener);
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** Serialize all actions as strictly-typed MCP tool declarations */
|
|
65
|
-
toMCPTools(): MCPToolDeclaration[] {
|
|
66
|
-
return this.getAll().map((a) => ({
|
|
67
|
-
name: a.name,
|
|
68
|
-
description: a.description,
|
|
69
|
-
inputSchema: this.buildInputSchema(a.parameters),
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
private buildInputSchema(params: Record<string, string | ActionParameterDef>) {
|
|
74
|
-
const properties: Record<string, any> = {};
|
|
75
|
-
const required: string[] = [];
|
|
76
|
-
|
|
77
|
-
for (const [key, val] of Object.entries(params)) {
|
|
78
|
-
if (typeof val === 'string') {
|
|
79
|
-
// Backward compatibility: passing a string means it's a required string param.
|
|
80
|
-
properties[key] = { type: 'string', description: val };
|
|
81
|
-
required.push(key);
|
|
82
|
-
} else {
|
|
83
|
-
// New strict parameter definition
|
|
84
|
-
properties[key] = { type: val.type, description: val.description };
|
|
85
|
-
if (val.enum) {
|
|
86
|
-
properties[key].enum = val.enum;
|
|
87
|
-
}
|
|
88
|
-
if (val.required !== false) {
|
|
89
|
-
required.push(key);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return { type: 'object', properties, required };
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
private notify() {
|
|
98
|
-
this.listeners.forEach((l) => l());
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// Export a singleton instance.
|
|
103
|
-
// This allows background channels (like App Intents bridging) to access actions
|
|
104
|
-
// even if the React tree hasn't accessed the AIAgent context yet.
|
|
105
|
-
export const actionRegistry = new ActionRegistry();
|