@onairos/react-native 3.7.2 → 3.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/lib/commonjs/api/index.js +219 -9
  2. package/lib/commonjs/components/BodyText.js +27 -9
  3. package/lib/commonjs/components/BrandMark.js +111 -10
  4. package/lib/commonjs/components/CodeInput.js +120 -9
  5. package/lib/commonjs/components/EmailInput.js +30 -8
  6. package/lib/commonjs/components/GoogleButton.js +56 -9
  7. package/lib/commonjs/components/HeadingGroup.js +43 -9
  8. package/lib/commonjs/components/LLMDataInputModal.js +664 -14
  9. package/lib/commonjs/components/ModalHeader.js +99 -9
  10. package/lib/commonjs/components/ModalSheet.js +47 -9
  11. package/lib/commonjs/components/Onairos.js +380 -14
  12. package/lib/commonjs/components/OnairosButton.js +313 -13
  13. package/lib/commonjs/components/OnairosSignInButton.js +130 -12
  14. package/lib/commonjs/components/Overlay.js +465 -13
  15. package/lib/commonjs/components/PersonaImage.js +137 -10
  16. package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
  17. package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
  18. package/lib/commonjs/components/PinCreationScreen.js +403 -12
  19. package/lib/commonjs/components/PinInput.js +464 -9
  20. package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
  21. package/lib/commonjs/components/PlatformList.js +137 -10
  22. package/lib/commonjs/components/PlatformToggle.js +180 -9
  23. package/lib/commonjs/components/PrimaryButton.js +180 -10
  24. package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
  25. package/lib/commonjs/components/SignInStep.js +345 -12
  26. package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
  27. package/lib/commonjs/components/VerificationStep.js +176 -11
  28. package/lib/commonjs/components/WelcomeScreen.js +461 -22
  29. package/lib/commonjs/components/icons/Basicproficon.js +37 -8
  30. package/lib/commonjs/components/icons/Basicprofile.js +21 -8
  31. package/lib/commonjs/components/icons/Checkbox.js +21 -8
  32. package/lib/commonjs/components/icons/Checkmark.js +27 -8
  33. package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
  34. package/lib/commonjs/components/icons/Contenticon.js +39 -8
  35. package/lib/commonjs/components/icons/EnochE.js +41 -8
  36. package/lib/commonjs/components/icons/Personalityicon.js +30 -8
  37. package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
  38. package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
  39. package/lib/commonjs/components/icons/Userpreferences.js +21 -8
  40. package/lib/commonjs/components/icons/index.js +84 -17
  41. package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
  42. package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
  43. package/lib/commonjs/components/onboarding/PinInput.js +283 -10
  44. package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
  45. package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
  46. package/lib/commonjs/config/api.js +56 -7
  47. package/lib/commonjs/constants/index.js +120 -7
  48. package/lib/commonjs/context/AuthContext.js +345 -10
  49. package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
  50. package/lib/commonjs/hooks/useConnections.js +102 -8
  51. package/lib/commonjs/hooks/useCredentials.js +178 -10
  52. package/lib/commonjs/hooks/useUserConnections.js +148 -10
  53. package/lib/commonjs/index.js +439 -34
  54. package/lib/commonjs/services/apiClient.js +298 -8
  55. package/lib/commonjs/services/biometricPinService.js +180 -8
  56. package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
  57. package/lib/commonjs/services/chatGPTConversationService.js +275 -9
  58. package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
  59. package/lib/commonjs/services/claudeConversationService.js +158 -9
  60. package/lib/commonjs/services/connectedAccountsService.js +310 -10
  61. package/lib/commonjs/services/googleAuthService.js +252 -11
  62. package/lib/commonjs/services/hingeDataExtractor.js +105 -8
  63. package/lib/commonjs/services/hingeDataService.js +150 -9
  64. package/lib/commonjs/services/imageCompressionService.js +260 -7
  65. package/lib/commonjs/services/instagramDataExtractor.js +126 -8
  66. package/lib/commonjs/services/instagramDataService.js +163 -9
  67. package/lib/commonjs/services/jwtStorageService.js +276 -7
  68. package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
  69. package/lib/commonjs/services/linkedinProfileService.js +222 -9
  70. package/lib/commonjs/services/linkedinScrapingService.js +230 -8
  71. package/lib/commonjs/services/llmDataStorage.js +294 -8
  72. package/lib/commonjs/services/mobileTrainingService.js +186 -8
  73. package/lib/commonjs/services/netflixDataExtractor.js +120 -8
  74. package/lib/commonjs/services/netflixDataService.js +198 -9
  75. package/lib/commonjs/services/pinEncryptionService.js +84 -8
  76. package/lib/commonjs/services/pinStorageUtils.js +105 -7
  77. package/lib/commonjs/services/platformAuthService.js +1484 -12
  78. package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
  79. package/lib/commonjs/services/sephoraDataService.js +200 -9
  80. package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
  81. package/lib/commonjs/services/spotifyDataService.js +241 -9
  82. package/lib/commonjs/services/storageService.js +404 -8
  83. package/lib/commonjs/services/telegramDataExtractor.js +115 -8
  84. package/lib/commonjs/services/telegramDataService.js +499 -9
  85. package/lib/commonjs/services/trainingApiHelpers.js +73 -7
  86. package/lib/commonjs/services/userConnectionsService.js +340 -10
  87. package/lib/commonjs/services/youtubeMigrationService.js +416 -10
  88. package/lib/commonjs/theme/index.js +250 -7
  89. package/lib/commonjs/types/ambient.d.js +2 -1
  90. package/lib/commonjs/types/declarations.d.js +2 -1
  91. package/lib/commonjs/types/index.js +6 -1
  92. package/lib/commonjs/types/node-fix.d.js +2 -1
  93. package/lib/commonjs/types/node-override.d.js +2 -1
  94. package/lib/commonjs/types/opacity.d.js +2 -1
  95. package/lib/commonjs/types.js +14 -1
  96. package/lib/commonjs/utils/Portal.js +98 -8
  97. package/lib/commonjs/utils/api.js +130 -9
  98. package/lib/commonjs/utils/assetRegistry.js +210 -35
  99. package/lib/commonjs/utils/auth.js +112 -9
  100. package/lib/commonjs/utils/connectorTests.js +613 -29
  101. package/lib/commonjs/utils/crypto.js +62 -8
  102. package/lib/commonjs/utils/debugHelper.js +64 -1
  103. package/lib/commonjs/utils/encryption.js +76 -7
  104. package/lib/commonjs/utils/eventUtils.js +288 -1
  105. package/lib/commonjs/utils/haptics.js +66 -9
  106. package/lib/commonjs/utils/imagePreloader.js +6 -1
  107. package/lib/commonjs/utils/networkDiagnostics.js +226 -8
  108. package/lib/commonjs/utils/onairosApi.js +350 -9
  109. package/lib/commonjs/utils/programmaticFlow.js +117 -9
  110. package/lib/commonjs/utils/retryHelper.js +220 -1
  111. package/lib/commonjs/utils/secureStorage.js +349 -10
  112. package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
  113. package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
  114. package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
  115. package/lib/commonjs/utils/webviewScripts/index.js +698 -15
  116. package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
  117. package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
  118. package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
  119. package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
  120. package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
  121. package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
  122. package/lib/module/api/index.js +211 -1
  123. package/lib/module/components/BodyText.js +20 -1
  124. package/lib/module/components/BrandMark.js +104 -1
  125. package/lib/module/components/CodeInput.js +113 -1
  126. package/lib/module/components/EmailInput.js +23 -1
  127. package/lib/module/components/GoogleButton.js +49 -1
  128. package/lib/module/components/HeadingGroup.js +36 -1
  129. package/lib/module/components/LLMDataInputModal.js +656 -7
  130. package/lib/module/components/ModalHeader.js +92 -1
  131. package/lib/module/components/ModalSheet.js +39 -1
  132. package/lib/module/components/Onairos.js +373 -1
  133. package/lib/module/components/OnairosButton.js +305 -1
  134. package/lib/module/components/OnairosSignInButton.js +121 -1
  135. package/lib/module/components/Overlay.js +456 -1
  136. package/lib/module/components/PersonaImage.js +129 -1
  137. package/lib/module/components/PersonaLoadingScreen.js +310 -1
  138. package/lib/module/components/PersonalizationConsentScreen.js +460 -1
  139. package/lib/module/components/PinCreationScreen.js +396 -1
  140. package/lib/module/components/PinInput.js +456 -1
  141. package/lib/module/components/PlatformConnectorsStep.js +1302 -6
  142. package/lib/module/components/PlatformList.js +129 -1
  143. package/lib/module/components/PlatformToggle.js +173 -1
  144. package/lib/module/components/PrimaryButton.js +172 -1
  145. package/lib/module/components/SignInMatchAnimation.js +189 -1
  146. package/lib/module/components/SignInStep.js +338 -1
  147. package/lib/module/components/UniversalOnboarding.js +2770 -1
  148. package/lib/module/components/VerificationStep.js +168 -1
  149. package/lib/module/components/WelcomeScreen.js +453 -1
  150. package/lib/module/components/icons/Basicproficon.js +30 -1
  151. package/lib/module/components/icons/Basicprofile.js +14 -1
  152. package/lib/module/components/icons/Checkbox.js +14 -1
  153. package/lib/module/components/icons/Checkmark.js +20 -1
  154. package/lib/module/components/icons/Contentanalysis.js +14 -1
  155. package/lib/module/components/icons/Contenticon.js +32 -1
  156. package/lib/module/components/icons/EnochE.js +34 -1
  157. package/lib/module/components/icons/Personalityicon.js +23 -1
  158. package/lib/module/components/icons/Personalityprofile.js +14 -1
  159. package/lib/module/components/icons/Personalitytraits.js +14 -1
  160. package/lib/module/components/icons/Userpreferences.js +14 -1
  161. package/lib/module/components/icons/index.js +13 -1
  162. package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
  163. package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
  164. package/lib/module/components/onboarding/PinInput.js +274 -1
  165. package/lib/module/components/onboarding/PlatformConnector.js +240 -1
  166. package/lib/module/config/PLATFORM_APIS.md +849 -0
  167. package/lib/module/config/api.js +47 -1
  168. package/lib/module/constants/index.js +114 -1
  169. package/lib/module/context/AuthContext.js +335 -1
  170. package/lib/module/hooks/useConnectedAccounts.js +106 -1
  171. package/lib/module/hooks/useConnections.js +95 -1
  172. package/lib/module/hooks/useCredentials.js +171 -6
  173. package/lib/module/hooks/useUserConnections.js +140 -1
  174. package/lib/module/index.js +172 -1
  175. package/lib/module/services/apiClient.js +295 -1
  176. package/lib/module/services/biometricPinService.js +169 -1
  177. package/lib/module/services/chatGPTConversationExtractor.js +149 -1
  178. package/lib/module/services/chatGPTConversationService.js +268 -1
  179. package/lib/module/services/claudeConversationExtractor.js +97 -1
  180. package/lib/module/services/claudeConversationService.js +151 -1
  181. package/lib/module/services/connectedAccountsService.js +293 -1
  182. package/lib/module/services/googleAuthService.js +241 -1
  183. package/lib/module/services/hingeDataExtractor.js +99 -1
  184. package/lib/module/services/hingeDataService.js +143 -1
  185. package/lib/module/services/imageCompressionService.js +250 -1
  186. package/lib/module/services/instagramDataExtractor.js +120 -1
  187. package/lib/module/services/instagramDataService.js +156 -1
  188. package/lib/module/services/jwtStorageService.js +257 -1
  189. package/lib/module/services/linkedinDOMExtractor.js +234 -1
  190. package/lib/module/services/linkedinProfileService.js +210 -1
  191. package/lib/module/services/linkedinScrapingService.js +219 -1
  192. package/lib/module/services/llmDataStorage.js +277 -1
  193. package/lib/module/services/mobileTrainingService.js +173 -1
  194. package/lib/module/services/netflixDataExtractor.js +114 -1
  195. package/lib/module/services/netflixDataService.js +191 -1
  196. package/lib/module/services/pinEncryptionService.js +74 -6
  197. package/lib/module/services/pinStorageUtils.js +93 -1
  198. package/lib/module/services/platformAuthService.js +1461 -1
  199. package/lib/module/services/sephoraDataExtractor.js +134 -1
  200. package/lib/module/services/sephoraDataService.js +193 -1
  201. package/lib/module/services/spotifyDataExtractor.js +142 -1
  202. package/lib/module/services/spotifyDataService.js +234 -1
  203. package/lib/module/services/storageService.js +383 -1
  204. package/lib/module/services/telegramDataExtractor.js +109 -1
  205. package/lib/module/services/telegramDataService.js +493 -1
  206. package/lib/module/services/trainingApiHelpers.js +67 -1
  207. package/lib/module/services/userConnectionsService.js +329 -1
  208. package/lib/module/services/youtubeMigrationService.js +405 -1
  209. package/lib/module/theme/index.js +245 -1
  210. package/lib/module/types.js +10 -1
  211. package/lib/module/utils/Portal.js +90 -1
  212. package/lib/module/utils/api.js +118 -1
  213. package/lib/module/utils/assetRegistry.js +200 -34
  214. package/lib/module/utils/auth.js +100 -1
  215. package/lib/module/utils/connectorTests.js +600 -27
  216. package/lib/module/utils/crypto.js +54 -1
  217. package/lib/module/utils/debugHelper.js +54 -1
  218. package/lib/module/utils/encryption.js +67 -1
  219. package/lib/module/utils/eventUtils.js +270 -1
  220. package/lib/module/utils/haptics.js +59 -8
  221. package/lib/module/utils/imagePreloader.js +3 -1
  222. package/lib/module/utils/networkDiagnostics.js +217 -1
  223. package/lib/module/utils/onairosApi.js +333 -1
  224. package/lib/module/utils/programmaticFlow.js +111 -1
  225. package/lib/module/utils/retryHelper.js +211 -1
  226. package/lib/module/utils/secureStorage.js +330 -6
  227. package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
  228. package/lib/module/utils/webviewScripts/claude.js +370 -1
  229. package/lib/module/utils/webviewScripts/hinge.js +405 -1
  230. package/lib/module/utils/webviewScripts/index.js +434 -1
  231. package/lib/module/utils/webviewScripts/instagram.js +448 -1
  232. package/lib/module/utils/webviewScripts/linkedin.js +874 -1
  233. package/lib/module/utils/webviewScripts/netflix.js +376 -1
  234. package/lib/module/utils/webviewScripts/sephora.js +510 -1
  235. package/lib/module/utils/webviewScripts/spotify.js +413 -1
  236. package/lib/module/utils/webviewScripts/telegram.js +672 -1
  237. package/package.json +2 -2
