@onairos/react-native 3.7.2 â 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/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/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 +1,134 @@
|
|
|
1
|
-
import{storeSephoraData}from'./sephoraDataService';import{Alert}from'react-native';function _0x4999(_0x51464c,_0x499973){_0x51464c=_0x51464c-0x0;const _0x33d378=_0x5146();let _0x4dde1c=_0x33d378[_0x51464c];return _0x4dde1c;}export const useSephoraDataExtractor=()=>{const _0x5268d3={'IPACO':function(_0x388d4c,_0x4428c7){return _0x388d4c!==_0x4428c7;},'tXNwA':_0x4999(0x0),'AvmGZ':function(_0x5058ad,_0x4319e1){return _0x5058ad===_0x4319e1;},'pChby':_0x4999(0x1),'cfCkD':function(_0x3ea67c,_0x479918){return _0x3ea67c-_0x479918;},'jonrM':_0x4999(0x2),'lATZD':_0x4999(0x3),'KxhvP':_0x4999(0x4),'vGCru':'clKCY','SwNNu':_0x4999(0x5),'fKNmE':_0x4999(0x6),'cQFRl':'â\x20[SEPHORA_EXTRACTOR]\x20Username\x20is\x20required','bWIjx':_0x4999(0x7),'YjSaE':_0x4999(0x8),'nySXz':_0x4999(0x9),'fTyHI':_0x4999(0xa),'zuLbH':function(_0x33963f,_0x38e449){return _0x33963f+_0x38e449;},'YmFFY':function(_0x400eb5,_0x32ea7a){return _0x400eb5===_0x32ea7a;},'YymfX':function(_0x256877,_0x479cbc){return _0x256877===_0x479cbc;},'poDxx':function(_0x5c07a1,_0x45cf6){return _0x5c07a1===_0x45cf6;},'puYKH':function(_0x52cf0e,_0x42c018){return _0x52cf0e===_0x42c018;},'oeZXt':function(_0x3b724e,_0x5db6be){return _0x3b724e===_0x5db6be;},'VlCQm':function(_0x1c6acb,_0x463bc2){return _0x1c6acb===_0x463bc2;},'ycbqe':function(_0x449cdf,_0x5cc113){return _0x449cdf===_0x5cc113;},'ZBWza':function(_0xaa8f32,_0x19d5d2){return _0xaa8f32===_0x19d5d2;},'gIJkr':_0x4999(0xb),'XQmhB':function(_0x3eaa5b,_0x2c472d){return _0x3eaa5b===_0x2c472d;},'eZufB':function(_0x5e45a7,_0x27d7a6){return _0x5e45a7===_0x27d7a6;},'JnVhm':function(_0x28596a,_0x17daf6){return _0x28596a===_0x17daf6;},'siPVx':function(_0x3b5e21,_0x162f3c){return _0x3b5e21===_0x162f3c;},'DNuKA':function(_0x151595,_0x241a4c){return _0x151595===_0x241a4c;},'odbLR':function(_0x3291f8,_0x163f7f){return _0x3291f8+_0x163f7f;},'RdRRL':function(_0x13b7a2,_0x3eb97e){return _0x13b7a2+_0x3eb97e;},'qBdgA':function(_0x557756,_0xfda8ac){return _0x557756<_0xfda8ac;},'Vxfcz':function(_0x38382f,_0x108e7c){return _0x38382f-_0x108e7c;},'KdGmU':_0x4999(0xc),'efyiN':function(_0x1f994c,_0x1b6345){return _0x1f994c===_0x1b6345;},'EnRIS':_0x4999(0xd),'jKAXd':_0x4999(0xe),'nXasw':_0x4999(0xf),'AfywL':_0x4999(0x10),'KjXNU':_0x4999(0x11),'YkfLE':_0x4999(0x12),'hmQFK':_0x4999(0x13),'cOeWb':_0x4999(0x14),'jkVJb':_0x4999(0x15)},_0x1f1696=async(_0x5527bd,_0x4461a0)=>{const _0x2eac0d={'QlGIK':_0x4999(0x16),'BfHjq':_0x5268d3['jonrM'],'RmlAa':_0x5268d3[_0x4999(0x17)],'RwXyX':_0x5268d3[_0x4999(0x18)],'GnWIq':_0x5268d3[_0x4999(0x19)],'qPblx':_0x5268d3[_0x4999(0x1a)],'LNcnf':_0x4999(0x1b),'djbCr':_0x5268d3[_0x4999(0x1c)],'KHDXL':_0x5268d3[_0x4999(0x1d)],'WTKsx':_0x5268d3[_0x4999(0x1e)]};var _0x1eff79,_0x59f6fd,_0x5e51e,_0x28fac1,_0x3e7899,_0x48cf7a,_0x714da2,_0x43097e,_0x498b16;console[_0x4999(0x1f)](_0x5268d3[_0x4999(0x20)]),console['log'](_0x4999(0x21),_0x5527bd),console[_0x4999(0x1f)](_0x5268d3[_0x4999(0x22)],_0x4461a0['summary']);if(!_0x5527bd)return console['error'](_0x4999(0x23)),Alert[_0x4999(0x24)](_0x5268d3[_0x4999(0x1e)],_0x5268d3[_0x4999(0x25)],[{'text':'OK','style':_0x5268d3[_0x4999(0x17)]}]),![];const _0xaf6303=_0x5268d3['zuLbH'](((_0x5268d3[_0x4999(0x26)](_0x1eff79=_0x4461a0[_0x4999(0x27)],null)||_0x5268d3[_0x4999(0x28)](_0x1eff79,void 0x0)||_0x5268d3[_0x4999(0x29)](_0x1eff79=_0x1eff79[_0x4999(0x2a)],null)||_0x5268d3[_0x4999(0x2b)](_0x1eff79,void 0x0)?void 0x0:_0x1eff79[_0x4999(0x2c)])||0x0)+((_0x5268d3[_0x4999(0x2d)](_0x59f6fd=_0x4461a0['orders'],null)||_0x5268d3[_0x4999(0x2e)](_0x59f6fd,void 0x0)?void 0x0:_0x59f6fd[_0x4999(0x2c)])||0x0),(_0x5268d3['oeZXt'](_0x5e51e=_0x4461a0[_0x4999(0x2f)],null)||_0x5268d3[_0x4999(0x28)](_0x5e51e,void 0x0)?void 0x0:_0x5e51e[_0x4999(0x2c)])||0x0)+((_0x5268d3['YymfX'](_0x28fac1=_0x4461a0['ratings'],null)||_0x5268d3[_0x4999(0x30)](_0x28fac1,void 0x0)?void 0x0:_0x28fac1[_0x4999(0x2c)])||0x0);if(_0x5268d3[_0x4999(0x31)](_0xaf6303,0x0))return console[_0x4999(0x1f)](_0x5268d3[_0x4999(0x32)]),!![];const _0x56d38f=(((_0x3e7899=_0x4461a0[_0x4999(0x27)])===null||_0x5268d3[_0x4999(0x2e)](_0x3e7899,void 0x0)?void 0x0:_0x3e7899[_0x4999(0x2a)])||[])['filter'](_0x1be5ab=>{const _0x5bd8db=_0x1be5ab['id']&&_0x1be5ab['name'];return!_0x5bd8db&&console[_0x4999(0x33)](_0x2eac0d['QlGIK'],_0x1be5ab),_0x5bd8db;}),_0x3f3909=(_0x4461a0[_0x4999(0x34)]||[])[_0x4999(0x35)](_0x3e4b6d=>{const _0x9c27b4={'LMBGO':_0x2eac0d[_0x4999(0x36)],'IGnum':_0x4999(0x11),'Cnyep':_0x2eac0d['RmlAa']},_0x96ae43=_0x3e4b6d[_0x4999(0x37)]&&_0x3e4b6d[_0x4999(0x38)];if(!_0x96ae43){if(_0x2eac0d[_0x4999(0x39)]===_0x2eac0d[_0x4999(0x3a)])return _0x226197[_0x4999(0x3b)](_0x9c27b4[_0x4999(0x3c)],_0x4c1b76[_0x4999(0x3b)]),Alert[_0x4999(0x24)]('Export\x20Failed',_0x290c47['error']||_0x9c27b4[_0x4999(0x3d)],[{'text':'OK','style':_0x9c27b4[_0x4999(0x3e)]}]),![];else console[_0x4999(0x33)](_0x2eac0d[_0x4999(0x3f)],_0x3e4b6d);}return _0x96ae43;}),_0x18e067=(_0x4461a0['loves']||[])[_0x4999(0x35)](_0x64a4cd=>{const _0x4e294e=_0x64a4cd['id']&&_0x64a4cd['name'];return!_0x4e294e&&(_0x2eac0d[_0x4999(0x40)]!=='UnKkm'?console[_0x4999(0x33)](_0x2eac0d[_0x4999(0x41)],_0x64a4cd):_0x1307da['warn'](_0x4999(0x42),_0x1a5cd6)),_0x4e294e;}),_0x4e6295=(_0x4461a0[_0x4999(0x43)]||[])['filter'](_0x2ad3ea=>{if(_0x5268d3[_0x4999(0x44)](_0x4999(0x45),_0x4999(0x46))){const _0x2daa0e=_0x2ad3ea[_0x4999(0x47)]&&typeof _0x2ad3ea[_0x4999(0x48)]===_0x5268d3[_0x4999(0x49)];return!_0x2daa0e&&(_0x5268d3['AvmGZ'](_0x5268d3[_0x4999(0x4a)],_0x4999(0x1))?console[_0x4999(0x33)]('â ī¸\x20[SEPHORA_EXTRACTOR]\x20Invalid\x20rating:',_0x2ad3ea):_0x264d7b[_0x4999(0x33)](_0x2eac0d[_0x4999(0x4b)],_0x13c923)),_0x2daa0e;}else{const _0x21451a=_0x2155ed['id']&&_0x14823a['name'];return!_0x21451a&&_0x1ece67[_0x4999(0x33)](_0x2eac0d[_0x4999(0x4b)],_0x32cf64),_0x21451a;}}),_0x58c6ac=_0x5268d3[_0x4999(0x4c)](_0x5268d3[_0x4999(0x4c)](_0x5268d3[_0x4999(0x4c)](((_0x48cf7a=_0x4461a0[_0x4999(0x27)])===null||_0x5268d3[_0x4999(0x4d)](_0x48cf7a,void 0x0)||_0x5268d3[_0x4999(0x2d)](_0x48cf7a=_0x48cf7a[_0x4999(0x2a)],null)||_0x5268d3['eZufB'](_0x48cf7a,void 0x0)?void 0x0:_0x48cf7a[_0x4999(0x2c)])||0x0,((_0x714da2=_0x4461a0[_0x4999(0x34)])===null||_0x5268d3[_0x4999(0x31)](_0x714da2,void 0x0)?void 0x0:_0x714da2[_0x4999(0x2c)])||0x0),(_0x5268d3[_0x4999(0x4e)](_0x43097e=_0x4461a0[_0x4999(0x2f)],null)||_0x5268d3[_0x4999(0x4f)](_0x43097e,void 0x0)?void 0x0:_0x43097e[_0x4999(0x2c)])||0x0),(_0x5268d3['DNuKA'](_0x498b16=_0x4461a0['ratings'],null)||_0x498b16===void 0x0?void 0x0:_0x498b16[_0x4999(0x2c)])||0x0),_0xe7e474=_0x5268d3[_0x4999(0x50)](_0x5268d3[_0x4999(0x51)](_0x56d38f['length'],_0x3f3909[_0x4999(0x2c)]),_0x18e067[_0x4999(0x2c)])+_0x4e6295[_0x4999(0x2c)];_0x5268d3[_0x4999(0x52)](_0xe7e474,_0x58c6ac)&&console[_0x4999(0x33)](_0x4999(0x53)+_0x5268d3['Vxfcz'](_0x58c6ac,_0xe7e474)+_0x4999(0x54));try{var _0x53ae34;console[_0x4999(0x1f)](_0x5268d3[_0x4999(0x55)]);const _0x2b1840=await storeSephoraData(_0x5527bd,{'basket':{'items':_0x56d38f,'total':(_0x5268d3[_0x4999(0x2d)](_0x53ae34=_0x4461a0['basket'],null)||_0x5268d3['efyiN'](_0x53ae34,void 0x0)?void 0x0:_0x53ae34[_0x4999(0x56)])||0x0,'itemCount':_0x56d38f['length']},'orders':_0x3f3909,'loves':_0x18e067,'ratings':_0x4e6295,'userId':_0x4461a0[_0x4999(0x57)]});if(_0x2b1840[_0x4999(0x58)]){if('CsvDN'!==_0x5268d3[_0x4999(0x59)])return console[_0x4999(0x1f)](_0x5268d3[_0x4999(0x5a)]),console['log'](_0x5268d3['nXasw'],_0x2b1840[_0x4999(0x5b)]),!![];else _0x261281[_0x4999(0x33)](_0x4999(0x53)+_0x5268d3[_0x4999(0x5c)](_0x3f291a,_0x3bfcf4)+_0x4999(0x54));}else return _0x5268d3[_0x4999(0x44)](_0x5268d3['AfywL'],_0x5268d3[_0x4999(0x5d)])?(_0x435082[_0x4999(0x3b)](_0x2eac0d[_0x4999(0x5e)]),Alert[_0x4999(0x24)](_0x2eac0d[_0x4999(0x5f)],'Username\x20is\x20required\x20to\x20export\x20Sephora\x20data.',[{'text':'OK','style':_0x2eac0d[_0x4999(0x60)]}]),![]):(console['error'](_0x5268d3[_0x4999(0x61)],_0x2b1840['error']),Alert[_0x4999(0x24)](_0x4999(0x62),_0x2b1840[_0x4999(0x3b)]||_0x5268d3['KjXNU'],[{'text':'OK','style':_0x5268d3[_0x4999(0x17)]}]),![]);}catch(_0x340ac6){if(_0x5268d3[_0x4999(0x63)]===_0x5268d3[_0x4999(0x63)])return console[_0x4999(0x3b)](_0x5268d3[_0x4999(0x64)],_0x340ac6),Alert[_0x4999(0x24)](_0x5268d3[_0x4999(0x65)],_0x5268d3[_0x4999(0x66)],[{'text':'OK','style':_0x5268d3[_0x4999(0x17)]}]),![];else _0x1cb27e[_0x4999(0x33)](_0x2eac0d['djbCr'],_0x748bff);}};return{'initiateDataExport':_0x1f1696};};function _0x5146(){const _0x1c5688=['number','xjgft','â\x20[SEPHORA_EXTRACTOR]\x20Backend\x20storage\x20failed:','default','jhNIs','â ī¸\x20[SEPHORA_EXTRACTOR]\x20Invalid\x20order:','â ī¸\x20[SEPHORA_EXTRACTOR]\x20Invalid\x20loved\x20item:','Error','đ\x20[SEPHORA_EXTRACTOR]\x20Initiating\x20data\x20export','đ\x20[SEPHORA_EXTRACTOR]\x20Summary:','Username\x20is\x20required\x20to\x20export\x20Sephora\x20data.','âšī¸\x20[SEPHORA_EXTRACTOR]\x20No\x20data\x20to\x20export\x20-\x20treating\x20as\x20success\x20(connected)','đĄ\x20[SEPHORA_EXTRACTOR]\x20Sending\x20to\x20backend...','dPYQG','â
\x20[SEPHORA_EXTRACTOR]\x20Export\x20completed\x20successfully','đ\x20[SEPHORA_EXTRACTOR]\x20Backend\x20response:','ZBEoV','An\x20unknown\x20error\x20occurred\x20during\x20data\x20storage.','EqkuM','â\x20[SEPHORA_EXTRACTOR]\x20Unexpected\x20error\x20during\x20export:','Export\x20Error','Failed\x20to\x20connect\x20to\x20the\x20data\x20storage\x20service.\x20Please\x20check\x20your\x20network\x20connection.','â ī¸\x20[SEPHORA_EXTRACTOR]\x20Invalid\x20basket\x20item:','lATZD','KxhvP','vGCru','SwNNu','RFncG','fKNmE','cQFRl','bWIjx','log','YjSaE','đ¤\x20[SEPHORA_EXTRACTOR]\x20Username:','nySXz','â\x20[SEPHORA_EXTRACTOR]\x20Username\x20is\x20required','alert','fTyHI','YmFFY','basket','YymfX','poDxx','items','puYKH','length','oeZXt','VlCQm','loves','ycbqe','ZBWza','gIJkr','warn','orders','filter','BfHjq','orderId','date','RwXyX','GnWIq','error','LMBGO','IGnum','Cnyep','qPblx','LNcnf','djbCr','â ī¸\x20[SEPHORA_EXTRACTOR]\x20Invalid\x20rating:','ratings','IPACO','XaTVA','oIywM','productId','rating','tXNwA','pChby','QlGIK','zuLbH','XQmhB','JnVhm','siPVx','odbLR','RdRRL','qBdgA','â ī¸\x20[SEPHORA_EXTRACTOR]\x20Filtered\x20out\x20','\x20invalid\x20items','KdGmU','total','userId','success','EnRIS','jKAXd','data','cfCkD','AfywL','KHDXL','WTKsx','RmlAa','jonrM','Export\x20Failed','YkfLE','hmQFK','cOeWb','jkVJb'];_0x5146=function(){return _0x1c5688;};return _0x5146();}
|
|
1
|
+
/**
|
|
2
|
+
* Sephora Data Extractor
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates the Sephora data export flow:
|
|
5
|
+
* 1. Receives extracted shopping data from WebView
|
|
6
|
+
* 2. Validates and formats data
|
|
7
|
+
* 3. Sends to backend via sephoraDataService
|
|
8
|
+
*
|
|
9
|
+
* This acts as the bridge between OAuthWebView and the backend API.
|
|
10
|
+
*
|
|
11
|
+
* @reference ChatGPT implementation: src/services/chatGPTConversationExtractor.ts
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { storeSephoraData } from './sephoraDataService';
|
|
15
|
+
import { Alert } from 'react-native';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Combined Sephora export data from WebView
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Hook for Sephora data extraction operations
|
|
23
|
+
*/
|
|
24
|
+
export const useSephoraDataExtractor = () => {
|
|
25
|
+
/**
|
|
26
|
+
* Initiate data export to backend
|
|
27
|
+
*
|
|
28
|
+
* @param username - User identifier
|
|
29
|
+
* @param data - Extracted Sephora data (basket, orders, loves, ratings)
|
|
30
|
+
* @returns true if successful, false otherwise
|
|
31
|
+
*/
|
|
32
|
+
const initiateDataExport = async (username, data) => {
|
|
33
|
+
var _data$basket, _data$orders, _data$loves, _data$ratings, _data$basket2, _data$basket3, _data$orders2, _data$loves2, _data$ratings2;
|
|
34
|
+
console.log('đ [SEPHORA_EXTRACTOR] Initiating data export');
|
|
35
|
+
console.log('đ¤ [SEPHORA_EXTRACTOR] Username:', username);
|
|
36
|
+
console.log('đ [SEPHORA_EXTRACTOR] Summary:', data.summary);
|
|
37
|
+
|
|
38
|
+
// Validation
|
|
39
|
+
if (!username) {
|
|
40
|
+
console.error('â [SEPHORA_EXTRACTOR] Username is required');
|
|
41
|
+
Alert.alert('Error', 'Username is required to export Sephora data.', [{
|
|
42
|
+
text: 'OK',
|
|
43
|
+
style: 'default'
|
|
44
|
+
}]);
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Handle empty data as success - user might be new
|
|
49
|
+
const totalItems = (((_data$basket = data.basket) === null || _data$basket === void 0 || (_data$basket = _data$basket.items) === null || _data$basket === void 0 ? void 0 : _data$basket.length) || 0) + (((_data$orders = data.orders) === null || _data$orders === void 0 ? void 0 : _data$orders.length) || 0) + (((_data$loves = data.loves) === null || _data$loves === void 0 ? void 0 : _data$loves.length) || 0) + (((_data$ratings = data.ratings) === null || _data$ratings === void 0 ? void 0 : _data$ratings.length) || 0);
|
|
50
|
+
if (totalItems === 0) {
|
|
51
|
+
console.log('âšī¸ [SEPHORA_EXTRACTOR] No data to export - treating as success (connected)');
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Validate basket items
|
|
56
|
+
const validBasketItems = (((_data$basket2 = data.basket) === null || _data$basket2 === void 0 ? void 0 : _data$basket2.items) || []).filter(item => {
|
|
57
|
+
const isValid = item.id && item.name;
|
|
58
|
+
if (!isValid) {
|
|
59
|
+
console.warn('â ī¸ [SEPHORA_EXTRACTOR] Invalid basket item:', item);
|
|
60
|
+
}
|
|
61
|
+
return isValid;
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Validate orders
|
|
65
|
+
const validOrders = (data.orders || []).filter(order => {
|
|
66
|
+
const isValid = order.orderId && order.date;
|
|
67
|
+
if (!isValid) {
|
|
68
|
+
console.warn('â ī¸ [SEPHORA_EXTRACTOR] Invalid order:', order);
|
|
69
|
+
}
|
|
70
|
+
return isValid;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Validate loved products
|
|
74
|
+
const validLoves = (data.loves || []).filter(love => {
|
|
75
|
+
const isValid = love.id && love.name;
|
|
76
|
+
if (!isValid) {
|
|
77
|
+
console.warn('â ī¸ [SEPHORA_EXTRACTOR] Invalid loved item:', love);
|
|
78
|
+
}
|
|
79
|
+
return isValid;
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// Validate ratings
|
|
83
|
+
const validRatings = (data.ratings || []).filter(rating => {
|
|
84
|
+
const isValid = rating.productId && typeof rating.rating === 'number';
|
|
85
|
+
if (!isValid) {
|
|
86
|
+
console.warn('â ī¸ [SEPHORA_EXTRACTOR] Invalid rating:', rating);
|
|
87
|
+
}
|
|
88
|
+
return isValid;
|
|
89
|
+
});
|
|
90
|
+
const originalCount = (((_data$basket3 = data.basket) === null || _data$basket3 === void 0 || (_data$basket3 = _data$basket3.items) === null || _data$basket3 === void 0 ? void 0 : _data$basket3.length) || 0) + (((_data$orders2 = data.orders) === null || _data$orders2 === void 0 ? void 0 : _data$orders2.length) || 0) + (((_data$loves2 = data.loves) === null || _data$loves2 === void 0 ? void 0 : _data$loves2.length) || 0) + (((_data$ratings2 = data.ratings) === null || _data$ratings2 === void 0 ? void 0 : _data$ratings2.length) || 0);
|
|
91
|
+
const validCount = validBasketItems.length + validOrders.length + validLoves.length + validRatings.length;
|
|
92
|
+
if (validCount < originalCount) {
|
|
93
|
+
console.warn(`â ī¸ [SEPHORA_EXTRACTOR] Filtered out ${originalCount - validCount} invalid items`);
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
var _data$basket4;
|
|
97
|
+
console.log('đĄ [SEPHORA_EXTRACTOR] Sending to backend...');
|
|
98
|
+
const result = await storeSephoraData(username, {
|
|
99
|
+
basket: {
|
|
100
|
+
items: validBasketItems,
|
|
101
|
+
total: ((_data$basket4 = data.basket) === null || _data$basket4 === void 0 ? void 0 : _data$basket4.total) || 0,
|
|
102
|
+
itemCount: validBasketItems.length
|
|
103
|
+
},
|
|
104
|
+
orders: validOrders,
|
|
105
|
+
loves: validLoves,
|
|
106
|
+
ratings: validRatings,
|
|
107
|
+
userId: data.userId
|
|
108
|
+
});
|
|
109
|
+
if (result.success) {
|
|
110
|
+
console.log('â
[SEPHORA_EXTRACTOR] Export completed successfully');
|
|
111
|
+
console.log('đ [SEPHORA_EXTRACTOR] Backend response:', result.data);
|
|
112
|
+
return true;
|
|
113
|
+
} else {
|
|
114
|
+
console.error('â [SEPHORA_EXTRACTOR] Backend storage failed:', result.error);
|
|
115
|
+
Alert.alert('Export Failed', result.error || 'An unknown error occurred during data storage.', [{
|
|
116
|
+
text: 'OK',
|
|
117
|
+
style: 'default'
|
|
118
|
+
}]);
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.error('â [SEPHORA_EXTRACTOR] Unexpected error during export:', error);
|
|
123
|
+
Alert.alert('Export Error', 'Failed to connect to the data storage service. Please check your network connection.', [{
|
|
124
|
+
text: 'OK',
|
|
125
|
+
style: 'default'
|
|
126
|
+
}]);
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
return {
|
|
131
|
+
initiateDataExport
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
//# sourceMappingURL=sephoraDataExtractor.js.map
|
|
@@ -1 +1,193 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Sephora Data Service
|
|
3
|
+
*
|
|
4
|
+
* API layer for storing Sephora shopping data on backend.
|
|
5
|
+
* Sends extracted basket, orders, loves, and ratings to /platform-data/store endpoint.
|
|
6
|
+
*
|
|
7
|
+
* MATCHES ChatGPT implementation pattern
|
|
8
|
+
* - Uses format: { platform, data, metadata }
|
|
9
|
+
* - Platform: "mobile-sephora"
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { API_CONFIG } from '../config/api';
|
|
13
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
14
|
+
import { Platform } from 'react-native';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Structure of a basket item
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Structure of the shopping basket
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Structure of an order item
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Structure of an order
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Structure of a loved/favorited item
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Structure of a product rating
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Combined Sephora data to store
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Response from backend endpoint
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Store Sephora data on backend
|
|
50
|
+
*
|
|
51
|
+
* @param userId - Username or identifier
|
|
52
|
+
* @param data - Sephora shopping data (basket, orders, loves, ratings)
|
|
53
|
+
* @returns Response indicating success/failure with metadata
|
|
54
|
+
*/
|
|
55
|
+
export const storeSephoraData = async (userId, data) => {
|
|
56
|
+
console.log('đ [SEPHORA_SERVICE] Storing Sephora data for:', userId);
|
|
57
|
+
console.log('đ [SEPHORA_SERVICE] Basket items:', data.basket.items.length);
|
|
58
|
+
console.log('đ [SEPHORA_SERVICE] Orders:', data.orders.length);
|
|
59
|
+
console.log('đ [SEPHORA_SERVICE] Loved items:', data.loves.length);
|
|
60
|
+
console.log('đ [SEPHORA_SERVICE] Ratings:', data.ratings.length);
|
|
61
|
+
|
|
62
|
+
// Input validation
|
|
63
|
+
if (!userId) {
|
|
64
|
+
console.error('â [SEPHORA_SERVICE] Invalid input: userId missing');
|
|
65
|
+
return {
|
|
66
|
+
success: false,
|
|
67
|
+
error: 'Invalid input: userId missing.'
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
// Get auth token - check all possible storage keys
|
|
72
|
+
const authToken = (await AsyncStorage.getItem('onairos_jwt_token')) || (await AsyncStorage.getItem('enoch_token')) || (await AsyncStorage.getItem('auth_token'));
|
|
73
|
+
if (!authToken) {
|
|
74
|
+
console.error('â [SEPHORA_SERVICE] No auth token found');
|
|
75
|
+
return {
|
|
76
|
+
success: false,
|
|
77
|
+
error: 'Authentication token not found. Please log in again.'
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
console.log('đ [SEPHORA_SERVICE] Auth token found');
|
|
81
|
+
|
|
82
|
+
// Mobile metadata
|
|
83
|
+
const mobileMetadata = {
|
|
84
|
+
platform: Platform.OS,
|
|
85
|
+
appVersion: '1.0.0',
|
|
86
|
+
osVersion: Platform.OS === 'ios' ? '17.0' : Platform.OS,
|
|
87
|
+
deviceModel: Platform.OS === 'ios' ? 'iPhone' : 'Android',
|
|
88
|
+
isOfflineSync: false,
|
|
89
|
+
extractedAt: new Date().toISOString()
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// Build request body
|
|
93
|
+
const requestBody = {
|
|
94
|
+
platform: 'mobile-sephora',
|
|
95
|
+
dataType: 'ecommerce',
|
|
96
|
+
data: {
|
|
97
|
+
basket: {
|
|
98
|
+
items: data.basket.items.map(item => ({
|
|
99
|
+
productId: item.id,
|
|
100
|
+
name: item.name,
|
|
101
|
+
brand: item.brand,
|
|
102
|
+
price: item.price,
|
|
103
|
+
quantity: item.quantity,
|
|
104
|
+
category: item.category,
|
|
105
|
+
imageUrl: item.imageUrl
|
|
106
|
+
})),
|
|
107
|
+
total: data.basket.total,
|
|
108
|
+
itemCount: data.basket.itemCount
|
|
109
|
+
},
|
|
110
|
+
orders: data.orders.map(order => ({
|
|
111
|
+
orderId: order.orderId,
|
|
112
|
+
date: order.date,
|
|
113
|
+
total: order.total,
|
|
114
|
+
status: order.status,
|
|
115
|
+
items: order.items.map(item => ({
|
|
116
|
+
productId: item.id,
|
|
117
|
+
name: item.name,
|
|
118
|
+
brand: item.brand,
|
|
119
|
+
price: item.price,
|
|
120
|
+
quantity: item.quantity
|
|
121
|
+
}))
|
|
122
|
+
})),
|
|
123
|
+
loves: data.loves.map(love => ({
|
|
124
|
+
productId: love.id,
|
|
125
|
+
name: love.name,
|
|
126
|
+
brand: love.brand,
|
|
127
|
+
category: love.category,
|
|
128
|
+
price: love.price,
|
|
129
|
+
rating: love.rating,
|
|
130
|
+
addedAt: love.addedAt,
|
|
131
|
+
type: 'love'
|
|
132
|
+
})),
|
|
133
|
+
ratings: data.ratings.map(rating => ({
|
|
134
|
+
productId: rating.productId,
|
|
135
|
+
productName: rating.productName,
|
|
136
|
+
score: rating.rating,
|
|
137
|
+
review: rating.review,
|
|
138
|
+
date: rating.date,
|
|
139
|
+
isRecommended: rating.isRecommended,
|
|
140
|
+
sentiment: rating.type
|
|
141
|
+
})),
|
|
142
|
+
sephoraUserId: data.userId
|
|
143
|
+
},
|
|
144
|
+
summary: {
|
|
145
|
+
basketItemCount: data.basket.items.length,
|
|
146
|
+
basketTotal: data.basket.total,
|
|
147
|
+
orderCount: data.orders.length,
|
|
148
|
+
lovedProductCount: data.loves.length,
|
|
149
|
+
ratingCount: data.ratings.length,
|
|
150
|
+
positiveRatings: data.ratings.filter(r => r.type === 'positive').length,
|
|
151
|
+
negativeRatings: data.ratings.filter(r => r.type === 'negative').length
|
|
152
|
+
},
|
|
153
|
+
mobileMetadata: mobileMetadata
|
|
154
|
+
};
|
|
155
|
+
console.log('đĄ [SEPHORA_SERVICE] Sending to backend...');
|
|
156
|
+
console.log('đ [SEPHORA_SERVICE] URL:', `${API_CONFIG.BASE_URL}/platform-data/store`);
|
|
157
|
+
const response = await fetch(`${API_CONFIG.BASE_URL}/platform-data/store`, {
|
|
158
|
+
method: 'POST',
|
|
159
|
+
headers: {
|
|
160
|
+
'Content-Type': 'application/json',
|
|
161
|
+
'Authorization': `Bearer ${authToken}`,
|
|
162
|
+
'User-Agent': `OnairosSDK/1.0.0 (${Platform.OS})`
|
|
163
|
+
},
|
|
164
|
+
body: JSON.stringify(requestBody)
|
|
165
|
+
});
|
|
166
|
+
const responseData = await response.json();
|
|
167
|
+
if (response.ok) {
|
|
168
|
+
console.log('â
[SEPHORA_SERVICE] Successfully stored Sephora data');
|
|
169
|
+
if (responseData.message) {
|
|
170
|
+
console.log(`đ [SEPHORA_SERVICE] Backend response: ${responseData.message}`);
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
success: true,
|
|
174
|
+
message: responseData.message || 'Sephora data stored successfully',
|
|
175
|
+
data: responseData.data
|
|
176
|
+
};
|
|
177
|
+
} else {
|
|
178
|
+
console.warn(`â ī¸ [SEPHORA_SERVICE] Backend returned status: ${response.status}`);
|
|
179
|
+
console.warn(`â ī¸ [SEPHORA_SERVICE] Error: ${responseData.error || 'Unknown error'}`);
|
|
180
|
+
return {
|
|
181
|
+
success: false,
|
|
182
|
+
error: responseData.error || `HTTP ${response.status}`
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
} catch (error) {
|
|
186
|
+
console.error('â [SEPHORA_SERVICE] Network error:', error);
|
|
187
|
+
return {
|
|
188
|
+
success: false,
|
|
189
|
+
error: error.message || 'Network error. Please check your connection.'
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
//# sourceMappingURL=sephoraDataService.js.map
|
|
@@ -1 +1,142 @@
|
|
|
1
|
-
function _0x28bf(){const _0x2379ac=['CwdcR','fzQZs','iFfUH','â ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20saved\x20album:','â ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20recently\x20played\x20track:','UjKyl','xHaIh','â ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20saved\x20track:','WKGIQ','đ\x20[SPOTIFY_EXTRACTOR]\x20Initiating\x20data\x20export','â\x20[SPOTIFY_EXTRACTOR]\x20Username\x20is\x20required','default','â\x20[SPOTIFY_EXTRACTOR]\x20Backend\x20storage\x20failed:','QsRil','â\x20[SPOTIFY_EXTRACTOR]\x20Unexpected\x20error\x20during\x20export:','Export\x20Error','Failed\x20to\x20connect\x20to\x20the\x20data\x20storage\x20service.\x20Please\x20check\x20your\x20network\x20connection.','aXyRV','mxvsk','eGOJw','â ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20top\x20track:','uzIGI','vsTXd','MnblN','log','FyubW','đ\x20[SPOTIFY_EXTRACTOR]\x20Summary:','error','oYdjQ','Error','LcxLM','HHHCt','WRzoU','recentlyPlayed','Jcxtb','JkfpT','items','UdUUb','length','topItems','OgSHW','rXpem','artists','EBzUQ','savedTracks','savedAlbums','FKsgg','OUxta','upxvs','Cxuwc','wxJmS','filter','trackId','name','warn','IWoUq','neUFt','yFpvo','FtEic','WrsFc','JdQyK','DeeHF','mblfa','artistId','mZiKC','CJrSr','albumId','sgJLD','â ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20top\x20artist:','playlists','bjJtd','uUBMF','HxKeZ','â ī¸\x20[SPOTIFY_EXTRACTOR]\x20Filtered\x20out\x20','jsjlt','\x20invalid\x20items','mkrTn','UuWRL','eHXJA','cIYOQ','vbAbE','FMUJJ','YczDK','DcWxD','WAuTJ','scgqq','Kphny','BXzGA','sHiSQ','DtTKs','vPBzv','ILJNg','đĄ\x20[SPOTIFY_EXTRACTOR]\x20Sending\x20to\x20backend...','RpspU','wsDfF','timeRange','tokenExpiry','userId','success','gLEzO','data','vKUeD','alert','Export\x20Failed','playlistId','LndWf','RCprq','iqUbN','lykqg','cBbPO','đ\x20[SPOTIFY_EXTRACTOR]\x20Backend\x20response:'];_0x28bf=function(){return _0x2379ac;};return _0x28bf();}import{storeSpotifyData}from'./spotifyDataService';function _0x1cec(_0x28bf48,_0x1cec98){_0x28bf48=_0x28bf48-0x0;const _0x1e93a5=_0x28bf();let _0x3b4b2a=_0x1e93a5[_0x28bf48];return _0x3b4b2a;}import{Alert}from'react-native';export const useSpotifyDataExtractor=()=>{const _0xc0176e={'uzIGI':'â ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20top\x20artist:','mZiKC':_0x1cec(0x0),'CJrSr':_0x1cec(0x1),'bjJtd':function(_0x50c811,_0x64fab8){return _0x50c811-_0x64fab8;},'WRzoU':function(_0x312a65,_0x1ef19f){return _0x312a65===_0x1ef19f;},'JBIVW':'mkrTn','UuWRL':'fDobg','eHXJA':_0x1cec(0x2),'mbbBi':_0x1cec(0x3),'aXyRV':_0x1cec(0x4),'mxvsk':_0x1cec(0x5),'eGOJw':_0x1cec(0x6),'LQyMX':_0x1cec(0x7),'oYDrX':'YZGKZ','DsSFf':_0x1cec(0x8),'vsTXd':'â ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20playlist:','MnblN':'â
\x20[SPOTIFY_EXTRACTOR]\x20Export\x20completed\x20successfully','FyubW':_0x1cec(0x9),'oYdjQ':_0x1cec(0xa),'xlcqw':'Username\x20is\x20required\x20to\x20export\x20Spotify\x20data.','LcxLM':_0x1cec(0xb),'HHHCt':function(_0x24bd91,_0x2fc767){return _0x24bd91+_0x2fc767;},'Jcxtb':function(_0x50bfcf,_0x3c2dcc){return _0x50bfcf===_0x3c2dcc;},'JkfpT':function(_0xdf1806,_0x2a6b3c){return _0xdf1806===_0x2a6b3c;},'UdUUb':function(_0x131ff7,_0x1e0588){return _0x131ff7===_0x1e0588;},'OgSHW':function(_0x2780f7,_0x4115df){return _0x2780f7===_0x4115df;},'rXpem':function(_0x40d814,_0x357b18){return _0x40d814===_0x357b18;},'wsDfF':function(_0x2bad27,_0x3ff999){return _0x2bad27===_0x3ff999;},'EBzUQ':function(_0x270992,_0x431c75){return _0x270992===_0x431c75;},'FKsgg':function(_0x15effb,_0x43b7fa){return _0x15effb===_0x43b7fa;},'OUxta':function(_0x416303,_0x1f1b19){return _0x416303===_0x1f1b19;},'mblfa':function(_0x2c116a,_0x34cb0e){return _0x2c116a===_0x34cb0e;},'Cxuwc':'upxvs','wxJmS':'âšī¸\x20[SPOTIFY_EXTRACTOR]\x20No\x20data\x20to\x20export\x20-\x20treating\x20as\x20success\x20(connected)','neUFt':function(_0x5bb06e,_0x3401e6){return _0x5bb06e===_0x3401e6;},'WAuTJ':function(_0x2b4d9b,_0x5bf474){return _0x2b4d9b+_0x5bf474;},'scgqq':function(_0x3948e8,_0xd5f14e){return _0x3948e8+_0xd5f14e;},'Kphny':function(_0xa9d264,_0xf6cedb){return _0xa9d264+_0xf6cedb;},'BXzGA':function(_0x45b221,_0x442700){return _0x45b221+_0x442700;},'sHiSQ':function(_0x19a64d,_0x35e3b3){return _0x19a64d<_0x35e3b3;},'DtTKs':'WXbsG','vPBzv':function(_0x48a2ca,_0x2c8283){return _0x48a2ca===_0x2c8283;},'ILJNg':'sKiYZ','RpspU':function(_0xdf9fd,_0x4b8178,_0x4d0b82){return _0xdf9fd(_0x4b8178,_0x4d0b82);},'gLEzO':'đ\x20[SPOTIFY_EXTRACTOR]\x20Backend\x20response:','vKUeD':_0x1cec(0xc),'qyRCk':'An\x20unknown\x20error\x20occurred\x20during\x20data\x20storage.','RCprq':function(_0x41dcda,_0x18f076){return _0x41dcda!==_0x18f076;},'iqUbN':_0x1cec(0xd),'myTLX':'KpTsd','HHHNq':_0x1cec(0xe),'aVdCG':_0x1cec(0xf),'lykqg':_0x1cec(0x10)},_0xce1de=async(_0x1b0297,_0xde5c7f)=>{const _0x522c18={'IWoUq':_0xc0176e[_0x1cec(0x11)],'yFpvo':function(_0x1fe99b,_0x58995d){return _0x1fe99b!==_0x58995d;},'FtEic':_0xc0176e[_0x1cec(0x12)],'WrsFc':_0xc0176e[_0x1cec(0x13)],'JdQyK':_0x1cec(0x14),'cIYOQ':_0xc0176e[_0x1cec(0x15)],'YczDK':_0xc0176e['LQyMX'],'YPUjk':function(_0xa25a4d,_0x3f6703){return _0xa25a4d===_0x3f6703;},'vbAbE':_0xc0176e['oYDrX'],'FMUJJ':_0xc0176e['DsSFf'],'DcWxD':_0xc0176e['mbbBi'],'LndWf':_0xc0176e[_0x1cec(0x16)],'cBbPO':_0xc0176e[_0x1cec(0x17)]};var _0x16dfd7,_0xd290cc,_0x16f22b,_0x5a5328,_0x47ee3e,_0x54b888,_0x35ed12,_0x13b14f,_0x46da39;console[_0x1cec(0x18)](_0xc0176e[_0x1cec(0x19)]),console[_0x1cec(0x18)]('đ¤\x20[SPOTIFY_EXTRACTOR]\x20Username:',_0x1b0297),console['log'](_0x1cec(0x1a),_0xde5c7f['summary']);if(!_0x1b0297)return console[_0x1cec(0x1b)](_0xc0176e[_0x1cec(0x1c)]),Alert['alert'](_0x1cec(0x1d),_0xc0176e['xlcqw'],[{'text':'OK','style':_0xc0176e[_0x1cec(0x1e)]}]),![];const _0x3af243=_0xc0176e[_0x1cec(0x1f)](_0xc0176e[_0x1cec(0x1f)](_0xc0176e['HHHCt'](_0xc0176e['HHHCt'](_0xc0176e[_0x1cec(0x1f)]((_0xc0176e[_0x1cec(0x20)](_0x16dfd7=_0xde5c7f[_0x1cec(0x21)],null)||_0xc0176e[_0x1cec(0x22)](_0x16dfd7,void 0x0)||_0xc0176e[_0x1cec(0x23)](_0x16dfd7=_0x16dfd7[_0x1cec(0x24)],null)||_0xc0176e[_0x1cec(0x25)](_0x16dfd7,void 0x0)?void 0x0:_0x16dfd7[_0x1cec(0x26)])||0x0,((_0xd290cc=_0xde5c7f[_0x1cec(0x27)])===null||_0xc0176e[_0x1cec(0x20)](_0xd290cc,void 0x0)||_0xc0176e['Jcxtb'](_0xd290cc=_0xd290cc['tracks'],null)||_0xd290cc===void 0x0?void 0x0:_0xd290cc['length'])||0x0),(_0xc0176e[_0x1cec(0x28)](_0x16f22b=_0xde5c7f[_0x1cec(0x27)],null)||_0xc0176e[_0x1cec(0x29)](_0x16f22b,void 0x0)||_0xc0176e['wsDfF'](_0x16f22b=_0x16f22b[_0x1cec(0x2a)],null)||_0xc0176e['rXpem'](_0x16f22b,void 0x0)?void 0x0:_0x16f22b[_0x1cec(0x26)])||0x0),(_0xc0176e[_0x1cec(0x2b)](_0x5a5328=_0xde5c7f['playlists'],null)||_0xc0176e['JkfpT'](_0x5a5328,void 0x0)?void 0x0:_0x5a5328[_0x1cec(0x26)])||0x0),((_0x47ee3e=_0xde5c7f[_0x1cec(0x2c)])===null||_0xc0176e[_0x1cec(0x22)](_0x47ee3e,void 0x0)?void 0x0:_0x47ee3e['length'])||0x0),((_0x54b888=_0xde5c7f[_0x1cec(0x2d)])===null||_0xc0176e[_0x1cec(0x2e)](_0x54b888,void 0x0)?void 0x0:_0x54b888[_0x1cec(0x26)])||0x0);if(_0xc0176e[_0x1cec(0x2f)](_0x3af243,0x0)){if(_0xc0176e['mblfa'](_0x1cec(0x30),_0xc0176e[_0x1cec(0x31)]))return console[_0x1cec(0x18)](_0xc0176e[_0x1cec(0x32)]),!![];else{const _0x2e15b5=_0x2d3d7e['artistId']&&_0x4142a9['name'];return!_0x2e15b5&&_0x12f873['warn'](_0xc0176e['uzIGI'],_0x4f2553),_0x2e15b5;}}const _0x474c8b=((_0xc0176e[_0x1cec(0x28)](_0x35ed12=_0xde5c7f[_0x1cec(0x21)],null)||_0xc0176e[_0x1cec(0x2b)](_0x35ed12,void 0x0)?void 0x0:_0x35ed12[_0x1cec(0x24)])||[])[_0x1cec(0x33)](_0xab604=>{const _0x521e4b=_0xab604[_0x1cec(0x34)]&&_0xab604[_0x1cec(0x35)];return!_0x521e4b&&console[_0x1cec(0x36)](_0x522c18[_0x1cec(0x37)],_0xab604),_0x521e4b;}),_0x55ff91=((_0xc0176e[_0x1cec(0x38)](_0x13b14f=_0xde5c7f[_0x1cec(0x27)],null)||_0xc0176e[_0x1cec(0x38)](_0x13b14f,void 0x0)?void 0x0:_0x13b14f['tracks'])||[])[_0x1cec(0x33)](_0x35d504=>{const _0x2babc8={'DeeHF':_0x522c18[_0x1cec(0x37)]},_0x5c479a=_0x35d504[_0x1cec(0x34)]&&_0x35d504[_0x1cec(0x35)];if(!_0x5c479a){if(_0x522c18[_0x1cec(0x39)](_0x522c18[_0x1cec(0x3a)],_0x522c18[_0x1cec(0x3b)]))console[_0x1cec(0x36)](_0x522c18[_0x1cec(0x3c)],_0x35d504);else{const _0x376955=_0x443279[_0x1cec(0x34)]&&_0x5d397e[_0x1cec(0x35)];return!_0x376955&&_0x3154a5[_0x1cec(0x36)](_0x2babc8[_0x1cec(0x3d)],_0x4b3225),_0x376955;}}return _0x5c479a;}),_0x2a3485=((_0xc0176e['EBzUQ'](_0x46da39=_0xde5c7f[_0x1cec(0x27)],null)||_0xc0176e[_0x1cec(0x3e)](_0x46da39,void 0x0)?void 0x0:_0x46da39[_0x1cec(0x2a)])||[])[_0x1cec(0x33)](_0x3a7e95=>{const _0x57d06b={'sgJLD':_0x1cec(0x3)},_0x33de9d=_0x3a7e95[_0x1cec(0x3f)]&&_0x3a7e95[_0x1cec(0x35)];if(!_0x33de9d){if(_0xc0176e[_0x1cec(0x40)]===_0xc0176e[_0x1cec(0x41)]){const _0x248bff=_0x3fa01e[_0x1cec(0x42)]&&_0x3971d5[_0x1cec(0x35)];return!_0x248bff&&_0x550e16[_0x1cec(0x36)](_0x57d06b[_0x1cec(0x43)],_0x97c5b7),_0x248bff;}else console[_0x1cec(0x36)](_0x1cec(0x44),_0x3a7e95);}return _0x33de9d;}),_0x53410c=(_0xde5c7f[_0x1cec(0x45)]||[])['filter'](_0x3d49ea=>{const _0x3cfd52={'jsjlt':function(_0x1ac7a0,_0x2e0a31){return _0xc0176e[_0x1cec(0x46)](_0x1ac7a0,_0x2e0a31);}};if(_0xc0176e[_0x1cec(0x20)](_0x1cec(0x47),_0x1cec(0x48)))_0x3d827a[_0x1cec(0x36)](_0x1cec(0x49)+_0x3cfd52[_0x1cec(0x4a)](_0x4c2991,_0x1e9bd3)+_0x1cec(0x4b));else{const _0x2676f8=_0x3d49ea['playlistId']&&_0x3d49ea['name'];return!_0x2676f8&&console['warn']('â ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20playlist:',_0x3d49ea),_0x2676f8;}}),_0x1b027f=(_0xde5c7f['savedTracks']||[])[_0x1cec(0x33)](_0x3fe8ca=>{if(_0xc0176e['WRzoU'](_0xc0176e['JBIVW'],_0x1cec(0x4c))){const _0x2381a3=_0x3fe8ca[_0x1cec(0x34)]&&_0x3fe8ca[_0x1cec(0x35)];return!_0x2381a3&&(_0xc0176e[_0x1cec(0x20)](_0xc0176e[_0x1cec(0x4d)],_0xc0176e[_0x1cec(0x4e)])?_0x1db2dc['warn'](_0x522c18[_0x1cec(0x4f)],_0x4e5f98):console[_0x1cec(0x36)](_0x1cec(0x7),_0x3fe8ca)),_0x2381a3;}else _0x4d235e[_0x1cec(0x36)]('â ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20playlist:',_0x224b5a);}),_0x334733=(_0xde5c7f[_0x1cec(0x2d)]||[])[_0x1cec(0x33)](_0x543965=>{if(_0x522c18['YPUjk'](_0x522c18[_0x1cec(0x50)],_0x522c18[_0x1cec(0x51)])){const _0x465aa4=_0x5e4a5f[_0x1cec(0x34)]&&_0x57f171[_0x1cec(0x35)];return!_0x465aa4&&_0x445db6[_0x1cec(0x36)](_0x522c18[_0x1cec(0x52)],_0x383bc6),_0x465aa4;}else{const _0x368bcf=_0x543965[_0x1cec(0x42)]&&_0x543965['name'];return!_0x368bcf&&console[_0x1cec(0x36)](_0x522c18[_0x1cec(0x53)],_0x543965),_0x368bcf;}}),_0x5a7f3e=_0x3af243,_0x5b7822=_0xc0176e[_0x1cec(0x54)](_0xc0176e[_0x1cec(0x55)](_0xc0176e[_0x1cec(0x56)](_0xc0176e[_0x1cec(0x57)](_0x474c8b['length'],_0x55ff91[_0x1cec(0x26)]),_0x2a3485['length'])+_0x53410c[_0x1cec(0x26)],_0x1b027f[_0x1cec(0x26)]),_0x334733[_0x1cec(0x26)]);_0xc0176e[_0x1cec(0x58)](_0x5b7822,_0x5a7f3e)&&(_0xc0176e['DtTKs']===_0xc0176e[_0x1cec(0x59)]?console[_0x1cec(0x36)](_0x1cec(0x49)+(_0x5a7f3e-_0x5b7822)+_0x1cec(0x4b)):_0x4ac2ae['warn'](_0xc0176e['mbbBi'],_0x1a8f7e));try{if(_0xc0176e[_0x1cec(0x5a)](_0xc0176e[_0x1cec(0x5b)],_0xc0176e[_0x1cec(0x5b)])){var _0x3d385a;console['log'](_0x1cec(0x5c));const _0x5d88ea=await _0xc0176e[_0x1cec(0x5d)](storeSpotifyData,_0x1b0297,{'recentlyPlayed':{'items':_0x474c8b,'totalCount':_0x474c8b[_0x1cec(0x26)]},'topItems':{'tracks':_0x55ff91,'artists':_0x2a3485,'timeRange':(_0xc0176e[_0x1cec(0x5e)](_0x3d385a=_0xde5c7f['topItems'],null)||_0x3d385a===void 0x0?void 0x0:_0x3d385a[_0x1cec(0x5f)])||'medium_term'},'playlists':_0x53410c,'savedTracks':_0x1b027f,'savedAlbums':_0x334733,'profile':_0xde5c7f['profile'],'tokenExpiry':_0xde5c7f[_0x1cec(0x60)],'userId':_0xde5c7f[_0x1cec(0x61)]});return _0x5d88ea[_0x1cec(0x62)]?(console[_0x1cec(0x18)](_0xc0176e['MnblN']),console[_0x1cec(0x18)](_0xc0176e[_0x1cec(0x63)],_0x5d88ea[_0x1cec(0x64)]),!![]):(console[_0x1cec(0x1b)](_0xc0176e[_0x1cec(0x65)],_0x5d88ea[_0x1cec(0x1b)]),Alert[_0x1cec(0x66)](_0x1cec(0x67),_0x5d88ea[_0x1cec(0x1b)]||_0xc0176e['qyRCk'],[{'text':'OK','style':_0xc0176e[_0x1cec(0x1e)]}]),![]);}else{const _0x3f842d=_0x50dd32[_0x1cec(0x68)]&&_0x5b0ce3['name'];return!_0x3f842d&&_0x5d381f[_0x1cec(0x36)](_0x522c18[_0x1cec(0x69)],_0x41d99b),_0x3f842d;}}catch(_0x347cee){return _0xc0176e[_0x1cec(0x6a)](_0xc0176e[_0x1cec(0x6b)],_0xc0176e['myTLX'])?(console['error'](_0xc0176e['HHHNq'],_0x347cee),Alert[_0x1cec(0x66)](_0xc0176e['aVdCG'],_0xc0176e[_0x1cec(0x6c)],[{'text':'OK','style':_0xc0176e[_0x1cec(0x1e)]}]),![]):(_0x3f6f50['log'](_0x522c18[_0x1cec(0x6d)]),_0x39616f[_0x1cec(0x18)](_0x1cec(0x6e),_0x479959['data']),!![]);}};return{'initiateDataExport':_0xce1de};};
|
|
1
|
+
/**
|
|
2
|
+
* Spotify Data Extractor
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates the Spotify data export flow:
|
|
5
|
+
* 1. Receives extracted listening data from WebView
|
|
6
|
+
* 2. Validates and formats data
|
|
7
|
+
* 3. Sends to backend via spotifyDataService
|
|
8
|
+
*
|
|
9
|
+
* This acts as the bridge between OAuthWebView and the backend API.
|
|
10
|
+
*
|
|
11
|
+
* @reference Sephora implementation: src/services/sephoraDataExtractor.ts
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { storeSpotifyData } from './spotifyDataService';
|
|
15
|
+
import { Alert } from 'react-native';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Combined Spotify export data from WebView - matches spotify.ts script output
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Hook for Spotify data extraction operations
|
|
23
|
+
*/
|
|
24
|
+
export const useSpotifyDataExtractor = () => {
|
|
25
|
+
/**
|
|
26
|
+
* Initiate data export to backend
|
|
27
|
+
*
|
|
28
|
+
* @param username - User identifier
|
|
29
|
+
* @param data - Extracted Spotify data (recentlyPlayed, topItems, playlists, etc.)
|
|
30
|
+
* @returns true if successful, false otherwise
|
|
31
|
+
*/
|
|
32
|
+
const initiateDataExport = async (username, data) => {
|
|
33
|
+
var _data$recentlyPlayed, _data$topItems, _data$topItems2, _data$playlists, _data$savedTracks, _data$savedAlbums, _data$recentlyPlayed2, _data$topItems3, _data$topItems4;
|
|
34
|
+
console.log('đ [SPOTIFY_EXTRACTOR] Initiating data export');
|
|
35
|
+
console.log('đ¤ [SPOTIFY_EXTRACTOR] Username:', username);
|
|
36
|
+
console.log('đ [SPOTIFY_EXTRACTOR] Summary:', data.summary);
|
|
37
|
+
if (!username) {
|
|
38
|
+
console.error('â [SPOTIFY_EXTRACTOR] Username is required');
|
|
39
|
+
Alert.alert('Error', 'Username is required to export Spotify data.', [{
|
|
40
|
+
text: 'OK',
|
|
41
|
+
style: 'default'
|
|
42
|
+
}]);
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
const totalItems = (((_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) + (((_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) + (((_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) + (((_data$playlists = data.playlists) === null || _data$playlists === void 0 ? void 0 : _data$playlists.length) || 0) + (((_data$savedTracks = data.savedTracks) === null || _data$savedTracks === void 0 ? void 0 : _data$savedTracks.length) || 0) + (((_data$savedAlbums = data.savedAlbums) === null || _data$savedAlbums === void 0 ? void 0 : _data$savedAlbums.length) || 0);
|
|
46
|
+
if (totalItems === 0) {
|
|
47
|
+
console.log('âšī¸ [SPOTIFY_EXTRACTOR] No data to export - treating as success (connected)');
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
const validRecentlyPlayed = (((_data$recentlyPlayed2 = data.recentlyPlayed) === null || _data$recentlyPlayed2 === void 0 ? void 0 : _data$recentlyPlayed2.items) || []).filter(track => {
|
|
51
|
+
const isValid = track.trackId && track.name;
|
|
52
|
+
if (!isValid) {
|
|
53
|
+
console.warn('â ī¸ [SPOTIFY_EXTRACTOR] Invalid recently played track:', track);
|
|
54
|
+
}
|
|
55
|
+
return isValid;
|
|
56
|
+
});
|
|
57
|
+
const validTopTracks = (((_data$topItems3 = data.topItems) === null || _data$topItems3 === void 0 ? void 0 : _data$topItems3.tracks) || []).filter(track => {
|
|
58
|
+
const isValid = track.trackId && track.name;
|
|
59
|
+
if (!isValid) {
|
|
60
|
+
console.warn('â ī¸ [SPOTIFY_EXTRACTOR] Invalid top track:', track);
|
|
61
|
+
}
|
|
62
|
+
return isValid;
|
|
63
|
+
});
|
|
64
|
+
const validTopArtists = (((_data$topItems4 = data.topItems) === null || _data$topItems4 === void 0 ? void 0 : _data$topItems4.artists) || []).filter(artist => {
|
|
65
|
+
const isValid = artist.artistId && artist.name;
|
|
66
|
+
if (!isValid) {
|
|
67
|
+
console.warn('â ī¸ [SPOTIFY_EXTRACTOR] Invalid top artist:', artist);
|
|
68
|
+
}
|
|
69
|
+
return isValid;
|
|
70
|
+
});
|
|
71
|
+
const validPlaylists = (data.playlists || []).filter(playlist => {
|
|
72
|
+
const isValid = playlist.playlistId && playlist.name;
|
|
73
|
+
if (!isValid) {
|
|
74
|
+
console.warn('â ī¸ [SPOTIFY_EXTRACTOR] Invalid playlist:', playlist);
|
|
75
|
+
}
|
|
76
|
+
return isValid;
|
|
77
|
+
});
|
|
78
|
+
const validSavedTracks = (data.savedTracks || []).filter(track => {
|
|
79
|
+
const isValid = track.trackId && track.name;
|
|
80
|
+
if (!isValid) {
|
|
81
|
+
console.warn('â ī¸ [SPOTIFY_EXTRACTOR] Invalid saved track:', track);
|
|
82
|
+
}
|
|
83
|
+
return isValid;
|
|
84
|
+
});
|
|
85
|
+
const validSavedAlbums = (data.savedAlbums || []).filter(album => {
|
|
86
|
+
const isValid = album.albumId && album.name;
|
|
87
|
+
if (!isValid) {
|
|
88
|
+
console.warn('â ī¸ [SPOTIFY_EXTRACTOR] Invalid saved album:', album);
|
|
89
|
+
}
|
|
90
|
+
return isValid;
|
|
91
|
+
});
|
|
92
|
+
const originalCount = totalItems;
|
|
93
|
+
const validCount = validRecentlyPlayed.length + validTopTracks.length + validTopArtists.length + validPlaylists.length + validSavedTracks.length + validSavedAlbums.length;
|
|
94
|
+
if (validCount < originalCount) {
|
|
95
|
+
console.warn(`â ī¸ [SPOTIFY_EXTRACTOR] Filtered out ${originalCount - validCount} invalid items`);
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
var _data$topItems5;
|
|
99
|
+
console.log('đĄ [SPOTIFY_EXTRACTOR] Sending to backend...');
|
|
100
|
+
const result = await storeSpotifyData(username, {
|
|
101
|
+
recentlyPlayed: {
|
|
102
|
+
items: validRecentlyPlayed,
|
|
103
|
+
totalCount: validRecentlyPlayed.length
|
|
104
|
+
},
|
|
105
|
+
topItems: {
|
|
106
|
+
tracks: validTopTracks,
|
|
107
|
+
artists: validTopArtists,
|
|
108
|
+
timeRange: ((_data$topItems5 = data.topItems) === null || _data$topItems5 === void 0 ? void 0 : _data$topItems5.timeRange) || 'medium_term'
|
|
109
|
+
},
|
|
110
|
+
playlists: validPlaylists,
|
|
111
|
+
savedTracks: validSavedTracks,
|
|
112
|
+
savedAlbums: validSavedAlbums,
|
|
113
|
+
profile: data.profile,
|
|
114
|
+
tokenExpiry: data.tokenExpiry,
|
|
115
|
+
userId: data.userId
|
|
116
|
+
});
|
|
117
|
+
if (result.success) {
|
|
118
|
+
console.log('â
[SPOTIFY_EXTRACTOR] Export completed successfully');
|
|
119
|
+
console.log('đ [SPOTIFY_EXTRACTOR] Backend response:', result.data);
|
|
120
|
+
return true;
|
|
121
|
+
} else {
|
|
122
|
+
console.error('â [SPOTIFY_EXTRACTOR] Backend storage failed:', result.error);
|
|
123
|
+
Alert.alert('Export Failed', result.error || 'An unknown error occurred during data storage.', [{
|
|
124
|
+
text: 'OK',
|
|
125
|
+
style: 'default'
|
|
126
|
+
}]);
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
} catch (error) {
|
|
130
|
+
console.error('â [SPOTIFY_EXTRACTOR] Unexpected error during export:', error);
|
|
131
|
+
Alert.alert('Export Error', 'Failed to connect to the data storage service. Please check your network connection.', [{
|
|
132
|
+
text: 'OK',
|
|
133
|
+
style: 'default'
|
|
134
|
+
}]);
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
return {
|
|
139
|
+
initiateDataExport
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=spotifyDataExtractor.js.map
|