@onairos/react-native 3.4.0 → 3.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (546) hide show
  1. package/README.md +62 -13
  2. package/lib/commonjs/api/index.js +9 -145
  3. package/lib/commonjs/assets/animations/loaderani.json +1 -0
  4. package/lib/commonjs/assets/animations/persona-animation.json +1 -0
  5. package/lib/commonjs/assets/fonts/EBGaramond-VariableFont_wght.ttf +0 -0
  6. package/lib/commonjs/assets/fonts/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
  7. package/lib/commonjs/assets/icons/Facebookicon.png +0 -0
  8. package/lib/commonjs/assets/icons/Gmail.png +0 -0
  9. package/lib/commonjs/assets/icons/Linkedinicon.png +0 -0
  10. package/lib/commonjs/assets/icons/Redditicon.png +0 -0
  11. package/lib/commonjs/assets/icons/YouTubeicon2.png +0 -0
  12. package/lib/commonjs/assets/icons/YouTubeicon3.png +0 -0
  13. package/lib/commonjs/assets/icons/chatgpt.png +0 -0
  14. package/lib/commonjs/assets/icons/claude.png +0 -0
  15. package/lib/commonjs/assets/icons/gemini.png +0 -0
  16. package/lib/commonjs/assets/icons/grok.png +0 -0
  17. package/lib/commonjs/assets/images/Checkbox.svg +3 -0
  18. package/lib/commonjs/assets/images/EnochE.svg +19 -0
  19. package/lib/commonjs/assets/images/Enochicon1.png +0 -0
  20. package/lib/commonjs/assets/images/Face_ID_logo.png +0 -0
  21. package/lib/commonjs/assets/images/Facebookicon.png +0 -0
  22. package/lib/commonjs/assets/images/Gmail.png +0 -0
  23. package/lib/commonjs/assets/images/Googlelogo.png +0 -0
  24. package/lib/commonjs/assets/images/Linkedinicon.png +0 -0
  25. package/lib/commonjs/assets/images/Onairoslogo.png +0 -0
  26. package/lib/commonjs/assets/images/Personalityprofile.svg +3 -0
  27. package/lib/commonjs/assets/images/Personalitytraits.svg +3 -0
  28. package/lib/commonjs/assets/images/Redditicon.png +0 -0
  29. package/lib/commonjs/assets/images/Userpreferences.svg +3 -0
  30. package/lib/commonjs/assets/images/YouTubeicon3.png +0 -0
  31. package/lib/commonjs/assets/images/arrow.svg +20 -0
  32. package/lib/commonjs/assets/images/basicproficon.svg +43 -0
  33. package/lib/commonjs/assets/images/basicprofile.svg +3 -0
  34. package/lib/commonjs/assets/images/chatgpt.png +0 -0
  35. package/lib/commonjs/assets/images/checkmark.svg +4 -0
  36. package/lib/commonjs/assets/images/claude.png +0 -0
  37. package/lib/commonjs/assets/images/contentanalysis.svg +3 -0
  38. package/lib/commonjs/assets/images/contenticon.svg +23 -0
  39. package/lib/commonjs/assets/images/gemini.png +0 -0
  40. package/lib/commonjs/assets/images/grok.png +0 -0
  41. package/lib/commonjs/assets/images/persona1.png +0 -0
  42. package/lib/commonjs/assets/images/persona2.png +0 -0
  43. package/lib/commonjs/assets/images/persona3.png +0 -0
  44. package/lib/commonjs/assets/images/persona4.png +0 -0
  45. package/lib/commonjs/assets/images/persona5.png +0 -0
  46. package/lib/commonjs/assets/images/personalityicon.svg +18 -0
  47. package/lib/commonjs/assets/images/x-close.svg +3 -0
  48. package/lib/commonjs/components/BodyText.js +9 -0
  49. package/lib/commonjs/components/BrandMark.js +10 -0
  50. package/lib/commonjs/components/CodeInput.js +9 -0
  51. package/lib/commonjs/components/EmailInput.js +8 -0
  52. package/lib/commonjs/components/GoogleButton.js +9 -0
  53. package/lib/commonjs/components/HeadingGroup.js +9 -0
  54. package/lib/commonjs/components/LLMDataInputModal.js +14 -0
  55. package/lib/commonjs/components/ModalHeader.js +9 -0
  56. package/lib/commonjs/components/ModalSheet.js +9 -0
  57. package/lib/commonjs/components/Onairos.js +14 -374
  58. package/lib/commonjs/components/OnairosButton.js +13 -309
  59. package/lib/commonjs/components/OnairosSignInButton.js +12 -0
  60. package/lib/commonjs/components/Overlay.js +13 -483
  61. package/lib/commonjs/components/PersonaImage.js +10 -0
  62. package/lib/commonjs/components/PersonaLoadingScreen.js +12 -0
  63. package/lib/commonjs/components/PersonalizationConsentScreen.js +13 -0
  64. package/lib/commonjs/components/PinCreationScreen.js +12 -0
  65. package/lib/commonjs/components/PinInput.js +9 -302
  66. package/lib/commonjs/components/PlatformConnectorsStep.js +22 -0
  67. package/lib/commonjs/components/PlatformList.js +10 -137
  68. package/lib/commonjs/components/PlatformToggle.js +9 -0
  69. package/lib/commonjs/components/PrimaryButton.js +10 -0
  70. package/lib/commonjs/components/SignInMatchAnimation.js +9 -0
  71. package/lib/commonjs/components/SignInStep.js +12 -0
  72. package/lib/commonjs/components/UniversalOnboarding.js +29 -1702
  73. package/lib/commonjs/components/VerificationStep.js +11 -0
  74. package/lib/commonjs/components/WelcomeScreen.js +21 -0
  75. package/lib/commonjs/components/icons/Basicproficon.js +8 -0
  76. package/lib/commonjs/components/icons/Basicprofile.js +8 -0
  77. package/lib/commonjs/components/icons/Checkbox.js +8 -0
  78. package/lib/commonjs/components/icons/Checkmark.js +8 -0
  79. package/lib/commonjs/components/icons/Contentanalysis.js +8 -0
  80. package/lib/commonjs/components/icons/Contenticon.js +8 -0
  81. package/lib/commonjs/components/icons/EnochE.js +8 -0
  82. package/lib/commonjs/components/icons/Personalityicon.js +8 -0
  83. package/lib/commonjs/components/icons/Personalityprofile.js +8 -0
  84. package/lib/commonjs/components/icons/Personalitytraits.js +8 -0
  85. package/lib/commonjs/components/icons/Userpreferences.js +8 -0
  86. package/lib/commonjs/components/icons/index.js +17 -0
  87. package/lib/commonjs/components/onboarding/OAuthWebView.js +14 -827
  88. package/lib/commonjs/components/onboarding/OnboardingHeader.js +10 -74
  89. package/lib/commonjs/components/onboarding/PinInput.js +10 -283
  90. package/lib/commonjs/components/onboarding/PlatformConnector.js +11 -249
  91. package/lib/commonjs/config/api.js +7 -0
  92. package/lib/commonjs/constants/index.js +7 -83
  93. package/lib/commonjs/context/AuthContext.js +10 -0
  94. package/lib/commonjs/hooks/useConnectedAccounts.js +9 -0
  95. package/lib/commonjs/hooks/useConnections.js +8 -159
  96. package/lib/commonjs/hooks/useCredentials.js +10 -177
  97. package/lib/commonjs/hooks/useUserConnections.js +10 -0
  98. package/lib/commonjs/index.js +35 -106
  99. package/lib/commonjs/services/SDK_API_KEY_VALIDATION.md +31 -38
  100. package/lib/commonjs/services/apiClient.js +8 -0
  101. package/lib/commonjs/services/apiKeyService.js +9 -946
  102. package/lib/commonjs/services/authService.js +10 -0
  103. package/lib/commonjs/services/biometricPinService.js +8 -0
  104. package/lib/commonjs/services/chatGPTConversationExtractor.js +8 -0
  105. package/lib/commonjs/services/chatGPTConversationService.js +9 -0
  106. package/lib/commonjs/services/claudeConversationExtractor.js +8 -0
  107. package/lib/commonjs/services/claudeConversationService.js +9 -0
  108. package/lib/commonjs/services/connectedAccountsService.js +10 -0
  109. package/lib/commonjs/services/googleAuthService.js +11 -0
  110. package/lib/commonjs/services/imageCompressionService.js +7 -0
  111. package/lib/commonjs/services/jwtStorageService.js +7 -0
  112. package/lib/commonjs/services/linkedinDOMExtractor.js +7 -0
  113. package/lib/commonjs/services/linkedinProfileService.js +9 -0
  114. package/lib/commonjs/services/linkedinScrapingService.js +8 -0
  115. package/lib/commonjs/services/llmDataStorage.js +8 -0
  116. package/lib/commonjs/services/mobileTrainingService.js +8 -0
  117. package/lib/commonjs/services/oauthService.js +11 -390
  118. package/lib/commonjs/services/pinEncryptionService.js +8 -0
  119. package/lib/commonjs/services/pinStorageUtils.js +7 -0
  120. package/lib/commonjs/services/platformAuthService.js +12 -1067
  121. package/lib/commonjs/services/storageService.js +8 -0
  122. package/lib/commonjs/services/trainingApiHelpers.js +7 -0
  123. package/lib/commonjs/services/userConnectionsService.js +10 -0
  124. package/lib/commonjs/services/youtubeMigrationService.js +10 -0
  125. package/lib/commonjs/theme/index.js +7 -0
  126. package/lib/commonjs/types/ambient.d.js +1 -2
  127. package/lib/commonjs/types/declarations.d.js +1 -2
  128. package/lib/commonjs/types/index.js +1 -6
  129. package/lib/commonjs/types/node-fix.d.js +1 -2
  130. package/lib/commonjs/types/node-override.d.js +1 -2
  131. package/lib/commonjs/types/opacity.d.js +1 -2
  132. package/lib/commonjs/types.js +1 -14
  133. package/lib/commonjs/utils/Portal.js +8 -98
  134. package/lib/commonjs/utils/api.js +9 -129
  135. package/lib/commonjs/utils/assetRegistry.js +33 -0
  136. package/lib/commonjs/utils/auth.js +9 -111
  137. package/lib/commonjs/utils/crypto.js +8 -62
  138. package/lib/commonjs/utils/debugHelper.js +1 -64
  139. package/lib/commonjs/utils/encryption.js +7 -76
  140. package/lib/commonjs/utils/eventUtils.js +1 -0
  141. package/lib/commonjs/utils/haptics.js +9 -0
  142. package/lib/commonjs/utils/imagePreloader.js +1 -0
  143. package/lib/commonjs/utils/networkDiagnostics.js +8 -0
  144. package/lib/commonjs/utils/onairosApi.js +9 -350
  145. package/lib/commonjs/utils/programmaticFlow.js +9 -117
  146. package/lib/commonjs/utils/retryHelper.js +1 -220
  147. package/lib/commonjs/utils/secureStorage.js +10 -349
  148. package/lib/commonjs/utils/webviewScripts/chatgpt.js +1 -0
  149. package/lib/commonjs/utils/webviewScripts/claude.js +1 -0
  150. package/lib/commonjs/utils/webviewScripts/index.js +9 -0
  151. package/lib/commonjs/utils/webviewScripts/linkedin.js +1 -0
  152. package/lib/module/api/index.js +1 -139
  153. package/lib/module/assets/animations/loaderani.json +1 -0
  154. package/lib/module/assets/animations/persona-animation.json +1 -0
  155. package/lib/module/assets/fonts/EBGaramond-VariableFont_wght.ttf +0 -0
  156. package/lib/module/assets/fonts/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
  157. package/lib/module/assets/icons/Facebookicon.png +0 -0
  158. package/lib/module/assets/icons/Gmail.png +0 -0
  159. package/lib/module/assets/icons/Linkedinicon.png +0 -0
  160. package/lib/module/assets/icons/Redditicon.png +0 -0
  161. package/lib/module/assets/icons/YouTubeicon2.png +0 -0
  162. package/lib/module/assets/icons/YouTubeicon3.png +0 -0
  163. package/lib/module/assets/icons/chatgpt.png +0 -0
  164. package/lib/module/assets/icons/claude.png +0 -0
  165. package/lib/module/assets/icons/farcaster.png +0 -0
  166. package/lib/module/assets/icons/gemini.png +0 -0
  167. package/lib/module/assets/icons/grok.png +0 -0
  168. package/lib/module/assets/icons/instagram.png +0 -0
  169. package/lib/module/assets/icons/pinterest.png +0 -0
  170. package/lib/module/assets/icons/swerv_logo.png +0 -0
  171. package/lib/module/assets/icons/twitter.jpg +0 -0
  172. package/lib/module/assets/images/Checkbox.svg +3 -0
  173. package/lib/module/assets/images/EnochE.svg +19 -0
  174. package/lib/module/assets/images/Enochicon1.png +0 -0
  175. package/lib/module/assets/images/Face_ID_logo.png +0 -0
  176. package/lib/module/assets/images/Facebookicon.png +0 -0
  177. package/lib/module/assets/images/Gmail.png +0 -0
  178. package/lib/module/assets/images/Googlelogo.png +0 -0
  179. package/lib/module/assets/images/Linkedinicon.png +0 -0
  180. package/lib/module/assets/images/Onairoslogo.png +0 -0
  181. package/lib/module/assets/images/Personalityprofile.svg +3 -0
  182. package/lib/module/assets/images/Personalitytraits.svg +3 -0
  183. package/lib/module/assets/images/Redditicon.png +0 -0
  184. package/lib/module/assets/images/Userpreferences.svg +3 -0
  185. package/lib/module/assets/images/YouTubeicon3.png +0 -0
  186. package/lib/module/assets/images/arrow.svg +20 -0
  187. package/lib/module/assets/images/basicproficon.svg +43 -0
  188. package/lib/module/assets/images/basicprofile.svg +3 -0
  189. package/lib/module/assets/images/chatgpt.png +0 -0
  190. package/lib/module/assets/images/checkmark.svg +4 -0
  191. package/lib/module/assets/images/claude.png +0 -0
  192. package/lib/module/assets/images/contentanalysis.svg +3 -0
  193. package/lib/module/assets/images/contenticon.svg +23 -0
  194. package/lib/module/assets/images/gemini.png +0 -0
  195. package/lib/module/assets/images/grok.png +0 -0
  196. package/lib/module/assets/images/persona1.png +0 -0
  197. package/lib/module/assets/images/persona2.png +0 -0
  198. package/lib/module/assets/images/persona3.png +0 -0
  199. package/lib/module/assets/images/persona4.png +0 -0
  200. package/lib/module/assets/images/persona5.png +0 -0
  201. package/lib/module/assets/images/personalityicon.svg +18 -0
  202. package/lib/module/assets/images/x-close.svg +3 -0
  203. package/lib/module/components/BodyText.js +1 -0
  204. package/lib/module/components/BrandMark.js +1 -0
  205. package/lib/module/components/CodeInput.js +1 -0
  206. package/lib/module/components/EmailInput.js +1 -0
  207. package/lib/module/components/GoogleButton.js +1 -0
  208. package/lib/module/components/HeadingGroup.js +1 -0
  209. package/lib/module/components/LLMDataInputModal.js +8 -0
  210. package/lib/module/components/ModalHeader.js +1 -0
  211. package/lib/module/components/ModalSheet.js +1 -0
  212. package/lib/module/components/Onairos.js +1 -367
  213. package/lib/module/components/OnairosButton.js +1 -302
  214. package/lib/module/components/OnairosSignInButton.js +1 -0
  215. package/lib/module/components/Overlay.js +1 -474
  216. package/lib/module/components/PersonaImage.js +1 -0
  217. package/lib/module/components/PersonaLoadingScreen.js +1 -0
  218. package/lib/module/components/PersonalizationConsentScreen.js +1 -0
  219. package/lib/module/components/PinCreationScreen.js +1 -0
  220. package/lib/module/components/PinInput.js +1 -293
  221. package/lib/module/components/PlatformConnectorsStep.js +1 -0
  222. package/lib/module/components/PlatformList.js +1 -129
  223. package/lib/module/components/PlatformToggle.js +1 -0
  224. package/lib/module/components/PrimaryButton.js +1 -0
  225. package/lib/module/components/SignInMatchAnimation.js +1 -0
  226. package/lib/module/components/SignInStep.js +1 -0
  227. package/lib/module/components/UniversalOnboarding.js +1 -1693
  228. package/lib/module/components/VerificationStep.js +1 -0
  229. package/lib/module/components/WelcomeScreen.js +1 -0
  230. package/lib/module/components/icons/Basicproficon.js +1 -0
  231. package/lib/module/components/icons/Basicprofile.js +1 -0
  232. package/lib/module/components/icons/Checkbox.js +1 -0
  233. package/lib/module/components/icons/Checkmark.js +1 -0
  234. package/lib/module/components/icons/Contentanalysis.js +1 -0
  235. package/lib/module/components/icons/Contenticon.js +1 -0
  236. package/lib/module/components/icons/EnochE.js +1 -0
  237. package/lib/module/components/icons/Personalityicon.js +1 -0
  238. package/lib/module/components/icons/Personalityprofile.js +1 -0
  239. package/lib/module/components/icons/Personalitytraits.js +1 -0
  240. package/lib/module/components/icons/Userpreferences.js +1 -0
  241. package/lib/module/components/icons/index.js +1 -0
  242. package/lib/module/components/onboarding/OAuthWebView.js +1 -818
  243. package/lib/module/components/onboarding/OnboardingHeader.js +1 -66
  244. package/lib/module/components/onboarding/PinInput.js +1 -274
  245. package/lib/module/components/onboarding/PlatformConnector.js +1 -240
  246. package/lib/module/config/api.js +1 -0
  247. package/lib/module/constants/index.js +1 -77
  248. package/lib/module/context/AuthContext.js +1 -0
  249. package/lib/module/hooks/useConnectedAccounts.js +1 -0
  250. package/lib/module/hooks/useConnections.js +1 -152
  251. package/lib/module/hooks/useCredentials.js +6 -169
  252. package/lib/module/hooks/useUserConnections.js +1 -0
  253. package/lib/module/index.js +1 -32
  254. package/lib/module/services/SDK_API_KEY_VALIDATION.md +31 -38
  255. package/lib/module/services/apiClient.js +1 -0
  256. package/lib/module/services/apiKeyService.js +1 -919
  257. package/lib/module/services/authService.js +1 -0
  258. package/lib/module/services/biometricPinService.js +1 -0
  259. package/lib/module/services/chatGPTConversationExtractor.js +1 -0
  260. package/lib/module/services/chatGPTConversationService.js +1 -0
  261. package/lib/module/services/claudeConversationExtractor.js +1 -0
  262. package/lib/module/services/claudeConversationService.js +1 -0
  263. package/lib/module/services/connectedAccountsService.js +1 -0
  264. package/lib/module/services/googleAuthService.js +1 -0
  265. package/lib/module/services/imageCompressionService.js +1 -0
  266. package/lib/module/services/jwtStorageService.js +1 -0
  267. package/lib/module/services/linkedinDOMExtractor.js +1 -0
  268. package/lib/module/services/linkedinProfileService.js +1 -0
  269. package/lib/module/services/linkedinScrapingService.js +1 -0
  270. package/lib/module/services/llmDataStorage.js +1 -0
  271. package/lib/module/services/mobileTrainingService.js +1 -0
  272. package/lib/module/services/oauthService.js +1 -380
  273. package/lib/module/services/pinEncryptionService.js +7 -0
  274. package/lib/module/services/pinStorageUtils.js +1 -0
  275. package/lib/module/services/platformAuthService.js +1 -1041
  276. package/lib/module/services/storageService.js +1 -0
  277. package/lib/module/services/trainingApiHelpers.js +1 -0
  278. package/lib/module/services/userConnectionsService.js +1 -0
  279. package/lib/module/services/youtubeMigrationService.js +1 -0
  280. package/lib/module/theme/index.js +1 -0
  281. package/lib/module/types.js +1 -10
  282. package/lib/module/utils/Portal.js +1 -90
  283. package/lib/module/utils/api.js +1 -117
  284. package/lib/module/utils/assetRegistry.js +33 -0
  285. package/lib/module/utils/auth.js +1 -99
  286. package/lib/module/utils/crypto.js +1 -54
  287. package/lib/module/utils/debugHelper.js +1 -54
  288. package/lib/module/utils/encryption.js +1 -67
  289. package/lib/module/utils/eventUtils.js +1 -0
  290. package/lib/module/utils/haptics.js +8 -0
  291. package/lib/module/utils/imagePreloader.js +1 -0
  292. package/lib/module/utils/networkDiagnostics.js +1 -0
  293. package/lib/module/utils/onairosApi.js +1 -333
  294. package/lib/module/utils/programmaticFlow.js +1 -111
  295. package/lib/module/utils/retryHelper.js +1 -211
  296. package/lib/module/utils/secureStorage.js +6 -330
  297. package/lib/module/utils/webviewScripts/chatgpt.js +1 -0
  298. package/lib/module/utils/webviewScripts/claude.js +1 -0
  299. package/lib/module/utils/webviewScripts/index.js +1 -0
  300. package/lib/module/utils/webviewScripts/linkedin.js +1 -0
  301. package/package.json +62 -39
  302. package/lib/commonjs/api/index.js.map +0 -1
  303. package/lib/commonjs/assets/images/email.png +0 -0
  304. package/lib/commonjs/assets/images/linkedin.png +0 -0
  305. package/lib/commonjs/assets/images/reddit.png +0 -0
  306. package/lib/commonjs/assets/images/youtube.png +0 -0
  307. package/lib/commonjs/components/DataRequestModal.js +0 -228
  308. package/lib/commonjs/components/DataRequestModal.js.map +0 -1
  309. package/lib/commonjs/components/DataRequestScreen.js +0 -329
  310. package/lib/commonjs/components/DataRequestScreen.js.map +0 -1
  311. package/lib/commonjs/components/EmailVerificationModal.js +0 -320
  312. package/lib/commonjs/components/EmailVerificationModal.js.map +0 -1
  313. package/lib/commonjs/components/Onairos.js.map +0 -1
  314. package/lib/commonjs/components/OnairosButton.js.map +0 -1
  315. package/lib/commonjs/components/Overlay.js.map +0 -1
  316. package/lib/commonjs/components/PinInput.js.map +0 -1
  317. package/lib/commonjs/components/PlatformList.js.map +0 -1
  318. package/lib/commonjs/components/TrainingModal.js +0 -717
  319. package/lib/commonjs/components/TrainingModal.js.map +0 -1
  320. package/lib/commonjs/components/UniversalOnboarding.js.map +0 -1
  321. package/lib/commonjs/components/UniversalOnboarding.tsx.new +0 -455
  322. package/lib/commonjs/components/onboarding/OAuthWebView.js.map +0 -1
  323. package/lib/commonjs/components/onboarding/OnboardingHeader.js.map +0 -1
  324. package/lib/commonjs/components/onboarding/PinInput.js.map +0 -1
  325. package/lib/commonjs/components/onboarding/PlatformConnector.js.map +0 -1
  326. package/lib/commonjs/components/screens/ConnectorScreen.js +0 -146
  327. package/lib/commonjs/components/screens/ConnectorScreen.js.map +0 -1
  328. package/lib/commonjs/components/screens/LoadingScreen.js +0 -91
  329. package/lib/commonjs/components/screens/LoadingScreen.js.map +0 -1
  330. package/lib/commonjs/components/screens/PinCreationScreen.js +0 -61
  331. package/lib/commonjs/components/screens/PinCreationScreen.js.map +0 -1
  332. package/lib/commonjs/constants/index.js.map +0 -1
  333. package/lib/commonjs/hooks/useConnections.js.map +0 -1
  334. package/lib/commonjs/hooks/useCredentials.js.map +0 -1
  335. package/lib/commonjs/index.js.map +0 -1
  336. package/lib/commonjs/services/apiKeyService.js.map +0 -1
  337. package/lib/commonjs/services/oauthService.js.map +0 -1
  338. package/lib/commonjs/services/platformAuthService.js.map +0 -1
  339. package/lib/commonjs/types/ambient.d.js.map +0 -1
  340. package/lib/commonjs/types/declarations.d.js.map +0 -1
  341. package/lib/commonjs/types/index.d.js.map +0 -1
  342. package/lib/commonjs/types/index.js.map +0 -1
  343. package/lib/commonjs/types/node-fix.d.js.map +0 -1
  344. package/lib/commonjs/types/node-override.d.js.map +0 -1
  345. package/lib/commonjs/types/opacity.d.js.map +0 -1
  346. package/lib/commonjs/types/types.d.js.map +0 -1
  347. package/lib/commonjs/types.js.map +0 -1
  348. package/lib/commonjs/utils/Portal.js.map +0 -1
  349. package/lib/commonjs/utils/api.js.map +0 -1
  350. package/lib/commonjs/utils/auth.js.map +0 -1
  351. package/lib/commonjs/utils/crypto.js.map +0 -1
  352. package/lib/commonjs/utils/debugHelper.js.map +0 -1
  353. package/lib/commonjs/utils/encryption.js.map +0 -1
  354. package/lib/commonjs/utils/onairosApi.js.map +0 -1
  355. package/lib/commonjs/utils/programmaticFlow.js.map +0 -1
  356. package/lib/commonjs/utils/retryHelper.js.map +0 -1
  357. package/lib/commonjs/utils/secureStorage.js.map +0 -1
  358. package/lib/module/api/index.js.map +0 -1
  359. package/lib/module/assets/images/email.png +0 -0
  360. package/lib/module/assets/images/linkedin.png +0 -0
  361. package/lib/module/assets/images/reddit.png +0 -0
  362. package/lib/module/assets/images/youtube.png +0 -0
  363. package/lib/module/components/DataRequestModal.js +0 -220
  364. package/lib/module/components/DataRequestModal.js.map +0 -1
  365. package/lib/module/components/DataRequestScreen.js +0 -321
  366. package/lib/module/components/DataRequestScreen.js.map +0 -1
  367. package/lib/module/components/EmailVerificationModal.js +0 -311
  368. package/lib/module/components/EmailVerificationModal.js.map +0 -1
  369. package/lib/module/components/Onairos.js.map +0 -1
  370. package/lib/module/components/OnairosButton.js.map +0 -1
  371. package/lib/module/components/Overlay.js.map +0 -1
  372. package/lib/module/components/PinInput.js.map +0 -1
  373. package/lib/module/components/PlatformList.js.map +0 -1
  374. package/lib/module/components/TrainingModal.js +0 -708
  375. package/lib/module/components/TrainingModal.js.map +0 -1
  376. package/lib/module/components/UniversalOnboarding.js.map +0 -1
  377. package/lib/module/components/UniversalOnboarding.tsx.new +0 -455
  378. package/lib/module/components/onboarding/OAuthWebView.js.map +0 -1
  379. package/lib/module/components/onboarding/OnboardingHeader.js.map +0 -1
  380. package/lib/module/components/onboarding/PinInput.js.map +0 -1
  381. package/lib/module/components/onboarding/PlatformConnector.js.map +0 -1
  382. package/lib/module/components/screens/ConnectorScreen.js +0 -138
  383. package/lib/module/components/screens/ConnectorScreen.js.map +0 -1
  384. package/lib/module/components/screens/LoadingScreen.js +0 -83
  385. package/lib/module/components/screens/LoadingScreen.js.map +0 -1
  386. package/lib/module/components/screens/PinCreationScreen.js +0 -53
  387. package/lib/module/components/screens/PinCreationScreen.js.map +0 -1
  388. package/lib/module/constants/index.js.map +0 -1
  389. package/lib/module/hooks/useConnections.js.map +0 -1
  390. package/lib/module/hooks/useCredentials.js.map +0 -1
  391. package/lib/module/index.js.map +0 -1
  392. package/lib/module/services/apiKeyService.js.map +0 -1
  393. package/lib/module/services/oauthService.js.map +0 -1
  394. package/lib/module/services/platformAuthService.js.map +0 -1
  395. package/lib/module/types/ambient.d.js.map +0 -1
  396. package/lib/module/types/declarations.d.js.map +0 -1
  397. package/lib/module/types/index.d.js.map +0 -1
  398. package/lib/module/types/index.js.map +0 -1
  399. package/lib/module/types/node-fix.d.js.map +0 -1
  400. package/lib/module/types/node-override.d.js.map +0 -1
  401. package/lib/module/types/opacity.d.js.map +0 -1
  402. package/lib/module/types/types.d.js.map +0 -1
  403. package/lib/module/types.js.map +0 -1
  404. package/lib/module/utils/Portal.js.map +0 -1
  405. package/lib/module/utils/api.js.map +0 -1
  406. package/lib/module/utils/auth.js.map +0 -1
  407. package/lib/module/utils/crypto.js.map +0 -1
  408. package/lib/module/utils/debugHelper.js.map +0 -1
  409. package/lib/module/utils/encryption.js.map +0 -1
  410. package/lib/module/utils/onairosApi.js.map +0 -1
  411. package/lib/module/utils/programmaticFlow.js.map +0 -1
  412. package/lib/module/utils/retryHelper.js.map +0 -1
  413. package/lib/module/utils/secureStorage.js.map +0 -1
  414. package/lib/typescript/api/index.d.ts +0 -8
  415. package/lib/typescript/api/index.d.ts.map +0 -1
  416. package/lib/typescript/components/DataRequestModal.d.ts +0 -11
  417. package/lib/typescript/components/DataRequestModal.d.ts.map +0 -1
  418. package/lib/typescript/components/DataRequestScreen.d.ts +0 -11
  419. package/lib/typescript/components/DataRequestScreen.d.ts.map +0 -1
  420. package/lib/typescript/components/EmailVerificationModal.d.ts +0 -11
  421. package/lib/typescript/components/EmailVerificationModal.d.ts.map +0 -1
  422. package/lib/typescript/components/Onairos.d.ts +0 -4
  423. package/lib/typescript/components/Onairos.d.ts.map +0 -1
  424. package/lib/typescript/components/OnairosButton.d.ts +0 -12
  425. package/lib/typescript/components/OnairosButton.d.ts.map +0 -1
  426. package/lib/typescript/components/Overlay.d.ts +0 -4
  427. package/lib/typescript/components/Overlay.d.ts.map +0 -1
  428. package/lib/typescript/components/PinInput.d.ts +0 -4
  429. package/lib/typescript/components/PinInput.d.ts.map +0 -1
  430. package/lib/typescript/components/PlatformList.d.ts +0 -4
  431. package/lib/typescript/components/PlatformList.d.ts.map +0 -1
  432. package/lib/typescript/components/TrainingModal.d.ts +0 -4
  433. package/lib/typescript/components/TrainingModal.d.ts.map +0 -1
  434. package/lib/typescript/components/UniversalOnboarding.d.ts +0 -4
  435. package/lib/typescript/components/UniversalOnboarding.d.ts.map +0 -1
  436. package/lib/typescript/components/onboarding/OAuthWebView.d.ts +0 -10
  437. package/lib/typescript/components/onboarding/OAuthWebView.d.ts.map +0 -1
  438. package/lib/typescript/components/onboarding/OnboardingHeader.d.ts +0 -11
  439. package/lib/typescript/components/onboarding/OnboardingHeader.d.ts.map +0 -1
  440. package/lib/typescript/components/onboarding/PinInput.d.ts +0 -4
  441. package/lib/typescript/components/onboarding/PinInput.d.ts.map +0 -1
  442. package/lib/typescript/components/onboarding/PlatformConnector.d.ts +0 -13
  443. package/lib/typescript/components/onboarding/PlatformConnector.d.ts.map +0 -1
  444. package/lib/typescript/components/screens/ConnectorScreen.d.ts +0 -9
  445. package/lib/typescript/components/screens/ConnectorScreen.d.ts.map +0 -1
  446. package/lib/typescript/components/screens/LoadingScreen.d.ts +0 -9
  447. package/lib/typescript/components/screens/LoadingScreen.d.ts.map +0 -1
  448. package/lib/typescript/components/screens/PinCreationScreen.d.ts +0 -10
  449. package/lib/typescript/components/screens/PinCreationScreen.d.ts.map +0 -1
  450. package/lib/typescript/constants/index.d.ts +0 -53
  451. package/lib/typescript/constants/index.d.ts.map +0 -1
  452. package/lib/typescript/hooks/useConnections.d.ts +0 -9
  453. package/lib/typescript/hooks/useConnections.d.ts.map +0 -1
  454. package/lib/typescript/hooks/useCredentials.d.ts +0 -9
  455. package/lib/typescript/hooks/useCredentials.d.ts.map +0 -1
  456. package/lib/typescript/index.d.ts +0 -18
  457. package/lib/typescript/index.d.ts.map +0 -1
  458. package/lib/typescript/services/apiKeyService.d.ts +0 -132
  459. package/lib/typescript/services/apiKeyService.d.ts.map +0 -1
  460. package/lib/typescript/services/oauthService.d.ts +0 -50
  461. package/lib/typescript/services/oauthService.d.ts.map +0 -1
  462. package/lib/typescript/services/platformAuthService.d.ts +0 -144
  463. package/lib/typescript/services/platformAuthService.d.ts.map +0 -1
  464. package/lib/typescript/types/index.d.ts +0 -231
  465. package/lib/typescript/types/index.d.ts.map +0 -1
  466. package/lib/typescript/types.d.ts +0 -270
  467. package/lib/typescript/types.d.ts.map +0 -1
  468. package/lib/typescript/utils/Portal.d.ts +0 -14
  469. package/lib/typescript/utils/Portal.d.ts.map +0 -1
  470. package/lib/typescript/utils/api.d.ts +0 -6
  471. package/lib/typescript/utils/api.d.ts.map +0 -1
  472. package/lib/typescript/utils/auth.d.ts +0 -6
  473. package/lib/typescript/utils/auth.d.ts.map +0 -1
  474. package/lib/typescript/utils/crypto.d.ts +0 -4
  475. package/lib/typescript/utils/crypto.d.ts.map +0 -1
  476. package/lib/typescript/utils/debugHelper.d.ts +0 -29
  477. package/lib/typescript/utils/debugHelper.d.ts.map +0 -1
  478. package/lib/typescript/utils/encryption.d.ts +0 -19
  479. package/lib/typescript/utils/encryption.d.ts.map +0 -1
  480. package/lib/typescript/utils/onairosApi.d.ts +0 -87
  481. package/lib/typescript/utils/onairosApi.d.ts.map +0 -1
  482. package/lib/typescript/utils/programmaticFlow.d.ts +0 -23
  483. package/lib/typescript/utils/programmaticFlow.d.ts.map +0 -1
  484. package/lib/typescript/utils/retryHelper.d.ts +0 -69
  485. package/lib/typescript/utils/retryHelper.d.ts.map +0 -1
  486. package/lib/typescript/utils/secureStorage.d.ts +0 -94
  487. package/lib/typescript/utils/secureStorage.d.ts.map +0 -1
  488. package/src/api/index.ts +0 -111
  489. package/src/assets/images/email.png +0 -0
  490. package/src/assets/images/linkedin.png +0 -0
  491. package/src/assets/images/onairos_logo.png +0 -0
  492. package/src/assets/images/reddit.png +0 -0
  493. package/src/assets/images/youtube.png +0 -0
  494. package/src/components/DataRequestModal.tsx +0 -227
  495. package/src/components/DataRequestScreen.tsx +0 -356
  496. package/src/components/EmailVerificationModal.tsx +0 -364
  497. package/src/components/Onairos.tsx +0 -425
  498. package/src/components/OnairosButton.tsx +0 -359
  499. package/src/components/Overlay.tsx +0 -506
  500. package/src/components/PinInput.tsx +0 -343
  501. package/src/components/PlatformList.tsx +0 -145
  502. package/src/components/TrainingModal.tsx +0 -737
  503. package/src/components/UniversalOnboarding.tsx +0 -1839
  504. package/src/components/UniversalOnboarding.tsx.new +0 -455
  505. package/src/components/onboarding/OAuthWebView.tsx +0 -838
  506. package/src/components/onboarding/OnboardingHeader.tsx +0 -70
  507. package/src/components/onboarding/PinInput.tsx +0 -356
  508. package/src/components/onboarding/PlatformConnector.tsx +0 -302
  509. package/src/components/screens/ConnectorScreen.tsx +0 -153
  510. package/src/components/screens/LoadingScreen.tsx +0 -100
  511. package/src/components/screens/PinCreationScreen.tsx +0 -67
  512. package/src/constants/index.ts +0 -83
  513. package/src/hooks/useConnections.ts +0 -163
  514. package/src/hooks/useCredentials.ts +0 -175
  515. package/src/index.js +0 -14
  516. package/src/index.ts +0 -50
  517. package/src/services/SDK_API_KEY_VALIDATION.md +0 -428
  518. package/src/services/apiKeyService.ts +0 -979
  519. package/src/services/oauthService.ts +0 -412
  520. package/src/services/platformAuthService.ts +0 -1113
  521. package/src/types/ambient.d.ts +0 -29
  522. package/src/types/declarations.d.ts +0 -26
  523. package/src/types/index.d.ts +0 -274
  524. package/src/types/index.ts +0 -244
  525. package/src/types/node-fix.d.ts +0 -19
  526. package/src/types/node-override.d.ts +0 -24
  527. package/src/types/opacity.d.ts +0 -16
  528. package/src/types/types.d.ts +0 -18
  529. package/src/types.ts +0 -298
  530. package/src/utils/Portal.tsx +0 -83
  531. package/src/utils/api.js +0 -112
  532. package/src/utils/auth.js +0 -104
  533. package/src/utils/crypto.js +0 -60
  534. package/src/utils/debugHelper.ts +0 -53
  535. package/src/utils/encryption.ts +0 -69
  536. package/src/utils/onairosApi.ts +0 -391
  537. package/src/utils/programmaticFlow.ts +0 -113
  538. package/src/utils/retryHelper.ts +0 -275
  539. package/src/utils/secureStorage.ts +0 -361
  540. package/types/index.d.ts +0 -218
  541. package/types/node-env.d.ts +0 -15
  542. /package/{src/assets/images → lib/commonjs/assets/icons}/farcaster.png +0 -0
  543. /package/{src/assets/images → lib/commonjs/assets/icons}/instagram.png +0 -0
  544. /package/{src/assets/images → lib/commonjs/assets/icons}/pinterest.png +0 -0
  545. /package/{src/assets/images → lib/commonjs/assets/icons}/swerv_logo.png +0 -0
  546. /package/{src/assets/images → lib/commonjs/assets/icons}/twitter.jpg +0 -0
