@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,8 +1,404 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object['defineProperty'](exports,_0x50f2(0x0),{'value':!![]}),exports[_0x50f2(0x1)]=exports[_0x50f2(0x2)]=exports[_0x50f2(0x3)]=exports[_0x50f2(0x4)]=exports[_0x50f2(0x5)]=exports[_0x50f2(0x6)]=exports['isReturningUser']=exports[_0x50f2(0x7)]=exports[_0x50f2(0x8)]=exports[_0x50f2(0x9)]=exports[_0x50f2(0xa)]=exports['getDebugStorageInfo']=exports['getAuthState']=exports['clearUserData']=exports[_0x50f2(0xb)]=exports[_0x50f2(0xc)]=void 0x0;var _asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x0)),_pinStorageUtils=__ONAIROS_REQ_FUNC__(0x1);function _interopRequireDefault(_0x2eaa38){return _0x2eaa38&&_0x2eaa38[_0x50f2(0x0)]?_0x2eaa38:{'default':_0x2eaa38};}const STORAGE_KEYS=exports['STORAGE_KEYS']={'AUTH_TOKEN':_0x50f2(0xd),'ONAIROS_JWT_TOKEN':_0x50f2(0xe),'ENOCH_TOKEN':_0x50f2(0xf),'USER':_0x50f2(0x10),'USER_PROFILE':_0x50f2(0x11),'USER_PROFILE_FALLBACK':_0x50f2(0x12),'USER_PROGRESS':_0x50f2(0x13),'ONBOARDING_COMPLETED':_0x50f2(0x14),'IS_FIRST_TIME_USER':'isFirstTimeUser','USER_ATTENDANCE_CONFIRMED':_0x50f2(0x15),'ONBOARDING_COMPLETE_TOKEN':_0x50f2(0x16),'EVENT_ACCESS_TOKEN':_0x50f2(0x17),'ONAIROS_USER':'onairos_user','APPLE_USER':_0x50f2(0x18),'AUTH_METHOD':_0x50f2(0x19),'CURRENT_EVENT_DATA':_0x50f2(0x1a),'CONNECTED_PLATFORMS':_0x50f2(0x1b),'PROFILE_IMAGE':_0x50f2(0x1c),'USER_ADMIN_STATUS':_0x50f2(0x1d)},saveUserProgress=async _0x52c7ed=>{const _0x550b0b={'ShKSP':'❌\x20Error\x20checking\x20returning\x20user\x20status:','yosHN':_0x50f2(0x1e),'bqFtx':_0x50f2(0x1f),'nhRdf':function(_0x598c1b,_0x4bd417){return _0x598c1b===_0x4bd417;},'YHzgP':_0x50f2(0x20),'kOyuU':_0x50f2(0x21),'zDJSo':'lKgeH','jyIxj':_0x50f2(0x22)};try{if(_0x550b0b[_0x50f2(0x23)](_0x550b0b['YHzgP'],_0x550b0b['YHzgP'])){const _0x4585cb=await getUserProgress(),_0x3c4c36={..._0x4585cb,..._0x52c7ed,'timestamp':Date['now']()};await _asyncStorage['default'][_0x50f2(0x24)](STORAGE_KEYS[_0x50f2(0x25)],JSON['stringify'](_0x3c4c36)),console['log'](_0x550b0b[_0x50f2(0x26)],_0x3c4c36);}else return _0x39c1b0['error'](_0x550b0b[_0x50f2(0x27)],_0x2b754d),![];}catch(_0x178e7e){if(_0x550b0b[_0x50f2(0x23)](_0x50f2(0x28),_0x550b0b['zDJSo']))console[_0x50f2(0x29)](_0x550b0b[_0x50f2(0x2a)],_0x178e7e);else return _0x200b2f[_0x50f2(0x29)](_0x550b0b[_0x50f2(0x2b)],_0xb8ae18),{'screen':_0x550b0b[_0x50f2(0x2c)]};}};exports[_0x50f2(0x2)]=saveUserProgress;const getUserProgress=async()=>{const _0x569eed={'MgLdi':_0x50f2(0x1f)};try{const _0x6e3540=await _asyncStorage[_0x50f2(0x2d)][_0x50f2(0x2e)](STORAGE_KEYS['USER_PROGRESS']);if(_0x6e3540)return JSON['parse'](_0x6e3540);}catch(_0x10e30e){console[_0x50f2(0x29)](_0x50f2(0x2f),_0x10e30e);}return{'lastScreen':_0x569eed[_0x50f2(0x30)],'completedSteps':[],'authMethod':null,'hasProfilePhoto':![],'hasCompletedProfile':![],'hasSelectedIntentions':![],'hasViewedResults':![],'hasEnteredEventCode':![],'hasRegisteredForEvent':![],'hasReachedEventPage':![],'timestamp':Date[_0x50f2(0x31)]()};};exports[_0x50f2(0x9)]=getUserProgress;const saveAuthState=async _0x1bc724=>{const _0x3fb2d2={'nAMoM':_0x50f2(0x1f),'lxGzc':function(_0xdd1e2a){return _0xdd1e2a();},'IMDVc':_0x50f2(0x32),'dRmdB':_0x50f2(0x33)};try{const _0x231def=await _0x3fb2d2[_0x50f2(0x34)](getAuthState),_0x5b0bc4={..._0x231def,..._0x1bc724};if(_0x1bc724[_0x50f2(0x35)]){if(_0x3fb2d2[_0x50f2(0x36)]!==_0x3fb2d2[_0x50f2(0x36)])return{'screen':_0x3fb2d2[_0x50f2(0x37)],'params':{'isNewUser':!![],'activateCamera':!![]}};else await _asyncStorage[_0x50f2(0x2d)][_0x50f2(0x24)](STORAGE_KEYS['AUTH_METHOD'],_0x1bc724[_0x50f2(0x35)]);}console[_0x50f2(0x38)](_0x3fb2d2['dRmdB'],_0x5b0bc4);}catch(_0x48656c){console[_0x50f2(0x29)](_0x50f2(0x39),_0x48656c);}};exports[_0x50f2(0x3)]=saveAuthState;const getAuthState=async()=>{const _0x6a6a8={'hGByN':_0x50f2(0x3a)};try{const _0x32f667=await _asyncStorage[_0x50f2(0x2d)][_0x50f2(0x2e)](STORAGE_KEYS[_0x50f2(0x3b)]),_0x2ec33c=!!await _asyncStorage['default'][_0x50f2(0x2e)](STORAGE_KEYS[_0x50f2(0x3c)]);return{'isAuthenticated':_0x2ec33c,'authMethod':_0x32f667,'hasValidToken':_0x2ec33c};}catch(_0x388979){return console[_0x50f2(0x29)](_0x6a6a8[_0x50f2(0x3d)],_0x388979),{'isAuthenticated':![],'authMethod':null,'hasValidToken':![]};}};exports[_0x50f2(0x3e)]=getAuthState;const clearUserData=async()=>{const _0x562b43={'xevvq':_0x50f2(0x22),'zQgad':'❌\x20Error\x20getting\x20auth\x20state:','icmWm':function(_0x56153a,_0x5c1eec){return _0x56153a===_0x5c1eec;},'xYlEo':_0x50f2(0x3f),'DAFZn':function(_0x1931f5,_0xda7d72){return _0x1931f5!==_0xda7d72;},'HnOKy':_0x50f2(0x40),'TpoSF':_0x50f2(0x41),'UfzNp':_0x50f2(0x42)};try{if(_0x562b43[_0x50f2(0x43)](_0x562b43[_0x50f2(0x44)],_0x50f2(0x45)))_0x34ffeb['error'](_0x562b43[_0x50f2(0x46)],_0x56c746);else{const _0x2ed3b9=[STORAGE_KEYS['USER'],STORAGE_KEYS[_0x50f2(0x47)],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[_0x50f2(0x3b)],STORAGE_KEYS['IS_FIRST_TIME_USER'],STORAGE_KEYS[_0x50f2(0x48)],STORAGE_KEYS[_0x50f2(0x49)],STORAGE_KEYS[_0x50f2(0x4a)],STORAGE_KEYS[_0x50f2(0x4b)],STORAGE_KEYS[_0x50f2(0x4c)]];await _asyncStorage[_0x50f2(0x2d)]['multiRemove'](_0x2ed3b9);try{if(_0x562b43[_0x50f2(0x4d)](_0x562b43[_0x50f2(0x4e)],_0x562b43['HnOKy']))return _0x287458[_0x50f2(0x29)](_0x562b43[_0x50f2(0x4f)],_0x4a6e62),{'isAuthenticated':![],'authMethod':null,'hasValidToken':![]};else await(0x0,_pinStorageUtils['clearStoredPin'])(),console[_0x50f2(0x38)](_0x562b43['TpoSF']);}catch(_0x2be9e9){console[_0x50f2(0x50)]('⚠️\x20Error\x20clearing\x20stored\x20PIN\x20(continuing):',_0x2be9e9);}console[_0x50f2(0x38)](_0x50f2(0x51));}}catch(_0x13d044){console[_0x50f2(0x29)](_0x562b43['UfzNp'],_0x13d044);}};exports['clearUserData']=clearUserData;const getResumeTarget=async()=>{const _0x5aa67f={'ILgtH':_0x50f2(0x52),'zZWVP':'❌\x20Error\x20getting\x20debug\x20storage\x20info:','jFjPC':'peDxp','zQjGe':function(_0x56760c){return _0x56760c();},'CFNRV':function(_0x2061f9){return _0x2061f9();},'TUZwf':function(_0x5eae0b,_0x5d3ef6){return _0x5eae0b===_0x5d3ef6;},'NZGhe':'JzjkS','bXOBZ':_0x50f2(0x53),'akhtG':'Home','SfkKO':function(_0x14da50,_0xb4792d){return _0x14da50===_0xb4792d;},'nwtVp':'Welcome','KHCTt':function(_0x2dbc7b,_0x2b1f0e){return _0x2dbc7b!==_0x2b1f0e;},'vfycB':_0x50f2(0x54),'GZRWW':_0x50f2(0x55),'xwUVZ':_0x50f2(0x56),'fLVSU':'Results','lpyKh':_0x50f2(0x1e)};try{if(_0x5aa67f['jFjPC']===_0x5aa67f['jFjPC']){const _0x123600=await _0x5aa67f['zQjGe'](getUserProgress),_0x22cf7f=await _0x5aa67f['zQjGe'](getAuthState),_0x3e1461=await _0x5aa67f[_0x50f2(0x57)](hasEventAccessToken);if(_0x3e1461||_0x123600[_0x50f2(0x58)]&&_0x123600[_0x50f2(0x59)]){if(_0x5aa67f[_0x50f2(0x5a)](_0x5aa67f[_0x50f2(0x5b)],_0x5aa67f['NZGhe']))return console[_0x50f2(0x38)](_0x5aa67f[_0x50f2(0x5c)]),{'screen':_0x5aa67f[_0x50f2(0x5d)]};else _0x380192['error'](_0x5aa67f[_0x50f2(0x5e)],_0x134221);}if(!_0x22cf7f[_0x50f2(0x5f)])return{'screen':_0x50f2(0x1f)};if(_0x5aa67f[_0x50f2(0x60)](_0x123600[_0x50f2(0x61)][_0x50f2(0x62)],0x0))return{'screen':_0x5aa67f[_0x50f2(0x63)],'params':{'isNewUser':!![],'activateCamera':!![]}};if(!_0x123600[_0x50f2(0x64)]){if(_0x5aa67f[_0x50f2(0x65)](_0x5aa67f['vfycB'],'TryxI'))return{'screen':_0x5aa67f['nwtVp'],'params':{'isNewUser':!![],'activateCamera':!![]}};else{_0x20d36f[_0x50f2(0x29)](_0x5aa67f['zZWVP'],_0xf35665);throw _0x28955d;}}if(!_0x123600[_0x50f2(0x66)]){const _0x1b0ba5=await _asyncStorage['default']['getItem'](STORAGE_KEYS[_0x50f2(0x49)]);return{'screen':_0x5aa67f['GZRWW'],'params':{'photo':_0x1b0ba5,'isReviewerBypass':_0x22cf7f[_0x50f2(0x35)]===_0x5aa67f['xwUVZ']}};}if(!_0x123600['hasSelectedIntentions']){const _0x2d09b2=await _asyncStorage[_0x50f2(0x2d)][_0x50f2(0x2e)](STORAGE_KEYS[_0x50f2(0x47)]);return{'screen':'Intention','params':{'userProfile':_0x2d09b2?JSON[_0x50f2(0x67)](_0x2d09b2):null}};}const _0x2d9b43=await _asyncStorage[_0x50f2(0x2d)]['getItem'](STORAGE_KEYS[_0x50f2(0x47)]);return{'screen':_0x5aa67f[_0x50f2(0x68)],'params':{'userProfile':_0x2d9b43?JSON['parse'](_0x2d9b43):null}};}else return _0x1a84b6[_0x50f2(0x29)](_0x50f2(0x69),_0x3aad32),![];}catch(_0xdeebcd){return console[_0x50f2(0x29)](_0x5aa67f[_0x50f2(0x6a)],_0xdeebcd),{'screen':_0x50f2(0x1f)};}};exports['getResumeTarget']=getResumeTarget;const hasCompletedOnboarding=async()=>{const _0x384f56={'cQpye':function(_0xe47954){return _0xe47954();},'LcQFD':_0x50f2(0x69)};try{const _0x424e73=await _0x384f56[_0x50f2(0x6b)](getUserProgress);return _0x424e73['hasCompletedProfile']&&_0x424e73[_0x50f2(0x59)];}catch(_0x539395){return console[_0x50f2(0x29)](_0x384f56['LcQFD'],_0x539395),![];}};exports['hasCompletedOnboarding']=hasCompletedOnboarding;const markEventPageReached=async _0x5e24f2=>{const _0x471e72={'hpnHh':function(_0x4ec2c1){return _0x4ec2c1();},'Tsmjd':function(_0x38fec6,_0x2a2286){return _0x38fec6(_0x2a2286);},'YjjHD':'true','NmdjH':_0x50f2(0x6c)};try{const _0x1897da=await _0x471e72[_0x50f2(0x6d)](getUserProgress),_0x44f78a={..._0x1897da,'hasReachedEventPage':!![],'hasViewedResults':!![],'eventData':_0x5e24f2||_0x1897da['eventData'],'timestamp':Date[_0x50f2(0x31)]()};await _0x471e72[_0x50f2(0x6e)](saveUserProgress,_0x44f78a),await _asyncStorage[_0x50f2(0x2d)][_0x50f2(0x24)](STORAGE_KEYS[_0x50f2(0x4b)],_0x471e72[_0x50f2(0x6f)]),await _asyncStorage['default'][_0x50f2(0x24)](STORAGE_KEYS['EVENT_ACCESS_TOKEN'],JSON[_0x50f2(0x70)]({'timestamp':Date['now'](),'eventData':_0x5e24f2,'hasAccess':!![]})),console[_0x50f2(0x38)](_0x471e72['NmdjH']);}catch(_0xd57b0e){console[_0x50f2(0x29)](_0x50f2(0x71),_0xd57b0e);}};exports[_0x50f2(0x5)]=markEventPageReached;const hasEventAccessToken=async()=>{const _0x3e2ada={'IfgdF':function(_0x349ef6){return _0x349ef6();},'jbjqW':'true'};try{const _0x1b372f=await _asyncStorage['default'][_0x50f2(0x2e)](STORAGE_KEYS[_0x50f2(0x4b)]),_0x3ec6bc=await _0x3e2ada[_0x50f2(0x72)](getUserProgress);return _0x1b372f===_0x3e2ada['jbjqW']&&_0x3ec6bc[_0x50f2(0x58)];}catch(_0x2d69eb){return console[_0x50f2(0x29)](_0x50f2(0x73),_0x2d69eb),![];}};exports[_0x50f2(0x7)]=hasEventAccessToken;const markStepCompleted=async _0x1d8808=>{const _0x2068cf={'nlbLj':_0x50f2(0x42),'nQymY':function(_0xf0f705,_0x42839d){return _0xf0f705!==_0x42839d;},'PWRKH':'ieKYO','QPIkG':function(_0x4b51a2){return _0x4b51a2();},'NUAcp':function(_0x3b0081,_0x184982){return _0x3b0081(_0x184982);},'KaKnH':_0x50f2(0x74),'LgPUM':_0x50f2(0x75)};try{if(_0x2068cf[_0x50f2(0x76)](_0x2068cf[_0x50f2(0x77)],_0x2068cf['PWRKH']))_0x3d007b[_0x50f2(0x29)](_0x2068cf[_0x50f2(0x78)],_0x5647fa);else{const _0x112f5e=await _0x2068cf['QPIkG'](getUserProgress);!_0x112f5e[_0x50f2(0x61)][_0x50f2(0x79)](_0x1d8808)&&(_0x112f5e['completedSteps'][_0x50f2(0x7a)](_0x1d8808),await _0x2068cf[_0x50f2(0x7b)](saveUserProgress,_0x112f5e));}}catch(_0x1e662d){if(_0x2068cf['nQymY'](_0x50f2(0x74),_0x2068cf[_0x50f2(0x7c)]))return{'screen':_0x50f2(0x1f)};else console[_0x50f2(0x29)](_0x2068cf['LgPUM'],_0x1e662d);}};exports['markStepCompleted']=markStepCompleted;const updateLastScreen=async(_0x4d4726,_0x5e6481)=>{const _0x3a5c12={'gCfcl':function(_0x303c5b,_0x268331){return _0x303c5b(_0x268331);},'quAVm':_0x50f2(0x7d)};try{await _0x3a5c12['gCfcl'](saveUserProgress,{'lastScreen':_0x4d4726,'timestamp':Date['now']()});}catch(_0x352cf9){console[_0x50f2(0x29)](_0x3a5c12[_0x50f2(0x7e)],_0x352cf9);}};exports['updateLastScreen']=updateLastScreen;const isReturningUser=async()=>{const _0x160bf8={'dugOJ':function(_0x4f5989){return _0x4f5989();},'OoLIQ':function(_0xbd1023,_0xb68830){return _0xbd1023>_0xb68830;},'FLtNT':'❌\x20Error\x20checking\x20returning\x20user\x20status:'};try{const _0x40fa93=await getUserProgress(),_0x3cd551=await _0x160bf8[_0x50f2(0x7f)](getAuthState);return _0x3cd551[_0x50f2(0x5f)]&&_0x160bf8[_0x50f2(0x80)](_0x40fa93[_0x50f2(0x61)][_0x50f2(0x62)],0x0);}catch(_0x799dd9){return console[_0x50f2(0x29)](_0x160bf8[_0x50f2(0x81)],_0x799dd9),![];}};exports[_0x50f2(0x82)]=isReturningUser;function _0x2aac(){const _0x2ec8fe=['__esModule','updateLastScreen','saveUserProgress','saveAuthState','markStepCompleted','markEventPageReached','markAppActive','hasEventAccessToken','hasCompletedOnboarding','getUserProgress','getResumeTarget','clearAllProgress','STORAGE_KEYS','auth_token','onairos_jwt_token','enoch_token','user','userProfile','userProfileFallback','user_progress','onboardingCompleted','userAttendanceConfirmed','onboarding_complete_token','event_access_token','apple_user','auth_method','currentEventData','connectedPlatforms','profileImage','user_admin_status','❌\x20Error\x20determining\x20resume\x20target:','Welcome','oJdvs','✅\x20User\x20progress\x20saved:','❌\x20Error\x20saving\x20user\x20progress:','nhRdf','setItem','USER_PROGRESS','kOyuU','ShKSP','lKgeH','error','jyIxj','yosHN','bqFtx','default','getItem','❌\x20Error\x20getting\x20user\x20progress:','MgLdi','now','sOnvB','✅\x20Auth\x20state\x20saved:','lxGzc','authMethod','IMDVc','nAMoM','log','❌\x20Error\x20saving\x20auth\x20state:','❌\x20Error\x20getting\x20auth\x20state:','AUTH_METHOD','AUTH_TOKEN','hGByN','getAuthState','xgLuO','Uobtg','✅\x20Biometrically\x20stored\x20PIN\x20cleared','❌\x20Error\x20clearing\x20user\x20data:','icmWm','xYlEo','CXEEa','xevvq','USER_PROFILE','USER_ATTENDANCE_CONFIRMED','PROFILE_IMAGE','ONBOARDING_COMPLETED','ONBOARDING_COMPLETE_TOKEN','EVENT_ACCESS_TOKEN','DAFZn','HnOKy','zQgad','warn','✅\x20User\x20data\x20cleared\x20including\x20onboarding\x20completion\x20tokens','❌\x20Error\x20clearing\x20progress\x20data:','🎯\x20User\x20has\x20completed\x20onboarding\x20(verified\x20by\x20token)\x20-\x20returning\x20to\x20Home\x20screen','OWlli','CreateFreshProfile','onairos','CFNRV','hasReachedEventPage','hasViewedResults','TUZwf','NZGhe','bXOBZ','akhtG','ILgtH','isAuthenticated','SfkKO','completedSteps','length','nwtVp','hasProfilePhoto','KHCTt','hasCompletedProfile','parse','fLVSU','❌\x20Error\x20checking\x20onboarding\x20status:','lpyKh','cQpye','✅\x20User\x20marked\x20as\x20having\x20reached\x20event\x20page\x20-\x20will\x20always\x20return\x20to\x20Results','hpnHh','Tsmjd','YjjHD','stringify','❌\x20Error\x20marking\x20event\x20page\x20reached:','IfgdF','❌\x20Error\x20checking\x20event\x20access\x20token:','WcLIB','❌\x20Error\x20marking\x20step\x20completed:','nQymY','PWRKH','nlbLj','includes','push','NUAcp','KaKnH','❌\x20Error\x20updating\x20last\x20screen:','quAVm','dugOJ','OoLIQ','FLtNT','isReturningUser','HsYlT','✅\x20App\x20marked\x20as\x20active','❌\x20Error\x20marking\x20app\x20as\x20active:','SfmdK','hoKNo','yFYVm','Lavtn','UDZQb','getDebugStorageInfo','mOeLN','✅\x20All\x20progress\x20data\x20cleared','agSLM'];_0x2aac=function(){return _0x2ec8fe;};return _0x2aac();}function _0x50f2(_0x2aac13,_0x50f21e){_0x2aac13=_0x2aac13-0x0;const _0x1f7cd3=_0x2aac();let _0x7eab55=_0x1f7cd3[_0x2aac13];return _0x7eab55;}const markAppActive=async()=>{const _0x489c3e={'yFYVm':'⚠️\x20Error\x20clearing\x20stored\x20PIN\x20(continuing):','SfmdK':function(_0x13e428,_0x3b2b7){return _0x13e428===_0x3b2b7;},'hoKNo':_0x50f2(0x83),'ftfBU':_0x50f2(0x84),'RvqRe':_0x50f2(0x85)};try{_0x489c3e[_0x50f2(0x86)](_0x489c3e[_0x50f2(0x87)],_0x489c3e[_0x50f2(0x87)])?(await saveUserProgress({'timestamp':Date[_0x50f2(0x31)]()}),console['log'](_0x489c3e['ftfBU'])):_0x5dc5cf[_0x50f2(0x50)](_0x489c3e[_0x50f2(0x88)],_0xe04715);}catch(_0xd07eea){console['error'](_0x489c3e['RvqRe'],_0xd07eea);}};exports[_0x50f2(0x6)]=markAppActive;const getDebugStorageInfo=async()=>{const _0x455e74={'Lavtn':function(_0x2d289c){return _0x2d289c();},'UDZQb':'❌\x20Error\x20getting\x20debug\x20storage\x20info:'};try{const _0x5679b6=await getUserProgress(),_0x2e1d70=await getAuthState(),_0x19f0a3=await isReturningUser(),_0x7dfd9e=await _0x455e74[_0x50f2(0x89)](getResumeTarget);return{'progress':_0x5679b6,'authState':_0x2e1d70,'isReturning':_0x19f0a3,'resumeTarget':_0x7dfd9e};}catch(_0x3d99b0){console['error'](_0x455e74[_0x50f2(0x8a)],_0x3d99b0);throw _0x3d99b0;}};exports[_0x50f2(0x8b)]=getDebugStorageInfo;const clearAllProgress=async()=>{const _0x2da39e={'mOeLN':function(_0x133034){return _0x133034();},'agSLM':_0x50f2(0x52)};try{await _0x2da39e[_0x50f2(0x8c)](clearUserData),console['log'](_0x50f2(0x8d));}catch(_0x2d46c4){console[_0x50f2(0x29)](_0x2da39e[_0x50f2(0x8e)],_0x2d46c4);}};exports[_0x50f2(0xb)]=clearAllProgress;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.updateLastScreen = exports.saveUserProgress = exports.saveAuthState = exports.markStepCompleted = exports.markEventPageReached = exports.markAppActive = exports.isReturningUser = exports.hasEventAccessToken = exports.hasCompletedOnboarding = exports.getUserProgress = exports.getResumeTarget = exports.getDebugStorageInfo = exports.getAuthState = exports.clearUserData = exports.clearAllProgress = exports.STORAGE_KEYS = void 0;
|
|
7
|
+
var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
|
|
8
|
+
var _pinStorageUtils = require("./pinStorageUtils");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
// Storage keys
|
|
11
|
+
const STORAGE_KEYS = exports.STORAGE_KEYS = {
|
|
12
|
+
// Authentication
|
|
13
|
+
AUTH_TOKEN: 'auth_token',
|
|
14
|
+
ONAIROS_JWT_TOKEN: 'onairos_jwt_token',
|
|
15
|
+
ENOCH_TOKEN: 'enoch_token',
|
|
16
|
+
// User data
|
|
17
|
+
USER: 'user',
|
|
18
|
+
USER_PROFILE: 'userProfile',
|
|
19
|
+
USER_PROFILE_FALLBACK: 'userProfileFallback',
|
|
20
|
+
// App state
|
|
21
|
+
USER_PROGRESS: 'user_progress',
|
|
22
|
+
ONBOARDING_COMPLETED: 'onboardingCompleted',
|
|
23
|
+
IS_FIRST_TIME_USER: 'isFirstTimeUser',
|
|
24
|
+
USER_ATTENDANCE_CONFIRMED: 'userAttendanceConfirmed',
|
|
25
|
+
// New: Token for completed onboarding with Results access
|
|
26
|
+
ONBOARDING_COMPLETE_TOKEN: 'onboarding_complete_token',
|
|
27
|
+
EVENT_ACCESS_TOKEN: 'event_access_token',
|
|
28
|
+
// Authentication method tracking
|
|
29
|
+
ONAIROS_USER: 'onairos_user',
|
|
30
|
+
APPLE_USER: 'apple_user',
|
|
31
|
+
AUTH_METHOD: 'auth_method',
|
|
32
|
+
// Session data
|
|
33
|
+
CURRENT_EVENT_DATA: 'currentEventData',
|
|
34
|
+
CONNECTED_PLATFORMS: 'connectedPlatforms',
|
|
35
|
+
PROFILE_IMAGE: 'profileImage',
|
|
36
|
+
// Admin status
|
|
37
|
+
USER_ADMIN_STATUS: 'user_admin_status'
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// User progress tracking
|
|
41
|
+
|
|
42
|
+
// Authentication state
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Save user progress to track where they left off
|
|
46
|
+
*/
|
|
47
|
+
const saveUserProgress = async progress => {
|
|
48
|
+
try {
|
|
49
|
+
const existingProgress = await getUserProgress();
|
|
50
|
+
const updatedProgress = {
|
|
51
|
+
...existingProgress,
|
|
52
|
+
...progress,
|
|
53
|
+
timestamp: Date.now()
|
|
54
|
+
};
|
|
55
|
+
await _asyncStorage.default.setItem(STORAGE_KEYS.USER_PROGRESS, JSON.stringify(updatedProgress));
|
|
56
|
+
console.log('✅ User progress saved:', updatedProgress);
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error('❌ Error saving user progress:', error);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Get user progress to determine where to resume
|
|
64
|
+
*/
|
|
65
|
+
exports.saveUserProgress = saveUserProgress;
|
|
66
|
+
const getUserProgress = async () => {
|
|
67
|
+
try {
|
|
68
|
+
const progressData = await _asyncStorage.default.getItem(STORAGE_KEYS.USER_PROGRESS);
|
|
69
|
+
if (progressData) {
|
|
70
|
+
return JSON.parse(progressData);
|
|
71
|
+
}
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.error('❌ Error getting user progress:', error);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Return default progress
|
|
77
|
+
return {
|
|
78
|
+
lastScreen: 'Welcome',
|
|
79
|
+
completedSteps: [],
|
|
80
|
+
authMethod: null,
|
|
81
|
+
hasProfilePhoto: false,
|
|
82
|
+
hasCompletedProfile: false,
|
|
83
|
+
hasSelectedIntentions: false,
|
|
84
|
+
hasViewedResults: false,
|
|
85
|
+
hasEnteredEventCode: false,
|
|
86
|
+
hasRegisteredForEvent: false,
|
|
87
|
+
hasReachedEventPage: false,
|
|
88
|
+
timestamp: Date.now()
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Save authentication state
|
|
94
|
+
*/
|
|
95
|
+
exports.getUserProgress = getUserProgress;
|
|
96
|
+
const saveAuthState = async authState => {
|
|
97
|
+
try {
|
|
98
|
+
const existingState = await getAuthState();
|
|
99
|
+
const updatedState = {
|
|
100
|
+
...existingState,
|
|
101
|
+
...authState
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// Also save the auth method separately for quick access
|
|
105
|
+
if (authState.authMethod) {
|
|
106
|
+
await _asyncStorage.default.setItem(STORAGE_KEYS.AUTH_METHOD, authState.authMethod);
|
|
107
|
+
}
|
|
108
|
+
console.log('✅ Auth state saved:', updatedState);
|
|
109
|
+
} catch (error) {
|
|
110
|
+
console.error('❌ Error saving auth state:', error);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Get authentication state
|
|
116
|
+
*/
|
|
117
|
+
exports.saveAuthState = saveAuthState;
|
|
118
|
+
const getAuthState = async () => {
|
|
119
|
+
try {
|
|
120
|
+
const authMethod = await _asyncStorage.default.getItem(STORAGE_KEYS.AUTH_METHOD);
|
|
121
|
+
const hasToken = !!(await _asyncStorage.default.getItem(STORAGE_KEYS.AUTH_TOKEN));
|
|
122
|
+
return {
|
|
123
|
+
isAuthenticated: hasToken,
|
|
124
|
+
authMethod,
|
|
125
|
+
hasValidToken: hasToken
|
|
126
|
+
};
|
|
127
|
+
} catch (error) {
|
|
128
|
+
console.error('❌ Error getting auth state:', error);
|
|
129
|
+
return {
|
|
130
|
+
isAuthenticated: false,
|
|
131
|
+
authMethod: null,
|
|
132
|
+
hasValidToken: false
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Clear all user data (for logout)
|
|
139
|
+
*/
|
|
140
|
+
exports.getAuthState = getAuthState;
|
|
141
|
+
const clearUserData = async () => {
|
|
142
|
+
try {
|
|
143
|
+
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,
|
|
144
|
+
// Clear the new onboarding completion tokens
|
|
145
|
+
STORAGE_KEYS.ONBOARDING_COMPLETE_TOKEN, STORAGE_KEYS.EVENT_ACCESS_TOKEN];
|
|
146
|
+
await _asyncStorage.default.multiRemove(keysToRemove);
|
|
147
|
+
|
|
148
|
+
// Also clear biometrically stored PIN
|
|
149
|
+
try {
|
|
150
|
+
await (0, _pinStorageUtils.clearStoredPin)();
|
|
151
|
+
console.log('✅ Biometrically stored PIN cleared');
|
|
152
|
+
} catch (error) {
|
|
153
|
+
console.warn('⚠️ Error clearing stored PIN (continuing):', error);
|
|
154
|
+
}
|
|
155
|
+
console.log('✅ User data cleared including onboarding completion tokens');
|
|
156
|
+
} catch (error) {
|
|
157
|
+
console.error('❌ Error clearing user data:', error);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Get resume navigation target based on user progress
|
|
163
|
+
*/
|
|
164
|
+
exports.clearUserData = clearUserData;
|
|
165
|
+
const getResumeTarget = async () => {
|
|
166
|
+
try {
|
|
167
|
+
const progress = await getUserProgress();
|
|
168
|
+
const authState = await getAuthState();
|
|
169
|
+
|
|
170
|
+
// HIGHEST PRIORITY: Check event access token first (regardless of auth state)
|
|
171
|
+
// This ensures release mode reliability when network auth fails
|
|
172
|
+
const hasEventToken = await hasEventAccessToken();
|
|
173
|
+
if (hasEventToken || progress.hasReachedEventPage && progress.hasViewedResults) {
|
|
174
|
+
console.log('🎯 User has completed onboarding (verified by token) - returning to Home screen');
|
|
175
|
+
|
|
176
|
+
// After completing first event, users go to Home screen instead of Results
|
|
177
|
+
// This provides a better post-event experience and central hub
|
|
178
|
+
return {
|
|
179
|
+
screen: 'Home'
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// If not authenticated, start from Welcome
|
|
184
|
+
if (!authState.isAuthenticated) {
|
|
185
|
+
return {
|
|
186
|
+
screen: 'Welcome'
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// If authenticated but no progress, start camera flow
|
|
191
|
+
if (progress.completedSteps.length === 0) {
|
|
192
|
+
return {
|
|
193
|
+
screen: 'Welcome',
|
|
194
|
+
params: {
|
|
195
|
+
isNewUser: true,
|
|
196
|
+
activateCamera: true
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Resume based on last completed step for users still in onboarding
|
|
202
|
+
if (!progress.hasProfilePhoto) {
|
|
203
|
+
return {
|
|
204
|
+
screen: 'Welcome',
|
|
205
|
+
params: {
|
|
206
|
+
isNewUser: true,
|
|
207
|
+
activateCamera: true
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
if (!progress.hasCompletedProfile) {
|
|
212
|
+
const profileImage = await _asyncStorage.default.getItem(STORAGE_KEYS.PROFILE_IMAGE);
|
|
213
|
+
return {
|
|
214
|
+
screen: 'CreateFreshProfile',
|
|
215
|
+
params: {
|
|
216
|
+
photo: profileImage,
|
|
217
|
+
isReviewerBypass: authState.authMethod === 'onairos'
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
if (!progress.hasSelectedIntentions) {
|
|
222
|
+
const userProfile = await _asyncStorage.default.getItem(STORAGE_KEYS.USER_PROFILE);
|
|
223
|
+
return {
|
|
224
|
+
screen: 'Intention',
|
|
225
|
+
params: {
|
|
226
|
+
userProfile: userProfile ? JSON.parse(userProfile) : null
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Default to Results if everything is complete
|
|
232
|
+
const userProfile = await _asyncStorage.default.getItem(STORAGE_KEYS.USER_PROFILE);
|
|
233
|
+
return {
|
|
234
|
+
screen: 'Results',
|
|
235
|
+
params: {
|
|
236
|
+
userProfile: userProfile ? JSON.parse(userProfile) : null
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
} catch (error) {
|
|
240
|
+
console.error('❌ Error determining resume target:', error);
|
|
241
|
+
return {
|
|
242
|
+
screen: 'Welcome'
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Check if user has completed onboarding flow
|
|
249
|
+
*/
|
|
250
|
+
exports.getResumeTarget = getResumeTarget;
|
|
251
|
+
const hasCompletedOnboarding = async () => {
|
|
252
|
+
try {
|
|
253
|
+
const progress = await getUserProgress();
|
|
254
|
+
return progress.hasCompletedProfile && progress.hasViewedResults;
|
|
255
|
+
} catch (error) {
|
|
256
|
+
console.error('❌ Error checking onboarding status:', error);
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Mark user as having reached the event page (completed full onboarding)
|
|
263
|
+
* This creates the token that ensures they always return to Results
|
|
264
|
+
*/
|
|
265
|
+
exports.hasCompletedOnboarding = hasCompletedOnboarding;
|
|
266
|
+
const markEventPageReached = async eventData => {
|
|
267
|
+
try {
|
|
268
|
+
const progress = await getUserProgress();
|
|
269
|
+
const updatedProgress = {
|
|
270
|
+
...progress,
|
|
271
|
+
hasReachedEventPage: true,
|
|
272
|
+
hasViewedResults: true,
|
|
273
|
+
eventData: eventData || progress.eventData,
|
|
274
|
+
timestamp: Date.now()
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
// Save the updated progress
|
|
278
|
+
await saveUserProgress(updatedProgress);
|
|
279
|
+
|
|
280
|
+
// Save the onboarding completion token for extra security
|
|
281
|
+
await _asyncStorage.default.setItem(STORAGE_KEYS.ONBOARDING_COMPLETE_TOKEN, 'true');
|
|
282
|
+
await _asyncStorage.default.setItem(STORAGE_KEYS.EVENT_ACCESS_TOKEN, JSON.stringify({
|
|
283
|
+
timestamp: Date.now(),
|
|
284
|
+
eventData: eventData,
|
|
285
|
+
hasAccess: true
|
|
286
|
+
}));
|
|
287
|
+
console.log('✅ User marked as having reached event page - will always return to Results');
|
|
288
|
+
} catch (error) {
|
|
289
|
+
console.error('❌ Error marking event page reached:', error);
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Check if user has the event access token (completed onboarding)
|
|
295
|
+
*/
|
|
296
|
+
exports.markEventPageReached = markEventPageReached;
|
|
297
|
+
const hasEventAccessToken = async () => {
|
|
298
|
+
try {
|
|
299
|
+
const token = await _asyncStorage.default.getItem(STORAGE_KEYS.ONBOARDING_COMPLETE_TOKEN);
|
|
300
|
+
const progress = await getUserProgress();
|
|
301
|
+
return token === 'true' && progress.hasReachedEventPage;
|
|
302
|
+
} catch (error) {
|
|
303
|
+
console.error('❌ Error checking event access token:', error);
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Mark a step as completed
|
|
310
|
+
*/
|
|
311
|
+
exports.hasEventAccessToken = hasEventAccessToken;
|
|
312
|
+
const markStepCompleted = async step => {
|
|
313
|
+
try {
|
|
314
|
+
const progress = await getUserProgress();
|
|
315
|
+
if (!progress.completedSteps.includes(step)) {
|
|
316
|
+
progress.completedSteps.push(step);
|
|
317
|
+
await saveUserProgress(progress);
|
|
318
|
+
}
|
|
319
|
+
} catch (error) {
|
|
320
|
+
console.error('❌ Error marking step completed:', error);
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Update user's last screen
|
|
326
|
+
*/
|
|
327
|
+
exports.markStepCompleted = markStepCompleted;
|
|
328
|
+
const updateLastScreen = async (screen, params) => {
|
|
329
|
+
try {
|
|
330
|
+
await saveUserProgress({
|
|
331
|
+
lastScreen: screen,
|
|
332
|
+
timestamp: Date.now()
|
|
333
|
+
});
|
|
334
|
+
} catch (error) {
|
|
335
|
+
console.error('❌ Error updating last screen:', error);
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Check if this is a returning user with existing progress
|
|
341
|
+
*/
|
|
342
|
+
exports.updateLastScreen = updateLastScreen;
|
|
343
|
+
const isReturningUser = async () => {
|
|
344
|
+
try {
|
|
345
|
+
const progress = await getUserProgress();
|
|
346
|
+
const authState = await getAuthState();
|
|
347
|
+
return authState.isAuthenticated && progress.completedSteps.length > 0;
|
|
348
|
+
} catch (error) {
|
|
349
|
+
console.error('❌ Error checking returning user status:', error);
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Mark app as active (call this when app becomes active)
|
|
356
|
+
*/
|
|
357
|
+
exports.isReturningUser = isReturningUser;
|
|
358
|
+
const markAppActive = async () => {
|
|
359
|
+
try {
|
|
360
|
+
await saveUserProgress({
|
|
361
|
+
timestamp: Date.now()
|
|
362
|
+
});
|
|
363
|
+
console.log('✅ App marked as active');
|
|
364
|
+
} catch (error) {
|
|
365
|
+
console.error('❌ Error marking app as active:', error);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Development utility: Get all stored progress data for debugging
|
|
371
|
+
*/
|
|
372
|
+
exports.markAppActive = markAppActive;
|
|
373
|
+
const getDebugStorageInfo = async () => {
|
|
374
|
+
try {
|
|
375
|
+
const progress = await getUserProgress();
|
|
376
|
+
const authState = await getAuthState();
|
|
377
|
+
const isReturning = await isReturningUser();
|
|
378
|
+
const resumeTarget = await getResumeTarget();
|
|
379
|
+
return {
|
|
380
|
+
progress,
|
|
381
|
+
authState,
|
|
382
|
+
isReturning,
|
|
383
|
+
resumeTarget
|
|
384
|
+
};
|
|
385
|
+
} catch (error) {
|
|
386
|
+
console.error('❌ Error getting debug storage info:', error);
|
|
387
|
+
throw error;
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Development utility: Clear all progress (for testing)
|
|
393
|
+
*/
|
|
394
|
+
exports.getDebugStorageInfo = getDebugStorageInfo;
|
|
395
|
+
const clearAllProgress = async () => {
|
|
396
|
+
try {
|
|
397
|
+
await clearUserData();
|
|
398
|
+
console.log('✅ All progress data cleared');
|
|
399
|
+
} catch (error) {
|
|
400
|
+
console.error('❌ Error clearing progress data:', error);
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
exports.clearAllProgress = clearAllProgress;
|
|
404
|
+
//# sourceMappingURL=storageService.js.map
|
|
@@ -1,8 +1,115 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useTelegramDataExtractor = void 0;
|
|
7
|
+
var _telegramDataService = require("./telegramDataService");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
/**
|
|
10
|
+
* Telegram Data Extractor
|
|
11
|
+
*
|
|
12
|
+
* Orchestrates the Telegram data export flow:
|
|
13
|
+
* 1. Receives extracted dialogs/messages from WebView
|
|
14
|
+
* 2. Validates and formats data
|
|
15
|
+
* 3. Sends to backend via telegramDataService
|
|
16
|
+
*
|
|
17
|
+
* This acts as the bridge between OAuthWebView and the backend API.
|
|
18
|
+
*
|
|
19
|
+
* @reference ChatGPT implementation: src/services/chatGPTConversationExtractor.ts
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Combined Telegram export data from WebView
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Hook for Telegram data extraction operations
|
|
28
|
+
*/
|
|
29
|
+
const useTelegramDataExtractor = () => {
|
|
30
|
+
/**
|
|
31
|
+
* Initiate data export to backend
|
|
32
|
+
*
|
|
33
|
+
* @param username - User identifier
|
|
34
|
+
* @param data - Extracted Telegram data (dialogs and messages)
|
|
35
|
+
* @returns true if successful, false otherwise
|
|
36
|
+
*/
|
|
37
|
+
const initiateDataExport = async (username, data) => {
|
|
38
|
+
var _data$summary, _data$summary2, _data$dialogs, _data$messages, _data$dialogs2, _data$messages2;
|
|
39
|
+
console.log('🚀 [TELEGRAM_EXTRACTOR] Initiating data export');
|
|
40
|
+
console.log('👤 [TELEGRAM_EXTRACTOR] Username:', username);
|
|
41
|
+
console.log('📊 [TELEGRAM_EXTRACTOR] Dialogs:', (_data$summary = data.summary) === null || _data$summary === void 0 ? void 0 : _data$summary.dialogCount);
|
|
42
|
+
console.log('📊 [TELEGRAM_EXTRACTOR] Messages:', (_data$summary2 = data.summary) === null || _data$summary2 === void 0 ? void 0 : _data$summary2.messageCount);
|
|
43
|
+
|
|
44
|
+
// Validation
|
|
45
|
+
if (!username) {
|
|
46
|
+
console.error('❌ [TELEGRAM_EXTRACTOR] Username is required');
|
|
47
|
+
_reactNative.Alert.alert('Error', 'Username is required to export Telegram data.', [{
|
|
48
|
+
text: 'OK',
|
|
49
|
+
style: 'default'
|
|
50
|
+
}]);
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Handle empty data as success - user might have no recent messages
|
|
55
|
+
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);
|
|
56
|
+
if (totalItems === 0) {
|
|
57
|
+
console.log('ℹ️ [TELEGRAM_EXTRACTOR] No data to export - treating as success (connected)');
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Validate dialogs structure
|
|
62
|
+
const validDialogs = (data.dialogs || []).filter(dialog => {
|
|
63
|
+
const isValid = dialog.id && dialog.title;
|
|
64
|
+
if (!isValid) {
|
|
65
|
+
console.warn('⚠️ [TELEGRAM_EXTRACTOR] Invalid dialog:', dialog);
|
|
66
|
+
}
|
|
67
|
+
return isValid;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Validate messages structure
|
|
71
|
+
const validMessages = (data.messages || []).filter(msg => {
|
|
72
|
+
const isValid = msg.id && (msg.text || msg.type);
|
|
73
|
+
if (!isValid) {
|
|
74
|
+
console.warn('⚠️ [TELEGRAM_EXTRACTOR] Invalid message:', msg);
|
|
75
|
+
}
|
|
76
|
+
return isValid;
|
|
77
|
+
});
|
|
78
|
+
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;
|
|
79
|
+
if (filteredOut > 0) {
|
|
80
|
+
console.warn(`⚠️ [TELEGRAM_EXTRACTOR] Filtered out ${filteredOut} invalid items`);
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
console.log('📡 [TELEGRAM_EXTRACTOR] Sending to backend...');
|
|
84
|
+
const result = await (0, _telegramDataService.storeTelegramData)(username, {
|
|
85
|
+
dialogs: validDialogs,
|
|
86
|
+
messages: validMessages,
|
|
87
|
+
userId: data.userId
|
|
88
|
+
});
|
|
89
|
+
if (result.success) {
|
|
90
|
+
console.log('✅ [TELEGRAM_EXTRACTOR] Export completed successfully');
|
|
91
|
+
console.log('📊 [TELEGRAM_EXTRACTOR] Backend response:', result.data);
|
|
92
|
+
return true;
|
|
93
|
+
} else {
|
|
94
|
+
console.error('❌ [TELEGRAM_EXTRACTOR] Backend storage failed:', result.error);
|
|
95
|
+
_reactNative.Alert.alert('Export Failed', result.error || 'An unknown error occurred during data storage.', [{
|
|
96
|
+
text: 'OK',
|
|
97
|
+
style: 'default'
|
|
98
|
+
}]);
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.error('❌ [TELEGRAM_EXTRACTOR] Unexpected error during export:', error);
|
|
103
|
+
_reactNative.Alert.alert('Export Error', 'Failed to connect to the data storage service. Please check your network connection.', [{
|
|
104
|
+
text: 'OK',
|
|
105
|
+
style: 'default'
|
|
106
|
+
}]);
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
return {
|
|
111
|
+
initiateDataExport
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
exports.useTelegramDataExtractor = useTelegramDataExtractor;
|
|
115
|
+
//# sourceMappingURL=telegramDataExtractor.js.map
|