@@ -1,9 +1,241 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("../config/api"),
5
- require("@react-native-async-storage/async-storage"),
6
- require("react-native")
7
- ];
8
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
9
- function _0x58de(){const _0x151e3a=['defineProperty','__esModule','storeSpotifyData','❌\x20[SPOTIFY_SERVICE]\x20Invalid\x20input:\x20userId\x20missing','✅\x20[SPOTIFY_SERVICE]\x20Successfully\x20stored\x20Spotify\x20data','Spotify\x20data\x20stored\x20successfully','📊\x20[SPOTIFY_SERVICE]\x20Recently\x20played\x20items:','📊\x20[SPOTIFY_SERVICE]\x20Top\x20tracks:','📊\x20[SPOTIFY_SERVICE]\x20Top\x20artists:','📊\x20[SPOTIFY_SERVICE]\x20Playlists:','📊\x20[SPOTIFY_SERVICE]\x20Saved\x20albums:','enoch_token','auth_token','LUYnR','❌\x20[SPOTIFY_SERVICE]\x20No\x20auth\x20token\x20found','Authentication\x20token\x20not\x20found.\x20Please\x20log\x20in\x20again.','1.0.0','iPhone','Android','streaming','📍\x20[SPOTIFY_SERVICE]\x20URL:','kkndT','Unknown\x20error','log','🚀\x20[SPOTIFY_SERVICE]\x20Storing\x20Spotify\x20data\x20for:','PPOlN','MMayl','recentlyPlayed','pPTLR','twUWh','KtEyq','length','JdjLP','VeJXA','artists','hkLku','fSCiq','playlists','📊\x20[SPOTIFY_SERVICE]\x20Saved\x20tracks:','savedTracks','FVDIz','jReba','📊\x20[SPOTIFY_SERVICE]\x20Has\x20profile:','profile','error','NxWHF','getItem','onairos_jwt_token','default','sDQeO','nYznA','Yzmfh','VQbFL','pLfJv','JURLS','Platform','webview-api','Davjo','kKTjJ','toISOString','tokenExpiry','items','map','trackId','album','albumId','duration','playedAt','imageUrl','explicit','popularity','gCHFT','inqWw','LcKUF','topItems','tracks','name','FLDjW','gEAdE','artistId','genres','AhltH','AguQq','description','isCollaborative','trackCount','owner','savedAlbums','releaseDate','savedAt','userId','displayName','subscription','njqkO','YqVVc','PSjxr','rxzLy','unknown','SMQcf','📡\x20[SPOTIFY_SERVICE]\x20Sending\x20to\x20backend...','API_CONFIG','BASE_URL','/platform-data/store','kRcOu','Bearer\x20','OnairosSDK/1.0.0\x20(','json','message','AAZEj','jvkgG','data','warn','⚠️\x20[SPOTIFY_SERVICE]\x20Error:\x20','fpXio','HTTP\x20','status','❌\x20[SPOTIFY_SERVICE]\x20Network\x20error:','Network\x20error.\x20Please\x20check\x20your\x20connection.'];_0x58de=function(){return _0x151e3a;};return _0x58de();}Object[_0x1f81(0x0)](exports,_0x1f81(0x1),{'value':!![]}),exports[_0x1f81(0x2)]=void 0x0;var _api=__ONAIROS_REQ_FUNC__(0x0),_asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x1)),_reactNative=__ONAIROS_REQ_FUNC__(0x2);function _interopRequireDefault(_0x4a26a3){return _0x4a26a3&&_0x4a26a3['__esModule']?_0x4a26a3:{'default':_0x4a26a3};}function _0x1f81(_0x58dea8,_0x1f8127){_0x58dea8=_0x58dea8-0x0;const _0x361039=_0x58de();let _0x4b4f48=_0x361039[_0x58dea8];return _0x4b4f48;}const storeSpotifyData=async(_0x1aebce,_0x4ac40b)=>{const _0x47b789={'rOxxd':_0x1f81(0x3),'NxWHF':'Invalid\x20input:\x20userId\x20missing.','ipVLn':_0x1f81(0x4),'AAZEj':_0x1f81(0x5),'PPOlN':_0x1f81(0x6),'MMayl':function(_0xca2d0c,_0x41bd83){return _0xca2d0c===_0x41bd83;},'pPTLR':function(_0x40e6db,_0x22144c){return _0x40e6db===_0x22144c;},'twUWh':_0x1f81(0x7),'hkLku':function(_0x1f5166,_0x281350){return _0x1f5166===_0x281350;},'KtEyq':function(_0x569902,_0x5ab543){return _0x569902===_0x5ab543;},'JdjLP':_0x1f81(0x8),'VeJXA':function(_0x1dde03,_0x226f4f){return _0x1dde03===_0x226f4f;},'fSCiq':_0x1f81(0x9),'FVDIz':_0x1f81(0xa),'jReba':function(_0x2bec54,_0x534a2f){return _0x2bec54===_0x534a2f;},'DPVku':_0x1f81(0xb),'JuHGM':_0x1f81(0xc),'sDQeO':function(_0x160d91,_0x497b81){return _0x160d91!==_0x497b81;},'nYznA':'cguyF','Yzmfh':_0x1f81(0xd),'VQbFL':_0x1f81(0xe),'pLfJv':_0x1f81(0xf),'JURLS':'🔑\x20[SPOTIFY_SERVICE]\x20Auth\x20token\x20found','Davjo':_0x1f81(0x10),'kKTjJ':'ios','RQeqF':'17.0','VtMLw':_0x1f81(0x11),'PGbOD':_0x1f81(0x12),'KdhWM':'mobile-spotify','IAfnm':_0x1f81(0x13),'gCHFT':function(_0x44d3c3,_0x477e02){return _0x44d3c3===_0x477e02;},'pLpfS':function(_0x3a3759,_0x449820){return _0x3a3759===_0x449820;},'SMQcf':function(_0x59eaad,_0x82c2d0){return _0x59eaad===_0x82c2d0;},'inqWw':function(_0x3b6341,_0x5c0f59){return _0x3b6341===_0x5c0f59;},'LcKUF':function(_0x51ddf3,_0x5d2c31){return _0x51ddf3===_0x5d2c31;},'FLDjW':function(_0x412c93,_0xe481f9){return _0x412c93===_0xe481f9;},'gEAdE':function(_0xa2eaf1,_0x150008){return _0xa2eaf1===_0x150008;},'AhltH':function(_0x3fadd5,_0xcc9248){return _0x3fadd5===_0xcc9248;},'AguQq':'medium_term','gJaAP':function(_0x19b8bb,_0x3656d0){return _0x19b8bb===_0x3656d0;},'njqkO':function(_0x5eefde,_0x17dd6f){return _0x5eefde===_0x17dd6f;},'YqVVc':function(_0x48c10b,_0x3bc3ef){return _0x48c10b===_0x3bc3ef;},'PSjxr':function(_0x2f7849,_0x4178fe){return _0x2f7849===_0x4178fe;},'erAAV':function(_0x3c3b15,_0x230b82){return _0x3c3b15===_0x230b82;},'rxzLy':function(_0x59556d,_0x3a212e){return _0x59556d===_0x3a212e;},'efCSI':_0x1f81(0x14),'kRcOu':function(_0x19c924,_0xeceea5,_0x1eede6){return _0x19c924(_0xeceea5,_0x1eede6);},'TqZZH':function(_0x318bb0,_0xb0f4ec){return _0x318bb0!==_0xb0f4ec;},'jvkgG':_0x1f81(0x15),'fpXio':_0x1f81(0x16)};var _0x44e816,_0x383ee9,_0x50ac77,_0x5a235d,_0x26c7d9,_0x5407db;console[_0x1f81(0x17)](_0x1f81(0x18),_0x1aebce),console['log'](_0x47b789[_0x1f81(0x19)],(_0x47b789[_0x1f81(0x1a)](_0x44e816=_0x4ac40b[_0x1f81(0x1b)],null)||_0x47b789['pPTLR'](_0x44e816,void 0x0)||_0x47b789[_0x1f81(0x1c)](_0x44e816=_0x44e816['items'],null)||_0x47b789[_0x1f81(0x1c)](_0x44e816,void 0x0)?void 0x0:_0x44e816['length'])||0x0),console[_0x1f81(0x17)](_0x47b789[_0x1f81(0x1d)],(_0x47b789['hkLku'](_0x383ee9=_0x4ac40b['topItems'],null)||_0x383ee9===void 0x0||_0x47b789[_0x1f81(0x1c)](_0x383ee9=_0x383ee9['tracks'],null)||_0x47b789[_0x1f81(0x1e)](_0x383ee9,void 0x0)?void 0x0:_0x383ee9[_0x1f81(0x1f)])||0x0),console['log'](_0x47b789[_0x1f81(0x20)],((_0x50ac77=_0x4ac40b['topItems'])===null||_0x47b789[_0x1f81(0x21)](_0x50ac77,void 0x0)||_0x47b789[_0x1f81(0x1a)](_0x50ac77=_0x50ac77[_0x1f81(0x22)],null)||_0x47b789[_0x1f81(0x23)](_0x50ac77,void 0x0)?void 0x0:_0x50ac77[_0x1f81(0x1f)])||0x0),console[_0x1f81(0x17)](_0x47b789[_0x1f81(0x24)],(_0x47b789[_0x1f81(0x1c)](_0x5a235d=_0x4ac40b[_0x1f81(0x25)],null)||_0x47b789[_0x1f81(0x21)](_0x5a235d,void 0x0)?void 0x0:_0x5a235d[_0x1f81(0x1f)])||0x0),console[_0x1f81(0x17)](_0x1f81(0x26),(_0x47b789[_0x1f81(0x1c)](_0x26c7d9=_0x4ac40b[_0x1f81(0x27)],null)||_0x26c7d9===void 0x0?void 0x0:_0x26c7d9[_0x1f81(0x1f)])||0x0),console[_0x1f81(0x17)](_0x47b789[_0x1f81(0x28)],((_0x5407db=_0x4ac40b['savedAlbums'])===null||_0x47b789[_0x1f81(0x29)](_0x5407db,void 0x0)?void 0x0:_0x5407db[_0x1f81(0x1f)])||0x0),console['log'](_0x1f81(0x2a),!!_0x4ac40b[_0x1f81(0x2b)]);if(!_0x1aebce)return console[_0x1f81(0x2c)](_0x47b789['rOxxd']),{'success':![],'error':_0x47b789[_0x1f81(0x2d)]};try{var _0x54aadb,_0x114866,_0x3f2653,_0x11b585,_0x5230b5,_0x1ce582,_0x35f767,_0xd9550f,_0x32b3bc,_0x54c7d8,_0x9cab62,_0xc8572c,_0x46e5ae,_0x2707ad,_0x46bc30;const _0x587a25=await _asyncStorage['default'][_0x1f81(0x2e)](_0x1f81(0x2f))||await _asyncStorage['default'][_0x1f81(0x2e)](_0x47b789['DPVku'])||await _asyncStorage[_0x1f81(0x30)][_0x1f81(0x2e)](_0x47b789['JuHGM']);if(!_0x587a25)return _0x47b789[_0x1f81(0x31)](_0x47b789[_0x1f81(0x32)],_0x47b789[_0x1f81(0x33)])?(console[_0x1f81(0x2c)](_0x47b789[_0x1f81(0x34)]),{'success':![],'error':_0x47b789[_0x1f81(0x35)]}):(_0x112110[_0x1f81(0x2c)](_0x47b789['rOxxd']),{'success':![],'error':_0x47b789['NxWHF']});console[_0x1f81(0x17)](_0x47b789[_0x1f81(0x36)]);const _0x3254cb={'platform':_reactNative[_0x1f81(0x37)]['OS'],'source':_0x1f81(0x38),'appVersion':_0x47b789[_0x1f81(0x39)],'osVersion':_reactNative['Platform']['OS']===_0x47b789[_0x1f81(0x3a)]?_0x47b789['RQeqF']:_reactNative[_0x1f81(0x37)]['OS'],'deviceModel':_0x47b789['jReba'](_reactNative[_0x1f81(0x37)]['OS'],_0x47b789[_0x1f81(0x3a)])?_0x47b789['VtMLw']:_0x47b789['PGbOD'],'isOfflineSync':![],'extractedAt':new Date()[_0x1f81(0x3b)](),'tokenExpiry':_0x4ac40b[_0x1f81(0x3c)]},_0x40e569={'platform':_0x47b789['KdhWM'],'dataType':_0x47b789['IAfnm'],'data':{'recentlyPlayed':{'items':((_0x47b789[_0x1f81(0x1e)](_0x54aadb=_0x4ac40b[_0x1f81(0x1b)],null)||_0x47b789[_0x1f81(0x1c)](_0x54aadb,void 0x0)?void 0x0:_0x54aadb[_0x1f81(0x3d)])||[])[_0x1f81(0x3e)](_0x489783=>({'trackId':_0x489783[_0x1f81(0x3f)],'name':_0x489783['name'],'artists':_0x489783[_0x1f81(0x22)],'album':_0x489783[_0x1f81(0x40)],'albumId':_0x489783[_0x1f81(0x41)],'duration':_0x489783[_0x1f81(0x42)],'playedAt':_0x489783[_0x1f81(0x43)],'imageUrl':_0x489783[_0x1f81(0x44)],'explicit':_0x489783[_0x1f81(0x45)],'popularity':_0x489783[_0x1f81(0x46)]})),'totalCount':(_0x47b789[_0x1f81(0x47)](_0x114866=_0x4ac40b[_0x1f81(0x1b)],null)||_0x47b789[_0x1f81(0x21)](_0x114866,void 0x0)?void 0x0:_0x114866['totalCount'])||(_0x47b789['pLpfS'](_0x3f2653=_0x4ac40b[_0x1f81(0x1b)],null)||_0x3f2653===void 0x0||_0x47b789['SMQcf'](_0x3f2653=_0x3f2653[_0x1f81(0x3d)],null)||_0x47b789[_0x1f81(0x48)](_0x3f2653,void 0x0)?void 0x0:_0x3f2653[_0x1f81(0x1f)])||0x0},'topItems':{'tracks':((_0x47b789[_0x1f81(0x49)](_0x11b585=_0x4ac40b[_0x1f81(0x4a)],null)||_0x11b585===void 0x0?void 0x0:_0x11b585[_0x1f81(0x4b)])||[])[_0x1f81(0x3e)](_0x292f02=>({'trackId':_0x292f02['trackId'],'name':_0x292f02[_0x1f81(0x4c)],'artists':_0x292f02['artists'],'album':_0x292f02[_0x1f81(0x40)],'imageUrl':_0x292f02['imageUrl'],'popularity':_0x292f02[_0x1f81(0x46)]})),'artists':((_0x47b789[_0x1f81(0x4d)](_0x5230b5=_0x4ac40b[_0x1f81(0x4a)],null)||_0x47b789[_0x1f81(0x4e)](_0x5230b5,void 0x0)?void 0x0:_0x5230b5['artists'])||[])[_0x1f81(0x3e)](_0x568a37=>({'artistId':_0x568a37[_0x1f81(0x4f)],'name':_0x568a37[_0x1f81(0x4c)],'genres':_0x568a37[_0x1f81(0x50)],'imageUrl':_0x568a37[_0x1f81(0x44)],'popularity':_0x568a37[_0x1f81(0x46)],'followers':_0x568a37['followers']})),'timeRange':(_0x47b789[_0x1f81(0x51)](_0x1ce582=_0x4ac40b[_0x1f81(0x4a)],null)||_0x47b789['FLDjW'](_0x1ce582,void 0x0)?void 0x0:_0x1ce582['timeRange'])||_0x47b789[_0x1f81(0x52)]},'playlists':(_0x4ac40b['playlists']||[])[_0x1f81(0x3e)](_0x54d0f1=>({'playlistId':_0x54d0f1['playlistId'],'name':_0x54d0f1[_0x1f81(0x4c)],'description':_0x54d0f1[_0x1f81(0x53)],'isPublic':_0x54d0f1['isPublic'],'isCollaborative':_0x54d0f1[_0x1f81(0x54)],'trackCount':_0x54d0f1[_0x1f81(0x55)],'imageUrl':_0x54d0f1['imageUrl'],'owner':_0x54d0f1[_0x1f81(0x56)]})),'savedTracks':(_0x4ac40b['savedTracks']||[])[_0x1f81(0x3e)](_0x1f3c34=>({'trackId':_0x1f3c34['trackId'],'name':_0x1f3c34[_0x1f81(0x4c)],'artists':_0x1f3c34['artists'],'album':_0x1f3c34[_0x1f81(0x40)],'imageUrl':_0x1f3c34[_0x1f81(0x44)]})),'savedAlbums':(_0x4ac40b[_0x1f81(0x57)]||[])['map'](_0x2061bf=>({'albumId':_0x2061bf[_0x1f81(0x41)],'name':_0x2061bf[_0x1f81(0x4c)],'artists':_0x2061bf[_0x1f81(0x22)],'releaseDate':_0x2061bf[_0x1f81(0x58)],'trackCount':_0x2061bf[_0x1f81(0x55)],'imageUrl':_0x2061bf[_0x1f81(0x44)],'savedAt':_0x2061bf[_0x1f81(0x59)]})),'profile':_0x4ac40b[_0x1f81(0x2b)]?{'userId':_0x4ac40b['profile'][_0x1f81(0x5a)],'displayName':_0x4ac40b[_0x1f81(0x2b)][_0x1f81(0x5b)],'country':_0x4ac40b[_0x1f81(0x2b)]['country'],'subscription':_0x4ac40b[_0x1f81(0x2b)][_0x1f81(0x5c)],'followers':_0x4ac40b[_0x1f81(0x2b)]['followers'],'imageUrl':_0x4ac40b['profile'][_0x1f81(0x44)]}:null,'spotifyUserId':_0x4ac40b[_0x1f81(0x5a)]||(_0x47b789['AhltH'](_0x35f767=_0x4ac40b['profile'],null)||_0x47b789['KtEyq'](_0x35f767,void 0x0)?void 0x0:_0x35f767[_0x1f81(0x5a)])},'summary':{'recentlyPlayedCount':(_0x47b789[_0x1f81(0x4e)](_0xd9550f=_0x4ac40b['recentlyPlayed'],null)||_0x47b789['gJaAP'](_0xd9550f,void 0x0)||_0x47b789[_0x1f81(0x5d)](_0xd9550f=_0xd9550f['items'],null)||_0x47b789[_0x1f81(0x5e)](_0xd9550f,void 0x0)?void 0x0:_0xd9550f[_0x1f81(0x1f)])||0x0,'topTracksCount':(_0x47b789[_0x1f81(0x4e)](_0x32b3bc=_0x4ac40b[_0x1f81(0x4a)],null)||_0x47b789[_0x1f81(0x1a)](_0x32b3bc,void 0x0)||_0x47b789[_0x1f81(0x1c)](_0x32b3bc=_0x32b3bc[_0x1f81(0x4b)],null)||_0x47b789[_0x1f81(0x5f)](_0x32b3bc,void 0x0)?void 0x0:_0x32b3bc[_0x1f81(0x1f)])||0x0,'topArtistsCount':(_0x47b789[_0x1f81(0x21)](_0x54c7d8=_0x4ac40b[_0x1f81(0x4a)],null)||_0x47b789['MMayl'](_0x54c7d8,void 0x0)||_0x47b789[_0x1f81(0x1c)](_0x54c7d8=_0x54c7d8[_0x1f81(0x22)],null)||_0x47b789[_0x1f81(0x1e)](_0x54c7d8,void 0x0)?void 0x0:_0x54c7d8['length'])||0x0,'playlistCount':(_0x47b789[_0x1f81(0x48)](_0x9cab62=_0x4ac40b['playlists'],null)||_0x47b789[_0x1f81(0x5f)](_0x9cab62,void 0x0)?void 0x0:_0x9cab62[_0x1f81(0x1f)])||0x0,'savedTracksCount':(_0x47b789[_0x1f81(0x47)](_0xc8572c=_0x4ac40b[_0x1f81(0x27)],null)||_0x47b789['YqVVc'](_0xc8572c,void 0x0)?void 0x0:_0xc8572c[_0x1f81(0x1f)])||0x0,'savedAlbumsCount':(_0x47b789[_0x1f81(0x48)](_0x46e5ae=_0x4ac40b[_0x1f81(0x57)],null)||_0x47b789[_0x1f81(0x1a)](_0x46e5ae,void 0x0)?void 0x0:_0x46e5ae[_0x1f81(0x1f)])||0x0,'subscription':(_0x47b789['erAAV'](_0x2707ad=_0x4ac40b[_0x1f81(0x2b)],null)||_0x47b789[_0x1f81(0x60)](_0x2707ad,void 0x0)?void 0x0:_0x2707ad[_0x1f81(0x5c)])||_0x1f81(0x61),'displayName':(_0x47b789[_0x1f81(0x29)](_0x46bc30=_0x4ac40b[_0x1f81(0x2b)],null)||_0x47b789[_0x1f81(0x62)](_0x46bc30,void 0x0)?void 0x0:_0x46bc30['displayName'])||_0x1f81(0x61)},'mobileMetadata':_0x3254cb};console[_0x1f81(0x17)](_0x1f81(0x63)),console['log'](_0x47b789['efCSI'],_api[_0x1f81(0x64)][_0x1f81(0x65)]+_0x1f81(0x66));const _0x505122=await _0x47b789[_0x1f81(0x67)](fetch,_api['API_CONFIG'][_0x1f81(0x65)]+_0x1f81(0x66),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x1f81(0x68)+_0x587a25,'User-Agent':_0x1f81(0x69)+_reactNative[_0x1f81(0x37)]['OS']+')'},'body':JSON['stringify'](_0x40e569)}),_0x18a7c6=await _0x505122[_0x1f81(0x6a)]();return _0x505122['ok']?(console[_0x1f81(0x17)]('✅\x20[SPOTIFY_SERVICE]\x20Successfully\x20stored\x20Spotify\x20data'),_0x18a7c6[_0x1f81(0x6b)]&&console[_0x1f81(0x17)]('📝\x20[SPOTIFY_SERVICE]\x20Backend\x20response:\x20'+_0x18a7c6['message']),{'success':!![],'message':_0x18a7c6['message']||_0x47b789[_0x1f81(0x6c)],'data':_0x18a7c6['data']}):_0x47b789['TqZZH'](_0x47b789[_0x1f81(0x6d)],_0x1f81(0x15))?(_0x4724a3['log'](_0x47b789['ipVLn']),_0x36006d[_0x1f81(0x6b)]&&_0x32b04f['log']('📝\x20[SPOTIFY_SERVICE]\x20Backend\x20response:\x20'+_0x3db176[_0x1f81(0x6b)]),{'success':!![],'message':_0x456e31[_0x1f81(0x6b)]||_0x47b789['AAZEj'],'data':_0x215499[_0x1f81(0x6e)]}):(console[_0x1f81(0x6f)]('⚠️\x20[SPOTIFY_SERVICE]\x20Backend\x20returned\x20status:\x20'+_0x505122['status']),console[_0x1f81(0x6f)](_0x1f81(0x70)+(_0x18a7c6[_0x1f81(0x2c)]||_0x47b789[_0x1f81(0x71)])),{'success':![],'error':_0x18a7c6['error']||_0x1f81(0x72)+_0x505122[_0x1f81(0x73)]});}catch(_0x425628){return console[_0x1f81(0x2c)](_0x1f81(0x74),_0x425628),{'success':![],'error':_0x425628[_0x1f81(0x6b)]||_0x1f81(0x75)};}};exports['storeSpotifyData']=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