@onairos/react-native 3.7.2 → 3.7.3
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/lib/commonjs/api/index.js +219 -9
- package/lib/commonjs/components/BodyText.js +27 -9
- package/lib/commonjs/components/BrandMark.js +111 -10
- package/lib/commonjs/components/CodeInput.js +116 -9
- package/lib/commonjs/components/EmailInput.js +30 -8
- package/lib/commonjs/components/GoogleButton.js +56 -9
- package/lib/commonjs/components/HeadingGroup.js +43 -9
- package/lib/commonjs/components/LLMDataInputModal.js +664 -14
- package/lib/commonjs/components/ModalHeader.js +99 -9
- package/lib/commonjs/components/ModalSheet.js +47 -9
- package/lib/commonjs/components/Onairos.js +380 -14
- package/lib/commonjs/components/OnairosButton.js +313 -13
- package/lib/commonjs/components/OnairosSignInButton.js +130 -12
- package/lib/commonjs/components/Overlay.js +465 -13
- package/lib/commonjs/components/PersonaImage.js +137 -10
- package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
- package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
- package/lib/commonjs/components/PinCreationScreen.js +403 -12
- package/lib/commonjs/components/PinInput.js +464 -9
- package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
- package/lib/commonjs/components/PlatformList.js +137 -10
- package/lib/commonjs/components/PlatformToggle.js +180 -9
- package/lib/commonjs/components/PrimaryButton.js +180 -10
- package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
- package/lib/commonjs/components/SignInStep.js +345 -12
- package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
- package/lib/commonjs/components/VerificationStep.js +176 -11
- package/lib/commonjs/components/WelcomeScreen.js +461 -22
- package/lib/commonjs/components/icons/Basicproficon.js +37 -8
- package/lib/commonjs/components/icons/Basicprofile.js +21 -8
- package/lib/commonjs/components/icons/Checkbox.js +21 -8
- package/lib/commonjs/components/icons/Checkmark.js +27 -8
- package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
- package/lib/commonjs/components/icons/Contenticon.js +39 -8
- package/lib/commonjs/components/icons/EnochE.js +41 -8
- package/lib/commonjs/components/icons/Personalityicon.js +30 -8
- package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
- package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
- package/lib/commonjs/components/icons/Userpreferences.js +21 -8
- package/lib/commonjs/components/icons/index.js +84 -17
- package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
- package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
- package/lib/commonjs/components/onboarding/PinInput.js +283 -10
- package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
- package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
- package/lib/commonjs/config/api.js +56 -7
- package/lib/commonjs/constants/index.js +120 -7
- package/lib/commonjs/context/AuthContext.js +345 -10
- package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
- package/lib/commonjs/hooks/useConnections.js +102 -8
- package/lib/commonjs/hooks/useCredentials.js +178 -10
- package/lib/commonjs/hooks/useUserConnections.js +148 -10
- package/lib/commonjs/index.js +439 -34
- package/lib/commonjs/services/apiClient.js +298 -8
- package/lib/commonjs/services/biometricPinService.js +180 -8
- package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
- package/lib/commonjs/services/chatGPTConversationService.js +275 -9
- package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
- package/lib/commonjs/services/claudeConversationService.js +158 -9
- package/lib/commonjs/services/connectedAccountsService.js +310 -10
- package/lib/commonjs/services/googleAuthService.js +252 -11
- package/lib/commonjs/services/hingeDataExtractor.js +105 -8
- package/lib/commonjs/services/hingeDataService.js +150 -9
- package/lib/commonjs/services/imageCompressionService.js +260 -7
- package/lib/commonjs/services/instagramDataExtractor.js +126 -8
- package/lib/commonjs/services/instagramDataService.js +163 -9
- package/lib/commonjs/services/jwtStorageService.js +276 -7
- package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
- package/lib/commonjs/services/linkedinProfileService.js +222 -9
- package/lib/commonjs/services/linkedinScrapingService.js +230 -8
- package/lib/commonjs/services/llmDataStorage.js +294 -8
- package/lib/commonjs/services/mobileTrainingService.js +186 -8
- package/lib/commonjs/services/netflixDataExtractor.js +120 -8
- package/lib/commonjs/services/netflixDataService.js +198 -9
- package/lib/commonjs/services/pinEncryptionService.js +84 -8
- package/lib/commonjs/services/pinStorageUtils.js +105 -7
- package/lib/commonjs/services/platformAuthService.js +1484 -12
- package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
- package/lib/commonjs/services/sephoraDataService.js +200 -9
- package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
- package/lib/commonjs/services/spotifyDataService.js +241 -9
- package/lib/commonjs/services/storageService.js +404 -8
- package/lib/commonjs/services/telegramDataExtractor.js +115 -8
- package/lib/commonjs/services/telegramDataService.js +499 -9
- package/lib/commonjs/services/trainingApiHelpers.js +73 -7
- package/lib/commonjs/services/userConnectionsService.js +340 -10
- package/lib/commonjs/services/youtubeMigrationService.js +416 -10
- package/lib/commonjs/theme/index.js +250 -7
- package/lib/commonjs/types/ambient.d.js +2 -1
- package/lib/commonjs/types/declarations.d.js +2 -1
- package/lib/commonjs/types/index.js +6 -1
- package/lib/commonjs/types/node-fix.d.js +2 -1
- package/lib/commonjs/types/node-override.d.js +2 -1
- package/lib/commonjs/types/opacity.d.js +2 -1
- package/lib/commonjs/types.js +14 -1
- package/lib/commonjs/utils/Portal.js +98 -8
- package/lib/commonjs/utils/api.js +130 -9
- package/lib/commonjs/utils/assetRegistry.js +210 -35
- package/lib/commonjs/utils/auth.js +112 -9
- package/lib/commonjs/utils/connectorTests.js +613 -29
- package/lib/commonjs/utils/crypto.js +62 -8
- package/lib/commonjs/utils/debugHelper.js +64 -1
- package/lib/commonjs/utils/encryption.js +76 -7
- package/lib/commonjs/utils/eventUtils.js +288 -1
- package/lib/commonjs/utils/haptics.js +66 -9
- package/lib/commonjs/utils/imagePreloader.js +6 -1
- package/lib/commonjs/utils/networkDiagnostics.js +226 -8
- package/lib/commonjs/utils/onairosApi.js +350 -9
- package/lib/commonjs/utils/programmaticFlow.js +117 -9
- package/lib/commonjs/utils/retryHelper.js +220 -1
- package/lib/commonjs/utils/secureStorage.js +349 -10
- package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
- package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
- package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
- package/lib/commonjs/utils/webviewScripts/index.js +698 -15
- package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
- package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
- package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
- package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
- package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
- package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
- package/lib/module/api/index.js +211 -1
- package/lib/module/components/BodyText.js +20 -1
- package/lib/module/components/BrandMark.js +104 -1
- package/lib/module/components/CodeInput.js +109 -1
- package/lib/module/components/EmailInput.js +23 -1
- package/lib/module/components/GoogleButton.js +49 -1
- package/lib/module/components/HeadingGroup.js +36 -1
- package/lib/module/components/LLMDataInputModal.js +656 -7
- package/lib/module/components/ModalHeader.js +92 -1
- package/lib/module/components/ModalSheet.js +39 -1
- package/lib/module/components/Onairos.js +373 -1
- package/lib/module/components/OnairosButton.js +305 -1
- package/lib/module/components/OnairosSignInButton.js +121 -1
- package/lib/module/components/Overlay.js +456 -1
- package/lib/module/components/PersonaImage.js +129 -1
- package/lib/module/components/PersonaLoadingScreen.js +310 -1
- package/lib/module/components/PersonalizationConsentScreen.js +460 -1
- package/lib/module/components/PinCreationScreen.js +396 -1
- package/lib/module/components/PinInput.js +456 -1
- package/lib/module/components/PlatformConnectorsStep.js +1302 -6
- package/lib/module/components/PlatformList.js +129 -1
- package/lib/module/components/PlatformToggle.js +173 -1
- package/lib/module/components/PrimaryButton.js +172 -1
- package/lib/module/components/SignInMatchAnimation.js +189 -1
- package/lib/module/components/SignInStep.js +338 -1
- package/lib/module/components/UniversalOnboarding.js +2770 -1
- package/lib/module/components/VerificationStep.js +168 -1
- package/lib/module/components/WelcomeScreen.js +453 -1
- package/lib/module/components/icons/Basicproficon.js +30 -1
- package/lib/module/components/icons/Basicprofile.js +14 -1
- package/lib/module/components/icons/Checkbox.js +14 -1
- package/lib/module/components/icons/Checkmark.js +20 -1
- package/lib/module/components/icons/Contentanalysis.js +14 -1
- package/lib/module/components/icons/Contenticon.js +32 -1
- package/lib/module/components/icons/EnochE.js +34 -1
- package/lib/module/components/icons/Personalityicon.js +23 -1
- package/lib/module/components/icons/Personalityprofile.js +14 -1
- package/lib/module/components/icons/Personalitytraits.js +14 -1
- package/lib/module/components/icons/Userpreferences.js +14 -1
- package/lib/module/components/icons/index.js +13 -1
- package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
- package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
- package/lib/module/components/onboarding/PinInput.js +274 -1
- package/lib/module/components/onboarding/PlatformConnector.js +240 -1
- package/lib/module/config/PLATFORM_APIS.md +849 -0
- package/lib/module/config/api.js +47 -1
- package/lib/module/constants/index.js +114 -1
- package/lib/module/context/AuthContext.js +335 -1
- package/lib/module/hooks/useConnectedAccounts.js +106 -1
- package/lib/module/hooks/useConnections.js +95 -1
- package/lib/module/hooks/useCredentials.js +171 -6
- package/lib/module/hooks/useUserConnections.js +140 -1
- package/lib/module/index.js +172 -1
- package/lib/module/services/apiClient.js +295 -1
- package/lib/module/services/biometricPinService.js +169 -1
- package/lib/module/services/chatGPTConversationExtractor.js +149 -1
- package/lib/module/services/chatGPTConversationService.js +268 -1
- package/lib/module/services/claudeConversationExtractor.js +97 -1
- package/lib/module/services/claudeConversationService.js +151 -1
- package/lib/module/services/connectedAccountsService.js +293 -1
- package/lib/module/services/googleAuthService.js +241 -1
- package/lib/module/services/hingeDataExtractor.js +99 -1
- package/lib/module/services/hingeDataService.js +143 -1
- package/lib/module/services/imageCompressionService.js +250 -1
- package/lib/module/services/instagramDataExtractor.js +120 -1
- package/lib/module/services/instagramDataService.js +156 -1
- package/lib/module/services/jwtStorageService.js +257 -1
- package/lib/module/services/linkedinDOMExtractor.js +234 -1
- package/lib/module/services/linkedinProfileService.js +210 -1
- package/lib/module/services/linkedinScrapingService.js +219 -1
- package/lib/module/services/llmDataStorage.js +277 -1
- package/lib/module/services/mobileTrainingService.js +173 -1
- package/lib/module/services/netflixDataExtractor.js +114 -1
- package/lib/module/services/netflixDataService.js +191 -1
- package/lib/module/services/pinEncryptionService.js +74 -6
- package/lib/module/services/pinStorageUtils.js +93 -1
- package/lib/module/services/platformAuthService.js +1461 -1
- package/lib/module/services/sephoraDataExtractor.js +134 -1
- package/lib/module/services/sephoraDataService.js +193 -1
- package/lib/module/services/spotifyDataExtractor.js +142 -1
- package/lib/module/services/spotifyDataService.js +234 -1
- package/lib/module/services/storageService.js +383 -1
- package/lib/module/services/telegramDataExtractor.js +109 -1
- package/lib/module/services/telegramDataService.js +493 -1
- package/lib/module/services/trainingApiHelpers.js +67 -1
- package/lib/module/services/userConnectionsService.js +329 -1
- package/lib/module/services/youtubeMigrationService.js +405 -1
- package/lib/module/theme/index.js +245 -1
- package/lib/module/types.js +10 -1
- package/lib/module/utils/Portal.js +90 -1
- package/lib/module/utils/api.js +118 -1
- package/lib/module/utils/assetRegistry.js +200 -34
- package/lib/module/utils/auth.js +100 -1
- package/lib/module/utils/connectorTests.js +600 -27
- package/lib/module/utils/crypto.js +54 -1
- package/lib/module/utils/debugHelper.js +54 -1
- package/lib/module/utils/encryption.js +67 -1
- package/lib/module/utils/eventUtils.js +270 -1
- package/lib/module/utils/haptics.js +59 -8
- package/lib/module/utils/imagePreloader.js +3 -1
- package/lib/module/utils/networkDiagnostics.js +217 -1
- package/lib/module/utils/onairosApi.js +333 -1
- package/lib/module/utils/programmaticFlow.js +111 -1
- package/lib/module/utils/retryHelper.js +211 -1
- package/lib/module/utils/secureStorage.js +330 -6
- package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
- package/lib/module/utils/webviewScripts/claude.js +370 -1
- package/lib/module/utils/webviewScripts/hinge.js +405 -1
- package/lib/module/utils/webviewScripts/index.js +434 -1
- package/lib/module/utils/webviewScripts/instagram.js +448 -1
- package/lib/module/utils/webviewScripts/linkedin.js +874 -1
- package/lib/module/utils/webviewScripts/netflix.js +376 -1
- package/lib/module/utils/webviewScripts/sephora.js +510 -1
- package/lib/module/utils/webviewScripts/spotify.js +413 -1
- package/lib/module/utils/webviewScripts/telegram.js +672 -1
- package/package.json +2 -2
|
@@ -1,9 +1,158 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.storeClaudeConversations = void 0;
|
|
7
|
+
var _api = require("../config/api");
|
|
8
|
+
var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
|
|
9
|
+
var _reactNative = require("react-native");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
/**
|
|
12
|
+
* Claude Conversation Service
|
|
13
|
+
*
|
|
14
|
+
* API layer for storing Claude conversation data on backend.
|
|
15
|
+
* Sends extracted user messages to /llm-data/store endpoint.
|
|
16
|
+
*
|
|
17
|
+
* MATCHES Enoch implementation pattern
|
|
18
|
+
* - Sends ONE request per conversation (not all at once)
|
|
19
|
+
* - Uses format: { conversationId, messages[], context }
|
|
20
|
+
* - Platform: "mobile-claude"
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Structure of conversation messages extracted from Claude
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Response from backend /llm-data/store endpoint
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Store Claude conversations on backend
|
|
33
|
+
* Sends one request per conversation (matches ChatGPT pattern)
|
|
34
|
+
*
|
|
35
|
+
* @param userId - Username or identifier
|
|
36
|
+
* @param conversations - Array of conversations with user messages
|
|
37
|
+
* @returns Response indicating success/failure with metadata
|
|
38
|
+
*/
|
|
39
|
+
const storeClaudeConversations = async (userId, conversations) => {
|
|
40
|
+
console.log('🚀 [CLAUDE_SERVICE] Storing Claude conversations for:', userId);
|
|
41
|
+
console.log('📊 [CLAUDE_SERVICE] Number of conversations:', conversations.length);
|
|
42
|
+
console.log('📊 [CLAUDE_SERVICE] Total messages:', conversations.reduce((sum, c) => sum + c.user_messages.length, 0));
|
|
43
|
+
|
|
44
|
+
// Input validation
|
|
45
|
+
if (!userId || !conversations || conversations.length === 0) {
|
|
46
|
+
console.error('❌ [CLAUDE_SERVICE] Invalid input');
|
|
47
|
+
return {
|
|
48
|
+
success: false,
|
|
49
|
+
error: 'Invalid input: userId or conversations missing.'
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
// Get auth token - check all possible storage keys (matches rest of codebase)
|
|
54
|
+
const authToken = (await _asyncStorage.default.getItem('onairos_jwt_token')) || (await _asyncStorage.default.getItem('enoch_token')) || (await _asyncStorage.default.getItem('auth_token'));
|
|
55
|
+
if (!authToken) {
|
|
56
|
+
console.error('❌ [CLAUDE_SERVICE] No auth token found in any storage key');
|
|
57
|
+
return {
|
|
58
|
+
success: false,
|
|
59
|
+
error: 'Authentication token not found. Please log in again.'
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
console.log('🔑 [CLAUDE_SERVICE] Auth token found');
|
|
63
|
+
|
|
64
|
+
// Mobile metadata
|
|
65
|
+
const mobileMetadata = {
|
|
66
|
+
platform: _reactNative.Platform.OS,
|
|
67
|
+
appVersion: '1.0.0',
|
|
68
|
+
osVersion: _reactNative.Platform.OS === 'ios' ? '17.0' : _reactNative.Platform.OS,
|
|
69
|
+
deviceModel: _reactNative.Platform.OS === 'ios' ? 'iPhone' : 'Android',
|
|
70
|
+
isOfflineSync: false
|
|
71
|
+
};
|
|
72
|
+
let successCount = 0;
|
|
73
|
+
let failCount = 0;
|
|
74
|
+
|
|
75
|
+
// Send ONE request per conversation (matches ChatGPT pattern)
|
|
76
|
+
for (let i = 0; i < conversations.length; i++) {
|
|
77
|
+
const conv = conversations[i];
|
|
78
|
+
const now = Date.now();
|
|
79
|
+
|
|
80
|
+
// Build messages array matching format
|
|
81
|
+
const messages = conv.user_messages.map((content, msgIndex) => ({
|
|
82
|
+
id: `${conv.conversation_id}-msg-${msgIndex}`,
|
|
83
|
+
role: 'user',
|
|
84
|
+
content: content,
|
|
85
|
+
timestamp: new Date(now - (conv.user_messages.length - msgIndex) * 1000).toISOString(),
|
|
86
|
+
metadata: {}
|
|
87
|
+
}));
|
|
88
|
+
|
|
89
|
+
// Build conversationData
|
|
90
|
+
const conversationData = {
|
|
91
|
+
conversationId: conv.conversation_id,
|
|
92
|
+
messages: messages,
|
|
93
|
+
context: {
|
|
94
|
+
title: conv.title,
|
|
95
|
+
create_time: Math.floor(now / 1000),
|
|
96
|
+
update_time: Math.floor(now / 1000)
|
|
97
|
+
},
|
|
98
|
+
mobileMetadata: mobileMetadata
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Request body
|
|
102
|
+
const requestBody = {
|
|
103
|
+
platform: 'mobile-claude',
|
|
104
|
+
// Claude platform identifier
|
|
105
|
+
conversationData: conversationData,
|
|
106
|
+
memoryType: 'conversation'
|
|
107
|
+
};
|
|
108
|
+
console.log(`📡 [CLAUDE_SERVICE] Sending conversation ${i + 1}/${conversations.length}: ${conv.title}`);
|
|
109
|
+
try {
|
|
110
|
+
const response = await fetch(`${_api.API_CONFIG.BASE_URL}/llm-data/store`, {
|
|
111
|
+
method: 'POST',
|
|
112
|
+
headers: {
|
|
113
|
+
'Content-Type': 'application/json',
|
|
114
|
+
'Authorization': `Bearer ${authToken}`,
|
|
115
|
+
'User-Agent': `OnairosSDK/1.0.0 (${_reactNative.Platform.OS})`
|
|
116
|
+
},
|
|
117
|
+
body: JSON.stringify(requestBody)
|
|
118
|
+
});
|
|
119
|
+
const responseData = await response.json();
|
|
120
|
+
if (response.ok) {
|
|
121
|
+
console.log(`✅ [CLAUDE_SERVICE] Sent conversation ${i + 1}/${conversations.length}`);
|
|
122
|
+
successCount++;
|
|
123
|
+
} else {
|
|
124
|
+
console.warn(`⚠️ [CLAUDE_SERVICE] Failed conversation ${i + 1}/${conversations.length}:`, responseData.error || response.status);
|
|
125
|
+
failCount++;
|
|
126
|
+
}
|
|
127
|
+
} catch (convError) {
|
|
128
|
+
console.warn(`⚠️ [CLAUDE_SERVICE] Network error for conversation ${i + 1}:`, convError);
|
|
129
|
+
failCount++;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Small delay between requests (0.3s like ChatGPT)
|
|
133
|
+
if (i < conversations.length - 1) {
|
|
134
|
+
await new Promise(resolve => setTimeout(resolve, 300));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
console.log(`📊 [CLAUDE_SERVICE] Complete: ${successCount} success, ${failCount} failed`);
|
|
138
|
+
if (successCount > 0) {
|
|
139
|
+
return {
|
|
140
|
+
success: true,
|
|
141
|
+
message: `Stored ${successCount} of ${conversations.length} conversations`
|
|
142
|
+
};
|
|
143
|
+
} else {
|
|
144
|
+
return {
|
|
145
|
+
success: false,
|
|
146
|
+
error: `Failed to store conversations (${failCount} errors)`
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
} catch (error) {
|
|
150
|
+
console.error('❌ [CLAUDE_SERVICE] Network error:', error);
|
|
151
|
+
return {
|
|
152
|
+
success: false,
|
|
153
|
+
error: error.message || 'Network error. Please check your connection.'
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
exports.storeClaudeConversations = storeClaudeConversations;
|
|
158
|
+
//# sourceMappingURL=claudeConversationService.js.map
|
|
@@ -1,10 +1,310 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
Object[_0x5b1a(0x0)](exports,'__esModule',{'value':!![]}),exports[_0x5b1a(0x1)]=exports[_0x5b1a(0x2)]=exports[_0x5b1a(0x3)]=exports[_0x5b1a(0x4)]=exports[_0x5b1a(0x5)]=exports[_0x5b1a(0x6)]=void 0x0,Object['defineProperty'](exports,'getPlatformIcon',{'enumerable':!![],'get':function(){return _assetRegistry[_0x5b1a(0x7)];}});var _authService=__ONAIROS_REQ_FUNC__(0x0),_api=__ONAIROS_REQ_FUNC__(0x1),_apiKeyService=__ONAIROS_REQ_FUNC__(0x2),_assetRegistry=__ONAIROS_REQ_FUNC__(0x3);const API_BASE_URL=_api[_0x5b1a(0x8)][_0x5b1a(0x9)],getDeveloperAuthHeaders=()=>{const _0x257176={'sKfoN':function(_0x18de90,_0x2cfbf0){return _0x18de90!==_0x2cfbf0;},'PntIG':_0x5b1a(0xa)};if(!(0x0,_apiKeyService['isApiKeyInitialized'])())return console[_0x5b1a(0xb)](_0x5b1a(0xc)),(0x0,_api[_0x5b1a(0xd)])();const _0x1b72ca=(0x0,_apiKeyService['getApiConfig'])();if(!(_0x1b72ca!==null&&_0x257176[_0x5b1a(0xe)](_0x1b72ca,void 0x0)&&_0x1b72ca[_0x5b1a(0xf)]))return(0x0,_api[_0x5b1a(0xd)])();return{...(0x0,_api['getApiHeaders'])(),'Authorization':'Bearer\x20'+_0x1b72ca[_0x5b1a(0xf)],'X-SDK-Version':_0x257176[_0x5b1a(0x10)],'X-SDK-Platform':'react-native'};},getConnectedAccountsLookup=async _0x562005=>{const _0x25022f={'vyDxZ':function(_0x454481,_0xb0dd4f,_0x217526){return _0x454481(_0xb0dd4f,_0x217526);},'TzzKG':function(_0x5a5e6b,_0x3e6bfe){return _0x5a5e6b(_0x3e6bfe);},'zYMIv':function(_0x5d9172){return _0x5d9172();},'GjOXk':_0x5b1a(0x11),'VLfBA':_0x5b1a(0x12),'qcVBE':function(_0x47190a,_0x3591f7){return _0x47190a>_0x3591f7;},'ABzon':_0x5b1a(0x13),'JTqYM':'❌\x20[NEW\x20API]\x20Error\x20fetching\x20connected\x20accounts\x20via\x20lookup:'};try{console[_0x5b1a(0x14)](_0x5b1a(0x15),_0x562005);const _0x545507=await(0x0,_authService[_0x5b1a(0x16)])(),_0xaf27b0=await _0x25022f[_0x5b1a(0x17)](fetch,API_BASE_URL+_0x5b1a(0x18)+_0x25022f[_0x5b1a(0x19)](encodeURIComponent,_0x562005),{'method':'GET','headers':_0x545507?(0x0,_api[_0x5b1a(0x1a)])(_0x545507):_0x25022f[_0x5b1a(0x1b)](getDeveloperAuthHeaders)});if(_0xaf27b0['ok']){if(_0x25022f[_0x5b1a(0x1c)]==='aBvOz'){const _0x1a9fff=await _0xaf27b0['json']();return console[_0x5b1a(0x14)](_0x25022f[_0x5b1a(0x1d)],_0x1a9fff),_0x1a9fff[_0x5b1a(0x1e)]&&_0x1a9fff['connectedAccounts']&&_0x25022f[_0x5b1a(0x1f)](_0x1a9fff[_0x5b1a(0x20)][_0x5b1a(0x21)],0x0)?(console[_0x5b1a(0x14)](_0x5b1a(0x22)+_0x1a9fff[_0x5b1a(0x20)]['length']+'\x20connected\x20accounts'),_0x1a9fff[_0x5b1a(0x20)]):(console[_0x5b1a(0x14)](_0x25022f['ABzon']),[]);}else return _0x2f6e43[_0x5b1a(0x20)];}else return console['log'](_0x5b1a(0x23)+_0xaf27b0[_0x5b1a(0x24)]+'\x20'+_0xaf27b0['statusText']),[];}catch(_0xbb9adc){return console[_0x5b1a(0x14)](_0x25022f[_0x5b1a(0x25)],_0xbb9adc),[];}};function _0x22e7(){const _0x5c0ba6=['defineProperty','getPlatformColor','getConnectedAccountsSmart','getConnectedAccountsLookup','getConnectedAccountsByUsername','getConnectedAccountsByUserId','getConnectedAccountsByEmail','getPlatformIconFromRegistry','API_CONFIG','BASE_URL','3.0.72','warn','⚠️\x20SDK\x20not\x20initialized\x20-\x20using\x20basic\x20headers','getApiHeaders','sKfoN','apiKey','PntIG','aBvOz','✅\x20[NEW\x20API]\x20Connected\x20accounts\x20fetched\x20successfully:','ℹ️\x20[NEW\x20API]\x20No\x20connected\x20accounts\x20found\x20for\x20user','log','🔍\x20[NEW\x20API]\x20Fetching\x20connected\x20accounts\x20via\x20unified\x20lookup\x20for:','getAuthToken','vyDxZ','/connectedAccounts/lookup/','TzzKG','getAuthHeaders','zYMIv','GjOXk','VLfBA','success','qcVBE','connectedAccounts','length','✅\x20[NEW\x20API]\x20Found\x20','⚠️\x20[NEW\x20API]\x20Response\x20not\x20OK:\x20','status','JTqYM','🧠\x20[SMART\x20API]\x20Available\x20identifiers:','IHcMg','🔄\x20[SMART\x20API]\x20New\x20API\x20returned\x20no\x20results,\x20trying\x20fallbacks...','🔄\x20[SMART\x20API]\x20Trying\x20old\x20API\x20with\x20userId:','MwnfQ','🔄\x20[SMART\x20API]\x20Trying\x20old\x20API\x20with\x20username:','⚠️\x20[SMART\x20API]\x20No\x20connected\x20accounts\x20found\x20with\x20any\x20method','NPdSn','oXEEr','wNTbM','XJrmC','hSeAs','XWVhT','mTuMi','🔄\x20[SMART\x20API]\x20Trying\x20old\x20API\x20with\x20email:','VEOaK','zCFjW','❌\x20[LEGACY]\x20Error\x20fetching\x20connected\x20accounts\x20by\x20username:','ahXhk','SaHyo','mAjiE','pjCok','✅\x20[SMART\x20API]\x20Success\x20with\x20old\x20API\x20fallback:\x20','\x20accounts','hfxsG','NfDpu','🔍\x20[LEGACY]\x20Fetching\x20connected\x20accounts\x20for\x20username:','NhGjL','HkQwt','getApiConfig','Bearer\x20','/connectedAccounts?username=','eJaeR','mkuql','json','✅\x20[LEGACY]\x20Connected\x20accounts\x20fetched:','sENuM','DibDO','UJIAR','OaDMm','⚠️\x20[LEGACY]\x20API\x20response\x20not\x20successful\x20or\x20empty','TsWtX','UqGIp','efslO','sVpjE','jSvwG','nSZlD','Wpoma','statusText','LCRNw','NTpyT','aaVLj','aSOGr','🔍\x20[LEGACY]\x20Fetching\x20connected\x20accounts\x20for\x20userId:','TrHJM','DZrPp','kyWCU','RKjSK','/connectedAccounts?userId=','FDfbb','tztIP','cuGFK','WwgmK','#FF0000','reddit','#FF4500','linkedin','instagram','#E1306C','facebook','#E60023','#EA4335','twitter','#1DA1F2','farcaster','openai','anthropic','#D4A574','#000000','gemini','hinge','sephora','telegram','#0088CC','netflix','#E50914','#666666','toLowerCase','youtube','CKUvJ','ErJhO','MjGSQ','lLHBR','Jzosy','wnGDO','gmail','iSZOZ','rBReh','zAkum','pJRLo','#8A63D2','chatgpt','yqDrx','claude','vqPZg','grok','rLuGA','wMrsT','google_ai','DHjOq','ZEGUb','#7C3AED','puQPW','spzPd','HnpSw','pLQdg','#1DB954','ZCVYe'];_0x22e7=function(){return _0x5c0ba6;};return _0x22e7();}exports[_0x5b1a(0x3)]=getConnectedAccountsLookup;const getConnectedAccountsSmart=async(_0x40fa0d,_0x2ceac2,_0x160a45)=>{const _0x1aaad6={'EQAeq':'🧠\x20[SMART\x20API]\x20Starting\x20smart\x20connected\x20accounts\x20fetch...','ooHUc':_0x5b1a(0x26),'NPdSn':function(_0x457929,_0x272b34){return _0x457929!==_0x272b34;},'oXEEr':'lihGQ','wNTbM':_0x5b1a(0x27),'XJrmC':'🧠\x20[SMART\x20API]\x20Trying\x20new\x20unified\x20lookup\x20with\x20email:','hSeAs':function(_0x2e6a7f,_0xc548f2){return _0x2e6a7f>_0xc548f2;},'UQyqh':'✅\x20[SMART\x20API]\x20Success\x20with\x20new\x20unified\x20lookup\x20via\x20email','XWVhT':_0x5b1a(0x28),'mTuMi':function(_0x5d535e,_0x20a72a){return _0x5d535e===_0x20a72a;},'yimYb':function(_0x3c29fa,_0x2d062e){return _0x3c29fa(_0x2d062e);},'VEOaK':function(_0x21db57,_0x4c006a){return _0x21db57===_0x4c006a;},'zCFjW':'FhoRC','ahXhk':_0x5b1a(0x29),'SaHyo':function(_0x1f9671,_0x5470dc){return _0x1f9671(_0x5470dc);},'lNMdw':function(_0x2f0a47,_0x173b3a){return _0x2f0a47===_0x173b3a;},'qcyiS':function(_0x238fb0,_0x4fe051){return _0x238fb0!==_0x4fe051;},'mAjiE':_0x5b1a(0x2a),'pjCok':_0x5b1a(0x2b),'BYfOE':_0x5b1a(0x2c)};console['log'](_0x1aaad6['EQAeq']),console[_0x5b1a(0x14)](_0x1aaad6['ooHUc'],{'userEmail':_0x40fa0d,'userId':_0x2ceac2,'username':_0x160a45});if(_0x40fa0d){if(_0x1aaad6[_0x5b1a(0x2d)](_0x1aaad6[_0x5b1a(0x2e)],_0x1aaad6[_0x5b1a(0x2f)])){console['log'](_0x1aaad6[_0x5b1a(0x30)],_0x40fa0d);const _0x4a5159=await getConnectedAccountsLookup(_0x40fa0d);if(_0x1aaad6[_0x5b1a(0x31)](_0x4a5159[_0x5b1a(0x21)],0x0))return console[_0x5b1a(0x14)](_0x1aaad6['UQyqh']),_0x4a5159;console[_0x5b1a(0x14)](_0x1aaad6[_0x5b1a(0x32)]);}else return _0x18240a[_0x5b1a(0x7)];}console[_0x5b1a(0x14)]('🔄\x20[SMART\x20API]\x20Falling\x20back\x20to\x20old\x20API\x20methods...');let _0x435be3=[];_0x40fa0d&&_0x1aaad6[_0x5b1a(0x33)](_0x435be3['length'],0x0)&&(console[_0x5b1a(0x14)](_0x5b1a(0x34),_0x40fa0d),_0x435be3=await _0x1aaad6['yimYb'](getConnectedAccountsByEmail,_0x40fa0d));if(_0x1aaad6[_0x5b1a(0x35)](_0x435be3[_0x5b1a(0x21)],0x0)&&_0x2ceac2){if(_0x1aaad6['NPdSn'](_0x1aaad6[_0x5b1a(0x36)],_0x1aaad6['zCFjW']))return _0x2fffa7[_0x5b1a(0x14)](_0x5b1a(0x37),_0x2c6fbb),[];else console[_0x5b1a(0x14)](_0x1aaad6[_0x5b1a(0x38)],_0x2ceac2),_0x435be3=await _0x1aaad6[_0x5b1a(0x39)](getConnectedAccountsByUserId,_0x2ceac2);}if(_0x1aaad6['lNMdw'](_0x435be3[_0x5b1a(0x21)],0x0)&&_0x160a45){if(_0x1aaad6['qcyiS']('yvUCj',_0x1aaad6[_0x5b1a(0x3a)]))console[_0x5b1a(0x14)](_0x1aaad6[_0x5b1a(0x3b)],_0x160a45),_0x435be3=await _0x1aaad6[_0x5b1a(0x39)](getConnectedAccountsByUsername,_0x160a45);else return _0xc2c261['log']('ℹ️\x20[NEW\x20API]\x20No\x20connected\x20accounts\x20found\x20for\x20user'),[];}return _0x435be3[_0x5b1a(0x21)]>0x0?console[_0x5b1a(0x14)](_0x5b1a(0x3c)+_0x435be3[_0x5b1a(0x21)]+_0x5b1a(0x3d)):console[_0x5b1a(0x14)](_0x1aaad6['BYfOE']),_0x435be3;};exports['getConnectedAccountsSmart']=getConnectedAccountsSmart;const getConnectedAccountsByUsername=async _0x33e790=>{const _0x47a125={'HkQwt':'⚠️\x20SDK\x20not\x20initialized\x20-\x20using\x20basic\x20headers','sENuM':function(_0xa0698a,_0xe5d779){return _0xa0698a!==_0xe5d779;},'GsLnf':'3.0.72','OaDMm':'❌\x20[LEGACY]\x20Error\x20fetching\x20connected\x20accounts\x20by\x20email:','bYdCu':_0x5b1a(0x3e),'NhGjL':_0x5b1a(0x3f),'dnCpr':_0x5b1a(0x40),'eJaeR':function(_0x575c0d,_0x25cb41){return _0x575c0d(_0x25cb41);},'mkuql':function(_0x10bd53){return _0x10bd53();}};try{if(_0x47a125['bYdCu']===_0x47a125[_0x5b1a(0x41)]){if(!(0x0,_0x47cd5d['isApiKeyInitialized'])())return _0x4f38b0[_0x5b1a(0xb)](_0x47a125[_0x5b1a(0x42)]),(0x0,_0x104fd8[_0x5b1a(0xd)])();const _0x3cbf34=(0x0,_0x55f2a2[_0x5b1a(0x43)])();if(!(_0x3cbf34!==null&&_0x47a125['sENuM'](_0x3cbf34,void 0x0)&&_0x3cbf34[_0x5b1a(0xf)]))return(0x0,_0x55896e['getApiHeaders'])();return{...(0x0,_0x301316[_0x5b1a(0xd)])(),'Authorization':_0x5b1a(0x44)+_0x3cbf34[_0x5b1a(0xf)],'X-SDK-Version':_0x47a125['GsLnf'],'X-SDK-Platform':'react-native'};}else{console[_0x5b1a(0x14)](_0x47a125['dnCpr'],_0x33e790);const _0x1983b1=await(0x0,_authService[_0x5b1a(0x16)])(),_0x4c1616=await fetch(API_BASE_URL+_0x5b1a(0x45)+_0x47a125[_0x5b1a(0x46)](encodeURIComponent,_0x33e790),{'method':'GET','headers':_0x1983b1?(0x0,_api[_0x5b1a(0x1a)])(_0x1983b1):_0x47a125[_0x5b1a(0x47)](getDeveloperAuthHeaders)});if(_0x4c1616['ok']){const _0x42a38e=await _0x4c1616[_0x5b1a(0x48)]();console[_0x5b1a(0x14)](_0x5b1a(0x49),_0x42a38e);if(_0x42a38e[_0x5b1a(0x1e)]&&_0x42a38e['connectedAccounts']&&_0x42a38e['connectedAccounts'][_0x5b1a(0x21)]>0x0)return _0x47a125[_0x5b1a(0x4a)](_0x5b1a(0x4b),_0x5b1a(0x4c))?_0x42a38e[_0x5b1a(0x20)]:(_0x40c4e7[_0x5b1a(0x14)](_0x47a125[_0x5b1a(0x4d)],_0x307de0),[]);}return console[_0x5b1a(0x14)](_0x5b1a(0x4e)),[];}}catch(_0x16b006){return console['log'](_0x5b1a(0x37),_0x16b006),[];}};exports[_0x5b1a(0x4)]=getConnectedAccountsByUsername;const getConnectedAccountsByEmail=async _0x5041b4=>{const _0x1de34e={'aaVLj':_0x5b1a(0x2c),'efslO':'🔍\x20[LEGACY]\x20Fetching\x20connected\x20accounts\x20for\x20email:','sVpjE':function(_0x15ca95,_0x244396){return _0x15ca95(_0x244396);},'jSvwG':_0x5b1a(0x4f),'nSZlD':'✅\x20[LEGACY]\x20Connected\x20accounts\x20fetched:','Wpoma':function(_0x301016,_0x7f2aa){return _0x301016>_0x7f2aa;},'utTOY':function(_0x5eb944,_0x14cac5){return _0x5eb944!==_0x14cac5;},'LCRNw':_0x5b1a(0x50),'NTpyT':'KSqnI'};try{console['log'](_0x1de34e[_0x5b1a(0x51)],_0x5041b4);const _0x535545=await(0x0,_authService[_0x5b1a(0x16)])(),_0x2e49e0=await fetch(API_BASE_URL+'/connectedAccounts?email='+_0x1de34e[_0x5b1a(0x52)](encodeURIComponent,_0x5041b4),{'method':'GET','headers':_0x535545?(0x0,_api['getAuthHeaders'])(_0x535545):getDeveloperAuthHeaders()});if(_0x2e49e0['ok']){if(_0x1de34e[_0x5b1a(0x53)]===_0x1de34e[_0x5b1a(0x53)]){const _0x244cdb=await _0x2e49e0[_0x5b1a(0x48)]();console[_0x5b1a(0x14)](_0x1de34e[_0x5b1a(0x54)],_0x244cdb);if(_0x244cdb[_0x5b1a(0x1e)]&&_0x244cdb[_0x5b1a(0x20)]&&_0x1de34e[_0x5b1a(0x55)](_0x244cdb[_0x5b1a(0x20)][_0x5b1a(0x21)],0x0))return _0x244cdb[_0x5b1a(0x20)];}else return _0x2c3c1f['log'](_0x5b1a(0x23)+_0x154d7c[_0x5b1a(0x24)]+'\x20'+_0x5af40e[_0x5b1a(0x56)]),[];}return console[_0x5b1a(0x14)](_0x5b1a(0x4e)),[];}catch(_0x425de8){if(_0x1de34e['utTOY'](_0x1de34e[_0x5b1a(0x57)],_0x1de34e[_0x5b1a(0x58)]))return console[_0x5b1a(0x14)]('❌\x20[LEGACY]\x20Error\x20fetching\x20connected\x20accounts\x20by\x20email:',_0x425de8),[];else _0x38a566['log'](_0x1de34e[_0x5b1a(0x59)]);}};exports[_0x5b1a(0x6)]=getConnectedAccountsByEmail;const getConnectedAccountsByUserId=async _0xe36410=>{const _0x2874bf={'IXPDS':_0x5b1a(0xc),'DZrPp':_0x5b1a(0x5a),'kyWCU':_0x5b1a(0x5b),'RKjSK':function(_0x2e2a38,_0x81badf,_0x33cdde){return _0x2e2a38(_0x81badf,_0x33cdde);},'FDfbb':function(_0x50b760){return _0x50b760();},'tztIP':_0x5b1a(0x49),'cuGFK':'⚠️\x20[LEGACY]\x20API\x20response\x20not\x20successful\x20or\x20empty','WwgmK':'❌\x20[LEGACY]\x20Error\x20fetching\x20connected\x20accounts\x20by\x20userId:'};try{if(_0x5b1a(0x5c)===_0x2874bf[_0x5b1a(0x5d)])return _0x13b34b[_0x5b1a(0xb)](_0x2874bf['IXPDS']),(0x0,_0x43d895[_0x5b1a(0xd)])();else{console['log'](_0x2874bf[_0x5b1a(0x5e)],_0xe36410);const _0xc1f0cf=await(0x0,_authService[_0x5b1a(0x16)])(),_0x1cc48c=await _0x2874bf[_0x5b1a(0x5f)](fetch,API_BASE_URL+_0x5b1a(0x60)+encodeURIComponent(_0xe36410),{'method':'GET','headers':_0xc1f0cf?(0x0,_api[_0x5b1a(0x1a)])(_0xc1f0cf):_0x2874bf[_0x5b1a(0x61)](getDeveloperAuthHeaders)});if(_0x1cc48c['ok']){const _0x3a8b71=await _0x1cc48c['json']();console['log'](_0x2874bf[_0x5b1a(0x62)],_0x3a8b71);if(_0x3a8b71['success']&&_0x3a8b71[_0x5b1a(0x20)]&&_0x3a8b71['connectedAccounts'][_0x5b1a(0x21)]>0x0)return _0x3a8b71[_0x5b1a(0x20)];}return console[_0x5b1a(0x14)](_0x2874bf[_0x5b1a(0x63)]),[];}}catch(_0x239a04){return console[_0x5b1a(0x14)](_0x2874bf[_0x5b1a(0x64)],_0x239a04),[];}};exports['getConnectedAccountsByUserId']=getConnectedAccountsByUserId;function _0x5b1a(_0x22e713,_0x5b1aa2){_0x22e713=_0x22e713-0x0;const _0x5581d6=_0x22e7();let _0xf7b67a=_0x5581d6[_0x22e713];return _0xf7b67a;}const getPlatformColor=_0x30e693=>{const _0x43eb7e={'CKUvJ':_0x5b1a(0x65),'WGhUp':_0x5b1a(0x66),'TuSij':_0x5b1a(0x67),'ErJhO':_0x5b1a(0x68),'MjGSQ':'#0077B5','lLHBR':_0x5b1a(0x69),'Jzosy':_0x5b1a(0x6a),'hEmUG':_0x5b1a(0x6b),'BPhVI':'#1877F2','jKiTA':'pinterest','wnGDO':_0x5b1a(0x6c),'iSZOZ':'email','rBReh':_0x5b1a(0x6d),'gtMXg':_0x5b1a(0x6e),'zAkum':_0x5b1a(0x6f),'pJRLo':_0x5b1a(0x70),'HAOqd':_0x5b1a(0x71),'yqDrx':'#10A37F','pJkWb':_0x5b1a(0x72),'vqPZg':_0x5b1a(0x73),'rLuGA':_0x5b1a(0x74),'wMrsT':_0x5b1a(0x75),'DHjOq':'#4285F4','ZEGUb':_0x5b1a(0x76),'puQPW':_0x5b1a(0x77),'spzPd':_0x5b1a(0x78),'HnpSw':_0x5b1a(0x79),'pLQdg':_0x5b1a(0x7a),'kZbYl':_0x5b1a(0x7b),'ZCVYe':_0x5b1a(0x7c)},_0x12afdc=_0x30e693[_0x5b1a(0x7d)]();switch(_0x12afdc){case _0x5b1a(0x7e):return _0x43eb7e[_0x5b1a(0x7f)];case _0x43eb7e['WGhUp']:return _0x43eb7e['TuSij'];case _0x43eb7e[_0x5b1a(0x80)]:return _0x43eb7e[_0x5b1a(0x81)];case _0x43eb7e[_0x5b1a(0x82)]:return _0x43eb7e[_0x5b1a(0x83)];case _0x43eb7e['hEmUG']:return _0x43eb7e['BPhVI'];case _0x43eb7e['jKiTA']:return _0x43eb7e[_0x5b1a(0x84)];case _0x5b1a(0x85):case _0x43eb7e[_0x5b1a(0x86)]:return _0x43eb7e[_0x5b1a(0x87)];case _0x43eb7e['gtMXg']:case'x':return _0x43eb7e[_0x5b1a(0x88)];case _0x43eb7e[_0x5b1a(0x89)]:return _0x5b1a(0x8a);case _0x5b1a(0x8b):case _0x43eb7e['HAOqd']:return _0x43eb7e[_0x5b1a(0x8c)];case _0x5b1a(0x8d):case _0x43eb7e['pJkWb']:return _0x43eb7e[_0x5b1a(0x8e)];case _0x5b1a(0x8f):return _0x43eb7e[_0x5b1a(0x90)];case _0x43eb7e[_0x5b1a(0x91)]:case _0x5b1a(0x92):return _0x43eb7e[_0x5b1a(0x93)];case _0x43eb7e[_0x5b1a(0x94)]:return _0x5b1a(0x95);case _0x43eb7e[_0x5b1a(0x82)]:return _0x43eb7e[_0x5b1a(0x83)];case _0x43eb7e[_0x5b1a(0x96)]:return _0x43eb7e[_0x5b1a(0x90)];case _0x43eb7e[_0x5b1a(0x97)]:return _0x43eb7e[_0x5b1a(0x98)];case _0x43eb7e[_0x5b1a(0x99)]:return _0x43eb7e['kZbYl'];case'spotify':return _0x5b1a(0x9a);default:return _0x43eb7e[_0x5b1a(0x9b)];}};exports[_0x5b1a(0x1)]=getPlatformColor;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getPlatformColor = exports.getConnectedAccountsSmart = exports.getConnectedAccountsLookup = exports.getConnectedAccountsByUsername = exports.getConnectedAccountsByUserId = exports.getConnectedAccountsByEmail = void 0;
|
|
7
|
+
Object.defineProperty(exports, "getPlatformIcon", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _assetRegistry.getPlatformIconFromRegistry;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _authService = require("./authService");
|
|
14
|
+
var _api = require("../config/api");
|
|
15
|
+
var _apiKeyService = require("./apiKeyService");
|
|
16
|
+
var _assetRegistry = require("../utils/assetRegistry");
|
|
17
|
+
const API_BASE_URL = _api.API_CONFIG.BASE_URL;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Get developer API key authorization headers
|
|
21
|
+
* Falls back when no user JWT token is available
|
|
22
|
+
*/
|
|
23
|
+
const getDeveloperAuthHeaders = () => {
|
|
24
|
+
if (!(0, _apiKeyService.isApiKeyInitialized)()) {
|
|
25
|
+
console.warn('⚠️ SDK not initialized - using basic headers');
|
|
26
|
+
return (0, _api.getApiHeaders)();
|
|
27
|
+
}
|
|
28
|
+
const config = (0, _apiKeyService.getApiConfig)();
|
|
29
|
+
if (!(config !== null && config !== void 0 && config.apiKey)) {
|
|
30
|
+
return (0, _api.getApiHeaders)();
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
...(0, _api.getApiHeaders)(),
|
|
34
|
+
'Authorization': `Bearer ${config.apiKey}`,
|
|
35
|
+
'X-SDK-Version': '3.0.72',
|
|
36
|
+
'X-SDK-Platform': 'react-native'
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Interface for connected account from API
|
|
41
|
+
|
|
42
|
+
// Interface for API response
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* NEW UNIFIED LOOKUP - Get connected accounts using the simplified lookup endpoint
|
|
46
|
+
* This is the preferred method that makes only ONE request to the backend
|
|
47
|
+
* @param userIdentifier - Can be email, username, userId, or any user identifier
|
|
48
|
+
* @returns Promise<ConnectedAccount[]>
|
|
49
|
+
*/
|
|
50
|
+
const getConnectedAccountsLookup = async userIdentifier => {
|
|
51
|
+
try {
|
|
52
|
+
console.log('🔍 [NEW API] Fetching connected accounts via unified lookup for:', userIdentifier);
|
|
53
|
+
const token = await (0, _authService.getAuthToken)();
|
|
54
|
+
|
|
55
|
+
// Use the new simplified endpoint format
|
|
56
|
+
// 🔒 Use user JWT if available, otherwise use developer API key
|
|
57
|
+
const response = await fetch(`${API_BASE_URL}/connectedAccounts/lookup/${encodeURIComponent(userIdentifier)}`, {
|
|
58
|
+
method: 'GET',
|
|
59
|
+
headers: token ? (0, _api.getAuthHeaders)(token) : getDeveloperAuthHeaders()
|
|
60
|
+
});
|
|
61
|
+
if (response.ok) {
|
|
62
|
+
const data = await response.json();
|
|
63
|
+
console.log('✅ [NEW API] Connected accounts fetched successfully:', data);
|
|
64
|
+
if (data.success && data.connectedAccounts && data.connectedAccounts.length > 0) {
|
|
65
|
+
console.log(`✅ [NEW API] Found ${data.connectedAccounts.length} connected accounts`);
|
|
66
|
+
return data.connectedAccounts;
|
|
67
|
+
} else {
|
|
68
|
+
console.log('ℹ️ [NEW API] No connected accounts found for user');
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
console.log(`⚠️ [NEW API] Response not OK: ${response.status} ${response.statusText}`);
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
} catch (error) {
|
|
76
|
+
console.log('❌ [NEW API] Error fetching connected accounts via lookup:', error);
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* SMART CONNECTED ACCOUNTS FETCHER - Uses new API with old API fallback
|
|
83
|
+
* This function tries the new unified lookup first, then falls back to old methods if needed
|
|
84
|
+
* @param userEmail - User's email (primary identifier)
|
|
85
|
+
* @param userId - User's ID (fallback)
|
|
86
|
+
* @param username - User's username (fallback)
|
|
87
|
+
* @returns Promise<ConnectedAccount[]>
|
|
88
|
+
*/
|
|
89
|
+
exports.getConnectedAccountsLookup = getConnectedAccountsLookup;
|
|
90
|
+
const getConnectedAccountsSmart = async (userEmail, userId, username) => {
|
|
91
|
+
console.log('🧠 [SMART API] Starting smart connected accounts fetch...');
|
|
92
|
+
console.log('🧠 [SMART API] Available identifiers:', {
|
|
93
|
+
userEmail,
|
|
94
|
+
userId,
|
|
95
|
+
username
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Try the new unified lookup API first (preferred method)
|
|
99
|
+
if (userEmail) {
|
|
100
|
+
console.log('🧠 [SMART API] Trying new unified lookup with email:', userEmail);
|
|
101
|
+
const accounts = await getConnectedAccountsLookup(userEmail);
|
|
102
|
+
if (accounts.length > 0) {
|
|
103
|
+
console.log('✅ [SMART API] Success with new unified lookup via email');
|
|
104
|
+
return accounts;
|
|
105
|
+
}
|
|
106
|
+
console.log('🔄 [SMART API] New API returned no results, trying fallbacks...');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// If new API didn't work or no email, try fallbacks
|
|
110
|
+
console.log('🔄 [SMART API] Falling back to old API methods...');
|
|
111
|
+
|
|
112
|
+
// Try old API methods as fallback
|
|
113
|
+
let accounts = [];
|
|
114
|
+
|
|
115
|
+
// Prioritize email for profile views
|
|
116
|
+
if (userEmail && accounts.length === 0) {
|
|
117
|
+
console.log('🔄 [SMART API] Trying old API with email:', userEmail);
|
|
118
|
+
accounts = await getConnectedAccountsByEmail(userEmail);
|
|
119
|
+
}
|
|
120
|
+
if (accounts.length === 0 && userId) {
|
|
121
|
+
console.log('🔄 [SMART API] Trying old API with userId:', userId);
|
|
122
|
+
accounts = await getConnectedAccountsByUserId(userId);
|
|
123
|
+
}
|
|
124
|
+
if (accounts.length === 0 && username) {
|
|
125
|
+
console.log('🔄 [SMART API] Trying old API with username:', username);
|
|
126
|
+
accounts = await getConnectedAccountsByUsername(username);
|
|
127
|
+
}
|
|
128
|
+
if (accounts.length > 0) {
|
|
129
|
+
console.log(`✅ [SMART API] Success with old API fallback: ${accounts.length} accounts`);
|
|
130
|
+
} else {
|
|
131
|
+
console.log('⚠️ [SMART API] No connected accounts found with any method');
|
|
132
|
+
}
|
|
133
|
+
return accounts;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// =============================================================================
|
|
137
|
+
// LEGACY API FUNCTIONS - Keep for backward compatibility and fallback
|
|
138
|
+
// These will be used as fallbacks if the new unified lookup fails
|
|
139
|
+
// =============================================================================
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Get connected accounts by username
|
|
143
|
+
* @param username - Username to fetch connected accounts for
|
|
144
|
+
* @returns Promise<ConnectedAccount[]>
|
|
145
|
+
*/
|
|
146
|
+
exports.getConnectedAccountsSmart = getConnectedAccountsSmart;
|
|
147
|
+
const getConnectedAccountsByUsername = async username => {
|
|
148
|
+
try {
|
|
149
|
+
console.log('🔍 [LEGACY] Fetching connected accounts for username:', username);
|
|
150
|
+
const token = await (0, _authService.getAuthToken)();
|
|
151
|
+
|
|
152
|
+
// 🔒 Use user JWT if available, otherwise use developer API key
|
|
153
|
+
const response = await fetch(`${API_BASE_URL}/connectedAccounts?username=${encodeURIComponent(username)}`, {
|
|
154
|
+
method: 'GET',
|
|
155
|
+
headers: token ? (0, _api.getAuthHeaders)(token) : getDeveloperAuthHeaders()
|
|
156
|
+
});
|
|
157
|
+
if (response.ok) {
|
|
158
|
+
const data = await response.json();
|
|
159
|
+
console.log('✅ [LEGACY] Connected accounts fetched:', data);
|
|
160
|
+
if (data.success && data.connectedAccounts && data.connectedAccounts.length > 0) {
|
|
161
|
+
return data.connectedAccounts;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
console.log('⚠️ [LEGACY] API response not successful or empty');
|
|
165
|
+
return [];
|
|
166
|
+
} catch (error) {
|
|
167
|
+
console.log('❌ [LEGACY] Error fetching connected accounts by username:', error);
|
|
168
|
+
return [];
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Get connected accounts by email
|
|
174
|
+
* @param email - Email to fetch connected accounts for
|
|
175
|
+
* @returns Promise<ConnectedAccount[]>
|
|
176
|
+
*/
|
|
177
|
+
exports.getConnectedAccountsByUsername = getConnectedAccountsByUsername;
|
|
178
|
+
const getConnectedAccountsByEmail = async email => {
|
|
179
|
+
try {
|
|
180
|
+
console.log('🔍 [LEGACY] Fetching connected accounts for email:', email);
|
|
181
|
+
const token = await (0, _authService.getAuthToken)();
|
|
182
|
+
|
|
183
|
+
// 🔒 Use user JWT if available, otherwise use developer API key
|
|
184
|
+
const response = await fetch(`${API_BASE_URL}/connectedAccounts?email=${encodeURIComponent(email)}`, {
|
|
185
|
+
method: 'GET',
|
|
186
|
+
headers: token ? (0, _api.getAuthHeaders)(token) : getDeveloperAuthHeaders()
|
|
187
|
+
});
|
|
188
|
+
if (response.ok) {
|
|
189
|
+
const data = await response.json();
|
|
190
|
+
console.log('✅ [LEGACY] Connected accounts fetched:', data);
|
|
191
|
+
if (data.success && data.connectedAccounts && data.connectedAccounts.length > 0) {
|
|
192
|
+
return data.connectedAccounts;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
console.log('⚠️ [LEGACY] API response not successful or empty');
|
|
196
|
+
return [];
|
|
197
|
+
} catch (error) {
|
|
198
|
+
console.log('❌ [LEGACY] Error fetching connected accounts by email:', error);
|
|
199
|
+
return [];
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Get connected accounts by user ID
|
|
205
|
+
* @param userId - User ID to fetch connected accounts for
|
|
206
|
+
* @returns Promise<ConnectedAccount[]>
|
|
207
|
+
*/
|
|
208
|
+
exports.getConnectedAccountsByEmail = getConnectedAccountsByEmail;
|
|
209
|
+
const getConnectedAccountsByUserId = async userId => {
|
|
210
|
+
try {
|
|
211
|
+
console.log('🔍 [LEGACY] Fetching connected accounts for userId:', userId);
|
|
212
|
+
const token = await (0, _authService.getAuthToken)();
|
|
213
|
+
|
|
214
|
+
// 🔒 Use user JWT if available, otherwise use developer API key
|
|
215
|
+
const response = await fetch(`${API_BASE_URL}/connectedAccounts?userId=${encodeURIComponent(userId)}`, {
|
|
216
|
+
method: 'GET',
|
|
217
|
+
headers: token ? (0, _api.getAuthHeaders)(token) : getDeveloperAuthHeaders()
|
|
218
|
+
});
|
|
219
|
+
if (response.ok) {
|
|
220
|
+
const data = await response.json();
|
|
221
|
+
console.log('✅ [LEGACY] Connected accounts fetched:', data);
|
|
222
|
+
if (data.success && data.connectedAccounts && data.connectedAccounts.length > 0) {
|
|
223
|
+
return data.connectedAccounts;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
console.log('⚠️ [LEGACY] API response not successful or empty');
|
|
227
|
+
return [];
|
|
228
|
+
} catch (error) {
|
|
229
|
+
console.log('❌ [LEGACY] Error fetching connected accounts by userId:', error);
|
|
230
|
+
return [];
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Get platform icon based on platform name
|
|
236
|
+
* @param platform - Platform name (case insensitive)
|
|
237
|
+
* @returns Image source for the platform icon
|
|
238
|
+
*/
|
|
239
|
+
exports.getConnectedAccountsByUserId = getConnectedAccountsByUserId;
|
|
240
|
+
/**
|
|
241
|
+
* Get platform color based on platform name
|
|
242
|
+
* @param platform - Platform name (case insensitive)
|
|
243
|
+
* @returns Hex color code for the platform
|
|
244
|
+
*/
|
|
245
|
+
const getPlatformColor = platform => {
|
|
246
|
+
const platformLower = platform.toLowerCase();
|
|
247
|
+
switch (platformLower) {
|
|
248
|
+
case 'youtube':
|
|
249
|
+
return '#FF0000';
|
|
250
|
+
case 'reddit':
|
|
251
|
+
return '#FF4500';
|
|
252
|
+
case 'linkedin':
|
|
253
|
+
return '#0077B5';
|
|
254
|
+
case 'instagram':
|
|
255
|
+
return '#E1306C';
|
|
256
|
+
case 'facebook':
|
|
257
|
+
return '#1877F2';
|
|
258
|
+
case 'pinterest':
|
|
259
|
+
return '#E60023';
|
|
260
|
+
case 'gmail':
|
|
261
|
+
case 'email':
|
|
262
|
+
return '#EA4335';
|
|
263
|
+
case 'twitter':
|
|
264
|
+
case 'x':
|
|
265
|
+
return '#1DA1F2';
|
|
266
|
+
case 'farcaster':
|
|
267
|
+
return '#8A63D2';
|
|
268
|
+
// LLM Platforms
|
|
269
|
+
case 'chatgpt':
|
|
270
|
+
case 'openai':
|
|
271
|
+
return '#10A37F';
|
|
272
|
+
// OpenAI green
|
|
273
|
+
case 'claude':
|
|
274
|
+
case 'anthropic':
|
|
275
|
+
return '#D4A574';
|
|
276
|
+
// Claude tan/orange
|
|
277
|
+
case 'grok':
|
|
278
|
+
return '#000000';
|
|
279
|
+
// X/Grok black
|
|
280
|
+
case 'gemini':
|
|
281
|
+
case 'google_ai':
|
|
282
|
+
return '#4285F4';
|
|
283
|
+
// Google blue
|
|
284
|
+
// New platforms
|
|
285
|
+
case 'hinge':
|
|
286
|
+
return '#7C3AED';
|
|
287
|
+
// Hinge Purple
|
|
288
|
+
case 'instagram':
|
|
289
|
+
return '#E1306C';
|
|
290
|
+
// Instagram Pink/Magenta
|
|
291
|
+
case 'sephora':
|
|
292
|
+
return '#000000';
|
|
293
|
+
// Sephora Black
|
|
294
|
+
case 'telegram':
|
|
295
|
+
return '#0088CC';
|
|
296
|
+
// Telegram Blue
|
|
297
|
+
// Streaming Platforms
|
|
298
|
+
case 'netflix':
|
|
299
|
+
return '#E50914';
|
|
300
|
+
// Netflix Red
|
|
301
|
+
case 'spotify':
|
|
302
|
+
return '#1DB954';
|
|
303
|
+
// Spotify Green
|
|
304
|
+
default:
|
|
305
|
+
return '#666666';
|
|
306
|
+
// Default gray
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
exports.getPlatformColor = getPlatformColor;
|
|
310
|
+
//# sourceMappingURL=connectedAccountsService.js.map
|