@onairos/react-native 3.7.2 → 3.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/lib/commonjs/api/index.js +219 -9
  2. package/lib/commonjs/components/BodyText.js +27 -9
  3. package/lib/commonjs/components/BrandMark.js +111 -10
  4. package/lib/commonjs/components/CodeInput.js +120 -9
  5. package/lib/commonjs/components/EmailInput.js +30 -8
  6. package/lib/commonjs/components/GoogleButton.js +56 -9
  7. package/lib/commonjs/components/HeadingGroup.js +43 -9
  8. package/lib/commonjs/components/LLMDataInputModal.js +664 -14
  9. package/lib/commonjs/components/ModalHeader.js +99 -9
  10. package/lib/commonjs/components/ModalSheet.js +47 -9
  11. package/lib/commonjs/components/Onairos.js +380 -14
  12. package/lib/commonjs/components/OnairosButton.js +313 -13
  13. package/lib/commonjs/components/OnairosSignInButton.js +130 -12
  14. package/lib/commonjs/components/Overlay.js +465 -13
  15. package/lib/commonjs/components/PersonaImage.js +137 -10
  16. package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
  17. package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
  18. package/lib/commonjs/components/PinCreationScreen.js +403 -12
  19. package/lib/commonjs/components/PinInput.js +464 -9
  20. package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
  21. package/lib/commonjs/components/PlatformList.js +137 -10
  22. package/lib/commonjs/components/PlatformToggle.js +180 -9
  23. package/lib/commonjs/components/PrimaryButton.js +180 -10
  24. package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
  25. package/lib/commonjs/components/SignInStep.js +345 -12
  26. package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
  27. package/lib/commonjs/components/VerificationStep.js +176 -11
  28. package/lib/commonjs/components/WelcomeScreen.js +461 -22
  29. package/lib/commonjs/components/icons/Basicproficon.js +37 -8
  30. package/lib/commonjs/components/icons/Basicprofile.js +21 -8
  31. package/lib/commonjs/components/icons/Checkbox.js +21 -8
  32. package/lib/commonjs/components/icons/Checkmark.js +27 -8
  33. package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
  34. package/lib/commonjs/components/icons/Contenticon.js +39 -8
  35. package/lib/commonjs/components/icons/EnochE.js +41 -8
  36. package/lib/commonjs/components/icons/Personalityicon.js +30 -8
  37. package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
  38. package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
  39. package/lib/commonjs/components/icons/Userpreferences.js +21 -8
  40. package/lib/commonjs/components/icons/index.js +84 -17
  41. package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
  42. package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
  43. package/lib/commonjs/components/onboarding/PinInput.js +283 -10
  44. package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
  45. package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
  46. package/lib/commonjs/config/api.js +56 -7
  47. package/lib/commonjs/constants/index.js +120 -7
  48. package/lib/commonjs/context/AuthContext.js +345 -10
  49. package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
  50. package/lib/commonjs/hooks/useConnections.js +102 -8
  51. package/lib/commonjs/hooks/useCredentials.js +178 -10
  52. package/lib/commonjs/hooks/useUserConnections.js +148 -10
  53. package/lib/commonjs/index.js +439 -34
  54. package/lib/commonjs/services/apiClient.js +298 -8
  55. package/lib/commonjs/services/biometricPinService.js +180 -8
  56. package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
  57. package/lib/commonjs/services/chatGPTConversationService.js +275 -9
  58. package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
  59. package/lib/commonjs/services/claudeConversationService.js +158 -9
  60. package/lib/commonjs/services/connectedAccountsService.js +310 -10
  61. package/lib/commonjs/services/googleAuthService.js +252 -11
  62. package/lib/commonjs/services/hingeDataExtractor.js +105 -8
  63. package/lib/commonjs/services/hingeDataService.js +150 -9
  64. package/lib/commonjs/services/imageCompressionService.js +260 -7
  65. package/lib/commonjs/services/instagramDataExtractor.js +126 -8
  66. package/lib/commonjs/services/instagramDataService.js +163 -9
  67. package/lib/commonjs/services/jwtStorageService.js +276 -7
  68. package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
  69. package/lib/commonjs/services/linkedinProfileService.js +222 -9
  70. package/lib/commonjs/services/linkedinScrapingService.js +230 -8
  71. package/lib/commonjs/services/llmDataStorage.js +294 -8
  72. package/lib/commonjs/services/mobileTrainingService.js +186 -8
  73. package/lib/commonjs/services/netflixDataExtractor.js +120 -8
  74. package/lib/commonjs/services/netflixDataService.js +198 -9
  75. package/lib/commonjs/services/pinEncryptionService.js +84 -8
  76. package/lib/commonjs/services/pinStorageUtils.js +105 -7
  77. package/lib/commonjs/services/platformAuthService.js +1484 -12
  78. package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
  79. package/lib/commonjs/services/sephoraDataService.js +200 -9
  80. package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
  81. package/lib/commonjs/services/spotifyDataService.js +241 -9
  82. package/lib/commonjs/services/storageService.js +404 -8
  83. package/lib/commonjs/services/telegramDataExtractor.js +115 -8
  84. package/lib/commonjs/services/telegramDataService.js +499 -9
  85. package/lib/commonjs/services/trainingApiHelpers.js +73 -7
  86. package/lib/commonjs/services/userConnectionsService.js +340 -10
  87. package/lib/commonjs/services/youtubeMigrationService.js +416 -10
  88. package/lib/commonjs/theme/index.js +250 -7
  89. package/lib/commonjs/types/ambient.d.js +2 -1
  90. package/lib/commonjs/types/declarations.d.js +2 -1
  91. package/lib/commonjs/types/index.js +6 -1
  92. package/lib/commonjs/types/node-fix.d.js +2 -1
  93. package/lib/commonjs/types/node-override.d.js +2 -1
  94. package/lib/commonjs/types/opacity.d.js +2 -1
  95. package/lib/commonjs/types.js +14 -1
  96. package/lib/commonjs/utils/Portal.js +98 -8
  97. package/lib/commonjs/utils/api.js +130 -9
  98. package/lib/commonjs/utils/assetRegistry.js +210 -35
  99. package/lib/commonjs/utils/auth.js +112 -9
  100. package/lib/commonjs/utils/connectorTests.js +613 -29
  101. package/lib/commonjs/utils/crypto.js +62 -8
  102. package/lib/commonjs/utils/debugHelper.js +64 -1
  103. package/lib/commonjs/utils/encryption.js +76 -7
  104. package/lib/commonjs/utils/eventUtils.js +288 -1
  105. package/lib/commonjs/utils/haptics.js +66 -9
  106. package/lib/commonjs/utils/imagePreloader.js +6 -1
  107. package/lib/commonjs/utils/networkDiagnostics.js +226 -8
  108. package/lib/commonjs/utils/onairosApi.js +350 -9
  109. package/lib/commonjs/utils/programmaticFlow.js +117 -9
  110. package/lib/commonjs/utils/retryHelper.js +220 -1
  111. package/lib/commonjs/utils/secureStorage.js +349 -10
  112. package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
  113. package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
  114. package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
  115. package/lib/commonjs/utils/webviewScripts/index.js +698 -15
  116. package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
  117. package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
  118. package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
  119. package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
  120. package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
  121. package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
  122. package/lib/module/api/index.js +211 -1
  123. package/lib/module/components/BodyText.js +20 -1
  124. package/lib/module/components/BrandMark.js +104 -1
  125. package/lib/module/components/CodeInput.js +113 -1
  126. package/lib/module/components/EmailInput.js +23 -1
  127. package/lib/module/components/GoogleButton.js +49 -1
  128. package/lib/module/components/HeadingGroup.js +36 -1
  129. package/lib/module/components/LLMDataInputModal.js +656 -7
  130. package/lib/module/components/ModalHeader.js +92 -1
  131. package/lib/module/components/ModalSheet.js +39 -1
  132. package/lib/module/components/Onairos.js +373 -1
  133. package/lib/module/components/OnairosButton.js +305 -1
  134. package/lib/module/components/OnairosSignInButton.js +121 -1
  135. package/lib/module/components/Overlay.js +456 -1
  136. package/lib/module/components/PersonaImage.js +129 -1
  137. package/lib/module/components/PersonaLoadingScreen.js +310 -1
  138. package/lib/module/components/PersonalizationConsentScreen.js +460 -1
  139. package/lib/module/components/PinCreationScreen.js +396 -1
  140. package/lib/module/components/PinInput.js +456 -1
  141. package/lib/module/components/PlatformConnectorsStep.js +1302 -6
  142. package/lib/module/components/PlatformList.js +129 -1
  143. package/lib/module/components/PlatformToggle.js +173 -1
  144. package/lib/module/components/PrimaryButton.js +172 -1
  145. package/lib/module/components/SignInMatchAnimation.js +189 -1
  146. package/lib/module/components/SignInStep.js +338 -1
  147. package/lib/module/components/UniversalOnboarding.js +2770 -1
  148. package/lib/module/components/VerificationStep.js +168 -1
  149. package/lib/module/components/WelcomeScreen.js +453 -1
  150. package/lib/module/components/icons/Basicproficon.js +30 -1
  151. package/lib/module/components/icons/Basicprofile.js +14 -1
  152. package/lib/module/components/icons/Checkbox.js +14 -1
  153. package/lib/module/components/icons/Checkmark.js +20 -1
  154. package/lib/module/components/icons/Contentanalysis.js +14 -1
  155. package/lib/module/components/icons/Contenticon.js +32 -1
  156. package/lib/module/components/icons/EnochE.js +34 -1
  157. package/lib/module/components/icons/Personalityicon.js +23 -1
  158. package/lib/module/components/icons/Personalityprofile.js +14 -1
  159. package/lib/module/components/icons/Personalitytraits.js +14 -1
  160. package/lib/module/components/icons/Userpreferences.js +14 -1
  161. package/lib/module/components/icons/index.js +13 -1
  162. package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
  163. package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
  164. package/lib/module/components/onboarding/PinInput.js +274 -1
  165. package/lib/module/components/onboarding/PlatformConnector.js +240 -1
  166. package/lib/module/config/PLATFORM_APIS.md +849 -0
  167. package/lib/module/config/api.js +47 -1
  168. package/lib/module/constants/index.js +114 -1
  169. package/lib/module/context/AuthContext.js +335 -1
  170. package/lib/module/hooks/useConnectedAccounts.js +106 -1
  171. package/lib/module/hooks/useConnections.js +95 -1
  172. package/lib/module/hooks/useCredentials.js +171 -6
  173. package/lib/module/hooks/useUserConnections.js +140 -1
  174. package/lib/module/index.js +172 -1
  175. package/lib/module/services/apiClient.js +295 -1
  176. package/lib/module/services/biometricPinService.js +169 -1
  177. package/lib/module/services/chatGPTConversationExtractor.js +149 -1
  178. package/lib/module/services/chatGPTConversationService.js +268 -1
  179. package/lib/module/services/claudeConversationExtractor.js +97 -1
  180. package/lib/module/services/claudeConversationService.js +151 -1
  181. package/lib/module/services/connectedAccountsService.js +293 -1
  182. package/lib/module/services/googleAuthService.js +241 -1
  183. package/lib/module/services/hingeDataExtractor.js +99 -1
  184. package/lib/module/services/hingeDataService.js +143 -1
  185. package/lib/module/services/imageCompressionService.js +250 -1
  186. package/lib/module/services/instagramDataExtractor.js +120 -1
  187. package/lib/module/services/instagramDataService.js +156 -1
  188. package/lib/module/services/jwtStorageService.js +257 -1
  189. package/lib/module/services/linkedinDOMExtractor.js +234 -1
  190. package/lib/module/services/linkedinProfileService.js +210 -1
  191. package/lib/module/services/linkedinScrapingService.js +219 -1
  192. package/lib/module/services/llmDataStorage.js +277 -1
  193. package/lib/module/services/mobileTrainingService.js +173 -1
  194. package/lib/module/services/netflixDataExtractor.js +114 -1
  195. package/lib/module/services/netflixDataService.js +191 -1
  196. package/lib/module/services/pinEncryptionService.js +74 -6
  197. package/lib/module/services/pinStorageUtils.js +93 -1
  198. package/lib/module/services/platformAuthService.js +1461 -1
  199. package/lib/module/services/sephoraDataExtractor.js +134 -1
  200. package/lib/module/services/sephoraDataService.js +193 -1
  201. package/lib/module/services/spotifyDataExtractor.js +142 -1
  202. package/lib/module/services/spotifyDataService.js +234 -1
  203. package/lib/module/services/storageService.js +383 -1
  204. package/lib/module/services/telegramDataExtractor.js +109 -1
  205. package/lib/module/services/telegramDataService.js +493 -1
  206. package/lib/module/services/trainingApiHelpers.js +67 -1
  207. package/lib/module/services/userConnectionsService.js +329 -1
  208. package/lib/module/services/youtubeMigrationService.js +405 -1
  209. package/lib/module/theme/index.js +245 -1
  210. package/lib/module/types.js +10 -1
  211. package/lib/module/utils/Portal.js +90 -1
  212. package/lib/module/utils/api.js +118 -1
  213. package/lib/module/utils/assetRegistry.js +200 -34
  214. package/lib/module/utils/auth.js +100 -1
  215. package/lib/module/utils/connectorTests.js +600 -27
  216. package/lib/module/utils/crypto.js +54 -1
  217. package/lib/module/utils/debugHelper.js +54 -1
  218. package/lib/module/utils/encryption.js +67 -1
  219. package/lib/module/utils/eventUtils.js +270 -1
  220. package/lib/module/utils/haptics.js +59 -8
  221. package/lib/module/utils/imagePreloader.js +3 -1
  222. package/lib/module/utils/networkDiagnostics.js +217 -1
  223. package/lib/module/utils/onairosApi.js +333 -1
  224. package/lib/module/utils/programmaticFlow.js +111 -1
  225. package/lib/module/utils/retryHelper.js +211 -1
  226. package/lib/module/utils/secureStorage.js +330 -6
  227. package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
  228. package/lib/module/utils/webviewScripts/claude.js +370 -1
  229. package/lib/module/utils/webviewScripts/hinge.js +405 -1
  230. package/lib/module/utils/webviewScripts/index.js +434 -1
  231. package/lib/module/utils/webviewScripts/instagram.js +448 -1
  232. package/lib/module/utils/webviewScripts/linkedin.js +874 -1
  233. package/lib/module/utils/webviewScripts/netflix.js +376 -1
  234. package/lib/module/utils/webviewScripts/sephora.js +510 -1
  235. package/lib/module/utils/webviewScripts/spotify.js +413 -1
  236. package/lib/module/utils/webviewScripts/telegram.js +672 -1
  237. package/package.json +2 -2
