@onairos/react-native 3.7.1 → 3.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/lib/commonjs/api/index.js +219 -9
  2. package/lib/commonjs/assets/icons/spotify.png +0 -0
  3. package/lib/commonjs/assets/images/spotify.png +0 -0
  4. package/lib/commonjs/components/BodyText.js +27 -9
  5. package/lib/commonjs/components/BrandMark.js +111 -10
  6. package/lib/commonjs/components/CodeInput.js +116 -9
  7. package/lib/commonjs/components/EmailInput.js +30 -8
  8. package/lib/commonjs/components/GoogleButton.js +56 -9
  9. package/lib/commonjs/components/HeadingGroup.js +43 -9
  10. package/lib/commonjs/components/LLMDataInputModal.js +664 -14
  11. package/lib/commonjs/components/ModalHeader.js +99 -9
  12. package/lib/commonjs/components/ModalSheet.js +47 -9
  13. package/lib/commonjs/components/Onairos.js +380 -14
  14. package/lib/commonjs/components/OnairosButton.js +313 -13
  15. package/lib/commonjs/components/OnairosSignInButton.js +130 -12
  16. package/lib/commonjs/components/Overlay.js +465 -13
  17. package/lib/commonjs/components/PersonaImage.js +137 -10
  18. package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
  19. package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
  20. package/lib/commonjs/components/PinCreationScreen.js +403 -12
  21. package/lib/commonjs/components/PinInput.js +464 -9
  22. package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
  23. package/lib/commonjs/components/PlatformList.js +137 -10
  24. package/lib/commonjs/components/PlatformToggle.js +180 -9
  25. package/lib/commonjs/components/PrimaryButton.js +180 -10
  26. package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
  27. package/lib/commonjs/components/SignInStep.js +345 -12
  28. package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
  29. package/lib/commonjs/components/VerificationStep.js +176 -11
  30. package/lib/commonjs/components/WelcomeScreen.js +461 -22
  31. package/lib/commonjs/components/icons/Basicproficon.js +37 -8
  32. package/lib/commonjs/components/icons/Basicprofile.js +21 -8
  33. package/lib/commonjs/components/icons/Checkbox.js +21 -8
  34. package/lib/commonjs/components/icons/Checkmark.js +27 -8
  35. package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
  36. package/lib/commonjs/components/icons/Contenticon.js +39 -8
  37. package/lib/commonjs/components/icons/EnochE.js +41 -8
  38. package/lib/commonjs/components/icons/Personalityicon.js +30 -8
  39. package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
  40. package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
  41. package/lib/commonjs/components/icons/Userpreferences.js +21 -8
  42. package/lib/commonjs/components/icons/index.js +84 -17
  43. package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
  44. package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
  45. package/lib/commonjs/components/onboarding/PinInput.js +283 -10
  46. package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
  47. package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
  48. package/lib/commonjs/config/api.js +56 -7
  49. package/lib/commonjs/constants/index.js +120 -7
  50. package/lib/commonjs/context/AuthContext.js +345 -10
  51. package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
  52. package/lib/commonjs/hooks/useConnections.js +102 -8
  53. package/lib/commonjs/hooks/useCredentials.js +178 -10
  54. package/lib/commonjs/hooks/useUserConnections.js +148 -10
  55. package/lib/commonjs/index.js +439 -34
  56. package/lib/commonjs/services/apiClient.js +298 -8
  57. package/lib/commonjs/services/biometricPinService.js +180 -8
  58. package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
  59. package/lib/commonjs/services/chatGPTConversationService.js +275 -9
  60. package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
  61. package/lib/commonjs/services/claudeConversationService.js +158 -9
  62. package/lib/commonjs/services/connectedAccountsService.js +310 -10
  63. package/lib/commonjs/services/googleAuthService.js +252 -11
  64. package/lib/commonjs/services/hingeDataExtractor.js +105 -8
  65. package/lib/commonjs/services/hingeDataService.js +150 -9
  66. package/lib/commonjs/services/imageCompressionService.js +260 -7
  67. package/lib/commonjs/services/instagramDataExtractor.js +126 -8
  68. package/lib/commonjs/services/instagramDataService.js +163 -9
  69. package/lib/commonjs/services/jwtStorageService.js +276 -7
  70. package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
  71. package/lib/commonjs/services/linkedinProfileService.js +222 -9
  72. package/lib/commonjs/services/linkedinScrapingService.js +230 -8
  73. package/lib/commonjs/services/llmDataStorage.js +294 -8
  74. package/lib/commonjs/services/mobileTrainingService.js +186 -8
  75. package/lib/commonjs/services/netflixDataExtractor.js +120 -8
  76. package/lib/commonjs/services/netflixDataService.js +198 -9
  77. package/lib/commonjs/services/pinEncryptionService.js +84 -8
  78. package/lib/commonjs/services/pinStorageUtils.js +105 -7
  79. package/lib/commonjs/services/platformAuthService.js +1484 -12
  80. package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
  81. package/lib/commonjs/services/sephoraDataService.js +200 -9
  82. package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
  83. package/lib/commonjs/services/spotifyDataService.js +241 -9
  84. package/lib/commonjs/services/storageService.js +404 -8
  85. package/lib/commonjs/services/telegramDataExtractor.js +115 -8
  86. package/lib/commonjs/services/telegramDataService.js +499 -9
  87. package/lib/commonjs/services/trainingApiHelpers.js +73 -7
  88. package/lib/commonjs/services/userConnectionsService.js +340 -10
  89. package/lib/commonjs/services/youtubeMigrationService.js +416 -10
  90. package/lib/commonjs/theme/index.js +250 -7
  91. package/lib/commonjs/types/ambient.d.js +2 -1
  92. package/lib/commonjs/types/declarations.d.js +2 -1
  93. package/lib/commonjs/types/index.js +6 -1
  94. package/lib/commonjs/types/node-fix.d.js +2 -1
  95. package/lib/commonjs/types/node-override.d.js +2 -1
  96. package/lib/commonjs/types/opacity.d.js +2 -1
  97. package/lib/commonjs/types.js +14 -1
  98. package/lib/commonjs/utils/Portal.js +98 -8
  99. package/lib/commonjs/utils/api.js +130 -9
  100. package/lib/commonjs/utils/assetRegistry.js +210 -35
  101. package/lib/commonjs/utils/auth.js +112 -9
  102. package/lib/commonjs/utils/connectorTests.js +613 -29
  103. package/lib/commonjs/utils/crypto.js +62 -8
  104. package/lib/commonjs/utils/debugHelper.js +64 -1
  105. package/lib/commonjs/utils/encryption.js +76 -7
  106. package/lib/commonjs/utils/eventUtils.js +288 -1
  107. package/lib/commonjs/utils/haptics.js +66 -9
  108. package/lib/commonjs/utils/imagePreloader.js +6 -1
  109. package/lib/commonjs/utils/networkDiagnostics.js +226 -8
  110. package/lib/commonjs/utils/onairosApi.js +350 -9
  111. package/lib/commonjs/utils/programmaticFlow.js +117 -9
  112. package/lib/commonjs/utils/retryHelper.js +220 -1
  113. package/lib/commonjs/utils/secureStorage.js +349 -10
  114. package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
  115. package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
  116. package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
  117. package/lib/commonjs/utils/webviewScripts/index.js +698 -15
  118. package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
  119. package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
  120. package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
  121. package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
  122. package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
  123. package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
  124. package/lib/module/api/index.js +211 -1
  125. package/lib/module/assets/icons/spotify.png +0 -0
  126. package/lib/module/assets/images/spotify.png +0 -0
  127. package/lib/module/components/BodyText.js +20 -1
  128. package/lib/module/components/BrandMark.js +104 -1
  129. package/lib/module/components/CodeInput.js +109 -1
  130. package/lib/module/components/EmailInput.js +23 -1
  131. package/lib/module/components/GoogleButton.js +49 -1
  132. package/lib/module/components/HeadingGroup.js +36 -1
  133. package/lib/module/components/LLMDataInputModal.js +656 -7
  134. package/lib/module/components/ModalHeader.js +92 -1
  135. package/lib/module/components/ModalSheet.js +39 -1
  136. package/lib/module/components/Onairos.js +373 -1
  137. package/lib/module/components/OnairosButton.js +305 -1
  138. package/lib/module/components/OnairosSignInButton.js +121 -1
  139. package/lib/module/components/Overlay.js +456 -1
  140. package/lib/module/components/PersonaImage.js +129 -1
  141. package/lib/module/components/PersonaLoadingScreen.js +310 -1
  142. package/lib/module/components/PersonalizationConsentScreen.js +460 -1
  143. package/lib/module/components/PinCreationScreen.js +396 -1
  144. package/lib/module/components/PinInput.js +456 -1
  145. package/lib/module/components/PlatformConnectorsStep.js +1302 -6
  146. package/lib/module/components/PlatformList.js +129 -1
  147. package/lib/module/components/PlatformToggle.js +173 -1
  148. package/lib/module/components/PrimaryButton.js +172 -1
  149. package/lib/module/components/SignInMatchAnimation.js +189 -1
  150. package/lib/module/components/SignInStep.js +338 -1
  151. package/lib/module/components/UniversalOnboarding.js +2770 -1
  152. package/lib/module/components/VerificationStep.js +168 -1
  153. package/lib/module/components/WelcomeScreen.js +453 -1
  154. package/lib/module/components/icons/Basicproficon.js +30 -1
  155. package/lib/module/components/icons/Basicprofile.js +14 -1
  156. package/lib/module/components/icons/Checkbox.js +14 -1
  157. package/lib/module/components/icons/Checkmark.js +20 -1
  158. package/lib/module/components/icons/Contentanalysis.js +14 -1
  159. package/lib/module/components/icons/Contenticon.js +32 -1
  160. package/lib/module/components/icons/EnochE.js +34 -1
  161. package/lib/module/components/icons/Personalityicon.js +23 -1
  162. package/lib/module/components/icons/Personalityprofile.js +14 -1
  163. package/lib/module/components/icons/Personalitytraits.js +14 -1
  164. package/lib/module/components/icons/Userpreferences.js +14 -1
  165. package/lib/module/components/icons/index.js +13 -1
  166. package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
  167. package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
  168. package/lib/module/components/onboarding/PinInput.js +274 -1
  169. package/lib/module/components/onboarding/PlatformConnector.js +240 -1
  170. package/lib/module/config/PLATFORM_APIS.md +849 -0
  171. package/lib/module/config/api.js +47 -1
  172. package/lib/module/constants/index.js +114 -1
  173. package/lib/module/context/AuthContext.js +335 -1
  174. package/lib/module/hooks/useConnectedAccounts.js +106 -1
  175. package/lib/module/hooks/useConnections.js +95 -1
  176. package/lib/module/hooks/useCredentials.js +171 -6
  177. package/lib/module/hooks/useUserConnections.js +140 -1
  178. package/lib/module/index.js +172 -1
  179. package/lib/module/services/apiClient.js +295 -1
  180. package/lib/module/services/biometricPinService.js +169 -1
  181. package/lib/module/services/chatGPTConversationExtractor.js +149 -1
  182. package/lib/module/services/chatGPTConversationService.js +268 -1
  183. package/lib/module/services/claudeConversationExtractor.js +97 -1
  184. package/lib/module/services/claudeConversationService.js +151 -1
  185. package/lib/module/services/connectedAccountsService.js +293 -1
  186. package/lib/module/services/googleAuthService.js +241 -1
  187. package/lib/module/services/hingeDataExtractor.js +99 -1
  188. package/lib/module/services/hingeDataService.js +143 -1
  189. package/lib/module/services/imageCompressionService.js +250 -1
  190. package/lib/module/services/instagramDataExtractor.js +120 -1
  191. package/lib/module/services/instagramDataService.js +156 -1
  192. package/lib/module/services/jwtStorageService.js +257 -1
  193. package/lib/module/services/linkedinDOMExtractor.js +234 -1
  194. package/lib/module/services/linkedinProfileService.js +210 -1
  195. package/lib/module/services/linkedinScrapingService.js +219 -1
  196. package/lib/module/services/llmDataStorage.js +277 -1
  197. package/lib/module/services/mobileTrainingService.js +173 -1
  198. package/lib/module/services/netflixDataExtractor.js +114 -1
  199. package/lib/module/services/netflixDataService.js +191 -1
  200. package/lib/module/services/pinEncryptionService.js +74 -6
  201. package/lib/module/services/pinStorageUtils.js +93 -1
  202. package/lib/module/services/platformAuthService.js +1461 -1
  203. package/lib/module/services/sephoraDataExtractor.js +134 -1
  204. package/lib/module/services/sephoraDataService.js +193 -1
  205. package/lib/module/services/spotifyDataExtractor.js +142 -1
  206. package/lib/module/services/spotifyDataService.js +234 -1
  207. package/lib/module/services/storageService.js +383 -1
  208. package/lib/module/services/telegramDataExtractor.js +109 -1
  209. package/lib/module/services/telegramDataService.js +493 -1
  210. package/lib/module/services/trainingApiHelpers.js +67 -1
  211. package/lib/module/services/userConnectionsService.js +329 -1
  212. package/lib/module/services/youtubeMigrationService.js +405 -1
  213. package/lib/module/theme/index.js +245 -1
  214. package/lib/module/types.js +10 -1
  215. package/lib/module/utils/Portal.js +90 -1
  216. package/lib/module/utils/api.js +118 -1
  217. package/lib/module/utils/assetRegistry.js +200 -34
  218. package/lib/module/utils/auth.js +100 -1
  219. package/lib/module/utils/connectorTests.js +600 -27
  220. package/lib/module/utils/crypto.js +54 -1
  221. package/lib/module/utils/debugHelper.js +54 -1
  222. package/lib/module/utils/encryption.js +67 -1
  223. package/lib/module/utils/eventUtils.js +270 -1
  224. package/lib/module/utils/haptics.js +59 -8
  225. package/lib/module/utils/imagePreloader.js +3 -1
  226. package/lib/module/utils/networkDiagnostics.js +217 -1
  227. package/lib/module/utils/onairosApi.js +333 -1
  228. package/lib/module/utils/programmaticFlow.js +111 -1
  229. package/lib/module/utils/retryHelper.js +211 -1
  230. package/lib/module/utils/secureStorage.js +330 -6
  231. package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
  232. package/lib/module/utils/webviewScripts/claude.js +370 -1
  233. package/lib/module/utils/webviewScripts/hinge.js +405 -1
  234. package/lib/module/utils/webviewScripts/index.js +434 -1
  235. package/lib/module/utils/webviewScripts/instagram.js +448 -1
  236. package/lib/module/utils/webviewScripts/linkedin.js +874 -1
  237. package/lib/module/utils/webviewScripts/netflix.js +376 -1
  238. package/lib/module/utils/webviewScripts/sephora.js +510 -1
  239. package/lib/module/utils/webviewScripts/spotify.js +413 -1
  240. package/lib/module/utils/webviewScripts/telegram.js +672 -1
  241. package/package.json +2 -2
