@onairos/react-native 3.7.1 â 3.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/api/index.js +219 -9
- package/lib/commonjs/assets/icons/spotify.png +0 -0
- package/lib/commonjs/assets/images/spotify.png +0 -0
- package/lib/commonjs/components/BodyText.js +27 -9
- package/lib/commonjs/components/BrandMark.js +111 -10
- package/lib/commonjs/components/CodeInput.js +116 -9
- package/lib/commonjs/components/EmailInput.js +30 -8
- package/lib/commonjs/components/GoogleButton.js +56 -9
- package/lib/commonjs/components/HeadingGroup.js +43 -9
- package/lib/commonjs/components/LLMDataInputModal.js +664 -14
- package/lib/commonjs/components/ModalHeader.js +99 -9
- package/lib/commonjs/components/ModalSheet.js +47 -9
- package/lib/commonjs/components/Onairos.js +380 -14
- package/lib/commonjs/components/OnairosButton.js +313 -13
- package/lib/commonjs/components/OnairosSignInButton.js +130 -12
- package/lib/commonjs/components/Overlay.js +465 -13
- package/lib/commonjs/components/PersonaImage.js +137 -10
- package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
- package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
- package/lib/commonjs/components/PinCreationScreen.js +403 -12
- package/lib/commonjs/components/PinInput.js +464 -9
- package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
- package/lib/commonjs/components/PlatformList.js +137 -10
- package/lib/commonjs/components/PlatformToggle.js +180 -9
- package/lib/commonjs/components/PrimaryButton.js +180 -10
- package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
- package/lib/commonjs/components/SignInStep.js +345 -12
- package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
- package/lib/commonjs/components/VerificationStep.js +176 -11
- package/lib/commonjs/components/WelcomeScreen.js +461 -22
- package/lib/commonjs/components/icons/Basicproficon.js +37 -8
- package/lib/commonjs/components/icons/Basicprofile.js +21 -8
- package/lib/commonjs/components/icons/Checkbox.js +21 -8
- package/lib/commonjs/components/icons/Checkmark.js +27 -8
- package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
- package/lib/commonjs/components/icons/Contenticon.js +39 -8
- package/lib/commonjs/components/icons/EnochE.js +41 -8
- package/lib/commonjs/components/icons/Personalityicon.js +30 -8
- package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
- package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
- package/lib/commonjs/components/icons/Userpreferences.js +21 -8
- package/lib/commonjs/components/icons/index.js +84 -17
- package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
- package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
- package/lib/commonjs/components/onboarding/PinInput.js +283 -10
- package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
- package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
- package/lib/commonjs/config/api.js +56 -7
- package/lib/commonjs/constants/index.js +120 -7
- package/lib/commonjs/context/AuthContext.js +345 -10
- package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
- package/lib/commonjs/hooks/useConnections.js +102 -8
- package/lib/commonjs/hooks/useCredentials.js +178 -10
- package/lib/commonjs/hooks/useUserConnections.js +148 -10
- package/lib/commonjs/index.js +439 -34
- package/lib/commonjs/services/apiClient.js +298 -8
- package/lib/commonjs/services/biometricPinService.js +180 -8
- package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
- package/lib/commonjs/services/chatGPTConversationService.js +275 -9
- package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
- package/lib/commonjs/services/claudeConversationService.js +158 -9
- package/lib/commonjs/services/connectedAccountsService.js +310 -10
- package/lib/commonjs/services/googleAuthService.js +252 -11
- package/lib/commonjs/services/hingeDataExtractor.js +105 -8
- package/lib/commonjs/services/hingeDataService.js +150 -9
- package/lib/commonjs/services/imageCompressionService.js +260 -7
- package/lib/commonjs/services/instagramDataExtractor.js +126 -8
- package/lib/commonjs/services/instagramDataService.js +163 -9
- package/lib/commonjs/services/jwtStorageService.js +276 -7
- package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
- package/lib/commonjs/services/linkedinProfileService.js +222 -9
- package/lib/commonjs/services/linkedinScrapingService.js +230 -8
- package/lib/commonjs/services/llmDataStorage.js +294 -8
- package/lib/commonjs/services/mobileTrainingService.js +186 -8
- package/lib/commonjs/services/netflixDataExtractor.js +120 -8
- package/lib/commonjs/services/netflixDataService.js +198 -9
- package/lib/commonjs/services/pinEncryptionService.js +84 -8
- package/lib/commonjs/services/pinStorageUtils.js +105 -7
- package/lib/commonjs/services/platformAuthService.js +1484 -12
- package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
- package/lib/commonjs/services/sephoraDataService.js +200 -9
- package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
- package/lib/commonjs/services/spotifyDataService.js +241 -9
- package/lib/commonjs/services/storageService.js +404 -8
- package/lib/commonjs/services/telegramDataExtractor.js +115 -8
- package/lib/commonjs/services/telegramDataService.js +499 -9
- package/lib/commonjs/services/trainingApiHelpers.js +73 -7
- package/lib/commonjs/services/userConnectionsService.js +340 -10
- package/lib/commonjs/services/youtubeMigrationService.js +416 -10
- package/lib/commonjs/theme/index.js +250 -7
- package/lib/commonjs/types/ambient.d.js +2 -1
- package/lib/commonjs/types/declarations.d.js +2 -1
- package/lib/commonjs/types/index.js +6 -1
- package/lib/commonjs/types/node-fix.d.js +2 -1
- package/lib/commonjs/types/node-override.d.js +2 -1
- package/lib/commonjs/types/opacity.d.js +2 -1
- package/lib/commonjs/types.js +14 -1
- package/lib/commonjs/utils/Portal.js +98 -8
- package/lib/commonjs/utils/api.js +130 -9
- package/lib/commonjs/utils/assetRegistry.js +210 -35
- package/lib/commonjs/utils/auth.js +112 -9
- package/lib/commonjs/utils/connectorTests.js +613 -29
- package/lib/commonjs/utils/crypto.js +62 -8
- package/lib/commonjs/utils/debugHelper.js +64 -1
- package/lib/commonjs/utils/encryption.js +76 -7
- package/lib/commonjs/utils/eventUtils.js +288 -1
- package/lib/commonjs/utils/haptics.js +66 -9
- package/lib/commonjs/utils/imagePreloader.js +6 -1
- package/lib/commonjs/utils/networkDiagnostics.js +226 -8
- package/lib/commonjs/utils/onairosApi.js +350 -9
- package/lib/commonjs/utils/programmaticFlow.js +117 -9
- package/lib/commonjs/utils/retryHelper.js +220 -1
- package/lib/commonjs/utils/secureStorage.js +349 -10
- package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
- package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
- package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
- package/lib/commonjs/utils/webviewScripts/index.js +698 -15
- package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
- package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
- package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
- package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
- package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
- package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
- package/lib/module/api/index.js +211 -1
- package/lib/module/assets/icons/spotify.png +0 -0
- package/lib/module/assets/images/spotify.png +0 -0
- package/lib/module/components/BodyText.js +20 -1
- package/lib/module/components/BrandMark.js +104 -1
- package/lib/module/components/CodeInput.js +109 -1
- package/lib/module/components/EmailInput.js +23 -1
- package/lib/module/components/GoogleButton.js +49 -1
- package/lib/module/components/HeadingGroup.js +36 -1
- package/lib/module/components/LLMDataInputModal.js +656 -7
- package/lib/module/components/ModalHeader.js +92 -1
- package/lib/module/components/ModalSheet.js +39 -1
- package/lib/module/components/Onairos.js +373 -1
- package/lib/module/components/OnairosButton.js +305 -1
- package/lib/module/components/OnairosSignInButton.js +121 -1
- package/lib/module/components/Overlay.js +456 -1
- package/lib/module/components/PersonaImage.js +129 -1
- package/lib/module/components/PersonaLoadingScreen.js +310 -1
- package/lib/module/components/PersonalizationConsentScreen.js +460 -1
- package/lib/module/components/PinCreationScreen.js +396 -1
- package/lib/module/components/PinInput.js +456 -1
- package/lib/module/components/PlatformConnectorsStep.js +1302 -6
- package/lib/module/components/PlatformList.js +129 -1
- package/lib/module/components/PlatformToggle.js +173 -1
- package/lib/module/components/PrimaryButton.js +172 -1
- package/lib/module/components/SignInMatchAnimation.js +189 -1
- package/lib/module/components/SignInStep.js +338 -1
- package/lib/module/components/UniversalOnboarding.js +2770 -1
- package/lib/module/components/VerificationStep.js +168 -1
- package/lib/module/components/WelcomeScreen.js +453 -1
- package/lib/module/components/icons/Basicproficon.js +30 -1
- package/lib/module/components/icons/Basicprofile.js +14 -1
- package/lib/module/components/icons/Checkbox.js +14 -1
- package/lib/module/components/icons/Checkmark.js +20 -1
- package/lib/module/components/icons/Contentanalysis.js +14 -1
- package/lib/module/components/icons/Contenticon.js +32 -1
- package/lib/module/components/icons/EnochE.js +34 -1
- package/lib/module/components/icons/Personalityicon.js +23 -1
- package/lib/module/components/icons/Personalityprofile.js +14 -1
- package/lib/module/components/icons/Personalitytraits.js +14 -1
- package/lib/module/components/icons/Userpreferences.js +14 -1
- package/lib/module/components/icons/index.js +13 -1
- package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
- package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
- package/lib/module/components/onboarding/PinInput.js +274 -1
- package/lib/module/components/onboarding/PlatformConnector.js +240 -1
- package/lib/module/config/PLATFORM_APIS.md +849 -0
- package/lib/module/config/api.js +47 -1
- package/lib/module/constants/index.js +114 -1
- package/lib/module/context/AuthContext.js +335 -1
- package/lib/module/hooks/useConnectedAccounts.js +106 -1
- package/lib/module/hooks/useConnections.js +95 -1
- package/lib/module/hooks/useCredentials.js +171 -6
- package/lib/module/hooks/useUserConnections.js +140 -1
- package/lib/module/index.js +172 -1
- package/lib/module/services/apiClient.js +295 -1
- package/lib/module/services/biometricPinService.js +169 -1
- package/lib/module/services/chatGPTConversationExtractor.js +149 -1
- package/lib/module/services/chatGPTConversationService.js +268 -1
- package/lib/module/services/claudeConversationExtractor.js +97 -1
- package/lib/module/services/claudeConversationService.js +151 -1
- package/lib/module/services/connectedAccountsService.js +293 -1
- package/lib/module/services/googleAuthService.js +241 -1
- package/lib/module/services/hingeDataExtractor.js +99 -1
- package/lib/module/services/hingeDataService.js +143 -1
- package/lib/module/services/imageCompressionService.js +250 -1
- package/lib/module/services/instagramDataExtractor.js +120 -1
- package/lib/module/services/instagramDataService.js +156 -1
- package/lib/module/services/jwtStorageService.js +257 -1
- package/lib/module/services/linkedinDOMExtractor.js +234 -1
- package/lib/module/services/linkedinProfileService.js +210 -1
- package/lib/module/services/linkedinScrapingService.js +219 -1
- package/lib/module/services/llmDataStorage.js +277 -1
- package/lib/module/services/mobileTrainingService.js +173 -1
- package/lib/module/services/netflixDataExtractor.js +114 -1
- package/lib/module/services/netflixDataService.js +191 -1
- package/lib/module/services/pinEncryptionService.js +74 -6
- package/lib/module/services/pinStorageUtils.js +93 -1
- package/lib/module/services/platformAuthService.js +1461 -1
- package/lib/module/services/sephoraDataExtractor.js +134 -1
- package/lib/module/services/sephoraDataService.js +193 -1
- package/lib/module/services/spotifyDataExtractor.js +142 -1
- package/lib/module/services/spotifyDataService.js +234 -1
- package/lib/module/services/storageService.js +383 -1
- package/lib/module/services/telegramDataExtractor.js +109 -1
- package/lib/module/services/telegramDataService.js +493 -1
- package/lib/module/services/trainingApiHelpers.js +67 -1
- package/lib/module/services/userConnectionsService.js +329 -1
- package/lib/module/services/youtubeMigrationService.js +405 -1
- package/lib/module/theme/index.js +245 -1
- package/lib/module/types.js +10 -1
- package/lib/module/utils/Portal.js +90 -1
- package/lib/module/utils/api.js +118 -1
- package/lib/module/utils/assetRegistry.js +200 -34
- package/lib/module/utils/auth.js +100 -1
- package/lib/module/utils/connectorTests.js +600 -27
- package/lib/module/utils/crypto.js +54 -1
- package/lib/module/utils/debugHelper.js +54 -1
- package/lib/module/utils/encryption.js +67 -1
- package/lib/module/utils/eventUtils.js +270 -1
- package/lib/module/utils/haptics.js +59 -8
- package/lib/module/utils/imagePreloader.js +3 -1
- package/lib/module/utils/networkDiagnostics.js +217 -1
- package/lib/module/utils/onairosApi.js +333 -1
- package/lib/module/utils/programmaticFlow.js +111 -1
- package/lib/module/utils/retryHelper.js +211 -1
- package/lib/module/utils/secureStorage.js +330 -6
- package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
- package/lib/module/utils/webviewScripts/claude.js +370 -1
- package/lib/module/utils/webviewScripts/hinge.js +405 -1
- package/lib/module/utils/webviewScripts/index.js +434 -1
- package/lib/module/utils/webviewScripts/instagram.js +448 -1
- package/lib/module/utils/webviewScripts/linkedin.js +874 -1
- package/lib/module/utils/webviewScripts/netflix.js +376 -1
- package/lib/module/utils/webviewScripts/sephora.js +510 -1
- package/lib/module/utils/webviewScripts/spotify.js +413 -1
- package/lib/module/utils/webviewScripts/telegram.js +672 -1
- package/package.json +2 -2
|
@@ -1,8 +1,404 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object['defineProperty'](exports,_0x15a1(0x0),{'value':!![]}),exports[_0x15a1(0x1)]=exports[_0x15a1(0x2)]=exports[_0x15a1(0x3)]=exports['markStepCompleted']=exports[_0x15a1(0x4)]=exports[_0x15a1(0x5)]=exports[_0x15a1(0x6)]=exports[_0x15a1(0x7)]=exports[_0x15a1(0x8)]=exports[_0x15a1(0x9)]=exports[_0x15a1(0xa)]=exports[_0x15a1(0xb)]=exports[_0x15a1(0xc)]=exports['clearUserData']=exports[_0x15a1(0xd)]=exports[_0x15a1(0xe)]=void 0x0;var _asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x0)),_pinStorageUtils=__ONAIROS_REQ_FUNC__(0x1);function _interopRequireDefault(_0x4ec2f8){return _0x4ec2f8&&_0x4ec2f8['__esModule']?_0x4ec2f8:{'default':_0x4ec2f8};}const STORAGE_KEYS=exports['STORAGE_KEYS']={'AUTH_TOKEN':_0x15a1(0xf),'ONAIROS_JWT_TOKEN':_0x15a1(0x10),'ENOCH_TOKEN':_0x15a1(0x11),'USER':'user','USER_PROFILE':_0x15a1(0x12),'USER_PROFILE_FALLBACK':_0x15a1(0x13),'USER_PROGRESS':_0x15a1(0x14),'ONBOARDING_COMPLETED':_0x15a1(0x15),'IS_FIRST_TIME_USER':_0x15a1(0x16),'USER_ATTENDANCE_CONFIRMED':'userAttendanceConfirmed','ONBOARDING_COMPLETE_TOKEN':_0x15a1(0x17),'EVENT_ACCESS_TOKEN':_0x15a1(0x18),'ONAIROS_USER':_0x15a1(0x19),'APPLE_USER':'apple_user','AUTH_METHOD':'auth_method','CURRENT_EVENT_DATA':_0x15a1(0x1a),'CONNECTED_PLATFORMS':_0x15a1(0x1b),'PROFILE_IMAGE':_0x15a1(0x1c),'USER_ADMIN_STATUS':_0x15a1(0x1d)},saveUserProgress=async _0x28cf79=>{const _0x814588={'zAfbM':function(_0x579fe1){return _0x579fe1();}};try{const _0x434f2d=await _0x814588['zAfbM'](getUserProgress),_0x38f5cf={..._0x434f2d,..._0x28cf79,'timestamp':Date[_0x15a1(0x1e)]()};await _asyncStorage[_0x15a1(0x1f)]['setItem'](STORAGE_KEYS['USER_PROGRESS'],JSON[_0x15a1(0x20)](_0x38f5cf)),console['log'](_0x15a1(0x21),_0x38f5cf);}catch(_0x376bfe){console[_0x15a1(0x22)](_0x15a1(0x23),_0x376bfe);}};exports['saveUserProgress']=saveUserProgress;const getUserProgress=async()=>{const _0x46878f={'twbMW':_0x15a1(0x24),'DhZLy':function(_0xbb2b29,_0x1065c0){return _0xbb2b29!==_0x1065c0;},'LDzbc':_0x15a1(0x25),'EVNzu':'â\x20Error\x20getting\x20user\x20progress:','PbRPn':'Welcome'};try{if(_0x46878f[_0x15a1(0x26)](_0x15a1(0x25),_0x46878f['LDzbc']))_0x3455b0[_0x15a1(0x22)](_0x46878f['twbMW'],_0x310c52);else{const _0x5e0a5f=await _asyncStorage['default'][_0x15a1(0x27)](STORAGE_KEYS[_0x15a1(0x28)]);if(_0x5e0a5f)return JSON[_0x15a1(0x29)](_0x5e0a5f);}}catch(_0x3c08de){console[_0x15a1(0x22)](_0x46878f[_0x15a1(0x2a)],_0x3c08de);}return{'lastScreen':_0x46878f[_0x15a1(0x2b)],'completedSteps':[],'authMethod':null,'hasProfilePhoto':![],'hasCompletedProfile':![],'hasSelectedIntentions':![],'hasViewedResults':![],'hasEnteredEventCode':![],'hasRegisteredForEvent':![],'hasReachedEventPage':![],'timestamp':Date[_0x15a1(0x1e)]()};};exports[_0x15a1(0x9)]=getUserProgress;const saveAuthState=async _0x28915a=>{const _0x389b0c={'kHdHf':'â\x20Error\x20saving\x20user\x20progress:','awmgU':function(_0x586a92){return _0x586a92();},'wyQCE':_0x15a1(0x2c),'blmtt':_0x15a1(0x2d),'ovNXA':_0x15a1(0x2e)};try{const _0xc4cc87=await _0x389b0c[_0x15a1(0x2f)](getAuthState),_0x246f01={..._0xc4cc87,..._0x28915a};_0x28915a[_0x15a1(0x30)]&&(_0x15a1(0x2c)===_0x389b0c[_0x15a1(0x31)]?await _asyncStorage[_0x15a1(0x1f)][_0x15a1(0x32)](STORAGE_KEYS[_0x15a1(0x33)],_0x28915a['authMethod']):_0x3f8795[_0x15a1(0x22)](_0x15a1(0x34),_0x148332)),console['log'](_0x15a1(0x35),_0x246f01);}catch(_0x4911a1){_0x389b0c[_0x15a1(0x36)]===_0x389b0c[_0x15a1(0x36)]?console['error'](_0x389b0c[_0x15a1(0x37)],_0x4911a1):_0x69563b['error'](_0x389b0c[_0x15a1(0x38)],_0x47ad7e);}};exports[_0x15a1(0x3)]=saveAuthState;const getAuthState=async()=>{const _0x1e2d1c={'kJbkz':_0x15a1(0x39)};try{const _0x381dee=await _asyncStorage[_0x15a1(0x1f)][_0x15a1(0x27)](STORAGE_KEYS['AUTH_METHOD']),_0x5beec4=!!await _asyncStorage['default'][_0x15a1(0x27)](STORAGE_KEYS[_0x15a1(0x3a)]);return{'isAuthenticated':_0x5beec4,'authMethod':_0x381dee,'hasValidToken':_0x5beec4};}catch(_0x8f81fd){return console[_0x15a1(0x22)](_0x1e2d1c[_0x15a1(0x3b)],_0x8f81fd),{'isAuthenticated':![],'authMethod':null,'hasValidToken':![]};}};exports[_0x15a1(0xc)]=getAuthState;const clearUserData=async()=>{const _0x36462b={'LczhM':_0x15a1(0x3c),'Ommzi':'â\x20Error\x20checking\x20returning\x20user\x20status:','XMrki':_0x15a1(0x3d),'EPQcz':function(_0x427a93,_0x261bb7){return _0x427a93===_0x261bb7;},'ZmhLo':_0x15a1(0x3e),'cHpyQ':function(_0x1b57b5,_0x347d23){return _0x1b57b5!==_0x347d23;},'UJnTg':_0x15a1(0x3f),'MosYR':_0x15a1(0x40),'kDlPm':_0x15a1(0x41),'rFKRL':'VJkJY'};try{if(_0x36462b[_0x15a1(0x42)](_0x36462b[_0x15a1(0x43)],_0x36462b[_0x15a1(0x43)])){const _0x51b92b=[STORAGE_KEYS[_0x15a1(0x44)],STORAGE_KEYS[_0x15a1(0x45)],STORAGE_KEYS[_0x15a1(0x46)],STORAGE_KEYS[_0x15a1(0x28)],STORAGE_KEYS['AUTH_TOKEN'],STORAGE_KEYS[_0x15a1(0x47)],STORAGE_KEYS[_0x15a1(0x48)],STORAGE_KEYS[_0x15a1(0x49)],STORAGE_KEYS[_0x15a1(0x4a)],STORAGE_KEYS[_0x15a1(0x33)],STORAGE_KEYS[_0x15a1(0x4b)],STORAGE_KEYS[_0x15a1(0x4c)],STORAGE_KEYS[_0x15a1(0x4d)],STORAGE_KEYS[_0x15a1(0x4e)],STORAGE_KEYS[_0x15a1(0x4f)],STORAGE_KEYS[_0x15a1(0x50)]];await _asyncStorage[_0x15a1(0x1f)][_0x15a1(0x51)](_0x51b92b);try{_0x36462b[_0x15a1(0x52)](_0x36462b['UJnTg'],_0x36462b[_0x15a1(0x53)])?(await(0x0,_pinStorageUtils[_0x15a1(0x54)])(),console['log'](_0x36462b[_0x15a1(0x55)])):_0x5d73e8[_0x15a1(0x22)](_0x36462b[_0x15a1(0x56)],_0x56ecdf);}catch(_0x27689b){if(_0x36462b[_0x15a1(0x57)]!==_0x36462b[_0x15a1(0x57)])return _0x2af337[_0x15a1(0x22)](_0x36462b[_0x15a1(0x58)],_0x31ec6f),![];else console[_0x15a1(0x59)](_0x15a1(0x5a),_0x27689b);}console[_0x15a1(0x5b)](_0x15a1(0x5c));}else return{'screen':_0x36462b['XMrki'],'params':{'isNewUser':!![],'activateCamera':!![]}};}catch(_0x2713c3){console[_0x15a1(0x22)](_0x15a1(0x34),_0x2713c3);}};function _0x15a1(_0x5814b1,_0x15a1e3){_0x5814b1=_0x5814b1-0x0;const _0x378bc8=_0x5814();let _0x4be186=_0x378bc8[_0x5814b1];return _0x4be186;}exports['clearUserData']=clearUserData;const getResumeTarget=async()=>{const _0x40970c={'dWffm':'â\x20Error\x20getting\x20debug\x20storage\x20info:','eBVxx':_0x15a1(0x5d),'BMRhI':_0x15a1(0x5e),'BZosQ':function(_0x3f0d34){return _0x3f0d34();},'zWAnd':'đ¯\x20User\x20has\x20completed\x20onboarding\x20(verified\x20by\x20token)\x20-\x20returning\x20to\x20Home\x20screen','zMxLa':'Home','UJQMX':function(_0x3c5d4c,_0x1a2d7f){return _0x3c5d4c===_0x1a2d7f;},'gxYJx':'BJRjz','lyYvb':_0x15a1(0x3d),'mNSdk':function(_0x4c3eb5,_0x1ffc0f){return _0x4c3eb5===_0x1ffc0f;},'kwaMV':'poLcW','LTXvL':_0x15a1(0x5f),'efvZa':_0x15a1(0x60),'IFqiD':function(_0x5c0432,_0x3c4f38){return _0x5c0432!==_0x3c4f38;}};try{const _0x5b54e3=await _0x40970c[_0x15a1(0x61)](getUserProgress),_0x4aba03=await _0x40970c[_0x15a1(0x61)](getAuthState),_0x33a4d3=await hasEventAccessToken();if(_0x33a4d3||_0x5b54e3[_0x15a1(0x62)]&&_0x5b54e3[_0x15a1(0x63)])return console['log'](_0x40970c[_0x15a1(0x64)]),{'screen':_0x40970c[_0x15a1(0x65)]};if(!_0x4aba03[_0x15a1(0x66)]){if(_0x40970c[_0x15a1(0x67)](_0x40970c[_0x15a1(0x68)],_0x15a1(0x69))){_0x271832['error'](_0x40970c[_0x15a1(0x6a)],_0x44cdc8);throw _0x41d096;}else return{'screen':_0x40970c[_0x15a1(0x6b)]};}if(_0x40970c['mNSdk'](_0x5b54e3[_0x15a1(0x6c)][_0x15a1(0x6d)],0x0))return{'screen':_0x40970c[_0x15a1(0x6b)],'params':{'isNewUser':!![],'activateCamera':!![]}};if(!_0x5b54e3[_0x15a1(0x6e)]){if(_0x40970c[_0x15a1(0x67)](_0x40970c[_0x15a1(0x6f)],_0x40970c[_0x15a1(0x6f)]))return{'screen':'Welcome','params':{'isNewUser':!![],'activateCamera':!![]}};else _0x321503[_0x15a1(0x22)](_0x40970c[_0x15a1(0x70)],_0x34ae6a);}if(!_0x5b54e3[_0x15a1(0x71)]){const _0x324122=await _asyncStorage[_0x15a1(0x1f)]['getItem'](STORAGE_KEYS[_0x15a1(0x4d)]);return{'screen':_0x15a1(0x72),'params':{'photo':_0x324122,'isReviewerBypass':_0x40970c['UJQMX'](_0x4aba03[_0x15a1(0x30)],_0x40970c['LTXvL'])}};}if(!_0x5b54e3[_0x15a1(0x73)]){const _0x481b6d=await _asyncStorage[_0x15a1(0x1f)][_0x15a1(0x27)](STORAGE_KEYS['USER_PROFILE']);return{'screen':_0x40970c[_0x15a1(0x74)],'params':{'userProfile':_0x481b6d?JSON['parse'](_0x481b6d):null}};}const _0x20567d=await _asyncStorage[_0x15a1(0x1f)][_0x15a1(0x27)](STORAGE_KEYS['USER_PROFILE']);return{'screen':_0x15a1(0x75),'params':{'userProfile':_0x20567d?JSON[_0x15a1(0x29)](_0x20567d):null}};}catch(_0x681318){if(_0x40970c[_0x15a1(0x76)](_0x15a1(0x77),_0x15a1(0x78)))return console[_0x15a1(0x22)](_0x15a1(0x79),_0x681318),{'screen':'Welcome'};else _0x3e761d[_0x15a1(0x22)](_0x40970c[_0x15a1(0x7a)],_0x27ce91);}};exports['getResumeTarget']=getResumeTarget;const hasCompletedOnboarding=async()=>{const _0x5c3a94={'HorAR':'VsMox','uwLeY':_0x15a1(0x7b),'YExMb':function(_0x4152c7){return _0x4152c7();},'aaZcU':_0x15a1(0x7c)};try{if(_0x5c3a94[_0x15a1(0x7d)]===_0x5c3a94[_0x15a1(0x7e)])return _0x53dd0b[_0x15a1(0x22)](_0x15a1(0x7c),_0x5a2da1),![];else{const _0x5f136c=await _0x5c3a94['YExMb'](getUserProgress);return _0x5f136c[_0x15a1(0x71)]&&_0x5f136c[_0x15a1(0x63)];}}catch(_0x972a43){return console[_0x15a1(0x22)](_0x5c3a94[_0x15a1(0x7f)],_0x972a43),![];}};function _0x5814(){const _0x35a531=['__esModule','updateLastScreen','saveUserProgress','saveAuthState','markEventPageReached','markAppActive','isReturningUser','hasEventAccessToken','hasCompletedOnboarding','getUserProgress','getResumeTarget','getDebugStorageInfo','getAuthState','clearAllProgress','STORAGE_KEYS','auth_token','onairos_jwt_token','enoch_token','userProfile','userProfileFallback','user_progress','onboardingCompleted','isFirstTimeUser','onboarding_complete_token','event_access_token','onairos_user','currentEventData','connectedPlatforms','profileImage','user_admin_status','now','default','stringify','â
\x20User\x20progress\x20saved:','error','â\x20Error\x20saving\x20user\x20progress:','â\x20Error\x20updating\x20last\x20screen:','uFfWy','DhZLy','getItem','USER_PROGRESS','parse','EVNzu','PbRPn','zLIpL','wIvpK','â\x20Error\x20saving\x20auth\x20state:','awmgU','authMethod','wyQCE','setItem','AUTH_METHOD','â\x20Error\x20clearing\x20user\x20data:','â
\x20Auth\x20state\x20saved:','blmtt','ovNXA','kHdHf','â\x20Error\x20getting\x20auth\x20state:','AUTH_TOKEN','kJbkz','â\x20Error\x20marking\x20app\x20as\x20active:','Welcome','ryRAV','sRtne','WbhkV','â
\x20Biometrically\x20stored\x20PIN\x20cleared','EPQcz','ZmhLo','USER','USER_PROFILE','USER_PROFILE_FALLBACK','ONAIROS_JWT_TOKEN','ENOCH_TOKEN','ONAIROS_USER','APPLE_USER','IS_FIRST_TIME_USER','USER_ATTENDANCE_CONFIRMED','PROFILE_IMAGE','ONBOARDING_COMPLETED','ONBOARDING_COMPLETE_TOKEN','EVENT_ACCESS_TOKEN','multiRemove','cHpyQ','MosYR','clearStoredPin','kDlPm','LczhM','rFKRL','Ommzi','warn','â ī¸\x20Error\x20clearing\x20stored\x20PIN\x20(continuing):','log','â
\x20User\x20data\x20cleared\x20including\x20onboarding\x20completion\x20tokens','â\x20Error\x20marking\x20event\x20page\x20reached:','â\x20Error\x20clearing\x20progress\x20data:','onairos','Intention','BZosQ','hasReachedEventPage','hasViewedResults','zWAnd','zMxLa','isAuthenticated','UJQMX','gxYJx','bXaGb','dWffm','lyYvb','completedSteps','length','hasProfilePhoto','kwaMV','eBVxx','hasCompletedProfile','CreateFreshProfile','hasSelectedIntentions','efvZa','Results','IFqiD','rUDCV','CwzqM','â\x20Error\x20determining\x20resume\x20target:','BMRhI','pKhpz','â\x20Error\x20checking\x20onboarding\x20status:','HorAR','uwLeY','aaZcU','â
\x20User\x20marked\x20as\x20having\x20reached\x20event\x20page\x20-\x20will\x20always\x20return\x20to\x20Results','JtdtS','eventData','VbdaL','XlLVa','cVCeX','TLEHQ','vzofK','true','cXhsX','â\x20Error\x20checking\x20event\x20access\x20token:','ryero','CaHFM','VsBZH','yHpTS','ZSvjm','faeJv','fQnGV','lipkd','â\x20Error\x20marking\x20step\x20completed:','includes','push','MEjsK','yeJnC','utzhq','cFGcH','GaCoJ','TpXQS','markStepCompleted','lscrf','gBEhc','IDwVL','tAHBh','kIRLs','rYDew','â\x20Error\x20checking\x20returning\x20user\x20status:','Qumuv','qjsFF','â\x20Error\x20getting\x20debug\x20storage\x20info:','gDXJO','LzzFy','xSVdR','isqyf','RWdMH','EOtgg','dCdsq'];_0x5814=function(){return _0x35a531;};return _0x5814();}exports[_0x15a1(0x8)]=hasCompletedOnboarding;const markEventPageReached=async _0x58dffa=>{const _0x235ad3={'JtdtS':function(_0x577bf5){return _0x577bf5();},'VbdaL':function(_0x132e35,_0x2b4526){return _0x132e35(_0x2b4526);},'XlLVa':'true','cVCeX':_0x15a1(0x80),'TLEHQ':_0x15a1(0x5d)};try{const _0x2f100a=await _0x235ad3[_0x15a1(0x81)](getUserProgress),_0x9186c0={..._0x2f100a,'hasReachedEventPage':!![],'hasViewedResults':!![],'eventData':_0x58dffa||_0x2f100a[_0x15a1(0x82)],'timestamp':Date[_0x15a1(0x1e)]()};await _0x235ad3[_0x15a1(0x83)](saveUserProgress,_0x9186c0),await _asyncStorage[_0x15a1(0x1f)][_0x15a1(0x32)](STORAGE_KEYS[_0x15a1(0x4f)],_0x235ad3[_0x15a1(0x84)]),await _asyncStorage[_0x15a1(0x1f)][_0x15a1(0x32)](STORAGE_KEYS[_0x15a1(0x50)],JSON[_0x15a1(0x20)]({'timestamp':Date['now'](),'eventData':_0x58dffa,'hasAccess':!![]})),console[_0x15a1(0x5b)](_0x235ad3[_0x15a1(0x85)]);}catch(_0x349dfe){console[_0x15a1(0x22)](_0x235ad3[_0x15a1(0x86)],_0x349dfe);}};exports[_0x15a1(0x4)]=markEventPageReached;const hasEventAccessToken=async()=>{const _0x5f4afe={'VsBZH':_0x15a1(0x39),'fQnGV':_0x15a1(0x2e),'ryero':function(_0x5c9dee,_0x319597){return _0x5c9dee!==_0x319597;},'CaHFM':_0x15a1(0x87),'yHpTS':function(_0x3f9876){return _0x3f9876();},'DRQKf':function(_0x3460cc,_0xcb9162){return _0x3460cc===_0xcb9162;},'ZSvjm':_0x15a1(0x88),'faeJv':_0x15a1(0x89),'lipkd':_0x15a1(0x8a)};try{if(_0x5f4afe[_0x15a1(0x8b)](_0x15a1(0x87),_0x5f4afe[_0x15a1(0x8c)]))return _0x10029d[_0x15a1(0x22)](_0x5f4afe[_0x15a1(0x8d)],_0x250931),{'isAuthenticated':![],'authMethod':null,'hasValidToken':![]};else{const _0x2b258c=await _asyncStorage[_0x15a1(0x1f)]['getItem'](STORAGE_KEYS[_0x15a1(0x4f)]),_0x1f9be9=await _0x5f4afe[_0x15a1(0x8e)](getUserProgress);return _0x5f4afe['DRQKf'](_0x2b258c,_0x5f4afe[_0x15a1(0x8f)])&&_0x1f9be9[_0x15a1(0x62)];}}catch(_0xbf90ae){if(_0x5f4afe[_0x15a1(0x8b)](_0x15a1(0x89),_0x5f4afe[_0x15a1(0x90)]))_0x2d9b25[_0x15a1(0x22)](_0x5f4afe[_0x15a1(0x91)],_0x1f8c1e);else return console[_0x15a1(0x22)](_0x5f4afe[_0x15a1(0x92)],_0xbf90ae),![];}};exports['hasEventAccessToken']=hasEventAccessToken;const markStepCompleted=async _0x2d5213=>{const _0x451055={'GaCoJ':'â\x20Error\x20determining\x20resume\x20target:','TpXQS':'Welcome','MEjsK':function(_0x1d8f04,_0x348193){return _0x1d8f04(_0x348193);},'aqmsM':function(_0x58c239,_0x54b9f4){return _0x58c239!==_0x54b9f4;},'yeJnC':'RRVPs','cFGcH':_0x15a1(0x93)};try{const _0x5784eb=await getUserProgress();!_0x5784eb['completedSteps'][_0x15a1(0x94)](_0x2d5213)&&(_0x5784eb[_0x15a1(0x6c)][_0x15a1(0x95)](_0x2d5213),await _0x451055[_0x15a1(0x96)](saveUserProgress,_0x5784eb));}catch(_0x5e0209){if(_0x451055['aqmsM'](_0x451055[_0x15a1(0x97)],_0x15a1(0x98)))console[_0x15a1(0x22)](_0x451055[_0x15a1(0x99)],_0x5e0209);else return _0x22489f[_0x15a1(0x22)](_0x451055[_0x15a1(0x9a)],_0x435b0a),{'screen':_0x451055[_0x15a1(0x9b)]};}};exports[_0x15a1(0x9c)]=markStepCompleted;const updateLastScreen=async(_0x2cbb5b,_0x280a23)=>{const _0x40c265={'NWWpL':function(_0x4ff13e,_0xf10d0d){return _0x4ff13e(_0xf10d0d);}};try{await _0x40c265['NWWpL'](saveUserProgress,{'lastScreen':_0x2cbb5b,'timestamp':Date[_0x15a1(0x1e)]()});}catch(_0x431fea){console['error'](_0x15a1(0x24),_0x431fea);}};exports[_0x15a1(0x1)]=updateLastScreen;const isReturningUser=async()=>{const _0x3c42fa={'HDWaH':'â\x20Error\x20checking\x20event\x20access\x20token:','ayshW':_0x15a1(0x93),'IDwVL':function(_0x187277,_0x429671){return _0x187277!==_0x429671;},'iennb':_0x15a1(0x9d),'tAHBh':function(_0x248876){return _0x248876();},'WQloY':function(_0x13c4a6,_0x499384){return _0x13c4a6>_0x499384;},'kIRLs':_0x15a1(0x9e)};try{if(_0x3c42fa[_0x15a1(0x9f)]('lscrf',_0x3c42fa['iennb']))return _0x1d5633['error'](_0x3c42fa['HDWaH'],_0x2ad874),![];else{const _0x3e5c1c=await getUserProgress(),_0x5e3fb1=await _0x3c42fa[_0x15a1(0xa0)](getAuthState);return _0x5e3fb1[_0x15a1(0x66)]&&_0x3c42fa['WQloY'](_0x3e5c1c[_0x15a1(0x6c)][_0x15a1(0x6d)],0x0);}}catch(_0x32f254){if(_0x3c42fa[_0x15a1(0xa1)]===_0x15a1(0xa2))_0x49602c[_0x15a1(0x22)](_0x3c42fa['ayshW'],_0x4d1a67);else return console[_0x15a1(0x22)](_0x15a1(0xa3),_0x32f254),![];}};exports['isReturningUser']=isReturningUser;const markAppActive=async()=>{const _0x4d6179={'tzmTG':function(_0x58d7b5,_0x321623){return _0x58d7b5(_0x321623);},'Qumuv':'â
\x20App\x20marked\x20as\x20active','qjsFF':'â\x20Error\x20marking\x20app\x20as\x20active:'};try{await _0x4d6179['tzmTG'](saveUserProgress,{'timestamp':Date[_0x15a1(0x1e)]()}),console[_0x15a1(0x5b)](_0x4d6179[_0x15a1(0xa4)]);}catch(_0x3974a4){console['error'](_0x4d6179[_0x15a1(0xa5)],_0x3974a4);}};exports[_0x15a1(0x5)]=markAppActive;const getDebugStorageInfo=async()=>{const _0x392056={'gDXJO':function(_0xaebd43){return _0xaebd43();},'LzzFy':function(_0x327bd1){return _0x327bd1();},'xSVdR':function(_0x242de6){return _0x242de6();},'isqyf':'cLpNY','RWdMH':_0x15a1(0xa6)};try{const _0x3c2c6c=await _0x392056['gDXJO'](getUserProgress),_0x3f592d=await _0x392056[_0x15a1(0xa7)](getAuthState),_0x2c5f57=await _0x392056[_0x15a1(0xa8)](isReturningUser),_0x5db072=await _0x392056[_0x15a1(0xa9)](getResumeTarget);return{'progress':_0x3c2c6c,'authState':_0x3f592d,'isReturning':_0x2c5f57,'resumeTarget':_0x5db072};}catch(_0x4f9f2c){if(_0x392056[_0x15a1(0xaa)]==='npMhM')return{'screen':_0x15a1(0x3d),'params':{'isNewUser':!![],'activateCamera':!![]}};else{console[_0x15a1(0x22)](_0x392056[_0x15a1(0xab)],_0x4f9f2c);throw _0x4f9f2c;}}};exports[_0x15a1(0xb)]=getDebugStorageInfo;const clearAllProgress=async()=>{const _0x2e2364={'EOtgg':function(_0x1e9ce6){return _0x1e9ce6();},'dCdsq':'â
\x20All\x20progress\x20data\x20cleared'};try{await _0x2e2364[_0x15a1(0xac)](clearUserData),console[_0x15a1(0x5b)](_0x2e2364[_0x15a1(0xad)]);}catch(_0x476bd7){console['error'](_0x15a1(0x5e),_0x476bd7);}};exports[_0x15a1(0xd)]=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
|