@onairos/react-native 3.7.2 → 3.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/lib/commonjs/api/index.js +219 -9
  2. package/lib/commonjs/components/BodyText.js +27 -9
  3. package/lib/commonjs/components/BrandMark.js +111 -10
  4. package/lib/commonjs/components/CodeInput.js +116 -9
  5. package/lib/commonjs/components/EmailInput.js +30 -8
  6. package/lib/commonjs/components/GoogleButton.js +56 -9
  7. package/lib/commonjs/components/HeadingGroup.js +43 -9
  8. package/lib/commonjs/components/LLMDataInputModal.js +664 -14
  9. package/lib/commonjs/components/ModalHeader.js +99 -9
  10. package/lib/commonjs/components/ModalSheet.js +47 -9
  11. package/lib/commonjs/components/Onairos.js +380 -14
  12. package/lib/commonjs/components/OnairosButton.js +313 -13
  13. package/lib/commonjs/components/OnairosSignInButton.js +130 -12
  14. package/lib/commonjs/components/Overlay.js +465 -13
  15. package/lib/commonjs/components/PersonaImage.js +137 -10
  16. package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
  17. package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
  18. package/lib/commonjs/components/PinCreationScreen.js +403 -12
  19. package/lib/commonjs/components/PinInput.js +464 -9
  20. package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
  21. package/lib/commonjs/components/PlatformList.js +137 -10
  22. package/lib/commonjs/components/PlatformToggle.js +180 -9
  23. package/lib/commonjs/components/PrimaryButton.js +180 -10
  24. package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
  25. package/lib/commonjs/components/SignInStep.js +345 -12
  26. package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
  27. package/lib/commonjs/components/VerificationStep.js +176 -11
  28. package/lib/commonjs/components/WelcomeScreen.js +461 -22
  29. package/lib/commonjs/components/icons/Basicproficon.js +37 -8
  30. package/lib/commonjs/components/icons/Basicprofile.js +21 -8
  31. package/lib/commonjs/components/icons/Checkbox.js +21 -8
  32. package/lib/commonjs/components/icons/Checkmark.js +27 -8
  33. package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
  34. package/lib/commonjs/components/icons/Contenticon.js +39 -8
  35. package/lib/commonjs/components/icons/EnochE.js +41 -8
  36. package/lib/commonjs/components/icons/Personalityicon.js +30 -8
  37. package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
  38. package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
  39. package/lib/commonjs/components/icons/Userpreferences.js +21 -8
  40. package/lib/commonjs/components/icons/index.js +84 -17
  41. package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
  42. package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
  43. package/lib/commonjs/components/onboarding/PinInput.js +283 -10
  44. package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
  45. package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
  46. package/lib/commonjs/config/api.js +56 -7
  47. package/lib/commonjs/constants/index.js +120 -7
  48. package/lib/commonjs/context/AuthContext.js +345 -10
  49. package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
  50. package/lib/commonjs/hooks/useConnections.js +102 -8
  51. package/lib/commonjs/hooks/useCredentials.js +178 -10
  52. package/lib/commonjs/hooks/useUserConnections.js +148 -10
  53. package/lib/commonjs/index.js +439 -34
  54. package/lib/commonjs/services/apiClient.js +298 -8
  55. package/lib/commonjs/services/biometricPinService.js +180 -8
  56. package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
  57. package/lib/commonjs/services/chatGPTConversationService.js +275 -9
  58. package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
  59. package/lib/commonjs/services/claudeConversationService.js +158 -9
  60. package/lib/commonjs/services/connectedAccountsService.js +310 -10
  61. package/lib/commonjs/services/googleAuthService.js +252 -11
  62. package/lib/commonjs/services/hingeDataExtractor.js +105 -8
  63. package/lib/commonjs/services/hingeDataService.js +150 -9
  64. package/lib/commonjs/services/imageCompressionService.js +260 -7
  65. package/lib/commonjs/services/instagramDataExtractor.js +126 -8
  66. package/lib/commonjs/services/instagramDataService.js +163 -9
  67. package/lib/commonjs/services/jwtStorageService.js +276 -7
  68. package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
  69. package/lib/commonjs/services/linkedinProfileService.js +222 -9
  70. package/lib/commonjs/services/linkedinScrapingService.js +230 -8
  71. package/lib/commonjs/services/llmDataStorage.js +294 -8
  72. package/lib/commonjs/services/mobileTrainingService.js +186 -8
  73. package/lib/commonjs/services/netflixDataExtractor.js +120 -8
  74. package/lib/commonjs/services/netflixDataService.js +198 -9
  75. package/lib/commonjs/services/pinEncryptionService.js +84 -8
  76. package/lib/commonjs/services/pinStorageUtils.js +105 -7
  77. package/lib/commonjs/services/platformAuthService.js +1484 -12
  78. package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
  79. package/lib/commonjs/services/sephoraDataService.js +200 -9
  80. package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
  81. package/lib/commonjs/services/spotifyDataService.js +241 -9
  82. package/lib/commonjs/services/storageService.js +404 -8
  83. package/lib/commonjs/services/telegramDataExtractor.js +115 -8
  84. package/lib/commonjs/services/telegramDataService.js +499 -9
  85. package/lib/commonjs/services/trainingApiHelpers.js +73 -7
  86. package/lib/commonjs/services/userConnectionsService.js +340 -10
  87. package/lib/commonjs/services/youtubeMigrationService.js +416 -10
  88. package/lib/commonjs/theme/index.js +250 -7
  89. package/lib/commonjs/types/ambient.d.js +2 -1
  90. package/lib/commonjs/types/declarations.d.js +2 -1
  91. package/lib/commonjs/types/index.js +6 -1
  92. package/lib/commonjs/types/node-fix.d.js +2 -1
  93. package/lib/commonjs/types/node-override.d.js +2 -1
  94. package/lib/commonjs/types/opacity.d.js +2 -1
  95. package/lib/commonjs/types.js +14 -1
  96. package/lib/commonjs/utils/Portal.js +98 -8
  97. package/lib/commonjs/utils/api.js +130 -9
  98. package/lib/commonjs/utils/assetRegistry.js +210 -35
  99. package/lib/commonjs/utils/auth.js +112 -9
  100. package/lib/commonjs/utils/connectorTests.js +613 -29
  101. package/lib/commonjs/utils/crypto.js +62 -8
  102. package/lib/commonjs/utils/debugHelper.js +64 -1
  103. package/lib/commonjs/utils/encryption.js +76 -7
  104. package/lib/commonjs/utils/eventUtils.js +288 -1
  105. package/lib/commonjs/utils/haptics.js +66 -9
  106. package/lib/commonjs/utils/imagePreloader.js +6 -1
  107. package/lib/commonjs/utils/networkDiagnostics.js +226 -8
  108. package/lib/commonjs/utils/onairosApi.js +350 -9
  109. package/lib/commonjs/utils/programmaticFlow.js +117 -9
  110. package/lib/commonjs/utils/retryHelper.js +220 -1
  111. package/lib/commonjs/utils/secureStorage.js +349 -10
  112. package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
  113. package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
  114. package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
  115. package/lib/commonjs/utils/webviewScripts/index.js +698 -15
  116. package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
  117. package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
  118. package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
  119. package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
  120. package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
  121. package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
  122. package/lib/module/api/index.js +211 -1
  123. package/lib/module/components/BodyText.js +20 -1
  124. package/lib/module/components/BrandMark.js +104 -1
  125. package/lib/module/components/CodeInput.js +109 -1
  126. package/lib/module/components/EmailInput.js +23 -1
  127. package/lib/module/components/GoogleButton.js +49 -1
  128. package/lib/module/components/HeadingGroup.js +36 -1
  129. package/lib/module/components/LLMDataInputModal.js +656 -7
  130. package/lib/module/components/ModalHeader.js +92 -1
  131. package/lib/module/components/ModalSheet.js +39 -1
  132. package/lib/module/components/Onairos.js +373 -1
  133. package/lib/module/components/OnairosButton.js +305 -1
  134. package/lib/module/components/OnairosSignInButton.js +121 -1
  135. package/lib/module/components/Overlay.js +456 -1
  136. package/lib/module/components/PersonaImage.js +129 -1
  137. package/lib/module/components/PersonaLoadingScreen.js +310 -1
  138. package/lib/module/components/PersonalizationConsentScreen.js +460 -1
  139. package/lib/module/components/PinCreationScreen.js +396 -1
  140. package/lib/module/components/PinInput.js +456 -1
  141. package/lib/module/components/PlatformConnectorsStep.js +1302 -6
  142. package/lib/module/components/PlatformList.js +129 -1
  143. package/lib/module/components/PlatformToggle.js +173 -1
  144. package/lib/module/components/PrimaryButton.js +172 -1
  145. package/lib/module/components/SignInMatchAnimation.js +189 -1
  146. package/lib/module/components/SignInStep.js +338 -1
  147. package/lib/module/components/UniversalOnboarding.js +2770 -1
  148. package/lib/module/components/VerificationStep.js +168 -1
  149. package/lib/module/components/WelcomeScreen.js +453 -1
  150. package/lib/module/components/icons/Basicproficon.js +30 -1
  151. package/lib/module/components/icons/Basicprofile.js +14 -1
  152. package/lib/module/components/icons/Checkbox.js +14 -1
  153. package/lib/module/components/icons/Checkmark.js +20 -1
  154. package/lib/module/components/icons/Contentanalysis.js +14 -1
  155. package/lib/module/components/icons/Contenticon.js +32 -1
  156. package/lib/module/components/icons/EnochE.js +34 -1
  157. package/lib/module/components/icons/Personalityicon.js +23 -1
  158. package/lib/module/components/icons/Personalityprofile.js +14 -1
  159. package/lib/module/components/icons/Personalitytraits.js +14 -1
  160. package/lib/module/components/icons/Userpreferences.js +14 -1
  161. package/lib/module/components/icons/index.js +13 -1
  162. package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
  163. package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
  164. package/lib/module/components/onboarding/PinInput.js +274 -1
  165. package/lib/module/components/onboarding/PlatformConnector.js +240 -1
  166. package/lib/module/config/PLATFORM_APIS.md +849 -0
  167. package/lib/module/config/api.js +47 -1
  168. package/lib/module/constants/index.js +114 -1
  169. package/lib/module/context/AuthContext.js +335 -1
  170. package/lib/module/hooks/useConnectedAccounts.js +106 -1
  171. package/lib/module/hooks/useConnections.js +95 -1
  172. package/lib/module/hooks/useCredentials.js +171 -6
  173. package/lib/module/hooks/useUserConnections.js +140 -1
  174. package/lib/module/index.js +172 -1
  175. package/lib/module/services/apiClient.js +295 -1
  176. package/lib/module/services/biometricPinService.js +169 -1
  177. package/lib/module/services/chatGPTConversationExtractor.js +149 -1
  178. package/lib/module/services/chatGPTConversationService.js +268 -1
  179. package/lib/module/services/claudeConversationExtractor.js +97 -1
  180. package/lib/module/services/claudeConversationService.js +151 -1
  181. package/lib/module/services/connectedAccountsService.js +293 -1
  182. package/lib/module/services/googleAuthService.js +241 -1
  183. package/lib/module/services/hingeDataExtractor.js +99 -1
  184. package/lib/module/services/hingeDataService.js +143 -1
  185. package/lib/module/services/imageCompressionService.js +250 -1
  186. package/lib/module/services/instagramDataExtractor.js +120 -1
  187. package/lib/module/services/instagramDataService.js +156 -1
  188. package/lib/module/services/jwtStorageService.js +257 -1
  189. package/lib/module/services/linkedinDOMExtractor.js +234 -1
  190. package/lib/module/services/linkedinProfileService.js +210 -1
  191. package/lib/module/services/linkedinScrapingService.js +219 -1
  192. package/lib/module/services/llmDataStorage.js +277 -1
  193. package/lib/module/services/mobileTrainingService.js +173 -1
  194. package/lib/module/services/netflixDataExtractor.js +114 -1
  195. package/lib/module/services/netflixDataService.js +191 -1
  196. package/lib/module/services/pinEncryptionService.js +74 -6
  197. package/lib/module/services/pinStorageUtils.js +93 -1
  198. package/lib/module/services/platformAuthService.js +1461 -1
  199. package/lib/module/services/sephoraDataExtractor.js +134 -1
  200. package/lib/module/services/sephoraDataService.js +193 -1
  201. package/lib/module/services/spotifyDataExtractor.js +142 -1
  202. package/lib/module/services/spotifyDataService.js +234 -1
  203. package/lib/module/services/storageService.js +383 -1
  204. package/lib/module/services/telegramDataExtractor.js +109 -1
  205. package/lib/module/services/telegramDataService.js +493 -1
  206. package/lib/module/services/trainingApiHelpers.js +67 -1
  207. package/lib/module/services/userConnectionsService.js +329 -1
  208. package/lib/module/services/youtubeMigrationService.js +405 -1
  209. package/lib/module/theme/index.js +245 -1
  210. package/lib/module/types.js +10 -1
  211. package/lib/module/utils/Portal.js +90 -1
  212. package/lib/module/utils/api.js +118 -1
  213. package/lib/module/utils/assetRegistry.js +200 -34
  214. package/lib/module/utils/auth.js +100 -1
  215. package/lib/module/utils/connectorTests.js +600 -27
  216. package/lib/module/utils/crypto.js +54 -1
  217. package/lib/module/utils/debugHelper.js +54 -1
  218. package/lib/module/utils/encryption.js +67 -1
  219. package/lib/module/utils/eventUtils.js +270 -1
  220. package/lib/module/utils/haptics.js +59 -8
  221. package/lib/module/utils/imagePreloader.js +3 -1
  222. package/lib/module/utils/networkDiagnostics.js +217 -1
  223. package/lib/module/utils/onairosApi.js +333 -1
  224. package/lib/module/utils/programmaticFlow.js +111 -1
  225. package/lib/module/utils/retryHelper.js +211 -1
  226. package/lib/module/utils/secureStorage.js +330 -6
  227. package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
  228. package/lib/module/utils/webviewScripts/claude.js +370 -1
  229. package/lib/module/utils/webviewScripts/hinge.js +405 -1
  230. package/lib/module/utils/webviewScripts/index.js +434 -1
  231. package/lib/module/utils/webviewScripts/instagram.js +448 -1
  232. package/lib/module/utils/webviewScripts/linkedin.js +874 -1
  233. package/lib/module/utils/webviewScripts/netflix.js +376 -1
  234. package/lib/module/utils/webviewScripts/sephora.js +510 -1
  235. package/lib/module/utils/webviewScripts/spotify.js +413 -1
  236. package/lib/module/utils/webviewScripts/telegram.js +672 -1
  237. package/package.json +2 -2