@@ -1,8 +1,120 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("./netflixDataService"),
5
- require("react-native")
6
- ];
7
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
8
- function _0x122c(_0x4c78d5,_0x122c87){_0x4c78d5=_0x4c78d5-0x0;const _0x31ee89=_0x4c78();let _0x44dbdc=_0x31ee89[_0x4c78d5];return _0x44dbdc;}function _0x4c78(){const _0x3660b3=['defineProperty','⚠️\x20[NETFLIX_EXTRACTOR]\x20Invalid\x20viewing\x20history\x20item:','RuJOx','⚠️\x20[NETFLIX_EXTRACTOR]\x20Invalid\x20My\x20List\x20item:','jpvAo','jsJEg','⚠️\x20[NETFLIX_EXTRACTOR]\x20Invalid\x20rating:','Export\x20Failed','An\x20unknown\x20error\x20occurred\x20during\x20data\x20storage.','🚀\x20[NETFLIX_EXTRACTOR]\x20Initiating\x20data\x20export','👤\x20[NETFLIX_EXTRACTOR]\x20Username:','❌\x20[NETFLIX_EXTRACTOR]\x20Username\x20is\x20required','Error','ℹ️\x20[NETFLIX_EXTRACTOR]\x20No\x20data\x20to\x20export\x20-\x20treating\x20as\x20success\x20(connected)','📊\x20[NETFLIX_EXTRACTOR]\x20Backend\x20response:','QGGZj','hzRsq','❌\x20[NETFLIX_EXTRACTOR]\x20Unexpected\x20error\x20during\x20export:','DLbgH','YXCLi','WZdAy','gZMQv','log','qlOKz','tWDVf','📊\x20[NETFLIX_EXTRACTOR]\x20Summary:','summary','error','gqNcm','alert','nRCiw','WtjCh','default','hEfQp','viewingHistory','oxhVb','length','tlYja','ratings','vJZoL','gVzvc','YyVXY','ZvWOS','items','dbAjh','vfVyO','warn','videoId','title','thDMJ','myList','filter','PPphm','Ipdam','Alert','nlKGS','sUWSM','kJQsQ','FAusx','YoCwN','⚠️\x20[NETFLIX_EXTRACTOR]\x20Filtered\x20out\x20','rTjES','\x20invalid\x20items','eDtIq','giiKc','rswtQ','IvpDw','eXggD','SjfMh','✅\x20[NETFLIX_EXTRACTOR]\x20Export\x20completed\x20successfully','data','RnQSS','ZiwzA','storeNetflixData','profile','tokenExpiry','profileId','success','YBwhE','CPPbT','ECnCJ','yHqGw','dCDDV','IeMes','Export\x20Error','Lokbl','useNetflixDataExtractor'];_0x4c78=function(){return _0x3660b3;};return _0x4c78();}Object[_0x122c(0x0)](exports,'__esModule',{'value':!![]}),exports['useNetflixDataExtractor']=void 0x0;var _netflixDataService=__ONAIROS_REQ_FUNC__(0x0),_reactNative=__ONAIROS_REQ_FUNC__(0x1);const useNetflixDataExtractor=()=>{const _0x1efd42={'tlYja':function(_0x242195,_0x2a3031){return _0x242195===_0x2a3031;},'dbAjh':'NPWLF','thDMJ':_0x122c(0x1),'EupsK':function(_0x29c926,_0x42bae2){return _0x29c926!==_0x42bae2;},'PPphm':_0x122c(0x2),'FAusx':'FziFe','eDtIq':_0x122c(0x3),'YyVXY':function(_0x52d524,_0x56c10a){return _0x52d524===_0x56c10a;},'giiKc':_0x122c(0x4),'rswtQ':function(_0xb13988,_0x517845){return _0xb13988!==_0x517845;},'eXggD':_0x122c(0x5),'SjfMh':_0x122c(0x6),'DLbgH':'❌\x20[NETFLIX_EXTRACTOR]\x20Backend\x20storage\x20failed:','YXCLi':_0x122c(0x7),'ECnCJ':_0x122c(0x8),'WZdAy':'default','gZMQv':function(_0x6b2fdf,_0x4df6a4){return _0x6b2fdf-_0x4df6a4;},'qlOKz':_0x122c(0x9),'tWDVf':_0x122c(0xa),'gqNcm':_0x122c(0xb),'nRCiw':_0x122c(0xc),'WtjCh':'Username\x20is\x20required\x20to\x20export\x20Netflix\x20data.','hEfQp':function(_0x1db5ca,_0x5ab937){return _0x1db5ca+_0x5ab937;},'oxhVb':function(_0x1bb450,_0x3b4be6){return _0x1bb450===_0x3b4be6;},'vJZoL':function(_0x357550,_0x460a8a){return _0x357550===_0x460a8a;},'gVzvc':_0x122c(0xd),'ZvWOS':function(_0x359db6,_0x284a90){return _0x359db6===_0x284a90;},'emxMV':function(_0x5e183a,_0x3fa459){return _0x5e183a+_0x3fa459;},'RnQSS':function(_0x8f4665,_0x2cc188){return _0x8f4665<_0x2cc188;},'ZiwzA':function(_0x6f2fcd,_0x4c2837){return _0x6f2fcd-_0x4c2837;},'RCJDw':'📡\x20[NETFLIX_EXTRACTOR]\x20Sending\x20to\x20backend...','YBwhE':_0x122c(0xe),'CPPbT':'ZbzGs','yHqGw':_0x122c(0xf),'dCDDV':_0x122c(0x10),'IeMes':_0x122c(0x11),'Lokbl':'Failed\x20to\x20connect\x20to\x20the\x20data\x20storage\x20service.\x20Please\x20check\x20your\x20network\x20connection.'},_0xc238f0=async(_0x4c3a1e,_0x47a590)=>{const _0x120a75={'HCvJH':_0x1efd42['eDtIq'],'Ipdam':_0x1efd42[_0x122c(0x12)],'nlKGS':_0x1efd42[_0x122c(0x13)],'sUWSM':_0x1efd42['ECnCJ'],'kJQsQ':_0x1efd42[_0x122c(0x14)],'rTjES':function(_0x25b816,_0x1d0d85){return _0x1efd42[_0x122c(0x15)](_0x25b816,_0x1d0d85);}};var _0x2f4389,_0x1d995e,_0x368af6,_0x3c526e;console[_0x122c(0x16)](_0x1efd42[_0x122c(0x17)]),console['log'](_0x1efd42[_0x122c(0x18)],_0x4c3a1e),console[_0x122c(0x16)](_0x122c(0x19),_0x47a590[_0x122c(0x1a)]);if(!_0x4c3a1e)return console[_0x122c(0x1b)](_0x1efd42[_0x122c(0x1c)]),_reactNative['Alert'][_0x122c(0x1d)](_0x1efd42[_0x122c(0x1e)],_0x1efd42[_0x122c(0x1f)],[{'text':'OK','style':_0x122c(0x20)}]),![];const _0x2d26e2=_0x1efd42[_0x122c(0x21)]((((_0x2f4389=_0x47a590[_0x122c(0x22)])===null||_0x1efd42[_0x122c(0x23)](_0x2f4389,void 0x0)||_0x1efd42[_0x122c(0x23)](_0x2f4389=_0x2f4389['items'],null)||_0x2f4389===void 0x0?void 0x0:_0x2f4389[_0x122c(0x24)])||0x0)+(((_0x1d995e=_0x47a590['myList'])===null||_0x1d995e===void 0x0?void 0x0:_0x1d995e['length'])||0x0),(_0x1efd42[_0x122c(0x25)](_0x368af6=_0x47a590[_0x122c(0x26)],null)||_0x1efd42[_0x122c(0x27)](_0x368af6,void 0x0)?void 0x0:_0x368af6['length'])||0x0);if(_0x1efd42[_0x122c(0x23)](_0x2d26e2,0x0))return console['log'](_0x1efd42[_0x122c(0x28)]),!![];const _0xa03589=((_0x1efd42[_0x122c(0x29)](_0x3c526e=_0x47a590[_0x122c(0x22)],null)||_0x1efd42[_0x122c(0x2a)](_0x3c526e,void 0x0)?void 0x0:_0x3c526e[_0x122c(0x2b)])||[])['filter'](_0x46bded=>{if(_0x1efd42['tlYja'](_0x1efd42[_0x122c(0x2c)],_0x122c(0x2d)))_0x3b1a01[_0x122c(0x2e)](_0x120a75['HCvJH'],_0x2be506);else{const _0x1cd623=_0x46bded[_0x122c(0x2f)]&&_0x46bded[_0x122c(0x30)];return!_0x1cd623&&console[_0x122c(0x2e)](_0x1efd42[_0x122c(0x31)],_0x46bded),_0x1cd623;}}),_0xdb55ea=(_0x47a590[_0x122c(0x32)]||[])[_0x122c(0x33)](_0x228417=>{if(_0x1efd42['EupsK'](_0x1efd42[_0x122c(0x34)],_0x1efd42['PPphm']))return _0x5a4235[_0x122c(0x1b)](_0x120a75[_0x122c(0x35)],_0x1d9d0c['error']),_0x1e23da[_0x122c(0x36)][_0x122c(0x1d)](_0x120a75[_0x122c(0x37)],_0x4bc118['error']||_0x120a75[_0x122c(0x38)],[{'text':'OK','style':_0x120a75[_0x122c(0x39)]}]),![];else{const _0x4b97c6=_0x228417[_0x122c(0x2f)]&&_0x228417[_0x122c(0x30)];return!_0x4b97c6&&(_0x1efd42[_0x122c(0x25)](_0x1efd42[_0x122c(0x3a)],_0x122c(0x3b))?_0x1edcbc[_0x122c(0x2e)](_0x122c(0x3c)+_0x120a75[_0x122c(0x3d)](_0x5dface,_0xb0b5c9)+_0x122c(0x3e)):console['warn'](_0x1efd42[_0x122c(0x3f)],_0x228417)),_0x4b97c6;}}),_0x210e31=(_0x47a590[_0x122c(0x26)]||[])['filter'](_0x29e003=>{if(_0x1efd42[_0x122c(0x29)](_0x122c(0x4),_0x1efd42[_0x122c(0x40)])){const _0x336c7d=_0x29e003[_0x122c(0x2f)]&&_0x29e003['rating'];if(!_0x336c7d){if(_0x1efd42[_0x122c(0x41)](_0x122c(0x42),_0x1efd42[_0x122c(0x43)]))console[_0x122c(0x2e)](_0x1efd42[_0x122c(0x44)],_0x29e003);else return _0x35e0b8[_0x122c(0x16)](_0x122c(0x45)),_0x567b4d['log'](_0x122c(0xe),_0xa3fec2[_0x122c(0x46)]),!![];}return _0x336c7d;}else _0x440185[_0x122c(0x2e)]('⚠️\x20[NETFLIX_EXTRACTOR]\x20Invalid\x20viewing\x20history\x20item:',_0x5812dc);}),_0x473663=_0x2d26e2,_0x4426c1=_0x1efd42['emxMV'](_0xa03589[_0x122c(0x24)]+_0xdb55ea[_0x122c(0x24)],_0x210e31[_0x122c(0x24)]);_0x1efd42[_0x122c(0x47)](_0x4426c1,_0x473663)&&console[_0x122c(0x2e)](_0x122c(0x3c)+_0x1efd42[_0x122c(0x48)](_0x473663,_0x4426c1)+_0x122c(0x3e));try{console['log'](_0x1efd42['RCJDw']);const _0x31cffb=await(0x0,_netflixDataService[_0x122c(0x49)])(_0x4c3a1e,{'viewingHistory':{'items':_0xa03589,'totalCount':_0xa03589['length']},'myList':_0xdb55ea,'ratings':_0x210e31,'profile':_0x47a590[_0x122c(0x4a)],'tokenExpiry':_0x47a590[_0x122c(0x4b)],'profileId':_0x47a590[_0x122c(0x4c)]});if(_0x31cffb[_0x122c(0x4d)])return console['log'](_0x122c(0x45)),console[_0x122c(0x16)](_0x1efd42[_0x122c(0x4e)],_0x31cffb['data']),!![];else{if(_0x1efd42[_0x122c(0x4f)]!==_0x1efd42[_0x122c(0x4f)]){const _0x805a10=_0x47ef2d[_0x122c(0x2f)]&&_0xbd519e[_0x122c(0x30)];return!_0x805a10&&_0x26daa0[_0x122c(0x2e)](_0x1efd42[_0x122c(0x3f)],_0x2cd027),_0x805a10;}else return console['error']('❌\x20[NETFLIX_EXTRACTOR]\x20Backend\x20storage\x20failed:',_0x31cffb[_0x122c(0x1b)]),_reactNative[_0x122c(0x36)][_0x122c(0x1d)](_0x122c(0x7),_0x31cffb['error']||_0x1efd42[_0x122c(0x50)],[{'text':'OK','style':_0x1efd42[_0x122c(0x14)]}]),![];}}catch(_0x446d6c){if(_0x1efd42['EupsK'](_0x1efd42[_0x122c(0x51)],_0x1efd42[_0x122c(0x52)]))return console[_0x122c(0x1b)](_0x1efd42[_0x122c(0x53)],_0x446d6c),_reactNative[_0x122c(0x36)][_0x122c(0x1d)](_0x122c(0x54),_0x1efd42[_0x122c(0x55)],[{'text':'OK','style':_0x1efd42['WZdAy']}]),![];else _0x2ad3fe[_0x122c(0x2e)](_0x1efd42[_0x122c(0x44)],_0x51983f);}};return{'initiateDataExport':_0xc238f0};};exports[_0x122c(0x56)]=useNetflixDataExtractor;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useNetflixDataExtractor = void 0;
7
+ var _netflixDataService = require("./netflixDataService");
8
+ var _reactNative = require("react-native");
9
+ /**
10
+ * Netflix Data Extractor
11
+ *
12
+ * Orchestrates the Netflix data export flow:
13
+ * 1. Receives extracted viewing data from WebView
14
+ * 2. Validates and formats data
15
+ * 3. Sends to backend via netflixDataService
16
+ *
17
+ * This acts as the bridge between OAuthWebView and the backend API.
18
+ *
19
+ * @reference Sephora implementation: src/services/sephoraDataExtractor.ts
20
+ */
21
+
22
+ /**
23
+ * Combined Netflix export data from WebView - matches netflix.ts script output
24
+ */
25
+
26
+ /**
27
+ * Hook for Netflix data extraction operations
28
+ */
29
+ const useNetflixDataExtractor = () => {
30
+ /**
31
+ * Initiate data export to backend
32
+ *
33
+ * @param username - User identifier
34
+ * @param data - Extracted Netflix data (viewingHistory, myList, ratings, profile)
35
+ * @returns true if successful, false otherwise
36
+ */
37
+ const initiateDataExport = async (username, data) => {
38
+ var _data$viewingHistory, _data$myList, _data$ratings, _data$viewingHistory2;
39
+ console.log('🚀 [NETFLIX_EXTRACTOR] Initiating data export');
40
+ console.log('👤 [NETFLIX_EXTRACTOR] Username:', username);
41
+ console.log('📊 [NETFLIX_EXTRACTOR] Summary:', data.summary);
42
+ if (!username) {
43
+ console.error('❌ [NETFLIX_EXTRACTOR] Username is required');
44
+ _reactNative.Alert.alert('Error', 'Username is required to export Netflix data.', [{
45
+ text: 'OK',
46
+ style: 'default'
47
+ }]);
48
+ return false;
49
+ }
50
+ 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);
51
+ if (totalItems === 0) {
52
+ console.log('ℹ️ [NETFLIX_EXTRACTOR] No data to export - treating as success (connected)');
53
+ return true;
54
+ }
55
+ const validViewingHistory = (((_data$viewingHistory2 = data.viewingHistory) === null || _data$viewingHistory2 === void 0 ? void 0 : _data$viewingHistory2.items) || []).filter(item => {
56
+ const isValid = item.videoId && item.title;
57
+ if (!isValid) {
58
+ console.warn('⚠️ [NETFLIX_EXTRACTOR] Invalid viewing history item:', item);
59
+ }
60
+ return isValid;
61
+ });
62
+ const validMyList = (data.myList || []).filter(item => {
63
+ const isValid = item.videoId && item.title;
64
+ if (!isValid) {
65
+ console.warn('⚠️ [NETFLIX_EXTRACTOR] Invalid My List item:', item);
66
+ }
67
+ return isValid;
68
+ });
69
+ const validRatings = (data.ratings || []).filter(rating => {
70
+ const isValid = rating.videoId && rating.rating;
71
+ if (!isValid) {
72
+ console.warn('⚠️ [NETFLIX_EXTRACTOR] Invalid rating:', rating);
73
+ }
74
+ return isValid;
75
+ });
76
+ const originalCount = totalItems;
77
+ const validCount = validViewingHistory.length + validMyList.length + validRatings.length;
78
+ if (validCount < originalCount) {
79
+ console.warn(`⚠️ [NETFLIX_EXTRACTOR] Filtered out ${originalCount - validCount} invalid items`);
80
+ }
81
+ try {
82
+ console.log('📡 [NETFLIX_EXTRACTOR] Sending to backend...');
83
+ const result = await (0, _netflixDataService.storeNetflixData)(username, {
84
+ viewingHistory: {
85
+ items: validViewingHistory,
86
+ totalCount: validViewingHistory.length
87
+ },
88
+ myList: validMyList,
89
+ ratings: validRatings,
90
+ profile: data.profile,
91
+ tokenExpiry: data.tokenExpiry,
92
+ profileId: data.profileId
93
+ });
94
+ if (result.success) {
95
+ console.log('✅ [NETFLIX_EXTRACTOR] Export completed successfully');
96
+ console.log('📊 [NETFLIX_EXTRACTOR] Backend response:', result.data);
97
+ return true;
98
+ } else {
99
+ console.error('❌ [NETFLIX_EXTRACTOR] Backend storage failed:', result.error);
100
+ _reactNative.Alert.alert('Export Failed', result.error || 'An unknown error occurred during data storage.', [{
101
+ text: 'OK',
102
+ style: 'default'
103
+ }]);
104
+ return false;
105
+ }
106
+ } catch (error) {
107
+ console.error('❌ [NETFLIX_EXTRACTOR] Unexpected error during export:', error);
108
+ _reactNative.Alert.alert('Export Error', 'Failed to connect to the data storage service. Please check your network connection.', [{
109
+ text: 'OK',
110
+ style: 'default'
111
+ }]);
112
+ return false;
113
+ }
114
+ };
115
+ return {
116
+ initiateDataExport
117
+ };
118
+ };
119
+ exports.useNetflixDataExtractor = useNetflixDataExtractor;
120
+ //# sourceMappingURL=netflixDataExtractor.js.map
@@ -1,9 +1,198 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("../config/api"),
5
- require("@react-native-async-storage/async-storage"),
6
- require("react-native")
7
- ];
8
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
9
- Object[_0x2cc3(0x0)](exports,_0x2cc3(0x1),{'value':!![]}),exports[_0x2cc3(0x2)]=void 0x0;function _0x25a7(){const _0x2dd920=['defineProperty','__esModule','storeNetflixData','Invalid\x20input:\x20userId\x20missing.','✅\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]\x20Has\x20profile:','❌\x20[NETFLIX_SERVICE]\x20Invalid\x20input:\x20userId\x20missing','onairos_jwt_token','enoch_token','❌\x20[NETFLIX_SERVICE]\x20No\x20auth\x20token\x20found','Authentication\x20token\x20not\x20found.\x20Please\x20log\x20in\x20again.','webview-api','ios','17.0','Android','mobile-netflix','📡\x20[NETFLIX_SERVICE]\x20Sending\x20to\x20backend...','OcAaf','❌\x20[NETFLIX_SERVICE]\x20Network\x20error:','qSgnk','log','BtOGg','viewingHistory','items','kZETi','ZjESN','myList','length','AYvZZ','ratings','profile','error','TfDUp','eRcfG','getItem','default','auth_token','FCXdC','🔑\x20[NETFLIX_SERVICE]\x20Auth\x20token\x20found','BGoZF','AYfRf','Platform','hvnwn','iPhone','oXVxz','toISOString','orgca','streaming','map','videoId','title','type','seriesTitle','seasonNumber','episodeNumber','watchDuration','totalDuration','percentWatched','imageUrl','genres','sGrYo','totalCount','Vxtvf','bxiNF','addedAt','maturityRating','rating','ratedAt','profileId','profileName','maturityLevel','language','subtitlePreferences','kMcML','FhRCx','xhKsO','filter','thumbs_down','unknown','ptEyT','BASE_URL','/platform-data/store','SmFFr','API_CONFIG','Bearer\x20','OnairosSDK/1.0.0\x20(','stringify','json','eXnGH','sigli','DewvC','EIFpg','message','📝\x20[NETFLIX_SERVICE]\x20Backend\x20response:\x20','data','warn','⚠️\x20[NETFLIX_SERVICE]\x20Backend\x20returned\x20status:\x20','⚠️\x20[NETFLIX_SERVICE]\x20Error:\x20','HTTP\x20','status','KJgWc','AaCrF','AOGTf','wcnNi'];_0x25a7=function(){return _0x2dd920;};return _0x25a7();}function _0x2cc3(_0x25a72b,_0x2cc373){_0x25a72b=_0x25a72b-0x0;const _0x24ce23=_0x25a7();let _0x33a7bd=_0x24ce23[_0x25a72b];return _0x33a7bd;}var _api=__ONAIROS_REQ_FUNC__(0x0),_asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x1)),_reactNative=__ONAIROS_REQ_FUNC__(0x2);function _interopRequireDefault(_0x28484c){return _0x28484c&&_0x28484c[_0x2cc3(0x1)]?_0x28484c:{'default':_0x28484c};}const storeNetflixData=async(_0x98a40f,_0x3a99a5)=>{const _0x57dea3={'eRcfG':_0x2cc3(0x3),'EIFpg':_0x2cc3(0x4),'TdUjU':_0x2cc3(0x5),'qSgnk':'🚀\x20[NETFLIX_SERVICE]\x20Storing\x20Netflix\x20data\x20for:','wXgIm':_0x2cc3(0x6),'BtOGg':function(_0x519d91,_0x10bf8e){return _0x519d91===_0x10bf8e;},'kZETi':function(_0xc56e08,_0xcf7c0c){return _0xc56e08===_0xcf7c0c;},'YVYdo':_0x2cc3(0x7),'ZjESN':function(_0x174bdf,_0x1b1195){return _0x174bdf===_0x1b1195;},'AYvZZ':'📊\x20[NETFLIX_SERVICE]\x20Ratings:','CLxfW':function(_0x250d80,_0x4c0761){return _0x250d80===_0x4c0761;},'UenjS':_0x2cc3(0x8),'TfDUp':_0x2cc3(0x9),'UDJaq':_0x2cc3(0xa),'NqNIZ':_0x2cc3(0xb),'FCXdC':_0x2cc3(0xc),'jnCqS':_0x2cc3(0xd),'BGoZF':_0x2cc3(0xe),'McyFC':'1.0.0','AYfRf':function(_0x563a86,_0x5a0213){return _0x563a86===_0x5a0213;},'hvnwn':_0x2cc3(0xf),'UXUdm':_0x2cc3(0x10),'oXVxz':_0x2cc3(0x11),'orgca':_0x2cc3(0x12),'eKNwJ':function(_0x97fe30,_0x2541c9){return _0x97fe30===_0x2541c9;},'sGrYo':function(_0x414e22,_0x3e8fb8){return _0x414e22===_0x3e8fb8;},'jtyFw':function(_0x569953,_0x477509){return _0x569953===_0x477509;},'Vxtvf':function(_0x363681,_0x362950){return _0x363681===_0x362950;},'bxiNF':function(_0xe57ab2,_0x32c89e){return _0xe57ab2===_0x32c89e;},'kMcML':function(_0x3abd2e,_0x5f4dc9){return _0x3abd2e===_0x5f4dc9;},'KyETD':function(_0x12840e,_0x345664){return _0x12840e===_0x345664;},'FhRCx':function(_0x4f5965,_0x1eeab0){return _0x4f5965===_0x1eeab0;},'xhKsO':function(_0x27bee9,_0x3798af){return _0x27bee9===_0x3798af;},'ptEyT':_0x2cc3(0x13),'shQcw':'📍\x20[NETFLIX_SERVICE]\x20URL:','SmFFr':function(_0x370e59,_0x2ac57e,_0x21f39b){return _0x370e59(_0x2ac57e,_0x21f39b);},'eXnGH':function(_0x497142,_0xa2cbfa){return _0x497142!==_0xa2cbfa;},'wvHlb':'Unknown\x20error','KJgWc':function(_0x55293c,_0x5a2d86){return _0x55293c!==_0x5a2d86;},'AaCrF':_0x2cc3(0x14),'AOGTf':_0x2cc3(0x15),'wcnNi':'Network\x20error.\x20Please\x20check\x20your\x20connection.'};var _0x597987,_0x366a60,_0x209455;console['log'](_0x57dea3[_0x2cc3(0x16)],_0x98a40f),console[_0x2cc3(0x17)](_0x57dea3['wXgIm'],(_0x57dea3[_0x2cc3(0x18)](_0x597987=_0x3a99a5[_0x2cc3(0x19)],null)||_0x57dea3['kZETi'](_0x597987,void 0x0)||(_0x597987=_0x597987[_0x2cc3(0x1a)])===null||_0x57dea3[_0x2cc3(0x1b)](_0x597987,void 0x0)?void 0x0:_0x597987['length'])||0x0),console[_0x2cc3(0x17)](_0x57dea3['YVYdo'],(_0x57dea3[_0x2cc3(0x1c)](_0x366a60=_0x3a99a5[_0x2cc3(0x1d)],null)||_0x366a60===void 0x0?void 0x0:_0x366a60[_0x2cc3(0x1e)])||0x0),console[_0x2cc3(0x17)](_0x57dea3[_0x2cc3(0x1f)],(_0x57dea3['CLxfW'](_0x209455=_0x3a99a5[_0x2cc3(0x20)],null)||_0x57dea3[_0x2cc3(0x18)](_0x209455,void 0x0)?void 0x0:_0x209455['length'])||0x0),console[_0x2cc3(0x17)](_0x57dea3['UenjS'],!!_0x3a99a5[_0x2cc3(0x21)]);if(!_0x98a40f)return console[_0x2cc3(0x22)](_0x57dea3[_0x2cc3(0x23)]),{'success':![],'error':_0x57dea3[_0x2cc3(0x24)]};try{var _0x4b4bed,_0x3881ed,_0x46d2e2,_0x24da9c,_0x50abde,_0x3bdcd9,_0x539dc6,_0x25c1c5;const _0x3a3ff6=await _asyncStorage['default'][_0x2cc3(0x25)](_0x57dea3['UDJaq'])||await _asyncStorage['default'][_0x2cc3(0x25)](_0x57dea3['NqNIZ'])||await _asyncStorage[_0x2cc3(0x26)][_0x2cc3(0x25)](_0x2cc3(0x27));if(!_0x3a3ff6)return console[_0x2cc3(0x22)](_0x57dea3[_0x2cc3(0x28)]),{'success':![],'error':_0x57dea3['jnCqS']};console[_0x2cc3(0x17)](_0x2cc3(0x29));const _0x4b800c={'platform':_reactNative['Platform']['OS'],'source':_0x57dea3[_0x2cc3(0x2a)],'appVersion':_0x57dea3['McyFC'],'osVersion':_0x57dea3[_0x2cc3(0x2b)](_reactNative[_0x2cc3(0x2c)]['OS'],_0x57dea3[_0x2cc3(0x2d)])?_0x57dea3['UXUdm']:_reactNative[_0x2cc3(0x2c)]['OS'],'deviceModel':_0x57dea3['BtOGg'](_reactNative[_0x2cc3(0x2c)]['OS'],_0x57dea3[_0x2cc3(0x2d)])?_0x2cc3(0x2e):_0x57dea3[_0x2cc3(0x2f)],'isOfflineSync':![],'extractedAt':new Date()[_0x2cc3(0x30)](),'tokenExpiry':_0x3a99a5['tokenExpiry']},_0x2a1893={'platform':_0x57dea3[_0x2cc3(0x31)],'dataType':_0x2cc3(0x32),'data':{'viewingHistory':{'items':((_0x57dea3['eKNwJ'](_0x4b4bed=_0x3a99a5[_0x2cc3(0x19)],null)||_0x4b4bed===void 0x0?void 0x0:_0x4b4bed['items'])||[])[_0x2cc3(0x33)](_0x3f3a20=>({'videoId':_0x3f3a20[_0x2cc3(0x34)],'title':_0x3f3a20[_0x2cc3(0x35)],'type':_0x3f3a20[_0x2cc3(0x36)],'seriesTitle':_0x3f3a20[_0x2cc3(0x37)],'seasonNumber':_0x3f3a20[_0x2cc3(0x38)],'episodeNumber':_0x3f3a20[_0x2cc3(0x39)],'watchedAt':_0x3f3a20['watchedAt'],'watchDuration':_0x3f3a20[_0x2cc3(0x3a)],'totalDuration':_0x3f3a20[_0x2cc3(0x3b)],'percentWatched':_0x3f3a20[_0x2cc3(0x3c)],'imageUrl':_0x3f3a20[_0x2cc3(0x3d)],'genres':_0x3f3a20[_0x2cc3(0x3e)]})),'totalCount':(_0x57dea3[_0x2cc3(0x3f)](_0x3881ed=_0x3a99a5[_0x2cc3(0x19)],null)||_0x57dea3['jtyFw'](_0x3881ed,void 0x0)?void 0x0:_0x3881ed[_0x2cc3(0x40)])||(_0x57dea3[_0x2cc3(0x41)](_0x46d2e2=_0x3a99a5[_0x2cc3(0x19)],null)||_0x57dea3[_0x2cc3(0x1b)](_0x46d2e2,void 0x0)||_0x57dea3[_0x2cc3(0x1b)](_0x46d2e2=_0x46d2e2[_0x2cc3(0x1a)],null)||_0x57dea3[_0x2cc3(0x42)](_0x46d2e2,void 0x0)?void 0x0:_0x46d2e2[_0x2cc3(0x1e)])||0x0},'myList':(_0x3a99a5[_0x2cc3(0x1d)]||[])[_0x2cc3(0x33)](_0x290ef8=>({'videoId':_0x290ef8[_0x2cc3(0x34)],'title':_0x290ef8['title'],'type':_0x290ef8[_0x2cc3(0x36)],'addedAt':_0x290ef8[_0x2cc3(0x43)],'imageUrl':_0x290ef8[_0x2cc3(0x3d)],'genres':_0x290ef8[_0x2cc3(0x3e)],'maturityRating':_0x290ef8[_0x2cc3(0x44)],'year':_0x290ef8['year']})),'ratings':(_0x3a99a5[_0x2cc3(0x20)]||[])[_0x2cc3(0x33)](_0x13e03c=>({'videoId':_0x13e03c[_0x2cc3(0x34)],'title':_0x13e03c['title'],'rating':_0x13e03c[_0x2cc3(0x45)],'ratedAt':_0x13e03c[_0x2cc3(0x46)]})),'profile':_0x3a99a5[_0x2cc3(0x21)]?{'profileId':_0x3a99a5[_0x2cc3(0x21)][_0x2cc3(0x47)],'profileName':_0x3a99a5['profile'][_0x2cc3(0x48)],'maturityLevel':_0x3a99a5[_0x2cc3(0x21)][_0x2cc3(0x49)],'language':_0x3a99a5[_0x2cc3(0x21)][_0x2cc3(0x4a)],'subtitlePreferences':_0x3a99a5[_0x2cc3(0x21)][_0x2cc3(0x4b)],'autoplayPreferences':_0x3a99a5[_0x2cc3(0x21)]['autoplayPreferences']}:null,'netflixProfileId':_0x3a99a5['profileId']||((_0x24da9c=_0x3a99a5[_0x2cc3(0x21)])===null||_0x57dea3[_0x2cc3(0x4c)](_0x24da9c,void 0x0)?void 0x0:_0x24da9c[_0x2cc3(0x47)])},'summary':{'viewingHistoryCount':(_0x57dea3[_0x2cc3(0x41)](_0x50abde=_0x3a99a5['viewingHistory'],null)||_0x57dea3['KyETD'](_0x50abde,void 0x0)||(_0x50abde=_0x50abde[_0x2cc3(0x1a)])===null||_0x57dea3[_0x2cc3(0x4d)](_0x50abde,void 0x0)?void 0x0:_0x50abde[_0x2cc3(0x1e)])||0x0,'myListCount':((_0x3bdcd9=_0x3a99a5['myList'])===null||_0x57dea3[_0x2cc3(0x4e)](_0x3bdcd9,void 0x0)?void 0x0:_0x3bdcd9[_0x2cc3(0x1e)])||0x0,'ratingsCount':(_0x57dea3[_0x2cc3(0x18)](_0x539dc6=_0x3a99a5[_0x2cc3(0x20)],null)||_0x57dea3[_0x2cc3(0x4e)](_0x539dc6,void 0x0)?void 0x0:_0x539dc6[_0x2cc3(0x1e)])||0x0,'thumbsUpCount':(_0x3a99a5[_0x2cc3(0x20)]||[])[_0x2cc3(0x4f)](_0x9460f7=>_0x9460f7[_0x2cc3(0x45)]==='thumbs_up')['length'],'thumbsDownCount':(_0x3a99a5['ratings']||[])[_0x2cc3(0x4f)](_0xca9fe=>_0xca9fe['rating']===_0x2cc3(0x50))[_0x2cc3(0x1e)],'profileName':(_0x57dea3['kZETi'](_0x25c1c5=_0x3a99a5[_0x2cc3(0x21)],null)||_0x57dea3[_0x2cc3(0x2b)](_0x25c1c5,void 0x0)?void 0x0:_0x25c1c5[_0x2cc3(0x48)])||_0x2cc3(0x51)},'mobileMetadata':_0x4b800c};console[_0x2cc3(0x17)](_0x57dea3[_0x2cc3(0x52)]),console['log'](_0x57dea3['shQcw'],_api['API_CONFIG'][_0x2cc3(0x53)]+_0x2cc3(0x54));const _0x61b5a=await _0x57dea3[_0x2cc3(0x55)](fetch,_api[_0x2cc3(0x56)][_0x2cc3(0x53)]+_0x2cc3(0x54),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x2cc3(0x57)+_0x3a3ff6,'User-Agent':_0x2cc3(0x58)+_reactNative[_0x2cc3(0x2c)]['OS']+')'},'body':JSON[_0x2cc3(0x59)](_0x2a1893)}),_0x52908a=await _0x61b5a[_0x2cc3(0x5a)]();return _0x61b5a['ok']?_0x57dea3[_0x2cc3(0x5b)](_0x2cc3(0x5c),_0x2cc3(0x5d))?(console[_0x2cc3(0x17)](_0x57dea3[_0x2cc3(0x5e)]),_0x52908a[_0x2cc3(0x5f)]&&console[_0x2cc3(0x17)](_0x2cc3(0x60)+_0x52908a[_0x2cc3(0x5f)]),{'success':!![],'message':_0x52908a[_0x2cc3(0x5f)]||_0x2cc3(0x5),'data':_0x52908a[_0x2cc3(0x61)]}):(_0x32652e[_0x2cc3(0x22)]('❌\x20[NETFLIX_SERVICE]\x20Invalid\x20input:\x20userId\x20missing'),{'success':![],'error':_0x57dea3[_0x2cc3(0x24)]}):(console[_0x2cc3(0x62)](_0x2cc3(0x63)+_0x61b5a['status']),console[_0x2cc3(0x62)](_0x2cc3(0x64)+(_0x52908a[_0x2cc3(0x22)]||_0x57dea3['wvHlb'])),{'success':![],'error':_0x52908a[_0x2cc3(0x22)]||_0x2cc3(0x65)+_0x61b5a[_0x2cc3(0x66)]});}catch(_0x3f1145){return _0x57dea3[_0x2cc3(0x67)](_0x57dea3[_0x2cc3(0x68)],_0x57dea3[_0x2cc3(0x68)])?(_0x17419a['log'](_0x57dea3['EIFpg']),_0x3aabbb[_0x2cc3(0x5f)]&&_0x49c806[_0x2cc3(0x17)]('📝\x20[NETFLIX_SERVICE]\x20Backend\x20response:\x20'+_0x52e05e['message']),{'success':!![],'message':_0x3be3b7[_0x2cc3(0x5f)]||_0x57dea3['TdUjU'],'data':_0x3d7f0e[_0x2cc3(0x61)]}):(console[_0x2cc3(0x22)](_0x57dea3[_0x2cc3(0x69)],_0x3f1145),{'success':![],'error':_0x3f1145['message']||_0x57dea3[_0x2cc3(0x6a)]});}};exports[_0x2cc3(0x2)]=storeNetflixData;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.storeNetflixData = void 0;
7
+ var _api = require("../config/api");
8
+ var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
9
+ var _reactNative = require("react-native");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ /**
12
+ * Netflix Data Service
13
+ *
14
+ * API layer for storing Netflix viewing data on backend.
15
+ * Sends extracted viewing history, watch later, and profile to /platform-data/store endpoint.
16
+ *
17
+ * MATCHES Sephora/ChatGPT implementation pattern
18
+ * - Uses format: { platform, data, metadata }
19
+ * - Platform: "mobile-netflix"
20
+ *
21
+ * Data Sources (from netflix.com - API details TBD):
22
+ * - Viewing History: User's watch history
23
+ * - My List: User's saved shows/movies
24
+ * - Profile: User preferences and settings
25
+ * - Ratings: User's thumbs up/down ratings
26
+ */
27
+
28
+ /**
29
+ * Structure of a viewed item - Netflix content
30
+ */
31
+
32
+ /**
33
+ * Structure of viewing history
34
+ */
35
+
36
+ /**
37
+ * Structure of a My List item
38
+ */
39
+
40
+ /**
41
+ * Structure of a rating
42
+ */
43
+
44
+ /**
45
+ * Structure of user profile
46
+ */
47
+
48
+ /**
49
+ * Token expiry information
50
+ */
51
+
52
+ /**
53
+ * Combined Netflix data to store - matches WebView export format
54
+ */
55
+
56
+ /**
57
+ * Response from backend endpoint
58
+ */
59
+
60
+ /**
61
+ * Store Netflix data on backend
62
+ *
63
+ * @param userId - Username or identifier
64
+ * @param data - Netflix viewing data (history, myList, ratings, profile)
65
+ * @returns Response indicating success/failure with metadata
66
+ */
67
+ const storeNetflixData = async (userId, data) => {
68
+ var _data$viewingHistory, _data$myList, _data$ratings;
69
+ console.log('🚀 [NETFLIX_SERVICE] Storing Netflix data for:', userId);
70
+ 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);
71
+ console.log('📊 [NETFLIX_SERVICE] My List items:', ((_data$myList = data.myList) === null || _data$myList === void 0 ? void 0 : _data$myList.length) || 0);
72
+ console.log('📊 [NETFLIX_SERVICE] Ratings:', ((_data$ratings = data.ratings) === null || _data$ratings === void 0 ? void 0 : _data$ratings.length) || 0);
73
+ console.log('📊 [NETFLIX_SERVICE] Has profile:', !!data.profile);
74
+ if (!userId) {
75
+ console.error('❌ [NETFLIX_SERVICE] Invalid input: userId missing');
76
+ return {
77
+ success: false,
78
+ error: 'Invalid input: userId missing.'
79
+ };
80
+ }
81
+ try {
82
+ var _data$viewingHistory2, _data$viewingHistory3, _data$viewingHistory4, _data$profile, _data$viewingHistory5, _data$myList2, _data$ratings2, _data$profile2;
83
+ const authToken = (await _asyncStorage.default.getItem('onairos_jwt_token')) || (await _asyncStorage.default.getItem('enoch_token')) || (await _asyncStorage.default.getItem('auth_token'));
84
+ if (!authToken) {
85
+ console.error('❌ [NETFLIX_SERVICE] No auth token found');
86
+ return {
87
+ success: false,
88
+ error: 'Authentication token not found. Please log in again.'
89
+ };
90
+ }
91
+ console.log('🔑 [NETFLIX_SERVICE] Auth token found');
92
+ const mobileMetadata = {
93
+ platform: _reactNative.Platform.OS,
94
+ source: 'webview-api',
95
+ appVersion: '1.0.0',
96
+ osVersion: _reactNative.Platform.OS === 'ios' ? '17.0' : _reactNative.Platform.OS,
97
+ deviceModel: _reactNative.Platform.OS === 'ios' ? 'iPhone' : 'Android',
98
+ isOfflineSync: false,
99
+ extractedAt: new Date().toISOString(),
100
+ tokenExpiry: data.tokenExpiry
101
+ };
102
+ const requestBody = {
103
+ platform: 'mobile-netflix',
104
+ dataType: 'streaming',
105
+ data: {
106
+ viewingHistory: {
107
+ items: (((_data$viewingHistory2 = data.viewingHistory) === null || _data$viewingHistory2 === void 0 ? void 0 : _data$viewingHistory2.items) || []).map(item => ({
108
+ videoId: item.videoId,
109
+ title: item.title,
110
+ type: item.type,
111
+ seriesTitle: item.seriesTitle,
112
+ seasonNumber: item.seasonNumber,
113
+ episodeNumber: item.episodeNumber,
114
+ watchedAt: item.watchedAt,
115
+ watchDuration: item.watchDuration,
116
+ totalDuration: item.totalDuration,
117
+ percentWatched: item.percentWatched,
118
+ imageUrl: item.imageUrl,
119
+ genres: item.genres
120
+ })),
121
+ 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
122
+ },
123
+ myList: (data.myList || []).map(item => ({
124
+ videoId: item.videoId,
125
+ title: item.title,
126
+ type: item.type,
127
+ addedAt: item.addedAt,
128
+ imageUrl: item.imageUrl,
129
+ genres: item.genres,
130
+ maturityRating: item.maturityRating,
131
+ year: item.year
132
+ })),
133
+ ratings: (data.ratings || []).map(rating => ({
134
+ videoId: rating.videoId,
135
+ title: rating.title,
136
+ rating: rating.rating,
137
+ ratedAt: rating.ratedAt
138
+ })),
139
+ profile: data.profile ? {
140
+ profileId: data.profile.profileId,
141
+ profileName: data.profile.profileName,
142
+ maturityLevel: data.profile.maturityLevel,
143
+ language: data.profile.language,
144
+ subtitlePreferences: data.profile.subtitlePreferences,
145
+ autoplayPreferences: data.profile.autoplayPreferences
146
+ } : null,
147
+ netflixProfileId: data.profileId || ((_data$profile = data.profile) === null || _data$profile === void 0 ? void 0 : _data$profile.profileId)
148
+ },
149
+ summary: {
150
+ 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,
151
+ myListCount: ((_data$myList2 = data.myList) === null || _data$myList2 === void 0 ? void 0 : _data$myList2.length) || 0,
152
+ ratingsCount: ((_data$ratings2 = data.ratings) === null || _data$ratings2 === void 0 ? void 0 : _data$ratings2.length) || 0,
153
+ thumbsUpCount: (data.ratings || []).filter(r => r.rating === 'thumbs_up').length,
154
+ thumbsDownCount: (data.ratings || []).filter(r => r.rating === 'thumbs_down').length,
155
+ profileName: ((_data$profile2 = data.profile) === null || _data$profile2 === void 0 ? void 0 : _data$profile2.profileName) || 'unknown'
156
+ },
157
+ mobileMetadata: mobileMetadata
158
+ };
159
+ console.log('📡 [NETFLIX_SERVICE] Sending to backend...');
160
+ console.log('📍 [NETFLIX_SERVICE] URL:', `${_api.API_CONFIG.BASE_URL}/platform-data/store`);
161
+ const response = await fetch(`${_api.API_CONFIG.BASE_URL}/platform-data/store`, {
162
+ method: 'POST',
163
+ headers: {
164
+ 'Content-Type': 'application/json',
165
+ 'Authorization': `Bearer ${authToken}`,
166
+ 'User-Agent': `OnairosSDK/1.0.0 (${_reactNative.Platform.OS})`
167
+ },
168
+ body: JSON.stringify(requestBody)
169
+ });
170
+ const responseData = await response.json();
171
+ if (response.ok) {
172
+ console.log('✅ [NETFLIX_SERVICE] Successfully stored Netflix data');
173
+ if (responseData.message) {
174
+ console.log(`📝 [NETFLIX_SERVICE] Backend response: ${responseData.message}`);
175
+ }
176
+ return {
177
+ success: true,
178
+ message: responseData.message || 'Netflix data stored successfully',
179
+ data: responseData.data
180
+ };
181
+ } else {
182
+ console.warn(`⚠️ [NETFLIX_SERVICE] Backend returned status: ${response.status}`);
183
+ console.warn(`⚠️ [NETFLIX_SERVICE] Error: ${responseData.error || 'Unknown error'}`);
184
+ return {
185
+ success: false,
186
+ error: responseData.error || `HTTP ${response.status}`
187
+ };
188
+ }
189
+ } catch (error) {
190
+ console.error('❌ [NETFLIX_SERVICE] Network error:', error);
191
+ return {
192
+ success: false,
193
+ error: error.message || 'Network error. Please check your connection.'
194
+ };
195
+ }
196
+ };
197
+ exports.storeNetflixData = storeNetflixData;
198
+ //# sourceMappingURL=netflixDataService.js.map
@@ -1,8 +1,84 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("./pinStorageUtils"),
5
- require('react-native-crypto-js')
6
- ];
7
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
8
- Object[_0x3bc0(0x0)](exports,_0x3bc0(0x1),{'value':!![]}),exports['hashPin']=exports[_0x3bc0(0x2)]=exports[_0x3bc0(0x3)]=exports['decryptPin']=void 0x0;var _pinStorageUtils=__ONAIROS_REQ_FUNC__(0x0);const CryptoJS=__ONAIROS_REQ_FUNC__(0x1),ENCRYPTION_KEY=_0x3bc0(0x4),encryptPin=_0x56f10f=>{const _0x42d9c1={'QSwkC':_0x3bc0(0x5),'kewMQ':function(_0x92972,_0x1c0805){return _0x92972!==_0x1c0805;},'oypMP':_0x3bc0(0x6),'KgwDp':_0x3bc0(0x7)};try{if(_0x42d9c1['kewMQ'](_0x42d9c1[_0x3bc0(0x8)],_0x42d9c1[_0x3bc0(0x8)]))try{const _0x3c274a=_0x4124c0['AES'][_0x3bc0(0x9)](_0x20bbf4,_0x21a61f)[_0x3bc0(0xa)]();return _0x4ab4ce[_0x3bc0(0xb)](_0x42d9c1[_0x3bc0(0xc)]),_0x3c274a;}catch(_0x212028){_0x575c6d[_0x3bc0(0xd)](_0x3bc0(0x7),_0x212028);throw _0x212028;}else{const _0x3710ac=CryptoJS[_0x3bc0(0xe)][_0x3bc0(0x9)](_0x56f10f,ENCRYPTION_KEY)[_0x3bc0(0xa)]();return console[_0x3bc0(0xb)](_0x42d9c1[_0x3bc0(0xc)]),_0x3710ac;}}catch(_0x5e7f04){console[_0x3bc0(0xd)](_0x42d9c1['KgwDp'],_0x5e7f04);throw _0x5e7f04;}};function _0x3bc0(_0x53f6be,_0x3bc0b3){_0x53f6be=_0x53f6be-0x0;const _0x509731=_0x53f6();let _0x4a0f64=_0x509731[_0x53f6be];return _0x4a0f64;}function _0x53f6(){const _0x41c0c2=['defineProperty','__esModule','getEncryptedPinForAPI','encryptPin','onairos-pin-encryption-key-2024','🔐\x20PIN\x20encrypted\x20successfully','kbQPJ','❌\x20Error\x20encrypting\x20PIN:','oypMP','encrypt','toString','log','QSwkC','error','AES','🔓\x20PIN\x20decrypted\x20successfully','❌\x20Error\x20decrypting\x20PIN:','decrypt','enc','Utf8','kNdxu','cZgNN','decryptPin','✅\x20PIN\x20encrypted\x20for\x20API\x20transmission','❌\x20Error\x20getting\x20encrypted\x20PIN\x20for\x20API:','qylIu','sIOIS','KsLgC','PZkSa','⚠️\x20No\x20temporary\x20PIN\x20available\x20for\x20encryption','fRRFE','bElMX','getTemporaryPin','SHZaB','🔒\x20PIN\x20hashed\x20successfully','❌\x20Error\x20hashing\x20PIN:','GMwlp','SORTw','SHA256','mWpgz','qqnPY','QQiCD','nFQEP','KbMDY','PwGgC','hashPin'];_0x53f6=function(){return _0x41c0c2;};return _0x53f6();}exports['encryptPin']=encryptPin;const decryptPin=_0x27f68a=>{const _0x2d1190={'kNdxu':_0x3bc0(0xf),'cZgNN':_0x3bc0(0x10)};try{const _0x1fff1b=CryptoJS['AES'][_0x3bc0(0x11)](_0x27f68a,ENCRYPTION_KEY),_0x27eab2=_0x1fff1b[_0x3bc0(0xa)](CryptoJS[_0x3bc0(0x12)][_0x3bc0(0x13)]);return console[_0x3bc0(0xb)](_0x2d1190[_0x3bc0(0x14)]),_0x27eab2;}catch(_0x453ff6){console['error'](_0x2d1190[_0x3bc0(0x15)],_0x453ff6);throw _0x453ff6;}};exports[_0x3bc0(0x16)]=decryptPin;const getEncryptedPinForAPI=async()=>{const _0x214cca={'fRRFE':function(_0x311e2b,_0x10c444){return _0x311e2b(_0x10c444);},'bElMX':_0x3bc0(0x17),'SHZaB':_0x3bc0(0x18),'sIOIS':function(_0x509e55,_0x8cb9e6){return _0x509e55!==_0x8cb9e6;},'PZkSa':_0x3bc0(0x19)};try{if(_0x214cca[_0x3bc0(0x1a)](_0x3bc0(0x1b),_0x214cca[_0x3bc0(0x1c)])){const _0xbfc571=(0x0,_pinStorageUtils['getTemporaryPin'])();if(!_0xbfc571)return console[_0x3bc0(0xb)](_0x3bc0(0x1d)),null;const _0x4da2cf=_0x214cca[_0x3bc0(0x1e)](encryptPin,_0xbfc571);return console['log'](_0x214cca[_0x3bc0(0x1f)]),_0x4da2cf;}else try{const _0x1c725a=(0x0,_0x90f2d8[_0x3bc0(0x20)])();if(!_0x1c725a)return _0xbefd84[_0x3bc0(0xb)](_0x3bc0(0x1d)),null;const _0x580005=_0x214cca[_0x3bc0(0x1e)](_0x9315b8,_0x1c725a);return _0x5a0089['log'](_0x214cca['bElMX']),_0x580005;}catch(_0x625930){return _0x247f4d['error'](_0x214cca[_0x3bc0(0x21)],_0x625930),null;}}catch(_0x4fdb9a){return console['error'](_0x3bc0(0x18),_0x4fdb9a),null;}};exports[_0x3bc0(0x2)]=getEncryptedPinForAPI;const hashPin=_0x1c9475=>{const _0x277a49={'RlBgG':function(_0x10a5a2,_0x490113){return _0x10a5a2+_0x490113;},'qqnPY':_0x3bc0(0x22),'PwGgC':_0x3bc0(0x23),'mWpgz':function(_0xfc7fdf,_0x130089){return _0xfc7fdf+_0x130089;},'QQiCD':function(_0x45ef78,_0x47177b){return _0x45ef78!==_0x47177b;},'nFQEP':_0x3bc0(0x24),'KbMDY':_0x3bc0(0x25)};try{const _0x59faea=CryptoJS[_0x3bc0(0x26)](_0x277a49[_0x3bc0(0x27)](_0x1c9475,ENCRYPTION_KEY))['toString']();return console['log'](_0x277a49[_0x3bc0(0x28)]),_0x59faea;}catch(_0x4ba3f9){if(_0x277a49[_0x3bc0(0x29)](_0x277a49[_0x3bc0(0x2a)],_0x277a49[_0x3bc0(0x2b)])){console[_0x3bc0(0xd)](_0x277a49[_0x3bc0(0x2c)],_0x4ba3f9);throw _0x4ba3f9;}else try{const _0x2f0981=_0x200564[_0x3bc0(0x26)](_0x277a49['RlBgG'](_0x4600d5,_0x1257ac))[_0x3bc0(0xa)]();return _0x559b96[_0x3bc0(0xb)](_0x277a49[_0x3bc0(0x28)]),_0x2f0981;}catch(_0x3ab559){_0x26d1f6[_0x3bc0(0xd)](_0x277a49[_0x3bc0(0x2c)],_0x3ab559);throw _0x3ab559;}}};exports[_0x3bc0(0x2d)]=hashPin;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.hashPin = exports.getEncryptedPinForAPI = exports.encryptPin = exports.decryptPin = void 0;
7
+ var _pinStorageUtils = require("./pinStorageUtils");
8
+ const CryptoJS = require('react-native-crypto-js');
9
+ /**
10
+ * Service for encrypting PIN data before sending to APIs
11
+ */
12
+
13
+ // Encryption key - in production, this should come from a secure source
14
+ const ENCRYPTION_KEY = 'onairos-pin-encryption-key-2024';
15
+
16
+ /**
17
+ * Encrypt PIN using AES encryption
18
+ */
19
+ const encryptPin = pin => {
20
+ try {
21
+ const encrypted = CryptoJS.AES.encrypt(pin, ENCRYPTION_KEY).toString();
22
+ console.log('🔐 PIN encrypted successfully');
23
+ return encrypted;
24
+ } catch (error) {
25
+ console.error('❌ Error encrypting PIN:', error);
26
+ throw error;
27
+ }
28
+ };
29
+
30
+ /**
31
+ * Decrypt PIN (for verification purposes)
32
+ */
33
+ exports.encryptPin = encryptPin;
34
+ const decryptPin = encryptedPin => {
35
+ try {
36
+ const decrypted = CryptoJS.AES.decrypt(encryptedPin, ENCRYPTION_KEY);
37
+ const pin = decrypted.toString(CryptoJS.enc.Utf8);
38
+ console.log('🔓 PIN decrypted successfully');
39
+ return pin;
40
+ } catch (error) {
41
+ console.error('❌ Error decrypting PIN:', error);
42
+ throw error;
43
+ }
44
+ };
45
+
46
+ /**
47
+ * Get encrypted PIN for API transmission
48
+ */
49
+ exports.decryptPin = decryptPin;
50
+ const getEncryptedPinForAPI = async () => {
51
+ try {
52
+ // Get the temporary PIN from memory
53
+ const pin = (0, _pinStorageUtils.getTemporaryPin)();
54
+ if (!pin) {
55
+ console.log('⚠️ No temporary PIN available for encryption');
56
+ return null;
57
+ }
58
+
59
+ // Encrypt the PIN
60
+ const encryptedPin = encryptPin(pin);
61
+ console.log('✅ PIN encrypted for API transmission');
62
+ return encryptedPin;
63
+ } catch (error) {
64
+ console.error('❌ Error getting encrypted PIN for API:', error);
65
+ return null;
66
+ }
67
+ };
68
+
69
+ /**
70
+ * Hash PIN for verification (one-way hash)
71
+ */
72
+ exports.getEncryptedPinForAPI = getEncryptedPinForAPI;
73
+ const hashPin = pin => {
74
+ try {
75
+ const hash = CryptoJS.SHA256(pin + ENCRYPTION_KEY).toString();
76
+ console.log('🔒 PIN hashed successfully');
77
+ return hash;
78
+ } catch (error) {
79
+ console.error('❌ Error hashing PIN:', error);
80
+ throw error;
81
+ }
82
+ };
83
+ exports.hashPin = hashPin;
84
+ //# sourceMappingURL=pinEncryptionService.js.map
@@ -1,7 +1,105 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("./biometricPinService")
5
- ];
6
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
7
- Object[_0x46da(0x0)](exports,_0x46da(0x1),{'value':!![]}),exports[_0x46da(0x2)]=exports[_0x46da(0x3)]=exports[_0x46da(0x4)]=exports[_0x46da(0x5)]=exports[_0x46da(0x6)]=exports['clearTemporaryPin']=exports[_0x46da(0x7)]=void 0x0;function _0x22f6(){const _0xf75526=['defineProperty','__esModule','setTemporaryPin','hasStoredPin','getTemporaryPin','getStoredPinForTraining','getPinForTraining','clearStoredPin','🔓\x20Retrieving\x20stored\x20PIN\x20for\x20training...','✅\x20PIN\x20retrieved\x20successfully\x20for\x20training','AIBxA','❌\x20Failed\x20to\x20retrieve\x20PIN\x20or\x20user\x20cancelled\x20authentication','isPinStored','zqoQB','usgyJ','log','njdZC','⚠️\x20No\x20PIN\x20stored\x20in\x20secure\x20storage','retrievePinWithBiometric','JUdkN','Prqjq','rgbbb','MedRY','📝\x20Using\x20temporary\x20PIN\x20for\x20training','error','YvBpY','Sajys','❌\x20Error\x20checking\x20PIN\x20storage:','Lmkcd','gmwvC','biometricPinService','qWZGM','🗑️\x20Clearing\x20stored\x20PIN...','removePinFromStorage','zcNse','📝\x20Temporary\x20PIN\x20set\x20for\x20training','🗑️\x20Temporary\x20PIN\x20cleared','blFRw'];_0x22f6=function(){return _0xf75526;};return _0x22f6();}var _biometricPinService=__ONAIROS_REQ_FUNC__(0x0);const getStoredPinForTraining=async()=>{const _0x1e9693={'njdZC':'🗑️\x20Temporary\x20PIN\x20cleared','EuYFE':_0x46da(0x8),'zqoQB':function(_0x55e612,_0x15154c){return _0x55e612!==_0x15154c;},'usgyJ':'EuWWH','JUdkN':_0x46da(0x9),'Prqjq':_0x46da(0xa),'MedRY':_0x46da(0xb),'YvBpY':'❌\x20Error\x20retrieving\x20stored\x20PIN:'};try{console['log'](_0x1e9693['EuYFE']);const _0x177178=await _biometricPinService['biometricPinService'][_0x46da(0xc)]();if(!_0x177178){if(_0x1e9693[_0x46da(0xd)](_0x1e9693[_0x46da(0xe)],_0x1e9693[_0x46da(0xe)]))_0x30fd4b=null,_0x2e0082[_0x46da(0xf)](_0x1e9693[_0x46da(0x10)]);else return console['log'](_0x46da(0x11)),null;}const _0x4f7fe5=await _biometricPinService['biometricPinService'][_0x46da(0x12)]();return _0x4f7fe5?(console[_0x46da(0xf)](_0x1e9693[_0x46da(0x13)]),_0x4f7fe5):_0x1e9693[_0x46da(0xd)](_0x1e9693[_0x46da(0x14)],_0x46da(0x15))?(console[_0x46da(0xf)](_0x1e9693[_0x46da(0x16)]),null):(_0x5206fd[_0x46da(0xf)](_0x46da(0x17)),_0x43a3f8);}catch(_0x2c6efe){return console[_0x46da(0x18)](_0x1e9693[_0x46da(0x19)],_0x2c6efe),null;}};exports[_0x46da(0x5)]=getStoredPinForTraining;const hasStoredPin=async()=>{const _0x418438={'Lmkcd':'UeGqW','gmwvC':_0x46da(0x1a),'qWZGM':_0x46da(0x1b)};try{return _0x418438[_0x46da(0x1c)]===_0x418438[_0x46da(0x1d)]?(_0x4976c3[_0x46da(0xf)](_0x46da(0xb)),null):await _biometricPinService[_0x46da(0x1e)][_0x46da(0xc)]();}catch(_0x535b88){return console['error'](_0x418438[_0x46da(0x1f)],_0x535b88),![];}};exports['hasStoredPin']=hasStoredPin;const clearStoredPin=async()=>{const _0x39158e={'JSyAz':'❌\x20Error\x20clearing\x20stored\x20PIN:'};try{return console[_0x46da(0xf)](_0x46da(0x20)),await _biometricPinService[_0x46da(0x1e)][_0x46da(0x21)]();}catch(_0x54060f){return console[_0x46da(0x18)](_0x39158e['JSyAz'],_0x54060f),![];}};exports[_0x46da(0x7)]=clearStoredPin;const getPinForTraining=async _0x2a2e43=>{const _0x5d8b13={'pJtSr':_0x46da(0x17),'zcNse':function(_0x523d68){return _0x523d68();}};if(_0x2a2e43)return console[_0x46da(0xf)](_0x5d8b13['pJtSr']),_0x2a2e43;return await _0x5d8b13[_0x46da(0x22)](getStoredPinForTraining);};exports['getPinForTraining']=getPinForTraining;let temporaryPin=null;const setTemporaryPin=_0x3bea3f=>{const _0x44a30e={'EecDT':_0x46da(0x23)};temporaryPin=_0x3bea3f,console[_0x46da(0xf)](_0x44a30e['EecDT']);};function _0x46da(_0x22f681,_0x46daed){_0x22f681=_0x22f681-0x0;const _0x25c0fd=_0x22f6();let _0x6588be=_0x25c0fd[_0x22f681];return _0x6588be;}exports[_0x46da(0x2)]=setTemporaryPin;const getTemporaryPin=()=>{return temporaryPin;};exports['getTemporaryPin']=getTemporaryPin;const clearTemporaryPin=()=>{const _0x427434={'blFRw':_0x46da(0x24)};temporaryPin=null,console[_0x46da(0xf)](_0x427434[_0x46da(0x25)]);};exports['clearTemporaryPin']=clearTemporaryPin;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.setTemporaryPin = exports.hasStoredPin = exports.getTemporaryPin = exports.getStoredPinForTraining = exports.getPinForTraining = exports.clearTemporaryPin = exports.clearStoredPin = void 0;
7
+ var _biometricPinService = require("./biometricPinService");
8
+ /**
9
+ * Utility functions for PIN storage management
10
+ */
11
+
12
+ /**
13
+ * Get the stored PIN for training/authentication purposes
14
+ * This will prompt for biometric authentication
15
+ */
16
+ const getStoredPinForTraining = async () => {
17
+ try {
18
+ console.log('🔓 Retrieving stored PIN for training...');
19
+
20
+ // Check if PIN is stored
21
+ const pinStored = await _biometricPinService.biometricPinService.isPinStored();
22
+ if (!pinStored) {
23
+ console.log('⚠️ No PIN stored in secure storage');
24
+ return null;
25
+ }
26
+
27
+ // Retrieve PIN with biometric authentication
28
+ const pin = await _biometricPinService.biometricPinService.retrievePinWithBiometric();
29
+ if (pin) {
30
+ console.log('✅ PIN retrieved successfully for training');
31
+ return pin;
32
+ } else {
33
+ console.log('❌ Failed to retrieve PIN or user cancelled authentication');
34
+ return null;
35
+ }
36
+ } catch (error) {
37
+ console.error('❌ Error retrieving stored PIN:', error);
38
+ return null;
39
+ }
40
+ };
41
+
42
+ /**
43
+ * Check if user has a PIN stored securely
44
+ */
45
+ exports.getStoredPinForTraining = getStoredPinForTraining;
46
+ const hasStoredPin = async () => {
47
+ try {
48
+ return await _biometricPinService.biometricPinService.isPinStored();
49
+ } catch (error) {
50
+ console.error('❌ Error checking PIN storage:', error);
51
+ return false;
52
+ }
53
+ };
54
+
55
+ /**
56
+ * Remove stored PIN (for logout/reset purposes)
57
+ */
58
+ exports.hasStoredPin = hasStoredPin;
59
+ const clearStoredPin = async () => {
60
+ try {
61
+ console.log('🗑️ Clearing stored PIN...');
62
+ return await _biometricPinService.biometricPinService.removePinFromStorage();
63
+ } catch (error) {
64
+ console.error('❌ Error clearing stored PIN:', error);
65
+ return false;
66
+ }
67
+ };
68
+
69
+ /**
70
+ * Get PIN for passing to training component
71
+ * This function can be called from the onboarding flow
72
+ */
73
+ exports.clearStoredPin = clearStoredPin;
74
+ const getPinForTraining = async tempPin => {
75
+ // If a temporary PIN is provided (from the PIN input), use it
76
+ if (tempPin) {
77
+ console.log('📝 Using temporary PIN for training');
78
+ return tempPin;
79
+ }
80
+
81
+ // Otherwise, try to retrieve stored PIN
82
+ return await getStoredPinForTraining();
83
+ };
84
+
85
+ /**
86
+ * Store PIN temporarily in memory for training component
87
+ * This is used when PIN is entered but not yet stored biometrically
88
+ */
89
+ exports.getPinForTraining = getPinForTraining;
90
+ let temporaryPin = null;
91
+ const setTemporaryPin = pin => {
92
+ temporaryPin = pin;
93
+ console.log('📝 Temporary PIN set for training');
94
+ };
95
+ exports.setTemporaryPin = setTemporaryPin;
96
+ const getTemporaryPin = () => {
97
+ return temporaryPin;
98
+ };
99
+ exports.getTemporaryPin = getTemporaryPin;
100
+ const clearTemporaryPin = () => {
101
+ temporaryPin = null;
102
+ console.log('🗑️ Temporary PIN cleared');
103
+ };
104
+ exports.clearTemporaryPin = clearTemporaryPin;
105
+ //# sourceMappingURL=pinStorageUtils.js.map