@onairos/react-native 3.7.2 → 3.7.4
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 +120 -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 +113 -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 +1,383 @@
|
|
|
1
|
-
import AsyncStorage from'@react-native-async-storage/async-storage';import{clearStoredPin}from'./pinStorageUtils';export const STORAGE_KEYS={'AUTH_TOKEN':_0x5c21(0x0),'ONAIROS_JWT_TOKEN':_0x5c21(0x1),'ENOCH_TOKEN':_0x5c21(0x2),'USER':_0x5c21(0x3),'USER_PROFILE':_0x5c21(0x4),'USER_PROFILE_FALLBACK':_0x5c21(0x5),'USER_PROGRESS':_0x5c21(0x6),'ONBOARDING_COMPLETED':_0x5c21(0x7),'IS_FIRST_TIME_USER':_0x5c21(0x8),'USER_ATTENDANCE_CONFIRMED':_0x5c21(0x9),'ONBOARDING_COMPLETE_TOKEN':_0x5c21(0xa),'EVENT_ACCESS_TOKEN':_0x5c21(0xb),'ONAIROS_USER':_0x5c21(0xc),'APPLE_USER':'apple_user','AUTH_METHOD':_0x5c21(0xd),'CURRENT_EVENT_DATA':_0x5c21(0xe),'CONNECTED_PLATFORMS':_0x5c21(0xf),'PROFILE_IMAGE':_0x5c21(0x10),'USER_ADMIN_STATUS':'user_admin_status'};function _0xdd9d(){const _0x3f0d51=['auth_token','onairos_jwt_token','enoch_token','user','userProfile','userProfileFallback','user_progress','onboardingCompleted','isFirstTimeUser','userAttendanceConfirmed','onboarding_complete_token','event_access_token','onairos_user','auth_method','currentEventData','connectedPlatforms','profileImage','❌\x20Error\x20updating\x20last\x20screen:','✅\x20User\x20progress\x20saved:','❌\x20Error\x20saving\x20user\x20progress:','zKcim','error','UdJZv','now','setItem','USER_PROGRESS','stringify','log','tgeir','tuoZp','Welcome','getItem','parse','tzEXM','✅\x20Auth\x20state\x20saved:','❌\x20Error\x20saving\x20auth\x20state:','ecKWR','authMethod','AUTH_METHOD','OwhEO','qFrPR','❌\x20Error\x20getting\x20auth\x20state:','AUTH_TOKEN','WvbEx','⚠️\x20Error\x20clearing\x20stored\x20PIN\x20(continuing):','✅\x20User\x20data\x20cleared\x20including\x20onboarding\x20completion\x20tokens','yKQNi','❌\x20Error\x20clearing\x20user\x20data:','IFEMP','lpfwQ','USER','USER_PROFILE','ONAIROS_JWT_TOKEN','APPLE_USER','IS_FIRST_TIME_USER','USER_ATTENDANCE_CONFIRMED','PROFILE_IMAGE','ONBOARDING_COMPLETED','ONBOARDING_COMPLETE_TOKEN','EVENT_ACCESS_TOKEN','multiRemove','Ewyjh','HWWTH','zkQNn','ernnl','DCevS','HScFD','WQybD','KcZJw','UBdWG','❌\x20Error\x20determining\x20resume\x20target:','❌\x20Error\x20checking\x20returning\x20user\x20status:','kcCgA','CreateFreshProfile','UzKpm','oIkmz','hasReachedEventPage','hasViewedResults','KcPFY','fVRpj','RbWCB','lWxQE','🎯\x20User\x20has\x20completed\x20onboarding\x20(verified\x20by\x20token)\x20-\x20returning\x20to\x20Home\x20screen','clfkb','isAuthenticated','completedSteps','length','fBhme','zJcwW','ujHpq','hasProfilePhoto','hasCompletedProfile','onairos','hasSelectedIntentions','iOfBu','HzJlL','Intention','qjmfc','AToLP','nFEPt','❌\x20Error\x20checking\x20onboarding\x20status:','FXaFX','WTSVH','kLdnx','ZVyor','true','fxGeS','yomVW','eventData','oalrJ','Qqvxe','yhzuI','CTJwI','jNqKC','WnrYS','SaNVH','❌\x20Error\x20getting\x20user\x20progress:','mkZeG','uQEBI','IpWdp','DEHTS','RBJck','includes','Llyed','dDedI','dBTkk','qCUbS','❌\x20Error\x20marking\x20step\x20completed:','❌\x20Error\x20marking\x20event\x20page\x20reached:','bmBxK','JISZC','XBKrc','ffUMS','wCBMF','dYspt','cCCIH','ViyzY','cGJLq','ZFhlv','BKlXZ','gZITu','❌\x20Error\x20marking\x20app\x20as\x20active:','jJPol','ZFPah','✅\x20App\x20marked\x20as\x20active','TpqtY','ChQer','Home','oQvOE','DWPXR','qCUpT','qHtgp','VkMYt','rjnJy','iVygU','❌\x20Error\x20getting\x20debug\x20storage\x20info:','✅\x20All\x20progress\x20data\x20cleared','❌\x20Error\x20clearing\x20progress\x20data:','gRoqf','MUFGt','fYcAU'];_0xdd9d=function(){return _0x3f0d51;};return _0xdd9d();}export const saveUserProgress=async _0x1c1dfb=>{const _0x3a8899={'ceqAU':_0x5c21(0x11),'CgTEd':function(_0x49b17e,_0x905d3f){return _0x49b17e!==_0x905d3f;},'UdJZv':function(_0x3593f1){return _0x3593f1();},'tgeir':_0x5c21(0x12),'tuoZp':_0x5c21(0x13)};try{if(_0x3a8899['CgTEd'](_0x5c21(0x14),_0x5c21(0x14)))_0x442a27[_0x5c21(0x15)](_0x3a8899['ceqAU'],_0x2c6d70);else{const _0x2913c=await _0x3a8899[_0x5c21(0x16)](getUserProgress),_0x4da52b={..._0x2913c,..._0x1c1dfb,'timestamp':Date[_0x5c21(0x17)]()};await AsyncStorage[_0x5c21(0x18)](STORAGE_KEYS[_0x5c21(0x19)],JSON[_0x5c21(0x1a)](_0x4da52b)),console[_0x5c21(0x1b)](_0x3a8899[_0x5c21(0x1c)],_0x4da52b);}}catch(_0x26072d){console[_0x5c21(0x15)](_0x3a8899[_0x5c21(0x1d)],_0x26072d);}};export const getUserProgress=async()=>{const _0x3a20aa={'FJgeg':'❌\x20Error\x20getting\x20user\x20progress:','tzEXM':_0x5c21(0x1e)};try{const _0x5bf274=await AsyncStorage[_0x5c21(0x1f)](STORAGE_KEYS[_0x5c21(0x19)]);if(_0x5bf274)return JSON[_0x5c21(0x20)](_0x5bf274);}catch(_0x1d87ed){console[_0x5c21(0x15)](_0x3a20aa['FJgeg'],_0x1d87ed);}return{'lastScreen':_0x3a20aa[_0x5c21(0x21)],'completedSteps':[],'authMethod':null,'hasProfilePhoto':![],'hasCompletedProfile':![],'hasSelectedIntentions':![],'hasViewedResults':![],'hasEnteredEventCode':![],'hasRegisteredForEvent':![],'hasReachedEventPage':![],'timestamp':Date[_0x5c21(0x17)]()};};export const saveAuthState=async _0x52d99e=>{const _0x417a4f={'ecKWR':function(_0x273eaf){return _0x273eaf();},'OwhEO':_0x5c21(0x22),'qFrPR':_0x5c21(0x23)};try{const _0x4dbef0=await _0x417a4f[_0x5c21(0x24)](getAuthState),_0x155915={..._0x4dbef0,..._0x52d99e};_0x52d99e[_0x5c21(0x25)]&&await AsyncStorage['setItem'](STORAGE_KEYS[_0x5c21(0x26)],_0x52d99e[_0x5c21(0x25)]),console[_0x5c21(0x1b)](_0x417a4f[_0x5c21(0x27)],_0x155915);}catch(_0x1c9ae){console[_0x5c21(0x15)](_0x417a4f[_0x5c21(0x28)],_0x1c9ae);}};export const getAuthState=async()=>{const _0x434252={'yOTou':_0x5c21(0x29)};try{const _0x1b296e=await AsyncStorage[_0x5c21(0x1f)](STORAGE_KEYS[_0x5c21(0x26)]),_0x55052c=!!await AsyncStorage[_0x5c21(0x1f)](STORAGE_KEYS[_0x5c21(0x2a)]);return{'isAuthenticated':_0x55052c,'authMethod':_0x1b296e,'hasValidToken':_0x55052c};}catch(_0x4443bd){return console[_0x5c21(0x15)](_0x434252['yOTou'],_0x4443bd),{'isAuthenticated':![],'authMethod':null,'hasValidToken':![]};}};export const clearUserData=async()=>{const _0x1183d1={'zkQNn':'❌\x20Error\x20checking\x20onboarding\x20status:','HScFD':'❌\x20Error\x20marking\x20app\x20as\x20active:','UBdWG':_0x5c21(0x23),'IFEMP':function(_0x3536bb,_0x293c4){return _0x3536bb===_0x293c4;},'lpfwQ':'SPJIO','CSXro':function(_0x12edcf){return _0x12edcf();},'Ewyjh':'✅\x20Biometrically\x20stored\x20PIN\x20cleared','cBnBc':function(_0x157f54,_0x336699){return _0x157f54!==_0x336699;},'HWWTH':_0x5c21(0x2b),'ernnl':_0x5c21(0x2c),'DCevS':_0x5c21(0x2d),'WQybD':_0x5c21(0x2e),'KcZJw':_0x5c21(0x2f)};try{if(_0x1183d1[_0x5c21(0x30)](_0x1183d1[_0x5c21(0x31)],_0x1183d1[_0x5c21(0x31)])){const _0x574946=[STORAGE_KEYS[_0x5c21(0x32)],STORAGE_KEYS[_0x5c21(0x33)],STORAGE_KEYS['USER_PROFILE_FALLBACK'],STORAGE_KEYS[_0x5c21(0x19)],STORAGE_KEYS[_0x5c21(0x2a)],STORAGE_KEYS[_0x5c21(0x34)],STORAGE_KEYS['ENOCH_TOKEN'],STORAGE_KEYS['ONAIROS_USER'],STORAGE_KEYS[_0x5c21(0x35)],STORAGE_KEYS[_0x5c21(0x26)],STORAGE_KEYS[_0x5c21(0x36)],STORAGE_KEYS[_0x5c21(0x37)],STORAGE_KEYS[_0x5c21(0x38)],STORAGE_KEYS[_0x5c21(0x39)],STORAGE_KEYS[_0x5c21(0x3a)],STORAGE_KEYS[_0x5c21(0x3b)]];await AsyncStorage[_0x5c21(0x3c)](_0x574946);try{await _0x1183d1['CSXro'](clearStoredPin),console['log'](_0x1183d1[_0x5c21(0x3d)]);}catch(_0xdac07b){if(_0x1183d1['cBnBc'](_0x1183d1[_0x5c21(0x3e)],'WvbEx'))return _0xc04b48[_0x5c21(0x15)](_0x1183d1[_0x5c21(0x3f)],_0x296a0d),![];else console['warn'](_0x1183d1[_0x5c21(0x40)],_0xdac07b);}console[_0x5c21(0x1b)](_0x1183d1[_0x5c21(0x41)]);}else _0x2033ac[_0x5c21(0x15)](_0x1183d1[_0x5c21(0x42)],_0x1da625);}catch(_0x2b53c3){_0x1183d1['IFEMP'](_0x1183d1[_0x5c21(0x43)],_0x1183d1[_0x5c21(0x43)])?console[_0x5c21(0x15)](_0x1183d1[_0x5c21(0x44)],_0x2b53c3):_0x4e86b9[_0x5c21(0x15)](_0x1183d1[_0x5c21(0x45)],_0x59242f);}};export const getResumeTarget=async()=>{const _0x5eedb4={'RbWCB':_0x5c21(0x46),'lWxQE':'Welcome','ujHpq':'❌\x20Error\x20clearing\x20user\x20data:','qjmfc':'❌\x20Error\x20clearing\x20progress\x20data:','FLiqU':_0x5c21(0x47),'oIkmz':function(_0xff94fa){return _0xff94fa();},'BxsLE':function(_0x5306ac){return _0x5306ac();},'KcPFY':function(_0x59b4ca,_0xf25476){return _0x59b4ca!==_0xf25476;},'fVRpj':'uVtzA','clfkb':'Home','fBhme':function(_0x50a3c9,_0x24b017){return _0x50a3c9===_0x24b017;},'zJcwW':_0x5c21(0x48),'hxWUe':_0x5c21(0x49),'iOfBu':function(_0x2607f5,_0x31553a){return _0x2607f5===_0x31553a;},'HzJlL':'fHarD','AToLP':'Results','nFEPt':_0x5c21(0x4a)};try{const _0x1a3715=await _0x5eedb4[_0x5c21(0x4b)](getUserProgress),_0x4ed449=await _0x5eedb4['BxsLE'](getAuthState),_0x21fda9=await _0x5eedb4[_0x5c21(0x4b)](hasEventAccessToken);if(_0x21fda9||_0x1a3715[_0x5c21(0x4c)]&&_0x1a3715[_0x5c21(0x4d)])return _0x5eedb4[_0x5c21(0x4e)](_0x5eedb4[_0x5c21(0x4f)],_0x5eedb4[_0x5c21(0x4f)])?(_0x163f45[_0x5c21(0x15)](_0x5eedb4[_0x5c21(0x50)],_0x558a8e),{'screen':_0x5eedb4[_0x5c21(0x51)]}):(console['log'](_0x5c21(0x52)),{'screen':_0x5eedb4[_0x5c21(0x53)]});if(!_0x4ed449[_0x5c21(0x54)])return{'screen':_0x5eedb4[_0x5c21(0x51)]};if(_0x1a3715[_0x5c21(0x55)][_0x5c21(0x56)]===0x0){if(_0x5eedb4[_0x5c21(0x57)](_0x5eedb4[_0x5c21(0x58)],_0x5eedb4[_0x5c21(0x58)]))return{'screen':'Welcome','params':{'isNewUser':!![],'activateCamera':!![]}};else _0x578897[_0x5c21(0x15)](_0x5eedb4[_0x5c21(0x59)],_0x2cfa3c);}if(!_0x1a3715[_0x5c21(0x5a)])return{'screen':_0x5c21(0x1e),'params':{'isNewUser':!![],'activateCamera':!![]}};if(!_0x1a3715[_0x5c21(0x5b)]){const _0x1acdef=await AsyncStorage[_0x5c21(0x1f)](STORAGE_KEYS[_0x5c21(0x38)]);return{'screen':_0x5eedb4['hxWUe'],'params':{'photo':_0x1acdef,'isReviewerBypass':_0x5eedb4[_0x5c21(0x57)](_0x4ed449[_0x5c21(0x25)],_0x5c21(0x5c))}};}if(!_0x1a3715[_0x5c21(0x5d)]){if(_0x5eedb4[_0x5c21(0x5e)](_0x5eedb4['HzJlL'],_0x5eedb4[_0x5c21(0x5f)])){const _0x569be4=await AsyncStorage['getItem'](STORAGE_KEYS[_0x5c21(0x33)]);return{'screen':_0x5c21(0x60),'params':{'userProfile':_0x569be4?JSON[_0x5c21(0x20)](_0x569be4):null}};}else _0x24a964[_0x5c21(0x15)](_0x5eedb4[_0x5c21(0x61)],_0x1dcede);}const _0x57fee2=await AsyncStorage[_0x5c21(0x1f)](STORAGE_KEYS[_0x5c21(0x33)]);return{'screen':_0x5eedb4[_0x5c21(0x62)],'params':{'userProfile':_0x57fee2?JSON[_0x5c21(0x20)](_0x57fee2):null}};}catch(_0xd56001){return'UzKpm'===_0x5eedb4[_0x5c21(0x63)]?(console[_0x5c21(0x15)](_0x5eedb4['RbWCB'],_0xd56001),{'screen':'Welcome'}):(_0x4a8e0d['error'](_0x5eedb4['FLiqU'],_0x2847a6),![]);}};export const hasCompletedOnboarding=async()=>{const _0x116968={'ZVyor':'❌\x20Error\x20getting\x20debug\x20storage\x20info:','FXaFX':function(_0x5a13dc,_0x4ee828){return _0x5a13dc===_0x4ee828;},'WTSVH':'tpeHL','kLdnx':function(_0x4d2a6e){return _0x4d2a6e();},'efCnh':_0x5c21(0x64)};try{if(_0x116968[_0x5c21(0x65)](_0x116968[_0x5c21(0x66)],_0x116968[_0x5c21(0x66)])){const _0x6847e0=await _0x116968[_0x5c21(0x67)](getUserProgress);return _0x6847e0[_0x5c21(0x5b)]&&_0x6847e0['hasViewedResults'];}else{_0x2308ba[_0x5c21(0x15)](_0x116968[_0x5c21(0x68)],_0x57f1e5);throw _0x3e9a66;}}catch(_0xb8cd8e){return console[_0x5c21(0x15)](_0x116968['efCnh'],_0xb8cd8e),![];}};export const markEventPageReached=async _0x20e536=>{const _0x2fd48c={'yomVW':function(_0x21a5d9){return _0x21a5d9();},'oalrJ':function(_0x39346f,_0x29eb6a){return _0x39346f(_0x29eb6a);},'Qqvxe':_0x5c21(0x69),'gQKET':'✅\x20User\x20marked\x20as\x20having\x20reached\x20event\x20page\x20-\x20will\x20always\x20return\x20to\x20Results','ahAlE':_0x5c21(0x6a),'yhzuI':'❌\x20Error\x20marking\x20event\x20page\x20reached:'};try{const _0x23a168=await _0x2fd48c[_0x5c21(0x6b)](getUserProgress),_0x4d0454={..._0x23a168,'hasReachedEventPage':!![],'hasViewedResults':!![],'eventData':_0x20e536||_0x23a168[_0x5c21(0x6c)],'timestamp':Date['now']()};await _0x2fd48c[_0x5c21(0x6d)](saveUserProgress,_0x4d0454),await AsyncStorage[_0x5c21(0x18)](STORAGE_KEYS[_0x5c21(0x3a)],_0x2fd48c[_0x5c21(0x6e)]),await AsyncStorage[_0x5c21(0x18)](STORAGE_KEYS[_0x5c21(0x3b)],JSON[_0x5c21(0x1a)]({'timestamp':Date[_0x5c21(0x17)](),'eventData':_0x20e536,'hasAccess':!![]})),console[_0x5c21(0x1b)](_0x2fd48c['gQKET']);}catch(_0x111f49){if(_0x5c21(0x6a)!==_0x2fd48c['ahAlE'])return{'screen':'Welcome','params':{'isNewUser':!![],'activateCamera':!![]}};else console[_0x5c21(0x15)](_0x2fd48c[_0x5c21(0x6f)],_0x111f49);}};export const hasEventAccessToken=async()=>{const _0x281333={'CTJwI':function(_0x2470ba){return _0x2470ba();},'jNqKC':function(_0x51838b,_0x333278){return _0x51838b===_0x333278;},'WnrYS':'true','SaNVH':'❌\x20Error\x20checking\x20event\x20access\x20token:'};try{const _0x4e3e64=await AsyncStorage[_0x5c21(0x1f)](STORAGE_KEYS[_0x5c21(0x3a)]),_0x2d8c3e=await _0x281333[_0x5c21(0x70)](getUserProgress);return _0x281333[_0x5c21(0x71)](_0x4e3e64,_0x281333[_0x5c21(0x72)])&&_0x2d8c3e[_0x5c21(0x4c)];}catch(_0x3848d8){return console[_0x5c21(0x15)](_0x281333[_0x5c21(0x73)],_0x3848d8),![];}};export const markStepCompleted=async _0x5ce4bf=>{const _0x5845fd={'DEHTS':_0x5c21(0x74),'qCUbS':'❌\x20Error\x20marking\x20step\x20completed:','IpWdp':_0x5c21(0x75),'RBJck':function(_0x574f90){return _0x574f90();},'Llyed':function(_0x3162d9,_0x4545e2){return _0x3162d9!==_0x4545e2;},'ZcKWL':_0x5c21(0x76),'dBTkk':function(_0x49f0c3,_0x2d347f){return _0x49f0c3(_0x2d347f);}};try{if(_0x5845fd[_0x5c21(0x77)]!==_0x5c21(0x75))_0x444c91[_0x5c21(0x15)](_0x5845fd[_0x5c21(0x78)],_0x38e0c5);else{const _0x137720=await _0x5845fd[_0x5c21(0x79)](getUserProgress);!_0x137720[_0x5c21(0x55)][_0x5c21(0x7a)](_0x5ce4bf)&&(_0x5845fd[_0x5c21(0x7b)](_0x5c21(0x7c),_0x5845fd['ZcKWL'])?(_0x137720[_0x5c21(0x55)]['push'](_0x5ce4bf),await _0x5845fd[_0x5c21(0x7d)](saveUserProgress,_0x137720)):_0x3340c6['error'](_0x5845fd[_0x5c21(0x7e)],_0x106e31));}}catch(_0x79d56b){console[_0x5c21(0x15)](_0x5c21(0x7f),_0x79d56b);}};function _0x5c21(_0xdd9db7,_0x5c21cd){_0xdd9db7=_0xdd9db7-0x0;const _0xb2c4f0=_0xdd9d();let _0x551e33=_0xb2c4f0[_0xdd9db7];return _0x551e33;}export const updateLastScreen=async(_0x5544a4,_0x6c33cc)=>{const _0x187bac={'qqKaO':_0x5c21(0x80),'JISZC':function(_0x3b7e73,_0x2fae83){return _0x3b7e73===_0x2fae83;},'XBKrc':_0x5c21(0x81),'ffUMS':function(_0x44cf79,_0x119573){return _0x44cf79(_0x119573);}};try{_0x187bac[_0x5c21(0x82)]('bmBxK',_0x187bac[_0x5c21(0x83)])?await _0x187bac[_0x5c21(0x84)](saveUserProgress,{'lastScreen':_0x5544a4,'timestamp':Date[_0x5c21(0x17)]()}):_0x27e3d4[_0x5c21(0x15)](_0x187bac['qqKaO'],_0x47adbb);}catch(_0x5eeb0c){console[_0x5c21(0x15)]('❌\x20Error\x20updating\x20last\x20screen:',_0x5eeb0c);}};export const isReturningUser=async()=>{const _0x17cfa9={'AsEps':'❌\x20Error\x20checking\x20event\x20access\x20token:','dYspt':function(_0x15f56b,_0x2f7ccc){return _0x15f56b===_0x2f7ccc;},'cCCIH':_0x5c21(0x85),'ViyzY':function(_0x5bc040){return _0x5bc040();},'cGJLq':function(_0x3da7ad,_0x50164d){return _0x3da7ad>_0x50164d;},'ZFhlv':_0x5c21(0x47)};try{if(_0x17cfa9[_0x5c21(0x86)](_0x17cfa9[_0x5c21(0x87)],_0x5c21(0x85))){const _0x39f838=await _0x17cfa9[_0x5c21(0x88)](getUserProgress),_0x8f9ca0=await _0x17cfa9[_0x5c21(0x88)](getAuthState);return _0x8f9ca0['isAuthenticated']&&_0x17cfa9[_0x5c21(0x89)](_0x39f838[_0x5c21(0x55)][_0x5c21(0x56)],0x0);}else return _0x53c36c[_0x5c21(0x15)](_0x17cfa9['AsEps'],_0x14382c),![];}catch(_0x57b02f){return console[_0x5c21(0x15)](_0x17cfa9[_0x5c21(0x8a)],_0x57b02f),![];}};export const markAppActive=async()=>{const _0x1b050f={'RKdwi':_0x5c21(0x13),'ChQer':'🎯\x20User\x20has\x20completed\x20onboarding\x20(verified\x20by\x20token)\x20-\x20returning\x20to\x20Home\x20screen','mmTVi':_0x5c21(0x8b),'jJPol':'iKBlL','ZFPah':function(_0x148d55,_0x5ce5e2){return _0x148d55(_0x5ce5e2);},'TpqtY':_0x5c21(0x8c),'oQvOE':_0x5c21(0x8d)};try{_0x1b050f['mmTVi']!==_0x1b050f[_0x5c21(0x8e)]?(await _0x1b050f[_0x5c21(0x8f)](saveUserProgress,{'timestamp':Date['now']()}),console[_0x5c21(0x1b)](_0x5c21(0x90))):_0x2f592e[_0x5c21(0x15)](_0x1b050f['RKdwi'],_0x1b85b1);}catch(_0x468780){if(_0x1b050f[_0x5c21(0x91)]!==_0x1b050f[_0x5c21(0x91)])return _0x567fe1['log'](_0x1b050f[_0x5c21(0x92)]),{'screen':_0x5c21(0x93)};else console[_0x5c21(0x15)](_0x1b050f[_0x5c21(0x94)],_0x468780);}};export const getDebugStorageInfo=async()=>{const _0x4a9036={'iVygU':_0x5c21(0x1e),'OeGIQ':function(_0xa8b4f6,_0x46142c){return _0xa8b4f6===_0x46142c;},'qHtgp':function(_0x246fa5){return _0x246fa5();},'VkMYt':function(_0x498dbc){return _0x498dbc();},'rjnJy':_0x5c21(0x95)};try{if(_0x4a9036['OeGIQ'](_0x5c21(0x96),'qCUpT')){const _0x55bc29=await _0x4a9036[_0x5c21(0x97)](getUserProgress),_0x4739cb=await _0x4a9036[_0x5c21(0x98)](getAuthState),_0xcbc8c0=await isReturningUser(),_0x7db2a3=await getResumeTarget();return{'progress':_0x55bc29,'authState':_0x4739cb,'isReturning':_0xcbc8c0,'resumeTarget':_0x7db2a3};}else return _0x2b9aa2[_0x5c21(0x20)](_0x2fb7b8);}catch(_0x5e5ebf){if(_0x4a9036[_0x5c21(0x99)]!==_0x4a9036[_0x5c21(0x99)])return{'screen':_0x4a9036[_0x5c21(0x9a)],'params':{'isNewUser':!![],'activateCamera':!![]}};else{console[_0x5c21(0x15)](_0x5c21(0x9b),_0x5e5ebf);throw _0x5e5ebf;}}};export const clearAllProgress=async()=>{const _0x893a5d={'gRoqf':function(_0x5ae5f9){return _0x5ae5f9();},'MUFGt':_0x5c21(0x9c),'fYcAU':_0x5c21(0x9d)};try{await _0x893a5d[_0x5c21(0x9e)](clearUserData),console['log'](_0x893a5d[_0x5c21(0x9f)]);}catch(_0x34bb3d){console[_0x5c21(0x15)](_0x893a5d[_0x5c21(0xa0)],_0x34bb3d);}};
|
|
1
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
2
|
+
import { clearStoredPin } from './pinStorageUtils';
|
|
3
|
+
|
|
4
|
+
// Storage keys
|
|
5
|
+
export const STORAGE_KEYS = {
|
|
6
|
+
// Authentication
|
|
7
|
+
AUTH_TOKEN: 'auth_token',
|
|
8
|
+
ONAIROS_JWT_TOKEN: 'onairos_jwt_token',
|
|
9
|
+
ENOCH_TOKEN: 'enoch_token',
|
|
10
|
+
// User data
|
|
11
|
+
USER: 'user',
|
|
12
|
+
USER_PROFILE: 'userProfile',
|
|
13
|
+
USER_PROFILE_FALLBACK: 'userProfileFallback',
|
|
14
|
+
// App state
|
|
15
|
+
USER_PROGRESS: 'user_progress',
|
|
16
|
+
ONBOARDING_COMPLETED: 'onboardingCompleted',
|
|
17
|
+
IS_FIRST_TIME_USER: 'isFirstTimeUser',
|
|
18
|
+
USER_ATTENDANCE_CONFIRMED: 'userAttendanceConfirmed',
|
|
19
|
+
// New: Token for completed onboarding with Results access
|
|
20
|
+
ONBOARDING_COMPLETE_TOKEN: 'onboarding_complete_token',
|
|
21
|
+
EVENT_ACCESS_TOKEN: 'event_access_token',
|
|
22
|
+
// Authentication method tracking
|
|
23
|
+
ONAIROS_USER: 'onairos_user',
|
|
24
|
+
APPLE_USER: 'apple_user',
|
|
25
|
+
AUTH_METHOD: 'auth_method',
|
|
26
|
+
// Session data
|
|
27
|
+
CURRENT_EVENT_DATA: 'currentEventData',
|
|
28
|
+
CONNECTED_PLATFORMS: 'connectedPlatforms',
|
|
29
|
+
PROFILE_IMAGE: 'profileImage',
|
|
30
|
+
// Admin status
|
|
31
|
+
USER_ADMIN_STATUS: 'user_admin_status'
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// User progress tracking
|
|
35
|
+
|
|
36
|
+
// Authentication state
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Save user progress to track where they left off
|
|
40
|
+
*/
|
|
41
|
+
export const saveUserProgress = async progress => {
|
|
42
|
+
try {
|
|
43
|
+
const existingProgress = await getUserProgress();
|
|
44
|
+
const updatedProgress = {
|
|
45
|
+
...existingProgress,
|
|
46
|
+
...progress,
|
|
47
|
+
timestamp: Date.now()
|
|
48
|
+
};
|
|
49
|
+
await AsyncStorage.setItem(STORAGE_KEYS.USER_PROGRESS, JSON.stringify(updatedProgress));
|
|
50
|
+
console.log('✅ User progress saved:', updatedProgress);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error('❌ Error saving user progress:', error);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Get user progress to determine where to resume
|
|
58
|
+
*/
|
|
59
|
+
export const getUserProgress = async () => {
|
|
60
|
+
try {
|
|
61
|
+
const progressData = await AsyncStorage.getItem(STORAGE_KEYS.USER_PROGRESS);
|
|
62
|
+
if (progressData) {
|
|
63
|
+
return JSON.parse(progressData);
|
|
64
|
+
}
|
|
65
|
+
} catch (error) {
|
|
66
|
+
console.error('❌ Error getting user progress:', error);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Return default progress
|
|
70
|
+
return {
|
|
71
|
+
lastScreen: 'Welcome',
|
|
72
|
+
completedSteps: [],
|
|
73
|
+
authMethod: null,
|
|
74
|
+
hasProfilePhoto: false,
|
|
75
|
+
hasCompletedProfile: false,
|
|
76
|
+
hasSelectedIntentions: false,
|
|
77
|
+
hasViewedResults: false,
|
|
78
|
+
hasEnteredEventCode: false,
|
|
79
|
+
hasRegisteredForEvent: false,
|
|
80
|
+
hasReachedEventPage: false,
|
|
81
|
+
timestamp: Date.now()
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Save authentication state
|
|
87
|
+
*/
|
|
88
|
+
export const saveAuthState = async authState => {
|
|
89
|
+
try {
|
|
90
|
+
const existingState = await getAuthState();
|
|
91
|
+
const updatedState = {
|
|
92
|
+
...existingState,
|
|
93
|
+
...authState
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// Also save the auth method separately for quick access
|
|
97
|
+
if (authState.authMethod) {
|
|
98
|
+
await AsyncStorage.setItem(STORAGE_KEYS.AUTH_METHOD, authState.authMethod);
|
|
99
|
+
}
|
|
100
|
+
console.log('✅ Auth state saved:', updatedState);
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.error('❌ Error saving auth state:', error);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Get authentication state
|
|
108
|
+
*/
|
|
109
|
+
export const getAuthState = async () => {
|
|
110
|
+
try {
|
|
111
|
+
const authMethod = await AsyncStorage.getItem(STORAGE_KEYS.AUTH_METHOD);
|
|
112
|
+
const hasToken = !!(await AsyncStorage.getItem(STORAGE_KEYS.AUTH_TOKEN));
|
|
113
|
+
return {
|
|
114
|
+
isAuthenticated: hasToken,
|
|
115
|
+
authMethod,
|
|
116
|
+
hasValidToken: hasToken
|
|
117
|
+
};
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.error('❌ Error getting auth state:', error);
|
|
120
|
+
return {
|
|
121
|
+
isAuthenticated: false,
|
|
122
|
+
authMethod: null,
|
|
123
|
+
hasValidToken: false
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Clear all user data (for logout)
|
|
130
|
+
*/
|
|
131
|
+
export const clearUserData = async () => {
|
|
132
|
+
try {
|
|
133
|
+
const keysToRemove = [STORAGE_KEYS.USER, STORAGE_KEYS.USER_PROFILE, STORAGE_KEYS.USER_PROFILE_FALLBACK, STORAGE_KEYS.USER_PROGRESS, STORAGE_KEYS.AUTH_TOKEN, STORAGE_KEYS.ONAIROS_JWT_TOKEN, STORAGE_KEYS.ENOCH_TOKEN, STORAGE_KEYS.ONAIROS_USER, STORAGE_KEYS.APPLE_USER, STORAGE_KEYS.AUTH_METHOD, STORAGE_KEYS.IS_FIRST_TIME_USER, STORAGE_KEYS.USER_ATTENDANCE_CONFIRMED, STORAGE_KEYS.PROFILE_IMAGE, STORAGE_KEYS.ONBOARDING_COMPLETED,
|
|
134
|
+
// Clear the new onboarding completion tokens
|
|
135
|
+
STORAGE_KEYS.ONBOARDING_COMPLETE_TOKEN, STORAGE_KEYS.EVENT_ACCESS_TOKEN];
|
|
136
|
+
await AsyncStorage.multiRemove(keysToRemove);
|
|
137
|
+
|
|
138
|
+
// Also clear biometrically stored PIN
|
|
139
|
+
try {
|
|
140
|
+
await clearStoredPin();
|
|
141
|
+
console.log('✅ Biometrically stored PIN cleared');
|
|
142
|
+
} catch (error) {
|
|
143
|
+
console.warn('⚠️ Error clearing stored PIN (continuing):', error);
|
|
144
|
+
}
|
|
145
|
+
console.log('✅ User data cleared including onboarding completion tokens');
|
|
146
|
+
} catch (error) {
|
|
147
|
+
console.error('❌ Error clearing user data:', error);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Get resume navigation target based on user progress
|
|
153
|
+
*/
|
|
154
|
+
export const getResumeTarget = async () => {
|
|
155
|
+
try {
|
|
156
|
+
const progress = await getUserProgress();
|
|
157
|
+
const authState = await getAuthState();
|
|
158
|
+
|
|
159
|
+
// HIGHEST PRIORITY: Check event access token first (regardless of auth state)
|
|
160
|
+
// This ensures release mode reliability when network auth fails
|
|
161
|
+
const hasEventToken = await hasEventAccessToken();
|
|
162
|
+
if (hasEventToken || progress.hasReachedEventPage && progress.hasViewedResults) {
|
|
163
|
+
console.log('🎯 User has completed onboarding (verified by token) - returning to Home screen');
|
|
164
|
+
|
|
165
|
+
// After completing first event, users go to Home screen instead of Results
|
|
166
|
+
// This provides a better post-event experience and central hub
|
|
167
|
+
return {
|
|
168
|
+
screen: 'Home'
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// If not authenticated, start from Welcome
|
|
173
|
+
if (!authState.isAuthenticated) {
|
|
174
|
+
return {
|
|
175
|
+
screen: 'Welcome'
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// If authenticated but no progress, start camera flow
|
|
180
|
+
if (progress.completedSteps.length === 0) {
|
|
181
|
+
return {
|
|
182
|
+
screen: 'Welcome',
|
|
183
|
+
params: {
|
|
184
|
+
isNewUser: true,
|
|
185
|
+
activateCamera: true
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Resume based on last completed step for users still in onboarding
|
|
191
|
+
if (!progress.hasProfilePhoto) {
|
|
192
|
+
return {
|
|
193
|
+
screen: 'Welcome',
|
|
194
|
+
params: {
|
|
195
|
+
isNewUser: true,
|
|
196
|
+
activateCamera: true
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
if (!progress.hasCompletedProfile) {
|
|
201
|
+
const profileImage = await AsyncStorage.getItem(STORAGE_KEYS.PROFILE_IMAGE);
|
|
202
|
+
return {
|
|
203
|
+
screen: 'CreateFreshProfile',
|
|
204
|
+
params: {
|
|
205
|
+
photo: profileImage,
|
|
206
|
+
isReviewerBypass: authState.authMethod === 'onairos'
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
if (!progress.hasSelectedIntentions) {
|
|
211
|
+
const userProfile = await AsyncStorage.getItem(STORAGE_KEYS.USER_PROFILE);
|
|
212
|
+
return {
|
|
213
|
+
screen: 'Intention',
|
|
214
|
+
params: {
|
|
215
|
+
userProfile: userProfile ? JSON.parse(userProfile) : null
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Default to Results if everything is complete
|
|
221
|
+
const userProfile = await AsyncStorage.getItem(STORAGE_KEYS.USER_PROFILE);
|
|
222
|
+
return {
|
|
223
|
+
screen: 'Results',
|
|
224
|
+
params: {
|
|
225
|
+
userProfile: userProfile ? JSON.parse(userProfile) : null
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
} catch (error) {
|
|
229
|
+
console.error('❌ Error determining resume target:', error);
|
|
230
|
+
return {
|
|
231
|
+
screen: 'Welcome'
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Check if user has completed onboarding flow
|
|
238
|
+
*/
|
|
239
|
+
export const hasCompletedOnboarding = async () => {
|
|
240
|
+
try {
|
|
241
|
+
const progress = await getUserProgress();
|
|
242
|
+
return progress.hasCompletedProfile && progress.hasViewedResults;
|
|
243
|
+
} catch (error) {
|
|
244
|
+
console.error('❌ Error checking onboarding status:', error);
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Mark user as having reached the event page (completed full onboarding)
|
|
251
|
+
* This creates the token that ensures they always return to Results
|
|
252
|
+
*/
|
|
253
|
+
export const markEventPageReached = async eventData => {
|
|
254
|
+
try {
|
|
255
|
+
const progress = await getUserProgress();
|
|
256
|
+
const updatedProgress = {
|
|
257
|
+
...progress,
|
|
258
|
+
hasReachedEventPage: true,
|
|
259
|
+
hasViewedResults: true,
|
|
260
|
+
eventData: eventData || progress.eventData,
|
|
261
|
+
timestamp: Date.now()
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// Save the updated progress
|
|
265
|
+
await saveUserProgress(updatedProgress);
|
|
266
|
+
|
|
267
|
+
// Save the onboarding completion token for extra security
|
|
268
|
+
await AsyncStorage.setItem(STORAGE_KEYS.ONBOARDING_COMPLETE_TOKEN, 'true');
|
|
269
|
+
await AsyncStorage.setItem(STORAGE_KEYS.EVENT_ACCESS_TOKEN, JSON.stringify({
|
|
270
|
+
timestamp: Date.now(),
|
|
271
|
+
eventData: eventData,
|
|
272
|
+
hasAccess: true
|
|
273
|
+
}));
|
|
274
|
+
console.log('✅ User marked as having reached event page - will always return to Results');
|
|
275
|
+
} catch (error) {
|
|
276
|
+
console.error('❌ Error marking event page reached:', error);
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Check if user has the event access token (completed onboarding)
|
|
282
|
+
*/
|
|
283
|
+
export const hasEventAccessToken = async () => {
|
|
284
|
+
try {
|
|
285
|
+
const token = await AsyncStorage.getItem(STORAGE_KEYS.ONBOARDING_COMPLETE_TOKEN);
|
|
286
|
+
const progress = await getUserProgress();
|
|
287
|
+
return token === 'true' && progress.hasReachedEventPage;
|
|
288
|
+
} catch (error) {
|
|
289
|
+
console.error('❌ Error checking event access token:', error);
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Mark a step as completed
|
|
296
|
+
*/
|
|
297
|
+
export const markStepCompleted = async step => {
|
|
298
|
+
try {
|
|
299
|
+
const progress = await getUserProgress();
|
|
300
|
+
if (!progress.completedSteps.includes(step)) {
|
|
301
|
+
progress.completedSteps.push(step);
|
|
302
|
+
await saveUserProgress(progress);
|
|
303
|
+
}
|
|
304
|
+
} catch (error) {
|
|
305
|
+
console.error('❌ Error marking step completed:', error);
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Update user's last screen
|
|
311
|
+
*/
|
|
312
|
+
export const updateLastScreen = async (screen, params) => {
|
|
313
|
+
try {
|
|
314
|
+
await saveUserProgress({
|
|
315
|
+
lastScreen: screen,
|
|
316
|
+
timestamp: Date.now()
|
|
317
|
+
});
|
|
318
|
+
} catch (error) {
|
|
319
|
+
console.error('❌ Error updating last screen:', error);
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Check if this is a returning user with existing progress
|
|
325
|
+
*/
|
|
326
|
+
export const isReturningUser = async () => {
|
|
327
|
+
try {
|
|
328
|
+
const progress = await getUserProgress();
|
|
329
|
+
const authState = await getAuthState();
|
|
330
|
+
return authState.isAuthenticated && progress.completedSteps.length > 0;
|
|
331
|
+
} catch (error) {
|
|
332
|
+
console.error('❌ Error checking returning user status:', error);
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Mark app as active (call this when app becomes active)
|
|
339
|
+
*/
|
|
340
|
+
export const markAppActive = async () => {
|
|
341
|
+
try {
|
|
342
|
+
await saveUserProgress({
|
|
343
|
+
timestamp: Date.now()
|
|
344
|
+
});
|
|
345
|
+
console.log('✅ App marked as active');
|
|
346
|
+
} catch (error) {
|
|
347
|
+
console.error('❌ Error marking app as active:', error);
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Development utility: Get all stored progress data for debugging
|
|
353
|
+
*/
|
|
354
|
+
export const getDebugStorageInfo = async () => {
|
|
355
|
+
try {
|
|
356
|
+
const progress = await getUserProgress();
|
|
357
|
+
const authState = await getAuthState();
|
|
358
|
+
const isReturning = await isReturningUser();
|
|
359
|
+
const resumeTarget = await getResumeTarget();
|
|
360
|
+
return {
|
|
361
|
+
progress,
|
|
362
|
+
authState,
|
|
363
|
+
isReturning,
|
|
364
|
+
resumeTarget
|
|
365
|
+
};
|
|
366
|
+
} catch (error) {
|
|
367
|
+
console.error('❌ Error getting debug storage info:', error);
|
|
368
|
+
throw error;
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Development utility: Clear all progress (for testing)
|
|
374
|
+
*/
|
|
375
|
+
export const clearAllProgress = async () => {
|
|
376
|
+
try {
|
|
377
|
+
await clearUserData();
|
|
378
|
+
console.log('✅ All progress data cleared');
|
|
379
|
+
} catch (error) {
|
|
380
|
+
console.error('❌ Error clearing progress data:', error);
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
//# sourceMappingURL=storageService.js.map
|
|
@@ -1 +1,109 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Telegram Data Extractor
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates the Telegram data export flow:
|
|
5
|
+
* 1. Receives extracted dialogs/messages from WebView
|
|
6
|
+
* 2. Validates and formats data
|
|
7
|
+
* 3. Sends to backend via telegramDataService
|
|
8
|
+
*
|
|
9
|
+
* This acts as the bridge between OAuthWebView and the backend API.
|
|
10
|
+
*
|
|
11
|
+
* @reference ChatGPT implementation: src/services/chatGPTConversationExtractor.ts
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { storeTelegramData } from './telegramDataService';
|
|
15
|
+
import { Alert } from 'react-native';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Combined Telegram export data from WebView
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Hook for Telegram data extraction operations
|
|
23
|
+
*/
|
|
24
|
+
export const useTelegramDataExtractor = () => {
|
|
25
|
+
/**
|
|
26
|
+
* Initiate data export to backend
|
|
27
|
+
*
|
|
28
|
+
* @param username - User identifier
|
|
29
|
+
* @param data - Extracted Telegram data (dialogs and messages)
|
|
30
|
+
* @returns true if successful, false otherwise
|
|
31
|
+
*/
|
|
32
|
+
const initiateDataExport = async (username, data) => {
|
|
33
|
+
var _data$summary, _data$summary2, _data$dialogs, _data$messages, _data$dialogs2, _data$messages2;
|
|
34
|
+
console.log('🚀 [TELEGRAM_EXTRACTOR] Initiating data export');
|
|
35
|
+
console.log('👤 [TELEGRAM_EXTRACTOR] Username:', username);
|
|
36
|
+
console.log('📊 [TELEGRAM_EXTRACTOR] Dialogs:', (_data$summary = data.summary) === null || _data$summary === void 0 ? void 0 : _data$summary.dialogCount);
|
|
37
|
+
console.log('📊 [TELEGRAM_EXTRACTOR] Messages:', (_data$summary2 = data.summary) === null || _data$summary2 === void 0 ? void 0 : _data$summary2.messageCount);
|
|
38
|
+
|
|
39
|
+
// Validation
|
|
40
|
+
if (!username) {
|
|
41
|
+
console.error('❌ [TELEGRAM_EXTRACTOR] Username is required');
|
|
42
|
+
Alert.alert('Error', 'Username is required to export Telegram data.', [{
|
|
43
|
+
text: 'OK',
|
|
44
|
+
style: 'default'
|
|
45
|
+
}]);
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Handle empty data as success - user might have no recent messages
|
|
50
|
+
const totalItems = (((_data$dialogs = data.dialogs) === null || _data$dialogs === void 0 ? void 0 : _data$dialogs.length) || 0) + (((_data$messages = data.messages) === null || _data$messages === void 0 ? void 0 : _data$messages.length) || 0);
|
|
51
|
+
if (totalItems === 0) {
|
|
52
|
+
console.log('ℹ️ [TELEGRAM_EXTRACTOR] No data to export - treating as success (connected)');
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Validate dialogs structure
|
|
57
|
+
const validDialogs = (data.dialogs || []).filter(dialog => {
|
|
58
|
+
const isValid = dialog.id && dialog.title;
|
|
59
|
+
if (!isValid) {
|
|
60
|
+
console.warn('⚠️ [TELEGRAM_EXTRACTOR] Invalid dialog:', dialog);
|
|
61
|
+
}
|
|
62
|
+
return isValid;
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Validate messages structure
|
|
66
|
+
const validMessages = (data.messages || []).filter(msg => {
|
|
67
|
+
const isValid = msg.id && (msg.text || msg.type);
|
|
68
|
+
if (!isValid) {
|
|
69
|
+
console.warn('⚠️ [TELEGRAM_EXTRACTOR] Invalid message:', msg);
|
|
70
|
+
}
|
|
71
|
+
return isValid;
|
|
72
|
+
});
|
|
73
|
+
const filteredOut = (((_data$dialogs2 = data.dialogs) === null || _data$dialogs2 === void 0 ? void 0 : _data$dialogs2.length) || 0) - validDialogs.length + (((_data$messages2 = data.messages) === null || _data$messages2 === void 0 ? void 0 : _data$messages2.length) || 0) - validMessages.length;
|
|
74
|
+
if (filteredOut > 0) {
|
|
75
|
+
console.warn(`⚠️ [TELEGRAM_EXTRACTOR] Filtered out ${filteredOut} invalid items`);
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
console.log('📡 [TELEGRAM_EXTRACTOR] Sending to backend...');
|
|
79
|
+
const result = await storeTelegramData(username, {
|
|
80
|
+
dialogs: validDialogs,
|
|
81
|
+
messages: validMessages,
|
|
82
|
+
userId: data.userId
|
|
83
|
+
});
|
|
84
|
+
if (result.success) {
|
|
85
|
+
console.log('✅ [TELEGRAM_EXTRACTOR] Export completed successfully');
|
|
86
|
+
console.log('📊 [TELEGRAM_EXTRACTOR] Backend response:', result.data);
|
|
87
|
+
return true;
|
|
88
|
+
} else {
|
|
89
|
+
console.error('❌ [TELEGRAM_EXTRACTOR] Backend storage failed:', result.error);
|
|
90
|
+
Alert.alert('Export Failed', result.error || 'An unknown error occurred during data storage.', [{
|
|
91
|
+
text: 'OK',
|
|
92
|
+
style: 'default'
|
|
93
|
+
}]);
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.error('❌ [TELEGRAM_EXTRACTOR] Unexpected error during export:', error);
|
|
98
|
+
Alert.alert('Export Error', 'Failed to connect to the data storage service. Please check your network connection.', [{
|
|
99
|
+
text: 'OK',
|
|
100
|
+
style: 'default'
|
|
101
|
+
}]);
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return {
|
|
106
|
+
initiateDataExport
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=telegramDataExtractor.js.map
|