@onairos/react-native 3.7.1 → 3.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/lib/commonjs/api/index.js +219 -9
  2. package/lib/commonjs/assets/icons/spotify.png +0 -0
  3. package/lib/commonjs/assets/images/spotify.png +0 -0
  4. package/lib/commonjs/components/BodyText.js +27 -9
  5. package/lib/commonjs/components/BrandMark.js +111 -10
  6. package/lib/commonjs/components/CodeInput.js +116 -9
  7. package/lib/commonjs/components/EmailInput.js +30 -8
  8. package/lib/commonjs/components/GoogleButton.js +56 -9
  9. package/lib/commonjs/components/HeadingGroup.js +43 -9
  10. package/lib/commonjs/components/LLMDataInputModal.js +664 -14
  11. package/lib/commonjs/components/ModalHeader.js +99 -9
  12. package/lib/commonjs/components/ModalSheet.js +47 -9
  13. package/lib/commonjs/components/Onairos.js +380 -14
  14. package/lib/commonjs/components/OnairosButton.js +313 -13
  15. package/lib/commonjs/components/OnairosSignInButton.js +130 -12
  16. package/lib/commonjs/components/Overlay.js +465 -13
  17. package/lib/commonjs/components/PersonaImage.js +137 -10
  18. package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
  19. package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
  20. package/lib/commonjs/components/PinCreationScreen.js +403 -12
  21. package/lib/commonjs/components/PinInput.js +464 -9
  22. package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
  23. package/lib/commonjs/components/PlatformList.js +137 -10
  24. package/lib/commonjs/components/PlatformToggle.js +180 -9
  25. package/lib/commonjs/components/PrimaryButton.js +180 -10
  26. package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
  27. package/lib/commonjs/components/SignInStep.js +345 -12
  28. package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
  29. package/lib/commonjs/components/VerificationStep.js +176 -11
  30. package/lib/commonjs/components/WelcomeScreen.js +461 -22
  31. package/lib/commonjs/components/icons/Basicproficon.js +37 -8
  32. package/lib/commonjs/components/icons/Basicprofile.js +21 -8
  33. package/lib/commonjs/components/icons/Checkbox.js +21 -8
  34. package/lib/commonjs/components/icons/Checkmark.js +27 -8
  35. package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
  36. package/lib/commonjs/components/icons/Contenticon.js +39 -8
  37. package/lib/commonjs/components/icons/EnochE.js +41 -8
  38. package/lib/commonjs/components/icons/Personalityicon.js +30 -8
  39. package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
  40. package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
  41. package/lib/commonjs/components/icons/Userpreferences.js +21 -8
  42. package/lib/commonjs/components/icons/index.js +84 -17
  43. package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
  44. package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
  45. package/lib/commonjs/components/onboarding/PinInput.js +283 -10
  46. package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
  47. package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
  48. package/lib/commonjs/config/api.js +56 -7
  49. package/lib/commonjs/constants/index.js +120 -7
  50. package/lib/commonjs/context/AuthContext.js +345 -10
  51. package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
  52. package/lib/commonjs/hooks/useConnections.js +102 -8
  53. package/lib/commonjs/hooks/useCredentials.js +178 -10
  54. package/lib/commonjs/hooks/useUserConnections.js +148 -10
  55. package/lib/commonjs/index.js +439 -34
  56. package/lib/commonjs/services/apiClient.js +298 -8
  57. package/lib/commonjs/services/biometricPinService.js +180 -8
  58. package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
  59. package/lib/commonjs/services/chatGPTConversationService.js +275 -9
  60. package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
  61. package/lib/commonjs/services/claudeConversationService.js +158 -9
  62. package/lib/commonjs/services/connectedAccountsService.js +310 -10
  63. package/lib/commonjs/services/googleAuthService.js +252 -11
  64. package/lib/commonjs/services/hingeDataExtractor.js +105 -8
  65. package/lib/commonjs/services/hingeDataService.js +150 -9
  66. package/lib/commonjs/services/imageCompressionService.js +260 -7
  67. package/lib/commonjs/services/instagramDataExtractor.js +126 -8
  68. package/lib/commonjs/services/instagramDataService.js +163 -9
  69. package/lib/commonjs/services/jwtStorageService.js +276 -7
  70. package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
  71. package/lib/commonjs/services/linkedinProfileService.js +222 -9
  72. package/lib/commonjs/services/linkedinScrapingService.js +230 -8
  73. package/lib/commonjs/services/llmDataStorage.js +294 -8
  74. package/lib/commonjs/services/mobileTrainingService.js +186 -8
  75. package/lib/commonjs/services/netflixDataExtractor.js +120 -8
  76. package/lib/commonjs/services/netflixDataService.js +198 -9
  77. package/lib/commonjs/services/pinEncryptionService.js +84 -8
  78. package/lib/commonjs/services/pinStorageUtils.js +105 -7
  79. package/lib/commonjs/services/platformAuthService.js +1484 -12
  80. package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
  81. package/lib/commonjs/services/sephoraDataService.js +200 -9
  82. package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
  83. package/lib/commonjs/services/spotifyDataService.js +241 -9
  84. package/lib/commonjs/services/storageService.js +404 -8
  85. package/lib/commonjs/services/telegramDataExtractor.js +115 -8
  86. package/lib/commonjs/services/telegramDataService.js +499 -9
  87. package/lib/commonjs/services/trainingApiHelpers.js +73 -7
  88. package/lib/commonjs/services/userConnectionsService.js +340 -10
  89. package/lib/commonjs/services/youtubeMigrationService.js +416 -10
  90. package/lib/commonjs/theme/index.js +250 -7
  91. package/lib/commonjs/types/ambient.d.js +2 -1
  92. package/lib/commonjs/types/declarations.d.js +2 -1
  93. package/lib/commonjs/types/index.js +6 -1
  94. package/lib/commonjs/types/node-fix.d.js +2 -1
  95. package/lib/commonjs/types/node-override.d.js +2 -1
  96. package/lib/commonjs/types/opacity.d.js +2 -1
  97. package/lib/commonjs/types.js +14 -1
  98. package/lib/commonjs/utils/Portal.js +98 -8
  99. package/lib/commonjs/utils/api.js +130 -9
  100. package/lib/commonjs/utils/assetRegistry.js +210 -35
  101. package/lib/commonjs/utils/auth.js +112 -9
  102. package/lib/commonjs/utils/connectorTests.js +613 -29
  103. package/lib/commonjs/utils/crypto.js +62 -8
  104. package/lib/commonjs/utils/debugHelper.js +64 -1
  105. package/lib/commonjs/utils/encryption.js +76 -7
  106. package/lib/commonjs/utils/eventUtils.js +288 -1
  107. package/lib/commonjs/utils/haptics.js +66 -9
  108. package/lib/commonjs/utils/imagePreloader.js +6 -1
  109. package/lib/commonjs/utils/networkDiagnostics.js +226 -8
  110. package/lib/commonjs/utils/onairosApi.js +350 -9
  111. package/lib/commonjs/utils/programmaticFlow.js +117 -9
  112. package/lib/commonjs/utils/retryHelper.js +220 -1
  113. package/lib/commonjs/utils/secureStorage.js +349 -10
  114. package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
  115. package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
  116. package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
  117. package/lib/commonjs/utils/webviewScripts/index.js +698 -15
  118. package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
  119. package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
  120. package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
  121. package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
  122. package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
  123. package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
  124. package/lib/module/api/index.js +211 -1
  125. package/lib/module/assets/icons/spotify.png +0 -0
  126. package/lib/module/assets/images/spotify.png +0 -0
  127. package/lib/module/components/BodyText.js +20 -1
  128. package/lib/module/components/BrandMark.js +104 -1
  129. package/lib/module/components/CodeInput.js +109 -1
  130. package/lib/module/components/EmailInput.js +23 -1
  131. package/lib/module/components/GoogleButton.js +49 -1
  132. package/lib/module/components/HeadingGroup.js +36 -1
  133. package/lib/module/components/LLMDataInputModal.js +656 -7
  134. package/lib/module/components/ModalHeader.js +92 -1
  135. package/lib/module/components/ModalSheet.js +39 -1
  136. package/lib/module/components/Onairos.js +373 -1
  137. package/lib/module/components/OnairosButton.js +305 -1
  138. package/lib/module/components/OnairosSignInButton.js +121 -1
  139. package/lib/module/components/Overlay.js +456 -1
  140. package/lib/module/components/PersonaImage.js +129 -1
  141. package/lib/module/components/PersonaLoadingScreen.js +310 -1
  142. package/lib/module/components/PersonalizationConsentScreen.js +460 -1
  143. package/lib/module/components/PinCreationScreen.js +396 -1
  144. package/lib/module/components/PinInput.js +456 -1
  145. package/lib/module/components/PlatformConnectorsStep.js +1302 -6
  146. package/lib/module/components/PlatformList.js +129 -1
  147. package/lib/module/components/PlatformToggle.js +173 -1
  148. package/lib/module/components/PrimaryButton.js +172 -1
  149. package/lib/module/components/SignInMatchAnimation.js +189 -1
  150. package/lib/module/components/SignInStep.js +338 -1
  151. package/lib/module/components/UniversalOnboarding.js +2770 -1
  152. package/lib/module/components/VerificationStep.js +168 -1
  153. package/lib/module/components/WelcomeScreen.js +453 -1
  154. package/lib/module/components/icons/Basicproficon.js +30 -1
  155. package/lib/module/components/icons/Basicprofile.js +14 -1
  156. package/lib/module/components/icons/Checkbox.js +14 -1
  157. package/lib/module/components/icons/Checkmark.js +20 -1
  158. package/lib/module/components/icons/Contentanalysis.js +14 -1
  159. package/lib/module/components/icons/Contenticon.js +32 -1
  160. package/lib/module/components/icons/EnochE.js +34 -1
  161. package/lib/module/components/icons/Personalityicon.js +23 -1
  162. package/lib/module/components/icons/Personalityprofile.js +14 -1
  163. package/lib/module/components/icons/Personalitytraits.js +14 -1
  164. package/lib/module/components/icons/Userpreferences.js +14 -1
  165. package/lib/module/components/icons/index.js +13 -1
  166. package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
  167. package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
  168. package/lib/module/components/onboarding/PinInput.js +274 -1
  169. package/lib/module/components/onboarding/PlatformConnector.js +240 -1
  170. package/lib/module/config/PLATFORM_APIS.md +849 -0
  171. package/lib/module/config/api.js +47 -1
  172. package/lib/module/constants/index.js +114 -1
  173. package/lib/module/context/AuthContext.js +335 -1
  174. package/lib/module/hooks/useConnectedAccounts.js +106 -1
  175. package/lib/module/hooks/useConnections.js +95 -1
  176. package/lib/module/hooks/useCredentials.js +171 -6
  177. package/lib/module/hooks/useUserConnections.js +140 -1
  178. package/lib/module/index.js +172 -1
  179. package/lib/module/services/apiClient.js +295 -1
  180. package/lib/module/services/biometricPinService.js +169 -1
  181. package/lib/module/services/chatGPTConversationExtractor.js +149 -1
  182. package/lib/module/services/chatGPTConversationService.js +268 -1
  183. package/lib/module/services/claudeConversationExtractor.js +97 -1
  184. package/lib/module/services/claudeConversationService.js +151 -1
  185. package/lib/module/services/connectedAccountsService.js +293 -1
  186. package/lib/module/services/googleAuthService.js +241 -1
  187. package/lib/module/services/hingeDataExtractor.js +99 -1
  188. package/lib/module/services/hingeDataService.js +143 -1
  189. package/lib/module/services/imageCompressionService.js +250 -1
  190. package/lib/module/services/instagramDataExtractor.js +120 -1
  191. package/lib/module/services/instagramDataService.js +156 -1
  192. package/lib/module/services/jwtStorageService.js +257 -1
  193. package/lib/module/services/linkedinDOMExtractor.js +234 -1
  194. package/lib/module/services/linkedinProfileService.js +210 -1
  195. package/lib/module/services/linkedinScrapingService.js +219 -1
  196. package/lib/module/services/llmDataStorage.js +277 -1
  197. package/lib/module/services/mobileTrainingService.js +173 -1
  198. package/lib/module/services/netflixDataExtractor.js +114 -1
  199. package/lib/module/services/netflixDataService.js +191 -1
  200. package/lib/module/services/pinEncryptionService.js +74 -6
  201. package/lib/module/services/pinStorageUtils.js +93 -1
  202. package/lib/module/services/platformAuthService.js +1461 -1
  203. package/lib/module/services/sephoraDataExtractor.js +134 -1
  204. package/lib/module/services/sephoraDataService.js +193 -1
  205. package/lib/module/services/spotifyDataExtractor.js +142 -1
  206. package/lib/module/services/spotifyDataService.js +234 -1
  207. package/lib/module/services/storageService.js +383 -1
  208. package/lib/module/services/telegramDataExtractor.js +109 -1
  209. package/lib/module/services/telegramDataService.js +493 -1
  210. package/lib/module/services/trainingApiHelpers.js +67 -1
  211. package/lib/module/services/userConnectionsService.js +329 -1
  212. package/lib/module/services/youtubeMigrationService.js +405 -1
  213. package/lib/module/theme/index.js +245 -1
  214. package/lib/module/types.js +10 -1
  215. package/lib/module/utils/Portal.js +90 -1
  216. package/lib/module/utils/api.js +118 -1
  217. package/lib/module/utils/assetRegistry.js +200 -34
  218. package/lib/module/utils/auth.js +100 -1
  219. package/lib/module/utils/connectorTests.js +600 -27
  220. package/lib/module/utils/crypto.js +54 -1
  221. package/lib/module/utils/debugHelper.js +54 -1
  222. package/lib/module/utils/encryption.js +67 -1
  223. package/lib/module/utils/eventUtils.js +270 -1
  224. package/lib/module/utils/haptics.js +59 -8
  225. package/lib/module/utils/imagePreloader.js +3 -1
  226. package/lib/module/utils/networkDiagnostics.js +217 -1
  227. package/lib/module/utils/onairosApi.js +333 -1
  228. package/lib/module/utils/programmaticFlow.js +111 -1
  229. package/lib/module/utils/retryHelper.js +211 -1
  230. package/lib/module/utils/secureStorage.js +330 -6
  231. package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
  232. package/lib/module/utils/webviewScripts/claude.js +370 -1
  233. package/lib/module/utils/webviewScripts/hinge.js +405 -1
  234. package/lib/module/utils/webviewScripts/index.js +434 -1
  235. package/lib/module/utils/webviewScripts/instagram.js +448 -1
  236. package/lib/module/utils/webviewScripts/linkedin.js +874 -1
  237. package/lib/module/utils/webviewScripts/netflix.js +376 -1
  238. package/lib/module/utils/webviewScripts/sephora.js +510 -1
  239. package/lib/module/utils/webviewScripts/spotify.js +413 -1
  240. package/lib/module/utils/webviewScripts/telegram.js +672 -1
  241. package/package.json +2 -2
