@onairos/react-native 3.7.2 → 3.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +116 -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 +109 -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 +1,173 @@
1
- import{getAuthToken}from'./authService';import{API_CONFIG}from'../config/api';const API_BASE_URL=''+API_CONFIG[_0x3298(0x0)];export const getTrainingStatus=async _0x496ea6=>{const _0x975d44={'PlOKo':_0x3298(0x1),'DUDBj':_0x3298(0x2),'WckIc':'❌\x20Training\x20error:','TgPnJ':function(_0x54706b,_0x40eb41){return _0x54706b!==_0x40eb41;},'Uxwhv':_0x3298(0x3),'qQTsk':'BjAlf','haGey':function(_0x20cdbe){return _0x20cdbe();},'iifCU':'JjmTl','pNMLd':'oBMqy','zdiNR':_0x3298(0x4),'ZOYiQ':function(_0x154912,_0xf3bd66){return _0x154912===_0xf3bd66;},'xxaeG':'xeGTW'};try{if(_0x975d44[_0x3298(0x5)](_0x975d44[_0x3298(0x6)],_0x975d44['qQTsk'])){const _0x914542=await _0x975d44['haGey'](getAuthToken);if(!_0x914542){if(_0x975d44['TgPnJ'](_0x975d44[_0x3298(0x7)],_0x975d44['iifCU']))throw new _0x364803(_0x975d44[_0x3298(0x8)]);else throw new Error(_0x975d44['PlOKo']);}const _0x144612=await fetch(API_BASE_URL+_0x3298(0x9)+_0x496ea6,{'method':'GET','headers':{'Authorization':_0x914542,'Content-Type':'application/json'}});if(!_0x144612['ok']){if(_0x975d44[_0x3298(0x5)](_0x975d44['pNMLd'],_0x975d44[_0x3298(0xa)])){const _0x40b0bc=await _0x144612[_0x3298(0xb)]();throw new Error(_0x40b0bc[_0x3298(0xc)]||_0x3298(0xd)+_0x144612[_0x3298(0xe)]);}else{_0x1e76ef[_0x3298(0xc)](_0x975d44['DUDBj'],_0x3c519f);throw _0xae9ddd;}}return await _0x144612['json']();}else{_0x547a95[_0x3298(0xc)](_0x975d44[_0x3298(0xf)],_0x345e46);throw _0x2beeca;}}catch(_0x298510){if(_0x975d44[_0x3298(0x10)](_0x975d44[_0x3298(0x11)],_0x975d44[_0x3298(0x11)])){console[_0x3298(0xc)](_0x3298(0x12),_0x298510);throw _0x298510;}else{_0x582b92[_0x3298(0xc)](_0x3298(0x13),_0x292307);throw _0x5979a0;}}};export const getModelInfo=async()=>{const _0xc4dc6f={'eYhVO':function(_0x22c185){return _0x22c185();},'vTXtS':_0x3298(0x1)};try{const _0x11e054=await _0xc4dc6f[_0x3298(0x14)](getAuthToken);if(!_0x11e054)throw new Error(_0xc4dc6f['vTXtS']);const _0x57c184=await fetch(API_BASE_URL+_0x3298(0x15),{'method':'GET','headers':{'Authorization':_0x11e054,'Content-Type':'application/json'}});if(!_0x57c184['ok']){const _0x3c915f=await _0x57c184[_0x3298(0xb)]();throw new Error(_0x3c915f[_0x3298(0xc)]||'HTTP\x20'+_0x57c184[_0x3298(0xe)]);}return await _0x57c184[_0x3298(0xb)]();}catch(_0x16174d){console[_0x3298(0xc)](_0x3298(0x13),_0x16174d);throw _0x16174d;}};export const getHealthCheck=async()=>{const _0xa1ab6={'cvRAO':_0x3298(0x12),'vWLoZ':function(_0x367fa9,_0x3157ec){return _0x367fa9!==_0x3157ec;},'TbVBW':'WjViz','CLujV':_0x3298(0x2)};try{const _0x21ef67=await fetch(API_BASE_URL+_0x3298(0x16),{'method':'GET','headers':{'Content-Type':'application/json'}});if(!_0x21ef67['ok']){const _0x13d08d=await _0x21ef67[_0x3298(0xb)]();throw new Error(_0x13d08d['error']||_0x3298(0xd)+_0x21ef67[_0x3298(0xe)]);}return await _0x21ef67['json']();}catch(_0x586f9e){if(_0xa1ab6['vWLoZ'](_0xa1ab6['TbVBW'],_0x3298(0x17))){_0x13a944[_0x3298(0xc)](_0xa1ab6['cvRAO'],_0x2563e2);throw _0x38acbb;}else{console['error'](_0xa1ab6[_0x3298(0x18)],_0x586f9e);throw _0x586f9e;}}};export const startEnochTrainingWithYouTubeCheck=async _0x2bf300=>{const _0x37c440={'QKuBk':_0x3298(0x19),'EFjXC':_0x3298(0x1a),'FiYTC':_0x3298(0x1b),'evepP':_0x3298(0x1c),'uPQGD':function(_0x33f9db,_0x27c458){return _0x33f9db(_0x27c458);},'YQdPx':_0x3298(0x1d)};try{return console[_0x3298(0x1e)](_0x3298(0x1f),_0x2bf300[_0x3298(0x20)],'(backend\x20auto-handles\x20YouTube)'),console[_0x3298(0x1e)](_0x3298(0x21)),console[_0x3298(0x1e)](_0x37c440[_0x3298(0x22)]),console[_0x3298(0x1e)](_0x37c440[_0x3298(0x23)]),console[_0x3298(0x1e)](_0x37c440[_0x3298(0x24)]),console[_0x3298(0x1e)](_0x37c440['evepP']),await _0x37c440['uPQGD'](startEnochTraining,_0x2bf300);}catch(_0x7df217){console[_0x3298(0xc)](_0x37c440['YQdPx'],_0x7df217);throw _0x7df217;}};export const startEnochTraining=async _0x3bf386=>{const _0x437de6={'gqewD':_0x3298(0x25),'TKejK':'No\x20authentication\x20token\x20available','ZGfTF':function(_0x27e601,_0x24407c){return _0x27e601!==_0x24407c;},'RUPDh':function(_0x22483e){return _0x22483e();},'TEXJG':_0x3298(0x26),'ghsDy':_0x3298(0x27),'GRuQR':_0x3298(0x28),'Rotbh':_0x3298(0x29),'umxyL':_0x3298(0x2a),'gSqYi':_0x3298(0x2b),'XdCnW':_0x3298(0x2c),'UMkzJ':function(_0xa63a84,_0x2a80b2){return _0xa63a84!==_0x2a80b2;},'FJMlM':_0x3298(0x2d),'UOJdQ':_0x3298(0x2e)};try{if(_0x437de6[_0x3298(0x2f)](_0x3298(0x30),'KaRqt'))throw new _0x26cdf2(_0x3298(0x31)+_0x53ff40[_0x3298(0xe)]+'\x20-\x20'+_0x69cd57);else{const _0x39bacc=await _0x437de6[_0x3298(0x32)](getAuthToken);if(!_0x39bacc){if(_0x437de6[_0x3298(0x2f)](_0x437de6[_0x3298(0x33)],_0x437de6[_0x3298(0x34)]))throw new Error(_0x3298(0x1));else return _0xd88fa8[_0x3298(0x35)](_0x3298(0x36),_0x3706e0),null;}console[_0x3298(0x1e)](_0x437de6['GRuQR'],_0x3bf386);const _0x2aadf6=await fetch(API_BASE_URL+_0x3298(0x37),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x39bacc},'body':JSON[_0x3298(0x38)](_0x3bf386)});console[_0x3298(0x1e)](_0x437de6['Rotbh'],_0x2aadf6[_0x3298(0xe)]);if(!_0x2aadf6['ok']){const _0x92f46f=await _0x2aadf6[_0x3298(0x39)]();console[_0x3298(0xc)](_0x3298(0x3a),_0x2aadf6[_0x3298(0xe)],_0x437de6[_0x3298(0x3b)],_0x92f46f);try{const _0x4fda8d=JSON[_0x3298(0x3c)](_0x92f46f);throw new Error(_0x4fda8d[_0x3298(0xc)]||_0x3298(0xd)+_0x2aadf6['status']);}catch(_0x218f5a){if(_0x437de6['ZGfTF'](_0x437de6['gSqYi'],_0x437de6[_0x3298(0x3d)])){_0x129339[_0x3298(0xc)](_0x437de6[_0x3298(0x3e)],_0x258b18);throw _0x40454f;}else throw new Error(_0x3298(0x31)+_0x2aadf6[_0x3298(0xe)]+'\x20-\x20'+_0x92f46f);}}const _0x4acf33=await _0x2aadf6[_0x3298(0xb)]();return console[_0x3298(0x1e)](_0x437de6[_0x3298(0x3f)],_0x4acf33),_0x4acf33;}}catch(_0x360658){if(_0x437de6[_0x3298(0x40)](_0x437de6[_0x3298(0x41)],_0x437de6[_0x3298(0x42)])){console['error'](_0x437de6[_0x3298(0x3e)],_0x360658);throw _0x360658;}else throw new _0x3b349a(_0x437de6['TKejK']);}};function _0x3298(_0x391442,_0x3298f9){_0x391442=_0x391442-0x0;const _0x128af4=_0x3914();let _0x4c2839=_0x128af4[_0x391442];return _0x4c2839;}export const isTrainingInProgress=async _0x1ac960=>{const _0x5f1122={'ROxOA':function(_0x103d96,_0x1ad8e2){return _0x103d96(_0x1ad8e2);}};try{const _0x6a3209=await _0x5f1122['ROxOA'](getTrainingStatus,_0x1ac960);return _0x6a3209['success']&&_0x6a3209['isTraining'];}catch(_0x1ac924){return console[_0x3298(0x35)]('⚠️\x20Could\x20not\x20check\x20training\x20status:',_0x1ac924),![];}};export const getTrainingFeatures=async()=>{const _0x576e11={'HaVPL':'No\x20authentication\x20token\x20available','QhKtn':function(_0x55db0d,_0x5a36c7){return _0x55db0d!==_0x5a36c7;},'PnTGL':_0x3298(0x43),'zDtOk':_0x3298(0x44),'Auxyt':function(_0xa3b17a){return _0xa3b17a();},'Jxhry':function(_0x304dde,_0x47a4cd){return _0x304dde===_0x47a4cd;},'DcOSa':_0x3298(0x45),'sztTM':_0x3298(0x46),'wkEHl':_0x3298(0x36)};try{if(_0x576e11['QhKtn'](_0x576e11[_0x3298(0x47)],_0x576e11[_0x3298(0x48)])){const _0x55928b=await _0x576e11['Auxyt'](getHealthCheck);return _0x55928b['features'];}else throw new _0x3fc9c5(_0x576e11[_0x3298(0x49)]);}catch(_0x54008a){return _0x576e11[_0x3298(0x4a)](_0x576e11[_0x3298(0x4b)],_0x576e11[_0x3298(0x4c)])?(_0x196e36[_0x3298(0x35)](_0x3298(0x4d),_0xbfc1b4),![]):(console[_0x3298(0x35)](_0x576e11['wkEHl'],_0x54008a),null);}};function _0x3914(){const _0x3251f9=['BASE_URL','No\x20authentication\x20token\x20available','❌\x20Failed\x20to\x20get\x20health\x20check:','GzEZI','aTvjF','TgPnJ','Uxwhv','iifCU','PlOKo','/mobile-training/status/','zdiNR','json','error','HTTP\x20','status','WckIc','ZOYiQ','xxaeG','❌\x20Failed\x20to\x20get\x20training\x20status:','❌\x20Failed\x20to\x20get\x20model\x20info:','eYhVO','/mobile-training/model-info','/mobile-training/health','WjViz','CLujV','ℹ️\x20[TRAINING]\x20No\x20migration\x20checks\x20needed:','\x20\x20\x20-\x20Temporary\x20mode\x20connections:\x20Work\x20automatically\x20✅','\x20\x20\x20-\x20Full\x20refresh\x20tokens:\x20Auto-refresh\x20when\x20expired\x20✅','\x20\x20\x20-\x20Backend\x20validation:\x20Handles\x20all\x20edge\x20cases\x20✅','❌\x20Training\x20error:','log','🚀\x20Starting\x20Enoch\x20training\x20for\x20user:','username','🚀\x20[TRAINING]\x20Starting\x20training\x20-\x20backend\x20handles\x20all\x20YouTube\x20cases\x20automatically','QKuBk','EFjXC','FiYTC','❌\x20Training\x20start\x20error:','HpIRV','fHrEk','📤\x20Sending\x20training\x20data\x20to\x20/mobile-training/enoch:','📡\x20Training\x20API\x20response\x20status:','Error:','kpXge','📡\x20Training\x20API\x20response:','sndtL','BCfqT','ZGfTF','KaRqt','Training\x20API\x20failed:\x20','RUPDh','TEXJG','ghsDy','warn','⚠️\x20Could\x20not\x20get\x20training\x20features:','/mobile-training/enoch','stringify','text','❌\x20Training\x20API\x20failed\x20with\x20status:','umxyL','parse','gSqYi','gqewD','XdCnW','UMkzJ','FJMlM','UOJdQ','nlsMU','ZfGWl','WZdmr','sAGLZ','PnTGL','zDtOk','HaVPL','Jxhry','DcOSa','sztTM','⚠️\x20Could\x20not\x20check\x20training\x20status:'];_0x3914=function(){return _0x3251f9;};return _0x3914();}
1
+ import { getAuthToken } from './authService';
2
+ import { API_CONFIG } from '../config/api';
3
+ // Migration functions no longer needed - backend handles all YouTube cases automatically
4
+ // import { checkAndFixYouTubeConnection, getYouTubeConnectionStatus, shouldShowYouTubeMigrationWarning } from './youtubeMigrationService';
5
+
6
+ const API_BASE_URL = `${API_CONFIG.BASE_URL}`;
7
+
8
+ /**
9
+ * Mobile Training API Service
10
+ * Implements the updated training spec routes
11
+ */
12
+
13
+ // Training Status Route
14
+ export const getTrainingStatus = async username => {
15
+ try {
16
+ const authToken = await getAuthToken();
17
+ if (!authToken) {
18
+ throw new Error('No authentication token available');
19
+ }
20
+ const response = await fetch(`${API_BASE_URL}/mobile-training/status/${username}`, {
21
+ method: 'GET',
22
+ headers: {
23
+ 'Authorization': authToken,
24
+ 'Content-Type': 'application/json'
25
+ }
26
+ });
27
+ if (!response.ok) {
28
+ const errorData = await response.json();
29
+ throw new Error(errorData.error || `HTTP ${response.status}`);
30
+ }
31
+ return await response.json();
32
+ } catch (error) {
33
+ console.error('❌ Failed to get training status:', error);
34
+ throw error;
35
+ }
36
+ };
37
+
38
+ // Model Info Route
39
+ export const getModelInfo = async () => {
40
+ try {
41
+ const authToken = await getAuthToken();
42
+ if (!authToken) {
43
+ throw new Error('No authentication token available');
44
+ }
45
+ const response = await fetch(`${API_BASE_URL}/mobile-training/model-info`, {
46
+ method: 'GET',
47
+ headers: {
48
+ 'Authorization': authToken,
49
+ 'Content-Type': 'application/json'
50
+ }
51
+ });
52
+ if (!response.ok) {
53
+ const errorData = await response.json();
54
+ throw new Error(errorData.error || `HTTP ${response.status}`);
55
+ }
56
+ return await response.json();
57
+ } catch (error) {
58
+ console.error('❌ Failed to get model info:', error);
59
+ throw error;
60
+ }
61
+ };
62
+
63
+ // Health Check Route
64
+ export const getHealthCheck = async () => {
65
+ try {
66
+ const response = await fetch(`${API_BASE_URL}/mobile-training/health`, {
67
+ method: 'GET',
68
+ headers: {
69
+ 'Content-Type': 'application/json'
70
+ }
71
+ });
72
+ if (!response.ok) {
73
+ const errorData = await response.json();
74
+ throw new Error(errorData.error || `HTTP ${response.status}`);
75
+ }
76
+ return await response.json();
77
+ } catch (error) {
78
+ console.error('❌ Failed to get health check:', error);
79
+ throw error;
80
+ }
81
+ };
82
+
83
+ /**
84
+ * Start Enoch Training - Simplified Version
85
+ * Backend now handles all YouTube connection cases automatically (temporary mode, refresh tokens, etc.)
86
+ * No frontend migration checks needed anymore
87
+ */
88
+ export const startEnochTrainingWithYouTubeCheck = async trainingData => {
89
+ try {
90
+ console.log('🚀 Starting Enoch training for user:', trainingData.username, '(backend auto-handles YouTube)');
91
+
92
+ // ✅ SIMPLIFIED: Backend handles all YouTube connection cases automatically
93
+ console.log('🚀 [TRAINING] Starting training - backend handles all YouTube cases automatically');
94
+ console.log('ℹ️ [TRAINING] No migration checks needed:');
95
+ console.log(' - Temporary mode connections: Work automatically ✅');
96
+ console.log(' - Full refresh tokens: Auto-refresh when expired ✅');
97
+ console.log(' - Backend validation: Handles all edge cases ✅');
98
+
99
+ // ✅ Proceed with training - backend handles YouTube automatically
100
+ return await startEnochTraining(trainingData);
101
+ } catch (error) {
102
+ console.error('❌ Training error:', error);
103
+ throw error;
104
+ }
105
+ };
106
+
107
+ /**
108
+ * Start Enoch Training
109
+ * Updated to use the new /mobile-training/enoch endpoint with proper error handling
110
+ */
111
+ export const startEnochTraining = async trainingData => {
112
+ try {
113
+ const authToken = await getAuthToken();
114
+ if (!authToken) {
115
+ throw new Error('No authentication token available');
116
+ }
117
+ console.log('📤 Sending training data to /mobile-training/enoch:', trainingData);
118
+ const response = await fetch(`${API_BASE_URL}/mobile-training/enoch`, {
119
+ method: 'POST',
120
+ headers: {
121
+ 'Content-Type': 'application/json',
122
+ 'Authorization': authToken
123
+ },
124
+ body: JSON.stringify(trainingData)
125
+ });
126
+ console.log('📡 Training API response status:', response.status);
127
+ if (!response.ok) {
128
+ const errorText = await response.text();
129
+ console.error('❌ Training API failed with status:', response.status, 'Error:', errorText);
130
+
131
+ // Try to parse error response
132
+ try {
133
+ const errorData = JSON.parse(errorText);
134
+ throw new Error(errorData.error || `HTTP ${response.status}`);
135
+ } catch (parseError) {
136
+ throw new Error(`Training API failed: ${response.status} - ${errorText}`);
137
+ }
138
+ }
139
+ const result = await response.json();
140
+ console.log('📡 Training API response:', result);
141
+ return result;
142
+ } catch (error) {
143
+ console.error('❌ Training start error:', error);
144
+ throw error;
145
+ }
146
+ };
147
+
148
+ /**
149
+ * Helper function to check if training is in progress
150
+ */
151
+ export const isTrainingInProgress = async username => {
152
+ try {
153
+ const status = await getTrainingStatus(username);
154
+ return status.success && status.isTraining;
155
+ } catch (error) {
156
+ console.warn('⚠️ Could not check training status:', error);
157
+ return false;
158
+ }
159
+ };
160
+
161
+ /**
162
+ * Helper function to get training features info
163
+ */
164
+ export const getTrainingFeatures = async () => {
165
+ try {
166
+ const health = await getHealthCheck();
167
+ return health.features;
168
+ } catch (error) {
169
+ console.warn('⚠️ Could not get training features:', error);
170
+ return null;
171
+ }
172
+ };
173
+ //# sourceMappingURL=mobileTrainingService.js.map
@@ -1 +1,114 @@
1
- import{storeNetflixData}from'./netflixDataService';import{Alert}from'react-native';function _0x5600(_0x9210c2,_0x560053){_0x9210c2=_0x9210c2-0x0;const _0x897359=_0x9210();let _0x4dcb45=_0x897359[_0x9210c2];return _0x4dcb45;}function _0x9210(){const _0x4929b4=['IdOyO','TlRPY','⚠️\x20[NETFLIX_EXTRACTOR]\x20Invalid\x20rating:','❌\x20[NETFLIX_EXTRACTOR]\x20Backend\x20storage\x20failed:','An\x20unknown\x20error\x20occurred\x20during\x20data\x20storage.','👤\x20[NETFLIX_EXTRACTOR]\x20Username:','📊\x20[NETFLIX_EXTRACTOR]\x20Summary:','bRlvZ','❌\x20[NETFLIX_EXTRACTOR]\x20Username\x20is\x20required','AgrhS','📡\x20[NETFLIX_EXTRACTOR]\x20Sending\x20to\x20backend...','✅\x20[NETFLIX_EXTRACTOR]\x20Export\x20completed\x20successfully','📊\x20[NETFLIX_EXTRACTOR]\x20Backend\x20response:','❌\x20[NETFLIX_EXTRACTOR]\x20Unexpected\x20error\x20during\x20export:','Failed\x20to\x20connect\x20to\x20the\x20data\x20storage\x20service.\x20Please\x20check\x20your\x20network\x20connection.','GwLeB','wiwse','log','🚀\x20[NETFLIX_EXTRACTOR]\x20Initiating\x20data\x20export','wpSXz','summary','dFcKR','olMTo','error','AZVdM','LezrA','KCmBM','fjbaC','viewingHistory','BuJeB','items','length','myList','ratings','vGQug','filter','videoId','title','warn','yoAfj','vGBcu','qvxkX','rating','jEIHj','default','WEVrZ','fytFi','aAyJx','CAxXZ','SjckC','wlZzG','iPxmg','zDdwr','LZxct','eohql','⚠️\x20[NETFLIX_EXTRACTOR]\x20Filtered\x20out\x20','WaJkn','znngH','qpbuk','XARWb','TwxIH','profileId','success','KSZie','eNCIG','alert','Error','gVCXt','WUTMz','data','rIUjw'];_0x9210=function(){return _0x4929b4;};return _0x9210();}export const useNetflixDataExtractor=()=>{const _0x14b19f={'fjbaC':function(_0x181ac1,_0x39fdd1){return _0x181ac1===_0x39fdd1;},'vGBcu':_0x5600(0x0),'qvxkX':'⚠️\x20[NETFLIX_EXTRACTOR]\x20Invalid\x20My\x20List\x20item:','jEIHj':'Export\x20Error','WEVrZ':'FdKae','fytFi':_0x5600(0x1),'aAyJx':_0x5600(0x2),'EWWtw':'Username\x20is\x20required\x20to\x20export\x20Netflix\x20data.','rIUjw':_0x5600(0x3),'GwLeB':'Export\x20Failed','wiwse':_0x5600(0x4),'wpSXz':_0x5600(0x5),'qRebE':_0x5600(0x6),'dFcKR':function(_0x4ad2c6,_0x59cdb1){return _0x4ad2c6!==_0x59cdb1;},'olMTo':_0x5600(0x7),'AZVdM':_0x5600(0x8),'LezrA':'Error','KCmBM':'default','iPxmg':function(_0x4cf759,_0x2c98c6){return _0x4cf759+_0x2c98c6;},'BuJeB':function(_0xb86251,_0x1ec5c0){return _0xb86251===_0x1ec5c0;},'vGQug':function(_0x554134,_0x801a00){return _0x554134===_0x801a00;},'OSudg':function(_0x2c50cf,_0x120a7e){return _0x2c50cf===_0x120a7e;},'zDdwr':function(_0x4e701e,_0x35d901){return _0x4e701e+_0x35d901;},'LZxct':_0x5600(0x9),'eohql':'Qbzlw','WaJkn':function(_0x2eed35,_0x14fc20){return _0x2eed35-_0x14fc20;},'XARWb':_0x5600(0xa),'TwxIH':function(_0x4f8a52,_0x1f67be,_0x3f188d){return _0x4f8a52(_0x1f67be,_0x3f188d);},'KSZie':'eNCIG','gVCXt':_0x5600(0xb),'WUTMz':_0x5600(0xc),'SBSSP':_0x5600(0xd),'ghDdh':_0x5600(0xe)},_0x550bb3=async(_0x5666e4,_0x48bbc2)=>{const _0x2a7466={'yoAfj':'⚠️\x20[NETFLIX_EXTRACTOR]\x20Invalid\x20viewing\x20history\x20item:','kRALw':_0x14b19f['rIUjw'],'qGjzd':_0x14b19f[_0x5600(0xf)],'znngH':_0x14b19f[_0x5600(0x10)],'qpbuk':'default'};var _0x393e04,_0x2f62c7,_0xa8a01b,_0xe9cbcd;console[_0x5600(0x11)](_0x5600(0x12)),console[_0x5600(0x11)](_0x14b19f[_0x5600(0x13)],_0x5666e4),console[_0x5600(0x11)](_0x14b19f['qRebE'],_0x48bbc2[_0x5600(0x14)]);if(!_0x5666e4)return _0x14b19f[_0x5600(0x15)](_0x14b19f[_0x5600(0x16)],_0x5600(0x7))?(_0x4177a7[_0x5600(0x11)]('ℹ️\x20[NETFLIX_EXTRACTOR]\x20No\x20data\x20to\x20export\x20-\x20treating\x20as\x20success\x20(connected)'),!![]):(console[_0x5600(0x17)](_0x14b19f[_0x5600(0x18)]),Alert['alert'](_0x14b19f[_0x5600(0x19)],'Username\x20is\x20required\x20to\x20export\x20Netflix\x20data.',[{'text':'OK','style':_0x14b19f[_0x5600(0x1a)]}]),![]);const _0x439ee5=_0x14b19f['iPxmg']((_0x14b19f[_0x5600(0x1b)](_0x393e04=_0x48bbc2[_0x5600(0x1c)],null)||_0x393e04===void 0x0||_0x14b19f[_0x5600(0x1d)](_0x393e04=_0x393e04[_0x5600(0x1e)],null)||_0x14b19f[_0x5600(0x1d)](_0x393e04,void 0x0)?void 0x0:_0x393e04[_0x5600(0x1f)])||0x0,(_0x14b19f[_0x5600(0x1d)](_0x2f62c7=_0x48bbc2[_0x5600(0x20)],null)||_0x2f62c7===void 0x0?void 0x0:_0x2f62c7[_0x5600(0x1f)])||0x0)+((_0x14b19f['fjbaC'](_0xa8a01b=_0x48bbc2[_0x5600(0x21)],null)||_0xa8a01b===void 0x0?void 0x0:_0xa8a01b['length'])||0x0);if(_0x14b19f[_0x5600(0x22)](_0x439ee5,0x0))return console['log']('ℹ️\x20[NETFLIX_EXTRACTOR]\x20No\x20data\x20to\x20export\x20-\x20treating\x20as\x20success\x20(connected)'),!![];const _0x4a36ad=(((_0xe9cbcd=_0x48bbc2[_0x5600(0x1c)])===null||_0x14b19f['OSudg'](_0xe9cbcd,void 0x0)?void 0x0:_0xe9cbcd[_0x5600(0x1e)])||[])[_0x5600(0x23)](_0xa56822=>{const _0x1c8a0f=_0xa56822[_0x5600(0x24)]&&_0xa56822[_0x5600(0x25)];return!_0x1c8a0f&&console[_0x5600(0x26)](_0x2a7466[_0x5600(0x27)],_0xa56822),_0x1c8a0f;}),_0x3ab82b=(_0x48bbc2[_0x5600(0x20)]||[])[_0x5600(0x23)](_0x16f28a=>{if(_0x14b19f[_0x5600(0x1b)](_0x14b19f[_0x5600(0x28)],_0x14b19f[_0x5600(0x28)])){const _0xae3961=_0x16f28a[_0x5600(0x24)]&&_0x16f28a['title'];return!_0xae3961&&console[_0x5600(0x26)](_0x14b19f[_0x5600(0x29)],_0x16f28a),_0xae3961;}else{const _0x1ec4c7=_0x50157b[_0x5600(0x24)]&&_0x5f5b44[_0x5600(0x2a)];return!_0x1ec4c7&&_0x38dad5[_0x5600(0x26)](_0x5600(0x2),_0x50b956),_0x1ec4c7;}}),_0x4c5ce3=(_0x48bbc2[_0x5600(0x21)]||[])[_0x5600(0x23)](_0x2caf0e=>{const _0x5e8355={'CAxXZ':_0x14b19f[_0x5600(0x2b)],'SjckC':'Failed\x20to\x20connect\x20to\x20the\x20data\x20storage\x20service.\x20Please\x20check\x20your\x20network\x20connection.','wlZzG':_0x5600(0x2c)};if(_0x14b19f[_0x5600(0x2d)]!==_0x14b19f[_0x5600(0x2e)]){const _0x56d41a=_0x2caf0e[_0x5600(0x24)]&&_0x2caf0e[_0x5600(0x2a)];return!_0x56d41a&&console[_0x5600(0x26)](_0x14b19f[_0x5600(0x2f)],_0x2caf0e),_0x56d41a;}else return _0x25815c[_0x5600(0x17)](_0x5600(0xd),_0x1de03e),Alert['alert'](_0x5e8355[_0x5600(0x30)],_0x5e8355[_0x5600(0x31)],[{'text':'OK','style':_0x5e8355[_0x5600(0x32)]}]),![];}),_0x2fe832=_0x439ee5,_0xd2e453=_0x14b19f[_0x5600(0x33)](_0x14b19f[_0x5600(0x34)](_0x4a36ad[_0x5600(0x1f)],_0x3ab82b[_0x5600(0x1f)]),_0x4c5ce3['length']);if(_0xd2e453<_0x2fe832){if(_0x14b19f[_0x5600(0x35)]!==_0x14b19f[_0x5600(0x36)])console[_0x5600(0x26)](_0x5600(0x37)+_0x14b19f[_0x5600(0x38)](_0x2fe832,_0xd2e453)+'\x20invalid\x20items');else return _0x1b385f[_0x5600(0x17)](_0x2a7466['kRALw'],_0x522321[_0x5600(0x17)]),Alert['alert'](_0x2a7466['qGjzd'],_0x5cf917[_0x5600(0x17)]||_0x2a7466[_0x5600(0x39)],[{'text':'OK','style':_0x2a7466[_0x5600(0x3a)]}]),![];}try{console[_0x5600(0x11)](_0x14b19f[_0x5600(0x3b)]);const _0x5e0ec4=await _0x14b19f[_0x5600(0x3c)](storeNetflixData,_0x5666e4,{'viewingHistory':{'items':_0x4a36ad,'totalCount':_0x4a36ad[_0x5600(0x1f)]},'myList':_0x3ab82b,'ratings':_0x4c5ce3,'profile':_0x48bbc2['profile'],'tokenExpiry':_0x48bbc2['tokenExpiry'],'profileId':_0x48bbc2[_0x5600(0x3d)]});return _0x5e0ec4[_0x5600(0x3e)]?_0x14b19f[_0x5600(0x3f)]!==_0x5600(0x40)?(_0x7c887f[_0x5600(0x17)](_0x5600(0x8)),Alert[_0x5600(0x41)](_0x5600(0x42),_0x14b19f['EWWtw'],[{'text':'OK','style':_0x5600(0x2c)}]),![]):(console['log'](_0x14b19f[_0x5600(0x43)]),console[_0x5600(0x11)](_0x14b19f[_0x5600(0x44)],_0x5e0ec4[_0x5600(0x45)]),!![]):(console[_0x5600(0x17)](_0x14b19f[_0x5600(0x46)],_0x5e0ec4['error']),Alert[_0x5600(0x41)](_0x14b19f[_0x5600(0xf)],_0x5e0ec4[_0x5600(0x17)]||_0x14b19f[_0x5600(0x10)],[{'text':'OK','style':_0x14b19f[_0x5600(0x1a)]}]),![]);}catch(_0x456114){return console['error'](_0x14b19f['SBSSP'],_0x456114),Alert[_0x5600(0x41)](_0x14b19f[_0x5600(0x2b)],_0x14b19f['ghDdh'],[{'text':'OK','style':'default'}]),![];}};return{'initiateDataExport':_0x550bb3};};
1
+ /**
2
+ * Netflix Data Extractor
3
+ *
4
+ * Orchestrates the Netflix data export flow:
5
+ * 1. Receives extracted viewing data from WebView
6
+ * 2. Validates and formats data
7
+ * 3. Sends to backend via netflixDataService
8
+ *
9
+ * This acts as the bridge between OAuthWebView and the backend API.
10
+ *
11
+ * @reference Sephora implementation: src/services/sephoraDataExtractor.ts
12
+ */
13
+
14
+ import { storeNetflixData } from './netflixDataService';
15
+ import { Alert } from 'react-native';
16
+
17
+ /**
18
+ * Combined Netflix export data from WebView - matches netflix.ts script output
19
+ */
20
+
21
+ /**
22
+ * Hook for Netflix data extraction operations
23
+ */
24
+ export const useNetflixDataExtractor = () => {
25
+ /**
26
+ * Initiate data export to backend
27
+ *
28
+ * @param username - User identifier
29
+ * @param data - Extracted Netflix data (viewingHistory, myList, ratings, profile)
30
+ * @returns true if successful, false otherwise
31
+ */
32
+ const initiateDataExport = async (username, data) => {
33
+ var _data$viewingHistory, _data$myList, _data$ratings, _data$viewingHistory2;
34
+ console.log('🚀 [NETFLIX_EXTRACTOR] Initiating data export');
35
+ console.log('👤 [NETFLIX_EXTRACTOR] Username:', username);
36
+ console.log('📊 [NETFLIX_EXTRACTOR] Summary:', data.summary);
37
+ if (!username) {
38
+ console.error('❌ [NETFLIX_EXTRACTOR] Username is required');
39
+ Alert.alert('Error', 'Username is required to export Netflix data.', [{
40
+ text: 'OK',
41
+ style: 'default'
42
+ }]);
43
+ return false;
44
+ }
45
+ const totalItems = (((_data$viewingHistory = data.viewingHistory) === null || _data$viewingHistory === void 0 || (_data$viewingHistory = _data$viewingHistory.items) === null || _data$viewingHistory === void 0 ? void 0 : _data$viewingHistory.length) || 0) + (((_data$myList = data.myList) === null || _data$myList === void 0 ? void 0 : _data$myList.length) || 0) + (((_data$ratings = data.ratings) === null || _data$ratings === void 0 ? void 0 : _data$ratings.length) || 0);
46
+ if (totalItems === 0) {
47
+ console.log('ℹ️ [NETFLIX_EXTRACTOR] No data to export - treating as success (connected)');
48
+ return true;
49
+ }
50
+ const validViewingHistory = (((_data$viewingHistory2 = data.viewingHistory) === null || _data$viewingHistory2 === void 0 ? void 0 : _data$viewingHistory2.items) || []).filter(item => {
51
+ const isValid = item.videoId && item.title;
52
+ if (!isValid) {
53
+ console.warn('⚠️ [NETFLIX_EXTRACTOR] Invalid viewing history item:', item);
54
+ }
55
+ return isValid;
56
+ });
57
+ const validMyList = (data.myList || []).filter(item => {
58
+ const isValid = item.videoId && item.title;
59
+ if (!isValid) {
60
+ console.warn('⚠️ [NETFLIX_EXTRACTOR] Invalid My List item:', item);
61
+ }
62
+ return isValid;
63
+ });
64
+ const validRatings = (data.ratings || []).filter(rating => {
65
+ const isValid = rating.videoId && rating.rating;
66
+ if (!isValid) {
67
+ console.warn('⚠️ [NETFLIX_EXTRACTOR] Invalid rating:', rating);
68
+ }
69
+ return isValid;
70
+ });
71
+ const originalCount = totalItems;
72
+ const validCount = validViewingHistory.length + validMyList.length + validRatings.length;
73
+ if (validCount < originalCount) {
74
+ console.warn(`⚠️ [NETFLIX_EXTRACTOR] Filtered out ${originalCount - validCount} invalid items`);
75
+ }
76
+ try {
77
+ console.log('📡 [NETFLIX_EXTRACTOR] Sending to backend...');
78
+ const result = await storeNetflixData(username, {
79
+ viewingHistory: {
80
+ items: validViewingHistory,
81
+ totalCount: validViewingHistory.length
82
+ },
83
+ myList: validMyList,
84
+ ratings: validRatings,
85
+ profile: data.profile,
86
+ tokenExpiry: data.tokenExpiry,
87
+ profileId: data.profileId
88
+ });
89
+ if (result.success) {
90
+ console.log('✅ [NETFLIX_EXTRACTOR] Export completed successfully');
91
+ console.log('📊 [NETFLIX_EXTRACTOR] Backend response:', result.data);
92
+ return true;
93
+ } else {
94
+ console.error('❌ [NETFLIX_EXTRACTOR] Backend storage failed:', result.error);
95
+ Alert.alert('Export Failed', result.error || 'An unknown error occurred during data storage.', [{
96
+ text: 'OK',
97
+ style: 'default'
98
+ }]);
99
+ return false;
100
+ }
101
+ } catch (error) {
102
+ console.error('❌ [NETFLIX_EXTRACTOR] Unexpected error during export:', error);
103
+ Alert.alert('Export Error', 'Failed to connect to the data storage service. Please check your network connection.', [{
104
+ text: 'OK',
105
+ style: 'default'
106
+ }]);
107
+ return false;
108
+ }
109
+ };
110
+ return {
111
+ initiateDataExport
112
+ };
113
+ };
114
+ //# sourceMappingURL=netflixDataExtractor.js.map
@@ -1 +1,191 @@
1
- import{API_CONFIG}from'../config/api';import AsyncStorage from'@react-native-async-storage/async-storage';function _0x4e2f(_0x519ae5,_0x4e2ff2){_0x519ae5=_0x519ae5-0x0;const _0x588b01=_0x519a();let _0x365ddd=_0x588b01[_0x519ae5];return _0x365ddd;}import{Platform}from'react-native';function _0x519a(){const _0x44db36=['📊\x20[NETFLIX_SERVICE]\x20My\x20List\x20items:','📊\x20[NETFLIX_SERVICE]\x20Ratings:','📊\x20[NETFLIX_SERVICE]\x20Has\x20profile:','Invalid\x20input:\x20userId\x20missing.','onairos_jwt_token','Authentication\x20token\x20not\x20found.\x20Please\x20log\x20in\x20again.','webview-api','ios','iPhone','Android','mobile-netflix','unknown','✅\x20[NETFLIX_SERVICE]\x20Successfully\x20stored\x20Netflix\x20data','Netflix\x20data\x20stored\x20successfully','Unknown\x20error','wXDPm','❌\x20[NETFLIX_SERVICE]\x20Network\x20error:','Network\x20error.\x20Please\x20check\x20your\x20connection.','log','🚀\x20[NETFLIX_SERVICE]\x20Storing\x20Netflix\x20data\x20for:','ORzEn','viewingHistory','items','length','RvLlM','FBazy','brguj','YOLfM','profile','error','LyFgs','kCzdk','vtcpC','getItem','enoch_token','auth_token','❌\x20[NETFLIX_SERVICE]\x20No\x20auth\x20token\x20found','rSbEG','Obfkt','1.0.0','fyRNk','seRbn','bgwHc','cpXGt','toISOString','tokenExpiry','vpOxy','streaming','dAVsG','map','videoId','title','type','seriesTitle','seasonNumber','episodeNumber','watchDuration','percentWatched','imageUrl','genres','totalCount','thIbc','myList','year','ratings','rating','ratedAt','profileName','maturityLevel','autoplayPreferences','profileId','ugLMg','KneND','cWRAB','pYpfG','filter','omwuf','PPNBY','XHqEz','📍\x20[NETFLIX_SERVICE]\x20URL:','BASE_URL','/platform-data/store','hhIkL','Bearer\x20','OnairosSDK/1.0.0\x20(','json','DCKMN','📝\x20[NETFLIX_SERVICE]\x20Backend\x20response:\x20','message','PdBQQ','data','warn','status','⚠️\x20[NETFLIX_SERVICE]\x20Error:\x20','ShuTk','OKdnb','YqELz','VhSBs'];_0x519a=function(){return _0x44db36;};return _0x519a();}export const storeNetflixData=async(_0x6f3680,_0x5e4a5c)=>{const _0x1daa67={'ORzEn':'📊\x20[NETFLIX_SERVICE]\x20Viewing\x20history\x20items:','fyRNk':function(_0x569839,_0x264e7b){return _0x569839===_0x264e7b;},'cWRAB':function(_0x21142a,_0x250b3b){return _0x21142a===_0x250b3b;},'RvLlM':_0x4e2f(0x0),'FBazy':function(_0x546bfb,_0x502e7c){return _0x546bfb===_0x502e7c;},'brguj':_0x4e2f(0x1),'YOLfM':_0x4e2f(0x2),'LyFgs':'❌\x20[NETFLIX_SERVICE]\x20Invalid\x20input:\x20userId\x20missing','kCzdk':_0x4e2f(0x3),'vtcpC':_0x4e2f(0x4),'rSbEG':_0x4e2f(0x5),'IKUDm':'🔑\x20[NETFLIX_SERVICE]\x20Auth\x20token\x20found','Obfkt':_0x4e2f(0x6),'seRbn':_0x4e2f(0x7),'bgwHc':_0x4e2f(0x8),'cpXGt':_0x4e2f(0x9),'vpOxy':_0x4e2f(0xa),'dAVsG':function(_0x3bb5b6,_0x4eb6b8){return _0x3bb5b6===_0x4eb6b8;},'thIbc':function(_0x414322,_0x48b759){return _0x414322===_0x48b759;},'ugLMg':function(_0x445ff0,_0x240a35){return _0x445ff0===_0x240a35;},'KneND':function(_0xc10587,_0x59e12f){return _0xc10587===_0x59e12f;},'pYpfG':function(_0x532745,_0x3eeacd){return _0x532745===_0x3eeacd;},'omwuf':function(_0x426848,_0x259b5a){return _0x426848===_0x259b5a;},'PPNBY':_0x4e2f(0xb),'XHqEz':'📡\x20[NETFLIX_SERVICE]\x20Sending\x20to\x20backend...','hhIkL':function(_0x487506,_0x28e32d,_0x3fddec){return _0x487506(_0x28e32d,_0x3fddec);},'DCKMN':_0x4e2f(0xc),'PdBQQ':_0x4e2f(0xd),'ShuTk':_0x4e2f(0xe),'OKdnb':_0x4e2f(0xf),'YqELz':_0x4e2f(0x10),'VhSBs':_0x4e2f(0x11)};var _0x3a7903,_0x3f1ad7,_0x436f59;console[_0x4e2f(0x12)](_0x4e2f(0x13),_0x6f3680),console[_0x4e2f(0x12)](_0x1daa67[_0x4e2f(0x14)],((_0x3a7903=_0x5e4a5c[_0x4e2f(0x15)])===null||_0x3a7903===void 0x0||_0x1daa67['fyRNk'](_0x3a7903=_0x3a7903[_0x4e2f(0x16)],null)||_0x1daa67['cWRAB'](_0x3a7903,void 0x0)?void 0x0:_0x3a7903[_0x4e2f(0x17)])||0x0),console[_0x4e2f(0x12)](_0x1daa67[_0x4e2f(0x18)],(_0x1daa67[_0x4e2f(0x19)](_0x3f1ad7=_0x5e4a5c['myList'],null)||_0x1daa67[_0x4e2f(0x19)](_0x3f1ad7,void 0x0)?void 0x0:_0x3f1ad7[_0x4e2f(0x17)])||0x0),console[_0x4e2f(0x12)](_0x1daa67[_0x4e2f(0x1a)],(_0x1daa67['FBazy'](_0x436f59=_0x5e4a5c['ratings'],null)||_0x436f59===void 0x0?void 0x0:_0x436f59[_0x4e2f(0x17)])||0x0),console[_0x4e2f(0x12)](_0x1daa67[_0x4e2f(0x1b)],!!_0x5e4a5c[_0x4e2f(0x1c)]);if(!_0x6f3680)return console[_0x4e2f(0x1d)](_0x1daa67[_0x4e2f(0x1e)]),{'success':![],'error':_0x1daa67[_0x4e2f(0x1f)]};try{var _0x240f11,_0x5d9869,_0x5ed04,_0x50fa3a,_0x241d8c,_0x40f7c5,_0x2a39de,_0x2fd8f7;const _0x2e44d6=await AsyncStorage['getItem'](_0x1daa67[_0x4e2f(0x20)])||await AsyncStorage[_0x4e2f(0x21)](_0x4e2f(0x22))||await AsyncStorage[_0x4e2f(0x21)](_0x4e2f(0x23));if(!_0x2e44d6)return console[_0x4e2f(0x1d)](_0x4e2f(0x24)),{'success':![],'error':_0x1daa67[_0x4e2f(0x25)]};console[_0x4e2f(0x12)](_0x1daa67['IKUDm']);const _0x1894cf={'platform':Platform['OS'],'source':_0x1daa67[_0x4e2f(0x26)],'appVersion':_0x4e2f(0x27),'osVersion':_0x1daa67[_0x4e2f(0x28)](Platform['OS'],_0x1daa67[_0x4e2f(0x29)])?'17.0':Platform['OS'],'deviceModel':Platform['OS']===_0x1daa67[_0x4e2f(0x29)]?_0x1daa67[_0x4e2f(0x2a)]:_0x1daa67[_0x4e2f(0x2b)],'isOfflineSync':![],'extractedAt':new Date()[_0x4e2f(0x2c)](),'tokenExpiry':_0x5e4a5c[_0x4e2f(0x2d)]},_0x1235a4={'platform':_0x1daa67[_0x4e2f(0x2e)],'dataType':_0x4e2f(0x2f),'data':{'viewingHistory':{'items':((_0x1daa67[_0x4e2f(0x30)](_0x240f11=_0x5e4a5c[_0x4e2f(0x15)],null)||_0x1daa67['cWRAB'](_0x240f11,void 0x0)?void 0x0:_0x240f11[_0x4e2f(0x16)])||[])[_0x4e2f(0x31)](_0x3f980d=>({'videoId':_0x3f980d[_0x4e2f(0x32)],'title':_0x3f980d[_0x4e2f(0x33)],'type':_0x3f980d[_0x4e2f(0x34)],'seriesTitle':_0x3f980d[_0x4e2f(0x35)],'seasonNumber':_0x3f980d[_0x4e2f(0x36)],'episodeNumber':_0x3f980d[_0x4e2f(0x37)],'watchedAt':_0x3f980d['watchedAt'],'watchDuration':_0x3f980d[_0x4e2f(0x38)],'totalDuration':_0x3f980d['totalDuration'],'percentWatched':_0x3f980d[_0x4e2f(0x39)],'imageUrl':_0x3f980d[_0x4e2f(0x3a)],'genres':_0x3f980d[_0x4e2f(0x3b)]})),'totalCount':((_0x5d9869=_0x5e4a5c[_0x4e2f(0x15)])===null||_0x1daa67[_0x4e2f(0x28)](_0x5d9869,void 0x0)?void 0x0:_0x5d9869[_0x4e2f(0x3c)])||(_0x1daa67[_0x4e2f(0x30)](_0x5ed04=_0x5e4a5c[_0x4e2f(0x15)],null)||_0x1daa67[_0x4e2f(0x3d)](_0x5ed04,void 0x0)||_0x1daa67[_0x4e2f(0x3d)](_0x5ed04=_0x5ed04[_0x4e2f(0x16)],null)||_0x5ed04===void 0x0?void 0x0:_0x5ed04[_0x4e2f(0x17)])||0x0},'myList':(_0x5e4a5c[_0x4e2f(0x3e)]||[])[_0x4e2f(0x31)](_0x25abb6=>({'videoId':_0x25abb6[_0x4e2f(0x32)],'title':_0x25abb6[_0x4e2f(0x33)],'type':_0x25abb6[_0x4e2f(0x34)],'addedAt':_0x25abb6['addedAt'],'imageUrl':_0x25abb6['imageUrl'],'genres':_0x25abb6['genres'],'maturityRating':_0x25abb6['maturityRating'],'year':_0x25abb6[_0x4e2f(0x3f)]})),'ratings':(_0x5e4a5c[_0x4e2f(0x40)]||[])[_0x4e2f(0x31)](_0x1b566a=>({'videoId':_0x1b566a[_0x4e2f(0x32)],'title':_0x1b566a[_0x4e2f(0x33)],'rating':_0x1b566a[_0x4e2f(0x41)],'ratedAt':_0x1b566a[_0x4e2f(0x42)]})),'profile':_0x5e4a5c[_0x4e2f(0x1c)]?{'profileId':_0x5e4a5c[_0x4e2f(0x1c)]['profileId'],'profileName':_0x5e4a5c[_0x4e2f(0x1c)][_0x4e2f(0x43)],'maturityLevel':_0x5e4a5c[_0x4e2f(0x1c)][_0x4e2f(0x44)],'language':_0x5e4a5c['profile']['language'],'subtitlePreferences':_0x5e4a5c['profile']['subtitlePreferences'],'autoplayPreferences':_0x5e4a5c[_0x4e2f(0x1c)][_0x4e2f(0x45)]}:null,'netflixProfileId':_0x5e4a5c[_0x4e2f(0x46)]||(_0x1daa67['dAVsG'](_0x50fa3a=_0x5e4a5c[_0x4e2f(0x1c)],null)||_0x1daa67[_0x4e2f(0x47)](_0x50fa3a,void 0x0)?void 0x0:_0x50fa3a[_0x4e2f(0x46)])},'summary':{'viewingHistoryCount':(_0x1daa67[_0x4e2f(0x47)](_0x241d8c=_0x5e4a5c[_0x4e2f(0x15)],null)||_0x1daa67[_0x4e2f(0x48)](_0x241d8c,void 0x0)||(_0x241d8c=_0x241d8c['items'])===null||_0x1daa67[_0x4e2f(0x49)](_0x241d8c,void 0x0)?void 0x0:_0x241d8c[_0x4e2f(0x17)])||0x0,'myListCount':(_0x1daa67[_0x4e2f(0x4a)](_0x40f7c5=_0x5e4a5c[_0x4e2f(0x3e)],null)||_0x40f7c5===void 0x0?void 0x0:_0x40f7c5['length'])||0x0,'ratingsCount':(_0x1daa67[_0x4e2f(0x49)](_0x2a39de=_0x5e4a5c[_0x4e2f(0x40)],null)||_0x2a39de===void 0x0?void 0x0:_0x2a39de[_0x4e2f(0x17)])||0x0,'thumbsUpCount':(_0x5e4a5c[_0x4e2f(0x40)]||[])[_0x4e2f(0x4b)](_0x3f9aaf=>_0x3f9aaf['rating']==='thumbs_up')[_0x4e2f(0x17)],'thumbsDownCount':(_0x5e4a5c[_0x4e2f(0x40)]||[])[_0x4e2f(0x4b)](_0x590267=>_0x590267[_0x4e2f(0x41)]==='thumbs_down')[_0x4e2f(0x17)],'profileName':(_0x1daa67[_0x4e2f(0x4c)](_0x2fd8f7=_0x5e4a5c['profile'],null)||_0x1daa67['thIbc'](_0x2fd8f7,void 0x0)?void 0x0:_0x2fd8f7[_0x4e2f(0x43)])||_0x1daa67[_0x4e2f(0x4d)]},'mobileMetadata':_0x1894cf};console[_0x4e2f(0x12)](_0x1daa67[_0x4e2f(0x4e)]),console[_0x4e2f(0x12)](_0x4e2f(0x4f),API_CONFIG[_0x4e2f(0x50)]+_0x4e2f(0x51));const _0x1de409=await _0x1daa67[_0x4e2f(0x52)](fetch,API_CONFIG[_0x4e2f(0x50)]+_0x4e2f(0x51),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x4e2f(0x53)+_0x2e44d6,'User-Agent':_0x4e2f(0x54)+Platform['OS']+')'},'body':JSON['stringify'](_0x1235a4)}),_0xb5f0b8=await _0x1de409[_0x4e2f(0x55)]();return _0x1de409['ok']?(console[_0x4e2f(0x12)](_0x1daa67[_0x4e2f(0x56)]),_0xb5f0b8['message']&&console['log'](_0x4e2f(0x57)+_0xb5f0b8[_0x4e2f(0x58)]),{'success':!![],'message':_0xb5f0b8['message']||_0x1daa67[_0x4e2f(0x59)],'data':_0xb5f0b8[_0x4e2f(0x5a)]}):(console[_0x4e2f(0x5b)]('⚠️\x20[NETFLIX_SERVICE]\x20Backend\x20returned\x20status:\x20'+_0x1de409[_0x4e2f(0x5c)]),console[_0x4e2f(0x5b)](_0x4e2f(0x5d)+(_0xb5f0b8[_0x4e2f(0x1d)]||_0x1daa67[_0x4e2f(0x5e)])),{'success':![],'error':_0xb5f0b8['error']||'HTTP\x20'+_0x1de409[_0x4e2f(0x5c)]});}catch(_0x15647c){return _0x1daa67['OKdnb']!==_0x1daa67[_0x4e2f(0x5f)]?(_0x38fc9c['error'](_0x4e2f(0x24)),{'success':![],'error':'Authentication\x20token\x20not\x20found.\x20Please\x20log\x20in\x20again.'}):(console[_0x4e2f(0x1d)](_0x1daa67[_0x4e2f(0x60)],_0x15647c),{'success':![],'error':_0x15647c[_0x4e2f(0x58)]||_0x1daa67[_0x4e2f(0x61)]});}};
1
+ /**
2
+ * Netflix Data Service
3
+ *
4
+ * API layer for storing Netflix viewing data on backend.
5
+ * Sends extracted viewing history, watch later, and profile to /platform-data/store endpoint.
6
+ *
7
+ * MATCHES Sephora/ChatGPT implementation pattern
8
+ * - Uses format: { platform, data, metadata }
9
+ * - Platform: "mobile-netflix"
10
+ *
11
+ * Data Sources (from netflix.com - API details TBD):
12
+ * - Viewing History: User's watch history
13
+ * - My List: User's saved shows/movies
14
+ * - Profile: User preferences and settings
15
+ * - Ratings: User's thumbs up/down ratings
16
+ */
17
+
18
+ import { API_CONFIG } from '../config/api';
19
+ import AsyncStorage from '@react-native-async-storage/async-storage';
20
+ import { Platform } from 'react-native';
21
+
22
+ /**
23
+ * Structure of a viewed item - Netflix content
24
+ */
25
+
26
+ /**
27
+ * Structure of viewing history
28
+ */
29
+
30
+ /**
31
+ * Structure of a My List item
32
+ */
33
+
34
+ /**
35
+ * Structure of a rating
36
+ */
37
+
38
+ /**
39
+ * Structure of user profile
40
+ */
41
+
42
+ /**
43
+ * Token expiry information
44
+ */
45
+
46
+ /**
47
+ * Combined Netflix data to store - matches WebView export format
48
+ */
49
+
50
+ /**
51
+ * Response from backend endpoint
52
+ */
53
+
54
+ /**
55
+ * Store Netflix data on backend
56
+ *
57
+ * @param userId - Username or identifier
58
+ * @param data - Netflix viewing data (history, myList, ratings, profile)
59
+ * @returns Response indicating success/failure with metadata
60
+ */
61
+ export const storeNetflixData = async (userId, data) => {
62
+ var _data$viewingHistory, _data$myList, _data$ratings;
63
+ console.log('🚀 [NETFLIX_SERVICE] Storing Netflix data for:', userId);
64
+ console.log('📊 [NETFLIX_SERVICE] Viewing history items:', ((_data$viewingHistory = data.viewingHistory) === null || _data$viewingHistory === void 0 || (_data$viewingHistory = _data$viewingHistory.items) === null || _data$viewingHistory === void 0 ? void 0 : _data$viewingHistory.length) || 0);
65
+ console.log('📊 [NETFLIX_SERVICE] My List items:', ((_data$myList = data.myList) === null || _data$myList === void 0 ? void 0 : _data$myList.length) || 0);
66
+ console.log('📊 [NETFLIX_SERVICE] Ratings:', ((_data$ratings = data.ratings) === null || _data$ratings === void 0 ? void 0 : _data$ratings.length) || 0);
67
+ console.log('📊 [NETFLIX_SERVICE] Has profile:', !!data.profile);
68
+ if (!userId) {
69
+ console.error('❌ [NETFLIX_SERVICE] Invalid input: userId missing');
70
+ return {
71
+ success: false,
72
+ error: 'Invalid input: userId missing.'
73
+ };
74
+ }
75
+ try {
76
+ var _data$viewingHistory2, _data$viewingHistory3, _data$viewingHistory4, _data$profile, _data$viewingHistory5, _data$myList2, _data$ratings2, _data$profile2;
77
+ const authToken = (await AsyncStorage.getItem('onairos_jwt_token')) || (await AsyncStorage.getItem('enoch_token')) || (await AsyncStorage.getItem('auth_token'));
78
+ if (!authToken) {
79
+ console.error('❌ [NETFLIX_SERVICE] No auth token found');
80
+ return {
81
+ success: false,
82
+ error: 'Authentication token not found. Please log in again.'
83
+ };
84
+ }
85
+ console.log('🔑 [NETFLIX_SERVICE] Auth token found');
86
+ const mobileMetadata = {
87
+ platform: Platform.OS,
88
+ source: 'webview-api',
89
+ appVersion: '1.0.0',
90
+ osVersion: Platform.OS === 'ios' ? '17.0' : Platform.OS,
91
+ deviceModel: Platform.OS === 'ios' ? 'iPhone' : 'Android',
92
+ isOfflineSync: false,
93
+ extractedAt: new Date().toISOString(),
94
+ tokenExpiry: data.tokenExpiry
95
+ };
96
+ const requestBody = {
97
+ platform: 'mobile-netflix',
98
+ dataType: 'streaming',
99
+ data: {
100
+ viewingHistory: {
101
+ items: (((_data$viewingHistory2 = data.viewingHistory) === null || _data$viewingHistory2 === void 0 ? void 0 : _data$viewingHistory2.items) || []).map(item => ({
102
+ videoId: item.videoId,
103
+ title: item.title,
104
+ type: item.type,
105
+ seriesTitle: item.seriesTitle,
106
+ seasonNumber: item.seasonNumber,
107
+ episodeNumber: item.episodeNumber,
108
+ watchedAt: item.watchedAt,
109
+ watchDuration: item.watchDuration,
110
+ totalDuration: item.totalDuration,
111
+ percentWatched: item.percentWatched,
112
+ imageUrl: item.imageUrl,
113
+ genres: item.genres
114
+ })),
115
+ totalCount: ((_data$viewingHistory3 = data.viewingHistory) === null || _data$viewingHistory3 === void 0 ? void 0 : _data$viewingHistory3.totalCount) || ((_data$viewingHistory4 = data.viewingHistory) === null || _data$viewingHistory4 === void 0 || (_data$viewingHistory4 = _data$viewingHistory4.items) === null || _data$viewingHistory4 === void 0 ? void 0 : _data$viewingHistory4.length) || 0
116
+ },
117
+ myList: (data.myList || []).map(item => ({
118
+ videoId: item.videoId,
119
+ title: item.title,
120
+ type: item.type,
121
+ addedAt: item.addedAt,
122
+ imageUrl: item.imageUrl,
123
+ genres: item.genres,
124
+ maturityRating: item.maturityRating,
125
+ year: item.year
126
+ })),
127
+ ratings: (data.ratings || []).map(rating => ({
128
+ videoId: rating.videoId,
129
+ title: rating.title,
130
+ rating: rating.rating,
131
+ ratedAt: rating.ratedAt
132
+ })),
133
+ profile: data.profile ? {
134
+ profileId: data.profile.profileId,
135
+ profileName: data.profile.profileName,
136
+ maturityLevel: data.profile.maturityLevel,
137
+ language: data.profile.language,
138
+ subtitlePreferences: data.profile.subtitlePreferences,
139
+ autoplayPreferences: data.profile.autoplayPreferences
140
+ } : null,
141
+ netflixProfileId: data.profileId || ((_data$profile = data.profile) === null || _data$profile === void 0 ? void 0 : _data$profile.profileId)
142
+ },
143
+ summary: {
144
+ viewingHistoryCount: ((_data$viewingHistory5 = data.viewingHistory) === null || _data$viewingHistory5 === void 0 || (_data$viewingHistory5 = _data$viewingHistory5.items) === null || _data$viewingHistory5 === void 0 ? void 0 : _data$viewingHistory5.length) || 0,
145
+ myListCount: ((_data$myList2 = data.myList) === null || _data$myList2 === void 0 ? void 0 : _data$myList2.length) || 0,
146
+ ratingsCount: ((_data$ratings2 = data.ratings) === null || _data$ratings2 === void 0 ? void 0 : _data$ratings2.length) || 0,
147
+ thumbsUpCount: (data.ratings || []).filter(r => r.rating === 'thumbs_up').length,
148
+ thumbsDownCount: (data.ratings || []).filter(r => r.rating === 'thumbs_down').length,
149
+ profileName: ((_data$profile2 = data.profile) === null || _data$profile2 === void 0 ? void 0 : _data$profile2.profileName) || 'unknown'
150
+ },
151
+ mobileMetadata: mobileMetadata
152
+ };
153
+ console.log('📡 [NETFLIX_SERVICE] Sending to backend...');
154
+ console.log('📍 [NETFLIX_SERVICE] URL:', `${API_CONFIG.BASE_URL}/platform-data/store`);
155
+ const response = await fetch(`${API_CONFIG.BASE_URL}/platform-data/store`, {
156
+ method: 'POST',
157
+ headers: {
158
+ 'Content-Type': 'application/json',
159
+ 'Authorization': `Bearer ${authToken}`,
160
+ 'User-Agent': `OnairosSDK/1.0.0 (${Platform.OS})`
161
+ },
162
+ body: JSON.stringify(requestBody)
163
+ });
164
+ const responseData = await response.json();
165
+ if (response.ok) {
166
+ console.log('✅ [NETFLIX_SERVICE] Successfully stored Netflix data');
167
+ if (responseData.message) {
168
+ console.log(`📝 [NETFLIX_SERVICE] Backend response: ${responseData.message}`);
169
+ }
170
+ return {
171
+ success: true,
172
+ message: responseData.message || 'Netflix data stored successfully',
173
+ data: responseData.data
174
+ };
175
+ } else {
176
+ console.warn(`⚠️ [NETFLIX_SERVICE] Backend returned status: ${response.status}`);
177
+ console.warn(`⚠️ [NETFLIX_SERVICE] Error: ${responseData.error || 'Unknown error'}`);
178
+ return {
179
+ success: false,
180
+ error: responseData.error || `HTTP ${response.status}`
181
+ };
182
+ }
183
+ } catch (error) {
184
+ console.error('❌ [NETFLIX_SERVICE] Network error:', error);
185
+ return {
186
+ success: false,
187
+ error: error.message || 'Network error. Please check your connection.'
188
+ };
189
+ }
190
+ };
191
+ //# sourceMappingURL=netflixDataService.js.map
@@ -1,7 +1,75 @@
1
+ const CryptoJS = require('react-native-crypto-js');
2
+ import { getTemporaryPin } from './pinStorageUtils';
1
3
 
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require('react-native-crypto-js')
5
- ];
6
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
7
- const CryptoJS=__ONAIROS_REQ_FUNC__(0x0);function _0x1022(_0x3eabc2,_0x1022e9){_0x3eabc2=_0x3eabc2-0x0;const _0x3d2f57=_0x3eab();let _0x5ac644=_0x3d2f57[_0x3eabc2];return _0x5ac644;}import{getTemporaryPin}from'./pinStorageUtils';const ENCRYPTION_KEY=_0x1022(0x0);function _0x3eab(){const _0x1cca2=['onairos-pin-encryption-key-2024','✅\x20PIN\x20encrypted\x20for\x20API\x20transmission','❌\x20Error\x20getting\x20encrypted\x20PIN\x20for\x20API:','⚠️\x20No\x20temporary\x20PIN\x20available\x20for\x20encryption','LVvbe','dTjfm','❌\x20Error\x20encrypting\x20PIN:','zrXlk','FVYHB','JRxYs','log','rQwgZ','eBXVX','error','FzWNS','AES','toString','🔐\x20PIN\x20encrypted\x20successfully','nieye','IaWqL','TsOFC','iLkkP','DEmtL','🔓\x20PIN\x20decrypted\x20successfully','lkvfF','❌\x20Error\x20decrypting\x20PIN:','enc','JfKDr','qzYAj','lPaxT','HvGWD','imGrx','🔒\x20PIN\x20hashed\x20successfully','NqbtK','FYiDC','mqRks','PkmyS','OoZBr','vdDRx','KAaMV','SHA256','jFPsl','ufKwZ','DRlUw','Utf8'];_0x3eab=function(){return _0x1cca2;};return _0x3eab();}export const encryptPin=_0x44ff17=>{const _0x1fdd48={'JRxYs':function(_0x394b64){return _0x394b64();},'rQwgZ':function(_0x374496,_0x9ba857){return _0x374496(_0x9ba857);},'eBXVX':_0x1022(0x1),'FzWNS':_0x1022(0x2),'iLkkP':_0x1022(0x3),'zrXlk':function(_0x5d89ad,_0x24f753){return _0x5d89ad!==_0x24f753;},'FVYHB':_0x1022(0x4),'nieye':function(_0x87d605,_0x192647){return _0x87d605===_0x192647;},'TsOFC':_0x1022(0x5),'DEmtL':_0x1022(0x6)};try{if(_0x1fdd48[_0x1022(0x7)](_0x1fdd48[_0x1022(0x8)],_0x1022(0x4)))try{const _0x4074f1=_0x1fdd48[_0x1022(0x9)](_0x3b4d6c);if(!_0x4074f1)return _0x3269d4[_0x1022(0xa)](_0x1022(0x3)),null;const _0x388bfb=_0x1fdd48[_0x1022(0xb)](_0x825af6,_0x4074f1);return _0x21eaa5[_0x1022(0xa)](_0x1fdd48[_0x1022(0xc)]),_0x388bfb;}catch(_0x5d9c31){return _0x367a48[_0x1022(0xd)](_0x1fdd48[_0x1022(0xe)],_0x5d9c31),null;}else{const _0x3ea0e4=CryptoJS[_0x1022(0xf)]['encrypt'](_0x44ff17,ENCRYPTION_KEY)[_0x1022(0x10)]();return console[_0x1022(0xa)](_0x1022(0x11)),_0x3ea0e4;}}catch(_0x368aa4){if(_0x1fdd48[_0x1022(0x12)](_0x1022(0x13),_0x1fdd48[_0x1022(0x14)]))return _0x15c188[_0x1022(0xa)](_0x1fdd48[_0x1022(0x15)]),null;else{console[_0x1022(0xd)](_0x1fdd48[_0x1022(0x16)],_0x368aa4);throw _0x368aa4;}}};export const decryptPin=_0xc2fea6=>{const _0x242d1f={'JfKDr':_0x1022(0x17),'qzYAj':function(_0x8ad2ac,_0x3216fc){return _0x8ad2ac!==_0x3216fc;},'lPaxT':_0x1022(0x18),'HvGWD':'Jmwoi','imGrx':_0x1022(0x19)};try{const _0x41066b=CryptoJS[_0x1022(0xf)]['decrypt'](_0xc2fea6,ENCRYPTION_KEY),_0x8dfa3f=_0x41066b[_0x1022(0x10)](CryptoJS[_0x1022(0x1a)]['Utf8']);return console[_0x1022(0xa)](_0x242d1f[_0x1022(0x1b)]),_0x8dfa3f;}catch(_0x2a2c10){if(_0x242d1f[_0x1022(0x1c)](_0x242d1f[_0x1022(0x1d)],_0x242d1f[_0x1022(0x1e)])){console['error'](_0x242d1f[_0x1022(0x1f)],_0x2a2c10);throw _0x2a2c10;}else{_0x245e38[_0x1022(0xd)](_0x1022(0x19),_0x6016a1);throw _0x13f656;}}};export const getEncryptedPinForAPI=async()=>{const _0x5e1554={'PkmyS':function(_0x426389,_0x401593){return _0x426389+_0x401593;},'OoZBr':_0x1022(0x20),'FYiDC':function(_0x2f2ab0,_0x53f205){return _0x2f2ab0!==_0x53f205;},'mqRks':_0x1022(0x21),'sKOjq':function(_0x52a4bb){return _0x52a4bb();},'vdDRx':_0x1022(0x3),'KAaMV':_0x1022(0x1)};try{if(_0x5e1554[_0x1022(0x22)](_0x5e1554[_0x1022(0x23)],_0x5e1554['mqRks'])){const _0x3827a7=_0x2c7ce9['SHA256'](_0x5e1554[_0x1022(0x24)](_0xe4b1a0,_0x5a62a6))[_0x1022(0x10)]();return _0x304722[_0x1022(0xa)](_0x5e1554[_0x1022(0x25)]),_0x3827a7;}else{const _0x4642ab=_0x5e1554['sKOjq'](getTemporaryPin);if(!_0x4642ab)return console[_0x1022(0xa)](_0x5e1554[_0x1022(0x26)]),null;const _0xa540c1=encryptPin(_0x4642ab);return console[_0x1022(0xa)](_0x5e1554[_0x1022(0x27)]),_0xa540c1;}}catch(_0x8e4778){return console[_0x1022(0xd)](_0x1022(0x2),_0x8e4778),null;}};export const hashPin=_0x47b3fc=>{const _0x4673ee={'jFPsl':function(_0x344061,_0x11cb88){return _0x344061+_0x11cb88;},'vKYiw':_0x1022(0x20),'ufKwZ':function(_0x4701e8,_0x465afd){return _0x4701e8!==_0x465afd;},'DRlUw':'suMVN','cRUAx':'❌\x20Error\x20hashing\x20PIN:'};try{const _0x191d84=CryptoJS[_0x1022(0x28)](_0x4673ee[_0x1022(0x29)](_0x47b3fc,ENCRYPTION_KEY))['toString']();return console[_0x1022(0xa)](_0x4673ee['vKYiw']),_0x191d84;}catch(_0x1bbfea){if(_0x4673ee[_0x1022(0x2a)](_0x4673ee[_0x1022(0x2b)],_0x4673ee[_0x1022(0x2b)])){const _0x2b80a4=_0x9cfa24[_0x1022(0xf)]['decrypt'](_0x58fa5d,_0x41a546),_0x560809=_0x2b80a4[_0x1022(0x10)](_0xdeee55[_0x1022(0x1a)][_0x1022(0x2c)]);return _0x27c1fe[_0x1022(0xa)](_0x1022(0x17)),_0x560809;}else{console[_0x1022(0xd)](_0x4673ee['cRUAx'],_0x1bbfea);throw _0x1bbfea;}}};
4
+ /**
5
+ * Service for encrypting PIN data before sending to APIs
6
+ */
7
+
8
+ // Encryption key - in production, this should come from a secure source
9
+ const ENCRYPTION_KEY = 'onairos-pin-encryption-key-2024';
10
+
11
+ /**
12
+ * Encrypt PIN using AES encryption
13
+ */
14
+ export const encryptPin = pin => {
15
+ try {
16
+ const encrypted = CryptoJS.AES.encrypt(pin, ENCRYPTION_KEY).toString();
17
+ console.log('🔐 PIN encrypted successfully');
18
+ return encrypted;
19
+ } catch (error) {
20
+ console.error('❌ Error encrypting PIN:', error);
21
+ throw error;
22
+ }
23
+ };
24
+
25
+ /**
26
+ * Decrypt PIN (for verification purposes)
27
+ */
28
+ export const decryptPin = encryptedPin => {
29
+ try {
30
+ const decrypted = CryptoJS.AES.decrypt(encryptedPin, ENCRYPTION_KEY);
31
+ const pin = decrypted.toString(CryptoJS.enc.Utf8);
32
+ console.log('🔓 PIN decrypted successfully');
33
+ return pin;
34
+ } catch (error) {
35
+ console.error('❌ Error decrypting PIN:', error);
36
+ throw error;
37
+ }
38
+ };
39
+
40
+ /**
41
+ * Get encrypted PIN for API transmission
42
+ */
43
+ export const getEncryptedPinForAPI = async () => {
44
+ try {
45
+ // Get the temporary PIN from memory
46
+ const pin = getTemporaryPin();
47
+ if (!pin) {
48
+ console.log('⚠️ No temporary PIN available for encryption');
49
+ return null;
50
+ }
51
+
52
+ // Encrypt the PIN
53
+ const encryptedPin = encryptPin(pin);
54
+ console.log('✅ PIN encrypted for API transmission');
55
+ return encryptedPin;
56
+ } catch (error) {
57
+ console.error('❌ Error getting encrypted PIN for API:', error);
58
+ return null;
59
+ }
60
+ };
61
+
62
+ /**
63
+ * Hash PIN for verification (one-way hash)
64
+ */
65
+ export const hashPin = pin => {
66
+ try {
67
+ const hash = CryptoJS.SHA256(pin + ENCRYPTION_KEY).toString();
68
+ console.log('🔒 PIN hashed successfully');
69
+ return hash;
70
+ } catch (error) {
71
+ console.error('❌ Error hashing PIN:', error);
72
+ throw error;
73
+ }
74
+ };
75
+ //# sourceMappingURL=pinEncryptionService.js.map