@@ -1,708 +0,0 @@
1
- import React, { useEffect, useRef, useState } from 'react';
2
- import { View, Text, StyleSheet, TouchableOpacity, Dimensions, Modal, TouchableWithoutFeedback, SafeAreaView, Image, Alert } from 'react-native';
3
- import Icon from 'react-native-vector-icons/MaterialIcons';
4
- import { io } from 'socket.io-client';
5
- import { COLORS } from '../constants';
6
- const {
7
- width,
8
- height
9
- } = Dimensions.get('window');
10
- export const TrainingModal = ({
11
- visible,
12
- progress,
13
- eta,
14
- onCancel,
15
- onComplete,
16
- modelKey,
17
- username,
18
- test = false
19
- }) => {
20
- // Socket and training state
21
- const socketRef = useRef(null);
22
- const [socketConnected, setSocketConnected] = useState(false);
23
- const [trainingStatus, setTrainingStatus] = useState('Initializing...');
24
- const [hasError, setHasError] = useState(false);
25
- const [errorCode, setErrorCode] = useState(null);
26
- const [isTrainingComplete, setIsTrainingComplete] = useState(false);
27
- const [userTraits, setUserTraits] = useState(null);
28
- const [inferenceResults, setInferenceResults] = useState(null);
29
- const [internalProgress, setInternalProgress] = useState(0);
30
- const [isEnochSDK, setIsEnochSDK] = useState(false); // Determine if using Enoch SDK
31
- const [trainingResults, setTrainingResults] = useState(null);
32
-
33
- // Use internal progress if available, otherwise fall back to prop progress
34
- const currentProgress = internalProgress > 0 ? internalProgress / 100 : progress;
35
- const progressPercentage = Math.round(currentProgress * 100);
36
-
37
- // Mock user data for now - in real implementation this would come from props
38
- const userToken = 'mock-token'; // TODO: Get from actual auth
39
- const userInfo = {
40
- username: username || 'mobile_user',
41
- email: null,
42
- id: null,
43
- name: username || 'mobile_user'
44
- };
45
-
46
- // Check if we should use Enoch SDK (based on modelKey or other criteria)
47
- useEffect(() => {
48
- // For now, default to clean training unless specified
49
- // In real implementation, this would be determined by SDK type
50
- setIsEnochSDK((modelKey === null || modelKey === void 0 ? void 0 : modelKey.includes('enoch')) || false);
51
- }, [modelKey]);
52
-
53
- // Start training with new API schema
54
- const startTraining = async socketId => {
55
- try {
56
- setTrainingStatus('Starting training...');
57
- setInternalProgress(10);
58
- setHasError(false);
59
- setErrorCode(null);
60
- if (!userToken) {
61
- throw new Error('No authentication token available');
62
- }
63
-
64
- // Determine endpoint based on SDK type
65
- const endpoint = isEnochSDK ? '/mobile-training/enoch' : '/mobile-training/clean';
66
- console.log(`🚀 Starting training with endpoint: ${endpoint}`);
67
- console.log('🔍 Production mode: Using new training API schema');
68
-
69
- // Prepare training data in new format
70
- const trainingData = {
71
- Info: {
72
- username: (userInfo === null || userInfo === void 0 ? void 0 : userInfo.username) || (userInfo === null || userInfo === void 0 ? void 0 : userInfo.name) || username || 'mobile_user',
73
- // Mock connected platforms - in real implementation this would come from props
74
- connectedPlatforms: ['youtube', 'instagram', 'reddit'] // TODO: Get from actual connections
75
- }
76
- };
77
- console.log('📤 Sending training data:', trainingData);
78
-
79
- // Call the new training API
80
- const response = await fetch(`https://api2.onairos.uk${endpoint}`, {
81
- method: 'POST',
82
- headers: {
83
- 'Content-Type': 'application/json',
84
- 'Authorization': `Bearer ${userToken}` // JWT token authentication
85
- },
86
- body: JSON.stringify(trainingData)
87
- });
88
- const result = await response.json();
89
- if (result.success) {
90
- console.log('🚀 Training Started:', result.message);
91
- setTrainingStatus('Training initiated...');
92
- setInternalProgress(20);
93
- } else {
94
- console.error('Training start failed:', result.error);
95
-
96
- // Handle specific error codes from new schema
97
- if (result.code) {
98
- setErrorCode(result.code);
99
- handleTrainingError(result.code, result.error);
100
- } else {
101
- setTrainingStatus(`Error: ${result.error}`);
102
- setHasError(true);
103
- }
104
- }
105
- } catch (error) {
106
- console.error('Training start error:', error);
107
- setTrainingStatus(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
108
- setHasError(true);
109
- }
110
- };
111
-
112
- // Handle training errors with specific error codes
113
- const handleTrainingError = (code, message) => {
114
- console.error(`Training Error [${code}]:`, message);
115
- setHasError(true);
116
- switch (code) {
117
- case 'PIN_REQUIRED':
118
- setTrainingStatus('PIN setup required');
119
- Alert.alert('PIN Required', 'Please set up your PIN first before training.', [{
120
- text: 'Cancel',
121
- style: 'cancel'
122
- }, {
123
- text: 'Set PIN',
124
- onPress: () => {
125
- // TODO: Navigate to PIN setup
126
- console.log('Navigate to PIN setup');
127
- }
128
- }]);
129
- break;
130
- case 'CONNECTIONS_REQUIRED':
131
- setTrainingStatus('No connected accounts');
132
- Alert.alert('Connections Required', 'Please connect at least one social media account before training.', [{
133
- text: 'Cancel',
134
- style: 'cancel'
135
- }, {
136
- text: 'Connect',
137
- onPress: () => {
138
- // TODO: Navigate to connections
139
- console.log('Navigate to connections');
140
- }
141
- }]);
142
- break;
143
- case 'INSUFFICIENT_DATA':
144
- setTrainingStatus('Insufficient data for training');
145
- Alert.alert('Insufficient Data', 'We need more interaction data to train your model effectively. Please use your connected platforms more and try again.', [{
146
- text: 'OK',
147
- style: 'default'
148
- }]);
149
- break;
150
- case 'ENCRYPTION_REQUIRED':
151
- setTrainingStatus('Model encryption failed');
152
- Alert.alert('Encryption Error', 'Failed to encrypt your model. Please try again.', [{
153
- text: 'OK',
154
- style: 'default'
155
- }]);
156
- break;
157
- default:
158
- setTrainingStatus(`Error: ${message}`);
159
- Alert.alert('Training Error', message || 'An unexpected error occurred during training.', [{
160
- text: 'OK',
161
- style: 'default'
162
- }]);
163
- }
164
- };
165
-
166
- // Simulate training progress for test mode
167
- const simulateTraining = () => {
168
- var _phases$currentPhase;
169
- console.log('🧪 Starting simulated training with new schema phases...');
170
- setTrainingStatus('Validating Requirements');
171
- setInternalProgress(5);
172
-
173
- // Simulate all phases from the new schema
174
- const phases = [{
175
- progress: 10,
176
- status: 'Validating Requirements',
177
- delay: 1000
178
- }, {
179
- progress: 25,
180
- status: 'Training Model',
181
- delay: 2000
182
- }, {
183
- progress: 50,
184
- status: 'Training Model',
185
- delay: 2000
186
- }, {
187
- progress: 65,
188
- status: 'Model Trained - Running Test Inference',
189
- delay: 1500
190
- }, {
191
- progress: 80,
192
- status: 'Encrypting and Compressing Model',
193
- delay: 1000
194
- }, {
195
- progress: 95,
196
- status: 'Uploading Encrypted Model to ARDrive',
197
- delay: 1500
198
- }, {
199
- progress: 100,
200
- status: 'Complete!',
201
- delay: 500
202
- }];
203
- let currentPhase = 0;
204
- const progressInterval = setInterval(() => {
205
- if (currentPhase < phases.length) {
206
- const phase = phases[currentPhase];
207
- setInternalProgress(phase.progress);
208
- setTrainingStatus(phase.status);
209
- if (phase.progress === 100) {
210
- setIsTrainingComplete(true);
211
- clearInterval(progressInterval);
212
-
213
- // Mock completion results
214
- const mockResults = {
215
- completed: true,
216
- message: "Model trained, encrypted, and stored successfully",
217
- storage: "ARDrive",
218
- encryption: true,
219
- inference: isEnochSDK,
220
- // Only Enoch SDK runs inference
221
- modelUrl: `https://arweave.net/mock_tx_${Date.now()}`
222
- };
223
- setTrainingResults(mockResults);
224
-
225
- // Auto-complete after a short delay
226
- setTimeout(() => {
227
- onComplete && onComplete();
228
- }, 1000);
229
- }
230
- currentPhase++;
231
- }
232
- }, ((_phases$currentPhase = phases[currentPhase]) === null || _phases$currentPhase === void 0 ? void 0 : _phases$currentPhase.delay) || 1000);
233
-
234
- // Cleanup interval on unmount
235
- return () => clearInterval(progressInterval);
236
- };
237
-
238
- // Setup socket connection and training
239
- useEffect(() => {
240
- if (!visible || !userInfo) return;
241
- console.log('Setting up socket connection for training...');
242
- console.log('🧑‍💻 User info available:', userInfo);
243
- console.log('🧪 Test mode:', test);
244
- console.log('🔧 Using Enoch SDK:', isEnochSDK);
245
-
246
- // If test mode is enabled, use simulation instead of real API
247
- if (test) {
248
- console.log('🧪 Test mode enabled - Using simulated training with new schema');
249
- setSocketConnected(true);
250
- simulateTraining();
251
- return;
252
- }
253
-
254
- // Initialize real socket connection
255
- try {
256
- console.log('🔌 Production mode: Initializing real socket connection');
257
-
258
- // Initialize socket connection
259
- socketRef.current = io('https://api2.onairos.uk', {
260
- transports: ['websocket'],
261
- autoConnect: false
262
- });
263
-
264
- // Socket event listeners for new schema
265
- socketRef.current.on('connect', () => {
266
- var _socketRef$current;
267
- console.log('✅ Socket connected for training');
268
- setSocketConnected(true);
269
- const socketId = (_socketRef$current = socketRef.current) === null || _socketRef$current === void 0 ? void 0 : _socketRef$current.id;
270
- if (socketId) {
271
- startTraining(socketId);
272
- }
273
- });
274
- socketRef.current.on('disconnect', () => {
275
- console.log('❌ Socket disconnected');
276
- setSocketConnected(false);
277
- });
278
- socketRef.current.on('connect_error', error => {
279
- console.error('❌ Socket connection error:', error);
280
- setTrainingStatus('Connection failed');
281
- setHasError(true);
282
- });
283
-
284
- // Handle training updates with new schema phases
285
- socketRef.current.on('trainingUpdate', data => {
286
- console.log('📡 Training update received:', data);
287
- if (data.error) {
288
- if (data.code) {
289
- setErrorCode(data.code);
290
- handleTrainingError(data.code, data.error);
291
- } else {
292
- console.error('Training update error:', data.error);
293
- setTrainingStatus(`Error: ${data.error}`);
294
- setHasError(true);
295
- }
296
- } else {
297
- // Handle different status phases
298
- if (data.status) {
299
- setTrainingStatus(data.status);
300
-
301
- // Update progress based on phase
302
- switch (data.status) {
303
- case 'Validating Requirements':
304
- setInternalProgress(10);
305
- break;
306
- case 'Training Model':
307
- setInternalProgress(data.percent || 40);
308
- break;
309
- case 'Model Trained - Running Test Inference':
310
- setInternalProgress(65);
311
- break;
312
- case 'Encrypting and Compressing Model':
313
- setInternalProgress(80);
314
- break;
315
- case 'Uploading Encrypted Model to ARDrive':
316
- setInternalProgress(90);
317
- break;
318
- default:
319
- if (data.percent) {
320
- setInternalProgress(data.percent);
321
- }
322
- }
323
- }
324
- if (data.progress) {
325
- setInternalProgress(data.progress);
326
- }
327
- }
328
- });
329
-
330
- // Handle training completion with new schema
331
- socketRef.current.on('trainingCompleted', data => {
332
- console.log('✅ Training Complete:', data);
333
- if (data.completed && data.storage === 'ARDrive' && data.encryption === true) {
334
- setTrainingStatus('Training completed successfully!');
335
- setIsTrainingComplete(true);
336
- setInternalProgress(100);
337
- setTrainingResults(data);
338
-
339
- // Display results
340
- console.log('✅ Model URL:', data.modelUrl);
341
- console.log('✅ Storage:', data.storage);
342
- console.log('✅ Encrypted:', data.encryption);
343
- console.log('✅ Inference:', data.inference);
344
-
345
- // Auto-complete after a short delay
346
- setTimeout(() => {
347
- onComplete && onComplete();
348
- }, 1500);
349
- } else {
350
- console.error('Training completion missing required fields:', data);
351
- setTrainingStatus('Training completed with warnings');
352
- setHasError(true);
353
- }
354
- });
355
-
356
- // Legacy handlers for backward compatibility
357
- socketRef.current.on('inferenceCompleted', data => {
358
- console.log('🧠 Inference Complete:', data);
359
- setUserTraits(data.traits);
360
- setInferenceResults(data.inferenceResults);
361
- });
362
- socketRef.current.on('modelStandby', data => {
363
- console.log('🎉 Model Ready:', data);
364
- // This is handled by trainingCompleted now
365
- });
366
-
367
- // Connect to socket
368
- socketRef.current.connect();
369
- } catch (socketError) {
370
- console.error('🚨 Production mode: Socket connection failed:', socketError);
371
- setTrainingStatus('Failed to connect to training service');
372
- setHasError(true);
373
- }
374
-
375
- // Cleanup function
376
- return () => {
377
- if (socketRef.current) {
378
- console.log('🔌 Disconnecting training socket...');
379
- socketRef.current.disconnect();
380
- socketRef.current = null;
381
- }
382
- };
383
- }, [visible, userInfo, test, isEnochSDK]);
384
-
385
- // Render error details for specific error codes
386
- const renderErrorDetails = () => {
387
- if (!hasError || !errorCode) return null;
388
- const errorDetails = {
389
- 'PIN_REQUIRED': {
390
- icon: 'lock',
391
- title: 'PIN Setup Required',
392
- description: 'Set up your PIN to secure your AI model'
393
- },
394
- 'CONNECTIONS_REQUIRED': {
395
- icon: 'link',
396
- title: 'Connect Accounts',
397
- description: 'Connect at least one social media account'
398
- },
399
- 'INSUFFICIENT_DATA': {
400
- icon: 'data-usage',
401
- title: 'More Data Needed',
402
- description: 'We need more interaction data to train effectively'
403
- },
404
- 'ENCRYPTION_REQUIRED': {
405
- icon: 'security',
406
- title: 'Encryption Failed',
407
- description: 'Failed to encrypt your model securely'
408
- }
409
- };
410
- const details = errorDetails[errorCode];
411
- if (!details) return null;
412
- return /*#__PURE__*/React.createElement(View, {
413
- style: styles.errorDetailsContainer
414
- }, /*#__PURE__*/React.createElement(Icon, {
415
- name: details.icon,
416
- size: 32,
417
- color: "#FF6B6B"
418
- }), /*#__PURE__*/React.createElement(Text, {
419
- style: styles.errorTitle
420
- }, details.title), /*#__PURE__*/React.createElement(Text, {
421
- style: styles.errorDescription
422
- }, details.description));
423
- };
424
- return /*#__PURE__*/React.createElement(Modal, {
425
- visible: visible,
426
- transparent: true,
427
- animationType: "none",
428
- statusBarTranslucent: true,
429
- onRequestClose: onCancel
430
- }, /*#__PURE__*/React.createElement(TouchableWithoutFeedback, null, /*#__PURE__*/React.createElement(View, {
431
- style: styles.modalOverlay
432
- }, /*#__PURE__*/React.createElement(TouchableWithoutFeedback, null, /*#__PURE__*/React.createElement(View, {
433
- style: styles.bottomSheet
434
- }, /*#__PURE__*/React.createElement(View, {
435
- style: styles.handleContainer
436
- }, /*#__PURE__*/React.createElement(View, {
437
- style: styles.handle
438
- })), /*#__PURE__*/React.createElement(SafeAreaView, {
439
- style: styles.container
440
- }, /*#__PURE__*/React.createElement(View, {
441
- style: styles.content
442
- }, /*#__PURE__*/React.createElement(Image, {
443
- source: require('../assets/images/onairos_logo.png'),
444
- style: styles.onairosLogo,
445
- resizeMode: "contain"
446
- }), /*#__PURE__*/React.createElement(Text, {
447
- style: styles.title
448
- }, isEnochSDK ? 'Training AI with Inference' : 'Training Your AI'), /*#__PURE__*/React.createElement(View, {
449
- style: styles.progressContainer
450
- }, /*#__PURE__*/React.createElement(View, {
451
- style: styles.progressBar
452
- }, /*#__PURE__*/React.createElement(View, {
453
- style: [styles.progressFill, {
454
- width: `${progressPercentage}%`
455
- }]
456
- })), /*#__PURE__*/React.createElement(Text, {
457
- style: styles.progressText
458
- }, progressPercentage, "%")), /*#__PURE__*/React.createElement(Text, {
459
- style: styles.statusText
460
- }, trainingStatus), hasError && /*#__PURE__*/React.createElement(View, {
461
- style: styles.errorContainer
462
- }, /*#__PURE__*/React.createElement(Icon, {
463
- name: "error-outline",
464
- size: 24,
465
- color: "#FF6B6B"
466
- }), /*#__PURE__*/React.createElement(Text, {
467
- style: styles.errorText
468
- }, "Training encountered an error")), renderErrorDetails(), isTrainingComplete && trainingResults && /*#__PURE__*/React.createElement(View, {
469
- style: styles.resultsContainer
470
- }, /*#__PURE__*/React.createElement(Icon, {
471
- name: "check-circle",
472
- size: 32,
473
- color: "#4CAF50"
474
- }), /*#__PURE__*/React.createElement(Text, {
475
- style: styles.resultsTitle
476
- }, "Training Complete!"), /*#__PURE__*/React.createElement(View, {
477
- style: styles.resultsDetails
478
- }, /*#__PURE__*/React.createElement(View, {
479
- style: styles.resultItem
480
- }, /*#__PURE__*/React.createElement(Icon, {
481
- name: "cloud-done",
482
- size: 16,
483
- color: "#666"
484
- }), /*#__PURE__*/React.createElement(Text, {
485
- style: styles.resultText
486
- }, "Storage: ", trainingResults.storage)), /*#__PURE__*/React.createElement(View, {
487
- style: styles.resultItem
488
- }, /*#__PURE__*/React.createElement(Icon, {
489
- name: "security",
490
- size: 16,
491
- color: "#666"
492
- }), /*#__PURE__*/React.createElement(Text, {
493
- style: styles.resultText
494
- }, "Encrypted: ", trainingResults.encryption ? 'Yes' : 'No')), trainingResults.inference && /*#__PURE__*/React.createElement(View, {
495
- style: styles.resultItem
496
- }, /*#__PURE__*/React.createElement(Icon, {
497
- name: "psychology",
498
- size: 16,
499
- color: "#666"
500
- }), /*#__PURE__*/React.createElement(Text, {
501
- style: styles.resultText
502
- }, "Inference: Completed")))), /*#__PURE__*/React.createElement(View, {
503
- style: styles.footer
504
- }, /*#__PURE__*/React.createElement(TouchableOpacity, {
505
- style: styles.cancelButton,
506
- onPress: onCancel
507
- }, /*#__PURE__*/React.createElement(Text, {
508
- style: styles.cancelButtonText
509
- }, "Cancel")), (currentProgress >= 1 || isTrainingComplete) && /*#__PURE__*/React.createElement(TouchableOpacity, {
510
- style: styles.completeButton,
511
- onPress: onComplete
512
- }, /*#__PURE__*/React.createElement(Text, {
513
- style: styles.completeButtonText
514
- }, "Complete"))))))))));
515
- };
516
- const styles = StyleSheet.create({
517
- modalOverlay: {
518
- flex: 1,
519
- backgroundColor: 'rgba(0, 0, 0, 0.5)',
520
- justifyContent: 'flex-end',
521
- alignItems: 'center'
522
- },
523
- bottomSheet: {
524
- backgroundColor: '#fff',
525
- width: width,
526
- height: height * 0.8,
527
- borderTopLeftRadius: 24,
528
- borderTopRightRadius: 24,
529
- overflow: 'hidden'
530
- },
531
- handleContainer: {
532
- width: '100%',
533
- alignItems: 'center',
534
- paddingTop: 12,
535
- paddingBottom: 8
536
- },
537
- handle: {
538
- width: 40,
539
- height: 5,
540
- borderRadius: 3,
541
- backgroundColor: '#E0E0E0'
542
- },
543
- container: {
544
- flex: 1,
545
- backgroundColor: '#fff'
546
- },
547
- content: {
548
- flex: 1,
549
- width: '100%',
550
- alignItems: 'center',
551
- justifyContent: 'center',
552
- padding: 24
553
- },
554
- title: {
555
- fontSize: 24,
556
- fontWeight: '600',
557
- marginTop: 24,
558
- marginBottom: 8,
559
- color: COLORS.text.primary,
560
- textAlign: 'center'
561
- },
562
- subtitle: {
563
- fontSize: 16,
564
- color: COLORS.text.secondary,
565
- textAlign: 'center',
566
- marginBottom: 32
567
- },
568
- statusText: {
569
- fontSize: 14,
570
- color: COLORS.text.secondary,
571
- marginBottom: 24,
572
- textAlign: 'center'
573
- },
574
- progressContainer: {
575
- width: '100%',
576
- marginBottom: 16
577
- },
578
- progressBar: {
579
- height: 8,
580
- backgroundColor: COLORS.border,
581
- borderRadius: 4,
582
- overflow: 'hidden'
583
- },
584
- progressFill: {
585
- height: '100%',
586
- backgroundColor: COLORS.primary,
587
- borderRadius: 4
588
- },
589
- progressText: {
590
- fontSize: 14,
591
- color: COLORS.text.secondary,
592
- textAlign: 'center',
593
- marginTop: 8
594
- },
595
- etaText: {
596
- fontSize: 14,
597
- color: COLORS.text.secondary,
598
- marginBottom: 24
599
- },
600
- loadingContainer: {
601
- flexDirection: 'row',
602
- alignItems: 'center',
603
- marginBottom: 32
604
- },
605
- loadingText: {
606
- fontSize: 14,
607
- color: COLORS.text.secondary,
608
- marginLeft: 8
609
- },
610
- footer: {
611
- flexDirection: 'row',
612
- alignItems: 'center',
613
- justifyContent: 'space-between',
614
- width: '100%',
615
- borderTopWidth: 1,
616
- borderTopColor: '#eee',
617
- paddingTop: 16,
618
- paddingHorizontal: 24,
619
- paddingBottom: 24
620
- },
621
- cancelButton: {
622
- paddingVertical: 8,
623
- paddingHorizontal: 16
624
- },
625
- cancelButtonText: {
626
- fontSize: 16,
627
- color: '#666'
628
- },
629
- completeButton: {
630
- paddingVertical: 16,
631
- paddingHorizontal: 32,
632
- borderRadius: 16,
633
- backgroundColor: '#fff',
634
- borderWidth: 1,
635
- borderColor: '#000'
636
- },
637
- completeButtonText: {
638
- fontSize: 16,
639
- fontWeight: '600',
640
- color: '#000'
641
- },
642
- onairosLogo: {
643
- width: 48,
644
- height: 48
645
- },
646
- errorContainer: {
647
- flexDirection: 'row',
648
- alignItems: 'center',
649
- marginBottom: 16
650
- },
651
- errorText: {
652
- fontSize: 14,
653
- color: '#FF6B6B',
654
- marginLeft: 8
655
- },
656
- errorDetailsContainer: {
657
- alignItems: 'center',
658
- marginBottom: 24,
659
- padding: 16,
660
- backgroundColor: '#FFF5F5',
661
- borderRadius: 12,
662
- borderWidth: 1,
663
- borderColor: '#FFEBEE'
664
- },
665
- errorTitle: {
666
- fontSize: 16,
667
- fontWeight: '600',
668
- color: '#FF6B6B',
669
- marginTop: 8,
670
- marginBottom: 4
671
- },
672
- errorDescription: {
673
- fontSize: 14,
674
- color: '#666',
675
- textAlign: 'center'
676
- },
677
- resultsContainer: {
678
- alignItems: 'center',
679
- marginBottom: 24,
680
- padding: 16,
681
- backgroundColor: '#F5F5F5',
682
- borderRadius: 12,
683
- borderWidth: 1,
684
- borderColor: '#E0E0E0'
685
- },
686
- resultsTitle: {
687
- fontSize: 16,
688
- fontWeight: '600',
689
- color: '#4CAF50',
690
- marginTop: 8,
691
- marginBottom: 12
692
- },
693
- resultsDetails: {
694
- alignItems: 'flex-start',
695
- width: '100%'
696
- },
697
- resultItem: {
698
- flexDirection: 'row',
699
- alignItems: 'center',
700
- marginBottom: 4
701
- },
702
- resultText: {
703
- fontSize: 14,
704
- color: '#666',
705
- marginLeft: 8
706
- }
707
- });
708
- //# sourceMappingURL=TrainingModal.js.map