@onairos/react-native 3.1.18 → 3.2.1

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 (734) hide show
  1. package/README.md +374 -403
  2. package/lib/commonjs/api/index.js +1 -75
  3. package/lib/commonjs/api/index.js.map +1 -1
  4. package/lib/commonjs/assets/images/email.png +0 -0
  5. package/lib/commonjs/assets/images/linkedin.png +0 -0
  6. package/lib/commonjs/assets/images/reddit.png +0 -0
  7. package/lib/commonjs/assets/images/youtube.png +0 -0
  8. package/lib/commonjs/components/DataRequestModal.js.map +1 -1
  9. package/lib/commonjs/components/DataRequestScreen.js.map +1 -1
  10. package/lib/commonjs/components/EmailVerificationModal.js.map +1 -1
  11. package/lib/commonjs/components/Onairos.js +3 -1
  12. package/lib/commonjs/components/Onairos.js.map +1 -1
  13. package/lib/commonjs/components/OnairosButton.js +190 -171
  14. package/lib/commonjs/components/OnairosButton.js.map +1 -1
  15. package/lib/commonjs/components/Overlay.js +5 -5
  16. package/lib/commonjs/components/Overlay.js.map +1 -1
  17. package/lib/commonjs/components/PinInput.js +120 -282
  18. package/lib/commonjs/components/PinInput.js.map +1 -1
  19. package/lib/commonjs/components/PlatformList.js.map +1 -1
  20. package/lib/commonjs/components/TrainingModal.js +563 -808
  21. package/lib/commonjs/components/TrainingModal.js.map +1 -1
  22. package/lib/commonjs/components/UniversalOnboarding.js +1296 -2302
  23. package/lib/commonjs/components/UniversalOnboarding.js.map +1 -1
  24. package/lib/commonjs/components/UniversalOnboarding.tsx.new +455 -0
  25. package/lib/commonjs/components/onboarding/OAuthWebView.js +743 -134
  26. package/lib/commonjs/components/onboarding/OAuthWebView.js.map +1 -1
  27. package/lib/commonjs/components/onboarding/OnboardingHeader.js.map +1 -1
  28. package/lib/commonjs/components/onboarding/PinInput.js.map +1 -1
  29. package/lib/commonjs/components/onboarding/PlatformConnector.js.map +1 -1
  30. package/lib/commonjs/components/screens/ConnectorScreen.js.map +1 -1
  31. package/lib/commonjs/components/screens/LoadingScreen.js.map +1 -1
  32. package/lib/commonjs/components/screens/PinCreationScreen.js.map +1 -1
  33. package/lib/commonjs/constants/index.js.map +1 -1
  34. package/lib/commonjs/hooks/useConnections.js +125 -120
  35. package/lib/commonjs/hooks/useConnections.js.map +1 -1
  36. package/lib/commonjs/hooks/useCredentials.js.map +1 -1
  37. package/lib/commonjs/index.js +27 -157
  38. package/lib/commonjs/index.js.map +1 -1
  39. package/lib/commonjs/services/SDK_API_KEY_VALIDATION.md +428 -0
  40. package/lib/commonjs/services/apiKeyService.js +106 -105
  41. package/lib/commonjs/services/apiKeyService.js.map +1 -1
  42. package/lib/commonjs/services/oauthService.js.map +1 -1
  43. package/lib/commonjs/services/platformAuthService.js +722 -956
  44. package/lib/commonjs/services/platformAuthService.js.map +1 -1
  45. package/lib/commonjs/types/ambient.d.js.map +1 -1
  46. package/lib/commonjs/types/declarations.d.js.map +1 -1
  47. package/lib/commonjs/types/index.d.js.map +1 -1
  48. package/lib/commonjs/types/index.js.map +1 -1
  49. package/lib/commonjs/types/node-fix.d.js.map +1 -1
  50. package/lib/commonjs/types/node-override.d.js.map +1 -1
  51. package/lib/commonjs/types/opacity.d.js.map +1 -1
  52. package/lib/commonjs/types/types.d.js.map +1 -1
  53. package/lib/commonjs/types.js.map +1 -1
  54. package/lib/commonjs/utils/Portal.js +4 -4
  55. package/lib/commonjs/utils/Portal.js.map +1 -1
  56. package/lib/commonjs/utils/api.js +24 -24
  57. package/lib/commonjs/utils/api.js.map +1 -1
  58. package/lib/commonjs/utils/auth.js +18 -18
  59. package/lib/commonjs/utils/auth.js.map +1 -1
  60. package/lib/commonjs/utils/crypto.js +13 -13
  61. package/lib/commonjs/utils/crypto.js.map +1 -1
  62. package/lib/commonjs/utils/debugHelper.js.map +1 -1
  63. package/lib/commonjs/utils/encryption.js +12 -12
  64. package/lib/commonjs/utils/encryption.js.map +1 -1
  65. package/lib/commonjs/utils/onairosApi.js.map +1 -1
  66. package/lib/commonjs/utils/programmaticFlow.js +16 -16
  67. package/lib/commonjs/utils/programmaticFlow.js.map +1 -1
  68. package/lib/commonjs/utils/retryHelper.js +27 -27
  69. package/lib/commonjs/utils/retryHelper.js.map +1 -1
  70. package/lib/commonjs/utils/secureStorage.js.map +1 -1
  71. package/lib/module/api/index.js +0 -72
  72. package/lib/module/api/index.js.map +1 -1
  73. package/lib/module/assets/images/email.png +0 -0
  74. package/lib/module/assets/images/linkedin.png +0 -0
  75. package/lib/module/assets/images/reddit.png +0 -0
  76. package/lib/module/assets/images/youtube.png +0 -0
  77. package/lib/module/components/DataRequestModal.js.map +1 -1
  78. package/lib/module/components/DataRequestScreen.js.map +1 -1
  79. package/lib/module/components/EmailVerificationModal.js.map +1 -1
  80. package/lib/module/components/Onairos.js +3 -1
  81. package/lib/module/components/Onairos.js.map +1 -1
  82. package/lib/module/components/OnairosButton.js +192 -172
  83. package/lib/module/components/OnairosButton.js.map +1 -1
  84. package/lib/module/components/Overlay.js +5 -5
  85. package/lib/module/components/Overlay.js.map +1 -1
  86. package/lib/module/components/PinInput.js +120 -283
  87. package/lib/module/components/PinInput.js.map +1 -1
  88. package/lib/module/components/PlatformList.js.map +1 -1
  89. package/lib/module/components/TrainingModal.js +565 -809
  90. package/lib/module/components/TrainingModal.js.map +1 -1
  91. package/lib/module/components/UniversalOnboarding.js +1297 -2305
  92. package/lib/module/components/UniversalOnboarding.js.map +1 -1
  93. package/lib/module/components/UniversalOnboarding.tsx.new +455 -0
  94. package/lib/module/components/onboarding/OAuthWebView.js +744 -136
  95. package/lib/module/components/onboarding/OAuthWebView.js.map +1 -1
  96. package/lib/module/components/onboarding/OnboardingHeader.js.map +1 -1
  97. package/lib/module/components/onboarding/PinInput.js.map +1 -1
  98. package/lib/module/components/onboarding/PlatformConnector.js.map +1 -1
  99. package/lib/module/components/screens/ConnectorScreen.js.map +1 -1
  100. package/lib/module/components/screens/LoadingScreen.js.map +1 -1
  101. package/lib/module/components/screens/PinCreationScreen.js.map +1 -1
  102. package/lib/module/constants/index.js.map +1 -1
  103. package/lib/module/hooks/useConnections.js +125 -119
  104. package/lib/module/hooks/useConnections.js.map +1 -1
  105. package/lib/module/hooks/useCredentials.js.map +1 -1
  106. package/lib/module/index.js +17 -55
  107. package/lib/module/index.js.map +1 -1
  108. package/lib/module/services/SDK_API_KEY_VALIDATION.md +428 -0
  109. package/lib/module/services/apiKeyService.js +106 -105
  110. package/lib/module/services/apiKeyService.js.map +1 -1
  111. package/lib/module/services/oauthService.js.map +1 -1
  112. package/lib/module/services/platformAuthService.js +704 -943
  113. package/lib/module/services/platformAuthService.js.map +1 -1
  114. package/lib/module/types/ambient.d.js.map +1 -1
  115. package/lib/module/types/declarations.d.js.map +1 -1
  116. package/lib/module/types/index.d.js.map +1 -1
  117. package/lib/module/types/index.js.map +1 -1
  118. package/lib/module/types/node-fix.d.js.map +1 -1
  119. package/lib/module/types/node-override.d.js.map +1 -1
  120. package/lib/module/types/opacity.d.js.map +1 -1
  121. package/lib/module/types/types.d.js.map +1 -1
  122. package/lib/module/types.js.map +1 -1
  123. package/lib/module/utils/Portal.js +4 -4
  124. package/lib/module/utils/Portal.js.map +1 -1
  125. package/lib/module/utils/api.js +24 -24
  126. package/lib/module/utils/api.js.map +1 -1
  127. package/lib/module/utils/auth.js +18 -18
  128. package/lib/module/utils/auth.js.map +1 -1
  129. package/lib/module/utils/crypto.js +13 -13
  130. package/lib/module/utils/crypto.js.map +1 -1
  131. package/lib/module/utils/debugHelper.js.map +1 -1
  132. package/lib/module/utils/encryption.js +12 -12
  133. package/lib/module/utils/encryption.js.map +1 -1
  134. package/lib/module/utils/onairosApi.js.map +1 -1
  135. package/lib/module/utils/programmaticFlow.js +16 -16
  136. package/lib/module/utils/programmaticFlow.js.map +1 -1
  137. package/lib/module/utils/retryHelper.js +27 -27
  138. package/lib/module/utils/retryHelper.js.map +1 -1
  139. package/lib/module/utils/secureStorage.js.map +1 -1
  140. package/lib/typescript/api/index.d.ts +7 -15
  141. package/lib/typescript/api/index.d.ts.map +1 -1
  142. package/lib/typescript/components/DataRequestModal.d.ts +10 -10
  143. package/lib/typescript/components/DataRequestScreen.d.ts +10 -10
  144. package/lib/typescript/components/EmailVerificationModal.d.ts +10 -10
  145. package/lib/typescript/components/Onairos.d.ts +3 -3
  146. package/lib/typescript/components/Onairos.d.ts.map +1 -1
  147. package/lib/typescript/components/OnairosButton.d.ts +11 -36
  148. package/lib/typescript/components/OnairosButton.d.ts.map +1 -1
  149. package/lib/typescript/components/Overlay.d.ts +3 -3
  150. package/lib/typescript/components/PinInput.d.ts +3 -13
  151. package/lib/typescript/components/PinInput.d.ts.map +1 -1
  152. package/lib/typescript/components/PlatformList.d.ts +3 -3
  153. package/lib/typescript/components/TrainingModal.d.ts +3 -14
  154. package/lib/typescript/components/TrainingModal.d.ts.map +1 -1
  155. package/lib/typescript/components/UniversalOnboarding.d.ts +3 -16
  156. package/lib/typescript/components/UniversalOnboarding.d.ts.map +1 -1
  157. package/lib/typescript/components/onboarding/OAuthWebView.d.ts +9 -9
  158. package/lib/typescript/components/onboarding/OAuthWebView.d.ts.map +1 -1
  159. package/lib/typescript/components/onboarding/OnboardingHeader.d.ts +10 -10
  160. package/lib/typescript/components/onboarding/PinInput.d.ts +3 -3
  161. package/lib/typescript/components/onboarding/PlatformConnector.d.ts +12 -12
  162. package/lib/typescript/components/screens/ConnectorScreen.d.ts +8 -8
  163. package/lib/typescript/components/screens/LoadingScreen.d.ts +8 -8
  164. package/lib/typescript/components/screens/PinCreationScreen.d.ts +9 -9
  165. package/lib/typescript/constants/index.d.ts +52 -52
  166. package/lib/typescript/hooks/useConnections.d.ts +8 -13
  167. package/lib/typescript/hooks/useConnections.d.ts.map +1 -1
  168. package/lib/typescript/hooks/useCredentials.d.ts +8 -8
  169. package/lib/typescript/index.d.ts +17 -38
  170. package/lib/typescript/index.d.ts.map +1 -1
  171. package/lib/typescript/services/apiKeyService.d.ts +131 -131
  172. package/lib/typescript/services/apiKeyService.d.ts.map +1 -1
  173. package/lib/typescript/services/oauthService.d.ts +49 -49
  174. package/lib/typescript/services/platformAuthService.d.ts +143 -68
  175. package/lib/typescript/services/platformAuthService.d.ts.map +1 -1
  176. package/lib/typescript/types/index.d.ts +228 -264
  177. package/lib/typescript/types/index.d.ts.map +1 -1
  178. package/lib/typescript/types.d.ts +268 -266
  179. package/lib/typescript/types.d.ts.map +1 -1
  180. package/lib/typescript/utils/Portal.d.ts +13 -13
  181. package/lib/typescript/utils/api.d.ts +5 -5
  182. package/lib/typescript/utils/auth.d.ts +5 -5
  183. package/lib/typescript/utils/crypto.d.ts +3 -3
  184. package/lib/typescript/utils/debugHelper.d.ts +28 -28
  185. package/lib/typescript/utils/encryption.d.ts +18 -18
  186. package/lib/typescript/utils/onairosApi.d.ts +86 -86
  187. package/lib/typescript/utils/programmaticFlow.d.ts +22 -22
  188. package/lib/typescript/utils/retryHelper.d.ts +68 -68
  189. package/lib/typescript/utils/secureStorage.d.ts +93 -93
  190. package/package.json +149 -145
  191. package/src/api/index.ts +110 -151
  192. package/src/assets/images/email.png +0 -0
  193. package/src/assets/images/linkedin.png +0 -0
  194. package/src/assets/images/reddit.png +0 -0
  195. package/src/assets/images/youtube.png +0 -0
  196. package/src/components/DataRequestScreen.tsx +355 -355
  197. package/src/components/EmailVerificationModal.tsx +363 -363
  198. package/src/components/Onairos.tsx +424 -422
  199. package/src/components/OnairosButton.tsx +359 -339
  200. package/src/components/Overlay.tsx +506 -506
  201. package/src/components/PinInput.tsx +343 -555
  202. package/src/components/PlatformList.tsx +144 -144
  203. package/src/components/TrainingModal.tsx +737 -1047
  204. package/src/components/UniversalOnboarding.tsx +1839 -2888
  205. package/src/components/UniversalOnboarding.tsx.new +455 -0
  206. package/src/components/onboarding/OAuthWebView.tsx +838 -232
  207. package/src/hooks/useConnections.ts +163 -161
  208. package/src/hooks/useCredentials.ts +174 -174
  209. package/src/index.js +14 -14
  210. package/src/index.ts +49 -99
  211. package/src/services/SDK_API_KEY_VALIDATION.md +428 -0
  212. package/src/services/apiKeyService.ts +921 -919
  213. package/src/services/platformAuthService.ts +1113 -1346
  214. package/src/types/ambient.d.ts +28 -28
  215. package/src/types/index.ts +241 -265
  216. package/src/types/node-fix.d.ts +18 -18
  217. package/src/types/node-override.d.ts +23 -23
  218. package/src/types/opacity.d.ts +15 -15
  219. package/src/types/types.d.ts +17 -17
  220. package/src/types.ts +6 -4
  221. package/src/utils/Portal.tsx +82 -82
  222. package/src/utils/api.js +111 -111
  223. package/src/utils/auth.js +103 -103
  224. package/src/utils/crypto.js +59 -59
  225. package/src/utils/encryption.ts +68 -68
  226. package/src/utils/programmaticFlow.ts +112 -112
  227. package/src/utils/retryHelper.ts +274 -274
  228. package/types/index.d.ts +213 -213
  229. package/types/node-env.d.ts +14 -14
  230. package/lib/commonjs/assets/fonts/EBGaramond-VariableFont_wght.ttf +0 -0
  231. package/lib/commonjs/assets/fonts/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
  232. package/lib/commonjs/assets/icons/Facebookicon.png +0 -0
  233. package/lib/commonjs/assets/icons/Gmail.png +0 -0
  234. package/lib/commonjs/assets/icons/Linkedinicon.png +0 -0
  235. package/lib/commonjs/assets/icons/Redditicon.png +0 -0
  236. package/lib/commonjs/assets/icons/YouTubeicon2.png +0 -0
  237. package/lib/commonjs/assets/icons/YouTubeicon3.png +0 -0
  238. package/lib/commonjs/assets/icons/farcaster.png +0 -0
  239. package/lib/commonjs/assets/icons/instagram.png +0 -0
  240. package/lib/commonjs/assets/icons/pinterest.png +0 -0
  241. package/lib/commonjs/assets/icons/swerv_logo.png +0 -0
  242. package/lib/commonjs/assets/icons/twitter.jpg +0 -0
  243. package/lib/commonjs/assets/images/Checkbox.svg +0 -3
  244. package/lib/commonjs/assets/images/EnochE.svg +0 -19
  245. package/lib/commonjs/assets/images/Enochicon1.png +0 -0
  246. package/lib/commonjs/assets/images/Face_ID_logo.png +0 -0
  247. package/lib/commonjs/assets/images/Facebookicon.png +0 -0
  248. package/lib/commonjs/assets/images/Gmail.png +0 -0
  249. package/lib/commonjs/assets/images/Googlelogo.png +0 -0
  250. package/lib/commonjs/assets/images/Linkedinicon.png +0 -0
  251. package/lib/commonjs/assets/images/Onairoslogo.png +0 -0
  252. package/lib/commonjs/assets/images/Personalityprofile.svg +0 -3
  253. package/lib/commonjs/assets/images/Personalitytraits.svg +0 -3
  254. package/lib/commonjs/assets/images/Redditicon.png +0 -0
  255. package/lib/commonjs/assets/images/Userpreferences.svg +0 -3
  256. package/lib/commonjs/assets/images/YouTubeicon3.png +0 -0
  257. package/lib/commonjs/assets/images/arrow.svg +0 -20
  258. package/lib/commonjs/assets/images/basicproficon.svg +0 -43
  259. package/lib/commonjs/assets/images/basicprofile.svg +0 -3
  260. package/lib/commonjs/assets/images/checkmark.svg +0 -4
  261. package/lib/commonjs/assets/images/contentanalysis.svg +0 -3
  262. package/lib/commonjs/assets/images/contenticon.svg +0 -23
  263. package/lib/commonjs/assets/images/persona1.png +0 -0
  264. package/lib/commonjs/assets/images/persona2.png +0 -0
  265. package/lib/commonjs/assets/images/persona3.png +0 -0
  266. package/lib/commonjs/assets/images/persona4.png +0 -0
  267. package/lib/commonjs/assets/images/persona5.png +0 -0
  268. package/lib/commonjs/assets/images/personalityicon.svg +0 -18
  269. package/lib/commonjs/assets/images/x-close.svg +0 -3
  270. package/lib/commonjs/components/BodyText.js +0 -27
  271. package/lib/commonjs/components/BodyText.js.map +0 -1
  272. package/lib/commonjs/components/BrandMark.js +0 -44
  273. package/lib/commonjs/components/BrandMark.js.map +0 -1
  274. package/lib/commonjs/components/CodeInput.js +0 -30
  275. package/lib/commonjs/components/CodeInput.js.map +0 -1
  276. package/lib/commonjs/components/EmailInput.js +0 -30
  277. package/lib/commonjs/components/EmailInput.js.map +0 -1
  278. package/lib/commonjs/components/ExistingUserDataConfirmation.js +0 -474
  279. package/lib/commonjs/components/ExistingUserDataConfirmation.js.map +0 -1
  280. package/lib/commonjs/components/GoogleButton.js +0 -55
  281. package/lib/commonjs/components/GoogleButton.js.map +0 -1
  282. package/lib/commonjs/components/HeadingGroup.js +0 -43
  283. package/lib/commonjs/components/HeadingGroup.js.map +0 -1
  284. package/lib/commonjs/components/ModalHeader.js +0 -99
  285. package/lib/commonjs/components/ModalHeader.js.map +0 -1
  286. package/lib/commonjs/components/ModalSheet.js +0 -47
  287. package/lib/commonjs/components/ModalSheet.js.map +0 -1
  288. package/lib/commonjs/components/OnairosSignInButton.js +0 -129
  289. package/lib/commonjs/components/OnairosSignInButton.js.map +0 -1
  290. package/lib/commonjs/components/PersonaImage.js +0 -60
  291. package/lib/commonjs/components/PersonaImage.js.map +0 -1
  292. package/lib/commonjs/components/PersonaLoadingScreen.js +0 -156
  293. package/lib/commonjs/components/PersonaLoadingScreen.js.map +0 -1
  294. package/lib/commonjs/components/PersonalizationConsentScreen.js +0 -316
  295. package/lib/commonjs/components/PersonalizationConsentScreen.js.map +0 -1
  296. package/lib/commonjs/components/PinCreationScreen.js +0 -393
  297. package/lib/commonjs/components/PinCreationScreen.js.map +0 -1
  298. package/lib/commonjs/components/PlatformConnectorsStep.js +0 -828
  299. package/lib/commonjs/components/PlatformConnectorsStep.js.map +0 -1
  300. package/lib/commonjs/components/PlatformToggle.js +0 -180
  301. package/lib/commonjs/components/PlatformToggle.js.map +0 -1
  302. package/lib/commonjs/components/PrimaryButton.js +0 -180
  303. package/lib/commonjs/components/PrimaryButton.js.map +0 -1
  304. package/lib/commonjs/components/SignInMatchAnimation.js +0 -197
  305. package/lib/commonjs/components/SignInMatchAnimation.js.map +0 -1
  306. package/lib/commonjs/components/SignInStep.js +0 -179
  307. package/lib/commonjs/components/SignInStep.js.map +0 -1
  308. package/lib/commonjs/components/VerificationStep.js +0 -154
  309. package/lib/commonjs/components/VerificationStep.js.map +0 -1
  310. package/lib/commonjs/components/WelcomeScreen.js +0 -401
  311. package/lib/commonjs/components/WelcomeScreen.js.map +0 -1
  312. package/lib/commonjs/components/icons/Basicproficon.js +0 -37
  313. package/lib/commonjs/components/icons/Basicproficon.js.map +0 -1
  314. package/lib/commonjs/components/icons/Basicprofile.js +0 -21
  315. package/lib/commonjs/components/icons/Basicprofile.js.map +0 -1
  316. package/lib/commonjs/components/icons/Checkbox.js +0 -21
  317. package/lib/commonjs/components/icons/Checkbox.js.map +0 -1
  318. package/lib/commonjs/components/icons/Checkmark.js +0 -27
  319. package/lib/commonjs/components/icons/Checkmark.js.map +0 -1
  320. package/lib/commonjs/components/icons/Contentanalysis.js +0 -21
  321. package/lib/commonjs/components/icons/Contentanalysis.js.map +0 -1
  322. package/lib/commonjs/components/icons/Contenticon.js +0 -39
  323. package/lib/commonjs/components/icons/Contenticon.js.map +0 -1
  324. package/lib/commonjs/components/icons/EnochE.js +0 -41
  325. package/lib/commonjs/components/icons/EnochE.js.map +0 -1
  326. package/lib/commonjs/components/icons/Personalityicon.js +0 -30
  327. package/lib/commonjs/components/icons/Personalityicon.js.map +0 -1
  328. package/lib/commonjs/components/icons/Personalityprofile.js +0 -21
  329. package/lib/commonjs/components/icons/Personalityprofile.js.map +0 -1
  330. package/lib/commonjs/components/icons/Personalitytraits.js +0 -21
  331. package/lib/commonjs/components/icons/Personalitytraits.js.map +0 -1
  332. package/lib/commonjs/components/icons/Userpreferences.js +0 -21
  333. package/lib/commonjs/components/icons/Userpreferences.js.map +0 -1
  334. package/lib/commonjs/components/icons/index.js +0 -84
  335. package/lib/commonjs/components/icons/index.js.map +0 -1
  336. package/lib/commonjs/config/api.js +0 -34
  337. package/lib/commonjs/config/api.js.map +0 -1
  338. package/lib/commonjs/context/AuthContext.js +0 -345
  339. package/lib/commonjs/context/AuthContext.js.map +0 -1
  340. package/lib/commonjs/hooks/useConnectedAccounts.js +0 -111
  341. package/lib/commonjs/hooks/useConnectedAccounts.js.map +0 -1
  342. package/lib/commonjs/hooks/useUserConnections.js +0 -148
  343. package/lib/commonjs/hooks/useUserConnections.js.map +0 -1
  344. package/lib/commonjs/services/apiClient.js +0 -302
  345. package/lib/commonjs/services/apiClient.js.map +0 -1
  346. package/lib/commonjs/services/authService.js +0 -935
  347. package/lib/commonjs/services/authService.js.map +0 -1
  348. package/lib/commonjs/services/biometricPinService.js +0 -184
  349. package/lib/commonjs/services/biometricPinService.js.map +0 -1
  350. package/lib/commonjs/services/connectedAccountsService.js +0 -268
  351. package/lib/commonjs/services/connectedAccountsService.js.map +0 -1
  352. package/lib/commonjs/services/googleAuthService.js +0 -268
  353. package/lib/commonjs/services/googleAuthService.js.map +0 -1
  354. package/lib/commonjs/services/imageCompressionService.js +0 -260
  355. package/lib/commonjs/services/imageCompressionService.js.map +0 -1
  356. package/lib/commonjs/services/jwtStorageService.js +0 -256
  357. package/lib/commonjs/services/jwtStorageService.js.map +0 -1
  358. package/lib/commonjs/services/mobileTrainingService.js +0 -185
  359. package/lib/commonjs/services/mobileTrainingService.js.map +0 -1
  360. package/lib/commonjs/services/pinEncryptionService.js +0 -84
  361. package/lib/commonjs/services/pinEncryptionService.js.map +0 -1
  362. package/lib/commonjs/services/pinStorageUtils.js +0 -105
  363. package/lib/commonjs/services/pinStorageUtils.js.map +0 -1
  364. package/lib/commonjs/services/storageService.js +0 -404
  365. package/lib/commonjs/services/storageService.js.map +0 -1
  366. package/lib/commonjs/services/trainingApiHelpers.js +0 -73
  367. package/lib/commonjs/services/trainingApiHelpers.js.map +0 -1
  368. package/lib/commonjs/services/userConnectionsService.js +0 -486
  369. package/lib/commonjs/services/userConnectionsService.js.map +0 -1
  370. package/lib/commonjs/services/youtubeMigrationService.js +0 -415
  371. package/lib/commonjs/services/youtubeMigrationService.js.map +0 -1
  372. package/lib/commonjs/theme/index.js +0 -249
  373. package/lib/commonjs/theme/index.js.map +0 -1
  374. package/lib/commonjs/utils/eventUtils.js +0 -288
  375. package/lib/commonjs/utils/eventUtils.js.map +0 -1
  376. package/lib/commonjs/utils/haptics.js +0 -66
  377. package/lib/commonjs/utils/haptics.js.map +0 -1
  378. package/lib/commonjs/utils/imagePreloader.js +0 -6
  379. package/lib/commonjs/utils/imagePreloader.js.map +0 -1
  380. package/lib/module/assets/fonts/EBGaramond-VariableFont_wght.ttf +0 -0
  381. package/lib/module/assets/fonts/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
  382. package/lib/module/assets/icons/Facebookicon.png +0 -0
  383. package/lib/module/assets/icons/Gmail.png +0 -0
  384. package/lib/module/assets/icons/Linkedinicon.png +0 -0
  385. package/lib/module/assets/icons/Redditicon.png +0 -0
  386. package/lib/module/assets/icons/YouTubeicon2.png +0 -0
  387. package/lib/module/assets/icons/YouTubeicon3.png +0 -0
  388. package/lib/module/assets/icons/farcaster.png +0 -0
  389. package/lib/module/assets/icons/instagram.png +0 -0
  390. package/lib/module/assets/icons/pinterest.png +0 -0
  391. package/lib/module/assets/icons/swerv_logo.png +0 -0
  392. package/lib/module/assets/icons/twitter.jpg +0 -0
  393. package/lib/module/assets/images/Checkbox.svg +0 -3
  394. package/lib/module/assets/images/EnochE.svg +0 -19
  395. package/lib/module/assets/images/Enochicon1.png +0 -0
  396. package/lib/module/assets/images/Face_ID_logo.png +0 -0
  397. package/lib/module/assets/images/Facebookicon.png +0 -0
  398. package/lib/module/assets/images/Gmail.png +0 -0
  399. package/lib/module/assets/images/Googlelogo.png +0 -0
  400. package/lib/module/assets/images/Linkedinicon.png +0 -0
  401. package/lib/module/assets/images/Onairoslogo.png +0 -0
  402. package/lib/module/assets/images/Personalityprofile.svg +0 -3
  403. package/lib/module/assets/images/Personalitytraits.svg +0 -3
  404. package/lib/module/assets/images/Redditicon.png +0 -0
  405. package/lib/module/assets/images/Userpreferences.svg +0 -3
  406. package/lib/module/assets/images/YouTubeicon3.png +0 -0
  407. package/lib/module/assets/images/arrow.svg +0 -20
  408. package/lib/module/assets/images/basicproficon.svg +0 -43
  409. package/lib/module/assets/images/basicprofile.svg +0 -3
  410. package/lib/module/assets/images/checkmark.svg +0 -4
  411. package/lib/module/assets/images/contentanalysis.svg +0 -3
  412. package/lib/module/assets/images/contenticon.svg +0 -23
  413. package/lib/module/assets/images/persona1.png +0 -0
  414. package/lib/module/assets/images/persona2.png +0 -0
  415. package/lib/module/assets/images/persona3.png +0 -0
  416. package/lib/module/assets/images/persona4.png +0 -0
  417. package/lib/module/assets/images/persona5.png +0 -0
  418. package/lib/module/assets/images/personalityicon.svg +0 -18
  419. package/lib/module/assets/images/x-close.svg +0 -3
  420. package/lib/module/components/BodyText.js +0 -20
  421. package/lib/module/components/BodyText.js.map +0 -1
  422. package/lib/module/components/BrandMark.js +0 -37
  423. package/lib/module/components/BrandMark.js.map +0 -1
  424. package/lib/module/components/CodeInput.js +0 -23
  425. package/lib/module/components/CodeInput.js.map +0 -1
  426. package/lib/module/components/EmailInput.js +0 -23
  427. package/lib/module/components/EmailInput.js.map +0 -1
  428. package/lib/module/components/ExistingUserDataConfirmation.js +0 -465
  429. package/lib/module/components/ExistingUserDataConfirmation.js.map +0 -1
  430. package/lib/module/components/GoogleButton.js +0 -48
  431. package/lib/module/components/GoogleButton.js.map +0 -1
  432. package/lib/module/components/HeadingGroup.js +0 -36
  433. package/lib/module/components/HeadingGroup.js.map +0 -1
  434. package/lib/module/components/ModalHeader.js +0 -92
  435. package/lib/module/components/ModalHeader.js.map +0 -1
  436. package/lib/module/components/ModalSheet.js +0 -39
  437. package/lib/module/components/ModalSheet.js.map +0 -1
  438. package/lib/module/components/OnairosSignInButton.js +0 -120
  439. package/lib/module/components/OnairosSignInButton.js.map +0 -1
  440. package/lib/module/components/PersonaImage.js +0 -53
  441. package/lib/module/components/PersonaImage.js.map +0 -1
  442. package/lib/module/components/PersonaLoadingScreen.js +0 -148
  443. package/lib/module/components/PersonaLoadingScreen.js.map +0 -1
  444. package/lib/module/components/PersonalizationConsentScreen.js +0 -309
  445. package/lib/module/components/PersonalizationConsentScreen.js.map +0 -1
  446. package/lib/module/components/PinCreationScreen.js +0 -386
  447. package/lib/module/components/PinCreationScreen.js.map +0 -1
  448. package/lib/module/components/PlatformConnectorsStep.js +0 -820
  449. package/lib/module/components/PlatformConnectorsStep.js.map +0 -1
  450. package/lib/module/components/PlatformToggle.js +0 -173
  451. package/lib/module/components/PlatformToggle.js.map +0 -1
  452. package/lib/module/components/PrimaryButton.js +0 -172
  453. package/lib/module/components/PrimaryButton.js.map +0 -1
  454. package/lib/module/components/SignInMatchAnimation.js +0 -189
  455. package/lib/module/components/SignInMatchAnimation.js.map +0 -1
  456. package/lib/module/components/SignInStep.js +0 -171
  457. package/lib/module/components/SignInStep.js.map +0 -1
  458. package/lib/module/components/VerificationStep.js +0 -146
  459. package/lib/module/components/VerificationStep.js.map +0 -1
  460. package/lib/module/components/WelcomeScreen.js +0 -393
  461. package/lib/module/components/WelcomeScreen.js.map +0 -1
  462. package/lib/module/components/icons/Basicproficon.js +0 -30
  463. package/lib/module/components/icons/Basicproficon.js.map +0 -1
  464. package/lib/module/components/icons/Basicprofile.js +0 -14
  465. package/lib/module/components/icons/Basicprofile.js.map +0 -1
  466. package/lib/module/components/icons/Checkbox.js +0 -14
  467. package/lib/module/components/icons/Checkbox.js.map +0 -1
  468. package/lib/module/components/icons/Checkmark.js +0 -20
  469. package/lib/module/components/icons/Checkmark.js.map +0 -1
  470. package/lib/module/components/icons/Contentanalysis.js +0 -14
  471. package/lib/module/components/icons/Contentanalysis.js.map +0 -1
  472. package/lib/module/components/icons/Contenticon.js +0 -32
  473. package/lib/module/components/icons/Contenticon.js.map +0 -1
  474. package/lib/module/components/icons/EnochE.js +0 -34
  475. package/lib/module/components/icons/EnochE.js.map +0 -1
  476. package/lib/module/components/icons/Personalityicon.js +0 -23
  477. package/lib/module/components/icons/Personalityicon.js.map +0 -1
  478. package/lib/module/components/icons/Personalityprofile.js +0 -14
  479. package/lib/module/components/icons/Personalityprofile.js.map +0 -1
  480. package/lib/module/components/icons/Personalitytraits.js +0 -14
  481. package/lib/module/components/icons/Personalitytraits.js.map +0 -1
  482. package/lib/module/components/icons/Userpreferences.js +0 -14
  483. package/lib/module/components/icons/Userpreferences.js.map +0 -1
  484. package/lib/module/components/icons/index.js +0 -13
  485. package/lib/module/components/icons/index.js.map +0 -1
  486. package/lib/module/config/api.js +0 -26
  487. package/lib/module/config/api.js.map +0 -1
  488. package/lib/module/context/AuthContext.js +0 -335
  489. package/lib/module/context/AuthContext.js.map +0 -1
  490. package/lib/module/hooks/useConnectedAccounts.js +0 -106
  491. package/lib/module/hooks/useConnectedAccounts.js.map +0 -1
  492. package/lib/module/hooks/useUserConnections.js +0 -140
  493. package/lib/module/hooks/useUserConnections.js.map +0 -1
  494. package/lib/module/services/apiClient.js +0 -298
  495. package/lib/module/services/apiClient.js.map +0 -1
  496. package/lib/module/services/authService.js +0 -905
  497. package/lib/module/services/authService.js.map +0 -1
  498. package/lib/module/services/biometricPinService.js +0 -173
  499. package/lib/module/services/biometricPinService.js.map +0 -1
  500. package/lib/module/services/connectedAccountsService.js +0 -255
  501. package/lib/module/services/connectedAccountsService.js.map +0 -1
  502. package/lib/module/services/googleAuthService.js +0 -258
  503. package/lib/module/services/googleAuthService.js.map +0 -1
  504. package/lib/module/services/imageCompressionService.js +0 -250
  505. package/lib/module/services/imageCompressionService.js.map +0 -1
  506. package/lib/module/services/jwtStorageService.js +0 -239
  507. package/lib/module/services/jwtStorageService.js.map +0 -1
  508. package/lib/module/services/mobileTrainingService.js +0 -172
  509. package/lib/module/services/mobileTrainingService.js.map +0 -1
  510. package/lib/module/services/pinEncryptionService.js +0 -75
  511. package/lib/module/services/pinEncryptionService.js.map +0 -1
  512. package/lib/module/services/pinStorageUtils.js +0 -93
  513. package/lib/module/services/pinStorageUtils.js.map +0 -1
  514. package/lib/module/services/storageService.js +0 -383
  515. package/lib/module/services/storageService.js.map +0 -1
  516. package/lib/module/services/trainingApiHelpers.js +0 -67
  517. package/lib/module/services/trainingApiHelpers.js.map +0 -1
  518. package/lib/module/services/userConnectionsService.js +0 -476
  519. package/lib/module/services/userConnectionsService.js.map +0 -1
  520. package/lib/module/services/youtubeMigrationService.js +0 -404
  521. package/lib/module/services/youtubeMigrationService.js.map +0 -1
  522. package/lib/module/theme/index.js +0 -244
  523. package/lib/module/theme/index.js.map +0 -1
  524. package/lib/module/utils/eventUtils.js +0 -270
  525. package/lib/module/utils/eventUtils.js.map +0 -1
  526. package/lib/module/utils/haptics.js +0 -59
  527. package/lib/module/utils/haptics.js.map +0 -1
  528. package/lib/module/utils/imagePreloader.js +0 -3
  529. package/lib/module/utils/imagePreloader.js.map +0 -1
  530. package/lib/typescript/components/BodyText.d.ts +0 -10
  531. package/lib/typescript/components/BodyText.d.ts.map +0 -1
  532. package/lib/typescript/components/BrandMark.d.ts +0 -11
  533. package/lib/typescript/components/BrandMark.d.ts.map +0 -1
  534. package/lib/typescript/components/CodeInput.d.ts +0 -10
  535. package/lib/typescript/components/CodeInput.d.ts.map +0 -1
  536. package/lib/typescript/components/EmailInput.d.ts +0 -8
  537. package/lib/typescript/components/EmailInput.d.ts.map +0 -1
  538. package/lib/typescript/components/ExistingUserDataConfirmation.d.ts +0 -12
  539. package/lib/typescript/components/ExistingUserDataConfirmation.d.ts.map +0 -1
  540. package/lib/typescript/components/GoogleButton.d.ts +0 -11
  541. package/lib/typescript/components/GoogleButton.d.ts.map +0 -1
  542. package/lib/typescript/components/HeadingGroup.d.ts +0 -11
  543. package/lib/typescript/components/HeadingGroup.d.ts.map +0 -1
  544. package/lib/typescript/components/ModalHeader.d.ts +0 -11
  545. package/lib/typescript/components/ModalHeader.d.ts.map +0 -1
  546. package/lib/typescript/components/ModalSheet.d.ts +0 -13
  547. package/lib/typescript/components/ModalSheet.d.ts.map +0 -1
  548. package/lib/typescript/components/OnairosSignInButton.d.ts +0 -13
  549. package/lib/typescript/components/OnairosSignInButton.d.ts.map +0 -1
  550. package/lib/typescript/components/PersonaImage.d.ts +0 -8
  551. package/lib/typescript/components/PersonaImage.d.ts.map +0 -1
  552. package/lib/typescript/components/PersonaLoadingScreen.d.ts +0 -10
  553. package/lib/typescript/components/PersonaLoadingScreen.d.ts.map +0 -1
  554. package/lib/typescript/components/PersonalizationConsentScreen.d.ts +0 -10
  555. package/lib/typescript/components/PersonalizationConsentScreen.d.ts.map +0 -1
  556. package/lib/typescript/components/PinCreationScreen.d.ts +0 -10
  557. package/lib/typescript/components/PinCreationScreen.d.ts.map +0 -1
  558. package/lib/typescript/components/PlatformConnectorsStep.d.ts +0 -11
  559. package/lib/typescript/components/PlatformConnectorsStep.d.ts.map +0 -1
  560. package/lib/typescript/components/PlatformToggle.d.ts +0 -20
  561. package/lib/typescript/components/PlatformToggle.d.ts.map +0 -1
  562. package/lib/typescript/components/PrimaryButton.d.ts +0 -22
  563. package/lib/typescript/components/PrimaryButton.d.ts.map +0 -1
  564. package/lib/typescript/components/SignInMatchAnimation.d.ts +0 -9
  565. package/lib/typescript/components/SignInMatchAnimation.d.ts.map +0 -1
  566. package/lib/typescript/components/SignInStep.d.ts +0 -12
  567. package/lib/typescript/components/SignInStep.d.ts.map +0 -1
  568. package/lib/typescript/components/VerificationStep.d.ts +0 -13
  569. package/lib/typescript/components/VerificationStep.d.ts.map +0 -1
  570. package/lib/typescript/components/WelcomeScreen.d.ts +0 -9
  571. package/lib/typescript/components/WelcomeScreen.d.ts.map +0 -1
  572. package/lib/typescript/components/icons/Basicproficon.d.ts +0 -5
  573. package/lib/typescript/components/icons/Basicproficon.d.ts.map +0 -1
  574. package/lib/typescript/components/icons/Basicprofile.d.ts +0 -5
  575. package/lib/typescript/components/icons/Basicprofile.d.ts.map +0 -1
  576. package/lib/typescript/components/icons/Checkbox.d.ts +0 -5
  577. package/lib/typescript/components/icons/Checkbox.d.ts.map +0 -1
  578. package/lib/typescript/components/icons/Checkmark.d.ts +0 -5
  579. package/lib/typescript/components/icons/Checkmark.d.ts.map +0 -1
  580. package/lib/typescript/components/icons/Contentanalysis.d.ts +0 -5
  581. package/lib/typescript/components/icons/Contentanalysis.d.ts.map +0 -1
  582. package/lib/typescript/components/icons/Contenticon.d.ts +0 -5
  583. package/lib/typescript/components/icons/Contenticon.d.ts.map +0 -1
  584. package/lib/typescript/components/icons/EnochE.d.ts +0 -5
  585. package/lib/typescript/components/icons/EnochE.d.ts.map +0 -1
  586. package/lib/typescript/components/icons/Personalityicon.d.ts +0 -5
  587. package/lib/typescript/components/icons/Personalityicon.d.ts.map +0 -1
  588. package/lib/typescript/components/icons/Personalityprofile.d.ts +0 -5
  589. package/lib/typescript/components/icons/Personalityprofile.d.ts.map +0 -1
  590. package/lib/typescript/components/icons/Personalitytraits.d.ts +0 -5
  591. package/lib/typescript/components/icons/Personalitytraits.d.ts.map +0 -1
  592. package/lib/typescript/components/icons/Userpreferences.d.ts +0 -5
  593. package/lib/typescript/components/icons/Userpreferences.d.ts.map +0 -1
  594. package/lib/typescript/components/icons/index.d.ts +0 -12
  595. package/lib/typescript/components/icons/index.d.ts.map +0 -1
  596. package/lib/typescript/config/api.d.ts +0 -24
  597. package/lib/typescript/config/api.d.ts.map +0 -1
  598. package/lib/typescript/context/AuthContext.d.ts +0 -34
  599. package/lib/typescript/context/AuthContext.d.ts.map +0 -1
  600. package/lib/typescript/hooks/useConnectedAccounts.d.ts +0 -11
  601. package/lib/typescript/hooks/useConnectedAccounts.d.ts.map +0 -1
  602. package/lib/typescript/hooks/useUserConnections.d.ts +0 -12
  603. package/lib/typescript/hooks/useUserConnections.d.ts.map +0 -1
  604. package/lib/typescript/services/apiClient.d.ts +0 -91
  605. package/lib/typescript/services/apiClient.d.ts.map +0 -1
  606. package/lib/typescript/services/authService.d.ts +0 -216
  607. package/lib/typescript/services/authService.d.ts.map +0 -1
  608. package/lib/typescript/services/biometricPinService.d.ts +0 -29
  609. package/lib/typescript/services/biometricPinService.d.ts.map +0 -1
  610. package/lib/typescript/services/connectedAccountsService.d.ts +0 -56
  611. package/lib/typescript/services/connectedAccountsService.d.ts.map +0 -1
  612. package/lib/typescript/services/googleAuthService.d.ts +0 -63
  613. package/lib/typescript/services/googleAuthService.d.ts.map +0 -1
  614. package/lib/typescript/services/imageCompressionService.d.ts +0 -37
  615. package/lib/typescript/services/imageCompressionService.d.ts.map +0 -1
  616. package/lib/typescript/services/jwtStorageService.d.ts +0 -86
  617. package/lib/typescript/services/jwtStorageService.d.ts.map +0 -1
  618. package/lib/typescript/services/mobileTrainingService.d.ts +0 -45
  619. package/lib/typescript/services/mobileTrainingService.d.ts.map +0 -1
  620. package/lib/typescript/services/pinEncryptionService.d.ts +0 -17
  621. package/lib/typescript/services/pinEncryptionService.d.ts.map +0 -1
  622. package/lib/typescript/services/pinStorageUtils.d.ts +0 -25
  623. package/lib/typescript/services/pinStorageUtils.d.ts.map +0 -1
  624. package/lib/typescript/services/storageService.d.ts +0 -128
  625. package/lib/typescript/services/storageService.d.ts.map +0 -1
  626. package/lib/typescript/services/trainingApiHelpers.d.ts +0 -38
  627. package/lib/typescript/services/trainingApiHelpers.d.ts.map +0 -1
  628. package/lib/typescript/services/userConnectionsService.d.ts +0 -90
  629. package/lib/typescript/services/userConnectionsService.d.ts.map +0 -1
  630. package/lib/typescript/services/youtubeMigrationService.d.ts +0 -12
  631. package/lib/typescript/services/youtubeMigrationService.d.ts.map +0 -1
  632. package/lib/typescript/theme/index.d.ts +0 -416
  633. package/lib/typescript/theme/index.d.ts.map +0 -1
  634. package/lib/typescript/utils/eventUtils.d.ts +0 -108
  635. package/lib/typescript/utils/eventUtils.d.ts.map +0 -1
  636. package/lib/typescript/utils/haptics.d.ts +0 -11
  637. package/lib/typescript/utils/haptics.d.ts.map +0 -1
  638. package/lib/typescript/utils/imagePreloader.d.ts +0 -2
  639. package/lib/typescript/utils/imagePreloader.d.ts.map +0 -1
  640. package/src/assets/fonts/EBGaramond-VariableFont_wght.ttf +0 -0
  641. package/src/assets/fonts/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
  642. package/src/assets/icons/Facebookicon.png +0 -0
  643. package/src/assets/icons/Gmail.png +0 -0
  644. package/src/assets/icons/Linkedinicon.png +0 -0
  645. package/src/assets/icons/Redditicon.png +0 -0
  646. package/src/assets/icons/YouTubeicon2.png +0 -0
  647. package/src/assets/icons/YouTubeicon3.png +0 -0
  648. package/src/assets/icons/farcaster.png +0 -0
  649. package/src/assets/icons/instagram.png +0 -0
  650. package/src/assets/icons/pinterest.png +0 -0
  651. package/src/assets/icons/swerv_logo.png +0 -0
  652. package/src/assets/icons/twitter.jpg +0 -0
  653. package/src/assets/images/Checkbox.svg +0 -3
  654. package/src/assets/images/EnochE.svg +0 -19
  655. package/src/assets/images/Enochicon1.png +0 -0
  656. package/src/assets/images/Face_ID_logo.png +0 -0
  657. package/src/assets/images/Facebookicon.png +0 -0
  658. package/src/assets/images/Gmail.png +0 -0
  659. package/src/assets/images/Googlelogo.png +0 -0
  660. package/src/assets/images/Linkedinicon.png +0 -0
  661. package/src/assets/images/Onairoslogo.png +0 -0
  662. package/src/assets/images/Personalityprofile.svg +0 -3
  663. package/src/assets/images/Personalitytraits.svg +0 -3
  664. package/src/assets/images/Redditicon.png +0 -0
  665. package/src/assets/images/Userpreferences.svg +0 -3
  666. package/src/assets/images/YouTubeicon3.png +0 -0
  667. package/src/assets/images/arrow.svg +0 -20
  668. package/src/assets/images/basicproficon.svg +0 -43
  669. package/src/assets/images/basicprofile.svg +0 -3
  670. package/src/assets/images/checkmark.svg +0 -4
  671. package/src/assets/images/contentanalysis.svg +0 -3
  672. package/src/assets/images/contenticon.svg +0 -23
  673. package/src/assets/images/persona1.png +0 -0
  674. package/src/assets/images/persona2.png +0 -0
  675. package/src/assets/images/persona3.png +0 -0
  676. package/src/assets/images/persona4.png +0 -0
  677. package/src/assets/images/persona5.png +0 -0
  678. package/src/assets/images/personalityicon.svg +0 -18
  679. package/src/assets/images/x-close.svg +0 -3
  680. package/src/components/BodyText.tsx +0 -33
  681. package/src/components/BrandMark.tsx +0 -62
  682. package/src/components/CodeInput.tsx +0 -32
  683. package/src/components/EmailInput.tsx +0 -31
  684. package/src/components/ExistingUserDataConfirmation.tsx +0 -507
  685. package/src/components/GoogleButton.tsx +0 -55
  686. package/src/components/HeadingGroup.tsx +0 -49
  687. package/src/components/ModalHeader.tsx +0 -125
  688. package/src/components/ModalSheet.tsx +0 -59
  689. package/src/components/OnairosSignInButton.tsx +0 -132
  690. package/src/components/PersonaImage.tsx +0 -79
  691. package/src/components/PersonaLoadingScreen.tsx +0 -201
  692. package/src/components/PersonalizationConsentScreen.tsx +0 -410
  693. package/src/components/PinCreationScreen.tsx +0 -492
  694. package/src/components/PlatformConnectorsStep.tsx +0 -892
  695. package/src/components/PlatformToggle.tsx +0 -226
  696. package/src/components/PrimaryButton.tsx +0 -214
  697. package/src/components/SignInMatchAnimation.tsx +0 -225
  698. package/src/components/SignInStep.tsx +0 -217
  699. package/src/components/VerificationStep.tsx +0 -198
  700. package/src/components/WelcomeScreen.tsx +0 -490
  701. package/src/components/icons/Basicproficon.tsx +0 -30
  702. package/src/components/icons/Basicprofile.tsx +0 -17
  703. package/src/components/icons/Checkbox.tsx +0 -17
  704. package/src/components/icons/Checkmark.tsx +0 -24
  705. package/src/components/icons/Contentanalysis.tsx +0 -17
  706. package/src/components/icons/Contenticon.tsx +0 -30
  707. package/src/components/icons/EnochE.tsx +0 -39
  708. package/src/components/icons/Personalityicon.tsx +0 -22
  709. package/src/components/icons/Personalityprofile.tsx +0 -17
  710. package/src/components/icons/Personalitytraits.tsx +0 -17
  711. package/src/components/icons/Userpreferences.tsx +0 -17
  712. package/src/components/icons/index.ts +0 -12
  713. package/src/config/api.ts +0 -25
  714. package/src/context/AuthContext.tsx +0 -393
  715. package/src/hooks/useConnectedAccounts.ts +0 -139
  716. package/src/hooks/useUserConnections.ts +0 -166
  717. package/src/services/apiClient.ts +0 -337
  718. package/src/services/authService.ts +0 -1008
  719. package/src/services/biometricPinService.ts +0 -193
  720. package/src/services/connectedAccountsService.ts +0 -290
  721. package/src/services/googleAuthService.ts +0 -279
  722. package/src/services/imageCompressionService.ts +0 -303
  723. package/src/services/jwtStorageService.ts +0 -257
  724. package/src/services/mobileTrainingService.ts +0 -204
  725. package/src/services/pinEncryptionService.ts +0 -76
  726. package/src/services/pinStorageUtils.ts +0 -97
  727. package/src/services/storageService.ts +0 -452
  728. package/src/services/trainingApiHelpers.ts +0 -67
  729. package/src/services/userConnectionsService.ts +0 -557
  730. package/src/services/youtubeMigrationService.ts +0 -454
  731. package/src/theme/index.ts +0 -239
  732. package/src/utils/eventUtils.ts +0 -303
  733. package/src/utils/haptics.ts +0 -59
  734. package/src/utils/imagePreloader.ts +0 -2