@@ -1,10 +1,416 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("@react-native-google-signin/google-signin"),
5
- require("react-native"),
6
- require("@react-native-async-storage/async-storage"),
7
- require("../config/api")
8
- ];
9
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
10
- Object[_0x11cf(0x0)](exports,'__esModule',{'value':!![]}),exports[_0x11cf(0x1)]=exports[_0x11cf(0x2)]=exports[_0x11cf(0x3)]=exports[_0x11cf(0x4)]=exports[_0x11cf(0x5)]=void 0x0;var _googleSignin=__ONAIROS_REQ_FUNC__(0x0),_reactNative=__ONAIROS_REQ_FUNC__(0x1),_asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x2)),_api=__ONAIROS_REQ_FUNC__(0x3);function _interopRequireDefault(_0x373d7f){return _0x373d7f&&_0x373d7f[_0x11cf(0x6)]?_0x373d7f:{'default':_0x373d7f};}function _0x224b(){const _0x5b72b9=['defineProperty','shouldShowYouTubeMigrationWarning','reconnectYouTube','getYouTubeConnectionStatus','checkYouTubeMigrationNeeded','checkAndFixYouTubeConnection','__esModule','1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com','https://www.googleapis.com/auth/youtube.readonly','openid','email','GoogleSignin','configure','pHcoN','kDUds','kEumJ','❌\x20Failed\x20to\x20track\x20migration\x20attempt:','Upgrade\x20Failed\x20❌','default','zLmaF','OkTSG','temporary\x20access\x20token\x20mode','⚠️\x20No\x20refresh\x20capability\x20but\x20training\x20can\x20proceed','🔧\x20User\x20needs\x20YouTube\x20migration\x20for\x20refresh\x20token','rBPgz','WYLTI','✅\x20YouTube\x20connection\x20fully\x20working\x20with\x20refresh\x20tokens','❌\x20Error\x20checking\x20YouTube\x20migration\x20status:','StBdl','GUqvC','API_CONFIG','BASE_URL','/youtube/validate-connection/','json','success','validation','oCOdS','isTemporaryMode','jZxzd','temporaryMode','rAVSB','includes','HMKMU','needsReconnection','hasRefreshToken','log','🔍\x20YouTube\x20migration\x20check:','enabled','message','lVWbT','AfrOM','KwSDb','kuarq','MAlAR','jHmBm','error','PQQbe','jPAzS','YouTube\x20connection\x20upgrade\x20failed.\x20Please\x20try\x20again\x20later\x20or\x20contact\x20support\x20if\x20the\x20problem\x20persists.','Jvrvt','JBbDG','profile','To\x20improve\x20your\x20training\x20experience,\x20we\x20need\x20to\x20upgrade\x20your\x20YouTube\x20connection.\x20This\x20prevents\x20interruptions\x20during\x20data\x20collection.\x0a\x0a✅\x20One-time\x20upgrade\x0a✅\x20Takes\x2030\x20seconds\x0a✅\x20No\x20data\x20loss\x0a\x0aUpgrade\x20now?','cancel','Upgrade\x20Now','❌\x20Error\x20getting\x20YouTube\x20connection\x20status:','none','🚫\x20[MIGRATION]\x20NO\x20MIGRATION\x20NEEDED\x20-\x20user\x20connection\x20is\x20working\x20correctly','EVcXa','enKEG','📋\x20Complete\x20YouTube\x20status\x20response:','wSqTQ','wWtDp','🔄\x20YouTube\x20connected\x20in\x20temporary\x20mode','✅\x20Training\x20will\x20work,\x20but\x20connection\x20expires\x20in\x20~1\x20hour','temporary','cgIar','⚠️\x20YouTube\x20connected\x20but\x20needs\x20migration','xWLZd','jRwIQ','kFeCK','cKyaG','miYxp','nKvsq','jFdey','SyZOR','WXiZY','QoYCm','UZEYT','SGxtP','NHaXU','UYYqx','yjURJ','npEcK','lQOJp','NKWlO','JWJjg','PWNnj','nrWIt','VAJqH','UDMBw','lhRAH','bqQim','jNMnn','limited','❓\x20YouTube\x20connection\x20status\x20unclear','CVQGl','Alert','alert','YouTube\x20Connection\x20Upgrade','aKCFO','Skip\x20for\x20Now','XoPXv','❌\x20No\x20YouTube\x20connection\x20found','ggsHV','WXiQv','PuegI','qtwYj','WiaqT','PmATr','CSwnj','⚠️\x20[MIGRATION\x20WARNING]\x20SHOW\x20WARNING\x20-\x20genuinely\x20old\x20connection\x20needs\x20update','❌\x20No\x20refresh\x20token\x20received\x20-\x20Google\x20Console\x20configuration\x20may\x20be\x20incorrect','\x20\x20\x201.\x20offlineAccess:\x20true\x20is\x20missing\x20from\x20configuration','\x20\x20\x202.\x20forceCodeForRefreshToken:\x20true\x20is\x20missing','\x20\x20\x203.\x20User\x20did\x20not\x20grant\x20offline\x20access\x20permission','tgLUx','ℹ️\x20No\x20token\x20cache\x20to\x20clear','None','NRxPD','Server\x20auth\x20code\x20from\x20sign-in','KOIGy','Current\x20user\x20server\x20auth\x20code','🔍\x20Token\x20Analysis:','Available','MISSING!','0|1|4|3|2|5','💡\x20This\x20usually\x20means:','🔑\x20Refresh\x20token\x20source:','onairos_jwt_token','enoch_token','⚠️\x20No\x20authentication\x20token\x20found\x20for\x20YouTube\x20migration','your-api-key','ESzSG','FJaoH','❌\x20YouTube\x20migration\x20failed:','🔄\x20Starting\x20YouTube\x20migration\x20for\x20user:','qGXqI','signOut','hvHeX','accessToken','LpgnD','ofMfI','YbRMO','hasPlayServices','🔐\x20Initiating\x20sign-in\x20-\x20consent\x20screen\x20should\x20appear...','getTokens','getCurrentUser','jxsra','serverAuthCode','KBecQ','BeKat','wyhoy','GbFQP','iBtpC','connectedAt','KBosQ','hKjis','wBjYu','DNAyv','FPTHl','🚫\x20[MIGRATION\x20WARNING]\x20NO\x20WARNING\x20-\x20user\x20is\x20in\x20temporary\x20mode\x20(working\x20correctly)','yLRUg','ZEyxl','user','ndKtF','split','KmGGG','yUBPP','AlAEr','✅\x20Got\x20refresh\x20token\x20after\x20consent:','substring','...','rNfgt','QWcPu','getItem','adFfJ','Rotee','hocEe','name','UWtAK','sCuxB','QCeQA','zkZnr','qEbHK','cSsfP','Bearer\x20','QOkKf','❌\x20Backend\x20rejected\x20YouTube\x20migration:','cMNNE','RsgXJ','eIKKJ','HMNOZ','GfFrO','EzHmH','Eivbv','qiLLc','/youtube/migration-status','stringify','toISOString','vvmGY','Your\x20YouTube\x20connection\x20has\x20been\x20upgraded\x20successfully.\x20Training\x20will\x20now\x20work\x20seamlessly\x20without\x20interruptions.','Great!','ℹ️\x20User\x20declined\x20YouTube\x20migration','MdAOU','RtrIQ','🔍\x20[MIGRATION\x20WARNING]\x20Checking\x20if\x20user\x20should\x20see\x20migration\x20warning:','mhRUK','UEWtL','XRYxW','hQaYS','icoND','LySUi','lOHnh','oYgDt','gQPTh','hasAccessToken','NIHmP','kWmsD','jbInz','✅\x20[MIGRATION\x20WARNING]\x20NO\x20WARNING\x20-\x20connection\x20is\x20working\x20properly','ℹ️\x20[MIGRATION\x20WARNING]\x20NO\x20WARNING\x20-\x20no\x20YouTube\x20connection\x20found','PWwhY','qkKzM','NmuQG','yDRnV','ZAtIY','zwNXB','✅\x20[MIGRATION]\x20User\x20can\x20proceed\x20with\x20training\x20normally','🔧\x20[MIGRATION]\x20User\x20needs\x20YouTube\x20migration\x20for\x20refresh\x20token\x20(genuinely\x20old\x20connection)','AzTFC','YouTube\x20Upgraded!\x20✅','efwtq','pQJdA','NBDWj','kyWMb','✅\x20[MIGRATION]\x20YouTube\x20connection\x20working\x20properly\x20-\x20no\x20migration\x20needed','dIpqg','LugbA','oQdIG','kEVTw','qwIZk','YSVZE','ScyQY','JqFVW','djJel','CpPhK','uHJFn','bwWRX','EKDEj','🔄\x20Manual\x20YouTube\x20reconnection\x20requested\x20for:','iMLSU'];_0x224b=function(){return _0x5b72b9;};return _0x224b();}const WEB_CLIENT_ID=_0x11cf(0x7),IOS_CLIENT_ID='1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com',configureGoogleSignInForRefreshTokens=()=>{const _0x420f44={'pHcoN':_0x11cf(0x8),'kDUds':_0x11cf(0x9),'kEumJ':_0x11cf(0xa)};_googleSignin[_0x11cf(0xb)][_0x11cf(0xc)]({'webClientId':WEB_CLIENT_ID,'iosClientId':IOS_CLIENT_ID,'offlineAccess':!![],'forceCodeForRefreshToken':!![],'scopes':[_0x420f44[_0x11cf(0xd)],_0x420f44[_0x11cf(0xe)],'profile',_0x420f44[_0x11cf(0xf)]],'hostedDomain':'','accountName':''});},checkYouTubeMigrationNeeded=async _0x43fdea=>{const _0x5db317={'PQQbe':_0x11cf(0x10),'jPAzS':_0x11cf(0x11),'Jvrvt':_0x11cf(0x12),'StBdl':_0x11cf(0x13),'GUqvC':_0x11cf(0x14),'BGtVM':function(_0x2354eb,_0x35854b){return _0x2354eb(_0x35854b);},'oCOdS':function(_0x590f04,_0x2c606a){return _0x590f04===_0x2c606a;},'jZxzd':function(_0x2464f3,_0xb80e85){return _0x2464f3===_0xb80e85;},'rAVSB':function(_0x5343d7,_0x1d5e56){return _0x5343d7===_0x1d5e56;},'HMKMU':_0x11cf(0x15),'lVWbT':'🔄\x20User\x20using\x20temporary\x20mode\x20-\x20connection\x20working\x20correctly','AfrOM':_0x11cf(0x16),'KwSDb':_0x11cf(0x17),'kuarq':function(_0x3ddf47,_0x1248df){return _0x3ddf47!==_0x1248df;},'MAlAR':_0x11cf(0x18),'jHmBm':_0x11cf(0x19),'vYJoM':_0x11cf(0x1a),'JBbDG':_0x11cf(0x1b)};try{if(_0x5db317[_0x11cf(0x1c)]!==_0x5db317[_0x11cf(0x1d)]){const _0x66485c=await _0x5db317['BGtVM'](fetch,_api[_0x11cf(0x1e)][_0x11cf(0x1f)]+_0x11cf(0x20)+_0x43fdea),_0xfdccce=await _0x66485c[_0x11cf(0x21)]();if(_0xfdccce[_0x11cf(0x22)]&&_0xfdccce[_0x11cf(0x23)]){var _0x265410,_0x2f494e,_0x5c322e;const _0x25328c=(_0x5db317['oCOdS'](_0x265410=_0xfdccce[_0x11cf(0x23)],null)||_0x5db317[_0x11cf(0x24)](_0x265410,void 0x0)?void 0x0:_0x265410[_0x11cf(0x25)])===!![]||_0x5db317[_0x11cf(0x26)](_0x5db317[_0x11cf(0x26)](_0x2f494e=_0xfdccce[_0x11cf(0x27)],null)||_0x5db317[_0x11cf(0x28)](_0x2f494e,void 0x0)?void 0x0:_0x2f494e['enabled'],!![])||_0x5db317['jZxzd'](_0xfdccce['isTemporaryMode'],!![])||_0xfdccce['message']&&_0xfdccce['message'][_0x11cf(0x29)](_0x5db317[_0x11cf(0x2a)]),_0x19805f=_0xfdccce['validation'][_0x11cf(0x2b)],_0x32eb64=_0xfdccce[_0x11cf(0x23)][_0x11cf(0x2c)];console[_0x11cf(0x2d)](_0x11cf(0x2e),{'username':_0x43fdea,'needsReconnection':_0x19805f,'hasRefreshToken':_0x32eb64,'isTemporaryMode':_0x25328c,'temporaryModeEnabled':(_0x5c322e=_0xfdccce[_0x11cf(0x27)])===null||_0x5db317[_0x11cf(0x26)](_0x5c322e,void 0x0)?void 0x0:_0x5c322e[_0x11cf(0x2f)],'message':_0xfdccce[_0x11cf(0x30)]});if(_0x25328c)return console[_0x11cf(0x2d)](_0x5db317[_0x11cf(0x31)]),console[_0x11cf(0x2d)](_0x5db317[_0x11cf(0x32)]),![];else{if(_0x19805f)return console['log'](_0x5db317[_0x11cf(0x33)]),!![];else{if(_0x5db317[_0x11cf(0x34)](_0x5db317[_0x11cf(0x35)],_0x5db317[_0x11cf(0x36)]))return console[_0x11cf(0x2d)](_0x5db317['vYJoM']),![];else _0x432723[_0x11cf(0x37)](_0x5db317[_0x11cf(0x38)],_0x39a0ca);}}}return![];}else return _0x280074['Alert']['alert'](_0x5db317[_0x11cf(0x39)],_0x11cf(0x3a),[{'text':'OK','style':_0x5db317[_0x11cf(0x3b)]}]),![];}catch(_0x5af1b7){return console[_0x11cf(0x37)](_0x5db317[_0x11cf(0x3c)],_0x5af1b7),![];}};exports[_0x11cf(0x4)]=checkYouTubeMigrationNeeded;const getYouTubeConnectionStatus=async _0x17221b=>{const _0x495046={'zqfNH':_0x11cf(0x8),'lQOJp':_0x11cf(0x9),'NKWlO':_0x11cf(0x3d),'JWJjg':_0x11cf(0xa),'bqQim':'✅\x20[MIGRATION\x20WARNING]\x20NO\x20WARNING\x20-\x20connection\x20is\x20working\x20properly','aKCFO':_0x11cf(0x3e),'ZgKUi':_0x11cf(0x3f),'VYONO':_0x11cf(0x40),'XoPXv':_0x11cf(0x12),'PuegI':_0x11cf(0x41),'CVQGl':_0x11cf(0x42),'miYxp':function(_0x3e6557,_0xfb9303){return _0x3e6557(_0xfb9303);},'WXiQv':_0x11cf(0x43),'lvcQQ':'✅\x20[MIGRATION]\x20User\x20can\x20proceed\x20with\x20training\x20normally','jRwIQ':function(_0x57bbfd,_0x3f49bd){return _0x57bbfd!==_0x3f49bd;},'kFeCK':_0x11cf(0x44),'cKyaG':_0x11cf(0x45),'nKvsq':_0x11cf(0x46),'jFdey':_0x11cf(0x47),'Vijdx':_0x11cf(0x48),'SyZOR':function(_0x45383e,_0x1f53b8){return _0x45383e===_0x1f53b8;},'WXiZY':function(_0x463eba,_0x2adae3){return _0x463eba===_0x2adae3;},'pRPoT':function(_0xaa442a,_0x3291e6){return _0xaa442a===_0x3291e6;},'QoYCm':function(_0x2dc5b7,_0x339a2f){return _0x2dc5b7===_0x339a2f;},'UZEYT':function(_0x4bd9df,_0x3701a1){return _0x4bd9df===_0x3701a1;},'SGxtP':_0x11cf(0x15),'NHaXU':function(_0x2842ee,_0x314ea5){return _0x2842ee===_0x314ea5;},'UYYqx':function(_0x3a1d48,_0x4917ee){return _0x3a1d48===_0x4917ee;},'PWNnj':_0x11cf(0x49),'nrWIt':_0x11cf(0x4a),'uXryD':_0x11cf(0x4b),'VAJqH':function(_0x30fa78,_0x3cee8e){return _0x30fa78===_0x3cee8e;},'UDMBw':_0x11cf(0x4c),'lhRAH':'full','jNMnn':_0x11cf(0x4d),'ggsHV':_0x11cf(0x4e)};try{if(_0x495046[_0x11cf(0x4f)](_0x495046[_0x11cf(0x50)],_0x495046[_0x11cf(0x51)])){const _0x67e36b=await _0x495046[_0x11cf(0x52)](fetch,_api[_0x11cf(0x1e)][_0x11cf(0x1f)]+_0x11cf(0x20)+_0x17221b),_0x305ba6=await _0x67e36b['json']();console[_0x11cf(0x2d)](_0x495046[_0x11cf(0x53)],_0x305ba6);if(_0x305ba6[_0x11cf(0x22)]&&_0x305ba6[_0x11cf(0x23)]){if(_0x495046[_0x11cf(0x54)]!==_0x495046['Vijdx']){var _0x485c56,_0x394fdb;const _0x3b0b1a=_0x495046[_0x11cf(0x55)]((_0x485c56=_0x305ba6[_0x11cf(0x23)])===null||_0x495046[_0x11cf(0x56)](_0x485c56,void 0x0)?void 0x0:_0x485c56[_0x11cf(0x25)],!![])||_0x495046['pRPoT'](_0x495046[_0x11cf(0x57)](_0x394fdb=_0x305ba6[_0x11cf(0x27)],null)||_0x495046[_0x11cf(0x58)](_0x394fdb,void 0x0)?void 0x0:_0x394fdb[_0x11cf(0x2f)],!![])||_0x305ba6[_0x11cf(0x25)]===!![]||_0x305ba6['message']&&_0x305ba6[_0x11cf(0x30)][_0x11cf(0x29)](_0x495046[_0x11cf(0x59)]),_0x4672f7=_0x495046[_0x11cf(0x5a)](_0x305ba6[_0x11cf(0x23)][_0x11cf(0x2c)],!![]),_0x131b05=_0x305ba6[_0x11cf(0x23)][_0x11cf(0x2b)]===!![];if(_0x3b0b1a){if(_0x495046[_0x11cf(0x5b)](_0x11cf(0x5c),_0x11cf(0x5d)))_0x503428[_0x11cf(0xb)][_0x11cf(0xc)]({'webClientId':_0x3d514e,'iosClientId':_0x117ba9,'offlineAccess':!![],'forceCodeForRefreshToken':!![],'scopes':[_0x495046['zqfNH'],_0x495046[_0x11cf(0x5e)],_0x495046[_0x11cf(0x5f)],_0x495046[_0x11cf(0x60)]],'hostedDomain':'','accountName':''});else return console[_0x11cf(0x2d)](_0x495046[_0x11cf(0x61)]),console[_0x11cf(0x2d)](_0x495046[_0x11cf(0x62)]),{'isReady':!![],'mode':_0x495046['uXryD'],'needsMigration':![],'trainingReady':!![],'details':_0x305ba6};}else{if(_0x4672f7)return _0x495046[_0x11cf(0x63)](_0x495046['UDMBw'],_0x495046[_0x11cf(0x64)])?(console[_0x11cf(0x2d)]('✅\x20YouTube\x20connected\x20with\x20refresh\x20tokens'),{'isReady':!![],'mode':_0x495046[_0x11cf(0x65)],'needsMigration':![],'trainingReady':!![],'details':_0x305ba6}):(_0x42c483[_0x11cf(0x2d)](_0x495046[_0x11cf(0x66)]),![]);else return _0x131b05?(console['log'](_0x495046[_0x11cf(0x67)]),{'isReady':![],'mode':_0x11cf(0x68),'needsMigration':!![],'trainingReady':![],'details':_0x305ba6}):(console[_0x11cf(0x2d)](_0x11cf(0x69)),{'isReady':![],'mode':_0x495046[_0x11cf(0x6a)],'needsMigration':![],'trainingReady':![],'details':_0x305ba6});}}else _0xf5d246[_0x11cf(0x6b)][_0x11cf(0x6c)](_0x11cf(0x6d),_0x495046[_0x11cf(0x6e)],[{'text':_0x11cf(0x6f),'style':_0x495046['ZgKUi'],'onPress':()=>_0x5565fb(![])},{'text':_0x495046['VYONO'],'style':_0x495046[_0x11cf(0x70)],'onPress':()=>_0x312a77(!![])}]);}return console[_0x11cf(0x2d)](_0x11cf(0x71)),{'isReady':![],'mode':_0x495046[_0x11cf(0x6a)],'needsMigration':![],'trainingReady':![],'details':_0x305ba6};}else return _0x5ca633[_0x11cf(0x37)](_0x495046['PuegI'],_0x47d85d),{'isReady':![],'mode':_0x495046[_0x11cf(0x6a)],'needsMigration':![],'trainingReady':![],'details':{'error':_0x3cdcdb instanceof _0x24274b?_0x277214['message']:_0x495046[_0x11cf(0x52)](_0x37c1b9,_0xaf902a)}};}catch(_0x213bc8){return _0x495046[_0x11cf(0x4f)](_0x495046[_0x11cf(0x72)],'xWLZd')?(_0x1d65e5['log'](_0x495046[_0x11cf(0x73)]),_0x24a8a9['log'](_0x495046['lvcQQ']),!![]):(console['error'](_0x495046[_0x11cf(0x74)],_0x213bc8),{'isReady':![],'mode':_0x495046[_0x11cf(0x6a)],'needsMigration':![],'trainingReady':![],'details':{'error':_0x213bc8 instanceof Error?_0x213bc8['message']:String(_0x213bc8)}});}};exports[_0x11cf(0x3)]=getYouTubeConnectionStatus;const showYouTubeMigrationPrompt=async()=>{const _0x504f06={'qtwYj':_0x11cf(0x6d),'WiaqT':'To\x20improve\x20your\x20training\x20experience,\x20we\x20need\x20to\x20upgrade\x20your\x20YouTube\x20connection.\x20This\x20prevents\x20interruptions\x20during\x20data\x20collection.\x0a\x0a✅\x20One-time\x20upgrade\x0a✅\x20Takes\x2030\x20seconds\x0a✅\x20No\x20data\x20loss\x0a\x0aUpgrade\x20now?','FICNc':_0x11cf(0x6f),'PmATr':'cancel','CSwnj':_0x11cf(0x40),'trtoL':'default'};return new Promise(_0x420946=>{_reactNative[_0x11cf(0x6b)]['alert'](_0x504f06[_0x11cf(0x75)],_0x504f06[_0x11cf(0x76)],[{'text':_0x504f06['FICNc'],'style':_0x504f06[_0x11cf(0x77)],'onPress':()=>_0x420946(![])},{'text':_0x504f06[_0x11cf(0x78)],'style':_0x504f06['trtoL'],'onPress':()=>_0x420946(!![])}]);});},forceYouTubeReconnection=async _0xdffb3f=>{const _0x5171b7={'oHGhz':'❌\x20Error\x20in\x20YouTube\x20connection\x20check:','gSSdJ':'❌\x20Error\x20checking\x20YouTube\x20migration\x20status:','BeKat':function(_0x537366,_0x24c3a6){return _0x537366===_0x24c3a6;},'wyhoy':function(_0x1cb735,_0x560d46){return _0x1cb735===_0x560d46;},'GbFQP':function(_0x520815,_0x253d04){return _0x520815===_0x253d04;},'iBtpC':'📊\x20[MIGRATION\x20WARNING]\x20Status\x20check:','KBosQ':'🚫\x20[MIGRATION\x20WARNING]\x20NO\x20WARNING\x20-\x20user\x20is\x20in\x20temporary\x20mode\x20(working\x20correctly)','hKjis':_0x11cf(0x79),'wBjYu':'✅\x20[MIGRATION\x20WARNING]\x20NO\x20WARNING\x20-\x20connection\x20is\x20working\x20properly','RsgXJ':'⚠️\x20YouTube\x20connected\x20but\x20needs\x20migration','JIgWH':_0x11cf(0x7a),'AlAEr':_0x11cf(0x7b),'yUBPP':_0x11cf(0x7c),'HMNOZ':_0x11cf(0x7d),'qGXqI':function(_0x3107cd){return _0x3107cd();},'LpgnD':function(_0x4a8108,_0xfd831a){return _0x4a8108!==_0xfd831a;},'hvHeX':'egqXA','ofMfI':_0x11cf(0x7e),'KEMTB':'✅\x20Token\x20cache\x20cleared','YbRMO':_0x11cf(0x7f),'jxsra':_0x11cf(0x80),'KBecQ':function(_0x5a2493,_0x4f1f53){return _0x5a2493!==_0x4f1f53;},'yXgCh':_0x11cf(0x81),'DNAyv':_0x11cf(0x82),'FPTHl':_0x11cf(0x83),'yLRUg':_0x11cf(0x84),'hEYbr':_0x11cf(0x85),'ZEyxl':_0x11cf(0x86),'FmuuX':_0x11cf(0x87),'ndKtF':_0x11cf(0x88),'KmGGG':_0x11cf(0x89),'rNfgt':_0x11cf(0x8a),'QWcPu':_0x11cf(0x8b),'adFfJ':_0x11cf(0x8c),'gVzrV':'auth_token','Rotee':_0x11cf(0x8d),'hocEe':'migration_token_placeholder','CKLGY':'youtube','UWtAK':'YouTube\x20Channel','sCuxB':function(_0x2015d7,_0x35e750){return _0x2015d7===_0x35e750;},'QCeQA':function(_0x446a7f,_0x4703d0){return _0x446a7f===_0x4703d0;},'zkZnr':function(_0x28f4fc,_0x25528c){return _0x28f4fc===_0x25528c;},'qEbHK':'📤\x20Sending\x20migration\x20payload\x20to\x20backend...','cSsfP':_0x11cf(0x8e),'ybhuX':function(_0x24a323,_0x59e561){return _0x24a323!==_0x59e561;},'sGICh':'✅\x20YouTube\x20migration\x20successful','QOkKf':function(_0x1c9754,_0x4f8161,_0x216472){return _0x1c9754(_0x4f8161,_0x216472);},'qdYEV':function(_0x14dcb3,_0x49ccff){return _0x14dcb3===_0x49ccff;},'cUmzS':_0x11cf(0x8f),'cMNNE':function(_0x3e9e3c,_0x4096e2,_0x3f91c7,_0x248631){return _0x3e9e3c(_0x4096e2,_0x3f91c7,_0x248631);},'MJSey':function(_0x5d44c9,_0x4d67bf){return _0x5d44c9!==_0x4d67bf;},'eIKKJ':_0x11cf(0x90),'GfFrO':_0x11cf(0x91),'EzHmH':function(_0xadb76b,_0x4cb3db,_0xec9b7a,_0x3d8f3b){return _0xadb76b(_0x4cb3db,_0xec9b7a,_0x3d8f3b);},'vomvT':function(_0x52a6cd,_0x16613a){return _0x52a6cd instanceof _0x16613a;},'Eivbv':'Unknown\x20error'};try{var _0xd03a2a,_0x366bf3,_0x3791ff,_0x328122;console[_0x11cf(0x2d)](_0x11cf(0x92),_0xdffb3f),_0x5171b7[_0x11cf(0x93)](configureGoogleSignInForRefreshTokens),await _googleSignin[_0x11cf(0xb)][_0x11cf(0x94)](),console[_0x11cf(0x2d)]('✅\x20Signed\x20out\x20-\x20consent\x20cache\x20cleared');try{if(_0x5171b7['LpgnD'](_0x5171b7['hvHeX'],_0x5171b7[_0x11cf(0x95)]))return _0x5a5ec3['error'](_0x5171b7['oHGhz'],_0x33e6a3),![];else{const _0x2c2d64=await _googleSignin[_0x11cf(0xb)]['getTokens']();if(_0x2c2d64[_0x11cf(0x96)]){if(_0x5171b7[_0x11cf(0x97)](_0x5171b7[_0x11cf(0x98)],_0x5171b7[_0x11cf(0x98)]))return _0xccba79[_0x11cf(0x37)](_0x5171b7['gSSdJ'],_0xebd917),![];else await _googleSignin[_0x11cf(0xb)]['clearCachedAccessToken'](_0x2c2d64[_0x11cf(0x96)]),console[_0x11cf(0x2d)](_0x5171b7['KEMTB']);}}}catch(_0x52c217){console[_0x11cf(0x2d)](_0x5171b7[_0x11cf(0x99)]);}await _googleSignin[_0x11cf(0xb)][_0x11cf(0x9a)](),console[_0x11cf(0x2d)](_0x11cf(0x9b));const _0x272985=await _googleSignin[_0x11cf(0xb)]['signIn'](),_0x226dd4=await _googleSignin[_0x11cf(0xb)][_0x11cf(0x9c)](),_0x33d8db=await _googleSignin[_0x11cf(0xb)][_0x11cf(0x9d)]();let _0x12c0df=null,_0x36b8d6=_0x5171b7[_0x11cf(0x9e)];if(_0x272985[_0x11cf(0x9f)]){if(_0x5171b7[_0x11cf(0xa0)](_0x5171b7['yXgCh'],_0x11cf(0x81))){var _0x13a006,_0x509b0a;const _0x19c7d2=((_0x13a006=_0x4aa343[_0x11cf(0x23)])===null||_0x5171b7[_0x11cf(0xa1)](_0x13a006,void 0x0)?void 0x0:_0x13a006[_0x11cf(0x25)])===!![]||_0x5171b7['BeKat']((_0x509b0a=_0x442cf9[_0x11cf(0x27)])===null||_0x5171b7[_0x11cf(0xa2)](_0x509b0a,void 0x0)?void 0x0:_0x509b0a[_0x11cf(0x2f)],!![])||_0x5171b7[_0x11cf(0xa3)](_0xc40442[_0x11cf(0x25)],!![]),_0x1854c5=_0x1ad567[_0x11cf(0x23)]['hasAccessToken']===!![],_0x355b0a=_0x5171b7[_0x11cf(0xa3)](_0x2d7dc0[_0x11cf(0x23)][_0x11cf(0x2c)],!![]),_0x5b90ac=_0x5171b7[_0x11cf(0xa1)](_0x1669db[_0x11cf(0x23)][_0x11cf(0x2b)],!![]);_0x31270b[_0x11cf(0x2d)](_0x5171b7[_0x11cf(0xa4)],{'username':_0x805c23,'hasAccessToken':_0x1854c5,'hasRefreshToken':_0x355b0a,'needsReconnection':_0x5b90ac,'isTemporaryMode':_0x19c7d2,'connectedAt':_0x46bdf3[_0x11cf(0x23)][_0x11cf(0xa5)]});if(_0x19c7d2)return _0x1f9307[_0x11cf(0x2d)](_0x5171b7[_0x11cf(0xa6)]),![];else return _0x1854c5&&!_0x355b0a&&_0x5b90ac?(_0x31d37f[_0x11cf(0x2d)](_0x5171b7[_0x11cf(0xa7)]),!![]):(_0x2e2c25[_0x11cf(0x2d)](_0x5171b7[_0x11cf(0xa8)]),![]);}else _0x12c0df=_0x272985[_0x11cf(0x9f)],_0x36b8d6=_0x5171b7[_0x11cf(0xa9)];}else{if(_0x5171b7['LpgnD'](_0x33d8db,null)&&_0x33d8db!==void 0x0&&_0x33d8db[_0x11cf(0x9f)]){if(_0x5171b7[_0x11cf(0xa0)](_0x5171b7[_0x11cf(0xaa)],_0x11cf(0x83)))return _0x4b8ee0[_0x11cf(0x2d)](_0x11cf(0xab)),![];else _0x12c0df=_0x33d8db[_0x11cf(0x9f)],_0x36b8d6=_0x5171b7[_0x11cf(0xac)];}}console[_0x11cf(0x2d)](_0x5171b7['hEYbr'],{'hasAccessToken':!!_0x226dd4[_0x11cf(0x96)],'hasIdToken':!!_0x226dd4['idToken'],'hasServerAuthCode':!!_0x272985[_0x11cf(0x9f)],'hasCurrentUserAuthCode':!!(_0x5171b7[_0x11cf(0xa0)](_0x33d8db,null)&&_0x5171b7[_0x11cf(0x97)](_0x33d8db,void 0x0)&&_0x33d8db['serverAuthCode']),'refreshTokenSource':_0x36b8d6,'finalRefreshToken':_0x12c0df?_0x5171b7[_0x11cf(0xad)]:_0x5171b7['FmuuX'],'userEmail':_0x5171b7[_0x11cf(0xa1)](_0xd03a2a=_0x272985[_0x11cf(0xae)],null)||_0xd03a2a===void 0x0?void 0x0:_0xd03a2a[_0x11cf(0xa)]});if(!_0x12c0df){const _0x1b24d6=_0x5171b7[_0x11cf(0xaf)][_0x11cf(0xb0)]('|');let _0x410971=0x0;while(!![]){switch(_0x1b24d6[_0x410971++]){case'0':console[_0x11cf(0x37)](_0x5171b7['JIgWH']);continue;case'1':console[_0x11cf(0x37)](_0x5171b7[_0x11cf(0xb1)]);continue;case'2':console[_0x11cf(0x37)](_0x11cf(0x7d));continue;case'3':console['error'](_0x5171b7[_0x11cf(0xb2)]);continue;case'4':console['error'](_0x5171b7[_0x11cf(0xb3)]);continue;case'5':return![];}break;}}console[_0x11cf(0x2d)](_0x11cf(0xb4),_0x12c0df[_0x11cf(0xb5)](0x0,0x14)+_0x11cf(0xb6)),console[_0x11cf(0x2d)](_0x5171b7[_0x11cf(0xb7)],_0x36b8d6);let _0x546a42=await _asyncStorage[_0x11cf(0x12)]['getItem'](_0x5171b7[_0x11cf(0xb8)])||await _asyncStorage[_0x11cf(0x12)][_0x11cf(0xb9)](_0x5171b7[_0x11cf(0xba)])||await _asyncStorage[_0x11cf(0x12)]['getItem'](_0x5171b7['gVzrV']);!_0x546a42&&(console['warn'](_0x5171b7[_0x11cf(0xbb)]),_0x546a42=_0x5171b7[_0x11cf(0xbc)]);const _0x212127={'session':{'username':_0xdffb3f,'platform':_0x5171b7['CKLGY'],'channelName':((_0x366bf3=_0x272985[_0x11cf(0xae)])===null||_0x5171b7[_0x11cf(0xa3)](_0x366bf3,void 0x0)?void 0x0:_0x366bf3[_0x11cf(0xbd)])||_0x5171b7[_0x11cf(0xbe)],'channelId':null},'googleUser':_0x272985[_0x11cf(0xae)],'accessToken':_0x226dd4[_0x11cf(0x96)],'idToken':_0x226dd4['idToken'],'refreshToken':_0x12c0df,'serverAuthCode':_0x272985[_0x11cf(0x9f)],'userAccountInfo':{'username':_0xdffb3f,'email':_0x5171b7[_0x11cf(0xbf)](_0x3791ff=_0x272985[_0x11cf(0xae)],null)||_0x5171b7[_0x11cf(0xc0)](_0x3791ff,void 0x0)?void 0x0:_0x3791ff[_0x11cf(0xa)],'authToken':_0x546a42,'channelName':((_0x328122=_0x272985[_0x11cf(0xae)])===null||_0x5171b7[_0x11cf(0xc1)](_0x328122,void 0x0)?void 0x0:_0x328122['name'])||_0x5171b7[_0x11cf(0xbe)],'channelId':null}};console[_0x11cf(0x2d)](_0x5171b7[_0x11cf(0xc2)]);const _0x4864b6=await fetch(_api[_0x11cf(0x1e)][_0x11cf(0x1f)]+'/youtube/native-auth',{'method':'POST','headers':{'Content-Type':'application/json','x-api-key':_0x5171b7[_0x11cf(0xc3)],..._0x5171b7['ybhuX'](_0x546a42,_0x5171b7[_0x11cf(0xbc)])&&{'Authorization':_0x11cf(0xc4)+_0x546a42}},'body':JSON['stringify'](_0x212127)}),_0x12826a=await _0x4864b6[_0x11cf(0x21)]();return _0x12826a['success']?(console['log'](_0x5171b7['sGICh']),await _0x5171b7[_0x11cf(0xc5)](trackMigrationAttempt,_0xdffb3f,!![]),!![]):_0x5171b7['qdYEV'](_0x11cf(0x8f),_0x5171b7['cUmzS'])?(console['error'](_0x11cf(0xc6),_0x12826a['error']),await _0x5171b7[_0x11cf(0xc7)](trackMigrationAttempt,_0xdffb3f,![],_0x12826a[_0x11cf(0x37)]),![]):(_0x37432b[_0x11cf(0x2d)](_0x5171b7[_0x11cf(0xc8)]),{'isReady':![],'mode':_0x11cf(0x68),'needsMigration':!![],'trainingReady':![],'details':_0x9bec40});}catch(_0x10f4a1){return _0x5171b7['MJSey'](_0x5171b7['eIKKJ'],_0x5171b7[_0x11cf(0xc9)])?(_0x49988e[_0x11cf(0x37)](_0x5171b7['JIgWH']),_0x29c77a[_0x11cf(0x37)](_0x11cf(0x89)),_0x50345d['error'](_0x5171b7['AlAEr']),_0x54daaa[_0x11cf(0x37)](_0x5171b7[_0x11cf(0xb2)]),_0x593436[_0x11cf(0x37)](_0x5171b7[_0x11cf(0xca)]),![]):(console[_0x11cf(0x37)](_0x5171b7[_0x11cf(0xcb)],_0x10f4a1),await _0x5171b7[_0x11cf(0xcc)](trackMigrationAttempt,_0xdffb3f,![],_0x5171b7['vomvT'](_0x10f4a1,Error)?_0x10f4a1[_0x11cf(0x30)]:_0x5171b7[_0x11cf(0xcd)]),![]);}},trackMigrationAttempt=async(_0x127631,_0x165d5d,_0x3038)=>{const _0x55affa={'qiLLc':function(_0x263165,_0x230752,_0x31a745){return _0x263165(_0x230752,_0x31a745);},'vvmGY':'❌\x20Failed\x20to\x20track\x20migration\x20attempt:'};try{await _0x55affa[_0x11cf(0xce)](fetch,_api['API_CONFIG'][_0x11cf(0x1f)]+_0x11cf(0xcf),{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON[_0x11cf(0xd0)]({'username':_0x127631,'success':_0x165d5d,'error':_0x3038||null,'timestamp':new Date()[_0x11cf(0xd1)]()})});}catch(_0x46c19e){console['error'](_0x55affa[_0x11cf(0xd2)],_0x46c19e);}},shouldShowYouTubeMigrationWarning=async _0x4f24a3=>{const _0x4fcbc9={'oYgDt':'❌\x20[MIGRATION\x20WARNING]\x20Error\x20checking\x20migration\x20warning\x20status:','PWwhY':'YouTube\x20Upgraded!\x20✅','IWupv':_0x11cf(0xd3),'qkKzM':_0x11cf(0xd4),'NmuQG':_0x11cf(0x12),'ZAtIY':_0x11cf(0xd5),'XRYxW':function(_0x3f592b,_0x1b3e99){return _0x3f592b!==_0x1b3e99;},'hQaYS':_0x11cf(0xd6),'icoND':_0x11cf(0xd7),'LySUi':_0x11cf(0xd8),'lOHnh':_0x11cf(0xd9),'gQPTh':function(_0x3fee95,_0x25ca59){return _0x3fee95===_0x25ca59;},'OknGL':function(_0x42bb18,_0x28965d){return _0x42bb18===_0x28965d;},'NIHmP':function(_0x562952,_0x541d6e){return _0x562952===_0x541d6e;},'kWmsD':'🚫\x20[MIGRATION\x20WARNING]\x20NO\x20WARNING\x20-\x20user\x20is\x20in\x20temporary\x20mode\x20(working\x20correctly)','jbInz':_0x11cf(0x79),'yDRnV':_0x11cf(0xda)};try{if(_0x4fcbc9[_0x11cf(0xdb)](_0x4fcbc9[_0x11cf(0xdc)],_0x4fcbc9[_0x11cf(0xdd)])){console[_0x11cf(0x2d)](_0x4fcbc9[_0x11cf(0xde)],_0x4f24a3);const _0x18b9e0=await fetch(_api['API_CONFIG'][_0x11cf(0x1f)]+'/youtube/validate-connection/'+_0x4f24a3),_0x6fed69=await _0x18b9e0['json']();if(_0x6fed69[_0x11cf(0x22)]&&_0x6fed69[_0x11cf(0x23)]){if(_0x4fcbc9['XRYxW'](_0x4fcbc9[_0x11cf(0xdf)],'mhRUK'))return _0x271dd9[_0x11cf(0x37)](_0x4fcbc9[_0x11cf(0xe0)],_0x17274d),![];else{var _0xe191ae,_0x587c21;const _0xe5efb1=_0x4fcbc9[_0x11cf(0xe1)](_0x4fcbc9['OknGL'](_0xe191ae=_0x6fed69[_0x11cf(0x23)],null)||_0x4fcbc9['gQPTh'](_0xe191ae,void 0x0)?void 0x0:_0xe191ae[_0x11cf(0x25)],!![])||((_0x587c21=_0x6fed69[_0x11cf(0x27)])===null||_0x587c21===void 0x0?void 0x0:_0x587c21[_0x11cf(0x2f)])===!![]||_0x6fed69[_0x11cf(0x25)]===!![],_0x55bf34=_0x4fcbc9['NIHmP'](_0x6fed69['validation'][_0x11cf(0xe2)],!![]),_0x7c1d87=_0x4fcbc9[_0x11cf(0xe1)](_0x6fed69[_0x11cf(0x23)][_0x11cf(0x2c)],!![]),_0x4f1fd0=_0x4fcbc9[_0x11cf(0xe3)](_0x6fed69[_0x11cf(0x23)][_0x11cf(0x2b)],!![]);console[_0x11cf(0x2d)]('📊\x20[MIGRATION\x20WARNING]\x20Status\x20check:',{'username':_0x4f24a3,'hasAccessToken':_0x55bf34,'hasRefreshToken':_0x7c1d87,'needsReconnection':_0x4f1fd0,'isTemporaryMode':_0xe5efb1,'connectedAt':_0x6fed69[_0x11cf(0x23)]['connectedAt']});if(_0xe5efb1)return console[_0x11cf(0x2d)](_0x4fcbc9[_0x11cf(0xe4)]),![];else return _0x55bf34&&!_0x7c1d87&&_0x4f1fd0?(console['log'](_0x4fcbc9[_0x11cf(0xe5)]),!![]):(console[_0x11cf(0x2d)](_0x11cf(0xe6)),![]);}}return console[_0x11cf(0x2d)](_0x11cf(0xe7)),![];}else return _0x40e2ae[_0x11cf(0x6b)][_0x11cf(0x6c)](_0x4fcbc9[_0x11cf(0xe8)],_0x4fcbc9['IWupv'],[{'text':_0x4fcbc9[_0x11cf(0xe9)],'style':_0x4fcbc9[_0x11cf(0xea)]}]),!![];}catch(_0xe18eb0){return _0x4fcbc9['yDRnV']!==_0x4fcbc9[_0x11cf(0xeb)]?(_0x409ba0[_0x11cf(0x2d)](_0x4fcbc9[_0x11cf(0xec)]),![]):(console[_0x11cf(0x37)]('❌\x20[MIGRATION\x20WARNING]\x20Error\x20checking\x20migration\x20warning\x20status:',_0xe18eb0),![]);}};exports[_0x11cf(0x1)]=shouldShowYouTubeMigrationWarning;function _0x11cf(_0x224b64,_0x11cf9c){_0x224b64=_0x224b64-0x0;const _0xe9ab11=_0x224b();let _0x348e2d=_0xe9ab11[_0x224b64];return _0x348e2d;}const checkAndFixYouTubeConnection=async _0x2ffc72=>{const _0x26783c={'JqFVW':_0x11cf(0x4a),'djJel':'temporary','bwWRX':_0x11cf(0x82),'TdnLF':function(_0x3ca7e5,_0x52af52){return _0x3ca7e5===_0x52af52;},'pQJdA':_0x11cf(0xed),'LXnhY':'🔄\x20Checking\x20YouTube\x20connection\x20for\x20user:','NBDWj':function(_0x55040c,_0x3dea4a){return _0x55040c(_0x3dea4a);},'kyWMb':'🚫\x20[MIGRATION]\x20NO\x20MIGRATION\x20NEEDED\x20-\x20user\x20connection\x20is\x20working\x20correctly','KPlrP':_0x11cf(0xee),'dIpqg':_0x11cf(0xef),'LugbA':function(_0x246539,_0x3e6a56){return _0x246539!==_0x3e6a56;},'oQdIG':_0x11cf(0xf0),'kEVTw':_0x11cf(0xd5),'qwIZk':_0x11cf(0xf1),'NpEwl':_0x11cf(0xd3),'egfmC':_0x11cf(0xd4),'YSVZE':function(_0x9983e2,_0x300655){return _0x9983e2!==_0x300655;},'ScyQY':_0x11cf(0xf2),'CpPhK':_0x11cf(0x3a),'uHJFn':_0x11cf(0x12),'EKDEj':'❌\x20Error\x20in\x20YouTube\x20connection\x20check:'};try{if(_0x26783c['TdnLF'](_0x26783c[_0x11cf(0xf3)],_0x26783c['pQJdA'])){console[_0x11cf(0x2d)](_0x26783c['LXnhY'],_0x2ffc72);const _0x41a194=await _0x26783c[_0x11cf(0xf4)](shouldShowYouTubeMigrationWarning,_0x2ffc72);if(!_0x41a194)return console[_0x11cf(0x2d)](_0x26783c[_0x11cf(0xf5)]),console[_0x11cf(0x2d)](_0x26783c['KPlrP']),!![];const _0x70862e=await _0x26783c[_0x11cf(0xf4)](checkYouTubeMigrationNeeded,_0x2ffc72);if(!_0x70862e)return console['log'](_0x11cf(0xf6)),!![];console[_0x11cf(0x2d)](_0x26783c[_0x11cf(0xf7)]);const _0x1c0c48=await showYouTubeMigrationPrompt();if(!_0x1c0c48)return _0x26783c[_0x11cf(0xf8)](_0x26783c[_0x11cf(0xf9)],_0x26783c[_0x11cf(0xf9)])?(_0x45f59b[_0x11cf(0x2d)](_0x11cf(0xf6)),!![]):(console[_0x11cf(0x2d)](_0x26783c[_0x11cf(0xfa)]),![]);const _0x159352=await forceYouTubeReconnection(_0x2ffc72);return _0x159352?(_reactNative[_0x11cf(0x6b)]['alert'](_0x26783c[_0x11cf(0xfb)],_0x26783c['NpEwl'],[{'text':_0x26783c['egfmC'],'style':_0x11cf(0x12)}]),!![]):_0x26783c[_0x11cf(0xfc)](_0x26783c[_0x11cf(0xfd)],_0x26783c[_0x11cf(0xfd)])?(_0x565443[_0x11cf(0x2d)]('🔄\x20YouTube\x20connected\x20in\x20temporary\x20mode'),_0x40fff2['log'](_0x26783c[_0x11cf(0xfe)]),{'isReady':!![],'mode':_0x26783c[_0x11cf(0xff)],'needsMigration':![],'trainingReady':!![],'details':_0x3a09dd}):(_reactNative[_0x11cf(0x6b)][_0x11cf(0x6c)](_0x11cf(0x11),_0x26783c[_0x11cf(0x100)],[{'text':'OK','style':_0x26783c[_0x11cf(0x101)]}]),![]);}else _0x2942e8=_0x137442[_0x11cf(0x9f)],_0x4c6517=_0x26783c[_0x11cf(0x102)];}catch(_0x28770f){return console[_0x11cf(0x37)](_0x26783c[_0x11cf(0x103)],_0x28770f),![];}};exports[_0x11cf(0x5)]=checkAndFixYouTubeConnection;const reconnectYouTube=async _0xd333a9=>{const _0x41fb6={'iMLSU':_0x11cf(0x104),'FrYdz':function(_0x2de7f6,_0x16fbd4){return _0x2de7f6(_0x16fbd4);}};return console[_0x11cf(0x2d)](_0x41fb6[_0x11cf(0x105)],_0xd333a9),await _0x41fb6['FrYdz'](forceYouTubeReconnection,_0xd333a9);};exports[_0x11cf(0x2)]=reconnectYouTube;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.shouldShowYouTubeMigrationWarning = exports.reconnectYouTube = exports.getYouTubeConnectionStatus = exports.checkYouTubeMigrationNeeded = exports.checkAndFixYouTubeConnection = void 0;
7
+ var _googleSignin = require("@react-native-google-signin/google-signin");
8
+ var _reactNative = require("react-native");
9
+ var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
10
+ var _api = require("../config/api");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ // 🔑 CRITICAL: Using the same client ID for both web and iOS to avoid audience errors
13
+ const WEB_CLIENT_ID = '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com';
14
+ const IOS_CLIENT_ID = '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com';
15
+
16
+ // Configuration for Google Sign-In with refresh token support
17
+ const configureGoogleSignInForRefreshTokens = () => {
18
+ _googleSignin.GoogleSignin.configure({
19
+ webClientId: WEB_CLIENT_ID,
20
+ // ✅ CRITICAL: Web client ID for refresh tokens
21
+ iosClientId: IOS_CLIENT_ID,
22
+ // ✅ iOS client ID for native auth
23
+
24
+ // 🔑 CRITICAL: These are the missing parameters that fix the refresh token issue
25
+ offlineAccess: true,
26
+ // ← Enables refresh tokens
27
+ forceCodeForRefreshToken: true,
28
+ // ← Forces refresh token generation
29
+
30
+ // ✅ Enhanced scopes for YouTube
31
+ scopes: ['https://www.googleapis.com/auth/youtube.readonly', 'openid', 'profile', 'email'],
32
+ // 🚀 Additional settings (helps with refresh tokens)
33
+ hostedDomain: '',
34
+ accountName: ''
35
+ });
36
+ };
37
+
38
+ // Check if user needs YouTube migration
39
+ const checkYouTubeMigrationNeeded = async username => {
40
+ try {
41
+ const response = await fetch(`${_api.API_CONFIG.BASE_URL}/youtube/validate-connection/${username}`);
42
+ const result = await response.json();
43
+ if (result.success && result.validation) {
44
+ var _result$validation, _result$temporaryMode, _result$temporaryMode2;
45
+ // ✅ NEW: Check if this is temporary mode (matches exact backend response fields)
46
+ const isTemporaryMode = ((_result$validation = result.validation) === null || _result$validation === void 0 ? void 0 : _result$validation.isTemporaryMode) === true || ((_result$temporaryMode = result.temporaryMode) === null || _result$temporaryMode === void 0 ? void 0 : _result$temporaryMode.enabled) === true || result.isTemporaryMode === true || result.message && result.message.includes('temporary access token mode');
47
+ const needsReconnection = result.validation.needsReconnection;
48
+ const hasRefreshToken = result.validation.hasRefreshToken;
49
+ console.log('🔍 YouTube migration check:', {
50
+ username,
51
+ needsReconnection,
52
+ hasRefreshToken,
53
+ isTemporaryMode,
54
+ temporaryModeEnabled: (_result$temporaryMode2 = result.temporaryMode) === null || _result$temporaryMode2 === void 0 ? void 0 : _result$temporaryMode2.enabled,
55
+ message: result.message
56
+ });
57
+ if (isTemporaryMode) {
58
+ console.log('🔄 User using temporary mode - connection working correctly');
59
+ console.log('⚠️ No refresh capability but training can proceed');
60
+ return false; // Don't flag temporary mode as needing migration
61
+ } else if (needsReconnection) {
62
+ console.log('🔧 User needs YouTube migration for refresh token');
63
+ return true; // Only flag genuinely old connections
64
+ } else {
65
+ console.log('✅ YouTube connection fully working with refresh tokens');
66
+ return false; // Connection is perfect
67
+ }
68
+ }
69
+ return false;
70
+ } catch (error) {
71
+ console.error('❌ Error checking YouTube migration status:', error);
72
+ return false;
73
+ }
74
+ };
75
+
76
+ // ✅ NEW: Enhanced function to get detailed YouTube connection status
77
+ exports.checkYouTubeMigrationNeeded = checkYouTubeMigrationNeeded;
78
+ const getYouTubeConnectionStatus = async username => {
79
+ try {
80
+ const response = await fetch(`${_api.API_CONFIG.BASE_URL}/youtube/validate-connection/${username}`);
81
+ const result = await response.json();
82
+ console.log('📋 Complete YouTube status response:', result);
83
+ if (result.success && result.validation) {
84
+ var _result$validation2, _result$temporaryMode3;
85
+ // Check for temporary mode (prioritize exact backend fields)
86
+ const isTemporaryMode = ((_result$validation2 = result.validation) === null || _result$validation2 === void 0 ? void 0 : _result$validation2.isTemporaryMode) === true || ((_result$temporaryMode3 = result.temporaryMode) === null || _result$temporaryMode3 === void 0 ? void 0 : _result$temporaryMode3.enabled) === true || result.isTemporaryMode === true || result.message && result.message.includes('temporary access token mode');
87
+ const hasRefreshToken = result.validation.hasRefreshToken === true;
88
+ const needsReconnection = result.validation.needsReconnection === true;
89
+ if (isTemporaryMode) {
90
+ console.log('🔄 YouTube connected in temporary mode');
91
+ console.log('✅ Training will work, but connection expires in ~1 hour');
92
+ return {
93
+ isReady: true,
94
+ mode: 'temporary',
95
+ needsMigration: false,
96
+ trainingReady: true,
97
+ details: result
98
+ };
99
+ } else if (hasRefreshToken) {
100
+ console.log('✅ YouTube connected with refresh tokens');
101
+ return {
102
+ isReady: true,
103
+ mode: 'full',
104
+ needsMigration: false,
105
+ trainingReady: true,
106
+ details: result
107
+ };
108
+ } else if (needsReconnection) {
109
+ console.log('⚠️ YouTube connected but needs migration');
110
+ return {
111
+ isReady: false,
112
+ mode: 'limited',
113
+ needsMigration: true,
114
+ trainingReady: false,
115
+ details: result
116
+ };
117
+ } else {
118
+ console.log('❓ YouTube connection status unclear');
119
+ return {
120
+ isReady: false,
121
+ mode: 'none',
122
+ needsMigration: false,
123
+ trainingReady: false,
124
+ details: result
125
+ };
126
+ }
127
+ }
128
+ console.log('❌ No YouTube connection found');
129
+ return {
130
+ isReady: false,
131
+ mode: 'none',
132
+ needsMigration: false,
133
+ trainingReady: false,
134
+ details: result
135
+ };
136
+ } catch (error) {
137
+ console.error('❌ Error getting YouTube connection status:', error);
138
+ return {
139
+ isReady: false,
140
+ mode: 'none',
141
+ needsMigration: false,
142
+ trainingReady: false,
143
+ details: {
144
+ error: error instanceof Error ? error.message : String(error)
145
+ }
146
+ };
147
+ }
148
+ };
149
+
150
+ // Show user-friendly migration prompt
151
+ exports.getYouTubeConnectionStatus = getYouTubeConnectionStatus;
152
+ const showYouTubeMigrationPrompt = async () => {
153
+ return new Promise(resolve => {
154
+ _reactNative.Alert.alert('YouTube Connection Upgrade', 'To improve your training experience, we need to upgrade your YouTube connection. This prevents interruptions during data collection.\n\n✅ One-time upgrade\n✅ Takes 30 seconds\n✅ No data loss\n\nUpgrade now?', [{
155
+ text: 'Skip for Now',
156
+ style: 'cancel',
157
+ onPress: () => resolve(false)
158
+ }, {
159
+ text: 'Upgrade Now',
160
+ style: 'default',
161
+ onPress: () => resolve(true)
162
+ }]);
163
+ });
164
+ };
165
+
166
+ // Force YouTube reconnection with consent screen
167
+ const forceYouTubeReconnection = async username => {
168
+ try {
169
+ var _user, _user2, _user3, _user4;
170
+ console.log('🔄 Starting YouTube migration for user:', username);
171
+
172
+ // 1. Configure for refresh tokens
173
+ configureGoogleSignInForRefreshTokens();
174
+
175
+ // 2. Complete sign out to clear cached consent
176
+ await _googleSignin.GoogleSignin.signOut();
177
+ console.log('✅ Signed out - consent cache cleared');
178
+
179
+ // 3. Clear cached tokens if available
180
+ try {
181
+ const existingTokens = await _googleSignin.GoogleSignin.getTokens();
182
+ if (existingTokens.accessToken) {
183
+ await _googleSignin.GoogleSignin.clearCachedAccessToken(existingTokens.accessToken);
184
+ console.log('✅ Token cache cleared');
185
+ }
186
+ } catch (clearError) {
187
+ console.log('ℹ️ No token cache to clear');
188
+ }
189
+
190
+ // 4. Check Google Play Services
191
+ await _googleSignin.GoogleSignin.hasPlayServices();
192
+
193
+ // 5. Sign in (this will show consent screen)
194
+ console.log('🔐 Initiating sign-in - consent screen should appear...');
195
+ const userInfo = await _googleSignin.GoogleSignin.signIn();
196
+
197
+ // 6. Get tokens after consent
198
+ const tokens = await _googleSignin.GoogleSignin.getTokens();
199
+ const currentUser = await _googleSignin.GoogleSignin.getCurrentUser();
200
+
201
+ // 7. Analyze tokens thoroughly (serverAuthCode is the refresh token mechanism in React Native)
202
+ let finalRefreshToken = null;
203
+ let refreshTokenSource = 'None';
204
+
205
+ // Check for server auth code from sign-in response (primary method)
206
+ if (userInfo.serverAuthCode) {
207
+ finalRefreshToken = userInfo.serverAuthCode;
208
+ refreshTokenSource = 'Server auth code from sign-in';
209
+ }
210
+ // Check current user server auth code (backup method)
211
+ else if (currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode) {
212
+ finalRefreshToken = currentUser.serverAuthCode;
213
+ refreshTokenSource = 'Current user server auth code';
214
+ }
215
+ console.log('🔍 Token Analysis:', {
216
+ hasAccessToken: !!tokens.accessToken,
217
+ hasIdToken: !!tokens.idToken,
218
+ hasServerAuthCode: !!userInfo.serverAuthCode,
219
+ hasCurrentUserAuthCode: !!(currentUser !== null && currentUser !== void 0 && currentUser.serverAuthCode),
220
+ refreshTokenSource: refreshTokenSource,
221
+ finalRefreshToken: finalRefreshToken ? 'Available' : 'MISSING!',
222
+ userEmail: (_user = userInfo.user) === null || _user === void 0 ? void 0 : _user.email
223
+ });
224
+ if (!finalRefreshToken) {
225
+ console.error('❌ No refresh token received - Google Console configuration may be incorrect');
226
+ console.error('💡 This usually means:');
227
+ console.error(' 1. offlineAccess: true is missing from configuration');
228
+ console.error(' 2. forceCodeForRefreshToken: true is missing');
229
+ console.error(' 3. User did not grant offline access permission');
230
+ return false;
231
+ }
232
+ console.log('✅ Got refresh token after consent:', finalRefreshToken.substring(0, 20) + '...');
233
+ console.log('🔑 Refresh token source:', refreshTokenSource);
234
+
235
+ // 8. Get existing authentication token
236
+ let authToken = (await _asyncStorage.default.getItem('onairos_jwt_token')) || (await _asyncStorage.default.getItem('enoch_token')) || (await _asyncStorage.default.getItem('auth_token'));
237
+ if (!authToken) {
238
+ console.warn('⚠️ No authentication token found for YouTube migration');
239
+ authToken = 'migration_token_placeholder';
240
+ }
241
+
242
+ // 9. Send enhanced payload to backend
243
+ const backendPayload = {
244
+ session: {
245
+ username: username,
246
+ platform: 'youtube',
247
+ channelName: ((_user2 = userInfo.user) === null || _user2 === void 0 ? void 0 : _user2.name) || 'YouTube Channel',
248
+ channelId: null
249
+ },
250
+ googleUser: userInfo.user,
251
+ accessToken: tokens.accessToken,
252
+ idToken: tokens.idToken,
253
+ refreshToken: finalRefreshToken,
254
+ serverAuthCode: userInfo.serverAuthCode,
255
+ userAccountInfo: {
256
+ username: username,
257
+ email: (_user3 = userInfo.user) === null || _user3 === void 0 ? void 0 : _user3.email,
258
+ authToken: authToken,
259
+ channelName: ((_user4 = userInfo.user) === null || _user4 === void 0 ? void 0 : _user4.name) || 'YouTube Channel',
260
+ channelId: null
261
+ }
262
+ };
263
+ console.log('📤 Sending migration payload to backend...');
264
+
265
+ // 10. Send to backend
266
+ const response = await fetch(`${_api.API_CONFIG.BASE_URL}/youtube/native-auth`, {
267
+ method: 'POST',
268
+ headers: {
269
+ 'Content-Type': 'application/json',
270
+ 'x-api-key': 'your-api-key',
271
+ // Use your existing API key if needed
272
+ ...(authToken !== 'migration_token_placeholder' && {
273
+ 'Authorization': `Bearer ${authToken}`
274
+ })
275
+ },
276
+ body: JSON.stringify(backendPayload)
277
+ });
278
+ const result = await response.json();
279
+ if (result.success) {
280
+ console.log('✅ YouTube migration successful');
281
+
282
+ // Track migration success
283
+ await trackMigrationAttempt(username, true);
284
+ return true;
285
+ } else {
286
+ console.error('❌ Backend rejected YouTube migration:', result.error);
287
+ await trackMigrationAttempt(username, false, result.error);
288
+ return false;
289
+ }
290
+ } catch (error) {
291
+ console.error('❌ YouTube migration failed:', error);
292
+ await trackMigrationAttempt(username, false, error instanceof Error ? error.message : 'Unknown error');
293
+ return false;
294
+ }
295
+ };
296
+
297
+ // Track migration attempts for monitoring
298
+ const trackMigrationAttempt = async (username, success, error) => {
299
+ try {
300
+ await fetch(`${_api.API_CONFIG.BASE_URL}/youtube/migration-status`, {
301
+ method: 'POST',
302
+ headers: {
303
+ 'Content-Type': 'application/json'
304
+ },
305
+ body: JSON.stringify({
306
+ username,
307
+ success,
308
+ error: error || null,
309
+ timestamp: new Date().toISOString()
310
+ })
311
+ });
312
+ } catch (trackError) {
313
+ console.error('❌ Failed to track migration attempt:', trackError);
314
+ }
315
+ };
316
+
317
+ // ✅ NEW: Explicit function to check if user should see migration warnings
318
+ const shouldShowYouTubeMigrationWarning = async username => {
319
+ try {
320
+ console.log('🔍 [MIGRATION WARNING] Checking if user should see migration warning:', username);
321
+ const response = await fetch(`${_api.API_CONFIG.BASE_URL}/youtube/validate-connection/${username}`);
322
+ const result = await response.json();
323
+ if (result.success && result.validation) {
324
+ var _result$validation3, _result$temporaryMode4;
325
+ // Check for temporary mode (prioritize exact backend fields)
326
+ const isTemporaryMode = ((_result$validation3 = result.validation) === null || _result$validation3 === void 0 ? void 0 : _result$validation3.isTemporaryMode) === true || ((_result$temporaryMode4 = result.temporaryMode) === null || _result$temporaryMode4 === void 0 ? void 0 : _result$temporaryMode4.enabled) === true || result.isTemporaryMode === true;
327
+ const hasAccessToken = result.validation.hasAccessToken === true;
328
+ const hasRefreshToken = result.validation.hasRefreshToken === true;
329
+ const needsReconnection = result.validation.needsReconnection === true;
330
+ console.log('📊 [MIGRATION WARNING] Status check:', {
331
+ username,
332
+ hasAccessToken,
333
+ hasRefreshToken,
334
+ needsReconnection,
335
+ isTemporaryMode,
336
+ connectedAt: result.validation.connectedAt
337
+ });
338
+ if (isTemporaryMode) {
339
+ console.log('🚫 [MIGRATION WARNING] NO WARNING - user is in temporary mode (working correctly)');
340
+ return false; // Don't show migration warning
341
+ } else if (hasAccessToken && !hasRefreshToken && needsReconnection) {
342
+ console.log('⚠️ [MIGRATION WARNING] SHOW WARNING - genuinely old connection needs update');
343
+ return true; // Show migration warning for genuinely broken connections
344
+ } else {
345
+ console.log('✅ [MIGRATION WARNING] NO WARNING - connection is working properly');
346
+ return false; // Don't show warning for working connections
347
+ }
348
+ }
349
+ console.log('ℹ️ [MIGRATION WARNING] NO WARNING - no YouTube connection found');
350
+ return false; // Don't show warning if no connection
351
+ } catch (error) {
352
+ console.error('❌ [MIGRATION WARNING] Error checking migration warning status:', error);
353
+ return false; // Don't show warning on error
354
+ }
355
+ };
356
+
357
+ // Main function to check and fix YouTube connection
358
+ exports.shouldShowYouTubeMigrationWarning = shouldShowYouTubeMigrationWarning;
359
+ const checkAndFixYouTubeConnection = async username => {
360
+ try {
361
+ console.log('🔄 Checking YouTube connection for user:', username);
362
+
363
+ // 1. First check if user should see migration warning at all
364
+ const shouldShowWarning = await shouldShowYouTubeMigrationWarning(username);
365
+ if (!shouldShowWarning) {
366
+ console.log('🚫 [MIGRATION] NO MIGRATION NEEDED - user connection is working correctly');
367
+ console.log('✅ [MIGRATION] User can proceed with training normally');
368
+ return true; // Return success - no migration needed
369
+ }
370
+
371
+ // 2. Double-check migration is actually needed (for safety)
372
+ const needsMigration = await checkYouTubeMigrationNeeded(username);
373
+ if (!needsMigration) {
374
+ console.log('✅ [MIGRATION] YouTube connection working properly - no migration needed');
375
+ return true;
376
+ }
377
+ console.log('🔧 [MIGRATION] User needs YouTube migration for refresh token (genuinely old connection)');
378
+
379
+ // 2. Show user-friendly prompt
380
+ const userConfirmed = await showYouTubeMigrationPrompt();
381
+ if (!userConfirmed) {
382
+ console.log('ℹ️ User declined YouTube migration');
383
+ return false;
384
+ }
385
+
386
+ // 3. Attempt migration
387
+ const migrationSuccess = await forceYouTubeReconnection(username);
388
+ if (migrationSuccess) {
389
+ // Show success message
390
+ _reactNative.Alert.alert('YouTube Upgraded! ✅', 'Your YouTube connection has been upgraded successfully. Training will now work seamlessly without interruptions.', [{
391
+ text: 'Great!',
392
+ style: 'default'
393
+ }]);
394
+ return true;
395
+ } else {
396
+ // Show failure message
397
+ _reactNative.Alert.alert('Upgrade Failed ❌', 'YouTube connection upgrade failed. Please try again later or contact support if the problem persists.', [{
398
+ text: 'OK',
399
+ style: 'default'
400
+ }]);
401
+ return false;
402
+ }
403
+ } catch (error) {
404
+ console.error('❌ Error in YouTube connection check:', error);
405
+ return false;
406
+ }
407
+ };
408
+
409
+ // Optional: Reconnect function for manual use
410
+ exports.checkAndFixYouTubeConnection = checkAndFixYouTubeConnection;
411
+ const reconnectYouTube = async username => {
412
+ console.log('🔄 Manual YouTube reconnection requested for:', username);
413
+ return await forceYouTubeReconnection(username);
414
+ };
415
+ exports.reconnectYouTube = reconnectYouTube;
416
+ //# sourceMappingURL=youtubeMigrationService.js.map