@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,9 +1,241 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Object[_0x1779(0x0)](exports,_0x1779(0x1),{'value':!![]}),exports['storeSpotifyData']=void 0x0;var _api=__ONAIROS_REQ_FUNC__(0x0),_asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x1)),_reactNative=__ONAIROS_REQ_FUNC__(0x2);function _interopRequireDefault(_0x50e93b){return _0x50e93b&&_0x50e93b['__esModule']?_0x50e93b:{'default':_0x50e93b};}function _0x3e1a(){const _0xcafc25=['defineProperty','__esModule','✅\x20[SPOTIFY_SERVICE]\x20Successfully\x20stored\x20Spotify\x20data','🚀\x20[SPOTIFY_SERVICE]\x20Storing\x20Spotify\x20data\x20for:','📊\x20[SPOTIFY_SERVICE]\x20Recently\x20played\x20items:','📊\x20[SPOTIFY_SERVICE]\x20Top\x20artists:','📊\x20[SPOTIFY_SERVICE]\x20Playlists:','📊\x20[SPOTIFY_SERVICE]\x20Saved\x20tracks:','📊\x20[SPOTIFY_SERVICE]\x20Saved\x20albums:','📊\x20[SPOTIFY_SERVICE]\x20Has\x20profile:','onairos_jwt_token','enoch_token','❌\x20[SPOTIFY_SERVICE]\x20No\x20auth\x20token\x20found','🔑\x20[SPOTIFY_SERVICE]\x20Auth\x20token\x20found','webview-api','ios','iPhone','mobile-spotify','streaming','medium_term','📡\x20[SPOTIFY_SERVICE]\x20Sending\x20to\x20backend...','📍\x20[SPOTIFY_SERVICE]\x20URL:','Unknown\x20error','❌\x20[SPOTIFY_SERVICE]\x20Network\x20error:','log','zcGLV','lumMP','xWjrZ','length','📊\x20[SPOTIFY_SERVICE]\x20Top\x20tracks:','HQcox','topItems','tracks','artists','zWcVA','playlists','wVsYo','hhrTi','GtNQG','savedAlbums','FjDuZ','TVSpp','profile','error','❌\x20[SPOTIFY_SERVICE]\x20Invalid\x20input:\x20userId\x20missing','getItem','default','qOBgn','jLzqC','bHpfH','OBCjs','CExZp','YZgTg','Platform','KHRPZ','Android','toISOString','tokenExpiry','jGITK','rYATt','recentlyPlayed','items','map','trackId','album','albumId','duration','playedAt','imageUrl','explicit','popularity','GqlYu','wdgwG','mjWrI','dJzyp','artistId','followers','DUlfx','vCqcV','QjLPl','playlistId','isPublic','savedTracks','name','releaseDate','trackCount','savedAt','userId','displayName','country','subscription','WVAnF','NEOAh','BEjYY','byOXb','dOvVe','TcLbq','jShIK','ggpDN','UNPsF','unknown','maVAA','IoxCh','Rjikr','zQJmV','API_CONFIG','BASE_URL','/platform-data/store','DgAhF','Bearer\x20','OnairosSDK/1.0.0\x20(','stringify','json','TSPdw','message','cqFPm','📝\x20[SPOTIFY_SERVICE]\x20Backend\x20response:\x20','bEDKa','data','warn','⚠️\x20[SPOTIFY_SERVICE]\x20Backend\x20returned\x20status:\x20','⚠️\x20[SPOTIFY_SERVICE]\x20Error:\x20','IhBqD','status','Network\x20error.\x20Please\x20check\x20your\x20connection.','storeSpotifyData'];_0x3e1a=function(){return _0xcafc25;};return _0x3e1a();}function _0x1779(_0x3e1ac5,_0x177945){_0x3e1ac5=_0x3e1ac5-0x0;const _0x4be561=_0x3e1a();let _0x25fb53=_0x4be561[_0x3e1ac5];return _0x25fb53;}const storeSpotifyData=async(_0x531b9c,_0x42ac83)=>{const _0x3179a4={'TSPdw':_0x1779(0x2),'bEDKa':'Spotify\x20data\x20stored\x20successfully','OlZKI':_0x1779(0x3),'AwdQY':_0x1779(0x4),'zcGLV':function(_0x231094,_0x40cd8a){return _0x231094===_0x40cd8a;},'lumMP':function(_0x417612,_0x5e838b){return _0x417612===_0x5e838b;},'xWjrZ':function(_0x1b413e,_0x43e11f){return _0x1b413e===_0x43e11f;},'HQcox':function(_0x381f1d,_0xce75a7){return _0x381f1d===_0xce75a7;},'ddPKS':_0x1779(0x5),'zWcVA':_0x1779(0x6),'wVsYo':_0x1779(0x7),'hhrTi':function(_0x2af231,_0x5d4917){return _0x2af231===_0x5d4917;},'GtNQG':_0x1779(0x8),'FjDuZ':function(_0x44335b,_0x245236){return _0x44335b===_0x245236;},'TVSpp':_0x1779(0x9),'dcBZj':_0x1779(0xa),'qOBgn':_0x1779(0xb),'jLzqC':_0x1779(0xc),'bHpfH':'Authentication\x20token\x20not\x20found.\x20Please\x20log\x20in\x20again.','OBCjs':_0x1779(0xd),'CExZp':_0x1779(0xe),'YZgTg':'1.0.0','ggpDN':function(_0x58b0e1,_0x236979){return _0x58b0e1===_0x236979;},'KHRPZ':_0x1779(0xf),'SPHDd':'17.0','BHdAT':_0x1779(0x10),'jGITK':_0x1779(0x11),'rYATt':_0x1779(0x12),'byOXb':function(_0x1ecf76,_0x5d67d2){return _0x1ecf76===_0x5d67d2;},'BEjYY':function(_0xc2ed62,_0x234124){return _0xc2ed62===_0x234124;},'GqlYu':function(_0x41d1a9,_0x53206f){return _0x41d1a9===_0x53206f;},'wdgwG':function(_0x561ad8,_0x2b3eb4){return _0x561ad8===_0x2b3eb4;},'mjWrI':function(_0x67239a,_0x29ebc3){return _0x67239a===_0x29ebc3;},'dJzyp':function(_0x53709c,_0x338f07){return _0x53709c===_0x338f07;},'DUlfx':function(_0xe56dc4,_0x339c2d){return _0xe56dc4===_0x339c2d;},'vCqcV':function(_0x52eb18,_0x383cbe){return _0x52eb18===_0x383cbe;},'QjLPl':_0x1779(0x13),'IoxCh':function(_0x545a41,_0x34fe80){return _0x545a41===_0x34fe80;},'WVAnF':function(_0x2c6d0a,_0x3c5fda){return _0x2c6d0a===_0x3c5fda;},'NEOAh':function(_0x1a7705,_0x4897a1){return _0x1a7705===_0x4897a1;},'jaRlE':function(_0x35d133,_0x3ad04e){return _0x35d133===_0x3ad04e;},'dOvVe':function(_0x527b50,_0x79d963){return _0x527b50===_0x79d963;},'TcLbq':function(_0x4bdd7d,_0x231cda){return _0x4bdd7d===_0x231cda;},'jShIK':function(_0x27dbbe,_0x5ba70e){return _0x27dbbe===_0x5ba70e;},'UNPsF':function(_0x17507e,_0x3bcd68){return _0x17507e===_0x3bcd68;},'maVAA':function(_0x4bbc19,_0x35f575){return _0x4bbc19===_0x35f575;},'Rjikr':_0x1779(0x14),'zQJmV':_0x1779(0x15),'DgAhF':function(_0x6e0665,_0x54efe2,_0x7ae7d5){return _0x6e0665(_0x54efe2,_0x7ae7d5);},'cqFPm':'xKZXH','IhBqD':_0x1779(0x16),'uEAZg':_0x1779(0x17)};var _0x298fa0,_0x2d830c,_0x535e4c,_0x47f749,_0x8a73a6,_0x1dc0fb;console[_0x1779(0x18)](_0x3179a4['OlZKI'],_0x531b9c),console[_0x1779(0x18)](_0x3179a4['AwdQY'],(_0x3179a4[_0x1779(0x19)](_0x298fa0=_0x42ac83['recentlyPlayed'],null)||_0x3179a4[_0x1779(0x19)](_0x298fa0,void 0x0)||_0x3179a4[_0x1779(0x1a)](_0x298fa0=_0x298fa0['items'],null)||_0x3179a4[_0x1779(0x1b)](_0x298fa0,void 0x0)?void 0x0:_0x298fa0[_0x1779(0x1c)])||0x0),console[_0x1779(0x18)](_0x1779(0x1d),(_0x3179a4[_0x1779(0x1e)](_0x2d830c=_0x42ac83[_0x1779(0x1f)],null)||_0x2d830c===void 0x0||_0x3179a4[_0x1779(0x19)](_0x2d830c=_0x2d830c[_0x1779(0x20)],null)||_0x3179a4[_0x1779(0x1e)](_0x2d830c,void 0x0)?void 0x0:_0x2d830c[_0x1779(0x1c)])||0x0),console[_0x1779(0x18)](_0x3179a4['ddPKS'],(_0x3179a4[_0x1779(0x1e)](_0x535e4c=_0x42ac83[_0x1779(0x1f)],null)||_0x535e4c===void 0x0||_0x3179a4['xWjrZ'](_0x535e4c=_0x535e4c[_0x1779(0x21)],null)||_0x535e4c===void 0x0?void 0x0:_0x535e4c[_0x1779(0x1c)])||0x0),console[_0x1779(0x18)](_0x3179a4[_0x1779(0x22)],(_0x3179a4[_0x1779(0x1a)](_0x47f749=_0x42ac83[_0x1779(0x23)],null)||_0x47f749===void 0x0?void 0x0:_0x47f749[_0x1779(0x1c)])||0x0),console[_0x1779(0x18)](_0x3179a4[_0x1779(0x24)],((_0x8a73a6=_0x42ac83['savedTracks'])===null||_0x3179a4[_0x1779(0x25)](_0x8a73a6,void 0x0)?void 0x0:_0x8a73a6[_0x1779(0x1c)])||0x0),console[_0x1779(0x18)](_0x3179a4[_0x1779(0x26)],(_0x3179a4[_0x1779(0x1b)](_0x1dc0fb=_0x42ac83[_0x1779(0x27)],null)||_0x3179a4[_0x1779(0x28)](_0x1dc0fb,void 0x0)?void 0x0:_0x1dc0fb[_0x1779(0x1c)])||0x0),console[_0x1779(0x18)](_0x3179a4[_0x1779(0x29)],!!_0x42ac83[_0x1779(0x2a)]);if(!_0x531b9c)return console[_0x1779(0x2b)](_0x1779(0x2c)),{'success':![],'error':'Invalid\x20input:\x20userId\x20missing.'};try{var _0x27e687,_0x458f1d,_0x177764,_0x4a84e7,_0x327187,_0xbb66fc,_0x4422df,_0x449504,_0x3c51bd,_0x2defac,_0x3a759c,_0x4ed0ae,_0x2b66d8,_0x398e3d,_0x1f71e5;const _0x447dd2=await _asyncStorage['default'][_0x1779(0x2d)](_0x3179a4['dcBZj'])||await _asyncStorage[_0x1779(0x2e)][_0x1779(0x2d)](_0x3179a4[_0x1779(0x2f)])||await _asyncStorage[_0x1779(0x2e)]['getItem']('auth_token');if(!_0x447dd2)return console[_0x1779(0x2b)](_0x3179a4[_0x1779(0x30)]),{'success':![],'error':_0x3179a4[_0x1779(0x31)]};console['log'](_0x3179a4[_0x1779(0x32)]);const _0xe3863={'platform':_reactNative['Platform']['OS'],'source':_0x3179a4[_0x1779(0x33)],'appVersion':_0x3179a4[_0x1779(0x34)],'osVersion':_0x3179a4['ggpDN'](_reactNative[_0x1779(0x35)]['OS'],_0x3179a4[_0x1779(0x36)])?_0x3179a4['SPHDd']:_reactNative[_0x1779(0x35)]['OS'],'deviceModel':_0x3179a4[_0x1779(0x25)](_reactNative[_0x1779(0x35)]['OS'],_0x3179a4['KHRPZ'])?_0x3179a4['BHdAT']:_0x1779(0x37),'isOfflineSync':![],'extractedAt':new Date()[_0x1779(0x38)](),'tokenExpiry':_0x42ac83[_0x1779(0x39)]},_0x279cde={'platform':_0x3179a4[_0x1779(0x3a)],'dataType':_0x3179a4[_0x1779(0x3b)],'data':{'recentlyPlayed':{'items':((_0x3179a4['byOXb'](_0x27e687=_0x42ac83[_0x1779(0x3c)],null)||_0x27e687===void 0x0?void 0x0:_0x27e687[_0x1779(0x3d)])||[])[_0x1779(0x3e)](_0x5b14ea=>({'trackId':_0x5b14ea[_0x1779(0x3f)],'name':_0x5b14ea['name'],'artists':_0x5b14ea['artists'],'album':_0x5b14ea[_0x1779(0x40)],'albumId':_0x5b14ea[_0x1779(0x41)],'duration':_0x5b14ea[_0x1779(0x42)],'playedAt':_0x5b14ea[_0x1779(0x43)],'imageUrl':_0x5b14ea[_0x1779(0x44)],'explicit':_0x5b14ea[_0x1779(0x45)],'popularity':_0x5b14ea[_0x1779(0x46)]})),'totalCount':(_0x3179a4['FjDuZ'](_0x458f1d=_0x42ac83[_0x1779(0x3c)],null)||_0x3179a4[_0x1779(0x1e)](_0x458f1d,void 0x0)?void 0x0:_0x458f1d['totalCount'])||((_0x177764=_0x42ac83['recentlyPlayed'])===null||_0x3179a4['BEjYY'](_0x177764,void 0x0)||_0x3179a4[_0x1779(0x1b)](_0x177764=_0x177764[_0x1779(0x3d)],null)||_0x3179a4[_0x1779(0x47)](_0x177764,void 0x0)?void 0x0:_0x177764[_0x1779(0x1c)])||0x0},'topItems':{'tracks':((_0x3179a4[_0x1779(0x48)](_0x4a84e7=_0x42ac83[_0x1779(0x1f)],null)||_0x3179a4[_0x1779(0x49)](_0x4a84e7,void 0x0)?void 0x0:_0x4a84e7['tracks'])||[])[_0x1779(0x3e)](_0x508411=>({'trackId':_0x508411[_0x1779(0x3f)],'name':_0x508411['name'],'artists':_0x508411[_0x1779(0x21)],'album':_0x508411['album'],'imageUrl':_0x508411['imageUrl'],'popularity':_0x508411[_0x1779(0x46)]})),'artists':((_0x3179a4[_0x1779(0x4a)](_0x327187=_0x42ac83['topItems'],null)||_0x3179a4['byOXb'](_0x327187,void 0x0)?void 0x0:_0x327187[_0x1779(0x21)])||[])[_0x1779(0x3e)](_0x374658=>({'artistId':_0x374658[_0x1779(0x4b)],'name':_0x374658['name'],'genres':_0x374658['genres'],'imageUrl':_0x374658[_0x1779(0x44)],'popularity':_0x374658[_0x1779(0x46)],'followers':_0x374658[_0x1779(0x4c)]})),'timeRange':(_0x3179a4[_0x1779(0x4d)](_0xbb66fc=_0x42ac83['topItems'],null)||_0x3179a4[_0x1779(0x4e)](_0xbb66fc,void 0x0)?void 0x0:_0xbb66fc['timeRange'])||_0x3179a4[_0x1779(0x4f)]},'playlists':(_0x42ac83[_0x1779(0x23)]||[])[_0x1779(0x3e)](_0x543f13=>({'playlistId':_0x543f13[_0x1779(0x50)],'name':_0x543f13['name'],'description':_0x543f13['description'],'isPublic':_0x543f13[_0x1779(0x51)],'isCollaborative':_0x543f13['isCollaborative'],'trackCount':_0x543f13['trackCount'],'imageUrl':_0x543f13[_0x1779(0x44)],'owner':_0x543f13['owner']})),'savedTracks':(_0x42ac83[_0x1779(0x52)]||[])[_0x1779(0x3e)](_0xeb90b2=>({'trackId':_0xeb90b2[_0x1779(0x3f)],'name':_0xeb90b2[_0x1779(0x53)],'artists':_0xeb90b2['artists'],'album':_0xeb90b2['album'],'imageUrl':_0xeb90b2['imageUrl']})),'savedAlbums':(_0x42ac83[_0x1779(0x27)]||[])[_0x1779(0x3e)](_0x4f6883=>({'albumId':_0x4f6883[_0x1779(0x41)],'name':_0x4f6883[_0x1779(0x53)],'artists':_0x4f6883[_0x1779(0x21)],'releaseDate':_0x4f6883[_0x1779(0x54)],'trackCount':_0x4f6883[_0x1779(0x55)],'imageUrl':_0x4f6883[_0x1779(0x44)],'savedAt':_0x4f6883[_0x1779(0x56)]})),'profile':_0x42ac83[_0x1779(0x2a)]?{'userId':_0x42ac83[_0x1779(0x2a)][_0x1779(0x57)],'displayName':_0x42ac83[_0x1779(0x2a)][_0x1779(0x58)],'country':_0x42ac83[_0x1779(0x2a)][_0x1779(0x59)],'subscription':_0x42ac83[_0x1779(0x2a)][_0x1779(0x5a)],'followers':_0x42ac83[_0x1779(0x2a)]['followers'],'imageUrl':_0x42ac83[_0x1779(0x2a)][_0x1779(0x44)]}:null,'spotifyUserId':_0x42ac83[_0x1779(0x57)]||(_0x3179a4[_0x1779(0x4e)](_0x4422df=_0x42ac83[_0x1779(0x2a)],null)||_0x3179a4[_0x1779(0x1b)](_0x4422df,void 0x0)?void 0x0:_0x4422df[_0x1779(0x57)])},'summary':{'recentlyPlayedCount':(_0x3179a4['HQcox'](_0x449504=_0x42ac83[_0x1779(0x3c)],null)||_0x3179a4['IoxCh'](_0x449504,void 0x0)||_0x3179a4[_0x1779(0x5b)](_0x449504=_0x449504[_0x1779(0x3d)],null)||_0x3179a4[_0x1779(0x5c)](_0x449504,void 0x0)?void 0x0:_0x449504[_0x1779(0x1c)])||0x0,'topTracksCount':(_0x3179a4[_0x1779(0x47)](_0x3c51bd=_0x42ac83['topItems'],null)||_0x3179a4[_0x1779(0x5d)](_0x3c51bd,void 0x0)||_0x3179a4['jaRlE'](_0x3c51bd=_0x3c51bd[_0x1779(0x20)],null)||_0x3179a4['ggpDN'](_0x3c51bd,void 0x0)?void 0x0:_0x3c51bd[_0x1779(0x1c)])||0x0,'topArtistsCount':(_0x3179a4['BEjYY'](_0x2defac=_0x42ac83[_0x1779(0x1f)],null)||_0x3179a4[_0x1779(0x5e)](_0x2defac,void 0x0)||_0x3179a4[_0x1779(0x5f)](_0x2defac=_0x2defac[_0x1779(0x21)],null)||_0x2defac===void 0x0?void 0x0:_0x2defac['length'])||0x0,'playlistCount':((_0x3a759c=_0x42ac83[_0x1779(0x23)])===null||_0x3179a4[_0x1779(0x1e)](_0x3a759c,void 0x0)?void 0x0:_0x3a759c[_0x1779(0x1c)])||0x0,'savedTracksCount':(_0x3179a4[_0x1779(0x60)](_0x4ed0ae=_0x42ac83[_0x1779(0x52)],null)||_0x4ed0ae===void 0x0?void 0x0:_0x4ed0ae[_0x1779(0x1c)])||0x0,'savedAlbumsCount':(_0x3179a4[_0x1779(0x61)](_0x2b66d8=_0x42ac83[_0x1779(0x27)],null)||_0x3179a4[_0x1779(0x62)](_0x2b66d8,void 0x0)?void 0x0:_0x2b66d8[_0x1779(0x1c)])||0x0,'subscription':(_0x3179a4[_0x1779(0x63)](_0x398e3d=_0x42ac83[_0x1779(0x2a)],null)||_0x3179a4[_0x1779(0x1e)](_0x398e3d,void 0x0)?void 0x0:_0x398e3d['subscription'])||_0x1779(0x64),'displayName':(_0x3179a4[_0x1779(0x65)](_0x1f71e5=_0x42ac83[_0x1779(0x2a)],null)||_0x3179a4[_0x1779(0x66)](_0x1f71e5,void 0x0)?void 0x0:_0x1f71e5[_0x1779(0x58)])||_0x1779(0x64)},'mobileMetadata':_0xe3863};console['log'](_0x3179a4[_0x1779(0x67)]),console[_0x1779(0x18)](_0x3179a4[_0x1779(0x68)],_api[_0x1779(0x69)][_0x1779(0x6a)]+_0x1779(0x6b));const _0xe1eae6=await _0x3179a4[_0x1779(0x6c)](fetch,_api['API_CONFIG'][_0x1779(0x6a)]+_0x1779(0x6b),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x1779(0x6d)+_0x447dd2,'User-Agent':_0x1779(0x6e)+_reactNative[_0x1779(0x35)]['OS']+')'},'body':JSON[_0x1779(0x6f)](_0x279cde)}),_0x4347f0=await _0xe1eae6[_0x1779(0x70)]();if(_0xe1eae6['ok']){console['log'](_0x3179a4[_0x1779(0x71)]);if(_0x4347f0[_0x1779(0x72)]){if(_0x3179a4[_0x1779(0x73)]!=='xKZXH')return _0x5477c1[_0x1779(0x18)](_0x3179a4[_0x1779(0x71)]),_0x5b0779[_0x1779(0x72)]&&_0x1969eb['log'](_0x1779(0x74)+_0x2bc30f['message']),{'success':!![],'message':_0x34c690[_0x1779(0x72)]||_0x3179a4[_0x1779(0x75)],'data':_0x4e3313['data']};else console[_0x1779(0x18)](_0x1779(0x74)+_0x4347f0[_0x1779(0x72)]);}return{'success':!![],'message':_0x4347f0[_0x1779(0x72)]||_0x3179a4['bEDKa'],'data':_0x4347f0[_0x1779(0x76)]};}else return console[_0x1779(0x77)](_0x1779(0x78)+_0xe1eae6['status']),console[_0x1779(0x77)](_0x1779(0x79)+(_0x4347f0[_0x1779(0x2b)]||_0x3179a4[_0x1779(0x7a)])),{'success':![],'error':_0x4347f0[_0x1779(0x2b)]||'HTTP\x20'+_0xe1eae6[_0x1779(0x7b)]};}catch(_0x497d4f){return console[_0x1779(0x2b)](_0x3179a4['uEAZg'],_0x497d4f),{'success':![],'error':_0x497d4f[_0x1779(0x72)]||_0x1779(0x7c)};}};exports[_0x1779(0x7d)]=storeSpotifyData;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.storeSpotifyData = void 0;
|
|
7
|
+
var _api = require("../config/api");
|
|
8
|
+
var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
|
|
9
|
+
var _reactNative = require("react-native");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
/**
|
|
12
|
+
* Spotify Data Service
|
|
13
|
+
*
|
|
14
|
+
* API layer for storing Spotify listening data on backend.
|
|
15
|
+
* Sends extracted listening history, playlists, saved items, and profile to /platform-data/store endpoint.
|
|
16
|
+
*
|
|
17
|
+
* MATCHES Sephora/ChatGPT implementation pattern
|
|
18
|
+
* - Uses format: { platform, data, metadata }
|
|
19
|
+
* - Platform: "mobile-spotify"
|
|
20
|
+
*
|
|
21
|
+
* Data Sources (from spotify.com - API details TBD):
|
|
22
|
+
* - Recently Played: User's recent listening history
|
|
23
|
+
* - Top Tracks: User's most played tracks
|
|
24
|
+
* - Top Artists: User's most played artists
|
|
25
|
+
* - Playlists: User's created and followed playlists
|
|
26
|
+
* - Saved Tracks: User's liked songs
|
|
27
|
+
* - Saved Albums: User's saved albums
|
|
28
|
+
* - Profile: User preferences and settings
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Structure of a track
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Structure of an artist
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Structure of a playlist
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Structure of a saved album
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Structure of recently played data
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Structure of top items data
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Structure of user profile
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Token expiry information
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Combined Spotify data to store - matches WebView export format
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Response from backend endpoint
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Store Spotify data on backend
|
|
73
|
+
*
|
|
74
|
+
* @param userId - Username or identifier
|
|
75
|
+
* @param data - Spotify listening data (history, playlists, saved items, profile)
|
|
76
|
+
* @returns Response indicating success/failure with metadata
|
|
77
|
+
*/
|
|
78
|
+
const storeSpotifyData = async (userId, data) => {
|
|
79
|
+
var _data$recentlyPlayed, _data$topItems, _data$topItems2, _data$playlists, _data$savedTracks, _data$savedAlbums;
|
|
80
|
+
console.log('🚀 [SPOTIFY_SERVICE] Storing Spotify data for:', userId);
|
|
81
|
+
console.log('📊 [SPOTIFY_SERVICE] Recently played items:', ((_data$recentlyPlayed = data.recentlyPlayed) === null || _data$recentlyPlayed === void 0 || (_data$recentlyPlayed = _data$recentlyPlayed.items) === null || _data$recentlyPlayed === void 0 ? void 0 : _data$recentlyPlayed.length) || 0);
|
|
82
|
+
console.log('📊 [SPOTIFY_SERVICE] Top tracks:', ((_data$topItems = data.topItems) === null || _data$topItems === void 0 || (_data$topItems = _data$topItems.tracks) === null || _data$topItems === void 0 ? void 0 : _data$topItems.length) || 0);
|
|
83
|
+
console.log('📊 [SPOTIFY_SERVICE] Top artists:', ((_data$topItems2 = data.topItems) === null || _data$topItems2 === void 0 || (_data$topItems2 = _data$topItems2.artists) === null || _data$topItems2 === void 0 ? void 0 : _data$topItems2.length) || 0);
|
|
84
|
+
console.log('📊 [SPOTIFY_SERVICE] Playlists:', ((_data$playlists = data.playlists) === null || _data$playlists === void 0 ? void 0 : _data$playlists.length) || 0);
|
|
85
|
+
console.log('📊 [SPOTIFY_SERVICE] Saved tracks:', ((_data$savedTracks = data.savedTracks) === null || _data$savedTracks === void 0 ? void 0 : _data$savedTracks.length) || 0);
|
|
86
|
+
console.log('📊 [SPOTIFY_SERVICE] Saved albums:', ((_data$savedAlbums = data.savedAlbums) === null || _data$savedAlbums === void 0 ? void 0 : _data$savedAlbums.length) || 0);
|
|
87
|
+
console.log('📊 [SPOTIFY_SERVICE] Has profile:', !!data.profile);
|
|
88
|
+
if (!userId) {
|
|
89
|
+
console.error('❌ [SPOTIFY_SERVICE] Invalid input: userId missing');
|
|
90
|
+
return {
|
|
91
|
+
success: false,
|
|
92
|
+
error: 'Invalid input: userId missing.'
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
var _data$recentlyPlayed2, _data$recentlyPlayed3, _data$recentlyPlayed4, _data$topItems3, _data$topItems4, _data$topItems5, _data$profile, _data$recentlyPlayed5, _data$topItems6, _data$topItems7, _data$playlists2, _data$savedTracks2, _data$savedAlbums2, _data$profile2, _data$profile3;
|
|
97
|
+
const authToken = (await _asyncStorage.default.getItem('onairos_jwt_token')) || (await _asyncStorage.default.getItem('enoch_token')) || (await _asyncStorage.default.getItem('auth_token'));
|
|
98
|
+
if (!authToken) {
|
|
99
|
+
console.error('❌ [SPOTIFY_SERVICE] No auth token found');
|
|
100
|
+
return {
|
|
101
|
+
success: false,
|
|
102
|
+
error: 'Authentication token not found. Please log in again.'
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
console.log('🔑 [SPOTIFY_SERVICE] Auth token found');
|
|
106
|
+
const mobileMetadata = {
|
|
107
|
+
platform: _reactNative.Platform.OS,
|
|
108
|
+
source: 'webview-api',
|
|
109
|
+
appVersion: '1.0.0',
|
|
110
|
+
osVersion: _reactNative.Platform.OS === 'ios' ? '17.0' : _reactNative.Platform.OS,
|
|
111
|
+
deviceModel: _reactNative.Platform.OS === 'ios' ? 'iPhone' : 'Android',
|
|
112
|
+
isOfflineSync: false,
|
|
113
|
+
extractedAt: new Date().toISOString(),
|
|
114
|
+
tokenExpiry: data.tokenExpiry
|
|
115
|
+
};
|
|
116
|
+
const requestBody = {
|
|
117
|
+
platform: 'mobile-spotify',
|
|
118
|
+
dataType: 'streaming',
|
|
119
|
+
data: {
|
|
120
|
+
recentlyPlayed: {
|
|
121
|
+
items: (((_data$recentlyPlayed2 = data.recentlyPlayed) === null || _data$recentlyPlayed2 === void 0 ? void 0 : _data$recentlyPlayed2.items) || []).map(track => ({
|
|
122
|
+
trackId: track.trackId,
|
|
123
|
+
name: track.name,
|
|
124
|
+
artists: track.artists,
|
|
125
|
+
album: track.album,
|
|
126
|
+
albumId: track.albumId,
|
|
127
|
+
duration: track.duration,
|
|
128
|
+
playedAt: track.playedAt,
|
|
129
|
+
imageUrl: track.imageUrl,
|
|
130
|
+
explicit: track.explicit,
|
|
131
|
+
popularity: track.popularity
|
|
132
|
+
})),
|
|
133
|
+
totalCount: ((_data$recentlyPlayed3 = data.recentlyPlayed) === null || _data$recentlyPlayed3 === void 0 ? void 0 : _data$recentlyPlayed3.totalCount) || ((_data$recentlyPlayed4 = data.recentlyPlayed) === null || _data$recentlyPlayed4 === void 0 || (_data$recentlyPlayed4 = _data$recentlyPlayed4.items) === null || _data$recentlyPlayed4 === void 0 ? void 0 : _data$recentlyPlayed4.length) || 0
|
|
134
|
+
},
|
|
135
|
+
topItems: {
|
|
136
|
+
tracks: (((_data$topItems3 = data.topItems) === null || _data$topItems3 === void 0 ? void 0 : _data$topItems3.tracks) || []).map(track => ({
|
|
137
|
+
trackId: track.trackId,
|
|
138
|
+
name: track.name,
|
|
139
|
+
artists: track.artists,
|
|
140
|
+
album: track.album,
|
|
141
|
+
imageUrl: track.imageUrl,
|
|
142
|
+
popularity: track.popularity
|
|
143
|
+
})),
|
|
144
|
+
artists: (((_data$topItems4 = data.topItems) === null || _data$topItems4 === void 0 ? void 0 : _data$topItems4.artists) || []).map(artist => ({
|
|
145
|
+
artistId: artist.artistId,
|
|
146
|
+
name: artist.name,
|
|
147
|
+
genres: artist.genres,
|
|
148
|
+
imageUrl: artist.imageUrl,
|
|
149
|
+
popularity: artist.popularity,
|
|
150
|
+
followers: artist.followers
|
|
151
|
+
})),
|
|
152
|
+
timeRange: ((_data$topItems5 = data.topItems) === null || _data$topItems5 === void 0 ? void 0 : _data$topItems5.timeRange) || 'medium_term'
|
|
153
|
+
},
|
|
154
|
+
playlists: (data.playlists || []).map(playlist => ({
|
|
155
|
+
playlistId: playlist.playlistId,
|
|
156
|
+
name: playlist.name,
|
|
157
|
+
description: playlist.description,
|
|
158
|
+
isPublic: playlist.isPublic,
|
|
159
|
+
isCollaborative: playlist.isCollaborative,
|
|
160
|
+
trackCount: playlist.trackCount,
|
|
161
|
+
imageUrl: playlist.imageUrl,
|
|
162
|
+
owner: playlist.owner
|
|
163
|
+
})),
|
|
164
|
+
savedTracks: (data.savedTracks || []).map(track => ({
|
|
165
|
+
trackId: track.trackId,
|
|
166
|
+
name: track.name,
|
|
167
|
+
artists: track.artists,
|
|
168
|
+
album: track.album,
|
|
169
|
+
imageUrl: track.imageUrl
|
|
170
|
+
})),
|
|
171
|
+
savedAlbums: (data.savedAlbums || []).map(album => ({
|
|
172
|
+
albumId: album.albumId,
|
|
173
|
+
name: album.name,
|
|
174
|
+
artists: album.artists,
|
|
175
|
+
releaseDate: album.releaseDate,
|
|
176
|
+
trackCount: album.trackCount,
|
|
177
|
+
imageUrl: album.imageUrl,
|
|
178
|
+
savedAt: album.savedAt
|
|
179
|
+
})),
|
|
180
|
+
profile: data.profile ? {
|
|
181
|
+
userId: data.profile.userId,
|
|
182
|
+
displayName: data.profile.displayName,
|
|
183
|
+
country: data.profile.country,
|
|
184
|
+
subscription: data.profile.subscription,
|
|
185
|
+
followers: data.profile.followers,
|
|
186
|
+
imageUrl: data.profile.imageUrl
|
|
187
|
+
} : null,
|
|
188
|
+
spotifyUserId: data.userId || ((_data$profile = data.profile) === null || _data$profile === void 0 ? void 0 : _data$profile.userId)
|
|
189
|
+
},
|
|
190
|
+
summary: {
|
|
191
|
+
recentlyPlayedCount: ((_data$recentlyPlayed5 = data.recentlyPlayed) === null || _data$recentlyPlayed5 === void 0 || (_data$recentlyPlayed5 = _data$recentlyPlayed5.items) === null || _data$recentlyPlayed5 === void 0 ? void 0 : _data$recentlyPlayed5.length) || 0,
|
|
192
|
+
topTracksCount: ((_data$topItems6 = data.topItems) === null || _data$topItems6 === void 0 || (_data$topItems6 = _data$topItems6.tracks) === null || _data$topItems6 === void 0 ? void 0 : _data$topItems6.length) || 0,
|
|
193
|
+
topArtistsCount: ((_data$topItems7 = data.topItems) === null || _data$topItems7 === void 0 || (_data$topItems7 = _data$topItems7.artists) === null || _data$topItems7 === void 0 ? void 0 : _data$topItems7.length) || 0,
|
|
194
|
+
playlistCount: ((_data$playlists2 = data.playlists) === null || _data$playlists2 === void 0 ? void 0 : _data$playlists2.length) || 0,
|
|
195
|
+
savedTracksCount: ((_data$savedTracks2 = data.savedTracks) === null || _data$savedTracks2 === void 0 ? void 0 : _data$savedTracks2.length) || 0,
|
|
196
|
+
savedAlbumsCount: ((_data$savedAlbums2 = data.savedAlbums) === null || _data$savedAlbums2 === void 0 ? void 0 : _data$savedAlbums2.length) || 0,
|
|
197
|
+
subscription: ((_data$profile2 = data.profile) === null || _data$profile2 === void 0 ? void 0 : _data$profile2.subscription) || 'unknown',
|
|
198
|
+
displayName: ((_data$profile3 = data.profile) === null || _data$profile3 === void 0 ? void 0 : _data$profile3.displayName) || 'unknown'
|
|
199
|
+
},
|
|
200
|
+
mobileMetadata: mobileMetadata
|
|
201
|
+
};
|
|
202
|
+
console.log('📡 [SPOTIFY_SERVICE] Sending to backend...');
|
|
203
|
+
console.log('📍 [SPOTIFY_SERVICE] URL:', `${_api.API_CONFIG.BASE_URL}/platform-data/store`);
|
|
204
|
+
const response = await fetch(`${_api.API_CONFIG.BASE_URL}/platform-data/store`, {
|
|
205
|
+
method: 'POST',
|
|
206
|
+
headers: {
|
|
207
|
+
'Content-Type': 'application/json',
|
|
208
|
+
'Authorization': `Bearer ${authToken}`,
|
|
209
|
+
'User-Agent': `OnairosSDK/1.0.0 (${_reactNative.Platform.OS})`
|
|
210
|
+
},
|
|
211
|
+
body: JSON.stringify(requestBody)
|
|
212
|
+
});
|
|
213
|
+
const responseData = await response.json();
|
|
214
|
+
if (response.ok) {
|
|
215
|
+
console.log('✅ [SPOTIFY_SERVICE] Successfully stored Spotify data');
|
|
216
|
+
if (responseData.message) {
|
|
217
|
+
console.log(`📝 [SPOTIFY_SERVICE] Backend response: ${responseData.message}`);
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
success: true,
|
|
221
|
+
message: responseData.message || 'Spotify data stored successfully',
|
|
222
|
+
data: responseData.data
|
|
223
|
+
};
|
|
224
|
+
} else {
|
|
225
|
+
console.warn(`⚠️ [SPOTIFY_SERVICE] Backend returned status: ${response.status}`);
|
|
226
|
+
console.warn(`⚠️ [SPOTIFY_SERVICE] Error: ${responseData.error || 'Unknown error'}`);
|
|
227
|
+
return {
|
|
228
|
+
success: false,
|
|
229
|
+
error: responseData.error || `HTTP ${response.status}`
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
} catch (error) {
|
|
233
|
+
console.error('❌ [SPOTIFY_SERVICE] Network error:', error);
|
|
234
|
+
return {
|
|
235
|
+
success: false,
|
|
236
|
+
error: error.message || 'Network error. Please check your connection.'
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
exports.storeSpotifyData = storeSpotifyData;
|
|
241
|
+
//# sourceMappingURL=spotifyDataService.js.map
|