@onairos/react-native 3.7.1 → 3.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/lib/commonjs/api/index.js +219 -9
  2. package/lib/commonjs/assets/icons/spotify.png +0 -0
  3. package/lib/commonjs/assets/images/spotify.png +0 -0
  4. package/lib/commonjs/components/BodyText.js +27 -9
  5. package/lib/commonjs/components/BrandMark.js +111 -10
  6. package/lib/commonjs/components/CodeInput.js +116 -9
  7. package/lib/commonjs/components/EmailInput.js +30 -8
  8. package/lib/commonjs/components/GoogleButton.js +56 -9
  9. package/lib/commonjs/components/HeadingGroup.js +43 -9
  10. package/lib/commonjs/components/LLMDataInputModal.js +664 -14
  11. package/lib/commonjs/components/ModalHeader.js +99 -9
  12. package/lib/commonjs/components/ModalSheet.js +47 -9
  13. package/lib/commonjs/components/Onairos.js +380 -14
  14. package/lib/commonjs/components/OnairosButton.js +313 -13
  15. package/lib/commonjs/components/OnairosSignInButton.js +130 -12
  16. package/lib/commonjs/components/Overlay.js +465 -13
  17. package/lib/commonjs/components/PersonaImage.js +137 -10
  18. package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
  19. package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
  20. package/lib/commonjs/components/PinCreationScreen.js +403 -12
  21. package/lib/commonjs/components/PinInput.js +464 -9
  22. package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
  23. package/lib/commonjs/components/PlatformList.js +137 -10
  24. package/lib/commonjs/components/PlatformToggle.js +180 -9
  25. package/lib/commonjs/components/PrimaryButton.js +180 -10
  26. package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
  27. package/lib/commonjs/components/SignInStep.js +345 -12
  28. package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
  29. package/lib/commonjs/components/VerificationStep.js +176 -11
  30. package/lib/commonjs/components/WelcomeScreen.js +461 -22
  31. package/lib/commonjs/components/icons/Basicproficon.js +37 -8
  32. package/lib/commonjs/components/icons/Basicprofile.js +21 -8
  33. package/lib/commonjs/components/icons/Checkbox.js +21 -8
  34. package/lib/commonjs/components/icons/Checkmark.js +27 -8
  35. package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
  36. package/lib/commonjs/components/icons/Contenticon.js +39 -8
  37. package/lib/commonjs/components/icons/EnochE.js +41 -8
  38. package/lib/commonjs/components/icons/Personalityicon.js +30 -8
  39. package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
  40. package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
  41. package/lib/commonjs/components/icons/Userpreferences.js +21 -8
  42. package/lib/commonjs/components/icons/index.js +84 -17
  43. package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
  44. package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
  45. package/lib/commonjs/components/onboarding/PinInput.js +283 -10
  46. package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
  47. package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
  48. package/lib/commonjs/config/api.js +56 -7
  49. package/lib/commonjs/constants/index.js +120 -7
  50. package/lib/commonjs/context/AuthContext.js +345 -10
  51. package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
  52. package/lib/commonjs/hooks/useConnections.js +102 -8
  53. package/lib/commonjs/hooks/useCredentials.js +178 -10
  54. package/lib/commonjs/hooks/useUserConnections.js +148 -10
  55. package/lib/commonjs/index.js +439 -34
  56. package/lib/commonjs/services/apiClient.js +298 -8
  57. package/lib/commonjs/services/biometricPinService.js +180 -8
  58. package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
  59. package/lib/commonjs/services/chatGPTConversationService.js +275 -9
  60. package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
  61. package/lib/commonjs/services/claudeConversationService.js +158 -9
  62. package/lib/commonjs/services/connectedAccountsService.js +310 -10
  63. package/lib/commonjs/services/googleAuthService.js +252 -11
  64. package/lib/commonjs/services/hingeDataExtractor.js +105 -8
  65. package/lib/commonjs/services/hingeDataService.js +150 -9
  66. package/lib/commonjs/services/imageCompressionService.js +260 -7
  67. package/lib/commonjs/services/instagramDataExtractor.js +126 -8
  68. package/lib/commonjs/services/instagramDataService.js +163 -9
  69. package/lib/commonjs/services/jwtStorageService.js +276 -7
  70. package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
  71. package/lib/commonjs/services/linkedinProfileService.js +222 -9
  72. package/lib/commonjs/services/linkedinScrapingService.js +230 -8
  73. package/lib/commonjs/services/llmDataStorage.js +294 -8
  74. package/lib/commonjs/services/mobileTrainingService.js +186 -8
  75. package/lib/commonjs/services/netflixDataExtractor.js +120 -8
  76. package/lib/commonjs/services/netflixDataService.js +198 -9
  77. package/lib/commonjs/services/pinEncryptionService.js +84 -8
  78. package/lib/commonjs/services/pinStorageUtils.js +105 -7
  79. package/lib/commonjs/services/platformAuthService.js +1484 -12
  80. package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
  81. package/lib/commonjs/services/sephoraDataService.js +200 -9
  82. package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
  83. package/lib/commonjs/services/spotifyDataService.js +241 -9
  84. package/lib/commonjs/services/storageService.js +404 -8
  85. package/lib/commonjs/services/telegramDataExtractor.js +115 -8
  86. package/lib/commonjs/services/telegramDataService.js +499 -9
  87. package/lib/commonjs/services/trainingApiHelpers.js +73 -7
  88. package/lib/commonjs/services/userConnectionsService.js +340 -10
  89. package/lib/commonjs/services/youtubeMigrationService.js +416 -10
  90. package/lib/commonjs/theme/index.js +250 -7
  91. package/lib/commonjs/types/ambient.d.js +2 -1
  92. package/lib/commonjs/types/declarations.d.js +2 -1
  93. package/lib/commonjs/types/index.js +6 -1
  94. package/lib/commonjs/types/node-fix.d.js +2 -1
  95. package/lib/commonjs/types/node-override.d.js +2 -1
  96. package/lib/commonjs/types/opacity.d.js +2 -1
  97. package/lib/commonjs/types.js +14 -1
  98. package/lib/commonjs/utils/Portal.js +98 -8
  99. package/lib/commonjs/utils/api.js +130 -9
  100. package/lib/commonjs/utils/assetRegistry.js +210 -35
  101. package/lib/commonjs/utils/auth.js +112 -9
  102. package/lib/commonjs/utils/connectorTests.js +613 -29
  103. package/lib/commonjs/utils/crypto.js +62 -8
  104. package/lib/commonjs/utils/debugHelper.js +64 -1
  105. package/lib/commonjs/utils/encryption.js +76 -7
  106. package/lib/commonjs/utils/eventUtils.js +288 -1
  107. package/lib/commonjs/utils/haptics.js +66 -9
  108. package/lib/commonjs/utils/imagePreloader.js +6 -1
  109. package/lib/commonjs/utils/networkDiagnostics.js +226 -8
  110. package/lib/commonjs/utils/onairosApi.js +350 -9
  111. package/lib/commonjs/utils/programmaticFlow.js +117 -9
  112. package/lib/commonjs/utils/retryHelper.js +220 -1
  113. package/lib/commonjs/utils/secureStorage.js +349 -10
  114. package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
  115. package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
  116. package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
  117. package/lib/commonjs/utils/webviewScripts/index.js +698 -15
  118. package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
  119. package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
  120. package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
  121. package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
  122. package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
  123. package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
  124. package/lib/module/api/index.js +211 -1
  125. package/lib/module/assets/icons/spotify.png +0 -0
  126. package/lib/module/assets/images/spotify.png +0 -0
  127. package/lib/module/components/BodyText.js +20 -1
  128. package/lib/module/components/BrandMark.js +104 -1
  129. package/lib/module/components/CodeInput.js +109 -1
  130. package/lib/module/components/EmailInput.js +23 -1
  131. package/lib/module/components/GoogleButton.js +49 -1
  132. package/lib/module/components/HeadingGroup.js +36 -1
  133. package/lib/module/components/LLMDataInputModal.js +656 -7
  134. package/lib/module/components/ModalHeader.js +92 -1
  135. package/lib/module/components/ModalSheet.js +39 -1
  136. package/lib/module/components/Onairos.js +373 -1
  137. package/lib/module/components/OnairosButton.js +305 -1
  138. package/lib/module/components/OnairosSignInButton.js +121 -1
  139. package/lib/module/components/Overlay.js +456 -1
  140. package/lib/module/components/PersonaImage.js +129 -1
  141. package/lib/module/components/PersonaLoadingScreen.js +310 -1
  142. package/lib/module/components/PersonalizationConsentScreen.js +460 -1
  143. package/lib/module/components/PinCreationScreen.js +396 -1
  144. package/lib/module/components/PinInput.js +456 -1
  145. package/lib/module/components/PlatformConnectorsStep.js +1302 -6
  146. package/lib/module/components/PlatformList.js +129 -1
  147. package/lib/module/components/PlatformToggle.js +173 -1
  148. package/lib/module/components/PrimaryButton.js +172 -1
  149. package/lib/module/components/SignInMatchAnimation.js +189 -1
  150. package/lib/module/components/SignInStep.js +338 -1
  151. package/lib/module/components/UniversalOnboarding.js +2770 -1
  152. package/lib/module/components/VerificationStep.js +168 -1
  153. package/lib/module/components/WelcomeScreen.js +453 -1
  154. package/lib/module/components/icons/Basicproficon.js +30 -1
  155. package/lib/module/components/icons/Basicprofile.js +14 -1
  156. package/lib/module/components/icons/Checkbox.js +14 -1
  157. package/lib/module/components/icons/Checkmark.js +20 -1
  158. package/lib/module/components/icons/Contentanalysis.js +14 -1
  159. package/lib/module/components/icons/Contenticon.js +32 -1
  160. package/lib/module/components/icons/EnochE.js +34 -1
  161. package/lib/module/components/icons/Personalityicon.js +23 -1
  162. package/lib/module/components/icons/Personalityprofile.js +14 -1
  163. package/lib/module/components/icons/Personalitytraits.js +14 -1
  164. package/lib/module/components/icons/Userpreferences.js +14 -1
  165. package/lib/module/components/icons/index.js +13 -1
  166. package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
  167. package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
  168. package/lib/module/components/onboarding/PinInput.js +274 -1
  169. package/lib/module/components/onboarding/PlatformConnector.js +240 -1
  170. package/lib/module/config/PLATFORM_APIS.md +849 -0
  171. package/lib/module/config/api.js +47 -1
  172. package/lib/module/constants/index.js +114 -1
  173. package/lib/module/context/AuthContext.js +335 -1
  174. package/lib/module/hooks/useConnectedAccounts.js +106 -1
  175. package/lib/module/hooks/useConnections.js +95 -1
  176. package/lib/module/hooks/useCredentials.js +171 -6
  177. package/lib/module/hooks/useUserConnections.js +140 -1
  178. package/lib/module/index.js +172 -1
  179. package/lib/module/services/apiClient.js +295 -1
  180. package/lib/module/services/biometricPinService.js +169 -1
  181. package/lib/module/services/chatGPTConversationExtractor.js +149 -1
  182. package/lib/module/services/chatGPTConversationService.js +268 -1
  183. package/lib/module/services/claudeConversationExtractor.js +97 -1
  184. package/lib/module/services/claudeConversationService.js +151 -1
  185. package/lib/module/services/connectedAccountsService.js +293 -1
  186. package/lib/module/services/googleAuthService.js +241 -1
  187. package/lib/module/services/hingeDataExtractor.js +99 -1
  188. package/lib/module/services/hingeDataService.js +143 -1
  189. package/lib/module/services/imageCompressionService.js +250 -1
  190. package/lib/module/services/instagramDataExtractor.js +120 -1
  191. package/lib/module/services/instagramDataService.js +156 -1
  192. package/lib/module/services/jwtStorageService.js +257 -1
  193. package/lib/module/services/linkedinDOMExtractor.js +234 -1
  194. package/lib/module/services/linkedinProfileService.js +210 -1
  195. package/lib/module/services/linkedinScrapingService.js +219 -1
  196. package/lib/module/services/llmDataStorage.js +277 -1
  197. package/lib/module/services/mobileTrainingService.js +173 -1
  198. package/lib/module/services/netflixDataExtractor.js +114 -1
  199. package/lib/module/services/netflixDataService.js +191 -1
  200. package/lib/module/services/pinEncryptionService.js +74 -6
  201. package/lib/module/services/pinStorageUtils.js +93 -1
  202. package/lib/module/services/platformAuthService.js +1461 -1
  203. package/lib/module/services/sephoraDataExtractor.js +134 -1
  204. package/lib/module/services/sephoraDataService.js +193 -1
  205. package/lib/module/services/spotifyDataExtractor.js +142 -1
  206. package/lib/module/services/spotifyDataService.js +234 -1
  207. package/lib/module/services/storageService.js +383 -1
  208. package/lib/module/services/telegramDataExtractor.js +109 -1
  209. package/lib/module/services/telegramDataService.js +493 -1
  210. package/lib/module/services/trainingApiHelpers.js +67 -1
  211. package/lib/module/services/userConnectionsService.js +329 -1
  212. package/lib/module/services/youtubeMigrationService.js +405 -1
  213. package/lib/module/theme/index.js +245 -1
  214. package/lib/module/types.js +10 -1
  215. package/lib/module/utils/Portal.js +90 -1
  216. package/lib/module/utils/api.js +118 -1
  217. package/lib/module/utils/assetRegistry.js +200 -34
  218. package/lib/module/utils/auth.js +100 -1
  219. package/lib/module/utils/connectorTests.js +600 -27
  220. package/lib/module/utils/crypto.js +54 -1
  221. package/lib/module/utils/debugHelper.js +54 -1
  222. package/lib/module/utils/encryption.js +67 -1
  223. package/lib/module/utils/eventUtils.js +270 -1
  224. package/lib/module/utils/haptics.js +59 -8
  225. package/lib/module/utils/imagePreloader.js +3 -1
  226. package/lib/module/utils/networkDiagnostics.js +217 -1
  227. package/lib/module/utils/onairosApi.js +333 -1
  228. package/lib/module/utils/programmaticFlow.js +111 -1
  229. package/lib/module/utils/retryHelper.js +211 -1
  230. package/lib/module/utils/secureStorage.js +330 -6
  231. package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
  232. package/lib/module/utils/webviewScripts/claude.js +370 -1
  233. package/lib/module/utils/webviewScripts/hinge.js +405 -1
  234. package/lib/module/utils/webviewScripts/index.js +434 -1
  235. package/lib/module/utils/webviewScripts/instagram.js +448 -1
  236. package/lib/module/utils/webviewScripts/linkedin.js +874 -1
  237. package/lib/module/utils/webviewScripts/netflix.js +376 -1
  238. package/lib/module/utils/webviewScripts/sephora.js +510 -1
  239. package/lib/module/utils/webviewScripts/spotify.js +413 -1
  240. package/lib/module/utils/webviewScripts/telegram.js +672 -1
  241. package/package.json +2 -2