@@ -1,8 +1,140 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("./sephoraDataService"),
5
- require("react-native")
6
- ];
7
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
8
- function _0x2a22(_0x56350b,_0x2a22b8){_0x56350b=_0x56350b-0x0;const _0x174aa2=_0x5635();let _0x17b34f=_0x174aa2[_0x56350b];return _0x17b34f;}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports[_0x2a22(0x0)]=void 0x0;var _sephoraDataService=__ONAIROS_REQ_FUNC__(0x0),_reactNative=__ONAIROS_REQ_FUNC__(0x1);const useSephoraDataExtractor=()=>{const _0x5cdb62={'aJFiy':_0x2a22(0x1),'ooDsc':_0x2a22(0x2),'HEfbC':_0x2a22(0x3),'yASqm':_0x2a22(0x4),'GiUHR':_0x2a22(0x5),'iQxEj':_0x2a22(0x6),'iHCQn':function(_0x9d7160,_0x86c851){return _0x9d7160===_0x86c851;},'vadSl':_0x2a22(0x7),'WjhBf':function(_0x173a5e,_0x3818fe){return _0x173a5e===_0x3818fe;},'kUOVy':'number','fHutI':function(_0x42a21d,_0x389e6a){return _0x42a21d!==_0x389e6a;},'fXWfT':_0x2a22(0x8),'HfsFz':_0x2a22(0x9),'AJKyG':_0x2a22(0xa),'rlNwl':_0x2a22(0xb),'iyQRr':_0x2a22(0xc),'GspGN':_0x2a22(0xd),'pLMoO':'Error','KpmUG':_0x2a22(0xe),'eJiYA':function(_0x8c84e6,_0x4216d4){return _0x8c84e6+_0x4216d4;},'OFmXW':function(_0x2959a6,_0xcf8f9c){return _0x2959a6===_0xcf8f9c;},'lozZV':function(_0x500d4e,_0x225c52){return _0x500d4e===_0x225c52;},'UxNgR':function(_0x2ba8a0,_0x824fda){return _0x2ba8a0===_0x824fda;},'WebvE':function(_0x2315dc,_0x45f90b){return _0x2315dc===_0x45f90b;},'nNWVn':function(_0x586924,_0x4c7b7c){return _0x586924===_0x4c7b7c;},'PWLIF':_0x2a22(0xf),'PnMzr':_0x2a22(0x10),'xZkPK':function(_0x17933c,_0x141fb3){return _0x17933c+_0x141fb3;},'PvvuF':function(_0x28c09c,_0x2c8a43){return _0x28c09c+_0x2c8a43;},'vGHsx':function(_0xa14704,_0x1a3b14){return _0xa14704===_0x1a3b14;},'zKrNe':function(_0x4f9af8,_0x523b09){return _0x4f9af8===_0x523b09;},'uFPzR':function(_0x46bf6e,_0x529c43){return _0x46bf6e===_0x529c43;},'SMHhL':function(_0x8774b6,_0x58f196){return _0x8774b6+_0x58f196;},'pfMHX':function(_0x1bffa1,_0x540152){return _0x1bffa1<_0x540152;},'QRRRk':function(_0x2f5db9,_0x66aaea){return _0x2f5db9-_0x66aaea;},'Gupvl':_0x2a22(0x11),'oOPdS':'✅\x20[SEPHORA_EXTRACTOR]\x20Export\x20completed\x20successfully','LuRyS':_0x2a22(0x12),'jzygg':_0x2a22(0x13),'Cwhjo':_0x2a22(0x14),'GcacA':_0x2a22(0x15),'TuLOu':_0x2a22(0x16)},_0x51031a=async(_0x45ae8d,_0xc67677)=>{const _0x4ab040={'dCLOX':function(_0x38ae47,_0x2f0a61){return _0x5cdb62['fHutI'](_0x38ae47,_0x2f0a61);},'rbinS':_0x2a22(0x17),'OfqJn':_0x2a22(0x18),'PJiiy':_0x5cdb62[_0x2a22(0x19)],'yjTRX':_0x5cdb62['HfsFz']};if(_0x5cdb62[_0x2a22(0x1a)](_0x2a22(0x1b),_0x5cdb62['AJKyG']))return _0x251590['error'](_0x5cdb62[_0x2a22(0x1c)],_0x1ac4c1),_0x5f4c78[_0x2a22(0x1d)]['alert'](_0x5cdb62[_0x2a22(0x1e)],_0x5cdb62['HEfbC'],[{'text':'OK','style':_0x5cdb62[_0x2a22(0x1f)]}]),![];else{var _0x385bba,_0x1cf764,_0x2ba85d,_0x2762e7,_0x11a8e9,_0x4741cc,_0x55ac9a,_0x2e8e7f,_0x1b29c9;console[_0x2a22(0x20)](_0x5cdb62[_0x2a22(0x21)]),console[_0x2a22(0x20)](_0x2a22(0x22),_0x45ae8d),console['log'](_0x5cdb62[_0x2a22(0x23)],_0xc67677['summary']);if(!_0x45ae8d)return console[_0x2a22(0x24)](_0x5cdb62[_0x2a22(0x25)]),_reactNative[_0x2a22(0x1d)][_0x2a22(0x26)](_0x5cdb62[_0x2a22(0x27)],_0x5cdb62['KpmUG'],[{'text':'OK','style':_0x5cdb62[_0x2a22(0x1f)]}]),![];const _0x1f233a=_0x5cdb62['eJiYA'](_0x5cdb62['eJiYA']((_0x5cdb62[_0x2a22(0x28)](_0x385bba=_0xc67677[_0x2a22(0x29)],null)||_0x5cdb62['iHCQn'](_0x385bba,void 0x0)||_0x5cdb62[_0x2a22(0x28)](_0x385bba=_0x385bba[_0x2a22(0x2a)],null)||_0x5cdb62[_0x2a22(0x1a)](_0x385bba,void 0x0)?void 0x0:_0x385bba['length'])||0x0,(_0x5cdb62[_0x2a22(0x28)](_0x1cf764=_0xc67677[_0x2a22(0x2b)],null)||_0x5cdb62['OFmXW'](_0x1cf764,void 0x0)?void 0x0:_0x1cf764[_0x2a22(0x2c)])||0x0)+((_0x5cdb62[_0x2a22(0x2d)](_0x2ba85d=_0xc67677[_0x2a22(0x2e)],null)||_0x5cdb62[_0x2a22(0x2f)](_0x2ba85d,void 0x0)?void 0x0:_0x2ba85d[_0x2a22(0x2c)])||0x0),(_0x5cdb62['WebvE'](_0x2762e7=_0xc67677[_0x2a22(0x30)],null)||_0x5cdb62['nNWVn'](_0x2762e7,void 0x0)?void 0x0:_0x2762e7[_0x2a22(0x2c)])||0x0);if(_0x5cdb62[_0x2a22(0x31)](_0x1f233a,0x0)){if(_0x5cdb62[_0x2a22(0x32)]!==_0x5cdb62[_0x2a22(0x32)])_0x115000[_0x2a22(0x33)](_0x5cdb62['GiUHR'],_0x57ece8);else return console[_0x2a22(0x20)](_0x5cdb62[_0x2a22(0x34)]),!![];}const _0x300810=((_0x5cdb62['OFmXW'](_0x11a8e9=_0xc67677['basket'],null)||_0x5cdb62['iHCQn'](_0x11a8e9,void 0x0)?void 0x0:_0x11a8e9[_0x2a22(0x2a)])||[])[_0x2a22(0x35)](_0x1d9bbc=>{const _0x2a5803=_0x1d9bbc['id']&&_0x1d9bbc['name'];return!_0x2a5803&&console[_0x2a22(0x33)](_0x2a22(0x9),_0x1d9bbc),_0x2a5803;}),_0x1cb1b8=(_0xc67677['orders']||[])['filter'](_0x1df402=>{const _0x208082=_0x1df402[_0x2a22(0x36)]&&_0x1df402[_0x2a22(0x37)];return!_0x208082&&console[_0x2a22(0x33)](_0x2a22(0x6),_0x1df402),_0x208082;}),_0x11f7d5=(_0xc67677['loves']||[])['filter'](_0x1ce2de=>{if(_0x4ab040[_0x2a22(0x38)](_0x4ab040[_0x2a22(0x39)],_0x4ab040[_0x2a22(0x3a)])){const _0x3b209e=_0x1ce2de['id']&&_0x1ce2de['name'];return!_0x3b209e&&console[_0x2a22(0x33)](_0x4ab040[_0x2a22(0x3b)],_0x1ce2de),_0x3b209e;}else _0x5c0d37[_0x2a22(0x33)](_0x2a22(0x8),_0x12e2ea);}),_0x55c82c=(_0xc67677[_0x2a22(0x30)]||[])[_0x2a22(0x35)](_0x12119f=>{const _0x162ff7={'mSjoM':_0x5cdb62['iQxEj']};if(_0x5cdb62[_0x2a22(0x1a)](_0x5cdb62[_0x2a22(0x3c)],_0x5cdb62[_0x2a22(0x3c)])){const _0x5d15b5=_0x12119f['productId']&&_0x5cdb62[_0x2a22(0x28)](typeof _0x12119f[_0x2a22(0x3d)],_0x5cdb62[_0x2a22(0x3e)]);return!_0x5d15b5&&console[_0x2a22(0x33)](_0x5cdb62['GiUHR'],_0x12119f),_0x5d15b5;}else _0x2cac3f[_0x2a22(0x33)](_0x162ff7[_0x2a22(0x3f)],_0x894bb9);}),_0x1a958b=_0x5cdb62[_0x2a22(0x40)](_0x5cdb62[_0x2a22(0x41)](_0x5cdb62['PvvuF']((_0x5cdb62[_0x2a22(0x2f)](_0x4741cc=_0xc67677['basket'],null)||_0x5cdb62['WebvE'](_0x4741cc,void 0x0)||_0x5cdb62['vGHsx'](_0x4741cc=_0x4741cc[_0x2a22(0x2a)],null)||_0x5cdb62[_0x2a22(0x2f)](_0x4741cc,void 0x0)?void 0x0:_0x4741cc[_0x2a22(0x2c)])||0x0,((_0x55ac9a=_0xc67677[_0x2a22(0x2b)])===null||_0x5cdb62[_0x2a22(0x31)](_0x55ac9a,void 0x0)?void 0x0:_0x55ac9a['length'])||0x0),((_0x2e8e7f=_0xc67677[_0x2a22(0x2e)])===null||_0x2e8e7f===void 0x0?void 0x0:_0x2e8e7f[_0x2a22(0x2c)])||0x0),(_0x5cdb62[_0x2a22(0x42)](_0x1b29c9=_0xc67677[_0x2a22(0x30)],null)||_0x5cdb62[_0x2a22(0x43)](_0x1b29c9,void 0x0)?void 0x0:_0x1b29c9[_0x2a22(0x2c)])||0x0),_0x209359=_0x5cdb62[_0x2a22(0x44)](_0x300810[_0x2a22(0x2c)]+_0x1cb1b8[_0x2a22(0x2c)]+_0x11f7d5[_0x2a22(0x2c)],_0x55c82c[_0x2a22(0x2c)]);_0x5cdb62[_0x2a22(0x45)](_0x209359,_0x1a958b)&&console[_0x2a22(0x33)](_0x2a22(0x46)+_0x5cdb62[_0x2a22(0x47)](_0x1a958b,_0x209359)+'\x20invalid\x20items');try{var _0x12b02;console[_0x2a22(0x20)](_0x5cdb62['Gupvl']);const _0x265609=await(0x0,_sephoraDataService[_0x2a22(0x48)])(_0x45ae8d,{'basket':{'items':_0x300810,'total':(_0x5cdb62[_0x2a22(0x31)](_0x12b02=_0xc67677[_0x2a22(0x29)],null)||_0x5cdb62[_0x2a22(0x42)](_0x12b02,void 0x0)?void 0x0:_0x12b02[_0x2a22(0x49)])||0x0,'itemCount':_0x300810[_0x2a22(0x2c)]},'orders':_0x1cb1b8,'loves':_0x11f7d5,'ratings':_0x55c82c,'userId':_0xc67677[_0x2a22(0x4a)]});if(_0x265609[_0x2a22(0x4b)])return console[_0x2a22(0x20)](_0x5cdb62[_0x2a22(0x4c)]),console[_0x2a22(0x20)](_0x5cdb62['LuRyS'],_0x265609[_0x2a22(0x4d)]),!![];else{if(_0x5cdb62[_0x2a22(0x4e)](_0x2a22(0x13),_0x5cdb62[_0x2a22(0x4f)])){const _0xd6d6bb=_0x325fc4[_0x2a22(0x50)]&&_0x5cdb62[_0x2a22(0x1a)](typeof _0x3ee203[_0x2a22(0x3d)],_0x2a22(0x51));return!_0xd6d6bb&&_0xfe372c[_0x2a22(0x33)](_0x5cdb62[_0x2a22(0x52)],_0x3c4859),_0xd6d6bb;}else return console[_0x2a22(0x24)](_0x5cdb62[_0x2a22(0x53)],_0x265609[_0x2a22(0x24)]),_reactNative['Alert'][_0x2a22(0x26)](_0x2a22(0x54),_0x265609[_0x2a22(0x24)]||_0x2a22(0x55),[{'text':'OK','style':_0x5cdb62[_0x2a22(0x1f)]}]),![];}}catch(_0x242ead){if(_0x5cdb62[_0x2a22(0x4e)](_0x5cdb62[_0x2a22(0x56)],_0x5cdb62[_0x2a22(0x57)]))return console[_0x2a22(0x24)](_0x5cdb62['aJFiy'],_0x242ead),_reactNative['Alert'][_0x2a22(0x26)](_0x5cdb62[_0x2a22(0x1e)],_0x5cdb62[_0x2a22(0x58)],[{'text':'OK','style':'default'}]),![];else _0x32e8a1[_0x2a22(0x33)](_0x4ab040['yjTRX'],_0x5c2237);}}};return{'initiateDataExport':_0x51031a};};function _0x5635(){const _0x5adbc6=['useSephoraDataExtractor','❌\x20[SEPHORA_EXTRACTOR]\x20Unexpected\x20error\x20during\x20export:','Export\x20Error','Failed\x20to\x20connect\x20to\x20the\x20data\x20storage\x20service.\x20Please\x20check\x20your\x20network\x20connection.','default','âš ī¸\x20[SEPHORA_EXTRACTOR]\x20Invalid\x20rating:','âš ī¸\x20[SEPHORA_EXTRACTOR]\x20Invalid\x20order:','FVTAb','âš ī¸\x20[SEPHORA_EXTRACTOR]\x20Invalid\x20loved\x20item:','âš ī¸\x20[SEPHORA_EXTRACTOR]\x20Invalid\x20basket\x20item:','QFWRr','🚀\x20[SEPHORA_EXTRACTOR]\x20Initiating\x20data\x20export','📊\x20[SEPHORA_EXTRACTOR]\x20Summary:','❌\x20[SEPHORA_EXTRACTOR]\x20Username\x20is\x20required','Username\x20is\x20required\x20to\x20export\x20Sephora\x20data.','BbhTg','â„šī¸\x20[SEPHORA_EXTRACTOR]\x20No\x20data\x20to\x20export\x20-\x20treating\x20as\x20success\x20(connected)','📡\x20[SEPHORA_EXTRACTOR]\x20Sending\x20to\x20backend...','📊\x20[SEPHORA_EXTRACTOR]\x20Backend\x20response:','wBPyV','❌\x20[SEPHORA_EXTRACTOR]\x20Backend\x20storage\x20failed:','UcYhO','XjMSA','qtZpk','KlEDt','fXWfT','iHCQn','VaLXV','aJFiy','Alert','ooDsc','yASqm','log','rlNwl','👤\x20[SEPHORA_EXTRACTOR]\x20Username:','iyQRr','error','GspGN','alert','pLMoO','WjhBf','basket','items','orders','length','lozZV','loves','UxNgR','ratings','WebvE','PWLIF','warn','PnMzr','filter','orderId','date','dCLOX','rbinS','OfqJn','PJiiy','vadSl','rating','kUOVy','mSjoM','eJiYA','xZkPK','zKrNe','uFPzR','SMHhL','pfMHX','âš ī¸\x20[SEPHORA_EXTRACTOR]\x20Filtered\x20out\x20','QRRRk','storeSephoraData','total','userId','success','oOPdS','data','fHutI','jzygg','productId','number','GiUHR','Cwhjo','Export\x20Failed','An\x20unknown\x20error\x20occurred\x20during\x20data\x20storage.','GcacA','TuLOu','HEfbC'];_0x5635=function(){return _0x5adbc6;};return _0x5635();}exports[_0x2a22(0x0)]=useSephoraDataExtractor;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useSephoraDataExtractor = void 0;
7
+ var _sephoraDataService = require("./sephoraDataService");
8
+ var _reactNative = require("react-native");
9
+ /**
10
+ * Sephora Data Extractor
11
+ *
12
+ * Orchestrates the Sephora data export flow:
13
+ * 1. Receives extracted shopping data from WebView
14
+ * 2. Validates and formats data
15
+ * 3. Sends to backend via sephoraDataService
16
+ *
17
+ * This acts as the bridge between OAuthWebView and the backend API.
18
+ *
19
+ * @reference ChatGPT implementation: src/services/chatGPTConversationExtractor.ts
20
+ */
21
+
22
+ /**
23
+ * Combined Sephora export data from WebView
24
+ */
25
+
26
+ /**
27
+ * Hook for Sephora data extraction operations
28
+ */
29
+ const useSephoraDataExtractor = () => {
30
+ /**
31
+ * Initiate data export to backend
32
+ *
33
+ * @param username - User identifier
34
+ * @param data - Extracted Sephora data (basket, orders, loves, ratings)
35
+ * @returns true if successful, false otherwise
36
+ */
37
+ const initiateDataExport = async (username, data) => {
38
+ var _data$basket, _data$orders, _data$loves, _data$ratings, _data$basket2, _data$basket3, _data$orders2, _data$loves2, _data$ratings2;
39
+ console.log('🚀 [SEPHORA_EXTRACTOR] Initiating data export');
40
+ console.log('👤 [SEPHORA_EXTRACTOR] Username:', username);
41
+ console.log('📊 [SEPHORA_EXTRACTOR] Summary:', data.summary);
42
+
43
+ // Validation
44
+ if (!username) {
45
+ console.error('❌ [SEPHORA_EXTRACTOR] Username is required');
46
+ _reactNative.Alert.alert('Error', 'Username is required to export Sephora data.', [{
47
+ text: 'OK',
48
+ style: 'default'
49
+ }]);
50
+ return false;
51
+ }
52
+
53
+ // Handle empty data as success - user might be new
54
+ 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);
55
+ if (totalItems === 0) {
56
+ console.log('â„šī¸ [SEPHORA_EXTRACTOR] No data to export - treating as success (connected)');
57
+ return true;
58
+ }
59
+
60
+ // Validate basket items
61
+ const validBasketItems = (((_data$basket2 = data.basket) === null || _data$basket2 === void 0 ? void 0 : _data$basket2.items) || []).filter(item => {
62
+ const isValid = item.id && item.name;
63
+ if (!isValid) {
64
+ console.warn('âš ī¸ [SEPHORA_EXTRACTOR] Invalid basket item:', item);
65
+ }
66
+ return isValid;
67
+ });
68
+
69
+ // Validate orders
70
+ const validOrders = (data.orders || []).filter(order => {
71
+ const isValid = order.orderId && order.date;
72
+ if (!isValid) {
73
+ console.warn('âš ī¸ [SEPHORA_EXTRACTOR] Invalid order:', order);
74
+ }
75
+ return isValid;
76
+ });
77
+
78
+ // Validate loved products
79
+ const validLoves = (data.loves || []).filter(love => {
80
+ const isValid = love.id && love.name;
81
+ if (!isValid) {
82
+ console.warn('âš ī¸ [SEPHORA_EXTRACTOR] Invalid loved item:', love);
83
+ }
84
+ return isValid;
85
+ });
86
+
87
+ // Validate ratings
88
+ const validRatings = (data.ratings || []).filter(rating => {
89
+ const isValid = rating.productId && typeof rating.rating === 'number';
90
+ if (!isValid) {
91
+ console.warn('âš ī¸ [SEPHORA_EXTRACTOR] Invalid rating:', rating);
92
+ }
93
+ return isValid;
94
+ });
95
+ 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);
96
+ const validCount = validBasketItems.length + validOrders.length + validLoves.length + validRatings.length;
97
+ if (validCount < originalCount) {
98
+ console.warn(`âš ī¸ [SEPHORA_EXTRACTOR] Filtered out ${originalCount - validCount} invalid items`);
99
+ }
100
+ try {
101
+ var _data$basket4;
102
+ console.log('📡 [SEPHORA_EXTRACTOR] Sending to backend...');
103
+ const result = await (0, _sephoraDataService.storeSephoraData)(username, {
104
+ basket: {
105
+ items: validBasketItems,
106
+ total: ((_data$basket4 = data.basket) === null || _data$basket4 === void 0 ? void 0 : _data$basket4.total) || 0,
107
+ itemCount: validBasketItems.length
108
+ },
109
+ orders: validOrders,
110
+ loves: validLoves,
111
+ ratings: validRatings,
112
+ userId: data.userId
113
+ });
114
+ if (result.success) {
115
+ console.log('✅ [SEPHORA_EXTRACTOR] Export completed successfully');
116
+ console.log('📊 [SEPHORA_EXTRACTOR] Backend response:', result.data);
117
+ return true;
118
+ } else {
119
+ console.error('❌ [SEPHORA_EXTRACTOR] Backend storage failed:', result.error);
120
+ _reactNative.Alert.alert('Export Failed', result.error || 'An unknown error occurred during data storage.', [{
121
+ text: 'OK',
122
+ style: 'default'
123
+ }]);
124
+ return false;
125
+ }
126
+ } catch (error) {
127
+ console.error('❌ [SEPHORA_EXTRACTOR] Unexpected error during export:', error);
128
+ _reactNative.Alert.alert('Export Error', 'Failed to connect to the data storage service. Please check your network connection.', [{
129
+ text: 'OK',
130
+ style: 'default'
131
+ }]);
132
+ return false;
133
+ }
134
+ };
135
+ return {
136
+ initiateDataExport
137
+ };
138
+ };
139
+ exports.useSephoraDataExtractor = useSephoraDataExtractor;
140
+ //# sourceMappingURL=sephoraDataExtractor.js.map
@@ -1,9 +1,200 @@
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
- Object[_0x136f(0x0)](exports,_0x136f(0x1),{'value':!![]}),exports[_0x136f(0x2)]=void 0x0;var _api=__ONAIROS_REQ_FUNC__(0x0),_asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x1)),_reactNative=__ONAIROS_REQ_FUNC__(0x2);function _0x4c4e(){const _0x1a9f0f=['defineProperty','__esModule','storeSephoraData','Authentication\x20token\x20not\x20found.\x20Please\x20log\x20in\x20again.','❌\x20[SEPHORA_SERVICE]\x20Invalid\x20input:\x20userId\x20missing','🚀\x20[SEPHORA_SERVICE]\x20Storing\x20Sephora\x20data\x20for:','📊\x20[SEPHORA_SERVICE]\x20Basket\x20items:','📊\x20[SEPHORA_SERVICE]\x20Orders:','📊\x20[SEPHORA_SERVICE]\x20Loved\x20items:','📊\x20[SEPHORA_SERVICE]\x20Ratings:','nPSqC','Invalid\x20input:\x20userId\x20missing.','wswQd','auth_token','❌\x20[SEPHORA_SERVICE]\x20No\x20auth\x20token\x20found','iPhone','Android','ecommerce','gjcck','ziiBh','hUfBX','Unknown\x20error','Network\x20error.\x20Please\x20check\x20your\x20connection.','afGHA','log','zYvtb','basket','length','XHONi','orders','MUlbd','loves','hMUqN','ratings','igCZK','tvGPq','error','UvNDu','MyKyy','yuDtw','yZxOn','getItem','onairos_jwt_token','default','enoch_token','wuzHZ','okFCc','Platform','1.0.0','vJKBc','17.0','yhxPp','CVuLK','mobile-sephora','YvMOX','items','map','name','brand','price','quantity','category','imageUrl','itemCount','orderId','date','status','rating','productId','isRecommended','type','userId','total','positive','filter','negative','niAXa','📍\x20[SEPHORA_SERVICE]\x20URL:','API_CONFIG','BASE_URL','/platform-data/store','zmKIE','Bearer\x20','OnairosSDK/1.0.0\x20(','stringify','json','KNogh','UWgdK','✅\x20[SEPHORA_SERVICE]\x20Successfully\x20stored\x20Sephora\x20data','📝\x20[SEPHORA_SERVICE]\x20Backend\x20response:\x20','message','voncp','data','DGCkd','GWEuH','warn','âš ī¸\x20[SEPHORA_SERVICE]\x20Error:\x20','bqUSQ','HTTP\x20','puykE'];_0x4c4e=function(){return _0x1a9f0f;};return _0x4c4e();}function _0x136f(_0x4c4e5a,_0x136f1a){_0x4c4e5a=_0x4c4e5a-0x0;const _0x495af2=_0x4c4e();let _0x581b60=_0x495af2[_0x4c4e5a];return _0x581b60;}function _interopRequireDefault(_0x5d9aef){return _0x5d9aef&&_0x5d9aef[_0x136f(0x1)]?_0x5d9aef:{'default':_0x5d9aef};}const storeSephoraData=async(_0x1ef676,_0x371e9c)=>{const _0x7d5091={'UvNDu':_0x136f(0x3),'voncp':'✅\x20[SEPHORA_SERVICE]\x20Successfully\x20stored\x20Sephora\x20data','DGCkd':'Sephora\x20data\x20stored\x20successfully','zEjZP':_0x136f(0x4),'afGHA':_0x136f(0x5),'zYvtb':_0x136f(0x6),'XHONi':_0x136f(0x7),'MUlbd':_0x136f(0x8),'hMUqN':_0x136f(0x9),'igCZK':_0x136f(0xa),'tvGPq':_0x136f(0xb),'MyKyy':function(_0x27b08b,_0x2ea892){return _0x27b08b!==_0x2ea892;},'yuDtw':_0x136f(0xc),'yZxOn':'softG','PKIrI':_0x136f(0xd),'wuzHZ':_0x136f(0xe),'okFCc':'🔑\x20[SEPHORA_SERVICE]\x20Auth\x20token\x20found','vJKBc':'ios','yhxPp':function(_0x133c17,_0x31f453){return _0x133c17===_0x31f453;},'CVuLK':_0x136f(0xf),'Revzr':_0x136f(0x10),'YvMOX':_0x136f(0x11),'niAXa':'📡\x20[SEPHORA_SERVICE]\x20Sending\x20to\x20backend...','zmKIE':function(_0x477cc0,_0x15c23d,_0x40012b){return _0x477cc0(_0x15c23d,_0x40012b);},'KNogh':function(_0x2807e3,_0x55717e){return _0x2807e3===_0x55717e;},'UWgdK':_0x136f(0x12),'DcCzv':'dwmNE','GWEuH':_0x136f(0x13),'BlgZy':_0x136f(0x14),'bqUSQ':_0x136f(0x15),'fffiD':'❌\x20[SEPHORA_SERVICE]\x20Network\x20error:','puykE':_0x136f(0x16)};console['log'](_0x7d5091[_0x136f(0x17)],_0x1ef676),console[_0x136f(0x18)](_0x7d5091[_0x136f(0x19)],_0x371e9c[_0x136f(0x1a)]['items'][_0x136f(0x1b)]),console[_0x136f(0x18)](_0x7d5091[_0x136f(0x1c)],_0x371e9c[_0x136f(0x1d)][_0x136f(0x1b)]),console[_0x136f(0x18)](_0x7d5091[_0x136f(0x1e)],_0x371e9c[_0x136f(0x1f)][_0x136f(0x1b)]),console[_0x136f(0x18)](_0x7d5091[_0x136f(0x20)],_0x371e9c[_0x136f(0x21)][_0x136f(0x1b)]);if(!_0x1ef676)return'nPSqC'===_0x7d5091[_0x136f(0x22)]?(console['error'](_0x7d5091['zEjZP']),{'success':![],'error':_0x7d5091[_0x136f(0x23)]}):(_0x1e05aa[_0x136f(0x24)]('❌\x20[SEPHORA_SERVICE]\x20No\x20auth\x20token\x20found'),{'success':![],'error':_0x7d5091[_0x136f(0x25)]});try{if(_0x7d5091[_0x136f(0x26)](_0x7d5091[_0x136f(0x27)],_0x7d5091[_0x136f(0x28)])){const _0x9154b7=await _asyncStorage['default'][_0x136f(0x29)](_0x136f(0x2a))||await _asyncStorage[_0x136f(0x2b)][_0x136f(0x29)](_0x136f(0x2c))||await _asyncStorage['default'][_0x136f(0x29)](_0x7d5091['PKIrI']);if(!_0x9154b7)return console[_0x136f(0x24)](_0x7d5091[_0x136f(0x2d)]),{'success':![],'error':_0x7d5091[_0x136f(0x25)]};console[_0x136f(0x18)](_0x7d5091[_0x136f(0x2e)]);const _0xc9cf6a={'platform':_reactNative[_0x136f(0x2f)]['OS'],'appVersion':_0x136f(0x30),'osVersion':_reactNative['Platform']['OS']===_0x7d5091[_0x136f(0x31)]?_0x136f(0x32):_reactNative[_0x136f(0x2f)]['OS'],'deviceModel':_0x7d5091[_0x136f(0x33)](_reactNative[_0x136f(0x2f)]['OS'],_0x7d5091[_0x136f(0x31)])?_0x7d5091[_0x136f(0x34)]:_0x7d5091['Revzr'],'isOfflineSync':![],'extractedAt':new Date()['toISOString']()},_0x50d61f={'platform':_0x136f(0x35),'dataType':_0x7d5091[_0x136f(0x36)],'data':{'basket':{'items':_0x371e9c[_0x136f(0x1a)][_0x136f(0x37)][_0x136f(0x38)](_0x6d5b3b=>({'productId':_0x6d5b3b['id'],'name':_0x6d5b3b[_0x136f(0x39)],'brand':_0x6d5b3b[_0x136f(0x3a)],'price':_0x6d5b3b[_0x136f(0x3b)],'quantity':_0x6d5b3b[_0x136f(0x3c)],'category':_0x6d5b3b[_0x136f(0x3d)],'imageUrl':_0x6d5b3b[_0x136f(0x3e)]})),'total':_0x371e9c[_0x136f(0x1a)]['total'],'itemCount':_0x371e9c[_0x136f(0x1a)][_0x136f(0x3f)]},'orders':_0x371e9c[_0x136f(0x1d)][_0x136f(0x38)](_0x151deb=>({'orderId':_0x151deb[_0x136f(0x40)],'date':_0x151deb[_0x136f(0x41)],'total':_0x151deb['total'],'status':_0x151deb[_0x136f(0x42)],'items':_0x151deb['items'][_0x136f(0x38)](_0x3f6268=>({'productId':_0x3f6268['id'],'name':_0x3f6268[_0x136f(0x39)],'brand':_0x3f6268[_0x136f(0x3a)],'price':_0x3f6268[_0x136f(0x3b)],'quantity':_0x3f6268[_0x136f(0x3c)]}))})),'loves':_0x371e9c[_0x136f(0x1f)][_0x136f(0x38)](_0xc78b30=>({'productId':_0xc78b30['id'],'name':_0xc78b30['name'],'brand':_0xc78b30['brand'],'category':_0xc78b30[_0x136f(0x3d)],'price':_0xc78b30['price'],'rating':_0xc78b30[_0x136f(0x43)],'addedAt':_0xc78b30['addedAt'],'type':'love'})),'ratings':_0x371e9c['ratings'][_0x136f(0x38)](_0x3d6878=>({'productId':_0x3d6878[_0x136f(0x44)],'productName':_0x3d6878['productName'],'score':_0x3d6878[_0x136f(0x43)],'review':_0x3d6878['review'],'date':_0x3d6878[_0x136f(0x41)],'isRecommended':_0x3d6878[_0x136f(0x45)],'sentiment':_0x3d6878[_0x136f(0x46)]})),'sephoraUserId':_0x371e9c[_0x136f(0x47)]},'summary':{'basketItemCount':_0x371e9c[_0x136f(0x1a)][_0x136f(0x37)][_0x136f(0x1b)],'basketTotal':_0x371e9c[_0x136f(0x1a)][_0x136f(0x48)],'orderCount':_0x371e9c[_0x136f(0x1d)][_0x136f(0x1b)],'lovedProductCount':_0x371e9c[_0x136f(0x1f)][_0x136f(0x1b)],'ratingCount':_0x371e9c['ratings']['length'],'positiveRatings':_0x371e9c['ratings']['filter'](_0x1871f9=>_0x1871f9[_0x136f(0x46)]===_0x136f(0x49))[_0x136f(0x1b)],'negativeRatings':_0x371e9c['ratings'][_0x136f(0x4a)](_0xd8736d=>_0xd8736d[_0x136f(0x46)]===_0x136f(0x4b))[_0x136f(0x1b)]},'mobileMetadata':_0xc9cf6a};console[_0x136f(0x18)](_0x7d5091[_0x136f(0x4c)]),console[_0x136f(0x18)](_0x136f(0x4d),_api[_0x136f(0x4e)][_0x136f(0x4f)]+_0x136f(0x50));const _0x40d0d4=await _0x7d5091[_0x136f(0x51)](fetch,_api[_0x136f(0x4e)][_0x136f(0x4f)]+'/platform-data/store',{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x136f(0x52)+_0x9154b7,'User-Agent':_0x136f(0x53)+_reactNative['Platform']['OS']+')'},'body':JSON[_0x136f(0x54)](_0x50d61f)}),_0x282b2b=await _0x40d0d4[_0x136f(0x55)]();if(_0x40d0d4['ok']){if(_0x7d5091[_0x136f(0x56)](_0x7d5091['UWgdK'],_0x7d5091[_0x136f(0x57)])){console[_0x136f(0x18)](_0x136f(0x58));if(_0x282b2b['message']){if(_0x7d5091['DcCzv']!=='wGgPc')console[_0x136f(0x18)](_0x136f(0x59)+_0x282b2b[_0x136f(0x5a)]);else return _0xb005c6[_0x136f(0x18)](_0x7d5091[_0x136f(0x5b)]),_0x248e5a[_0x136f(0x5a)]&&_0xff8a85[_0x136f(0x18)](_0x136f(0x59)+_0x4a9640['message']),{'success':!![],'message':_0x37186d[_0x136f(0x5a)]||_0x7d5091['DGCkd'],'data':_0x5e31a4[_0x136f(0x5c)]};}return{'success':!![],'message':_0x282b2b['message']||_0x7d5091[_0x136f(0x5d)],'data':_0x282b2b['data']};}else return _0xc23e3a[_0x136f(0x24)](_0x7d5091['zEjZP']),{'success':![],'error':'Invalid\x20input:\x20userId\x20missing.'};}else{if(_0x7d5091[_0x136f(0x5e)]!==_0x7d5091['BlgZy'])return console[_0x136f(0x5f)]('âš ī¸\x20[SEPHORA_SERVICE]\x20Backend\x20returned\x20status:\x20'+_0x40d0d4[_0x136f(0x42)]),console[_0x136f(0x5f)](_0x136f(0x60)+(_0x282b2b[_0x136f(0x24)]||_0x7d5091[_0x136f(0x61)])),{'success':![],'error':_0x282b2b[_0x136f(0x24)]||_0x136f(0x62)+_0x40d0d4['status']};else _0xf01dab[_0x136f(0x18)](_0x136f(0x59)+_0x5c2388[_0x136f(0x5a)]);}}else return _0x5bbd54&&_0x1d1405[_0x136f(0x1)]?_0x599fda:{'default':_0x403d57};}catch(_0x15055a){return console[_0x136f(0x24)](_0x7d5091['fffiD'],_0x15055a),{'success':![],'error':_0x15055a[_0x136f(0x5a)]||_0x7d5091[_0x136f(0x63)]};}};exports[_0x136f(0x2)]=storeSephoraData;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.storeSephoraData = 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
+ * Sephora Data Service
13
+ *
14
+ * API layer for storing Sephora shopping data on backend.
15
+ * Sends extracted basket, orders, loves, and ratings to /platform-data/store endpoint.
16
+ *
17
+ * MATCHES ChatGPT implementation pattern
18
+ * - Uses format: { platform, data, metadata }
19
+ * - Platform: "mobile-sephora"
20
+ */
21
+
22
+ /**
23
+ * Structure of a basket item
24
+ */
25
+
26
+ /**
27
+ * Structure of the shopping basket
28
+ */
29
+
30
+ /**
31
+ * Structure of an order item
32
+ */
33
+
34
+ /**
35
+ * Structure of an order
36
+ */
37
+
38
+ /**
39
+ * Structure of a loved/favorited item
40
+ */
41
+
42
+ /**
43
+ * Structure of a product rating
44
+ */
45
+
46
+ /**
47
+ * Combined Sephora data to store
48
+ */
49
+
50
+ /**
51
+ * Response from backend endpoint
52
+ */
53
+
54
+ /**
55
+ * Store Sephora data on backend
56
+ *
57
+ * @param userId - Username or identifier
58
+ * @param data - Sephora shopping data (basket, orders, loves, ratings)
59
+ * @returns Response indicating success/failure with metadata
60
+ */
61
+ const storeSephoraData = async (userId, data) => {
62
+ console.log('🚀 [SEPHORA_SERVICE] Storing Sephora data for:', userId);
63
+ console.log('📊 [SEPHORA_SERVICE] Basket items:', data.basket.items.length);
64
+ console.log('📊 [SEPHORA_SERVICE] Orders:', data.orders.length);
65
+ console.log('📊 [SEPHORA_SERVICE] Loved items:', data.loves.length);
66
+ console.log('📊 [SEPHORA_SERVICE] Ratings:', data.ratings.length);
67
+
68
+ // Input validation
69
+ if (!userId) {
70
+ console.error('❌ [SEPHORA_SERVICE] Invalid input: userId missing');
71
+ return {
72
+ success: false,
73
+ error: 'Invalid input: userId missing.'
74
+ };
75
+ }
76
+ try {
77
+ // Get auth token - check all possible storage keys
78
+ const authToken = (await _asyncStorage.default.getItem('onairos_jwt_token')) || (await _asyncStorage.default.getItem('enoch_token')) || (await _asyncStorage.default.getItem('auth_token'));
79
+ if (!authToken) {
80
+ console.error('❌ [SEPHORA_SERVICE] No auth token found');
81
+ return {
82
+ success: false,
83
+ error: 'Authentication token not found. Please log in again.'
84
+ };
85
+ }
86
+ console.log('🔑 [SEPHORA_SERVICE] Auth token found');
87
+
88
+ // Mobile metadata
89
+ const mobileMetadata = {
90
+ platform: _reactNative.Platform.OS,
91
+ appVersion: '1.0.0',
92
+ osVersion: _reactNative.Platform.OS === 'ios' ? '17.0' : _reactNative.Platform.OS,
93
+ deviceModel: _reactNative.Platform.OS === 'ios' ? 'iPhone' : 'Android',
94
+ isOfflineSync: false,
95
+ extractedAt: new Date().toISOString()
96
+ };
97
+
98
+ // Build request body
99
+ const requestBody = {
100
+ platform: 'mobile-sephora',
101
+ dataType: 'ecommerce',
102
+ data: {
103
+ basket: {
104
+ items: data.basket.items.map(item => ({
105
+ productId: item.id,
106
+ name: item.name,
107
+ brand: item.brand,
108
+ price: item.price,
109
+ quantity: item.quantity,
110
+ category: item.category,
111
+ imageUrl: item.imageUrl
112
+ })),
113
+ total: data.basket.total,
114
+ itemCount: data.basket.itemCount
115
+ },
116
+ orders: data.orders.map(order => ({
117
+ orderId: order.orderId,
118
+ date: order.date,
119
+ total: order.total,
120
+ status: order.status,
121
+ items: order.items.map(item => ({
122
+ productId: item.id,
123
+ name: item.name,
124
+ brand: item.brand,
125
+ price: item.price,
126
+ quantity: item.quantity
127
+ }))
128
+ })),
129
+ loves: data.loves.map(love => ({
130
+ productId: love.id,
131
+ name: love.name,
132
+ brand: love.brand,
133
+ category: love.category,
134
+ price: love.price,
135
+ rating: love.rating,
136
+ addedAt: love.addedAt,
137
+ type: 'love'
138
+ })),
139
+ ratings: data.ratings.map(rating => ({
140
+ productId: rating.productId,
141
+ productName: rating.productName,
142
+ score: rating.rating,
143
+ review: rating.review,
144
+ date: rating.date,
145
+ isRecommended: rating.isRecommended,
146
+ sentiment: rating.type
147
+ })),
148
+ sephoraUserId: data.userId
149
+ },
150
+ summary: {
151
+ basketItemCount: data.basket.items.length,
152
+ basketTotal: data.basket.total,
153
+ orderCount: data.orders.length,
154
+ lovedProductCount: data.loves.length,
155
+ ratingCount: data.ratings.length,
156
+ positiveRatings: data.ratings.filter(r => r.type === 'positive').length,
157
+ negativeRatings: data.ratings.filter(r => r.type === 'negative').length
158
+ },
159
+ mobileMetadata: mobileMetadata
160
+ };
161
+ console.log('📡 [SEPHORA_SERVICE] Sending to backend...');
162
+ console.log('📍 [SEPHORA_SERVICE] URL:', `${_api.API_CONFIG.BASE_URL}/platform-data/store`);
163
+ const response = await fetch(`${_api.API_CONFIG.BASE_URL}/platform-data/store`, {
164
+ method: 'POST',
165
+ headers: {
166
+ 'Content-Type': 'application/json',
167
+ 'Authorization': `Bearer ${authToken}`,
168
+ 'User-Agent': `OnairosSDK/1.0.0 (${_reactNative.Platform.OS})`
169
+ },
170
+ body: JSON.stringify(requestBody)
171
+ });
172
+ const responseData = await response.json();
173
+ if (response.ok) {
174
+ console.log('✅ [SEPHORA_SERVICE] Successfully stored Sephora data');
175
+ if (responseData.message) {
176
+ console.log(`📝 [SEPHORA_SERVICE] Backend response: ${responseData.message}`);
177
+ }
178
+ return {
179
+ success: true,
180
+ message: responseData.message || 'Sephora data stored successfully',
181
+ data: responseData.data
182
+ };
183
+ } else {
184
+ console.warn(`âš ī¸ [SEPHORA_SERVICE] Backend returned status: ${response.status}`);
185
+ console.warn(`âš ī¸ [SEPHORA_SERVICE] Error: ${responseData.error || 'Unknown error'}`);
186
+ return {
187
+ success: false,
188
+ error: responseData.error || `HTTP ${response.status}`
189
+ };
190
+ }
191
+ } catch (error) {
192
+ console.error('❌ [SEPHORA_SERVICE] Network error:', error);
193
+ return {
194
+ success: false,
195
+ error: error.message || 'Network error. Please check your connection.'
196
+ };
197
+ }
198
+ };
199
+ exports.storeSephoraData = storeSephoraData;
200
+ //# sourceMappingURL=sephoraDataService.js.map
@@ -1,8 +1,148 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("./spotifyDataService"),
5
- require("react-native")
6
- ];
7
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
8
- Object[_0xb10e(0x0)](exports,_0xb10e(0x1),{'value':!![]}),exports['useSpotifyDataExtractor']=void 0x0;var _spotifyDataService=__ONAIROS_REQ_FUNC__(0x0),_reactNative=__ONAIROS_REQ_FUNC__(0x1);function _0xb10e(_0x16f9a3,_0xb10e33){_0x16f9a3=_0x16f9a3-0x0;const _0x1f784a=_0x16f9();let _0x279165=_0x1f784a[_0x16f9a3];return _0x279165;}const useSpotifyDataExtractor=()=>{const _0xf204b={'lZMxH':_0xb10e(0x2),'NyUgM':_0xb10e(0x3),'VQnwW':'âš ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20recently\x20played\x20track:','xFxMd':function(_0x3ac874,_0x121b56){return _0x3ac874===_0x121b56;},'Mcgna':'Qyezf','GKsoV':_0xb10e(0x4),'bKxHB':function(_0x5272f8,_0x124c62){return _0x5272f8!==_0x124c62;},'oxUre':_0xb10e(0x5),'yeHTU':_0xb10e(0x6),'XhkLn':_0xb10e(0x7),'gVObB':_0xb10e(0x8),'dURFj':_0xb10e(0x9),'kAuDS':_0xb10e(0xa),'URsBm':_0xb10e(0xb),'GLtIZ':_0xb10e(0xc),'jjNso':_0xb10e(0xd),'VVXyK':function(_0x5c5310,_0x3a6c30){return _0x5c5310===_0x3a6c30;},'aZTuJ':_0xb10e(0xe),'viHFb':_0xb10e(0xf),'tMoUe':_0xb10e(0x10),'vnusH':'Error','OvMJC':_0xb10e(0x11),'jlCCw':_0xb10e(0x12),'RJsOQ':function(_0x5ee0d9,_0x261d81){return _0x5ee0d9+_0x261d81;},'qplLM':function(_0x2418dc,_0x2cb906){return _0x2418dc+_0x2cb906;},'WvcjD':function(_0x8c3781,_0x593000){return _0x8c3781+_0x593000;},'EBdSr':function(_0x2834e1,_0x28ec50){return _0x2834e1===_0x28ec50;},'OjTtE':function(_0x513dd0,_0x5b7b1f){return _0x513dd0===_0x5b7b1f;},'igsAb':function(_0x4d9cf2,_0x2e6729){return _0x4d9cf2===_0x2e6729;},'bjqRR':function(_0x64b24c,_0xb8b0be){return _0x64b24c===_0xb8b0be;},'eRUmh':function(_0x1ac561,_0x5444d2){return _0x1ac561===_0x5444d2;},'maQHE':function(_0x19f862,_0x4272ec){return _0x19f862===_0x4272ec;},'VlOOq':_0xb10e(0x13),'AKPsC':function(_0x564ed0,_0x43e166){return _0x564ed0===_0x43e166;},'bBFjH':function(_0xa62353,_0x41f600){return _0xa62353===_0x41f600;},'AGGTO':function(_0x3ceb88,_0x1d4cba){return _0x3ceb88===_0x1d4cba;},'rAUbp':function(_0x512c45,_0x257655){return _0x512c45===_0x257655;},'WMTis':function(_0x1fa440,_0x3d69d4){return _0x1fa440<_0x3d69d4;},'oaCBw':function(_0x4dceae,_0x4eec83){return _0x4dceae!==_0x4eec83;},'Iskwt':_0xb10e(0x14),'zXNKg':function(_0x1f198e,_0x5b9172){return _0x1f198e-_0x5b9172;},'xNTry':_0xb10e(0x15),'HBheE':'medium_term','QWcln':_0xb10e(0x16),'MmXoA':_0xb10e(0x17),'yEDOr':'An\x20unknown\x20error\x20occurred\x20during\x20data\x20storage.','CszHf':_0xb10e(0x18),'CzVvp':_0xb10e(0x19)},_0x9b8658=async(_0x20d0da,_0x180f25)=>{const _0x285676={'pPqWp':_0xf204b[_0xb10e(0x1a)],'XujaG':_0xf204b[_0xb10e(0x1b)],'xUeLS':_0xf204b['dURFj'],'CqZqJ':_0xf204b[_0xb10e(0x1c)],'KjJzv':_0xb10e(0x1d),'YxFyF':_0xf204b['lZMxH']};var _0x1840e3,_0x2dde4c,_0x167e2b,_0x2f949d,_0x4936b2,_0x287b77,_0x5f169b,_0x41ae2e,_0x53e342;console[_0xb10e(0x1e)](_0xf204b[_0xb10e(0x1f)]),console['log'](_0xf204b[_0xb10e(0x20)],_0x20d0da),console[_0xb10e(0x1e)](_0xf204b[_0xb10e(0x21)],_0x180f25[_0xb10e(0x22)]);if(!_0x20d0da)return _0xf204b['VVXyK'](_0xf204b[_0xb10e(0x23)],_0xf204b[_0xb10e(0x24)])?(_0x10804d[_0xb10e(0x1e)](_0x285676['pPqWp']),!![]):(console[_0xb10e(0x25)](_0xf204b[_0xb10e(0x26)]),_reactNative[_0xb10e(0x27)][_0xb10e(0x28)](_0xf204b[_0xb10e(0x29)],_0xf204b[_0xb10e(0x2a)],[{'text':'OK','style':_0xf204b[_0xb10e(0x2b)]}]),![]);const _0x2dcd13=_0xf204b['RJsOQ'](_0xf204b[_0xb10e(0x2c)](_0xf204b[_0xb10e(0x2d)](_0xf204b[_0xb10e(0x2e)]((_0xf204b[_0xb10e(0x2f)](_0x1840e3=_0x180f25[_0xb10e(0x30)],null)||_0xf204b['xFxMd'](_0x1840e3,void 0x0)||_0xf204b[_0xb10e(0x31)](_0x1840e3=_0x1840e3[_0xb10e(0x32)],null)||_0xf204b[_0xb10e(0x33)](_0x1840e3,void 0x0)?void 0x0:_0x1840e3[_0xb10e(0x34)])||0x0,(_0xf204b[_0xb10e(0x35)](_0x2dde4c=_0x180f25['topItems'],null)||_0xf204b['xFxMd'](_0x2dde4c,void 0x0)||_0xf204b[_0xb10e(0x36)](_0x2dde4c=_0x2dde4c[_0xb10e(0x37)],null)||_0xf204b[_0xb10e(0x2f)](_0x2dde4c,void 0x0)?void 0x0:_0x2dde4c[_0xb10e(0x34)])||0x0),(_0xf204b['VVXyK'](_0x167e2b=_0x180f25[_0xb10e(0x38)],null)||_0xf204b[_0xb10e(0x35)](_0x167e2b,void 0x0)||(_0x167e2b=_0x167e2b[_0xb10e(0x39)])===null||_0xf204b[_0xb10e(0x36)](_0x167e2b,void 0x0)?void 0x0:_0x167e2b[_0xb10e(0x34)])||0x0)+((_0xf204b[_0xb10e(0x2f)](_0x2f949d=_0x180f25[_0xb10e(0x3a)],null)||_0xf204b[_0xb10e(0x33)](_0x2f949d,void 0x0)?void 0x0:_0x2f949d[_0xb10e(0x34)])||0x0),(_0xf204b[_0xb10e(0x3b)](_0x4936b2=_0x180f25[_0xb10e(0x3c)],null)||_0xf204b['igsAb'](_0x4936b2,void 0x0)?void 0x0:_0x4936b2[_0xb10e(0x34)])||0x0),(_0xf204b[_0xb10e(0x31)](_0x287b77=_0x180f25[_0xb10e(0x3d)],null)||_0xf204b[_0xb10e(0x3e)](_0x287b77,void 0x0)?void 0x0:_0x287b77[_0xb10e(0x34)])||0x0);if(_0xf204b[_0xb10e(0x3f)](_0x2dcd13,0x0)){if(_0xb10e(0x40)!==_0xf204b[_0xb10e(0x41)])return console['log'](_0xb10e(0x7)),!![];else{const _0x59f3ea=_0x4d1f0a[_0xb10e(0x42)]&&_0x3bc09f[_0xb10e(0x43)];return!_0x59f3ea&&_0x3f6819[_0xb10e(0x44)](_0xf204b[_0xb10e(0x45)],_0x2cc195),_0x59f3ea;}}const _0x196a46=(((_0x5f169b=_0x180f25[_0xb10e(0x30)])===null||_0xf204b[_0xb10e(0x46)](_0x5f169b,void 0x0)?void 0x0:_0x5f169b[_0xb10e(0x32)])||[])[_0xb10e(0x47)](_0x1c5bdd=>{const _0x13c310=_0x1c5bdd[_0xb10e(0x42)]&&_0x1c5bdd[_0xb10e(0x43)];return!_0x13c310&&(_0xf204b['NyUgM']!==_0xb10e(0x3)?_0x5ec883[_0xb10e(0x44)](_0x285676[_0xb10e(0x48)],_0x53254b):console[_0xb10e(0x44)](_0xf204b['VQnwW'],_0x1c5bdd)),_0x13c310;}),_0x83314f=((_0xf204b[_0xb10e(0x49)](_0x41ae2e=_0x180f25[_0xb10e(0x38)],null)||_0xf204b['VVXyK'](_0x41ae2e,void 0x0)?void 0x0:_0x41ae2e[_0xb10e(0x37)])||[])[_0xb10e(0x47)](_0x1b1f04=>{const _0x56ec83=_0x1b1f04[_0xb10e(0x42)]&&_0x1b1f04[_0xb10e(0x43)];return!_0x56ec83&&console[_0xb10e(0x44)](_0x285676[_0xb10e(0x48)],_0x1b1f04),_0x56ec83;}),_0x6dc309=((_0xf204b[_0xb10e(0x4a)](_0x53e342=_0x180f25[_0xb10e(0x38)],null)||_0xf204b[_0xb10e(0x4b)](_0x53e342,void 0x0)?void 0x0:_0x53e342[_0xb10e(0x39)])||[])[_0xb10e(0x47)](_0x2976bc=>{if(_0xf204b[_0xb10e(0x33)](_0xf204b['Mcgna'],_0xf204b[_0xb10e(0x4c)]))return _0x574e4a['error'](_0x285676['xUeLS'],_0x2c391f['error']),_0x58c08e[_0xb10e(0x27)]['alert'](_0x285676[_0xb10e(0x4d)],_0x55927f[_0xb10e(0x25)]||_0x285676['KjJzv'],[{'text':'OK','style':_0xb10e(0x12)}]),![];else{const _0x5a111f=_0x2976bc[_0xb10e(0x4e)]&&_0x2976bc[_0xb10e(0x43)];return!_0x5a111f&&console[_0xb10e(0x44)](_0xb10e(0x4f),_0x2976bc),_0x5a111f;}}),_0x267dda=(_0x180f25[_0xb10e(0x3a)]||[])[_0xb10e(0x47)](_0x5180b7=>{const _0x3a35fd=_0x5180b7['playlistId']&&_0x5180b7[_0xb10e(0x43)];if(!_0x3a35fd){if(_0xf204b[_0xb10e(0x50)](_0xb10e(0x51),_0xb10e(0x52)))console[_0xb10e(0x44)](_0xf204b[_0xb10e(0x53)],_0x5180b7);else{const _0x51921d=_0x45bc16[_0xb10e(0x42)]&&_0x1b549c[_0xb10e(0x43)];return!_0x51921d&&_0x5007a5[_0xb10e(0x44)]('âš ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20top\x20track:',_0x2fbbee),_0x51921d;}}return _0x3a35fd;}),_0x179e5b=(_0x180f25[_0xb10e(0x3c)]||[])[_0xb10e(0x47)](_0x255a53=>{const _0x23d8d9=_0x255a53['trackId']&&_0x255a53[_0xb10e(0x43)];return!_0x23d8d9&&console[_0xb10e(0x44)](_0x285676[_0xb10e(0x54)],_0x255a53),_0x23d8d9;}),_0x140302=(_0x180f25[_0xb10e(0x3d)]||[])[_0xb10e(0x47)](_0x52faf4=>{const _0x1d958e=_0x52faf4[_0xb10e(0x55)]&&_0x52faf4['name'];return!_0x1d958e&&console[_0xb10e(0x44)](_0xf204b[_0xb10e(0x56)],_0x52faf4),_0x1d958e;}),_0x4a20e6=_0x2dcd13,_0x5cc0e4=_0xf204b[_0xb10e(0x2e)](_0xf204b[_0xb10e(0x2c)](_0xf204b[_0xb10e(0x2c)](_0x196a46[_0xb10e(0x34)],_0x83314f[_0xb10e(0x34)]),_0x6dc309[_0xb10e(0x34)])+_0x267dda[_0xb10e(0x34)]+_0x179e5b[_0xb10e(0x34)],_0x140302[_0xb10e(0x34)]);if(_0xf204b['WMTis'](_0x5cc0e4,_0x4a20e6)){if(_0xf204b[_0xb10e(0x57)](_0xf204b['Iskwt'],_0xf204b[_0xb10e(0x58)])){const _0x1cecc5=_0x3b9874[_0xb10e(0x55)]&&_0x45ff8b[_0xb10e(0x43)];return!_0x1cecc5&&_0xb309c['warn'](_0xf204b[_0xb10e(0x56)],_0x1617cb),_0x1cecc5;}else console[_0xb10e(0x44)](_0xb10e(0x59)+_0xf204b['zXNKg'](_0x4a20e6,_0x5cc0e4)+_0xb10e(0x5a));}try{var _0x56b9d5;console[_0xb10e(0x1e)](_0xf204b[_0xb10e(0x5b)]);const _0x734041=await(0x0,_spotifyDataService[_0xb10e(0x5c)])(_0x20d0da,{'recentlyPlayed':{'items':_0x196a46,'totalCount':_0x196a46[_0xb10e(0x34)]},'topItems':{'tracks':_0x83314f,'artists':_0x6dc309,'timeRange':(_0xf204b['rAUbp'](_0x56b9d5=_0x180f25['topItems'],null)||_0x56b9d5===void 0x0?void 0x0:_0x56b9d5[_0xb10e(0x5d)])||_0xf204b[_0xb10e(0x5e)]},'playlists':_0x267dda,'savedTracks':_0x179e5b,'savedAlbums':_0x140302,'profile':_0x180f25[_0xb10e(0x5f)],'tokenExpiry':_0x180f25[_0xb10e(0x60)],'userId':_0x180f25[_0xb10e(0x61)]});return _0x734041['success']?(console[_0xb10e(0x1e)](_0xf204b[_0xb10e(0x62)]),console['log'](_0xf204b['MmXoA'],_0x734041['data']),!![]):(console['error'](_0xf204b[_0xb10e(0x63)],_0x734041[_0xb10e(0x25)]),_reactNative['Alert']['alert'](_0xf204b[_0xb10e(0x1c)],_0x734041[_0xb10e(0x25)]||_0xf204b[_0xb10e(0x64)],[{'text':'OK','style':_0xf204b['jlCCw']}]),![]);}catch(_0x238507){return console[_0xb10e(0x25)](_0xf204b[_0xb10e(0x65)],_0x238507),_reactNative[_0xb10e(0x27)][_0xb10e(0x28)](_0xf204b[_0xb10e(0x66)],_0xb10e(0x67),[{'text':'OK','style':_0xf204b[_0xb10e(0x2b)]}]),![];}};return{'initiateDataExport':_0x9b8658};};exports[_0xb10e(0x68)]=useSpotifyDataExtractor;function _0x16f9(){const _0xeca936=['defineProperty','__esModule','âš ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20saved\x20track:','VwyJl','FXmcv','âš ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20playlist:','âš ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20saved\x20album:','â„šī¸\x20[SPOTIFY_EXTRACTOR]\x20No\x20data\x20to\x20export\x20-\x20treating\x20as\x20success\x20(connected)','âš ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20top\x20track:','❌\x20[SPOTIFY_EXTRACTOR]\x20Backend\x20storage\x20failed:','Export\x20Failed','🚀\x20[SPOTIFY_EXTRACTOR]\x20Initiating\x20data\x20export','👤\x20[SPOTIFY_EXTRACTOR]\x20Username:','📊\x20[SPOTIFY_EXTRACTOR]\x20Summary:','vAxQv','BmCkz','❌\x20[SPOTIFY_EXTRACTOR]\x20Username\x20is\x20required','Username\x20is\x20required\x20to\x20export\x20Spotify\x20data.','default','tQcwL','jyRTR','📡\x20[SPOTIFY_EXTRACTOR]\x20Sending\x20to\x20backend...','✅\x20[SPOTIFY_EXTRACTOR]\x20Export\x20completed\x20successfully','📊\x20[SPOTIFY_EXTRACTOR]\x20Backend\x20response:','❌\x20[SPOTIFY_EXTRACTOR]\x20Unexpected\x20error\x20during\x20export:','Export\x20Error','XhkLn','gVObB','kAuDS','An\x20unknown\x20error\x20occurred\x20during\x20data\x20storage.','log','URsBm','GLtIZ','jjNso','summary','aZTuJ','viHFb','error','tMoUe','Alert','alert','vnusH','OvMJC','jlCCw','qplLM','RJsOQ','WvcjD','EBdSr','recentlyPlayed','VVXyK','items','xFxMd','length','OjTtE','igsAb','tracks','topItems','artists','playlists','bjqRR','savedTracks','savedAlbums','eRUmh','maQHE','MHZHX','VlOOq','trackId','name','warn','lZMxH','AKPsC','filter','XujaG','bBFjH','AGGTO','rAUbp','GKsoV','CqZqJ','artistId','âš ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20top\x20artist:','bKxHB','pCxJu','wXiPr','oxUre','YxFyF','albumId','yeHTU','oaCBw','Iskwt','âš ī¸\x20[SPOTIFY_EXTRACTOR]\x20Filtered\x20out\x20','\x20invalid\x20items','xNTry','storeSpotifyData','timeRange','HBheE','profile','tokenExpiry','userId','QWcln','dURFj','yEDOr','CszHf','CzVvp','Failed\x20to\x20connect\x20to\x20the\x20data\x20storage\x20service.\x20Please\x20check\x20your\x20network\x20connection.','useSpotifyDataExtractor'];_0x16f9=function(){return _0xeca936;};return _0x16f9();}
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useSpotifyDataExtractor = void 0;
7
+ var _spotifyDataService = require("./spotifyDataService");
8
+ var _reactNative = require("react-native");
9
+ /**
10
+ * Spotify Data Extractor
11
+ *
12
+ * Orchestrates the Spotify data export flow:
13
+ * 1. Receives extracted listening data from WebView
14
+ * 2. Validates and formats data
15
+ * 3. Sends to backend via spotifyDataService
16
+ *
17
+ * This acts as the bridge between OAuthWebView and the backend API.
18
+ *
19
+ * @reference Sephora implementation: src/services/sephoraDataExtractor.ts
20
+ */
21
+
22
+ /**
23
+ * Combined Spotify export data from WebView - matches spotify.ts script output
24
+ */
25
+
26
+ /**
27
+ * Hook for Spotify data extraction operations
28
+ */
29
+ const useSpotifyDataExtractor = () => {
30
+ /**
31
+ * Initiate data export to backend
32
+ *
33
+ * @param username - User identifier
34
+ * @param data - Extracted Spotify data (recentlyPlayed, topItems, playlists, etc.)
35
+ * @returns true if successful, false otherwise
36
+ */
37
+ const initiateDataExport = async (username, data) => {
38
+ var _data$recentlyPlayed, _data$topItems, _data$topItems2, _data$playlists, _data$savedTracks, _data$savedAlbums, _data$recentlyPlayed2, _data$topItems3, _data$topItems4;
39
+ console.log('🚀 [SPOTIFY_EXTRACTOR] Initiating data export');
40
+ console.log('👤 [SPOTIFY_EXTRACTOR] Username:', username);
41
+ console.log('📊 [SPOTIFY_EXTRACTOR] Summary:', data.summary);
42
+ if (!username) {
43
+ console.error('❌ [SPOTIFY_EXTRACTOR] Username is required');
44
+ _reactNative.Alert.alert('Error', 'Username is required to export Spotify data.', [{
45
+ text: 'OK',
46
+ style: 'default'
47
+ }]);
48
+ return false;
49
+ }
50
+ 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);
51
+ if (totalItems === 0) {
52
+ console.log('â„šī¸ [SPOTIFY_EXTRACTOR] No data to export - treating as success (connected)');
53
+ return true;
54
+ }
55
+ const validRecentlyPlayed = (((_data$recentlyPlayed2 = data.recentlyPlayed) === null || _data$recentlyPlayed2 === void 0 ? void 0 : _data$recentlyPlayed2.items) || []).filter(track => {
56
+ const isValid = track.trackId && track.name;
57
+ if (!isValid) {
58
+ console.warn('âš ī¸ [SPOTIFY_EXTRACTOR] Invalid recently played track:', track);
59
+ }
60
+ return isValid;
61
+ });
62
+ const validTopTracks = (((_data$topItems3 = data.topItems) === null || _data$topItems3 === void 0 ? void 0 : _data$topItems3.tracks) || []).filter(track => {
63
+ const isValid = track.trackId && track.name;
64
+ if (!isValid) {
65
+ console.warn('âš ī¸ [SPOTIFY_EXTRACTOR] Invalid top track:', track);
66
+ }
67
+ return isValid;
68
+ });
69
+ const validTopArtists = (((_data$topItems4 = data.topItems) === null || _data$topItems4 === void 0 ? void 0 : _data$topItems4.artists) || []).filter(artist => {
70
+ const isValid = artist.artistId && artist.name;
71
+ if (!isValid) {
72
+ console.warn('âš ī¸ [SPOTIFY_EXTRACTOR] Invalid top artist:', artist);
73
+ }
74
+ return isValid;
75
+ });
76
+ const validPlaylists = (data.playlists || []).filter(playlist => {
77
+ const isValid = playlist.playlistId && playlist.name;
78
+ if (!isValid) {
79
+ console.warn('âš ī¸ [SPOTIFY_EXTRACTOR] Invalid playlist:', playlist);
80
+ }
81
+ return isValid;
82
+ });
83
+ const validSavedTracks = (data.savedTracks || []).filter(track => {
84
+ const isValid = track.trackId && track.name;
85
+ if (!isValid) {
86
+ console.warn('âš ī¸ [SPOTIFY_EXTRACTOR] Invalid saved track:', track);
87
+ }
88
+ return isValid;
89
+ });
90
+ const validSavedAlbums = (data.savedAlbums || []).filter(album => {
91
+ const isValid = album.albumId && album.name;
92
+ if (!isValid) {
93
+ console.warn('âš ī¸ [SPOTIFY_EXTRACTOR] Invalid saved album:', album);
94
+ }
95
+ return isValid;
96
+ });
97
+ const originalCount = totalItems;
98
+ const validCount = validRecentlyPlayed.length + validTopTracks.length + validTopArtists.length + validPlaylists.length + validSavedTracks.length + validSavedAlbums.length;
99
+ if (validCount < originalCount) {
100
+ console.warn(`âš ī¸ [SPOTIFY_EXTRACTOR] Filtered out ${originalCount - validCount} invalid items`);
101
+ }
102
+ try {
103
+ var _data$topItems5;
104
+ console.log('📡 [SPOTIFY_EXTRACTOR] Sending to backend...');
105
+ const result = await (0, _spotifyDataService.storeSpotifyData)(username, {
106
+ recentlyPlayed: {
107
+ items: validRecentlyPlayed,
108
+ totalCount: validRecentlyPlayed.length
109
+ },
110
+ topItems: {
111
+ tracks: validTopTracks,
112
+ artists: validTopArtists,
113
+ timeRange: ((_data$topItems5 = data.topItems) === null || _data$topItems5 === void 0 ? void 0 : _data$topItems5.timeRange) || 'medium_term'
114
+ },
115
+ playlists: validPlaylists,
116
+ savedTracks: validSavedTracks,
117
+ savedAlbums: validSavedAlbums,
118
+ profile: data.profile,
119
+ tokenExpiry: data.tokenExpiry,
120
+ userId: data.userId
121
+ });
122
+ if (result.success) {
123
+ console.log('✅ [SPOTIFY_EXTRACTOR] Export completed successfully');
124
+ console.log('📊 [SPOTIFY_EXTRACTOR] Backend response:', result.data);
125
+ return true;
126
+ } else {
127
+ console.error('❌ [SPOTIFY_EXTRACTOR] Backend storage failed:', result.error);
128
+ _reactNative.Alert.alert('Export Failed', result.error || 'An unknown error occurred during data storage.', [{
129
+ text: 'OK',
130
+ style: 'default'
131
+ }]);
132
+ return false;
133
+ }
134
+ } catch (error) {
135
+ console.error('❌ [SPOTIFY_EXTRACTOR] Unexpected error during export:', error);
136
+ _reactNative.Alert.alert('Export Error', 'Failed to connect to the data storage service. Please check your network connection.', [{
137
+ text: 'OK',
138
+ style: 'default'
139
+ }]);
140
+ return false;
141
+ }
142
+ };
143
+ return {
144
+ initiateDataExport
145
+ };
146
+ };
147
+ exports.useSpotifyDataExtractor = useSpotifyDataExtractor;
148
+ //# sourceMappingURL=spotifyDataExtractor.js.map