@@ -1,1047 +1,737 @@
1
- import React, { useState, useEffect, useRef } from 'react';
2
- import {
3
- View,
4
- Text,
5
- StyleSheet,
6
- ScrollView,
7
- TouchableOpacity,
8
- ActivityIndicator,
9
- Dimensions,
10
- TextInput,
11
- Keyboard,
12
- Alert,
13
- Animated,
14
- Easing,
15
- Platform,
16
- KeyboardAvoidingView,
17
- Modal,
18
- TouchableWithoutFeedback
19
- } from 'react-native';
20
- import { io, Socket } from 'socket.io-client';
21
- import { getAuthToken, getUserProfile, saveEnochToken, getOnairosUsername } from '../services/authService';
22
- import LinearGradient from 'react-native-linear-gradient';
23
- import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
24
- import AsyncStorage from '@react-native-async-storage/async-storage';
25
- import { triggerHaptic, HapticType } from '../utils/haptics';
26
- import { getEncryptedPinForAPI } from '../services/pinEncryptionService';
27
- import { clearTemporaryPin } from '../services/pinStorageUtils';
28
- // import EmailVerification from '../../../components/EmailVerification'; // Commented out - file doesn't exist
29
- // import { sendEmailVerificationCode } from '../../../services/api'; // Commented out - use local API instead
30
- import { startEnochTrainingWithYouTubeCheck } from '../services/mobileTrainingService';
31
- import { ExistingUserDataConfirmation } from './ExistingUserDataConfirmation';
32
-
33
- const { width, height } = Dimensions.get('window');
34
-
35
- export interface TrainingModalProps {
36
- visible: boolean;
37
- progress?: number;
38
- eta?: string;
39
- onCancel: () => void;
40
- onComplete?: (emailOrToken: string) => void;
41
- modelKey?: string;
42
- username?: string;
43
- isPrimaryAuth?: boolean;
44
- autoFocusEmailInput?: boolean; // Add new prop
45
- navigation?: any;
46
- }
47
-
48
- export const TrainingModal: React.FC<TrainingModalProps> = ({
49
- visible,
50
- onCancel,
51
- onComplete,
52
- modelKey,
53
- username,
54
- isPrimaryAuth = false,
55
- autoFocusEmailInput = false, // Add default value
56
- navigation,
57
- }) => {
58
- const [progress, setProgress] = useState(0);
59
- const [email, setEmail] = useState('');
60
- const [emailError, setEmailError] = useState('');
61
- const [isTrainingComplete, setIsTrainingComplete] = useState(false);
62
- const [isSubmittingEmail, setIsSubmittingEmail] = useState(false);
63
- const [socketConnected, setSocketConnected] = useState(false);
64
- const [trainingStatus, setTrainingStatus] = useState('Initializing...');
65
- const [hasError, setHasError] = useState(false);
66
- const [userTraits, setUserTraits] = useState(null);
67
- const [inferenceResults, setInferenceResults] = useState(null);
68
- const socketRef = useRef<Socket | null>(null);
69
- const emailInputRef = useRef<TextInput>(null); // Add email input ref
70
- const [userToken, setUserToken] = useState<string | null>(null);
71
- const [userInfo, setUserInfo] = useState<any>(null);
72
- const [matchStep, setMatchStep] = useState<'email' | 'verification' | 'searching' | 'found' | 'existing_user'>('email');
73
- const [matchCount, setMatchCount] = useState(0);
74
- const [isContinueLoading, setIsContinueLoading] = useState(false);
75
- const [existingUserAccountInfo, setExistingUserAccountInfo] = useState<any>(null);
76
-
77
- // --- Modal slide animation ---
78
- const modalTranslateY = useRef(new Animated.Value(height)).current;
79
- const animationDuration = 300; // Increased duration for smoother animation
80
-
81
- // Reset state when modal becomes invisible
82
- useEffect(() => {
83
- if (!visible) {
84
- // Reset all state
85
- setEmail('');
86
- setEmailError('');
87
- setIsSubmittingEmail(false);
88
- setMatchStep('email');
89
- setMatchCount(0);
90
- setIsContinueLoading(false);
91
- setProgress(0);
92
- setIsTrainingComplete(false);
93
- setHasError(false);
94
- setTrainingStatus('Initializing...');
95
- setUserTraits(null);
96
- setInferenceResults(null);
97
- setUserToken(null);
98
- setUserInfo(null);
99
-
100
- // Reset animation value
101
- modalTranslateY.setValue(height);
102
- }
103
- }, [visible]);
104
-
105
- // Handle animation
106
- useEffect(() => {
107
- if (visible) {
108
- // Ensure we start from the bottom
109
- modalTranslateY.setValue(height);
110
- // Animate up
111
- Animated.spring(modalTranslateY, {
112
- toValue: 0,
113
- useNativeDriver: true,
114
- damping: 20,
115
- mass: 1,
116
- stiffness: 200,
117
- }).start();
118
- }
119
- }, [visible]);
120
-
121
- // Handle modal close
122
- const handleModalClose = () => {
123
- Animated.spring(modalTranslateY, {
124
- toValue: height,
125
- useNativeDriver: true,
126
- damping: 20,
127
- mass: 1,
128
- stiffness: 200,
129
- }).start(() => {
130
- onCancel();
131
- });
132
- };
133
-
134
- // Get auth token and user info on mount
135
- useEffect(() => {
136
- const loadUserData = async () => {
137
- try {
138
- const token = await getAuthToken();
139
- setUserToken(token);
140
-
141
- if (token) {
142
- // Use provided username instead of making API call to avoid 404 error
143
- // The backend JWT contains username but /api/user/profile endpoint doesn't exist
144
- const fallbackUsername = username || 'mobile_user';
145
-
146
- console.log('🔍 Using provided username for training:', fallbackUsername);
147
- setUserInfo({
148
- username: fallbackUsername,
149
- email: null,
150
- id: null // Will be filled by backend during training
151
- });
152
- }
153
- } catch (error) {
154
- console.error('Error loading user data:', error);
155
- // Fallback user info
156
- setUserInfo({
157
- username: username || 'mobile_user',
158
- email: null,
159
- id: null
160
- });
161
- }
162
- };
163
-
164
- if (visible) {
165
- loadUserData();
166
- }
167
- }, [visible, username]);
168
-
169
- // Start Enoch training via API
170
- const startEnochTraining = async (socketId: string) => {
171
- try {
172
- setTrainingStatus('Starting training...');
173
- setProgress(10);
174
-
175
- if (!userToken) {
176
- throw new Error('No authentication token available');
177
- }
178
-
179
- console.log('🚀 Starting Enoch training with socketId:', socketId);
180
-
181
- // Get stored Onairos username for API calls
182
- const storedUsername = await getOnairosUsername();
183
- const finalUsername = storedUsername || userInfo?.username || userInfo?.name || username || 'mobile_user';
184
-
185
- // Get connected platforms information
186
- const connectedPlatforms = await AsyncStorage.getItem('connectedPlatforms');
187
- const platformsList = connectedPlatforms ? JSON.parse(connectedPlatforms) : [];
188
-
189
- console.log('📱 Connected platforms for training:', platformsList);
190
-
191
- // Get encrypted PIN for training (if available)
192
- const encryptedPin = await getEncryptedPinForAPI().catch(error => {
193
- console.warn('⚠️ Could not get encrypted PIN for training:', error);
194
- return null;
195
- });
196
-
197
- // Prepare user data for training - match backend expected format
198
- const trainingData = {
199
- socketId,
200
- username: finalUsername, // This will be used as fallback in backend
201
- email: userInfo?.email || null, // Backend will use this if available
202
- modelKey: modelKey || null,
203
- connectedPlatforms: platformsList, // Include connected platforms
204
- // Include encrypted PIN if available
205
- ...(encryptedPin && {
206
- encryptedPin: encryptedPin,
207
- hasPinData: true
208
- })
209
- };
210
-
211
- console.log('📤 Starting training with YouTube migration check:', trainingData);
212
- console.log('🔑 Using stored username:', storedUsername);
213
- console.log('🔑 Final username for training:', finalUsername);
214
- console.log('🔗 Connected platforms:', platformsList);
215
- console.log('🔐 PIN included in training:', !!encryptedPin);
216
-
217
- // Use the new training function that includes YouTube migration check
218
- const result = await startEnochTrainingWithYouTubeCheck(trainingData);
219
-
220
- if (result.success) {
221
- console.log('🚀 Training Started:', result.message);
222
- console.log('🎯 Training Features:', result.features);
223
-
224
- // Log the new features from the spec
225
- if (result.features) {
226
- console.log('✅ Inference enabled:', result.features.inference);
227
- console.log('💾 Storage method:', result.features.storage);
228
- console.log('🔒 Compression enabled:', result.features.compression);
229
- console.log('🔐 Encryption enabled:', result.features.encryption);
230
- console.log('📊 Training type:', result.features.type);
231
- console.log('🗄️ Databases:', result.features.databases);
232
- console.log('📈 Query scores enabled:', result.features.queryScores);
233
- }
234
-
235
- setTrainingStatus('Training model...');
236
- setProgress(20);
237
- } else {
238
- console.error('Training start failed:', result.error);
239
- setTrainingStatus(`Error: ${result.error}`);
240
- setHasError(true);
241
- }
242
- } catch (error) {
243
- console.error('Training start error:', error);
244
- setTrainingStatus(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
245
- setHasError(true);
246
- }
247
- };
248
-
249
- // Setup socket connection and training
250
- useEffect(() => {
251
- if (!visible || !userToken || !userInfo) return;
252
-
253
- console.log('Setting up socket connection for training...');
254
- console.log('🧑‍💻 User info available:', userInfo);
255
-
256
- // Initialize socket connection
257
- socketRef.current = io('https://api2.onairos.uk', {
258
- transports: ['websocket'],
259
- autoConnect: false
260
- });
261
-
262
- // Socket event listeners
263
- socketRef.current.on('connect', () => {
264
- console.log('✅ Socket connected for training');
265
- setSocketConnected(true);
266
- const socketId = socketRef.current?.id;
267
- if (socketId) {
268
- // ❌ DISABLED: This was causing training to start too early (when modal opens)
269
- // Training should only start when transitioning from connectors to PIN screen
270
- // startEnochTraining(socketId);
271
- console.log('🔌 Socket ready, but training will start only when user transitions to PIN screen');
272
- }
273
- });
274
-
275
- socketRef.current.on('disconnect', () => {
276
- console.log('❌ Socket disconnected');
277
- setSocketConnected(false);
278
- });
279
-
280
- socketRef.current.on('trainingCompleted', (data) => {
281
- console.log('✅ Training Complete:', data);
282
- setTrainingStatus('Running test inference...');
283
- setProgress(60);
284
- });
285
-
286
- socketRef.current.on('inferenceCompleted', (data) => {
287
- console.log('🧠 Inference Complete:', data);
288
- setTrainingStatus('Uploading to S3...');
289
- setProgress(80);
290
- setUserTraits(data.traits);
291
- setInferenceResults(data.inferenceResults);
292
- });
293
-
294
- socketRef.current.on('modelStandby', (data) => {
295
- console.log('🎉 All Complete:', data);
296
-
297
- // Log completion details based on new spec
298
- if (data.completed) {
299
- console.log('✅ Training completed:', data.message);
300
- console.log('💾 Storage method:', data.storage);
301
- console.log('🔐 Encryption enabled:', data.encryption);
302
- console.log('🧠 Inference enabled:', data.inference);
303
-
304
- // Log database info for Enoch mode
305
- if (data.databases && Array.isArray(data.databases)) {
306
- console.log('🗄️ Databases used:', data.databases.join(', '));
307
- }
308
-
309
- // Log testing mode
310
- if (data.testing) {
311
- console.log('🧪 Testing mode enabled');
312
- }
313
- }
314
-
315
- setIsTrainingComplete(true);
316
- setTrainingStatus('Complete!');
317
- setProgress(100);
318
-
319
- // Clear temporary PIN after training is complete
320
- clearTemporaryPin();
321
-
322
- // Show continue button for primary auth when training is complete
323
- if (isPrimaryAuth) {
324
- setMatchStep('found');
325
- setMatchCount(Math.floor(Math.random() * 10) + 5);
326
- }
327
- });
328
-
329
- socketRef.current.on('trainingUpdate', (data) => {
330
- if (data.error) {
331
- console.error('Training update error:', data.error);
332
- setTrainingStatus(`Error: ${data.error}`);
333
- setHasError(true);
334
- } else if (data.progress) {
335
- setProgress(data.progress);
336
- setTrainingStatus(data.status || 'Training in progress...');
337
- }
338
- });
339
-
340
- // Connect to socket
341
- socketRef.current.connect();
342
-
343
- // Cleanup function
344
- return () => {
345
- if (socketRef.current) {
346
- console.log('🔌 Disconnecting training socket...');
347
- socketRef.current.disconnect();
348
- socketRef.current = null;
349
- }
350
- };
351
- }, [visible, userToken, userInfo]);
352
-
353
- // When modal becomes visible and autoFocus is requested, focus the email input
354
- useEffect(() => {
355
- if (visible && autoFocusEmailInput && matchStep === 'email' && emailInputRef.current) {
356
- const timer = setTimeout(() => {
357
- emailInputRef.current?.focus();
358
- }, 150); // Small delay to sync with modal animation
359
- return () => clearTimeout(timer);
360
- } else if (!visible && emailInputRef.current) {
361
- // Optional: Blur input when modal is not visible
362
- // emailInputRef.current?.blur();
363
- }
364
- }, [visible, autoFocusEmailInput, matchStep]);
365
-
366
- // Validate email format
367
- const validateEmail = (email: string) => {
368
- // Check for reviewer bypass first
369
- if (email.toLowerCase().trim() === 'reviewer') {
370
- return true; // Valid for reviewer bypass
371
- }
372
-
373
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
374
- return emailRegex.test(email);
375
- };
376
-
377
- const handleEmailSubmit = async () => {
378
- // Check for reviewer bypass
379
- if (email.toLowerCase().trim() === 'reviewer') {
380
- console.log('🔍 Reviewer bypass detected');
381
- setEmail('reviewer@bypass.com'); // Set a valid email for the flow
382
- if (onComplete) {
383
- onComplete('reviewer@bypass.com');
384
- }
385
- return;
386
- }
387
-
388
- // Regular email validation and submission
389
- if (!validateEmail(email)) {
390
- setEmailError('Please enter a valid email address');
391
- return;
392
- }
393
-
394
- setIsSubmittingEmail(true);
395
- setEmailError('');
396
-
397
- try {
398
- console.log('📧 Sending verification code to:', email);
399
-
400
- // Send verification code using the new API
401
- // const result = await sendEmailVerificationCode(email); // Function not available
402
- const result = { success: true, message: 'Email verification not implemented' };
403
-
404
- if (result.success) {
405
- console.log('✅ Verification code sent successfully');
406
- setMatchStep('verification'); // Move to verification step
407
- } else {
408
- console.log('❌ Failed to send verification code:', result.message);
409
- setEmailError(result.message || 'Failed to send verification code. Please try again.');
410
- }
411
- } catch (error) {
412
- console.error(' Error sending verification code:', error);
413
- setEmailError('Network error. Please check your connection and try again.');
414
- } finally {
415
- setIsSubmittingEmail(false);
416
- }
417
- };
418
-
419
- const handleVerificationComplete = async (verifiedEmail: string, isVerified: boolean, accountInfo?: any) => {
420
- if (isVerified) {
421
- console.log(' Email verification completed for:', verifiedEmail);
422
- console.log('🔍 AccountInfo received:', accountInfo);
423
- console.log('🔍 ExistingUser flag:', accountInfo?.existingUser);
424
-
425
- // Check if this is an existing user - must have accountInfo AND explicitly marked as existing
426
- if (accountInfo && accountInfo.existingUser === true) {
427
- console.log('🔍 Existing user detected:', accountInfo);
428
-
429
- // CRITICAL FIX: Ensure we have a valid JWT token before proceeding
430
- if (accountInfo.token && typeof accountInfo.token === 'string' && accountInfo.token.length > 50) {
431
- console.log('✅ Valid JWT token found for existing user');
432
-
433
- // Store the token immediately for existing users
434
- await AsyncStorage.setItem('onairos_jwt_token', accountInfo.token);
435
- await AsyncStorage.setItem('enoch_token', accountInfo.token);
436
- await AsyncStorage.setItem('auth_token', accountInfo.token);
437
- await AsyncStorage.setItem('user_email', verifiedEmail);
438
- await AsyncStorage.setItem('auth_method', 'onairos');
439
-
440
- console.log('✅ Existing user tokens stored successfully');
441
-
442
- // NEW: Show existing user confirmation modal instead of immediately completing
443
- setExistingUserAccountInfo(accountInfo);
444
- setMatchStep('existing_user');
445
- return;
446
- } else {
447
- console.error('❌ No valid JWT token for existing user - token:', accountInfo.token);
448
- console.error('❌ Cannot proceed without valid authentication token');
449
-
450
- // Don't fall back to email - throw error instead
451
- throw new Error('No valid authentication token received from server');
452
- }
453
- return;
454
- }
455
-
456
- console.log('🔍 New user detected - proceeding with account creation flow');
457
-
458
- // New user - proceed with account creation and continue to platform connectors
459
- try {
460
- console.log('📧 Creating Onairos account for verified email:', verifiedEmail);
461
-
462
- const username = verifiedEmail.split('@')[0];
463
-
464
- const onairosSignupResponse = await fetch('https://api2.onairos.uk/register/enoch', {
465
- method: 'POST',
466
- headers: {
467
- 'Content-Type': 'application/json'
468
- },
469
- body: JSON.stringify({
470
- email: verifiedEmail,
471
- username: username,
472
- name: username,
473
- emailVerified: true // Mark as verified
474
- })
475
- });
476
-
477
- const onairosResponseData = await onairosSignupResponse.json();
478
- console.log('🔗 Onairos account creation response:', onairosResponseData);
479
-
480
- if (onairosResponseData.token) {
481
- // Store tokens
482
- await AsyncStorage.setItem('onairos_jwt_token', onairosResponseData.token);
483
- await AsyncStorage.setItem('auth_token', onairosResponseData.token);
484
- await AsyncStorage.setItem('enoch_token', onairosResponseData.token);
485
- await AsyncStorage.setItem('onairos_username', onairosResponseData.username);
486
- await AsyncStorage.setItem('user_email', verifiedEmail);
487
-
488
- console.log('✅ Account created and tokens stored');
489
- console.log('🔗 Proceeding to UniversalOnboarding platform connectors');
490
-
491
- // Close the TrainingModal and proceed to UniversalOnboarding platform connectors
492
- if (onComplete) {
493
- // This is the account creation path for new users
494
- // Always proceed to platform connectors for new users, regardless of backend response
495
- console.log('📧 TrainingModal: New user account created - proceeding to platform connectors:', verifiedEmail);
496
- onComplete(verifiedEmail);
497
- }
498
- } else {
499
- // No token returned, continue with email to platform connectors
500
- console.log('🔗 No token returned, proceeding to platform connectors with email');
501
- // CRITICAL FIX: Store email even when account creation fails
502
- await AsyncStorage.setItem('user_email', verifiedEmail);
503
- console.log('✅ Email stored despite no token for admin check compatibility');
504
- if (onComplete) {
505
- onComplete(verifiedEmail);
506
- }
507
- }
508
- } catch (error) {
509
- console.error('❌ Error creating account after verification:', error);
510
- // Continue anyway to platform connectors
511
- console.log('🔗 Error occurred, but proceeding to platform connectors');
512
- // CRITICAL FIX: Store email even when account creation throws an error
513
- await AsyncStorage.setItem('user_email', verifiedEmail);
514
- console.log('✅ Email stored despite error for admin check compatibility');
515
- if (onComplete) {
516
- onComplete(verifiedEmail);
517
- }
518
- }
519
- }
520
- };
521
-
522
- const handleVerificationBack = () => {
523
- setMatchStep('email');
524
- setEmailError('');
525
- };
526
-
527
- // Handle existing user confirmation
528
- const handleExistingUserConfirm = async () => {
529
- console.log('✅ Existing user confirmed data sharing');
530
-
531
- if (existingUserAccountInfo && existingUserAccountInfo.token) {
532
- if (onComplete) {
533
- onComplete(existingUserAccountInfo.token);
534
- }
535
- } else {
536
- console.error('❌ No token available for existing user');
537
- setEmailError('Authentication error. Please try again.');
538
- setMatchStep('email');
539
- }
540
- };
541
-
542
- const handleExistingUserCancel = () => {
543
- console.log('❌ Existing user cancelled data sharing');
544
- setMatchStep('email');
545
- setExistingUserAccountInfo(null);
546
- setEmailError('');
547
- };
548
-
549
- const handleExistingUserAddMoreData = () => {
550
- console.log('🔗 Existing user wants to add more data');
551
-
552
- // Store the existing user info for later use
553
- if (existingUserAccountInfo && existingUserAccountInfo.token) {
554
- AsyncStorage.setItem('existing_user_token', existingUserAccountInfo.token);
555
- AsyncStorage.setItem('existing_user_info', JSON.stringify(existingUserAccountInfo));
556
- }
557
-
558
- // Continue to new user flow (UniversalOnboarding) but with existing user context
559
- setMatchStep('email');
560
- setExistingUserAccountInfo(null);
561
-
562
- // Call onComplete with email to trigger UniversalOnboarding
563
- if (onComplete) {
564
- onComplete(email);
565
- }
566
- };
567
-
568
- // Ensure cancel button always works
569
- const handleCancelPress = () => {
570
- // Clear temporary PIN when cancelling
571
- clearTemporaryPin();
572
- onCancel();
573
- };
574
- const handleContinue = () => {
575
- // Trigger haptic feedback when button is pressed
576
- ReactNativeHapticFeedback.trigger('impactMedium', {
577
- enableVibrateFallback: true,
578
- ignoreAndroidSystemSettings: false
579
- });
580
-
581
- console.log('handleContinue called. Current email state:', email);
582
- console.log('Continue button pressed, completing onboarding with email:', email);
583
-
584
- // Make sure we have a valid email
585
- if (!validateEmail(email)) {
586
- console.log('Email validation failed, cannot continue');
587
- return;
588
- }
589
-
590
- // Show loading state
591
- setIsContinueLoading(true);
592
-
593
- // Call onComplete immediately to prevent splash screen flash
594
- // The loading state will still be visible during the transition
595
- if (onComplete) {
596
- console.log('Calling onComplete with email:', email);
597
- onComplete(email);
598
- // Note: We don't reset isContinueLoading because the component will unmount
599
- }
600
- };
601
-
602
- // Calculate user-friendly message based on progress
603
- const getUserFriendlyMessage = () => {
604
- if (hasError) return 'Something went wrong. Please try again.';
605
- if (isTrainingComplete) return 'Your persona is ready! 🎉';
606
-
607
- if (progress < 20) {
608
- return 'Keeping your data private...';
609
- } else if (progress < 40) {
610
- return 'Trying to understand your mind...';
611
- } else if (progress < 60) {
612
- return 'You\'re more interesting than I expected...';
613
- } else if (progress < 80) {
614
- return 'Finalizing your unique persona...';
615
- } else if (progress < 95) {
616
- return 'Almost done...';
617
- } else {
618
- return 'Just a few more seconds...';
619
- }
620
- };
621
-
622
- // Calculate remaining time estimate
623
- const getTimeEstimate = () => {
624
- if (hasError) return 'Please try again';
625
- if (isTrainingComplete) return 'Complete!';
626
-
627
- // Rough time estimates based on progress
628
- const remainingProgress = 100 - progress;
629
- const estimatedSeconds = Math.ceil((remainingProgress / 100) * 120); // Assume 2 minutes total
630
-
631
- if (estimatedSeconds > 60) {
632
- return `About ${Math.ceil(estimatedSeconds / 60)} minute${Math.ceil(estimatedSeconds / 60) > 1 ? 's' : ''} remaining`;
633
- } else if (estimatedSeconds > 0) {
634
- return `About ${estimatedSeconds} seconds remaining`;
635
- } else {
636
- return 'Almost there...';
637
- }
638
- };
639
-
640
- // Grabber bar
641
- const Grabber = () => (
642
- <View style={styles.grabberContainer}>
643
- <View style={styles.grabberBar} />
644
- </View>
645
- );
646
-
647
- if (!visible) return null;
648
-
649
- const progressPercentage = Math.min(Math.max(progress, 0), 100);
650
-
651
- return (
652
- <Modal
653
- visible={visible}
654
- transparent
655
- animationType="none" // Changed to none since we're handling animation
656
- onRequestClose={handleModalClose}
657
- >
658
- <TouchableWithoutFeedback onPress={handleModalClose}>
659
- <View style={styles.modalOverlay}>
660
- <KeyboardAvoidingView
661
- behavior={Platform.OS === "ios" ? "padding" : "height"}
662
- keyboardVerticalOffset={0}
663
- style={styles.keyboardAvoidingView}
664
- >
665
- <TouchableWithoutFeedback onPress={(e) => e.stopPropagation()}>
666
- <Animated.View
667
- style={[
668
- styles.modalContent,
669
- {
670
- transform: [{ translateY: modalTranslateY }],
671
- }
672
- ]}
673
- >
674
- <Grabber />
675
-
676
- {/* START: Add X Close Button */}
677
- <TouchableOpacity style={styles.closeButton} onPress={onCancel}>
678
- <Text style={styles.closeButtonText}>✕</Text>
679
- </TouchableOpacity>
680
- {/* END: Add X Close Button */}
681
-
682
- {matchStep === 'email' && (
683
- <View style={[styles.primaryAuthHeader, { marginTop: 40 }]}>
684
- <Text style={styles.primaryAuthTitle}>Sign in with Onairos</Text>
685
- <Text style={styles.primaryAuthSubtitle}>
686
- </Text>
687
- </View>
688
- )}
689
-
690
-
691
-
692
- {/* Email Entry Step */}
693
- {isPrimaryAuth && matchStep === 'email' && (
694
- <View style={styles.emailSection}>
695
- <Text style={styles.emailLabel}>Enter your email to sign in / create an account</Text>
696
- <TextInput
697
- ref={emailInputRef}
698
- style={[styles.emailInput, emailError ? styles.emailInputError : null]}
699
- value={email}
700
- onChangeText={(text) => {
701
- setEmail(text);
702
- if (emailError) setEmailError('');
703
- }}
704
- placeholder="your.email@example.com"
705
- keyboardType="email-address"
706
- autoCapitalize="none"
707
- autoCorrect={false}
708
- returnKeyType="done"
709
- onSubmitEditing={() => Keyboard.dismiss()}
710
- />
711
- {emailError ? <Text style={styles.errorText}>{emailError}</Text> : null}
712
- <TouchableOpacity
713
- style={[
714
- styles.continueButton,
715
- (isSubmittingEmail || (!email.includes('@') && email.toLowerCase().trim() !== 'reviewer')) && styles.disabledButton,
716
- { marginTop: 24 }
717
- ]}
718
- onPress={handleEmailSubmit}
719
- disabled={isSubmittingEmail || (!email.includes('@') && email.toLowerCase().trim() !== 'reviewer')}
720
- activeOpacity={0.8}
721
- >
722
- {isSubmittingEmail ? (
723
- <ActivityIndicator size="small" color="#FFFFFF" />
724
- ) : (
725
- <Text style={styles.continueButtonText}>Continue</Text>
726
- )}
727
- </TouchableOpacity>
728
- </View>
729
- )}
730
-
731
- {/* Email Verification Step */}
732
- {isPrimaryAuth && matchStep === 'verification' && (
733
- <View>
734
- {/* EmailVerification component not available - placeholder */}
735
- <Text>Email verification step (not implemented)</Text>
736
- </View>
737
- )}
738
-
739
- {/* Existing User Data Confirmation Step */}
740
- {isPrimaryAuth && matchStep === 'existing_user' && existingUserAccountInfo && (
741
- <ExistingUserDataConfirmation
742
- visible={true}
743
- onConfirm={handleExistingUserConfirm}
744
- onCancel={handleExistingUserCancel}
745
- onAddMoreData={handleExistingUserAddMoreData}
746
- accountInfo={existingUserAccountInfo}
747
- userEmail={email}
748
- />
749
- )}
750
-
751
- {/* Existing steps remain the same */}
752
- {isPrimaryAuth && matchStep === 'searching' && (
753
- <View style={styles.matchContainer}>
754
- <Text style={styles.matchTitle}></Text>
755
- <ActivityIndicator size="large" color="#E9C46A" style={styles.matchLoader} />
756
- <Text style={styles.matchMessage}>
757
- Searching for potential connections based on your email...
758
- </Text>
759
- </View>
760
- )}
761
-
762
- {isPrimaryAuth && matchStep === 'found' && progress >= 100 && (
763
- <View style={styles.matchContainer}>
764
- <Text style={styles.matchTitle}>Connections Found</Text>
765
- <View style={styles.matchCircle}>
766
- <Text style={styles.matchCount}>{matchCount}</Text>
767
- </View>
768
- <Text style={styles.matchMessage}>
769
- We found {matchCount} potential connections for you!
770
- </Text>
771
- <Text style={styles.matchSubMessage}>
772
- Complete your profile to see your personalized matches
773
- </Text>
774
- <TouchableOpacity
775
- style={[
776
- styles.continueButton,
777
- isContinueLoading && styles.disabledButton
778
- ]}
779
- onPress={handleContinue}
780
- disabled={isContinueLoading}
781
- >
782
- {isContinueLoading ? (
783
- <ActivityIndicator size="small" color="#FFFFFF" />
784
- ) : (
785
- <Text style={styles.continueButtonText}>continue to setup</Text>
786
- )}
787
- </TouchableOpacity>
788
- </View>
789
- )}
790
- </Animated.View>
791
- </TouchableWithoutFeedback>
792
- </KeyboardAvoidingView>
793
- </View>
794
- </TouchableWithoutFeedback>
795
- </Modal>
796
- );
797
- };
798
-
799
- const styles = StyleSheet.create({
800
- container: {
801
- flex: 1,
802
- backgroundColor: '#fff',
803
- padding: 24,
804
- },
805
- scrollContentContainer: {
806
- flexGrow: 1,
807
- justifyContent: 'flex-start',
808
- paddingBottom: 0,
809
- marginBottom: 0,
810
- },
811
- actualContentWrapper: {
812
- width: '100%',
813
- alignItems: 'center', // Center content like headers if they are not full width
814
- },
815
- content: {
816
- // This style might be unused or redefined if still needed for specific children
817
- // flex: 1, // Original content style, likely not needed for the wrapper anymore
818
- },
819
- title: {
820
- fontSize: 24,
821
- fontWeight: '600',
822
- color: '#333',
823
- marginBottom: 24,
824
- textAlign: 'center',
825
- },
826
- subtitle: {
827
- fontSize: 16,
828
- color: '#666',
829
- marginBottom: 32,
830
- textAlign: 'center',
831
- },
832
- progressContainer: {
833
- marginBottom: 24,
834
- },
835
- progressBar: {
836
- height: 8,
837
- backgroundColor: '#F5F5F5',
838
- borderRadius: 4,
839
- overflow: 'hidden',
840
- marginBottom: 8,
841
- },
842
- progressFill: {
843
- height: '100%',
844
- backgroundColor: '#1BA9D4',
845
- borderRadius: 4,
846
- },
847
- progressText: {
848
- fontSize: 14,
849
- color: '#666',
850
- textAlign: 'right',
851
- },
852
- infoContainer: {
853
- flexDirection: 'row',
854
- alignItems: 'center',
855
- marginBottom: 32,
856
- },
857
- etaText: {
858
- fontSize: 14,
859
- color: '#666',
860
- marginLeft: 8,
861
- textAlign: 'center',
862
- marginBottom: 16,
863
- },
864
- detailText: {
865
- fontSize: 14,
866
- color: '#666',
867
- lineHeight: 20,
868
- },
869
- emailSection: {
870
- marginTop: 24,
871
- marginBottom: 16,
872
- width: '100%',
873
- },
874
- emailSectionPrimary: {
875
- marginTop: 40,
876
- marginBottom: 40,
877
- },
878
- emailLabel: {
879
- fontSize: 16,
880
- fontWeight: '500',
881
- color: '#333',
882
- marginBottom: 12,
883
- textAlign: 'center',
884
- },
885
- emailInput: {
886
- height: 48,
887
- borderWidth: 1,
888
- borderColor: '#E0E0E0',
889
- borderRadius: 8,
890
- paddingHorizontal: 16,
891
- fontSize: 16,
892
- marginBottom: 8,
893
- },
894
- emailInputError: {
895
- borderColor: '#FF3B30',
896
- },
897
- errorText: {
898
- color: '#FF3B30',
899
- fontSize: 14,
900
- marginBottom: 16,
901
- },
902
- footer: {
903
- flexDirection: 'row',
904
- justifyContent: 'space-between',
905
- marginTop: 24,
906
- paddingTop: 16,
907
- },
908
- completeButton: {
909
- paddingVertical: 12,
910
- paddingHorizontal: 24,
911
- backgroundColor: '#1BA9D4',
912
- borderRadius: 8,
913
- },
914
- disabledButton: {
915
- backgroundColor: '#CCCCCC',
916
- opacity: 0.7,
917
- },
918
- completeButtonText: {
919
- color: '#fff',
920
- fontSize: 16,
921
- fontWeight: '600',
922
- },
923
- statusText: {
924
- fontSize: 14,
925
- color: '#666',
926
- marginLeft: 8,
927
- },
928
- progressError: {
929
- backgroundColor: '#FF3B30',
930
- },
931
- primaryAuthHeader: {
932
- alignItems: 'center',
933
- marginBottom: 24,
934
- paddingHorizontal: 16,
935
- },
936
- primaryAuthTitle: {
937
- fontSize: 24,
938
- fontWeight: '600',
939
- color: '#333',
940
- marginBottom: 8,
941
- textAlign: 'center',
942
- },
943
- primaryAuthSubtitle: {
944
- fontSize: 16,
945
- color: '#555',
946
- textAlign: 'center',
947
- marginBottom: 16,
948
- },
949
- matchContainer: {
950
- alignItems: 'center',
951
- padding: 20,
952
- },
953
- matchTitle: {
954
- fontSize: 24,
955
- fontWeight: '600',
956
- color: '#333',
957
- marginBottom: 16,
958
- textAlign: 'center',
959
- },
960
- matchLoader: {
961
- marginVertical: 20,
962
- },
963
- matchMessage: {
964
- fontSize: 16,
965
- color: '#555',
966
- textAlign: 'center',
967
- marginVertical: 12,
968
- },
969
- matchSubMessage: {
970
- fontSize: 14,
971
- color: '#777',
972
- textAlign: 'center',
973
- marginTop: 8,
974
- },
975
- matchCircle: {
976
- width: 80,
977
- height: 80,
978
- borderRadius: 40,
979
- backgroundColor: '#E9C46A',
980
- justifyContent: 'center',
981
- alignItems: 'center',
982
- marginVertical: 16,
983
- },
984
- matchCount: {
985
- fontSize: 32,
986
- fontWeight: 'bold',
987
- color: '#FFFFFF',
988
- },
989
- continueButton: {
990
- marginTop: 40,
991
- width: '85%',
992
- height: 50,
993
- backgroundColor: '#000000',
994
- borderRadius: 8,
995
- justifyContent: 'center',
996
- alignItems: 'center',
997
- alignSelf: 'center',
998
- },
999
- continueButtonText: {
1000
- color: '#FFFFFF',
1001
- fontSize: 18,
1002
- fontWeight: '600',
1003
- textAlign: 'center',
1004
- },
1005
- modalOverlay: {
1006
- flex: 1,
1007
- backgroundColor: 'rgba(0, 0, 0, 0.5)',
1008
- justifyContent: 'flex-end',
1009
- },
1010
- keyboardAvoidingView: {
1011
- flex: 1,
1012
- justifyContent: 'flex-end',
1013
- alignItems: 'stretch',
1014
- margin: 0,
1015
- padding: 0,
1016
- },
1017
- modalContent: {
1018
- backgroundColor: '#fff',
1019
- borderTopLeftRadius: 20,
1020
- borderTopRightRadius: 20,
1021
- padding: 24,
1022
- paddingTop: 12,
1023
- minHeight: height * 0.4,
1024
- maxHeight: height * 0.9,
1025
- },
1026
- closeButton: {
1027
- position: 'absolute',
1028
- top: 15, // Adjust as needed for visual balance with grabber and padding
1029
- right: 20, // Adjust as needed
1030
- padding: 5, // Make it easier to tap
1031
- zIndex: 10, // Ensure it's above other content
1032
- },
1033
- closeButtonText: {
1034
- fontSize: 24, // Make it a bit larger
1035
- color: '#888', // Subtle color
1036
- fontWeight: '300',
1037
- },
1038
- grabberContainer: {
1039
- alignItems: 'center',
1040
- },
1041
- grabberBar: {
1042
- width: 48,
1043
- height: 5,
1044
- borderRadius: 3,
1045
- backgroundColor: '#E0E0E0',
1046
- },
1047
- });
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import {
3
+ View,
4
+ Text,
5
+ StyleSheet,
6
+ TouchableOpacity,
7
+ ActivityIndicator,
8
+ Dimensions,
9
+ Modal,
10
+ Animated,
11
+ TouchableWithoutFeedback,
12
+ SafeAreaView,
13
+ Image,
14
+ Alert,
15
+ } from 'react-native';
16
+ import Icon from 'react-native-vector-icons/MaterialIcons';
17
+ import { io, Socket } from 'socket.io-client';
18
+ import { COLORS } from '../constants';
19
+ import type { TrainingModalProps } from '../types';
20
+
21
+ const { width, height } = Dimensions.get('window');
22
+
23
+ export const TrainingModal: React.FC<TrainingModalProps> = ({
24
+ visible,
25
+ progress,
26
+ eta,
27
+ onCancel,
28
+ onComplete,
29
+ modelKey,
30
+ username,
31
+ test = false,
32
+ }) => {
33
+ // Socket and training state
34
+ const socketRef = useRef<Socket | null>(null);
35
+ const [socketConnected, setSocketConnected] = useState(false);
36
+ const [trainingStatus, setTrainingStatus] = useState('Initializing...');
37
+ const [hasError, setHasError] = useState(false);
38
+ const [errorCode, setErrorCode] = useState<string | null>(null);
39
+ const [isTrainingComplete, setIsTrainingComplete] = useState(false);
40
+ const [userTraits, setUserTraits] = useState<any>(null);
41
+ const [inferenceResults, setInferenceResults] = useState<any>(null);
42
+ const [internalProgress, setInternalProgress] = useState(0);
43
+ const [isEnochSDK, setIsEnochSDK] = useState(false); // Determine if using Enoch SDK
44
+ const [trainingResults, setTrainingResults] = useState<any>(null);
45
+
46
+ // Use internal progress if available, otherwise fall back to prop progress
47
+ const currentProgress = internalProgress > 0 ? internalProgress / 100 : progress;
48
+ const progressPercentage = Math.round(currentProgress * 100);
49
+
50
+ // Mock user data for now - in real implementation this would come from props
51
+ const userToken = 'mock-token'; // TODO: Get from actual auth
52
+ const userInfo = {
53
+ username: username || 'mobile_user',
54
+ email: null,
55
+ id: null,
56
+ name: username || 'mobile_user'
57
+ };
58
+
59
+ // Check if we should use Enoch SDK (based on modelKey or other criteria)
60
+ useEffect(() => {
61
+ // For now, default to clean training unless specified
62
+ // In real implementation, this would be determined by SDK type
63
+ setIsEnochSDK(modelKey?.includes('enoch') || false);
64
+ }, [modelKey]);
65
+
66
+ // Start training with new API schema
67
+ const startTraining = async (socketId: string) => {
68
+ try {
69
+ setTrainingStatus('Starting training...');
70
+ setInternalProgress(10);
71
+ setHasError(false);
72
+ setErrorCode(null);
73
+
74
+ if (!userToken) {
75
+ throw new Error('No authentication token available');
76
+ }
77
+
78
+ // Determine endpoint based on SDK type
79
+ const endpoint = isEnochSDK ? '/mobile-training/enoch' : '/mobile-training/clean';
80
+
81
+ console.log(`🚀 Starting training with endpoint: ${endpoint}`);
82
+ console.log('🔍 Production mode: Using new training API schema');
83
+
84
+ // Prepare training data in new format
85
+ const trainingData = {
86
+ Info: {
87
+ username: userInfo?.username || userInfo?.name || username || 'mobile_user',
88
+ // Mock connected platforms - in real implementation this would come from props
89
+ connectedPlatforms: ['youtube', 'instagram', 'reddit'] // TODO: Get from actual connections
90
+ }
91
+ };
92
+
93
+ console.log('📤 Sending training data:', trainingData);
94
+
95
+ // Call the new training API
96
+ const response = await fetch(`https://api2.onairos.uk${endpoint}`, {
97
+ method: 'POST',
98
+ headers: {
99
+ 'Content-Type': 'application/json',
100
+ 'Authorization': `Bearer ${userToken}` // JWT token authentication
101
+ },
102
+ body: JSON.stringify(trainingData)
103
+ });
104
+
105
+ const result = await response.json();
106
+
107
+ if (result.success) {
108
+ console.log('🚀 Training Started:', result.message);
109
+ setTrainingStatus('Training initiated...');
110
+ setInternalProgress(20);
111
+ } else {
112
+ console.error('Training start failed:', result.error);
113
+
114
+ // Handle specific error codes from new schema
115
+ if (result.code) {
116
+ setErrorCode(result.code);
117
+ handleTrainingError(result.code, result.error);
118
+ } else {
119
+ setTrainingStatus(`Error: ${result.error}`);
120
+ setHasError(true);
121
+ }
122
+ }
123
+
124
+ } catch (error) {
125
+ console.error('Training start error:', error);
126
+ setTrainingStatus(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
127
+ setHasError(true);
128
+ }
129
+ };
130
+
131
+ // Handle training errors with specific error codes
132
+ const handleTrainingError = (code: string, message: string) => {
133
+ console.error(`Training Error [${code}]:`, message);
134
+ setHasError(true);
135
+
136
+ switch (code) {
137
+ case 'PIN_REQUIRED':
138
+ setTrainingStatus('PIN setup required');
139
+ Alert.alert(
140
+ 'PIN Required',
141
+ 'Please set up your PIN first before training.',
142
+ [
143
+ { text: 'Cancel', style: 'cancel' },
144
+ { text: 'Set PIN', onPress: () => {
145
+ // TODO: Navigate to PIN setup
146
+ console.log('Navigate to PIN setup');
147
+ }}
148
+ ]
149
+ );
150
+ break;
151
+
152
+ case 'CONNECTIONS_REQUIRED':
153
+ setTrainingStatus('No connected accounts');
154
+ Alert.alert(
155
+ 'Connections Required',
156
+ 'Please connect at least one social media account before training.',
157
+ [
158
+ { text: 'Cancel', style: 'cancel' },
159
+ { text: 'Connect', onPress: () => {
160
+ // TODO: Navigate to connections
161
+ console.log('Navigate to connections');
162
+ }}
163
+ ]
164
+ );
165
+ break;
166
+
167
+ case 'INSUFFICIENT_DATA':
168
+ setTrainingStatus('Insufficient data for training');
169
+ Alert.alert(
170
+ 'Insufficient Data',
171
+ 'We need more interaction data to train your model effectively. Please use your connected platforms more and try again.',
172
+ [{ text: 'OK', style: 'default' }]
173
+ );
174
+ break;
175
+
176
+ case 'ENCRYPTION_REQUIRED':
177
+ setTrainingStatus('Model encryption failed');
178
+ Alert.alert(
179
+ 'Encryption Error',
180
+ 'Failed to encrypt your model. Please try again.',
181
+ [{ text: 'OK', style: 'default' }]
182
+ );
183
+ break;
184
+
185
+ default:
186
+ setTrainingStatus(`Error: ${message}`);
187
+ Alert.alert(
188
+ 'Training Error',
189
+ message || 'An unexpected error occurred during training.',
190
+ [{ text: 'OK', style: 'default' }]
191
+ );
192
+ }
193
+ };
194
+
195
+ // Simulate training progress for test mode
196
+ const simulateTraining = () => {
197
+ console.log('🧪 Starting simulated training with new schema phases...');
198
+ setTrainingStatus('Validating Requirements');
199
+ setInternalProgress(5);
200
+
201
+ // Simulate all phases from the new schema
202
+ const phases = [
203
+ { progress: 10, status: 'Validating Requirements', delay: 1000 },
204
+ { progress: 25, status: 'Training Model', delay: 2000 },
205
+ { progress: 50, status: 'Training Model', delay: 2000 },
206
+ { progress: 65, status: 'Model Trained - Running Test Inference', delay: 1500 },
207
+ { progress: 80, status: 'Encrypting and Compressing Model', delay: 1000 },
208
+ { progress: 95, status: 'Uploading Encrypted Model to ARDrive', delay: 1500 },
209
+ { progress: 100, status: 'Complete!', delay: 500 },
210
+ ];
211
+
212
+ let currentPhase = 0;
213
+
214
+ const progressInterval = setInterval(() => {
215
+ if (currentPhase < phases.length) {
216
+ const phase = phases[currentPhase];
217
+ setInternalProgress(phase.progress);
218
+ setTrainingStatus(phase.status);
219
+
220
+ if (phase.progress === 100) {
221
+ setIsTrainingComplete(true);
222
+ clearInterval(progressInterval);
223
+
224
+ // Mock completion results
225
+ const mockResults = {
226
+ completed: true,
227
+ message: "Model trained, encrypted, and stored successfully",
228
+ storage: "ARDrive",
229
+ encryption: true,
230
+ inference: isEnochSDK, // Only Enoch SDK runs inference
231
+ modelUrl: `https://arweave.net/mock_tx_${Date.now()}`
232
+ };
233
+
234
+ setTrainingResults(mockResults);
235
+
236
+ // Auto-complete after a short delay
237
+ setTimeout(() => {
238
+ onComplete && onComplete();
239
+ }, 1000);
240
+ }
241
+
242
+ currentPhase++;
243
+ }
244
+ }, phases[currentPhase]?.delay || 1000);
245
+
246
+ // Cleanup interval on unmount
247
+ return () => clearInterval(progressInterval);
248
+ };
249
+
250
+ // Setup socket connection and training
251
+ useEffect(() => {
252
+ if (!visible || !userInfo) return;
253
+
254
+ console.log('Setting up socket connection for training...');
255
+ console.log('🧑‍💻 User info available:', userInfo);
256
+ console.log('🧪 Test mode:', test);
257
+ console.log('🔧 Using Enoch SDK:', isEnochSDK);
258
+
259
+ // If test mode is enabled, use simulation instead of real API
260
+ if (test) {
261
+ console.log('🧪 Test mode enabled - Using simulated training with new schema');
262
+ setSocketConnected(true);
263
+ simulateTraining();
264
+ return;
265
+ }
266
+
267
+ // Initialize real socket connection
268
+ try {
269
+ console.log('🔌 Production mode: Initializing real socket connection');
270
+
271
+ // Initialize socket connection
272
+ socketRef.current = io('https://api2.onairos.uk', {
273
+ transports: ['websocket'],
274
+ autoConnect: false
275
+ });
276
+
277
+ // Socket event listeners for new schema
278
+ socketRef.current.on('connect', () => {
279
+ console.log('✅ Socket connected for training');
280
+ setSocketConnected(true);
281
+ const socketId = socketRef.current?.id;
282
+ if (socketId) {
283
+ startTraining(socketId);
284
+ }
285
+ });
286
+
287
+ socketRef.current.on('disconnect', () => {
288
+ console.log(' Socket disconnected');
289
+ setSocketConnected(false);
290
+ });
291
+
292
+ socketRef.current.on('connect_error', (error) => {
293
+ console.error('❌ Socket connection error:', error);
294
+ setTrainingStatus('Connection failed');
295
+ setHasError(true);
296
+ });
297
+
298
+ // Handle training updates with new schema phases
299
+ socketRef.current.on('trainingUpdate', (data) => {
300
+ console.log('📡 Training update received:', data);
301
+
302
+ if (data.error) {
303
+ if (data.code) {
304
+ setErrorCode(data.code);
305
+ handleTrainingError(data.code, data.error);
306
+ } else {
307
+ console.error('Training update error:', data.error);
308
+ setTrainingStatus(`Error: ${data.error}`);
309
+ setHasError(true);
310
+ }
311
+ } else {
312
+ // Handle different status phases
313
+ if (data.status) {
314
+ setTrainingStatus(data.status);
315
+
316
+ // Update progress based on phase
317
+ switch (data.status) {
318
+ case 'Validating Requirements':
319
+ setInternalProgress(10);
320
+ break;
321
+ case 'Training Model':
322
+ setInternalProgress(data.percent || 40);
323
+ break;
324
+ case 'Model Trained - Running Test Inference':
325
+ setInternalProgress(65);
326
+ break;
327
+ case 'Encrypting and Compressing Model':
328
+ setInternalProgress(80);
329
+ break;
330
+ case 'Uploading Encrypted Model to ARDrive':
331
+ setInternalProgress(90);
332
+ break;
333
+ default:
334
+ if (data.percent) {
335
+ setInternalProgress(data.percent);
336
+ }
337
+ }
338
+ }
339
+
340
+ if (data.progress) {
341
+ setInternalProgress(data.progress);
342
+ }
343
+ }
344
+ });
345
+
346
+ // Handle training completion with new schema
347
+ socketRef.current.on('trainingCompleted', (data) => {
348
+ console.log('✅ Training Complete:', data);
349
+
350
+ if (data.completed && data.storage === 'ARDrive' && data.encryption === true) {
351
+ setTrainingStatus('Training completed successfully!');
352
+ setIsTrainingComplete(true);
353
+ setInternalProgress(100);
354
+ setTrainingResults(data);
355
+
356
+ // Display results
357
+ console.log('✅ Model URL:', data.modelUrl);
358
+ console.log('✅ Storage:', data.storage);
359
+ console.log('✅ Encrypted:', data.encryption);
360
+ console.log('✅ Inference:', data.inference);
361
+
362
+ // Auto-complete after a short delay
363
+ setTimeout(() => {
364
+ onComplete && onComplete();
365
+ }, 1500);
366
+ } else {
367
+ console.error('Training completion missing required fields:', data);
368
+ setTrainingStatus('Training completed with warnings');
369
+ setHasError(true);
370
+ }
371
+ });
372
+
373
+ // Legacy handlers for backward compatibility
374
+ socketRef.current.on('inferenceCompleted', (data) => {
375
+ console.log('🧠 Inference Complete:', data);
376
+ setUserTraits(data.traits);
377
+ setInferenceResults(data.inferenceResults);
378
+ });
379
+
380
+ socketRef.current.on('modelStandby', (data) => {
381
+ console.log('🎉 Model Ready:', data);
382
+ // This is handled by trainingCompleted now
383
+ });
384
+
385
+ // Connect to socket
386
+ socketRef.current.connect();
387
+
388
+ } catch (socketError) {
389
+ console.error('🚨 Production mode: Socket connection failed:', socketError);
390
+ setTrainingStatus('Failed to connect to training service');
391
+ setHasError(true);
392
+ }
393
+
394
+ // Cleanup function
395
+ return () => {
396
+ if (socketRef.current) {
397
+ console.log('🔌 Disconnecting training socket...');
398
+ socketRef.current.disconnect();
399
+ socketRef.current = null;
400
+ }
401
+ };
402
+ }, [visible, userInfo, test, isEnochSDK]);
403
+
404
+ // Render error details for specific error codes
405
+ const renderErrorDetails = () => {
406
+ if (!hasError || !errorCode) return null;
407
+
408
+ const errorDetails = {
409
+ 'PIN_REQUIRED': {
410
+ icon: 'lock',
411
+ title: 'PIN Setup Required',
412
+ description: 'Set up your PIN to secure your AI model'
413
+ },
414
+ 'CONNECTIONS_REQUIRED': {
415
+ icon: 'link',
416
+ title: 'Connect Accounts',
417
+ description: 'Connect at least one social media account'
418
+ },
419
+ 'INSUFFICIENT_DATA': {
420
+ icon: 'data-usage',
421
+ title: 'More Data Needed',
422
+ description: 'We need more interaction data to train effectively'
423
+ },
424
+ 'ENCRYPTION_REQUIRED': {
425
+ icon: 'security',
426
+ title: 'Encryption Failed',
427
+ description: 'Failed to encrypt your model securely'
428
+ }
429
+ };
430
+
431
+ const details = errorDetails[errorCode];
432
+ if (!details) return null;
433
+
434
+ return (
435
+ <View style={styles.errorDetailsContainer}>
436
+ <Icon name={details.icon} size={32} color="#FF6B6B" />
437
+ <Text style={styles.errorTitle}>{details.title}</Text>
438
+ <Text style={styles.errorDescription}>{details.description}</Text>
439
+ </View>
440
+ );
441
+ };
442
+
443
+ return (
444
+ <Modal
445
+ visible={visible}
446
+ transparent
447
+ animationType="none"
448
+ statusBarTranslucent
449
+ onRequestClose={onCancel}
450
+ >
451
+ <TouchableWithoutFeedback>
452
+ <View style={styles.modalOverlay}>
453
+ <TouchableWithoutFeedback>
454
+ <View style={styles.bottomSheet}>
455
+ <View style={styles.handleContainer}>
456
+ <View style={styles.handle} />
457
+ </View>
458
+
459
+ <SafeAreaView style={styles.container}>
460
+ <View style={styles.content}>
461
+ <Image
462
+ source={require('../assets/images/onairos_logo.png')}
463
+ style={styles.onairosLogo}
464
+ resizeMode="contain"
465
+ />
466
+
467
+ <Text style={styles.title}>
468
+ {isEnochSDK ? 'Training AI with Inference' : 'Training Your AI'}
469
+ </Text>
470
+
471
+ <View style={styles.progressContainer}>
472
+ <View style={styles.progressBar}>
473
+ <View
474
+ style={[
475
+ styles.progressFill,
476
+ { width: `${progressPercentage}%` },
477
+ ]}
478
+ />
479
+ </View>
480
+ <Text style={styles.progressText}>{progressPercentage}%</Text>
481
+ </View>
482
+
483
+ <Text style={styles.statusText}>
484
+ {trainingStatus}
485
+ </Text>
486
+
487
+ {hasError && (
488
+ <View style={styles.errorContainer}>
489
+ <Icon name="error-outline" size={24} color="#FF6B6B" />
490
+ <Text style={styles.errorText}>Training encountered an error</Text>
491
+ </View>
492
+ )}
493
+
494
+ {renderErrorDetails()}
495
+
496
+ {isTrainingComplete && trainingResults && (
497
+ <View style={styles.resultsContainer}>
498
+ <Icon name="check-circle" size={32} color="#4CAF50" />
499
+ <Text style={styles.resultsTitle}>Training Complete!</Text>
500
+ <View style={styles.resultsDetails}>
501
+ <View style={styles.resultItem}>
502
+ <Icon name="cloud-done" size={16} color="#666" />
503
+ <Text style={styles.resultText}>Storage: {trainingResults.storage}</Text>
504
+ </View>
505
+ <View style={styles.resultItem}>
506
+ <Icon name="security" size={16} color="#666" />
507
+ <Text style={styles.resultText}>Encrypted: {trainingResults.encryption ? 'Yes' : 'No'}</Text>
508
+ </View>
509
+ {trainingResults.inference && (
510
+ <View style={styles.resultItem}>
511
+ <Icon name="psychology" size={16} color="#666" />
512
+ <Text style={styles.resultText}>Inference: Completed</Text>
513
+ </View>
514
+ )}
515
+ </View>
516
+ </View>
517
+ )}
518
+
519
+ <View style={styles.footer}>
520
+ <TouchableOpacity
521
+ style={styles.cancelButton}
522
+ onPress={onCancel}
523
+ >
524
+ <Text style={styles.cancelButtonText}>Cancel</Text>
525
+ </TouchableOpacity>
526
+
527
+ {(currentProgress >= 1 || isTrainingComplete) && (
528
+ <TouchableOpacity
529
+ style={styles.completeButton}
530
+ onPress={onComplete}
531
+ >
532
+ <Text style={styles.completeButtonText}>Complete</Text>
533
+ </TouchableOpacity>
534
+ )}
535
+ </View>
536
+ </View>
537
+ </SafeAreaView>
538
+ </View>
539
+ </TouchableWithoutFeedback>
540
+ </View>
541
+ </TouchableWithoutFeedback>
542
+ </Modal>
543
+ );
544
+ };
545
+
546
+ const styles = StyleSheet.create({
547
+ modalOverlay: {
548
+ flex: 1,
549
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
550
+ justifyContent: 'flex-end',
551
+ alignItems: 'center',
552
+ },
553
+ bottomSheet: {
554
+ backgroundColor: '#fff',
555
+ width: width,
556
+ height: height * 0.8,
557
+ borderTopLeftRadius: 24,
558
+ borderTopRightRadius: 24,
559
+ overflow: 'hidden',
560
+ },
561
+ handleContainer: {
562
+ width: '100%',
563
+ alignItems: 'center',
564
+ paddingTop: 12,
565
+ paddingBottom: 8,
566
+ },
567
+ handle: {
568
+ width: 40,
569
+ height: 5,
570
+ borderRadius: 3,
571
+ backgroundColor: '#E0E0E0',
572
+ },
573
+ container: {
574
+ flex: 1,
575
+ backgroundColor: '#fff',
576
+ },
577
+ content: {
578
+ flex: 1,
579
+ width: '100%',
580
+ alignItems: 'center',
581
+ justifyContent: 'center',
582
+ padding: 24,
583
+ },
584
+ title: {
585
+ fontSize: 24,
586
+ fontWeight: '600',
587
+ marginTop: 24,
588
+ marginBottom: 8,
589
+ color: COLORS.text.primary,
590
+ textAlign: 'center',
591
+ },
592
+ subtitle: {
593
+ fontSize: 16,
594
+ color: COLORS.text.secondary,
595
+ textAlign: 'center',
596
+ marginBottom: 32,
597
+ },
598
+ statusText: {
599
+ fontSize: 14,
600
+ color: COLORS.text.secondary,
601
+ marginBottom: 24,
602
+ textAlign: 'center',
603
+ },
604
+ progressContainer: {
605
+ width: '100%',
606
+ marginBottom: 16,
607
+ },
608
+ progressBar: {
609
+ height: 8,
610
+ backgroundColor: COLORS.border,
611
+ borderRadius: 4,
612
+ overflow: 'hidden',
613
+ },
614
+ progressFill: {
615
+ height: '100%',
616
+ backgroundColor: COLORS.primary,
617
+ borderRadius: 4,
618
+ },
619
+ progressText: {
620
+ fontSize: 14,
621
+ color: COLORS.text.secondary,
622
+ textAlign: 'center',
623
+ marginTop: 8,
624
+ },
625
+ etaText: {
626
+ fontSize: 14,
627
+ color: COLORS.text.secondary,
628
+ marginBottom: 24,
629
+ },
630
+ loadingContainer: {
631
+ flexDirection: 'row',
632
+ alignItems: 'center',
633
+ marginBottom: 32,
634
+ },
635
+ loadingText: {
636
+ fontSize: 14,
637
+ color: COLORS.text.secondary,
638
+ marginLeft: 8,
639
+ },
640
+ footer: {
641
+ flexDirection: 'row',
642
+ alignItems: 'center',
643
+ justifyContent: 'space-between',
644
+ width: '100%',
645
+ borderTopWidth: 1,
646
+ borderTopColor: '#eee',
647
+ paddingTop: 16,
648
+ paddingHorizontal: 24,
649
+ paddingBottom: 24,
650
+ },
651
+ cancelButton: {
652
+ paddingVertical: 8,
653
+ paddingHorizontal: 16,
654
+ },
655
+ cancelButtonText: {
656
+ fontSize: 16,
657
+ color: '#666',
658
+ },
659
+ completeButton: {
660
+ paddingVertical: 16,
661
+ paddingHorizontal: 32,
662
+ borderRadius: 16,
663
+ backgroundColor: '#fff',
664
+ borderWidth: 1,
665
+ borderColor: '#000',
666
+ },
667
+ completeButtonText: {
668
+ fontSize: 16,
669
+ fontWeight: '600',
670
+ color: '#000',
671
+ },
672
+ onairosLogo: {
673
+ width: 48,
674
+ height: 48,
675
+ },
676
+ errorContainer: {
677
+ flexDirection: 'row',
678
+ alignItems: 'center',
679
+ marginBottom: 16,
680
+ },
681
+ errorText: {
682
+ fontSize: 14,
683
+ color: '#FF6B6B',
684
+ marginLeft: 8,
685
+ },
686
+ errorDetailsContainer: {
687
+ alignItems: 'center',
688
+ marginBottom: 24,
689
+ padding: 16,
690
+ backgroundColor: '#FFF5F5',
691
+ borderRadius: 12,
692
+ borderWidth: 1,
693
+ borderColor: '#FFEBEE',
694
+ },
695
+ errorTitle: {
696
+ fontSize: 16,
697
+ fontWeight: '600',
698
+ color: '#FF6B6B',
699
+ marginTop: 8,
700
+ marginBottom: 4,
701
+ },
702
+ errorDescription: {
703
+ fontSize: 14,
704
+ color: '#666',
705
+ textAlign: 'center',
706
+ },
707
+ resultsContainer: {
708
+ alignItems: 'center',
709
+ marginBottom: 24,
710
+ padding: 16,
711
+ backgroundColor: '#F5F5F5',
712
+ borderRadius: 12,
713
+ borderWidth: 1,
714
+ borderColor: '#E0E0E0',
715
+ },
716
+ resultsTitle: {
717
+ fontSize: 16,
718
+ fontWeight: '600',
719
+ color: '#4CAF50',
720
+ marginTop: 8,
721
+ marginBottom: 12,
722
+ },
723
+ resultsDetails: {
724
+ alignItems: 'flex-start',
725
+ width: '100%',
726
+ },
727
+ resultItem: {
728
+ flexDirection: 'row',
729
+ alignItems: 'center',
730
+ marginBottom: 4,
731
+ },
732
+ resultText: {
733
+ fontSize: 14,
734
+ color: '#666',
735
+ marginLeft: 8,
736
+ },
737
+ });