@@ -1 +1,173 @@
1
- import{getAuthToken}from'./authService';import{API_CONFIG}from'../config/api';const API_BASE_URL=''+API_CONFIG[_0x49f9(0x0)];export const getTrainingStatus=async _0xa17d27=>{const _0xae4eb6={'yJbZy':_0x49f9(0x1),'RRDtf':_0x49f9(0x2),'kByzw':function(_0x279c09,_0x558e35){return _0x279c09===_0x558e35;},'gShHV':_0x49f9(0x3),'eGIeA':function(_0x3ad0f0){return _0x3ad0f0();},'HvFDF':'IqJlm','ijRNO':function(_0x593def,_0x1f7320,_0x412d7f){return _0x593def(_0x1f7320,_0x412d7f);},'NdTdR':_0x49f9(0x4),'qWofZ':_0x49f9(0x5)};try{if(_0xae4eb6[_0x49f9(0x6)](_0xae4eb6[_0x49f9(0x7)],_0xae4eb6[_0x49f9(0x7)])){const _0x550054=await _0xae4eb6['eGIeA'](getAuthToken);if(!_0x550054){if(_0xae4eb6[_0x49f9(0x6)](_0xae4eb6[_0x49f9(0x8)],_0xae4eb6[_0x49f9(0x8)]))throw new Error(_0x49f9(0x1));else throw new _0x148910(_0xae4eb6[_0x49f9(0x9)]);}const _0x425254=await _0xae4eb6[_0x49f9(0xa)](fetch,API_BASE_URL+_0x49f9(0xb)+_0xa17d27,{'method':'GET','headers':{'Authorization':_0x550054,'Content-Type':'application/json'}});if(!_0x425254['ok']){const _0x4d5f1a=await _0x425254[_0x49f9(0xc)]();throw new Error(_0x4d5f1a[_0x49f9(0xd)]||_0x49f9(0xe)+_0x425254[_0x49f9(0xf)]);}return await _0x425254[_0x49f9(0xc)]();}else return _0x2bb301['warn'](_0xae4eb6['RRDtf'],_0x4b564e),![];}catch(_0x5d744e){if(_0xae4eb6[_0x49f9(0x6)]('dQmuf',_0xae4eb6['NdTdR']))throw new _0xdda64c(_0x49f9(0x10)+_0x4db07f['status']+'\x20-\x20'+_0x34502f);else{console[_0x49f9(0xd)](_0xae4eb6[_0x49f9(0x11)],_0x5d744e);throw _0x5d744e;}}};export const getModelInfo=async()=>{const _0x278dcf={'AFhyZ':'❌\x20Training\x20start\x20error:','txSrw':function(_0x9145f1){return _0x9145f1();},'gcoyW':'No\x20authentication\x20token\x20available','kqRRv':function(_0x443a03,_0x40b43d,_0x5a4625){return _0x443a03(_0x40b43d,_0x5a4625);},'rVGkq':function(_0x3bcbe7,_0x22254a){return _0x3bcbe7===_0x22254a;},'cKUwj':_0x49f9(0x12),'SfjVT':'QrKov','BtokC':_0x49f9(0x13)};try{const _0x54018a=await _0x278dcf[_0x49f9(0x14)](getAuthToken);if(!_0x54018a)throw new Error(_0x278dcf[_0x49f9(0x15)]);const _0xda2e73=await _0x278dcf[_0x49f9(0x16)](fetch,API_BASE_URL+_0x49f9(0x17),{'method':'GET','headers':{'Authorization':_0x54018a,'Content-Type':'application/json'}});if(!_0xda2e73['ok']){if(_0x278dcf['rVGkq'](_0x278dcf[_0x49f9(0x18)],_0x278dcf['SfjVT'])){_0x21ab19[_0x49f9(0xd)](_0x278dcf['AFhyZ'],_0x451837);throw _0x2e04be;}else{const _0x2724e4=await _0xda2e73[_0x49f9(0xc)]();throw new Error(_0x2724e4[_0x49f9(0xd)]||_0x49f9(0xe)+_0xda2e73[_0x49f9(0xf)]);}}return await _0xda2e73[_0x49f9(0xc)]();}catch(_0x5a7252){console[_0x49f9(0xd)](_0x278dcf[_0x49f9(0x19)],_0x5a7252);throw _0x5a7252;}};export const getHealthCheck=async()=>{const _0x31688e={'Mtopy':function(_0x137532,_0x187bd6,_0x18b990){return _0x137532(_0x187bd6,_0x18b990);},'sXDQp':'❌\x20Failed\x20to\x20get\x20health\x20check:'};try{const _0x3ffd34=await _0x31688e[_0x49f9(0x1a)](fetch,API_BASE_URL+_0x49f9(0x1b),{'method':'GET','headers':{'Content-Type':'application/json'}});if(!_0x3ffd34['ok']){const _0x3106b5=await _0x3ffd34[_0x49f9(0xc)]();throw new Error(_0x3106b5['error']||_0x49f9(0xe)+_0x3ffd34[_0x49f9(0xf)]);}return await _0x3ffd34[_0x49f9(0xc)]();}catch(_0x2e2e1c){console[_0x49f9(0xd)](_0x31688e['sXDQp'],_0x2e2e1c);throw _0x2e2e1c;}};function _0x49f9(_0x32777c,_0x49f97a){_0x32777c=_0x32777c-0x0;const _0x305958=_0x3277();let _0x14b333=_0x305958[_0x32777c];return _0x14b333;}export const startEnochTrainingWithYouTubeCheck=async _0x5e56fe=>{const _0x3cd1c3={'UoIvn':_0x49f9(0x1c),'jDnYL':_0x49f9(0x1d),'gBDMH':_0x49f9(0x1e),'uiwWq':_0x49f9(0x1f),'txtsF':function(_0x29e28b,_0x34512b){return _0x29e28b(_0x34512b);},'wxBWr':_0x49f9(0x20),'XErJp':_0x49f9(0x21),'qpHXG':_0x49f9(0x22),'nKgyb':function(_0x4866f7,_0x288199){return _0x4866f7===_0x288199;},'UbqiS':_0x49f9(0x23),'kDBXZ':_0x49f9(0x24),'jcPwB':'❌\x20Training\x20error:'};try{const _0x35d7e4=_0x3cd1c3[_0x49f9(0x25)][_0x49f9(0x26)]('|');let _0x3252a6=0x0;while(!![]){switch(_0x35d7e4[_0x3252a6++]){case'0':console['log'](_0x49f9(0x27));continue;case'1':console['log'](_0x3cd1c3['jDnYL']);continue;case'2':console[_0x49f9(0x28)](_0x3cd1c3[_0x49f9(0x29)]);continue;case'3':console[_0x49f9(0x28)](_0x3cd1c3[_0x49f9(0x2a)]);continue;case'4':return await _0x3cd1c3[_0x49f9(0x2b)](startEnochTraining,_0x5e56fe);case'5':console[_0x49f9(0x28)](_0x3cd1c3[_0x49f9(0x2c)],_0x5e56fe[_0x49f9(0x2d)],_0x3cd1c3[_0x49f9(0x2e)]);continue;case'6':console['log'](_0x3cd1c3[_0x49f9(0x2f)]);continue;}break;}}catch(_0x1d0869){if(_0x3cd1c3[_0x49f9(0x30)](_0x3cd1c3[_0x49f9(0x31)],_0x3cd1c3[_0x49f9(0x32)])){_0x587e21[_0x49f9(0xd)](_0x49f9(0x33),_0x3c0ed2);throw _0x519828;}else{console[_0x49f9(0xd)](_0x3cd1c3['jcPwB'],_0x1d0869);throw _0x1d0869;}}};export const startEnochTraining=async _0x2e8e3a=>{const _0x1b48cf={'nIBrA':_0x49f9(0x34),'joGin':_0x49f9(0x35),'ScLGf':'No\x20authentication\x20token\x20available','EeAOb':_0x49f9(0x5),'KKOVw':function(_0xb602b5){return _0xb602b5();},'VBqzE':function(_0x57e787,_0x1e83db){return _0x57e787===_0x1e83db;},'yUKJi':_0x49f9(0x36),'mpXnM':_0x49f9(0x37),'nHedX':function(_0x30af8b,_0x48c9e1,_0x3d07e9){return _0x30af8b(_0x48c9e1,_0x3d07e9);},'sPlsI':'📡\x20Training\x20API\x20response\x20status:','AyGBN':function(_0x5c3463,_0x29c31e){return _0x5c3463!==_0x29c31e;},'nLsKm':_0x49f9(0x38),'LajWY':_0x49f9(0x39),'quRYT':_0x49f9(0x3a),'lKkkG':function(_0x477005,_0x2ba462){return _0x477005===_0x2ba462;},'MEMpa':_0x49f9(0x3b),'gzGzW':_0x49f9(0x3c),'bfTZP':_0x49f9(0x3d),'SZjwQ':_0x49f9(0x3e),'ZCAOT':'gfKHr','ISpYS':_0x49f9(0x3f)};try{const _0x469d04=await _0x1b48cf[_0x49f9(0x40)](getAuthToken);if(!_0x469d04){if(_0x1b48cf['VBqzE'](_0x1b48cf[_0x49f9(0x41)],_0x1b48cf[_0x49f9(0x41)]))throw new Error(_0x1b48cf[_0x49f9(0x42)]);else{_0x127079['error'](_0x49f9(0x13),_0x2f6fca);throw _0xdfa6d7;}}console['log'](_0x1b48cf['mpXnM'],_0x2e8e3a);const _0x3b20a0=await _0x1b48cf[_0x49f9(0x43)](fetch,API_BASE_URL+'/mobile-training/enoch',{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x469d04},'body':JSON[_0x49f9(0x44)](_0x2e8e3a)});console[_0x49f9(0x28)](_0x1b48cf['sPlsI'],_0x3b20a0[_0x49f9(0xf)]);if(!_0x3b20a0['ok']){if(_0x1b48cf[_0x49f9(0x45)](_0x1b48cf[_0x49f9(0x46)],_0x1b48cf[_0x49f9(0x47)])){const _0x54f7b0=await _0x3b20a0[_0x49f9(0x48)]();console[_0x49f9(0xd)](_0x1b48cf[_0x49f9(0x49)],_0x3b20a0['status'],_0x49f9(0x4a),_0x54f7b0);try{if(_0x1b48cf[_0x49f9(0x4b)](_0x1b48cf[_0x49f9(0x4c)],_0x1b48cf['gzGzW']))return _0x4fed57['warn'](_0x1b48cf['nIBrA'],_0x1ba2a3),null;else{const _0x3e1a8a=JSON[_0x49f9(0x4d)](_0x54f7b0);throw new Error(_0x3e1a8a['error']||'HTTP\x20'+_0x3b20a0[_0x49f9(0xf)]);}}catch(_0x34e61f){if(_0x1b48cf[_0x49f9(0x4b)](_0x1b48cf[_0x49f9(0x4e)],'hezFB'))throw new Error(_0x49f9(0x10)+_0x3b20a0[_0x49f9(0xf)]+_0x49f9(0x4f)+_0x54f7b0);else{_0x4e4794['error'](_0x1b48cf[_0x49f9(0x50)],_0x4709d1);throw _0x57d610;}}}else throw new _0xc7638c(_0x1b48cf[_0x49f9(0x42)]);}const _0x30b9a5=await _0x3b20a0['json']();return console['log'](_0x1b48cf[_0x49f9(0x51)],_0x30b9a5),_0x30b9a5;}catch(_0x502dbf){if(_0x1b48cf[_0x49f9(0x52)]===_0x1b48cf['ZCAOT']){console[_0x49f9(0xd)](_0x1b48cf[_0x49f9(0x53)],_0x502dbf);throw _0x502dbf;}else{_0x42494a[_0x49f9(0xd)](_0x1b48cf[_0x49f9(0x54)],_0x4c5823);throw _0x1852ae;}}};function _0x3277(){const _0x329046=['BASE_URL','No\x20authentication\x20token\x20available','⚠️\x20Could\x20not\x20check\x20training\x20status:','yEZsq','qeGrp','❌\x20Failed\x20to\x20get\x20training\x20status:','kByzw','gShHV','HvFDF','yJbZy','ijRNO','/mobile-training/status/','json','error','HTTP\x20','status','Training\x20API\x20failed:\x20','qWofZ','ABAke','❌\x20Failed\x20to\x20get\x20model\x20info:','txSrw','gcoyW','kqRRv','/mobile-training/model-info','cKUwj','BtokC','Mtopy','/mobile-training/health','5|1|0|6|3|2|4','🚀\x20[TRAINING]\x20Starting\x20training\x20-\x20backend\x20handles\x20all\x20YouTube\x20cases\x20automatically','\x20\x20\x20-\x20Backend\x20validation:\x20Handles\x20all\x20edge\x20cases\x20✅','\x20\x20\x20-\x20Full\x20refresh\x20tokens:\x20Auto-refresh\x20when\x20expired\x20✅','🚀\x20Starting\x20Enoch\x20training\x20for\x20user:','(backend\x20auto-handles\x20YouTube)','\x20\x20\x20-\x20Temporary\x20mode\x20connections:\x20Work\x20automatically\x20✅','QVxpc','FQtPI','UoIvn','split','ℹ️\x20[TRAINING]\x20No\x20migration\x20checks\x20needed:','log','gBDMH','uiwWq','txtsF','wxBWr','username','XErJp','qpHXG','nKgyb','UbqiS','kDBXZ','❌\x20Failed\x20to\x20get\x20health\x20check:','⚠️\x20Could\x20not\x20get\x20training\x20features:','❌\x20Training\x20error:','SyEGG','📤\x20Sending\x20training\x20data\x20to\x20/mobile-training/enoch:','WrzPo','Rddwm','❌\x20Training\x20API\x20failed\x20with\x20status:','QaHSM','CJgkY','hezFB','📡\x20Training\x20API\x20response:','❌\x20Training\x20start\x20error:','KKOVw','yUKJi','ScLGf','nHedX','stringify','AyGBN','nLsKm','LajWY','text','quRYT','Error:','lKkkG','MEMpa','parse','bfTZP','\x20-\x20','joGin','SZjwQ','ZCAOT','ISpYS','EeAOb','success','isTraining','warn','UVPTM','jNyuN','eOJaY','lCzvt','LPpZP','SBMtS','features'];_0x3277=function(){return _0x329046;};return _0x3277();}export const isTrainingInProgress=async _0x48facb=>{const _0x2da864={'RPcST':function(_0x5ed294,_0x4a2418){return _0x5ed294(_0x4a2418);},'UVPTM':'⚠️\x20Could\x20not\x20check\x20training\x20status:'};try{const _0x12bdd5=await _0x2da864['RPcST'](getTrainingStatus,_0x48facb);return _0x12bdd5[_0x49f9(0x55)]&&_0x12bdd5[_0x49f9(0x56)];}catch(_0x4f4e5f){return console[_0x49f9(0x57)](_0x2da864[_0x49f9(0x58)],_0x4f4e5f),![];}};export const getTrainingFeatures=async()=>{const _0x13ca5e={'LPpZP':_0x49f9(0x1),'eOJaY':function(_0x487eff,_0x32cce0){return _0x487eff===_0x32cce0;},'lCzvt':_0x49f9(0x59),'QvgtC':'NkBkZ','SBMtS':function(_0x577040){return _0x577040();},'HefUn':_0x49f9(0x34)};try{if(_0x13ca5e[_0x49f9(0x5a)](_0x13ca5e[_0x49f9(0x5b)],_0x13ca5e['QvgtC']))throw new _0x4a644c(_0x13ca5e[_0x49f9(0x5c)]);else{const _0x2f5d76=await _0x13ca5e[_0x49f9(0x5d)](getHealthCheck);return _0x2f5d76[_0x49f9(0x5e)];}}catch(_0x6223e7){return console[_0x49f9(0x57)](_0x13ca5e['HefUn'],_0x6223e7),null;}};
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';export const useNetflixDataExtractor=()=>{const _0x4a3ce0={'TDEru':_0x5145(0x0),'zhEas':'Export\x20Error','TSEYN':_0x5145(0x1),'OGWrQ':_0x5145(0x2),'MFJIG':function(_0x2a840f,_0x3c2ccf){return _0x2a840f!==_0x3c2ccf;},'iDFro':_0x5145(0x3),'AoSMK':_0x5145(0x4),'DfCtc':_0x5145(0x5),'MRuVp':_0x5145(0x6),'toeKm':_0x5145(0x7),'TdymY':_0x5145(0x8),'jHDQp':'✅\x20[NETFLIX_EXTRACTOR]\x20Export\x20completed\x20successfully','yabBH':'KeqXQ','MMwHg':_0x5145(0x9),'mndjz':function(_0xb8f87a,_0x3c8048){return _0xb8f87a===_0x3c8048;},'LPZzu':_0x5145(0xa),'Ynksb':'❌\x20[NETFLIX_EXTRACTOR]\x20Username\x20is\x20required','EvKOh':'Error','ZcFNS':'Username\x20is\x20required\x20to\x20export\x20Netflix\x20data.','dRpUC':function(_0x21b031,_0x5df4f1){return _0x21b031+_0x5df4f1;},'IjmhT':function(_0x9af600,_0x28ad38){return _0x9af600===_0x28ad38;},'iCXGo':function(_0x5e1ee1,_0x5af547){return _0x5e1ee1===_0x5af547;},'zzcHF':function(_0x5082dd,_0xd78ed1){return _0x5082dd===_0xd78ed1;},'iPkmR':function(_0x369ce5,_0x518c30){return _0x369ce5===_0x518c30;},'Bsazg':_0x5145(0xb),'tvWbI':_0x5145(0xc),'TpNvb':function(_0x2b5908,_0x2e6a2a){return _0x2b5908===_0x2e6a2a;},'tqDYj':function(_0x1dcdfd,_0x56edb2){return _0x1dcdfd+_0x56edb2;},'wyLMJ':function(_0x1a9f55,_0x2a5080){return _0x1a9f55+_0x2a5080;},'hCskD':function(_0x340a30,_0x91fceb){return _0x340a30<_0x91fceb;},'SuTdU':_0x5145(0xd),'oAMsC':function(_0x263098,_0x4bb614,_0x4e236e){return _0x263098(_0x4bb614,_0x4e236e);},'EjxJn':_0x5145(0xe),'mVOEI':function(_0x3623a9,_0x2f4f0b){return _0x3623a9!==_0x2f4f0b;},'jDlCD':'Export\x20Failed'},_0xa67bf2=async(_0x238eca,_0x57ee67)=>{const _0x5c4f4f={'wsegw':_0x4a3ce0['MRuVp'],'tsLro':_0x5145(0xf),'uKWON':_0x5145(0x10),'uVVyF':_0x5145(0x2),'qPmxw':_0x4a3ce0[_0x5145(0x11)],'jsQux':_0x4a3ce0[_0x5145(0x12)],'VCrOe':_0x4a3ce0[_0x5145(0x13)],'yyBit':_0x4a3ce0[_0x5145(0x14)]};if(_0x4a3ce0[_0x5145(0x15)](_0x4a3ce0[_0x5145(0x16)],'dTFAy')){var _0x42c0f6,_0x16579f,_0x2641a1,_0x3fd300;console[_0x5145(0x17)](_0x5145(0x18)),console['log']('👤\x20[NETFLIX_EXTRACTOR]\x20Username:',_0x238eca),console[_0x5145(0x17)](_0x4a3ce0[_0x5145(0x19)],_0x57ee67[_0x5145(0x1a)]);if(!_0x238eca){if(_0x4a3ce0[_0x5145(0x1b)](_0x4a3ce0[_0x5145(0x1c)],_0x4a3ce0[_0x5145(0x1c)]))return console[_0x5145(0x1d)](_0x4a3ce0['Ynksb']),Alert[_0x5145(0x1e)](_0x4a3ce0[_0x5145(0x1f)],_0x4a3ce0[_0x5145(0x20)],[{'text':'OK','style':_0x4a3ce0['OGWrQ']}]),![];else _0x37c57c[_0x5145(0x21)](_0x5145(0x7),_0x48b970);}const _0x199f2b=_0x4a3ce0[_0x5145(0x22)](((_0x4a3ce0['mndjz'](_0x42c0f6=_0x57ee67[_0x5145(0x23)],null)||_0x42c0f6===void 0x0||_0x4a3ce0[_0x5145(0x1b)](_0x42c0f6=_0x42c0f6[_0x5145(0x24)],null)||_0x4a3ce0[_0x5145(0x25)](_0x42c0f6,void 0x0)?void 0x0:_0x42c0f6[_0x5145(0x26)])||0x0)+((_0x4a3ce0[_0x5145(0x27)](_0x16579f=_0x57ee67[_0x5145(0x28)],null)||_0x16579f===void 0x0?void 0x0:_0x16579f['length'])||0x0),(_0x4a3ce0[_0x5145(0x1b)](_0x2641a1=_0x57ee67[_0x5145(0x29)],null)||_0x4a3ce0[_0x5145(0x2a)](_0x2641a1,void 0x0)?void 0x0:_0x2641a1[_0x5145(0x26)])||0x0);if(_0x199f2b===0x0){if(_0x4a3ce0[_0x5145(0x2b)](_0x4a3ce0[_0x5145(0x2c)],_0x5145(0x2d)))_0x54a3fc[_0x5145(0x21)](_0x5145(0x2e)+(_0x42b652-_0xdd98a)+_0x5145(0x2f));else return console[_0x5145(0x17)](_0x4a3ce0[_0x5145(0x30)]),!![];}const _0x297d37=(((_0x3fd300=_0x57ee67[_0x5145(0x23)])===null||_0x4a3ce0[_0x5145(0x31)](_0x3fd300,void 0x0)?void 0x0:_0x3fd300[_0x5145(0x24)])||[])[_0x5145(0x32)](_0x2bfb0d=>{const _0xa327ff={'qmAxe':_0x4a3ce0[_0x5145(0x33)],'RszsV':_0x4a3ce0[_0x5145(0x34)],'GfuHf':_0x4a3ce0[_0x5145(0x35)],'oOaNY':_0x4a3ce0[_0x5145(0x36)]};if(_0x4a3ce0[_0x5145(0x15)]('tyuoc',_0x4a3ce0[_0x5145(0x37)]))return _0x74d3a['error'](_0xa327ff[_0x5145(0x38)],_0x362cac),Alert[_0x5145(0x1e)](_0xa327ff[_0x5145(0x39)],_0xa327ff[_0x5145(0x3a)],[{'text':'OK','style':_0xa327ff[_0x5145(0x3b)]}]),![];else{const _0x2ba28a=_0x2bfb0d['videoId']&&_0x2bfb0d[_0x5145(0x3c)];return!_0x2ba28a&&console['warn'](_0x5145(0x8),_0x2bfb0d),_0x2ba28a;}}),_0x487c31=(_0x57ee67[_0x5145(0x28)]||[])['filter'](_0x312398=>{const _0x1e6bb0=_0x312398[_0x5145(0x3d)]&&_0x312398[_0x5145(0x3c)];if(!_0x1e6bb0){if(_0x4a3ce0['AoSMK']===_0x4a3ce0[_0x5145(0x3e)])console[_0x5145(0x21)](_0x4a3ce0['DfCtc'],_0x312398);else return _0xe23fc5[_0x5145(0x1d)](_0x5c4f4f[_0x5145(0x3f)],_0x2eff58[_0x5145(0x1d)]),Alert[_0x5145(0x1e)](_0x5c4f4f[_0x5145(0x40)],_0x48bdd8[_0x5145(0x1d)]||_0x5c4f4f['uKWON'],[{'text':'OK','style':_0x5c4f4f['uVVyF']}]),![];}return _0x1e6bb0;}),_0x2bfbc4=(_0x57ee67['ratings']||[])[_0x5145(0x32)](_0x50ce7c=>{const _0x398092=_0x50ce7c[_0x5145(0x3d)]&&_0x50ce7c[_0x5145(0x41)];return!_0x398092&&console[_0x5145(0x21)](_0x5c4f4f[_0x5145(0x42)],_0x50ce7c),_0x398092;}),_0x1c5b14=_0x199f2b,_0x167eb8=_0x4a3ce0[_0x5145(0x43)](_0x4a3ce0[_0x5145(0x44)](_0x297d37[_0x5145(0x26)],_0x487c31[_0x5145(0x26)]),_0x2bfbc4[_0x5145(0x26)]);_0x4a3ce0[_0x5145(0x45)](_0x167eb8,_0x1c5b14)&&console[_0x5145(0x21)]('⚠️\x20[NETFLIX_EXTRACTOR]\x20Filtered\x20out\x20'+(_0x1c5b14-_0x167eb8)+_0x5145(0x2f));try{if(_0x4a3ce0['MFJIG'](_0x4a3ce0['SuTdU'],_0x4a3ce0[_0x5145(0x46)])){const _0x76a514=_0x1e80cd['videoId']&&_0x4d36d6[_0x5145(0x3c)];return!_0x76a514&&_0x48dede[_0x5145(0x21)](_0x5145(0x5),_0x52e3e4),_0x76a514;}else{console[_0x5145(0x17)]('📡\x20[NETFLIX_EXTRACTOR]\x20Sending\x20to\x20backend...');const _0x21d589=await _0x4a3ce0['oAMsC'](storeNetflixData,_0x238eca,{'viewingHistory':{'items':_0x297d37,'totalCount':_0x297d37[_0x5145(0x26)]},'myList':_0x487c31,'ratings':_0x2bfbc4,'profile':_0x57ee67[_0x5145(0x47)],'tokenExpiry':_0x57ee67[_0x5145(0x48)],'profileId':_0x57ee67['profileId']});if(_0x21d589[_0x5145(0x49)])return console[_0x5145(0x17)](_0x4a3ce0[_0x5145(0x14)]),console[_0x5145(0x17)](_0x4a3ce0[_0x5145(0x4a)],_0x21d589['data']),!![];else{if(_0x4a3ce0[_0x5145(0x4b)](_0x5145(0x4c),_0x5145(0x4c)))_0x35a2e7[_0x5145(0x21)](_0x5c4f4f[_0x5145(0x4d)],_0x2555ee);else return console[_0x5145(0x1d)](_0x4a3ce0['MRuVp'],_0x21d589['error']),Alert[_0x5145(0x1e)](_0x4a3ce0[_0x5145(0x4e)],_0x21d589[_0x5145(0x1d)]||_0x5145(0x10),[{'text':'OK','style':_0x5145(0x2)}]),![];}}}catch(_0x3a9a82){if(_0x4a3ce0[_0x5145(0x25)]('TElXc',_0x5145(0x4f))){const _0x46924c=_0x1b4efe[_0x5145(0x3d)]&&_0x1b6420[_0x5145(0x3c)];return!_0x46924c&&_0x2ed44f[_0x5145(0x21)](_0x5c4f4f[_0x5145(0x50)],_0x2ec1ce),_0x46924c;}else return console[_0x5145(0x1d)]('❌\x20[NETFLIX_EXTRACTOR]\x20Unexpected\x20error\x20during\x20export:',_0x3a9a82),Alert[_0x5145(0x1e)](_0x4a3ce0[_0x5145(0x34)],_0x4a3ce0[_0x5145(0x35)],[{'text':'OK','style':_0x4a3ce0[_0x5145(0x36)]}]),![];}}else return _0x284326[_0x5145(0x17)](_0x5c4f4f[_0x5145(0x51)]),_0x2922a5[_0x5145(0x17)]('📊\x20[NETFLIX_EXTRACTOR]\x20Backend\x20response:',_0x34fa7e[_0x5145(0x52)]),!![];};return{'initiateDataExport':_0xa67bf2};};function _0x5145(_0x56eea2,_0x5145cf){_0x56eea2=_0x56eea2-0x0;const _0x5a7520=_0x56ee();let _0x1e4fb6=_0x5a7520[_0x56eea2];return _0x1e4fb6;}function _0x56ee(){const _0x328de3=['❌\x20[NETFLIX_EXTRACTOR]\x20Unexpected\x20error\x20during\x20export:','Failed\x20to\x20connect\x20to\x20the\x20data\x20storage\x20service.\x20Please\x20check\x20your\x20network\x20connection.','default','tyuoc','vuofc','⚠️\x20[NETFLIX_EXTRACTOR]\x20Invalid\x20My\x20List\x20item:','❌\x20[NETFLIX_EXTRACTOR]\x20Backend\x20storage\x20failed:','⚠️\x20[NETFLIX_EXTRACTOR]\x20Invalid\x20rating:','⚠️\x20[NETFLIX_EXTRACTOR]\x20Invalid\x20viewing\x20history\x20item:','📊\x20[NETFLIX_EXTRACTOR]\x20Summary:','SmatK','zyCMi','ℹ️\x20[NETFLIX_EXTRACTOR]\x20No\x20data\x20to\x20export\x20-\x20treating\x20as\x20success\x20(connected)','Yhvwl','📊\x20[NETFLIX_EXTRACTOR]\x20Backend\x20response:','Export\x20Failed','An\x20unknown\x20error\x20occurred\x20during\x20data\x20storage.','toeKm','DfCtc','TdymY','jHDQp','MFJIG','yabBH','log','🚀\x20[NETFLIX_EXTRACTOR]\x20Initiating\x20data\x20export','MMwHg','summary','mndjz','LPZzu','error','alert','EvKOh','ZcFNS','warn','dRpUC','viewingHistory','items','IjmhT','length','iCXGo','myList','ratings','zzcHF','iPkmR','Bsazg','WBSuS','⚠️\x20[NETFLIX_EXTRACTOR]\x20Filtered\x20out\x20','\x20invalid\x20items','tvWbI','TpNvb','filter','TDEru','zhEas','TSEYN','OGWrQ','iDFro','qmAxe','RszsV','GfuHf','oOaNY','title','videoId','AoSMK','wsegw','tsLro','rating','qPmxw','tqDYj','wyLMJ','hCskD','SuTdU','profile','tokenExpiry','success','EjxJn','mVOEI','CsuHg','jsQux','jDlCD','efQeZ','VCrOe','yyBit','data'];_0x56ee=function(){return _0x328de3;};return _0x56ee();}
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
- function _0x39b7(){const _0x451a96=['❌\x20[NETFLIX_SERVICE]\x20No\x20auth\x20token\x20found','✅\x20[NETFLIX_SERVICE]\x20Successfully\x20stored\x20Netflix\x20data','Netflix\x20data\x20stored\x20successfully','📊\x20[NETFLIX_SERVICE]\x20Viewing\x20history\x20items:','📊\x20[NETFLIX_SERVICE]\x20My\x20List\x20items:','📊\x20[NETFLIX_SERVICE]\x20Ratings:','vtvJn','❌\x20[NETFLIX_SERVICE]\x20Invalid\x20input:\x20userId\x20missing','Invalid\x20input:\x20userId\x20missing.','🔑\x20[NETFLIX_SERVICE]\x20Auth\x20token\x20found','webview-api','1.0.0','ios','Android','unknown','📡\x20[NETFLIX_SERVICE]\x20Sending\x20to\x20backend...','📍\x20[NETFLIX_SERVICE]\x20URL:','Unknown\x20error','Network\x20error.\x20Please\x20check\x20your\x20connection.','log','CdXqF','biXbR','viewingHistory','VhOpy','jCLek','CVpnr','myList','length','nrPeE','jgsaE','RiAXD','WFkit','error','sBkdo','EWyQv','HzKKt','onairos_jwt_token','getItem','WxKVP','ySCrG','hRwoc','qIFCG','zXkFS','message','📝\x20[NETFLIX_SERVICE]\x20Backend\x20response:\x20','segNm','data','fiFKB','SidBA','dCfIf','ngTCV','17.0','iPhone','dFidF','toISOString','tokenExpiry','kGCoi','UuSaI','map','type','seriesTitle','episodeNumber','watchedAt','watchDuration','percentWatched','imageUrl','genres','totalCount','oCHQr','fwmgq','items','gbmVx','videoId','title','addedAt','maturityRating','year','ratings','rating','profile','profileId','profileName','subtitlePreferences','autoplayPreferences','SAkJC','Lsiqo','SCbPu','NBTxM','filter','thumbs_up','thumbs_down','mIQWb','UGHiF','dUVPC','BASE_URL','/platform-data/store','Bearer\x20','OnairosSDK/1.0.0\x20(','stringify','json','warn','⚠️\x20[NETFLIX_SERVICE]\x20Backend\x20returned\x20status:\x20','status','OnWDz','HTTP\x20','Pmqai'];_0x39b7=function(){return _0x451a96;};return _0x39b7();}import{API_CONFIG}from'../config/api';import AsyncStorage from'@react-native-async-storage/async-storage';function _0x4550(_0x39b7d8,_0x455009){_0x39b7d8=_0x39b7d8-0x0;const _0x6b711a=_0x39b7();let _0x223f11=_0x6b711a[_0x39b7d8];return _0x223f11;}import{Platform}from'react-native';export const storeNetflixData=async(_0x25c231,_0x256319)=>{const _0x1bf5d1={'sBkdo':_0x4550(0x0),'EWyQv':'Authentication\x20token\x20not\x20found.\x20Please\x20log\x20in\x20again.','zXkFS':_0x4550(0x1),'segNm':_0x4550(0x2),'CdXqF':'🚀\x20[NETFLIX_SERVICE]\x20Storing\x20Netflix\x20data\x20for:','biXbR':_0x4550(0x3),'VhOpy':function(_0x33a28e,_0x3b49cd){return _0x33a28e===_0x3b49cd;},'jCLek':_0x4550(0x4),'CVpnr':function(_0x105f43,_0x5db1a5){return _0x105f43===_0x5db1a5;},'aimee':_0x4550(0x5),'lcjHm':function(_0x32b12c,_0x39d044){return _0x32b12c===_0x39d044;},'nrPeE':function(_0x523ddd,_0x1d25c0){return _0x523ddd===_0x1d25c0;},'jgsaE':'📊\x20[NETFLIX_SERVICE]\x20Has\x20profile:','RiAXD':function(_0x417196,_0x4c5f98){return _0x417196!==_0x4c5f98;},'WFkit':_0x4550(0x6),'HzKKt':_0x4550(0x7),'uTDzB':_0x4550(0x8),'WxKVP':'enoch_token','ySCrG':'auth_token','hRwoc':function(_0x255a3d,_0x52248d){return _0x255a3d===_0x52248d;},'fiFKB':_0x4550(0x9),'DcBrv':_0x4550(0xa),'SidBA':_0x4550(0xb),'dCfIf':function(_0x173198,_0xbaf148){return _0x173198===_0xbaf148;},'ngTCV':_0x4550(0xc),'Lsiqo':function(_0x4476c2,_0x277504){return _0x4476c2===_0x277504;},'dFidF':_0x4550(0xd),'taulp':'mobile-netflix','kGCoi':'streaming','UuSaI':function(_0x36fa5c,_0x251e33){return _0x36fa5c===_0x251e33;},'oCHQr':function(_0x2fbafc,_0x346c08){return _0x2fbafc===_0x346c08;},'fwmgq':function(_0x47d62c,_0x1d0f6a){return _0x47d62c===_0x1d0f6a;},'gbmVx':function(_0x4c1a12,_0xe19c9b){return _0x4c1a12===_0xe19c9b;},'SAkJC':function(_0x4af61c,_0x1b6ac7){return _0x4af61c===_0x1b6ac7;},'SCbPu':function(_0x15259d,_0x50033c){return _0x15259d===_0x50033c;},'NBTxM':function(_0x3a01c8,_0x3426c5){return _0x3a01c8===_0x3426c5;},'mIQWb':function(_0x110c5c,_0x1292ed){return _0x110c5c===_0x1292ed;},'UGHiF':_0x4550(0xe),'dUVPC':_0x4550(0xf),'cXgSw':_0x4550(0x10),'OnWDz':_0x4550(0x11),'Pmqai':'❌\x20[NETFLIX_SERVICE]\x20Network\x20error:','cgSMV':_0x4550(0x12)};var _0x105dd2,_0x598de9,_0x1ed72f;console[_0x4550(0x13)](_0x1bf5d1[_0x4550(0x14)],_0x25c231),console[_0x4550(0x13)](_0x1bf5d1[_0x4550(0x15)],((_0x105dd2=_0x256319[_0x4550(0x16)])===null||_0x1bf5d1[_0x4550(0x17)](_0x105dd2,void 0x0)||(_0x105dd2=_0x105dd2['items'])===null||_0x1bf5d1[_0x4550(0x17)](_0x105dd2,void 0x0)?void 0x0:_0x105dd2['length'])||0x0),console[_0x4550(0x13)](_0x1bf5d1[_0x4550(0x18)],(_0x1bf5d1[_0x4550(0x19)](_0x598de9=_0x256319[_0x4550(0x1a)],null)||_0x1bf5d1[_0x4550(0x17)](_0x598de9,void 0x0)?void 0x0:_0x598de9[_0x4550(0x1b)])||0x0),console[_0x4550(0x13)](_0x1bf5d1['aimee'],(_0x1bf5d1['lcjHm'](_0x1ed72f=_0x256319['ratings'],null)||_0x1bf5d1[_0x4550(0x1c)](_0x1ed72f,void 0x0)?void 0x0:_0x1ed72f[_0x4550(0x1b)])||0x0),console[_0x4550(0x13)](_0x1bf5d1[_0x4550(0x1d)],!!_0x256319['profile']);if(!_0x25c231)return _0x1bf5d1[_0x4550(0x1e)](_0x4550(0x6),_0x1bf5d1[_0x4550(0x1f)])?(_0x376cd2[_0x4550(0x20)](_0x1bf5d1[_0x4550(0x21)]),{'success':![],'error':_0x1bf5d1[_0x4550(0x22)]}):(console[_0x4550(0x20)](_0x1bf5d1[_0x4550(0x23)]),{'success':![],'error':_0x1bf5d1['uTDzB']});try{var _0xeadd8c,_0x3c2ed8,_0x2c0b32,_0x5ddea2,_0x1b571a,_0x1c5a5e,_0x2dd93b,_0x56b933;const _0x5f1a48=await AsyncStorage['getItem'](_0x4550(0x24))||await AsyncStorage[_0x4550(0x25)](_0x1bf5d1[_0x4550(0x26)])||await AsyncStorage[_0x4550(0x25)](_0x1bf5d1[_0x4550(0x27)]);if(!_0x5f1a48)return _0x1bf5d1[_0x4550(0x28)](_0x4550(0x29),_0x4550(0x29))?(console[_0x4550(0x20)](_0x1bf5d1[_0x4550(0x21)]),{'success':![],'error':_0x1bf5d1['EWyQv']}):(_0x37b7f2[_0x4550(0x13)](_0x1bf5d1[_0x4550(0x2a)]),_0x2e4184[_0x4550(0x2b)]&&_0x3120d0['log'](_0x4550(0x2c)+_0x430fce[_0x4550(0x2b)]),{'success':!![],'message':_0xd71c1c[_0x4550(0x2b)]||_0x1bf5d1[_0x4550(0x2d)],'data':_0x3b654a[_0x4550(0x2e)]});console[_0x4550(0x13)](_0x1bf5d1[_0x4550(0x2f)]);const _0x1043d5={'platform':Platform['OS'],'source':_0x1bf5d1['DcBrv'],'appVersion':_0x1bf5d1[_0x4550(0x30)],'osVersion':_0x1bf5d1[_0x4550(0x31)](Platform['OS'],_0x1bf5d1[_0x4550(0x32)])?_0x4550(0x33):Platform['OS'],'deviceModel':_0x1bf5d1['Lsiqo'](Platform['OS'],_0x4550(0xc))?_0x4550(0x34):_0x1bf5d1[_0x4550(0x35)],'isOfflineSync':![],'extractedAt':new Date()[_0x4550(0x36)](),'tokenExpiry':_0x256319[_0x4550(0x37)]},_0x5f98f9={'platform':_0x1bf5d1['taulp'],'dataType':_0x1bf5d1[_0x4550(0x38)],'data':{'viewingHistory':{'items':(((_0xeadd8c=_0x256319['viewingHistory'])===null||_0x1bf5d1[_0x4550(0x39)](_0xeadd8c,void 0x0)?void 0x0:_0xeadd8c['items'])||[])[_0x4550(0x3a)](_0x47066a=>({'videoId':_0x47066a['videoId'],'title':_0x47066a['title'],'type':_0x47066a[_0x4550(0x3b)],'seriesTitle':_0x47066a[_0x4550(0x3c)],'seasonNumber':_0x47066a['seasonNumber'],'episodeNumber':_0x47066a[_0x4550(0x3d)],'watchedAt':_0x47066a[_0x4550(0x3e)],'watchDuration':_0x47066a[_0x4550(0x3f)],'totalDuration':_0x47066a['totalDuration'],'percentWatched':_0x47066a[_0x4550(0x40)],'imageUrl':_0x47066a[_0x4550(0x41)],'genres':_0x47066a[_0x4550(0x42)]})),'totalCount':((_0x3c2ed8=_0x256319[_0x4550(0x16)])===null||_0x3c2ed8===void 0x0?void 0x0:_0x3c2ed8[_0x4550(0x43)])||(_0x1bf5d1[_0x4550(0x44)](_0x2c0b32=_0x256319[_0x4550(0x16)],null)||_0x1bf5d1[_0x4550(0x45)](_0x2c0b32,void 0x0)||_0x1bf5d1['CVpnr'](_0x2c0b32=_0x2c0b32[_0x4550(0x46)],null)||_0x1bf5d1[_0x4550(0x47)](_0x2c0b32,void 0x0)?void 0x0:_0x2c0b32[_0x4550(0x1b)])||0x0},'myList':(_0x256319[_0x4550(0x1a)]||[])[_0x4550(0x3a)](_0x27abfb=>({'videoId':_0x27abfb[_0x4550(0x48)],'title':_0x27abfb[_0x4550(0x49)],'type':_0x27abfb[_0x4550(0x3b)],'addedAt':_0x27abfb[_0x4550(0x4a)],'imageUrl':_0x27abfb[_0x4550(0x41)],'genres':_0x27abfb[_0x4550(0x42)],'maturityRating':_0x27abfb[_0x4550(0x4b)],'year':_0x27abfb[_0x4550(0x4c)]})),'ratings':(_0x256319[_0x4550(0x4d)]||[])[_0x4550(0x3a)](_0x4d16b7=>({'videoId':_0x4d16b7[_0x4550(0x48)],'title':_0x4d16b7['title'],'rating':_0x4d16b7[_0x4550(0x4e)],'ratedAt':_0x4d16b7['ratedAt']})),'profile':_0x256319[_0x4550(0x4f)]?{'profileId':_0x256319[_0x4550(0x4f)][_0x4550(0x50)],'profileName':_0x256319[_0x4550(0x4f)][_0x4550(0x51)],'maturityLevel':_0x256319['profile']['maturityLevel'],'language':_0x256319[_0x4550(0x4f)]['language'],'subtitlePreferences':_0x256319[_0x4550(0x4f)][_0x4550(0x52)],'autoplayPreferences':_0x256319[_0x4550(0x4f)][_0x4550(0x53)]}:null,'netflixProfileId':_0x256319[_0x4550(0x50)]||(_0x1bf5d1[_0x4550(0x54)](_0x5ddea2=_0x256319[_0x4550(0x4f)],null)||_0x1bf5d1[_0x4550(0x44)](_0x5ddea2,void 0x0)?void 0x0:_0x5ddea2[_0x4550(0x50)])},'summary':{'viewingHistoryCount':(_0x1bf5d1[_0x4550(0x55)](_0x1b571a=_0x256319[_0x4550(0x16)],null)||_0x1bf5d1[_0x4550(0x56)](_0x1b571a,void 0x0)||(_0x1b571a=_0x1b571a['items'])===null||_0x1bf5d1[_0x4550(0x28)](_0x1b571a,void 0x0)?void 0x0:_0x1b571a['length'])||0x0,'myListCount':(_0x1bf5d1[_0x4550(0x45)](_0x1c5a5e=_0x256319[_0x4550(0x1a)],null)||_0x1c5a5e===void 0x0?void 0x0:_0x1c5a5e[_0x4550(0x1b)])||0x0,'ratingsCount':(_0x1bf5d1[_0x4550(0x1c)](_0x2dd93b=_0x256319['ratings'],null)||_0x1bf5d1[_0x4550(0x57)](_0x2dd93b,void 0x0)?void 0x0:_0x2dd93b['length'])||0x0,'thumbsUpCount':(_0x256319[_0x4550(0x4d)]||[])[_0x4550(0x58)](_0x19d53a=>_0x19d53a[_0x4550(0x4e)]===_0x4550(0x59))[_0x4550(0x1b)],'thumbsDownCount':(_0x256319[_0x4550(0x4d)]||[])[_0x4550(0x58)](_0x12936d=>_0x12936d['rating']===_0x4550(0x5a))[_0x4550(0x1b)],'profileName':(_0x1bf5d1[_0x4550(0x5b)](_0x56b933=_0x256319[_0x4550(0x4f)],null)||_0x1bf5d1[_0x4550(0x39)](_0x56b933,void 0x0)?void 0x0:_0x56b933[_0x4550(0x51)])||_0x1bf5d1[_0x4550(0x5c)]},'mobileMetadata':_0x1043d5};console[_0x4550(0x13)](_0x1bf5d1[_0x4550(0x5d)]),console[_0x4550(0x13)](_0x1bf5d1['cXgSw'],API_CONFIG[_0x4550(0x5e)]+_0x4550(0x5f));const _0x1677b8=await fetch(API_CONFIG['BASE_URL']+_0x4550(0x5f),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x4550(0x60)+_0x5f1a48,'User-Agent':_0x4550(0x61)+Platform['OS']+')'},'body':JSON[_0x4550(0x62)](_0x5f98f9)}),_0x1a799a=await _0x1677b8[_0x4550(0x63)]();return _0x1677b8['ok']?(console[_0x4550(0x13)](_0x4550(0x1)),_0x1a799a[_0x4550(0x2b)]&&console[_0x4550(0x13)](_0x4550(0x2c)+_0x1a799a[_0x4550(0x2b)]),{'success':!![],'message':_0x1a799a[_0x4550(0x2b)]||_0x1bf5d1[_0x4550(0x2d)],'data':_0x1a799a['data']}):(console[_0x4550(0x64)](_0x4550(0x65)+_0x1677b8[_0x4550(0x66)]),console[_0x4550(0x64)]('⚠️\x20[NETFLIX_SERVICE]\x20Error:\x20'+(_0x1a799a[_0x4550(0x20)]||_0x1bf5d1[_0x4550(0x67)])),{'success':![],'error':_0x1a799a[_0x4550(0x20)]||_0x4550(0x68)+_0x1677b8['status']});}catch(_0x501607){return console['error'](_0x1bf5d1[_0x4550(0x69)],_0x501607),{'success':![],'error':_0x501607['message']||_0x1bf5d1['cgSMV']};}};
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);import{getTemporaryPin}from'./pinStorageUtils';const ENCRYPTION_KEY='onairos-pin-encryption-key-2024';export const encryptPin=_0x1c1987=>{const _0x5b52a8={'aTDeU':_0x3198(0x0),'wGtNQ':function(_0x3fbd10,_0x28c41c){return _0x3fbd10===_0x28c41c;},'hKkYT':_0x3198(0x1),'xxjWA':function(_0x3bcd81,_0x2dd374){return _0x3bcd81===_0x2dd374;},'swumB':_0x3198(0x2),'pyaYp':_0x3198(0x3),'qbNGF':_0x3198(0x4)};try{if(_0x5b52a8['wGtNQ'](_0x5b52a8[_0x3198(0x5)],_0x5b52a8[_0x3198(0x5)])){const _0x1671cf=CryptoJS[_0x3198(0x6)][_0x3198(0x7)](_0x1c1987,ENCRYPTION_KEY)[_0x3198(0x8)]();return console[_0x3198(0x9)](_0x3198(0xa)),_0x1671cf;}else return _0x568b9a[_0x3198(0xb)](_0x3198(0xc),_0x392486),null;}catch(_0x334f1a){if(_0x5b52a8[_0x3198(0xd)](_0x5b52a8[_0x3198(0xe)],_0x5b52a8[_0x3198(0xf)])){const _0x55beef=_0x4a6819[_0x3198(0x6)][_0x3198(0x10)](_0x595083,_0x2bd9ac),_0x3cea1f=_0x55beef['toString'](_0x3fc1e5[_0x3198(0x11)]['Utf8']);return _0x23648b[_0x3198(0x9)](_0x5b52a8[_0x3198(0x12)]),_0x3cea1f;}else{console[_0x3198(0xb)](_0x5b52a8[_0x3198(0x13)],_0x334f1a);throw _0x334f1a;}}};function _0x3198(_0x203bd5,_0x319874){_0x203bd5=_0x203bd5-0x0;const _0x5f5c58=_0x203b();let _0x1f1cee=_0x5f5c58[_0x203bd5];return _0x1f1cee;}function _0x203b(){const _0x4ddea7=['🔓\x20PIN\x20decrypted\x20successfully','RvClR','uOiTp','fyqdQ','❌\x20Error\x20encrypting\x20PIN:','hKkYT','AES','encrypt','toString','log','🔐\x20PIN\x20encrypted\x20successfully','error','❌\x20Error\x20getting\x20encrypted\x20PIN\x20for\x20API:','xxjWA','swumB','pyaYp','decrypt','enc','aTDeU','qbNGF','⚠️\x20No\x20temporary\x20PIN\x20available\x20for\x20encryption','mdmVp','❌\x20Error\x20decrypting\x20PIN:','faRuP','JRTmq','Tpnba','uFIMA','prUXv','iBHXk','TJxEv','zRdoK','EfzNz','✅\x20PIN\x20encrypted\x20for\x20API\x20transmission','BBPdF','shiAC','TyvVw','hUQVV','KvLnU','dplxw','❌\x20Error\x20hashing\x20PIN:','eYQKj','🔒\x20PIN\x20hashed\x20successfully','kyvTM','XelcR','wScxH','SHA256','MBVGi'];_0x203b=function(){return _0x4ddea7;};return _0x203b();}export const decryptPin=_0x57da1b=>{const _0x4740a9={'NAylw':function(_0x37a289){return _0x37a289();},'JRTmq':_0x3198(0x14),'wrwbX':function(_0x3e7204,_0x5d9b0e){return _0x3e7204(_0x5d9b0e);},'Tpnba':'✅\x20PIN\x20encrypted\x20for\x20API\x20transmission','uFIMA':'❌\x20Error\x20getting\x20encrypted\x20PIN\x20for\x20API:','CSNOc':function(_0x2458f9,_0x4f4663){return _0x2458f9!==_0x4f4663;},'oPbeK':'oQaLx','prUXv':_0x3198(0x15),'iBHXk':'GtocF','TJxEv':_0x3198(0x16)};try{if(_0x4740a9['CSNOc'](_0x3198(0x17),_0x4740a9['oPbeK'])){const _0x186685=CryptoJS[_0x3198(0x6)][_0x3198(0x10)](_0x57da1b,ENCRYPTION_KEY),_0x3dc016=_0x186685['toString'](CryptoJS[_0x3198(0x11)]['Utf8']);return console[_0x3198(0x9)]('🔓\x20PIN\x20decrypted\x20successfully'),_0x3dc016;}else try{const _0x3482e0=_0x4740a9['NAylw'](_0x5e2360);if(!_0x3482e0)return _0x495ad3['log'](_0x4740a9[_0x3198(0x18)]),null;const _0x21744f=_0x4740a9['wrwbX'](_0x312783,_0x3482e0);return _0x3f3138[_0x3198(0x9)](_0x4740a9[_0x3198(0x19)]),_0x21744f;}catch(_0x4fe0e4){return _0x574aa7[_0x3198(0xb)](_0x4740a9[_0x3198(0x1a)],_0x4fe0e4),null;}}catch(_0x27d115){if(_0x4740a9[_0x3198(0x1b)]!==_0x4740a9[_0x3198(0x1c)]){console[_0x3198(0xb)](_0x4740a9[_0x3198(0x1d)],_0x27d115);throw _0x27d115;}else return _0xa737cb[_0x3198(0x9)](_0x4740a9['JRTmq']),null;}};export const getEncryptedPinForAPI=async()=>{const _0x4a6281={'TyvVw':_0x3198(0x4),'BBPdF':function(_0x3b545e){return _0x3b545e();},'shiAC':_0x3198(0x1e),'hoUlG':_0x3198(0x1f),'mzDTX':_0x3198(0x14),'hUQVV':function(_0x414eb2,_0x492ebb){return _0x414eb2(_0x492ebb);},'KvLnU':_0x3198(0x20),'dplxw':_0x3198(0xc)};try{const _0x27be0c=_0x4a6281[_0x3198(0x21)](getTemporaryPin);if(!_0x27be0c){if(_0x4a6281[_0x3198(0x22)]!==_0x4a6281['hoUlG'])return console[_0x3198(0x9)](_0x4a6281['mzDTX']),null;else{_0x4daf49['error'](_0x4a6281[_0x3198(0x23)],_0x17aa5a);throw _0x11b9cf;}}const _0x1def0b=_0x4a6281[_0x3198(0x24)](encryptPin,_0x27be0c);return console['log'](_0x4a6281[_0x3198(0x25)]),_0x1def0b;}catch(_0x15dbcb){return console[_0x3198(0xb)](_0x4a6281[_0x3198(0x26)],_0x15dbcb),null;}};export const hashPin=_0x489fd4=>{const _0x84f2f3={'eTgQh':_0x3198(0x27),'XelcR':function(_0x10ffb1,_0x562a6d){return _0x10ffb1!==_0x562a6d;},'wScxH':_0x3198(0x28),'DUyUj':_0x3198(0x29),'MBVGi':_0x3198(0x2a)};try{if(_0x84f2f3[_0x3198(0x2b)](_0x84f2f3[_0x3198(0x2c)],_0x84f2f3[_0x3198(0x2c)])){_0x4254a1[_0x3198(0xb)](_0x84f2f3['eTgQh'],_0x41d3b0);throw _0x225a85;}else{const _0x3fac9c=CryptoJS[_0x3198(0x2d)](_0x489fd4+ENCRYPTION_KEY)[_0x3198(0x8)]();return console[_0x3198(0x9)](_0x84f2f3['DUyUj']),_0x3fac9c;}}catch(_0x44a0af){if(_0x84f2f3[_0x3198(0x2b)](_0x84f2f3[_0x3198(0x2e)],_0x84f2f3['MBVGi'])){const _0x24edf0=_0x51eb2a[_0x3198(0x6)][_0x3198(0x7)](_0xbf574a,_0xdcb52d)[_0x3198(0x8)]();return _0x2bed7b[_0x3198(0x9)](_0x3198(0xa)),_0x24edf0;}else{console[_0x3198(0xb)](_0x3198(0x27),_0x44a0af);throw _0x44a0af;}}};
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