@@ -1,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
- Object['defineProperty'](exports,_0x426a(0x0),{'value':!![]}),exports[_0x426a(0x1)]=void 0x0;function _0x4ade(){const _0x4c57fc=['__esModule','useSephoraDataExtractor','âš ī¸\x20[SEPHORA_EXTRACTOR]\x20Invalid\x20loved\x20item:','An\x20unknown\x20error\x20occurred\x20during\x20data\x20storage.','default','âš ī¸\x20[SEPHORA_EXTRACTOR]\x20Invalid\x20basket\x20item:','âš ī¸\x20[SEPHORA_EXTRACTOR]\x20Invalid\x20order:','xgHOW','number','👤\x20[SEPHORA_EXTRACTOR]\x20Username:','AqcFJ','FFJZm','❌\x20[SEPHORA_EXTRACTOR]\x20Username\x20is\x20required','Username\x20is\x20required\x20to\x20export\x20Sephora\x20data.','❌\x20[SEPHORA_EXTRACTOR]\x20Backend\x20storage\x20failed:','Export\x20Failed','❌\x20[SEPHORA_EXTRACTOR]\x20Unexpected\x20error\x20during\x20export:','Failed\x20to\x20connect\x20to\x20the\x20data\x20storage\x20service.\x20Please\x20check\x20your\x20network\x20connection.','lPBlS','TQVJu','idOXr','TQSZw','narhy','vvDBD','QSZkY','PxDvb','âš ī¸\x20[SEPHORA_EXTRACTOR]\x20Invalid\x20rating:','log','gNQIn','xLvyV','📊\x20[SEPHORA_EXTRACTOR]\x20Summary:','summary','BLmGA','VoIzr','warn','âš ī¸\x20[SEPHORA_EXTRACTOR]\x20Filtered\x20out\x20','lnEtP','\x20invalid\x20items','error','piCqX','Alert','alert','Error','cMLiW','CgNOT','EVtbv','items','length','orders','pEWcO','OAzyt','loves','ratings','HHdwo','basket','name','WEBFj','WkOLU','YNqrD','filter','orderId','JJRwD','woWFi','productId','rating','xczDv','QLVQo','xYrru','jEAmK','YcBmk','RbGcT','pOLJe','TdmGm','HBdcI','Tkmxt','WWKnU','APymu','IdAGR','Vkzcj','Efweb','vINye','iSnYy','eLSXY','storeSephoraData','EJHrC','total','userId','success','📊\x20[SEPHORA_EXTRACTOR]\x20Backend\x20response:','data','EcKKj','viIcO','lRflI','rDUGU'];_0x4ade=function(){return _0x4c57fc;};return _0x4ade();}var _sephoraDataService=__ONAIROS_REQ_FUNC__(0x0),_reactNative=__ONAIROS_REQ_FUNC__(0x1);function _0x426a(_0x4ade3c,_0x426a8e){_0x4ade3c=_0x4ade3c-0x0;const _0x2c0e21=_0x4ade();let _0x4e4f0d=_0x2c0e21[_0x4ade3c];return _0x4e4f0d;}const useSephoraDataExtractor=()=>{const _0xd87212={'lnEtP':function(_0x3c335e,_0x53a4a9){return _0x3c335e-_0x53a4a9;},'PxDvb':_0x426a(0x2),'lPBlS':_0x426a(0x3),'TQVJu':_0x426a(0x4),'idOXr':function(_0x4c4641,_0x49ec3d){return _0x4c4641===_0x49ec3d;},'TQSZw':'HaqKU','narhy':_0x426a(0x5),'vvDBD':_0x426a(0x6),'QSZkY':'â„šī¸\x20[SEPHORA_EXTRACTOR]\x20No\x20data\x20to\x20export\x20-\x20treating\x20as\x20success\x20(connected)','Ebhqb':_0x426a(0x7),'dBnrO':_0x426a(0x8),'gNQIn':'🚀\x20[SEPHORA_EXTRACTOR]\x20Initiating\x20data\x20export','xLvyV':_0x426a(0x9),'BLmGA':_0x426a(0xa),'VoIzr':_0x426a(0xb),'piCqX':_0x426a(0xc),'cMLiW':_0x426a(0xd),'MZBKr':function(_0x53f9bb,_0x3825df){return _0x53f9bb+_0x3825df;},'CgNOT':function(_0x45fa3e,_0x58ef2d){return _0x45fa3e+_0x58ef2d;},'jEAmK':function(_0xe0a70b,_0x1831ab){return _0xe0a70b===_0x1831ab;},'EVtbv':function(_0x5ddc14,_0x144bae){return _0x5ddc14===_0x144bae;},'pEWcO':function(_0x5519cd,_0x465b6d){return _0x5519cd===_0x465b6d;},'OAzyt':function(_0x121dc5,_0x188976){return _0x121dc5===_0x188976;},'TdmGm':function(_0x1bde10,_0x3d0406){return _0x1bde10===_0x3d0406;},'HHdwo':function(_0x59e2c0,_0x3a4e2d){return _0x59e2c0===_0x3a4e2d;},'MhcDf':function(_0x2756a1,_0x470ff5){return _0x2756a1+_0x470ff5;},'QLVQo':function(_0x2b122b,_0x115be0){return _0x2b122b+_0x115be0;},'xYrru':function(_0x14233e,_0x1de20e){return _0x14233e+_0x1de20e;},'YcBmk':function(_0x531771,_0x5921a8){return _0x531771===_0x5921a8;},'RbGcT':function(_0x245e16,_0x459968){return _0x245e16===_0x459968;},'pOLJe':function(_0x216a07,_0x119bfc){return _0x216a07===_0x119bfc;},'HBdcI':function(_0x23538d,_0x21cd0c){return _0x23538d===_0x21cd0c;},'Tkmxt':function(_0x1c7910,_0x55b45e){return _0x1c7910===_0x55b45e;},'WWKnU':function(_0xc80be7,_0x3e91b2){return _0xc80be7+_0x3e91b2;},'APymu':function(_0x225582,_0x359594){return _0x225582<_0x359594;},'IdAGR':function(_0x22bcea,_0x944bfa){return _0x22bcea===_0x944bfa;},'vINye':function(_0x2da7d5,_0x4e048a){return _0x2da7d5!==_0x4e048a;},'iSnYy':'ErYAp','eLSXY':'GGLqp','EJHrC':function(_0x506b52,_0x81af8a){return _0x506b52===_0x81af8a;},'tgqFA':'✅\x20[SEPHORA_EXTRACTOR]\x20Export\x20completed\x20successfully','EcKKj':_0x426a(0xe),'viIcO':_0x426a(0xf),'lRflI':_0x426a(0x10),'eKxkv':'Export\x20Error','rDUGU':_0x426a(0x11)},_0x33df0a=async(_0x34f503,_0x4ccb62)=>{const _0x9d0ede={'YNqrD':_0xd87212[_0x426a(0x12)],'LTctr':_0xd87212[_0x426a(0x13)],'WgCyK':function(_0x578acb,_0x5bf64b){return _0xd87212[_0x426a(0x14)](_0x578acb,_0x5bf64b);},'WEBFj':_0xd87212[_0x426a(0x15)],'WkOLU':_0xd87212[_0x426a(0x16)],'SEjQR':_0xd87212[_0x426a(0x17)],'zQPCP':_0xd87212[_0x426a(0x18)],'omxBE':function(_0x4dcf25,_0x26edab){return _0x4dcf25!==_0x26edab;},'JJRwD':_0xd87212['Ebhqb'],'woWFi':_0xd87212[_0x426a(0x19)],'xczDv':_0xd87212['dBnrO'],'AhONA':_0x426a(0x1a)};var _0x139247,_0x4e24dd,_0x3d12b6,_0x15c3e8,_0x1b49ff,_0x216b8d,_0x5d4444,_0x5068fb,_0x2428af;console[_0x426a(0x1b)](_0xd87212[_0x426a(0x1c)]),console['log'](_0xd87212[_0x426a(0x1d)],_0x34f503),console[_0x426a(0x1b)](_0x426a(0x1e),_0x4ccb62[_0x426a(0x1f)]);if(!_0x34f503){if(_0xd87212[_0x426a(0x14)](_0xd87212[_0x426a(0x20)],_0xd87212[_0x426a(0x21)]))_0x12de8d[_0x426a(0x22)](_0x426a(0x23)+_0xd87212[_0x426a(0x24)](_0x257b05,_0x1fdb93)+_0x426a(0x25));else return console[_0x426a(0x26)](_0xd87212[_0x426a(0x27)]),_reactNative[_0x426a(0x28)][_0x426a(0x29)](_0x426a(0x2a),_0xd87212[_0x426a(0x2b)],[{'text':'OK','style':_0xd87212[_0x426a(0x13)]}]),![];}const _0x28d0d0=_0xd87212['MZBKr'](_0xd87212[_0x426a(0x2c)]((_0xd87212['jEAmK'](_0x139247=_0x4ccb62['basket'],null)||_0xd87212[_0x426a(0x14)](_0x139247,void 0x0)||_0xd87212[_0x426a(0x2d)](_0x139247=_0x139247[_0x426a(0x2e)],null)||_0xd87212['jEAmK'](_0x139247,void 0x0)?void 0x0:_0x139247[_0x426a(0x2f)])||0x0,(_0xd87212[_0x426a(0x14)](_0x4e24dd=_0x4ccb62[_0x426a(0x30)],null)||_0xd87212[_0x426a(0x31)](_0x4e24dd,void 0x0)?void 0x0:_0x4e24dd[_0x426a(0x2f)])||0x0)+((_0xd87212[_0x426a(0x32)](_0x3d12b6=_0x4ccb62[_0x426a(0x33)],null)||_0x3d12b6===void 0x0?void 0x0:_0x3d12b6[_0x426a(0x2f)])||0x0),((_0x15c3e8=_0x4ccb62[_0x426a(0x34)])===null||_0xd87212['TdmGm'](_0x15c3e8,void 0x0)?void 0x0:_0x15c3e8[_0x426a(0x2f)])||0x0);if(_0xd87212[_0x426a(0x35)](_0x28d0d0,0x0))return console['log']('â„šī¸\x20[SEPHORA_EXTRACTOR]\x20No\x20data\x20to\x20export\x20-\x20treating\x20as\x20success\x20(connected)'),!![];const _0x227771=((_0xd87212[_0x426a(0x2d)](_0x1b49ff=_0x4ccb62[_0x426a(0x36)],null)||_0xd87212[_0x426a(0x35)](_0x1b49ff,void 0x0)?void 0x0:_0x1b49ff[_0x426a(0x2e)])||[])['filter'](_0x30888a=>{const _0x26890d=_0x30888a['id']&&_0x30888a[_0x426a(0x37)];if(!_0x26890d){if(_0x9d0ede['WgCyK'](_0x9d0ede[_0x426a(0x38)],'HaqKU'))console[_0x426a(0x22)](_0x9d0ede[_0x426a(0x39)],_0x30888a);else return _0x34b670['error'](_0x426a(0xe),_0x15cc78[_0x426a(0x26)]),_0x1a9969[_0x426a(0x28)][_0x426a(0x29)](_0x426a(0xf),_0x496880[_0x426a(0x26)]||_0x9d0ede[_0x426a(0x3a)],[{'text':'OK','style':_0x9d0ede['LTctr']}]),![];}return _0x26890d;}),_0x1e0cc6=(_0x4ccb62[_0x426a(0x30)]||[])[_0x426a(0x3b)](_0x5bfe47=>{const _0x125e78=_0x5bfe47[_0x426a(0x3c)]&&_0x5bfe47['date'];return!_0x125e78&&console[_0x426a(0x22)](_0x9d0ede['SEjQR'],_0x5bfe47),_0x125e78;}),_0x2ec898=(_0x4ccb62[_0x426a(0x33)]||[])[_0x426a(0x3b)](_0x4e45fd=>{const _0x14c2c3=_0x4e45fd['id']&&_0x4e45fd[_0x426a(0x37)];if(!_0x14c2c3){if(_0x9d0ede['omxBE'](_0x426a(0x7),_0x9d0ede[_0x426a(0x3d)]))return _0x4526aa[_0x426a(0x1b)](_0x9d0ede['zQPCP']),!![];else console[_0x426a(0x22)](_0x9d0ede[_0x426a(0x3e)],_0x4e45fd);}return _0x14c2c3;}),_0x15dbf1=(_0x4ccb62[_0x426a(0x34)]||[])[_0x426a(0x3b)](_0x32763b=>{const _0x173200=_0x32763b[_0x426a(0x3f)]&&typeof _0x32763b[_0x426a(0x40)]===_0x9d0ede[_0x426a(0x41)];return!_0x173200&&console[_0x426a(0x22)](_0x9d0ede['AhONA'],_0x32763b),_0x173200;}),_0x4fd49a=_0xd87212['MhcDf'](_0xd87212[_0x426a(0x42)](_0xd87212[_0x426a(0x43)]((_0xd87212['EVtbv'](_0x216b8d=_0x4ccb62['basket'],null)||_0xd87212[_0x426a(0x35)](_0x216b8d,void 0x0)||_0xd87212[_0x426a(0x44)](_0x216b8d=_0x216b8d['items'],null)||_0xd87212[_0x426a(0x45)](_0x216b8d,void 0x0)?void 0x0:_0x216b8d['length'])||0x0,(_0xd87212[_0x426a(0x46)](_0x5d4444=_0x4ccb62[_0x426a(0x30)],null)||_0xd87212[_0x426a(0x47)](_0x5d4444,void 0x0)?void 0x0:_0x5d4444['length'])||0x0),(_0xd87212[_0x426a(0x48)](_0x5068fb=_0x4ccb62[_0x426a(0x33)],null)||_0xd87212[_0x426a(0x45)](_0x5068fb,void 0x0)?void 0x0:_0x5068fb[_0x426a(0x2f)])||0x0),(_0xd87212[_0x426a(0x49)](_0x2428af=_0x4ccb62[_0x426a(0x34)],null)||_0xd87212[_0x426a(0x4a)](_0x2428af,void 0x0)?void 0x0:_0x2428af[_0x426a(0x2f)])||0x0),_0x28b3e=_0xd87212[_0x426a(0x4b)](_0x227771['length']+_0x1e0cc6[_0x426a(0x2f)],_0x2ec898[_0x426a(0x2f)])+_0x15dbf1[_0x426a(0x2f)];_0xd87212[_0x426a(0x4c)](_0x28b3e,_0x4fd49a)&&(_0xd87212[_0x426a(0x4d)](_0x426a(0x4e),_0x426a(0x4f))?_0xe50688['warn'](_0x9d0ede[_0x426a(0x39)],_0x20b878):console[_0x426a(0x22)](_0x426a(0x23)+_0xd87212[_0x426a(0x24)](_0x4fd49a,_0x28b3e)+_0x426a(0x25)));try{if(_0xd87212[_0x426a(0x50)](_0xd87212[_0x426a(0x51)],_0xd87212[_0x426a(0x52)])){var _0x59f51c;console[_0x426a(0x1b)]('📡\x20[SEPHORA_EXTRACTOR]\x20Sending\x20to\x20backend...');const _0x2a60bc=await(0x0,_sephoraDataService[_0x426a(0x53)])(_0x34f503,{'basket':{'items':_0x227771,'total':((_0x59f51c=_0x4ccb62[_0x426a(0x36)])===null||_0xd87212[_0x426a(0x54)](_0x59f51c,void 0x0)?void 0x0:_0x59f51c[_0x426a(0x55)])||0x0,'itemCount':_0x227771[_0x426a(0x2f)]},'orders':_0x1e0cc6,'loves':_0x2ec898,'ratings':_0x15dbf1,'userId':_0x4ccb62[_0x426a(0x56)]});return _0x2a60bc[_0x426a(0x57)]?(console[_0x426a(0x1b)](_0xd87212['tgqFA']),console[_0x426a(0x1b)](_0x426a(0x58),_0x2a60bc[_0x426a(0x59)]),!![]):(console['error'](_0xd87212[_0x426a(0x5a)],_0x2a60bc[_0x426a(0x26)]),_reactNative[_0x426a(0x28)]['alert'](_0xd87212[_0x426a(0x5b)],_0x2a60bc[_0x426a(0x26)]||_0xd87212[_0x426a(0x12)],[{'text':'OK','style':_0xd87212[_0x426a(0x13)]}]),![]);}else _0x2bdf90['warn'](_0xd87212[_0x426a(0x19)],_0x6471b9);}catch(_0x44c6ba){return console[_0x426a(0x26)](_0xd87212[_0x426a(0x5c)],_0x44c6ba),_reactNative[_0x426a(0x28)][_0x426a(0x29)](_0xd87212['eKxkv'],_0xd87212[_0x426a(0x5d)],[{'text':'OK','style':_0x426a(0x4)}]),![];}};return{'initiateDataExport':_0x33df0a};};exports[_0x426a(0x1)]=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[_0x47ff(0x0)](exports,_0x47ff(0x1),{'value':!![]}),exports[_0x47ff(0x2)]=void 0x0;function _0x47ff(_0x1fdf63,_0x47ff4c){_0x1fdf63=_0x1fdf63-0x0;const _0x137324=_0x1fdf();let _0x579767=_0x137324[_0x1fdf63];return _0x579767;}var _api=__ONAIROS_REQ_FUNC__(0x0),_asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x1)),_reactNative=__ONAIROS_REQ_FUNC__(0x2);function _interopRequireDefault(_0x116c78){return _0x116c78&&_0x116c78[_0x47ff(0x1)]?_0x116c78:{'default':_0x116c78};}function _0x1fdf(){const _0x372e87=['defineProperty','__esModule','storeSephoraData','❌\x20[SEPHORA_SERVICE]\x20No\x20auth\x20token\x20found','Network\x20error.\x20Please\x20check\x20your\x20connection.','Unknown\x20error','🚀\x20[SEPHORA_SERVICE]\x20Storing\x20Sephora\x20data\x20for:','📊\x20[SEPHORA_SERVICE]\x20Orders:','📊\x20[SEPHORA_SERVICE]\x20Loved\x20items:','📊\x20[SEPHORA_SERVICE]\x20Ratings:','❌\x20[SEPHORA_SERVICE]\x20Invalid\x20input:\x20userId\x20missing','Invalid\x20input:\x20userId\x20missing.','onairos_jwt_token','auth_token','1.0.0','ios','17.0','iPhone','Android','📍\x20[SEPHORA_SERVICE]\x20URL:','XZNUN','UbfXU','❌\x20[SEPHORA_SERVICE]\x20Network\x20error:','log','YwgxH','📊\x20[SEPHORA_SERVICE]\x20Basket\x20items:','basket','items','length','orders','UrUIg','loves','ratings','MttuU','KOJeJ','error','sgDGx','default','TsZph','qNtcq','getItem','DXELG','gQNQE','Platform','GeZiq','wnlfe','UiQYH','fhZTR','toISOString','mobile-sephora','ecommerce','map','name','brand','price','quantity','category','total','itemCount','date','status','addedAt','rating','isRecommended','type','userId','positive','filter','negative','mplLe','eAvAr','API_CONFIG','BASE_URL','/platform-data/store','Bearer\x20','OnairosSDK/1.0.0\x20(','stringify','json','message','EqUGR','Jfvan','📝\x20[SEPHORA_SERVICE]\x20Backend\x20response:\x20','Sephora\x20data\x20stored\x20successfully','data','DVCzs','warn','âš ī¸\x20[SEPHORA_SERVICE]\x20Backend\x20returned\x20status:\x20','âš ī¸\x20[SEPHORA_SERVICE]\x20Error:\x20','ZnisK','Xbrcx','hdQhT','HTTP\x20','llXjc'];_0x1fdf=function(){return _0x372e87;};return _0x1fdf();}const storeSephoraData=async(_0x14a7da,_0x7d2e94)=>{const _0x4e9461={'gQNQE':_0x47ff(0x3),'Jfvan':'Authentication\x20token\x20not\x20found.\x20Please\x20log\x20in\x20again.','ivsWl':_0x47ff(0x4),'ZnisK':_0x47ff(0x5),'YwgxH':_0x47ff(0x6),'cHzTT':_0x47ff(0x7),'UrUIg':_0x47ff(0x8),'sxahi':_0x47ff(0x9),'MttuU':function(_0x77cf9b,_0x25ed1b){return _0x77cf9b!==_0x25ed1b;},'KOJeJ':'NnBhy','sgDGx':_0x47ff(0xa),'SmcCn':_0x47ff(0xb),'TsZph':_0x47ff(0xc),'qNtcq':'enoch_token','DXELG':_0x47ff(0xd),'PyGSG':'🔑\x20[SEPHORA_SERVICE]\x20Auth\x20token\x20found','GeZiq':_0x47ff(0xe),'wnlfe':_0x47ff(0xf),'eZuFp':_0x47ff(0x10),'UiQYH':_0x47ff(0x11),'fhZTR':_0x47ff(0x12),'mplLe':'📡\x20[SEPHORA_SERVICE]\x20Sending\x20to\x20backend...','eAvAr':_0x47ff(0x13),'Xbrcx':function(_0x1a0497,_0x2d4b0c){return _0x1a0497!==_0x2d4b0c;},'EqUGR':_0x47ff(0x14),'ndcVK':function(_0x14c577,_0x2e1743){return _0x14c577!==_0x2e1743;},'DVCzs':_0x47ff(0x15),'hdQhT':'QcVKg','llXjc':_0x47ff(0x16)};console[_0x47ff(0x17)](_0x4e9461[_0x47ff(0x18)],_0x14a7da),console['log'](_0x47ff(0x19),_0x7d2e94[_0x47ff(0x1a)][_0x47ff(0x1b)][_0x47ff(0x1c)]),console[_0x47ff(0x17)](_0x4e9461['cHzTT'],_0x7d2e94[_0x47ff(0x1d)][_0x47ff(0x1c)]),console[_0x47ff(0x17)](_0x4e9461[_0x47ff(0x1e)],_0x7d2e94[_0x47ff(0x1f)][_0x47ff(0x1c)]),console[_0x47ff(0x17)](_0x4e9461['sxahi'],_0x7d2e94[_0x47ff(0x20)][_0x47ff(0x1c)]);if(!_0x14a7da){if(_0x4e9461[_0x47ff(0x21)](_0x4e9461[_0x47ff(0x22)],_0x4e9461[_0x47ff(0x22)]))_0x50d280[_0x47ff(0x17)]('📝\x20[SEPHORA_SERVICE]\x20Backend\x20response:\x20'+_0x53f021['message']);else return console[_0x47ff(0x23)](_0x4e9461[_0x47ff(0x24)]),{'success':![],'error':_0x4e9461['SmcCn']};}try{const _0x111560=await _asyncStorage[_0x47ff(0x25)]['getItem'](_0x4e9461[_0x47ff(0x26)])||await _asyncStorage[_0x47ff(0x25)]['getItem'](_0x4e9461[_0x47ff(0x27)])||await _asyncStorage['default'][_0x47ff(0x28)](_0x4e9461[_0x47ff(0x29)]);if(!_0x111560)return console[_0x47ff(0x23)](_0x4e9461[_0x47ff(0x2a)]),{'success':![],'error':_0x4e9461['Jfvan']};console['log'](_0x4e9461['PyGSG']);const _0x84d366={'platform':_reactNative[_0x47ff(0x2b)]['OS'],'appVersion':_0x4e9461[_0x47ff(0x2c)],'osVersion':_reactNative['Platform']['OS']===_0x4e9461[_0x47ff(0x2d)]?_0x4e9461['eZuFp']:_reactNative[_0x47ff(0x2b)]['OS'],'deviceModel':_reactNative[_0x47ff(0x2b)]['OS']===_0x4e9461[_0x47ff(0x2d)]?_0x4e9461[_0x47ff(0x2e)]:_0x4e9461[_0x47ff(0x2f)],'isOfflineSync':![],'extractedAt':new Date()[_0x47ff(0x30)]()},_0xb2387f={'platform':_0x47ff(0x31),'dataType':_0x47ff(0x32),'data':{'basket':{'items':_0x7d2e94['basket'][_0x47ff(0x1b)][_0x47ff(0x33)](_0x4f4e86=>({'productId':_0x4f4e86['id'],'name':_0x4f4e86[_0x47ff(0x34)],'brand':_0x4f4e86[_0x47ff(0x35)],'price':_0x4f4e86[_0x47ff(0x36)],'quantity':_0x4f4e86[_0x47ff(0x37)],'category':_0x4f4e86[_0x47ff(0x38)],'imageUrl':_0x4f4e86['imageUrl']})),'total':_0x7d2e94[_0x47ff(0x1a)][_0x47ff(0x39)],'itemCount':_0x7d2e94['basket'][_0x47ff(0x3a)]},'orders':_0x7d2e94['orders'][_0x47ff(0x33)](_0x2e510a=>({'orderId':_0x2e510a['orderId'],'date':_0x2e510a[_0x47ff(0x3b)],'total':_0x2e510a[_0x47ff(0x39)],'status':_0x2e510a[_0x47ff(0x3c)],'items':_0x2e510a[_0x47ff(0x1b)][_0x47ff(0x33)](_0x559ba9=>({'productId':_0x559ba9['id'],'name':_0x559ba9['name'],'brand':_0x559ba9[_0x47ff(0x35)],'price':_0x559ba9[_0x47ff(0x36)],'quantity':_0x559ba9[_0x47ff(0x37)]}))})),'loves':_0x7d2e94[_0x47ff(0x1f)][_0x47ff(0x33)](_0x43b1a8=>({'productId':_0x43b1a8['id'],'name':_0x43b1a8['name'],'brand':_0x43b1a8[_0x47ff(0x35)],'category':_0x43b1a8['category'],'price':_0x43b1a8[_0x47ff(0x36)],'rating':_0x43b1a8['rating'],'addedAt':_0x43b1a8[_0x47ff(0x3d)],'type':'love'})),'ratings':_0x7d2e94['ratings'][_0x47ff(0x33)](_0xdfcfa3=>({'productId':_0xdfcfa3['productId'],'productName':_0xdfcfa3['productName'],'score':_0xdfcfa3[_0x47ff(0x3e)],'review':_0xdfcfa3['review'],'date':_0xdfcfa3[_0x47ff(0x3b)],'isRecommended':_0xdfcfa3[_0x47ff(0x3f)],'sentiment':_0xdfcfa3[_0x47ff(0x40)]})),'sephoraUserId':_0x7d2e94[_0x47ff(0x41)]},'summary':{'basketItemCount':_0x7d2e94[_0x47ff(0x1a)]['items']['length'],'basketTotal':_0x7d2e94[_0x47ff(0x1a)][_0x47ff(0x39)],'orderCount':_0x7d2e94[_0x47ff(0x1d)][_0x47ff(0x1c)],'lovedProductCount':_0x7d2e94['loves'][_0x47ff(0x1c)],'ratingCount':_0x7d2e94[_0x47ff(0x20)][_0x47ff(0x1c)],'positiveRatings':_0x7d2e94[_0x47ff(0x20)]['filter'](_0x69c61d=>_0x69c61d[_0x47ff(0x40)]===_0x47ff(0x42))[_0x47ff(0x1c)],'negativeRatings':_0x7d2e94['ratings'][_0x47ff(0x43)](_0x343601=>_0x343601[_0x47ff(0x40)]===_0x47ff(0x44))[_0x47ff(0x1c)]},'mobileMetadata':_0x84d366};console['log'](_0x4e9461[_0x47ff(0x45)]),console[_0x47ff(0x17)](_0x4e9461[_0x47ff(0x46)],_api[_0x47ff(0x47)][_0x47ff(0x48)]+_0x47ff(0x49));const _0x485ec0=await fetch(_api[_0x47ff(0x47)][_0x47ff(0x48)]+_0x47ff(0x49),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x47ff(0x4a)+_0x111560,'User-Agent':_0x47ff(0x4b)+_reactNative[_0x47ff(0x2b)]['OS']+')'},'body':JSON[_0x47ff(0x4c)](_0xb2387f)}),_0x31fa01=await _0x485ec0[_0x47ff(0x4d)]();if(_0x485ec0['ok']){console[_0x47ff(0x17)]('✅\x20[SEPHORA_SERVICE]\x20Successfully\x20stored\x20Sephora\x20data');if(_0x31fa01[_0x47ff(0x4e)]){if(_0x4e9461['Xbrcx'](_0x4e9461[_0x47ff(0x4f)],_0x4e9461[_0x47ff(0x4f)]))return _0x3c1f05[_0x47ff(0x23)](_0x4e9461['gQNQE']),{'success':![],'error':_0x4e9461[_0x47ff(0x50)]};else console[_0x47ff(0x17)](_0x47ff(0x51)+_0x31fa01[_0x47ff(0x4e)]);}return{'success':!![],'message':_0x31fa01[_0x47ff(0x4e)]||_0x47ff(0x52),'data':_0x31fa01[_0x47ff(0x53)]};}else return _0x4e9461['ndcVK'](_0x4e9461[_0x47ff(0x54)],_0x47ff(0x15))?(_0x5c551e['error'](_0x47ff(0x16),_0xc8f2e8),{'success':![],'error':_0xe9eb97[_0x47ff(0x4e)]||_0x4e9461['ivsWl']}):(console[_0x47ff(0x55)](_0x47ff(0x56)+_0x485ec0[_0x47ff(0x3c)]),console['warn'](_0x47ff(0x57)+(_0x31fa01[_0x47ff(0x23)]||_0x4e9461[_0x47ff(0x58)])),{'success':![],'error':_0x31fa01[_0x47ff(0x23)]||'HTTP\x20'+_0x485ec0[_0x47ff(0x3c)]});}catch(_0x3534fc){return _0x4e9461[_0x47ff(0x59)](_0x4e9461[_0x47ff(0x5a)],_0x4e9461[_0x47ff(0x5a)])?(_0x4d4813[_0x47ff(0x55)](_0x47ff(0x56)+_0x1c36f6['status']),_0x100eff[_0x47ff(0x55)](_0x47ff(0x57)+(_0x2550b4[_0x47ff(0x23)]||_0x4e9461['ZnisK'])),{'success':![],'error':_0x1ea0e7[_0x47ff(0x23)]||_0x47ff(0x5b)+_0x321e66[_0x47ff(0x3c)]}):(console[_0x47ff(0x23)](_0x4e9461[_0x47ff(0x5c)],_0x3534fc),{'success':![],'error':_0x3534fc[_0x47ff(0x4e)]||_0x4e9461['ivsWl']});}};exports[_0x47ff(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[_0x6cce(0x0)](exports,_0x6cce(0x1),{'value':!![]}),exports['useSpotifyDataExtractor']=void 0x0;var _spotifyDataService=__ONAIROS_REQ_FUNC__(0x0),_reactNative=__ONAIROS_REQ_FUNC__(0x1);function _0x6cce(_0x25f55c,_0x6cce46){_0x25f55c=_0x25f55c-0x0;const _0x3a3f20=_0x25f5();let _0x58a8c8=_0x3a3f20[_0x25f55c];return _0x58a8c8;}function _0x25f5(){const _0x25a8eb=['defineProperty','__esModule','LcIBa','TiHRR','âš ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20saved\x20track:','âš ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20saved\x20album:','ggzye','Export\x20Error','default','Export\x20Failed','📊\x20[SPOTIFY_EXTRACTOR]\x20Summary:','❌\x20[SPOTIFY_EXTRACTOR]\x20Username\x20is\x20required','xpDmM','medium_term','✅\x20[SPOTIFY_EXTRACTOR]\x20Export\x20completed\x20successfully','📊\x20[SPOTIFY_EXTRACTOR]\x20Backend\x20response:','❌\x20[SPOTIFY_EXTRACTOR]\x20Backend\x20storage\x20failed:','An\x20unknown\x20error\x20occurred\x20during\x20data\x20storage.','❌\x20[SPOTIFY_EXTRACTOR]\x20Unexpected\x20error\x20during\x20export:','Failed\x20to\x20connect\x20to\x20the\x20data\x20storage\x20service.\x20Please\x20check\x20your\x20network\x20connection.','âš ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20top\x20artist:','tKBiZ','VmgTC','âš ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20top\x20track:','mVpbY','RxgjY','aezdT','log','qtBLd','summary','error','rTZqt','Alert','alert','Error','Username\x20is\x20required\x20to\x20export\x20Spotify\x20data.','OxPAT','LvwWV','recentlyPlayed','LOUkA','items','lrngH','length','MDpZD','topItems','JlbTL','artists','playlists','savedTracks','crJaP','savedAlbums','â„šī¸\x20[SPOTIFY_EXTRACTOR]\x20No\x20data\x20to\x20export\x20-\x20treating\x20as\x20success\x20(connected)','NpGRy','trackId','name','XYrhF','eIVOz','warn','oJtQl','kgLqI','asuFg','tracks','filter','VWEYJ','Vpcbi','âš ī¸\x20[SPOTIFY_EXTRACTOR]\x20Filtered\x20out\x20','\x20invalid\x20items','nIggW','XgLzC','Dvkqv','MKREs','hHQMv','OZgeX','YYpyR','MIsPN','nLHNw','albumId','BTOqn','KOTpn','ZiLxB','ccdjB','📡\x20[SPOTIFY_EXTRACTOR]\x20Sending\x20to\x20backend...','storeSpotifyData','timeRange','HMwxs','profile','tokenExpiry','userId','success','TcoVO','KjsiY','data','ByqpL','mQchR','THkYV','lCWSD','useSpotifyDataExtractor'];_0x25f5=function(){return _0x25a8eb;};return _0x25f5();}const useSpotifyDataExtractor=()=>{const _0x161cbc={'tKBiZ':function(_0x1ba5d4,_0x4cd22e){return _0x1ba5d4!==_0x4cd22e;},'nIggW':_0x6cce(0x2),'XgLzC':'FYbYV','Dvkqv':_0x6cce(0x3),'YYpyR':_0x6cce(0x4),'BTOqn':_0x6cce(0x5),'VmgTC':'hjmKq','mVpbY':_0x6cce(0x6),'THkYV':_0x6cce(0x7),'RxgjY':_0x6cce(0x8),'aezdT':_0x6cce(0x9),'qtBLd':_0x6cce(0xa),'rTZqt':_0x6cce(0xb),'OxPAT':function(_0x42515d,_0x26aab5){return _0x42515d+_0x26aab5;},'LvwWV':function(_0x1792e0,_0x54aa7c){return _0x1792e0+_0x54aa7c;},'lrngH':function(_0x3c892b,_0x1992ce){return _0x3c892b===_0x1992ce;},'LOUkA':function(_0x334254,_0x3f86b8){return _0x334254===_0x3f86b8;},'MDpZD':function(_0x1facac,_0x32c9d0){return _0x1facac===_0x32c9d0;},'JlbTL':function(_0x1d06f6,_0x299571){return _0x1d06f6===_0x299571;},'crJaP':function(_0x2039b8,_0x33c97b){return _0x2039b8===_0x33c97b;},'asuFg':function(_0x4ed6f7,_0x35c13b){return _0x4ed6f7===_0x35c13b;},'NpGRy':function(_0x27f83a,_0x5551d9){return _0x27f83a===_0x5551d9;},'kgLqI':function(_0x58af93,_0x10b2e5){return _0x58af93===_0x10b2e5;},'KOTpn':function(_0x5651c5,_0x2ead4d){return _0x5651c5+_0x2ead4d;},'xuoJP':function(_0x2f5275,_0xabfa0d){return _0x2f5275<_0xabfa0d;},'ZiLxB':function(_0x164f02,_0x5b9f57){return _0x164f02!==_0x5b9f57;},'ccdjB':_0x6cce(0xc),'jvWRe':function(_0x1a9a1e,_0x174898){return _0x1a9a1e===_0x174898;},'HMwxs':_0x6cce(0xd),'TcoVO':_0x6cce(0xe),'KjsiY':_0x6cce(0xf),'OvNyX':_0x6cce(0x10),'ByqpL':_0x6cce(0x11),'mQchR':_0x6cce(0x12),'lCWSD':_0x6cce(0x13)},_0x92bada=async(_0xa4ae7c,_0x50bbc0)=>{const _0x153e64={'Vpcbi':_0x6cce(0x14),'XYrhF':function(_0x2a60a4,_0x297042){return _0x161cbc[_0x6cce(0x15)](_0x2a60a4,_0x297042);},'DhLvZ':_0x161cbc[_0x6cce(0x16)],'oJtQl':'âš ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20recently\x20played\x20track:','VWEYJ':_0x6cce(0x17),'sfVWb':_0x161cbc[_0x6cce(0x18)],'VsLuL':'âš ī¸\x20[SPOTIFY_EXTRACTOR]\x20Invalid\x20playlist:','MKREs':'❌\x20[SPOTIFY_EXTRACTOR]\x20Unexpected\x20error\x20during\x20export:','hHQMv':_0x161cbc['THkYV'],'OZgeX':'Failed\x20to\x20connect\x20to\x20the\x20data\x20storage\x20service.\x20Please\x20check\x20your\x20network\x20connection.','nLHNw':_0x161cbc[_0x6cce(0x19)],'MIsPN':_0x161cbc[_0x6cce(0x1a)]};var _0xa953a3,_0x3731b8,_0x11ecfd,_0x57866e,_0x8e5f27,_0x5df3d1,_0x197be5,_0x531005,_0x31d4ea;console['log']('🚀\x20[SPOTIFY_EXTRACTOR]\x20Initiating\x20data\x20export'),console[_0x6cce(0x1b)]('👤\x20[SPOTIFY_EXTRACTOR]\x20Username:',_0xa4ae7c),console[_0x6cce(0x1b)](_0x161cbc[_0x6cce(0x1c)],_0x50bbc0[_0x6cce(0x1d)]);if(!_0xa4ae7c)return console[_0x6cce(0x1e)](_0x161cbc[_0x6cce(0x1f)]),_reactNative[_0x6cce(0x20)][_0x6cce(0x21)](_0x6cce(0x22),_0x6cce(0x23),[{'text':'OK','style':_0x161cbc[_0x6cce(0x19)]}]),![];const _0x506268=_0x161cbc[_0x6cce(0x24)](_0x161cbc[_0x6cce(0x25)](_0x161cbc['OxPAT'](((_0xa953a3=_0x50bbc0[_0x6cce(0x26)])===null||_0x161cbc['lrngH'](_0xa953a3,void 0x0)||_0x161cbc[_0x6cce(0x27)](_0xa953a3=_0xa953a3[_0x6cce(0x28)],null)||_0x161cbc[_0x6cce(0x29)](_0xa953a3,void 0x0)?void 0x0:_0xa953a3[_0x6cce(0x2a)])||0x0,((_0x3731b8=_0x50bbc0['topItems'])===null||_0x161cbc[_0x6cce(0x27)](_0x3731b8,void 0x0)||(_0x3731b8=_0x3731b8['tracks'])===null||_0x161cbc[_0x6cce(0x2b)](_0x3731b8,void 0x0)?void 0x0:_0x3731b8['length'])||0x0)+(((_0x11ecfd=_0x50bbc0[_0x6cce(0x2c)])===null||_0x161cbc[_0x6cce(0x2d)](_0x11ecfd,void 0x0)||_0x161cbc[_0x6cce(0x2d)](_0x11ecfd=_0x11ecfd[_0x6cce(0x2e)],null)||_0x161cbc['MDpZD'](_0x11ecfd,void 0x0)?void 0x0:_0x11ecfd[_0x6cce(0x2a)])||0x0)+((_0x161cbc[_0x6cce(0x29)](_0x57866e=_0x50bbc0[_0x6cce(0x2f)],null)||_0x161cbc[_0x6cce(0x2b)](_0x57866e,void 0x0)?void 0x0:_0x57866e[_0x6cce(0x2a)])||0x0),(_0x161cbc['crJaP'](_0x8e5f27=_0x50bbc0[_0x6cce(0x30)],null)||_0x161cbc['asuFg'](_0x8e5f27,void 0x0)?void 0x0:_0x8e5f27[_0x6cce(0x2a)])||0x0),(_0x161cbc[_0x6cce(0x31)](_0x5df3d1=_0x50bbc0[_0x6cce(0x32)],null)||_0x161cbc[_0x6cce(0x2b)](_0x5df3d1,void 0x0)?void 0x0:_0x5df3d1[_0x6cce(0x2a)])||0x0);if(_0x161cbc[_0x6cce(0x2d)](_0x506268,0x0))return console[_0x6cce(0x1b)](_0x6cce(0x33)),!![];const _0x4b8b44=((_0x161cbc[_0x6cce(0x34)](_0x197be5=_0x50bbc0['recentlyPlayed'],null)||_0x197be5===void 0x0?void 0x0:_0x197be5[_0x6cce(0x28)])||[])['filter'](_0x4d5dee=>{const _0x3e3a84=_0x4d5dee[_0x6cce(0x35)]&&_0x4d5dee[_0x6cce(0x36)];return!_0x3e3a84&&(_0x153e64[_0x6cce(0x37)](_0x6cce(0x38),_0x153e64['DhLvZ'])?console[_0x6cce(0x39)](_0x153e64[_0x6cce(0x3a)],_0x4d5dee):_0x30a0b7[_0x6cce(0x39)](_0x153e64['Vpcbi'],_0x3d7f07)),_0x3e3a84;}),_0x5aac21=((_0x161cbc[_0x6cce(0x3b)](_0x531005=_0x50bbc0['topItems'],null)||_0x161cbc[_0x6cce(0x3c)](_0x531005,void 0x0)?void 0x0:_0x531005[_0x6cce(0x3d)])||[])[_0x6cce(0x3e)](_0x47e82d=>{const _0x54eb68=_0x47e82d[_0x6cce(0x35)]&&_0x47e82d[_0x6cce(0x36)];return!_0x54eb68&&console[_0x6cce(0x39)](_0x153e64[_0x6cce(0x3f)],_0x47e82d),_0x54eb68;}),_0x375cad=(((_0x31d4ea=_0x50bbc0[_0x6cce(0x2c)])===null||_0x161cbc[_0x6cce(0x31)](_0x31d4ea,void 0x0)?void 0x0:_0x31d4ea[_0x6cce(0x2e)])||[])[_0x6cce(0x3e)](_0xeb7652=>{const _0x6b7772=_0xeb7652['artistId']&&_0xeb7652['name'];return!_0x6b7772&&console['warn'](_0x153e64[_0x6cce(0x40)],_0xeb7652),_0x6b7772;}),_0x3c5424=(_0x50bbc0[_0x6cce(0x2f)]||[])[_0x6cce(0x3e)](_0x3a20cb=>{const _0x15c418=_0x3a20cb['playlistId']&&_0x3a20cb[_0x6cce(0x36)];return!_0x15c418&&(_0x153e64[_0x6cce(0x37)](_0x6cce(0x6),_0x153e64['sfVWb'])?_0x46d70a['warn'](_0x6cce(0x41)+(_0x37b983-_0x287f3e)+_0x6cce(0x42)):console[_0x6cce(0x39)](_0x153e64['VsLuL'],_0x3a20cb)),_0x15c418;}),_0x448c55=(_0x50bbc0[_0x6cce(0x30)]||[])[_0x6cce(0x3e)](_0x47e82e=>{if(_0x161cbc['tKBiZ'](_0x161cbc[_0x6cce(0x43)],_0x161cbc[_0x6cce(0x44)])){const _0x528e0b=_0x47e82e[_0x6cce(0x35)]&&_0x47e82e[_0x6cce(0x36)];if(!_0x528e0b){if(_0x161cbc[_0x6cce(0x45)]!==_0x6cce(0x3))return _0xe4b37a[_0x6cce(0x1e)](_0x153e64[_0x6cce(0x46)],_0x24a47e),_0xf91d71[_0x6cce(0x20)][_0x6cce(0x21)](_0x153e64[_0x6cce(0x47)],_0x153e64[_0x6cce(0x48)],[{'text':'OK','style':_0x153e64['nLHNw']}]),![];else console[_0x6cce(0x39)](_0x161cbc[_0x6cce(0x49)],_0x47e82e);}return _0x528e0b;}else return _0x57abaa[_0x6cce(0x1e)](_0x6cce(0x10),_0x50d7b3['error']),_0x11d841[_0x6cce(0x20)][_0x6cce(0x21)](_0x153e64[_0x6cce(0x4a)],_0x2aac08[_0x6cce(0x1e)]||_0x6cce(0x11),[{'text':'OK','style':_0x153e64[_0x6cce(0x4b)]}]),![];}),_0x36b48c=(_0x50bbc0[_0x6cce(0x32)]||[])[_0x6cce(0x3e)](_0x7cc00c=>{const _0x3433bc=_0x7cc00c[_0x6cce(0x4c)]&&_0x7cc00c[_0x6cce(0x36)];return!_0x3433bc&&console['warn'](_0x161cbc[_0x6cce(0x4d)],_0x7cc00c),_0x3433bc;}),_0x13d7d4=_0x506268,_0x3fa18e=_0x161cbc[_0x6cce(0x25)](_0x161cbc[_0x6cce(0x4e)](_0x161cbc[_0x6cce(0x24)](_0x161cbc['OxPAT'](_0x4b8b44[_0x6cce(0x2a)],_0x5aac21[_0x6cce(0x2a)]),_0x375cad['length']),_0x3c5424[_0x6cce(0x2a)]),_0x448c55[_0x6cce(0x2a)])+_0x36b48c[_0x6cce(0x2a)];_0x161cbc['xuoJP'](_0x3fa18e,_0x13d7d4)&&console['warn'](_0x6cce(0x41)+(_0x13d7d4-_0x3fa18e)+'\x20invalid\x20items');try{if(_0x161cbc[_0x6cce(0x4f)](_0x161cbc[_0x6cce(0x50)],_0x161cbc[_0x6cce(0x50)]))_0x436a86['warn'](_0x153e64[_0x6cce(0x3a)],_0x41bcb9);else{var _0xb15414;console[_0x6cce(0x1b)](_0x6cce(0x51));const _0xcbacb1=await(0x0,_spotifyDataService[_0x6cce(0x52)])(_0xa4ae7c,{'recentlyPlayed':{'items':_0x4b8b44,'totalCount':_0x4b8b44['length']},'topItems':{'tracks':_0x5aac21,'artists':_0x375cad,'timeRange':(_0x161cbc['jvWRe'](_0xb15414=_0x50bbc0[_0x6cce(0x2c)],null)||_0xb15414===void 0x0?void 0x0:_0xb15414[_0x6cce(0x53)])||_0x161cbc[_0x6cce(0x54)]},'playlists':_0x3c5424,'savedTracks':_0x448c55,'savedAlbums':_0x36b48c,'profile':_0x50bbc0[_0x6cce(0x55)],'tokenExpiry':_0x50bbc0[_0x6cce(0x56)],'userId':_0x50bbc0[_0x6cce(0x57)]});return _0xcbacb1[_0x6cce(0x58)]?(console['log'](_0x161cbc[_0x6cce(0x59)]),console['log'](_0x161cbc[_0x6cce(0x5a)],_0xcbacb1[_0x6cce(0x5b)]),!![]):(console['error'](_0x161cbc['OvNyX'],_0xcbacb1[_0x6cce(0x1e)]),_reactNative[_0x6cce(0x20)][_0x6cce(0x21)](_0x161cbc[_0x6cce(0x1a)],_0xcbacb1[_0x6cce(0x1e)]||_0x161cbc[_0x6cce(0x5c)],[{'text':'OK','style':_0x161cbc[_0x6cce(0x19)]}]),![]);}}catch(_0x4055d2){return console[_0x6cce(0x1e)](_0x161cbc[_0x6cce(0x5d)],_0x4055d2),_reactNative[_0x6cce(0x20)][_0x6cce(0x21)](_0x161cbc[_0x6cce(0x5e)],_0x161cbc[_0x6cce(0x5f)],[{'text':'OK','style':_0x161cbc['RxgjY']}]),![];}};return{'initiateDataExport':_0x92bada};};exports[_0x6cce(0x60)]=useSpotifyDataExtractor;
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