@onairos/react-native 3.4.0 → 3.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (546) hide show
  1. package/README.md +62 -13
  2. package/lib/commonjs/api/index.js +9 -145
  3. package/lib/commonjs/assets/animations/loaderani.json +1 -0
  4. package/lib/commonjs/assets/animations/persona-animation.json +1 -0
  5. package/lib/commonjs/assets/fonts/EBGaramond-VariableFont_wght.ttf +0 -0
  6. package/lib/commonjs/assets/fonts/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
  7. package/lib/commonjs/assets/icons/Facebookicon.png +0 -0
  8. package/lib/commonjs/assets/icons/Gmail.png +0 -0
  9. package/lib/commonjs/assets/icons/Linkedinicon.png +0 -0
  10. package/lib/commonjs/assets/icons/Redditicon.png +0 -0
  11. package/lib/commonjs/assets/icons/YouTubeicon2.png +0 -0
  12. package/lib/commonjs/assets/icons/YouTubeicon3.png +0 -0
  13. package/lib/commonjs/assets/icons/chatgpt.png +0 -0
  14. package/lib/commonjs/assets/icons/claude.png +0 -0
  15. package/lib/commonjs/assets/icons/gemini.png +0 -0
  16. package/lib/commonjs/assets/icons/grok.png +0 -0
  17. package/lib/commonjs/assets/images/Checkbox.svg +3 -0
  18. package/lib/commonjs/assets/images/EnochE.svg +19 -0
  19. package/lib/commonjs/assets/images/Enochicon1.png +0 -0
  20. package/lib/commonjs/assets/images/Face_ID_logo.png +0 -0
  21. package/lib/commonjs/assets/images/Facebookicon.png +0 -0
  22. package/lib/commonjs/assets/images/Gmail.png +0 -0
  23. package/lib/commonjs/assets/images/Googlelogo.png +0 -0
  24. package/lib/commonjs/assets/images/Linkedinicon.png +0 -0
  25. package/lib/commonjs/assets/images/Onairoslogo.png +0 -0
  26. package/lib/commonjs/assets/images/Personalityprofile.svg +3 -0
  27. package/lib/commonjs/assets/images/Personalitytraits.svg +3 -0
  28. package/lib/commonjs/assets/images/Redditicon.png +0 -0
  29. package/lib/commonjs/assets/images/Userpreferences.svg +3 -0
  30. package/lib/commonjs/assets/images/YouTubeicon3.png +0 -0
  31. package/lib/commonjs/assets/images/arrow.svg +20 -0
  32. package/lib/commonjs/assets/images/basicproficon.svg +43 -0
  33. package/lib/commonjs/assets/images/basicprofile.svg +3 -0
  34. package/lib/commonjs/assets/images/chatgpt.png +0 -0
  35. package/lib/commonjs/assets/images/checkmark.svg +4 -0
  36. package/lib/commonjs/assets/images/claude.png +0 -0
  37. package/lib/commonjs/assets/images/contentanalysis.svg +3 -0
  38. package/lib/commonjs/assets/images/contenticon.svg +23 -0
  39. package/lib/commonjs/assets/images/gemini.png +0 -0
  40. package/lib/commonjs/assets/images/grok.png +0 -0
  41. package/lib/commonjs/assets/images/persona1.png +0 -0
  42. package/lib/commonjs/assets/images/persona2.png +0 -0
  43. package/lib/commonjs/assets/images/persona3.png +0 -0
  44. package/lib/commonjs/assets/images/persona4.png +0 -0
  45. package/lib/commonjs/assets/images/persona5.png +0 -0
  46. package/lib/commonjs/assets/images/personalityicon.svg +18 -0
  47. package/lib/commonjs/assets/images/x-close.svg +3 -0
  48. package/lib/commonjs/components/BodyText.js +9 -0
  49. package/lib/commonjs/components/BrandMark.js +10 -0
  50. package/lib/commonjs/components/CodeInput.js +9 -0
  51. package/lib/commonjs/components/EmailInput.js +8 -0
  52. package/lib/commonjs/components/GoogleButton.js +9 -0
  53. package/lib/commonjs/components/HeadingGroup.js +9 -0
  54. package/lib/commonjs/components/LLMDataInputModal.js +14 -0
  55. package/lib/commonjs/components/ModalHeader.js +9 -0
  56. package/lib/commonjs/components/ModalSheet.js +9 -0
  57. package/lib/commonjs/components/Onairos.js +14 -374
  58. package/lib/commonjs/components/OnairosButton.js +13 -309
  59. package/lib/commonjs/components/OnairosSignInButton.js +12 -0
  60. package/lib/commonjs/components/Overlay.js +13 -483
  61. package/lib/commonjs/components/PersonaImage.js +10 -0
  62. package/lib/commonjs/components/PersonaLoadingScreen.js +12 -0
  63. package/lib/commonjs/components/PersonalizationConsentScreen.js +13 -0
  64. package/lib/commonjs/components/PinCreationScreen.js +12 -0
  65. package/lib/commonjs/components/PinInput.js +9 -302
  66. package/lib/commonjs/components/PlatformConnectorsStep.js +22 -0
  67. package/lib/commonjs/components/PlatformList.js +10 -137
  68. package/lib/commonjs/components/PlatformToggle.js +9 -0
  69. package/lib/commonjs/components/PrimaryButton.js +10 -0
  70. package/lib/commonjs/components/SignInMatchAnimation.js +9 -0
  71. package/lib/commonjs/components/SignInStep.js +12 -0
  72. package/lib/commonjs/components/UniversalOnboarding.js +29 -1702
  73. package/lib/commonjs/components/VerificationStep.js +11 -0
  74. package/lib/commonjs/components/WelcomeScreen.js +21 -0
  75. package/lib/commonjs/components/icons/Basicproficon.js +8 -0
  76. package/lib/commonjs/components/icons/Basicprofile.js +8 -0
  77. package/lib/commonjs/components/icons/Checkbox.js +8 -0
  78. package/lib/commonjs/components/icons/Checkmark.js +8 -0
  79. package/lib/commonjs/components/icons/Contentanalysis.js +8 -0
  80. package/lib/commonjs/components/icons/Contenticon.js +8 -0
  81. package/lib/commonjs/components/icons/EnochE.js +8 -0
  82. package/lib/commonjs/components/icons/Personalityicon.js +8 -0
  83. package/lib/commonjs/components/icons/Personalityprofile.js +8 -0
  84. package/lib/commonjs/components/icons/Personalitytraits.js +8 -0
  85. package/lib/commonjs/components/icons/Userpreferences.js +8 -0
  86. package/lib/commonjs/components/icons/index.js +17 -0
  87. package/lib/commonjs/components/onboarding/OAuthWebView.js +14 -827
  88. package/lib/commonjs/components/onboarding/OnboardingHeader.js +10 -74
  89. package/lib/commonjs/components/onboarding/PinInput.js +10 -283
  90. package/lib/commonjs/components/onboarding/PlatformConnector.js +11 -249
  91. package/lib/commonjs/config/api.js +7 -0
  92. package/lib/commonjs/constants/index.js +7 -83
  93. package/lib/commonjs/context/AuthContext.js +10 -0
  94. package/lib/commonjs/hooks/useConnectedAccounts.js +9 -0
  95. package/lib/commonjs/hooks/useConnections.js +8 -159
  96. package/lib/commonjs/hooks/useCredentials.js +10 -177
  97. package/lib/commonjs/hooks/useUserConnections.js +10 -0
  98. package/lib/commonjs/index.js +35 -106
  99. package/lib/commonjs/services/SDK_API_KEY_VALIDATION.md +31 -38
  100. package/lib/commonjs/services/apiClient.js +8 -0
  101. package/lib/commonjs/services/apiKeyService.js +9 -946
  102. package/lib/commonjs/services/authService.js +10 -0
  103. package/lib/commonjs/services/biometricPinService.js +8 -0
  104. package/lib/commonjs/services/chatGPTConversationExtractor.js +8 -0
  105. package/lib/commonjs/services/chatGPTConversationService.js +9 -0
  106. package/lib/commonjs/services/claudeConversationExtractor.js +8 -0
  107. package/lib/commonjs/services/claudeConversationService.js +9 -0
  108. package/lib/commonjs/services/connectedAccountsService.js +10 -0
  109. package/lib/commonjs/services/googleAuthService.js +11 -0
  110. package/lib/commonjs/services/imageCompressionService.js +7 -0
  111. package/lib/commonjs/services/jwtStorageService.js +7 -0
  112. package/lib/commonjs/services/linkedinDOMExtractor.js +7 -0
  113. package/lib/commonjs/services/linkedinProfileService.js +9 -0
  114. package/lib/commonjs/services/linkedinScrapingService.js +8 -0
  115. package/lib/commonjs/services/llmDataStorage.js +8 -0
  116. package/lib/commonjs/services/mobileTrainingService.js +8 -0
  117. package/lib/commonjs/services/oauthService.js +11 -390
  118. package/lib/commonjs/services/pinEncryptionService.js +8 -0
  119. package/lib/commonjs/services/pinStorageUtils.js +7 -0
  120. package/lib/commonjs/services/platformAuthService.js +12 -1067
  121. package/lib/commonjs/services/storageService.js +8 -0
  122. package/lib/commonjs/services/trainingApiHelpers.js +7 -0
  123. package/lib/commonjs/services/userConnectionsService.js +10 -0
  124. package/lib/commonjs/services/youtubeMigrationService.js +10 -0
  125. package/lib/commonjs/theme/index.js +7 -0
  126. package/lib/commonjs/types/ambient.d.js +1 -2
  127. package/lib/commonjs/types/declarations.d.js +1 -2
  128. package/lib/commonjs/types/index.js +1 -6
  129. package/lib/commonjs/types/node-fix.d.js +1 -2
  130. package/lib/commonjs/types/node-override.d.js +1 -2
  131. package/lib/commonjs/types/opacity.d.js +1 -2
  132. package/lib/commonjs/types.js +1 -14
  133. package/lib/commonjs/utils/Portal.js +8 -98
  134. package/lib/commonjs/utils/api.js +9 -129
  135. package/lib/commonjs/utils/assetRegistry.js +33 -0
  136. package/lib/commonjs/utils/auth.js +9 -111
  137. package/lib/commonjs/utils/crypto.js +8 -62
  138. package/lib/commonjs/utils/debugHelper.js +1 -64
  139. package/lib/commonjs/utils/encryption.js +7 -76
  140. package/lib/commonjs/utils/eventUtils.js +1 -0
  141. package/lib/commonjs/utils/haptics.js +9 -0
  142. package/lib/commonjs/utils/imagePreloader.js +1 -0
  143. package/lib/commonjs/utils/networkDiagnostics.js +8 -0
  144. package/lib/commonjs/utils/onairosApi.js +9 -350
  145. package/lib/commonjs/utils/programmaticFlow.js +9 -117
  146. package/lib/commonjs/utils/retryHelper.js +1 -220
  147. package/lib/commonjs/utils/secureStorage.js +10 -349
  148. package/lib/commonjs/utils/webviewScripts/chatgpt.js +1 -0
  149. package/lib/commonjs/utils/webviewScripts/claude.js +1 -0
  150. package/lib/commonjs/utils/webviewScripts/index.js +9 -0
  151. package/lib/commonjs/utils/webviewScripts/linkedin.js +1 -0
  152. package/lib/module/api/index.js +1 -139
  153. package/lib/module/assets/animations/loaderani.json +1 -0
  154. package/lib/module/assets/animations/persona-animation.json +1 -0
  155. package/lib/module/assets/fonts/EBGaramond-VariableFont_wght.ttf +0 -0
  156. package/lib/module/assets/fonts/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
  157. package/lib/module/assets/icons/Facebookicon.png +0 -0
  158. package/lib/module/assets/icons/Gmail.png +0 -0
  159. package/lib/module/assets/icons/Linkedinicon.png +0 -0
  160. package/lib/module/assets/icons/Redditicon.png +0 -0
  161. package/lib/module/assets/icons/YouTubeicon2.png +0 -0
  162. package/lib/module/assets/icons/YouTubeicon3.png +0 -0
  163. package/lib/module/assets/icons/chatgpt.png +0 -0
  164. package/lib/module/assets/icons/claude.png +0 -0
  165. package/lib/module/assets/icons/farcaster.png +0 -0
  166. package/lib/module/assets/icons/gemini.png +0 -0
  167. package/lib/module/assets/icons/grok.png +0 -0
  168. package/lib/module/assets/icons/instagram.png +0 -0
  169. package/lib/module/assets/icons/pinterest.png +0 -0
  170. package/lib/module/assets/icons/swerv_logo.png +0 -0
  171. package/lib/module/assets/icons/twitter.jpg +0 -0
  172. package/lib/module/assets/images/Checkbox.svg +3 -0
  173. package/lib/module/assets/images/EnochE.svg +19 -0
  174. package/lib/module/assets/images/Enochicon1.png +0 -0
  175. package/lib/module/assets/images/Face_ID_logo.png +0 -0
  176. package/lib/module/assets/images/Facebookicon.png +0 -0
  177. package/lib/module/assets/images/Gmail.png +0 -0
  178. package/lib/module/assets/images/Googlelogo.png +0 -0
  179. package/lib/module/assets/images/Linkedinicon.png +0 -0
  180. package/lib/module/assets/images/Onairoslogo.png +0 -0
  181. package/lib/module/assets/images/Personalityprofile.svg +3 -0
  182. package/lib/module/assets/images/Personalitytraits.svg +3 -0
  183. package/lib/module/assets/images/Redditicon.png +0 -0
  184. package/lib/module/assets/images/Userpreferences.svg +3 -0
  185. package/lib/module/assets/images/YouTubeicon3.png +0 -0
  186. package/lib/module/assets/images/arrow.svg +20 -0
  187. package/lib/module/assets/images/basicproficon.svg +43 -0
  188. package/lib/module/assets/images/basicprofile.svg +3 -0
  189. package/lib/module/assets/images/chatgpt.png +0 -0
  190. package/lib/module/assets/images/checkmark.svg +4 -0
  191. package/lib/module/assets/images/claude.png +0 -0
  192. package/lib/module/assets/images/contentanalysis.svg +3 -0
  193. package/lib/module/assets/images/contenticon.svg +23 -0
  194. package/lib/module/assets/images/gemini.png +0 -0
  195. package/lib/module/assets/images/grok.png +0 -0
  196. package/lib/module/assets/images/persona1.png +0 -0
  197. package/lib/module/assets/images/persona2.png +0 -0
  198. package/lib/module/assets/images/persona3.png +0 -0
  199. package/lib/module/assets/images/persona4.png +0 -0
  200. package/lib/module/assets/images/persona5.png +0 -0
  201. package/lib/module/assets/images/personalityicon.svg +18 -0
  202. package/lib/module/assets/images/x-close.svg +3 -0
  203. package/lib/module/components/BodyText.js +1 -0
  204. package/lib/module/components/BrandMark.js +1 -0
  205. package/lib/module/components/CodeInput.js +1 -0
  206. package/lib/module/components/EmailInput.js +1 -0
  207. package/lib/module/components/GoogleButton.js +1 -0
  208. package/lib/module/components/HeadingGroup.js +1 -0
  209. package/lib/module/components/LLMDataInputModal.js +8 -0
  210. package/lib/module/components/ModalHeader.js +1 -0
  211. package/lib/module/components/ModalSheet.js +1 -0
  212. package/lib/module/components/Onairos.js +1 -367
  213. package/lib/module/components/OnairosButton.js +1 -302
  214. package/lib/module/components/OnairosSignInButton.js +1 -0
  215. package/lib/module/components/Overlay.js +1 -474
  216. package/lib/module/components/PersonaImage.js +1 -0
  217. package/lib/module/components/PersonaLoadingScreen.js +1 -0
  218. package/lib/module/components/PersonalizationConsentScreen.js +1 -0
  219. package/lib/module/components/PinCreationScreen.js +1 -0
  220. package/lib/module/components/PinInput.js +1 -293
  221. package/lib/module/components/PlatformConnectorsStep.js +1 -0
  222. package/lib/module/components/PlatformList.js +1 -129
  223. package/lib/module/components/PlatformToggle.js +1 -0
  224. package/lib/module/components/PrimaryButton.js +1 -0
  225. package/lib/module/components/SignInMatchAnimation.js +1 -0
  226. package/lib/module/components/SignInStep.js +1 -0
  227. package/lib/module/components/UniversalOnboarding.js +1 -1693
  228. package/lib/module/components/VerificationStep.js +1 -0
  229. package/lib/module/components/WelcomeScreen.js +1 -0
  230. package/lib/module/components/icons/Basicproficon.js +1 -0
  231. package/lib/module/components/icons/Basicprofile.js +1 -0
  232. package/lib/module/components/icons/Checkbox.js +1 -0
  233. package/lib/module/components/icons/Checkmark.js +1 -0
  234. package/lib/module/components/icons/Contentanalysis.js +1 -0
  235. package/lib/module/components/icons/Contenticon.js +1 -0
  236. package/lib/module/components/icons/EnochE.js +1 -0
  237. package/lib/module/components/icons/Personalityicon.js +1 -0
  238. package/lib/module/components/icons/Personalityprofile.js +1 -0
  239. package/lib/module/components/icons/Personalitytraits.js +1 -0
  240. package/lib/module/components/icons/Userpreferences.js +1 -0
  241. package/lib/module/components/icons/index.js +1 -0
  242. package/lib/module/components/onboarding/OAuthWebView.js +1 -818
  243. package/lib/module/components/onboarding/OnboardingHeader.js +1 -66
  244. package/lib/module/components/onboarding/PinInput.js +1 -274
  245. package/lib/module/components/onboarding/PlatformConnector.js +1 -240
  246. package/lib/module/config/api.js +1 -0
  247. package/lib/module/constants/index.js +1 -77
  248. package/lib/module/context/AuthContext.js +1 -0
  249. package/lib/module/hooks/useConnectedAccounts.js +1 -0
  250. package/lib/module/hooks/useConnections.js +1 -152
  251. package/lib/module/hooks/useCredentials.js +6 -169
  252. package/lib/module/hooks/useUserConnections.js +1 -0
  253. package/lib/module/index.js +1 -32
  254. package/lib/module/services/SDK_API_KEY_VALIDATION.md +31 -38
  255. package/lib/module/services/apiClient.js +1 -0
  256. package/lib/module/services/apiKeyService.js +1 -919
  257. package/lib/module/services/authService.js +1 -0
  258. package/lib/module/services/biometricPinService.js +1 -0
  259. package/lib/module/services/chatGPTConversationExtractor.js +1 -0
  260. package/lib/module/services/chatGPTConversationService.js +1 -0
  261. package/lib/module/services/claudeConversationExtractor.js +1 -0
  262. package/lib/module/services/claudeConversationService.js +1 -0
  263. package/lib/module/services/connectedAccountsService.js +1 -0
  264. package/lib/module/services/googleAuthService.js +1 -0
  265. package/lib/module/services/imageCompressionService.js +1 -0
  266. package/lib/module/services/jwtStorageService.js +1 -0
  267. package/lib/module/services/linkedinDOMExtractor.js +1 -0
  268. package/lib/module/services/linkedinProfileService.js +1 -0
  269. package/lib/module/services/linkedinScrapingService.js +1 -0
  270. package/lib/module/services/llmDataStorage.js +1 -0
  271. package/lib/module/services/mobileTrainingService.js +1 -0
  272. package/lib/module/services/oauthService.js +1 -380
  273. package/lib/module/services/pinEncryptionService.js +7 -0
  274. package/lib/module/services/pinStorageUtils.js +1 -0
  275. package/lib/module/services/platformAuthService.js +1 -1041
  276. package/lib/module/services/storageService.js +1 -0
  277. package/lib/module/services/trainingApiHelpers.js +1 -0
  278. package/lib/module/services/userConnectionsService.js +1 -0
  279. package/lib/module/services/youtubeMigrationService.js +1 -0
  280. package/lib/module/theme/index.js +1 -0
  281. package/lib/module/types.js +1 -10
  282. package/lib/module/utils/Portal.js +1 -90
  283. package/lib/module/utils/api.js +1 -117
  284. package/lib/module/utils/assetRegistry.js +33 -0
  285. package/lib/module/utils/auth.js +1 -99
  286. package/lib/module/utils/crypto.js +1 -54
  287. package/lib/module/utils/debugHelper.js +1 -54
  288. package/lib/module/utils/encryption.js +1 -67
  289. package/lib/module/utils/eventUtils.js +1 -0
  290. package/lib/module/utils/haptics.js +8 -0
  291. package/lib/module/utils/imagePreloader.js +1 -0
  292. package/lib/module/utils/networkDiagnostics.js +1 -0
  293. package/lib/module/utils/onairosApi.js +1 -333
  294. package/lib/module/utils/programmaticFlow.js +1 -111
  295. package/lib/module/utils/retryHelper.js +1 -211
  296. package/lib/module/utils/secureStorage.js +6 -330
  297. package/lib/module/utils/webviewScripts/chatgpt.js +1 -0
  298. package/lib/module/utils/webviewScripts/claude.js +1 -0
  299. package/lib/module/utils/webviewScripts/index.js +1 -0
  300. package/lib/module/utils/webviewScripts/linkedin.js +1 -0
  301. package/package.json +62 -39
  302. package/lib/commonjs/api/index.js.map +0 -1
  303. package/lib/commonjs/assets/images/email.png +0 -0
  304. package/lib/commonjs/assets/images/linkedin.png +0 -0
  305. package/lib/commonjs/assets/images/reddit.png +0 -0
  306. package/lib/commonjs/assets/images/youtube.png +0 -0
  307. package/lib/commonjs/components/DataRequestModal.js +0 -228
  308. package/lib/commonjs/components/DataRequestModal.js.map +0 -1
  309. package/lib/commonjs/components/DataRequestScreen.js +0 -329
  310. package/lib/commonjs/components/DataRequestScreen.js.map +0 -1
  311. package/lib/commonjs/components/EmailVerificationModal.js +0 -320
  312. package/lib/commonjs/components/EmailVerificationModal.js.map +0 -1
  313. package/lib/commonjs/components/Onairos.js.map +0 -1
  314. package/lib/commonjs/components/OnairosButton.js.map +0 -1
  315. package/lib/commonjs/components/Overlay.js.map +0 -1
  316. package/lib/commonjs/components/PinInput.js.map +0 -1
  317. package/lib/commonjs/components/PlatformList.js.map +0 -1
  318. package/lib/commonjs/components/TrainingModal.js +0 -717
  319. package/lib/commonjs/components/TrainingModal.js.map +0 -1
  320. package/lib/commonjs/components/UniversalOnboarding.js.map +0 -1
  321. package/lib/commonjs/components/UniversalOnboarding.tsx.new +0 -455
  322. package/lib/commonjs/components/onboarding/OAuthWebView.js.map +0 -1
  323. package/lib/commonjs/components/onboarding/OnboardingHeader.js.map +0 -1
  324. package/lib/commonjs/components/onboarding/PinInput.js.map +0 -1
  325. package/lib/commonjs/components/onboarding/PlatformConnector.js.map +0 -1
  326. package/lib/commonjs/components/screens/ConnectorScreen.js +0 -146
  327. package/lib/commonjs/components/screens/ConnectorScreen.js.map +0 -1
  328. package/lib/commonjs/components/screens/LoadingScreen.js +0 -91
  329. package/lib/commonjs/components/screens/LoadingScreen.js.map +0 -1
  330. package/lib/commonjs/components/screens/PinCreationScreen.js +0 -61
  331. package/lib/commonjs/components/screens/PinCreationScreen.js.map +0 -1
  332. package/lib/commonjs/constants/index.js.map +0 -1
  333. package/lib/commonjs/hooks/useConnections.js.map +0 -1
  334. package/lib/commonjs/hooks/useCredentials.js.map +0 -1
  335. package/lib/commonjs/index.js.map +0 -1
  336. package/lib/commonjs/services/apiKeyService.js.map +0 -1
  337. package/lib/commonjs/services/oauthService.js.map +0 -1
  338. package/lib/commonjs/services/platformAuthService.js.map +0 -1
  339. package/lib/commonjs/types/ambient.d.js.map +0 -1
  340. package/lib/commonjs/types/declarations.d.js.map +0 -1
  341. package/lib/commonjs/types/index.d.js.map +0 -1
  342. package/lib/commonjs/types/index.js.map +0 -1
  343. package/lib/commonjs/types/node-fix.d.js.map +0 -1
  344. package/lib/commonjs/types/node-override.d.js.map +0 -1
  345. package/lib/commonjs/types/opacity.d.js.map +0 -1
  346. package/lib/commonjs/types/types.d.js.map +0 -1
  347. package/lib/commonjs/types.js.map +0 -1
  348. package/lib/commonjs/utils/Portal.js.map +0 -1
  349. package/lib/commonjs/utils/api.js.map +0 -1
  350. package/lib/commonjs/utils/auth.js.map +0 -1
  351. package/lib/commonjs/utils/crypto.js.map +0 -1
  352. package/lib/commonjs/utils/debugHelper.js.map +0 -1
  353. package/lib/commonjs/utils/encryption.js.map +0 -1
  354. package/lib/commonjs/utils/onairosApi.js.map +0 -1
  355. package/lib/commonjs/utils/programmaticFlow.js.map +0 -1
  356. package/lib/commonjs/utils/retryHelper.js.map +0 -1
  357. package/lib/commonjs/utils/secureStorage.js.map +0 -1
  358. package/lib/module/api/index.js.map +0 -1
  359. package/lib/module/assets/images/email.png +0 -0
  360. package/lib/module/assets/images/linkedin.png +0 -0
  361. package/lib/module/assets/images/reddit.png +0 -0
  362. package/lib/module/assets/images/youtube.png +0 -0
  363. package/lib/module/components/DataRequestModal.js +0 -220
  364. package/lib/module/components/DataRequestModal.js.map +0 -1
  365. package/lib/module/components/DataRequestScreen.js +0 -321
  366. package/lib/module/components/DataRequestScreen.js.map +0 -1
  367. package/lib/module/components/EmailVerificationModal.js +0 -311
  368. package/lib/module/components/EmailVerificationModal.js.map +0 -1
  369. package/lib/module/components/Onairos.js.map +0 -1
  370. package/lib/module/components/OnairosButton.js.map +0 -1
  371. package/lib/module/components/Overlay.js.map +0 -1
  372. package/lib/module/components/PinInput.js.map +0 -1
  373. package/lib/module/components/PlatformList.js.map +0 -1
  374. package/lib/module/components/TrainingModal.js +0 -708
  375. package/lib/module/components/TrainingModal.js.map +0 -1
  376. package/lib/module/components/UniversalOnboarding.js.map +0 -1
  377. package/lib/module/components/UniversalOnboarding.tsx.new +0 -455
  378. package/lib/module/components/onboarding/OAuthWebView.js.map +0 -1
  379. package/lib/module/components/onboarding/OnboardingHeader.js.map +0 -1
  380. package/lib/module/components/onboarding/PinInput.js.map +0 -1
  381. package/lib/module/components/onboarding/PlatformConnector.js.map +0 -1
  382. package/lib/module/components/screens/ConnectorScreen.js +0 -138
  383. package/lib/module/components/screens/ConnectorScreen.js.map +0 -1
  384. package/lib/module/components/screens/LoadingScreen.js +0 -83
  385. package/lib/module/components/screens/LoadingScreen.js.map +0 -1
  386. package/lib/module/components/screens/PinCreationScreen.js +0 -53
  387. package/lib/module/components/screens/PinCreationScreen.js.map +0 -1
  388. package/lib/module/constants/index.js.map +0 -1
  389. package/lib/module/hooks/useConnections.js.map +0 -1
  390. package/lib/module/hooks/useCredentials.js.map +0 -1
  391. package/lib/module/index.js.map +0 -1
  392. package/lib/module/services/apiKeyService.js.map +0 -1
  393. package/lib/module/services/oauthService.js.map +0 -1
  394. package/lib/module/services/platformAuthService.js.map +0 -1
  395. package/lib/module/types/ambient.d.js.map +0 -1
  396. package/lib/module/types/declarations.d.js.map +0 -1
  397. package/lib/module/types/index.d.js.map +0 -1
  398. package/lib/module/types/index.js.map +0 -1
  399. package/lib/module/types/node-fix.d.js.map +0 -1
  400. package/lib/module/types/node-override.d.js.map +0 -1
  401. package/lib/module/types/opacity.d.js.map +0 -1
  402. package/lib/module/types/types.d.js.map +0 -1
  403. package/lib/module/types.js.map +0 -1
  404. package/lib/module/utils/Portal.js.map +0 -1
  405. package/lib/module/utils/api.js.map +0 -1
  406. package/lib/module/utils/auth.js.map +0 -1
  407. package/lib/module/utils/crypto.js.map +0 -1
  408. package/lib/module/utils/debugHelper.js.map +0 -1
  409. package/lib/module/utils/encryption.js.map +0 -1
  410. package/lib/module/utils/onairosApi.js.map +0 -1
  411. package/lib/module/utils/programmaticFlow.js.map +0 -1
  412. package/lib/module/utils/retryHelper.js.map +0 -1
  413. package/lib/module/utils/secureStorage.js.map +0 -1
  414. package/lib/typescript/api/index.d.ts +0 -8
  415. package/lib/typescript/api/index.d.ts.map +0 -1
  416. package/lib/typescript/components/DataRequestModal.d.ts +0 -11
  417. package/lib/typescript/components/DataRequestModal.d.ts.map +0 -1
  418. package/lib/typescript/components/DataRequestScreen.d.ts +0 -11
  419. package/lib/typescript/components/DataRequestScreen.d.ts.map +0 -1
  420. package/lib/typescript/components/EmailVerificationModal.d.ts +0 -11
  421. package/lib/typescript/components/EmailVerificationModal.d.ts.map +0 -1
  422. package/lib/typescript/components/Onairos.d.ts +0 -4
  423. package/lib/typescript/components/Onairos.d.ts.map +0 -1
  424. package/lib/typescript/components/OnairosButton.d.ts +0 -12
  425. package/lib/typescript/components/OnairosButton.d.ts.map +0 -1
  426. package/lib/typescript/components/Overlay.d.ts +0 -4
  427. package/lib/typescript/components/Overlay.d.ts.map +0 -1
  428. package/lib/typescript/components/PinInput.d.ts +0 -4
  429. package/lib/typescript/components/PinInput.d.ts.map +0 -1
  430. package/lib/typescript/components/PlatformList.d.ts +0 -4
  431. package/lib/typescript/components/PlatformList.d.ts.map +0 -1
  432. package/lib/typescript/components/TrainingModal.d.ts +0 -4
  433. package/lib/typescript/components/TrainingModal.d.ts.map +0 -1
  434. package/lib/typescript/components/UniversalOnboarding.d.ts +0 -4
  435. package/lib/typescript/components/UniversalOnboarding.d.ts.map +0 -1
  436. package/lib/typescript/components/onboarding/OAuthWebView.d.ts +0 -10
  437. package/lib/typescript/components/onboarding/OAuthWebView.d.ts.map +0 -1
  438. package/lib/typescript/components/onboarding/OnboardingHeader.d.ts +0 -11
  439. package/lib/typescript/components/onboarding/OnboardingHeader.d.ts.map +0 -1
  440. package/lib/typescript/components/onboarding/PinInput.d.ts +0 -4
  441. package/lib/typescript/components/onboarding/PinInput.d.ts.map +0 -1
  442. package/lib/typescript/components/onboarding/PlatformConnector.d.ts +0 -13
  443. package/lib/typescript/components/onboarding/PlatformConnector.d.ts.map +0 -1
  444. package/lib/typescript/components/screens/ConnectorScreen.d.ts +0 -9
  445. package/lib/typescript/components/screens/ConnectorScreen.d.ts.map +0 -1
  446. package/lib/typescript/components/screens/LoadingScreen.d.ts +0 -9
  447. package/lib/typescript/components/screens/LoadingScreen.d.ts.map +0 -1
  448. package/lib/typescript/components/screens/PinCreationScreen.d.ts +0 -10
  449. package/lib/typescript/components/screens/PinCreationScreen.d.ts.map +0 -1
  450. package/lib/typescript/constants/index.d.ts +0 -53
  451. package/lib/typescript/constants/index.d.ts.map +0 -1
  452. package/lib/typescript/hooks/useConnections.d.ts +0 -9
  453. package/lib/typescript/hooks/useConnections.d.ts.map +0 -1
  454. package/lib/typescript/hooks/useCredentials.d.ts +0 -9
  455. package/lib/typescript/hooks/useCredentials.d.ts.map +0 -1
  456. package/lib/typescript/index.d.ts +0 -18
  457. package/lib/typescript/index.d.ts.map +0 -1
  458. package/lib/typescript/services/apiKeyService.d.ts +0 -132
  459. package/lib/typescript/services/apiKeyService.d.ts.map +0 -1
  460. package/lib/typescript/services/oauthService.d.ts +0 -50
  461. package/lib/typescript/services/oauthService.d.ts.map +0 -1
  462. package/lib/typescript/services/platformAuthService.d.ts +0 -144
  463. package/lib/typescript/services/platformAuthService.d.ts.map +0 -1
  464. package/lib/typescript/types/index.d.ts +0 -231
  465. package/lib/typescript/types/index.d.ts.map +0 -1
  466. package/lib/typescript/types.d.ts +0 -270
  467. package/lib/typescript/types.d.ts.map +0 -1
  468. package/lib/typescript/utils/Portal.d.ts +0 -14
  469. package/lib/typescript/utils/Portal.d.ts.map +0 -1
  470. package/lib/typescript/utils/api.d.ts +0 -6
  471. package/lib/typescript/utils/api.d.ts.map +0 -1
  472. package/lib/typescript/utils/auth.d.ts +0 -6
  473. package/lib/typescript/utils/auth.d.ts.map +0 -1
  474. package/lib/typescript/utils/crypto.d.ts +0 -4
  475. package/lib/typescript/utils/crypto.d.ts.map +0 -1
  476. package/lib/typescript/utils/debugHelper.d.ts +0 -29
  477. package/lib/typescript/utils/debugHelper.d.ts.map +0 -1
  478. package/lib/typescript/utils/encryption.d.ts +0 -19
  479. package/lib/typescript/utils/encryption.d.ts.map +0 -1
  480. package/lib/typescript/utils/onairosApi.d.ts +0 -87
  481. package/lib/typescript/utils/onairosApi.d.ts.map +0 -1
  482. package/lib/typescript/utils/programmaticFlow.d.ts +0 -23
  483. package/lib/typescript/utils/programmaticFlow.d.ts.map +0 -1
  484. package/lib/typescript/utils/retryHelper.d.ts +0 -69
  485. package/lib/typescript/utils/retryHelper.d.ts.map +0 -1
  486. package/lib/typescript/utils/secureStorage.d.ts +0 -94
  487. package/lib/typescript/utils/secureStorage.d.ts.map +0 -1
  488. package/src/api/index.ts +0 -111
  489. package/src/assets/images/email.png +0 -0
  490. package/src/assets/images/linkedin.png +0 -0
  491. package/src/assets/images/onairos_logo.png +0 -0
  492. package/src/assets/images/reddit.png +0 -0
  493. package/src/assets/images/youtube.png +0 -0
  494. package/src/components/DataRequestModal.tsx +0 -227
  495. package/src/components/DataRequestScreen.tsx +0 -356
  496. package/src/components/EmailVerificationModal.tsx +0 -364
  497. package/src/components/Onairos.tsx +0 -425
  498. package/src/components/OnairosButton.tsx +0 -359
  499. package/src/components/Overlay.tsx +0 -506
  500. package/src/components/PinInput.tsx +0 -343
  501. package/src/components/PlatformList.tsx +0 -145
  502. package/src/components/TrainingModal.tsx +0 -737
  503. package/src/components/UniversalOnboarding.tsx +0 -1839
  504. package/src/components/UniversalOnboarding.tsx.new +0 -455
  505. package/src/components/onboarding/OAuthWebView.tsx +0 -838
  506. package/src/components/onboarding/OnboardingHeader.tsx +0 -70
  507. package/src/components/onboarding/PinInput.tsx +0 -356
  508. package/src/components/onboarding/PlatformConnector.tsx +0 -302
  509. package/src/components/screens/ConnectorScreen.tsx +0 -153
  510. package/src/components/screens/LoadingScreen.tsx +0 -100
  511. package/src/components/screens/PinCreationScreen.tsx +0 -67
  512. package/src/constants/index.ts +0 -83
  513. package/src/hooks/useConnections.ts +0 -163
  514. package/src/hooks/useCredentials.ts +0 -175
  515. package/src/index.js +0 -14
  516. package/src/index.ts +0 -50
  517. package/src/services/SDK_API_KEY_VALIDATION.md +0 -428
  518. package/src/services/apiKeyService.ts +0 -979
  519. package/src/services/oauthService.ts +0 -412
  520. package/src/services/platformAuthService.ts +0 -1113
  521. package/src/types/ambient.d.ts +0 -29
  522. package/src/types/declarations.d.ts +0 -26
  523. package/src/types/index.d.ts +0 -274
  524. package/src/types/index.ts +0 -244
  525. package/src/types/node-fix.d.ts +0 -19
  526. package/src/types/node-override.d.ts +0 -24
  527. package/src/types/opacity.d.ts +0 -16
  528. package/src/types/types.d.ts +0 -18
  529. package/src/types.ts +0 -298
  530. package/src/utils/Portal.tsx +0 -83
  531. package/src/utils/api.js +0 -112
  532. package/src/utils/auth.js +0 -104
  533. package/src/utils/crypto.js +0 -60
  534. package/src/utils/debugHelper.ts +0 -53
  535. package/src/utils/encryption.ts +0 -69
  536. package/src/utils/onairosApi.ts +0 -391
  537. package/src/utils/programmaticFlow.ts +0 -113
  538. package/src/utils/retryHelper.ts +0 -275
  539. package/src/utils/secureStorage.ts +0 -361
  540. package/types/index.d.ts +0 -218
  541. package/types/node-env.d.ts +0 -15
  542. /package/{src/assets/images → lib/commonjs/assets/icons}/farcaster.png +0 -0
  543. /package/{src/assets/images → lib/commonjs/assets/icons}/instagram.png +0 -0
  544. /package/{src/assets/images → lib/commonjs/assets/icons}/pinterest.png +0 -0
  545. /package/{src/assets/images → lib/commonjs/assets/icons}/swerv_logo.png +0 -0
  546. /package/{src/assets/images → lib/commonjs/assets/icons}/twitter.jpg +0 -0
@@ -1,838 +0,0 @@
1
- import React, { useState, useRef } from 'react';
2
- import {
3
- View,
4
- Text,
5
- StyleSheet,
6
- TouchableOpacity,
7
- ActivityIndicator,
8
- SafeAreaView,
9
- Dimensions,
10
- Linking,
11
- } from 'react-native';
12
- import { WebView } from 'react-native-webview';
13
- import Icon from 'react-native-vector-icons/MaterialIcons';
14
- import { COLORS } from '../../constants';
15
-
16
- const { width, height } = Dimensions.get('window');
17
-
18
- export interface OAuthWebViewProps {
19
- url: string;
20
- onClose: () => void;
21
- onSuccess: (code: string) => void;
22
- platform?: string;
23
- onComplete?: () => void;
24
- }
25
-
26
- export const OAuthWebView: React.FC<OAuthWebViewProps> = ({
27
- url,
28
- onClose,
29
- onSuccess,
30
- platform = 'platform',
31
- onComplete,
32
- }) => {
33
- const [isLoading, setIsLoading] = useState(true);
34
- const [error, setError] = useState<string | null>(null);
35
- const [errorMessage, setErrorMessage] = useState<string>('');
36
- const [isRetryable, setIsRetryable] = useState(true);
37
- const [retryCount, setRetryCount] = useState(0);
38
- const webViewRef = useRef<WebView>(null);
39
- const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
40
-
41
- console.log('🌐 Opening OAuth WebView with URL:', url);
42
- console.log('🔗 Platform:', platform);
43
- console.log('📱 URL Components:', {
44
- protocol: url.split('://')[0],
45
- domain: url.split('://')[1]?.split('/')[0],
46
- path: url.split('://')[1]?.split('/').slice(1).join('/'),
47
- });
48
-
49
- // Set up timeout for OAuth flow
50
- React.useEffect(() => {
51
- // Clear any existing timeout
52
- if (timeoutRef.current) {
53
- clearTimeout(timeoutRef.current);
54
- }
55
-
56
- // Set a 60-second timeout for OAuth completion
57
- timeoutRef.current = setTimeout(() => {
58
- console.log('OAuth flow timeout - no completion detected');
59
- setError('OAuth flow is taking too long. Please try again or use the browser option.');
60
- setIsLoading(false);
61
- }, 60000);
62
-
63
- return () => {
64
- if (timeoutRef.current) {
65
- clearTimeout(timeoutRef.current);
66
- }
67
- };
68
- }, [url]);
69
-
70
- // Clear timeout when component unmounts or OAuth completes
71
- React.useEffect(() => {
72
- return () => {
73
- if (timeoutRef.current) {
74
- clearTimeout(timeoutRef.current);
75
- }
76
- };
77
- }, []);
78
-
79
- const onNavigationStateChange = (navState: any) => {
80
- const currentUrl = navState.url;
81
- console.log('🌐 Navigation state changed:', {
82
- url: currentUrl,
83
- canGoBack: navState.canGoBack,
84
- canGoForward: navState.canGoForward,
85
- loading: navState.loading,
86
- title: navState.title,
87
- });
88
-
89
- // Don't process if still loading
90
- if (navState.loading) {
91
- return;
92
- }
93
-
94
- // Check if this URL indicates OAuth completion
95
- if (isOAuthComplete(currentUrl)) {
96
- console.log('🎉 OAuth completion detected!');
97
-
98
- // Extract the result
99
- const result = extractOAuthResult(currentUrl);
100
-
101
- if (result.success) {
102
- console.log('✅ OAuth completed successfully:', result);
103
-
104
- // Clear timeout
105
- if (timeoutRef.current) {
106
- clearTimeout(timeoutRef.current);
107
- timeoutRef.current = null;
108
- }
109
-
110
- // Call success callback
111
- if (onSuccess && result.code) {
112
- onSuccess(result.code);
113
- }
114
-
115
- // Close the WebView
116
- if (onComplete) {
117
- onComplete();
118
- }
119
- } else {
120
- console.error('❌ OAuth failed:', result.error);
121
-
122
- // Clear timeout
123
- if (timeoutRef.current) {
124
- clearTimeout(timeoutRef.current);
125
- timeoutRef.current = null;
126
- }
127
-
128
- // Set error state
129
- setError('OAuth authentication failed');
130
- setErrorMessage(result.error || 'Authentication failed');
131
- setIsRetryable(true);
132
- }
133
- }
134
-
135
- // Additional check for Gmail specific patterns
136
- if (platform === 'email' || platform === 'gmail') {
137
- const gmailPatterns = [
138
- 'onairos.uk/Home',
139
- 'onairos.uk/home',
140
- 'https://onairos.uk/Home',
141
- 'https://onairos.uk/home',
142
- ];
143
-
144
- for (const pattern of gmailPatterns) {
145
- if (currentUrl.includes(pattern)) {
146
- console.log('✅ Gmail OAuth success detected via home page redirect');
147
-
148
- // Clear timeout
149
- if (timeoutRef.current) {
150
- clearTimeout(timeoutRef.current);
151
- timeoutRef.current = null;
152
- }
153
-
154
- // Call success callback with Gmail-specific code
155
- if (onSuccess) {
156
- onSuccess('gmail_success');
157
- }
158
-
159
- // Close the WebView
160
- if (onComplete) {
161
- onComplete();
162
- }
163
-
164
- return;
165
- }
166
- }
167
- }
168
-
169
- // Check for error URLs
170
- const errorPatterns = [
171
- 'error=',
172
- 'error_description=',
173
- 'access_denied',
174
- 'user_cancelled',
175
- 'cancelled',
176
- 'denied',
177
- ];
178
-
179
- for (const pattern of errorPatterns) {
180
- if (currentUrl.includes(pattern)) {
181
- console.log('❌ OAuth error detected in URL:', pattern);
182
-
183
- // Clear timeout
184
- if (timeoutRef.current) {
185
- clearTimeout(timeoutRef.current);
186
- timeoutRef.current = null;
187
- }
188
-
189
- // Parse error details
190
- try {
191
- const urlObj = new URL(currentUrl);
192
- const params = new URLSearchParams(urlObj.search);
193
- const errorDescription = params.get('error_description') || params.get('error') || 'Authentication failed';
194
-
195
- setError('OAuth authentication failed');
196
- setErrorMessage(errorDescription);
197
- setIsRetryable(true);
198
- } catch (parseError) {
199
- setError('OAuth authentication failed');
200
- setErrorMessage('Authentication failed');
201
- setIsRetryable(true);
202
- }
203
-
204
- return;
205
- }
206
- }
207
- };
208
-
209
- const handleLoadEnd = () => {
210
- setIsLoading(false);
211
- setError(null);
212
- setErrorMessage('');
213
- };
214
-
215
- const handleError = (syntheticEvent: any) => {
216
- const { nativeEvent } = syntheticEvent;
217
- console.error('🚨 WebView error details:', {
218
- description: nativeEvent.description,
219
- code: nativeEvent.code,
220
- domain: nativeEvent.domain,
221
- url: nativeEvent.url,
222
- canGoBack: nativeEvent.canGoBack,
223
- canGoForward: nativeEvent.canGoForward,
224
- loading: nativeEvent.loading,
225
- target: nativeEvent.target,
226
- title: nativeEvent.title,
227
- });
228
-
229
- // Check for specific NSURLErrorDomain codes
230
- let errorMessage = 'Failed to load OAuth page.';
231
- let isRetryable = true;
232
-
233
- if (nativeEvent.domain === 'NSURLErrorDomain') {
234
- switch (nativeEvent.code) {
235
- case -1009: // NSURLErrorNotConnectedToInternet
236
- errorMessage = 'No internet connection. Please check your network and try again.';
237
- isRetryable = true;
238
- break;
239
- case -1003: // NSURLErrorCannotFindHost
240
- errorMessage = 'Cannot reach authentication server. Please check your internet connection.';
241
- isRetryable = true;
242
- break;
243
- case -1001: // NSURLErrorTimedOut
244
- errorMessage = 'Connection timed out. Please try again.';
245
- isRetryable = true;
246
- break;
247
- case -1200: // NSURLErrorSecureConnectionFailed
248
- errorMessage = 'Secure connection failed. Please try again.';
249
- isRetryable = true;
250
- break;
251
- case -1022: // NSURLErrorAppTransportSecurityRequiresSecureConnection
252
- errorMessage = 'App Transport Security error. Connection must be secure.';
253
- isRetryable = false;
254
- break;
255
- case -1004: // NSURLErrorCannotConnectToHost
256
- errorMessage = 'Cannot connect to authentication server. Please try again later.';
257
- isRetryable = true;
258
- break;
259
- case -1005: // NSURLErrorNetworkConnectionLost
260
- errorMessage = 'Network connection lost. Please check your connection and try again.';
261
- isRetryable = true;
262
- break;
263
- case -1020: // NSURLErrorDataNotAllowed
264
- errorMessage = 'Data not allowed. Please check your cellular data settings.';
265
- isRetryable = true;
266
- break;
267
- default:
268
- errorMessage = `Network error (${nativeEvent.code}): ${nativeEvent.description || 'Please check your connection and try again.'}`;
269
- isRetryable = true;
270
- }
271
- } else if (nativeEvent.domain === 'WebKitErrorDomain') {
272
- switch (nativeEvent.code) {
273
- case 102: // WebKitErrorFrameLoadInterruptedByPolicyChange
274
- errorMessage = 'Page load was interrupted. Please try again.';
275
- isRetryable = true;
276
- break;
277
- case 204: // WebKitErrorPlugInLoadFailed
278
- errorMessage = 'Plugin failed to load. Please try again.';
279
- isRetryable = true;
280
- break;
281
- default:
282
- errorMessage = `WebKit error (${nativeEvent.code}): ${nativeEvent.description || 'Please try again.'}`;
283
- isRetryable = true;
284
- }
285
- }
286
-
287
- console.error('🔴 OAuth WebView Error:', errorMessage);
288
-
289
- // Implement smart retry logic
290
- if (isRetryable && retryCount < 3) {
291
- console.log(`🔄 Auto-retrying OAuth load (attempt ${retryCount + 1}/3) in 3 seconds...`);
292
- setRetryCount(prev => prev + 1);
293
- setIsLoading(true);
294
- setError(null);
295
-
296
- // Retry after a delay with exponential backoff
297
- const retryDelay = 3000 * Math.pow(2, retryCount); // 3s, 6s, 12s
298
- setTimeout(() => {
299
- if (webViewRef.current) {
300
- console.log(`🔄 Attempting retry ${retryCount + 1}...`);
301
- webViewRef.current.reload();
302
- }
303
- }, retryDelay);
304
- } else {
305
- setError(errorMessage);
306
- setIsLoading(false);
307
-
308
- // Show additional help for persistent errors
309
- if (retryCount >= 3) {
310
- console.log('❌ Maximum retries reached, showing error to user');
311
- }
312
- }
313
- };
314
-
315
- const handleOpenInBrowser = () => {
316
- console.log('Opening OAuth URL in external browser:', url);
317
- Linking.openURL(url).catch(err => {
318
- console.error('Failed to open URL in browser:', err);
319
- setError('Unable to open browser. Please check your device settings.');
320
- });
321
- };
322
-
323
- const handleRetry = () => {
324
- console.log('Manual retry requested');
325
- setError(null);
326
- setErrorMessage('');
327
- setIsRetryable(true);
328
- setIsLoading(true);
329
- setRetryCount(0);
330
-
331
- if (webViewRef.current) {
332
- webViewRef.current.reload();
333
- }
334
- };
335
-
336
- /**
337
- * Get platform-specific icon
338
- */
339
- const getPlatformIcon = (platform: string): string => {
340
- switch (platform) {
341
- case 'instagram':
342
- return 'photo-camera';
343
- case 'youtube':
344
- return 'smart-display';
345
- case 'pinterest':
346
- return 'push-pin';
347
- case 'reddit':
348
- return 'forum';
349
- case 'email':
350
- return 'email';
351
- default:
352
- return 'link';
353
- }
354
- };
355
-
356
- /**
357
- * Get platform-specific color
358
- */
359
- const getPlatformColor = (platform: string): string => {
360
- switch (platform) {
361
- case 'instagram':
362
- return '#E1306C';
363
- case 'youtube':
364
- return '#FF0000';
365
- case 'pinterest':
366
- return '#E60023';
367
- case 'reddit':
368
- return '#FF4500';
369
- case 'email':
370
- return '#4285F4';
371
- default:
372
- return COLORS.primary;
373
- }
374
- };
375
-
376
- // Check if URL indicates OAuth completion
377
- const isOAuthComplete = (url: string): boolean => {
378
- // Gmail OAuth completion patterns
379
- const gmailSuccessPatterns = [
380
- 'https://onairos.uk/Home',
381
- 'https://onairos.uk/home',
382
- 'onairos.uk/Home',
383
- 'onairos.uk/home',
384
- process.env.APP_HOME_URL,
385
- ].filter(Boolean);
386
-
387
- // Check for success redirect patterns
388
- for (const pattern of gmailSuccessPatterns) {
389
- if (url.includes(pattern)) {
390
- console.log('✅ OAuth success detected via redirect to:', pattern);
391
- return true;
392
- }
393
- }
394
-
395
- // Check for traditional OAuth callback patterns (more specific)
396
- // Only match actual query parameters, not just any occurrence in the URL
397
- const callbackPatterns = [
398
- 'code=',
399
- 'access_token=',
400
- 'oauth_token=',
401
- 'authorization_code=',
402
- 'auth_code=',
403
- 'token=',
404
- ];
405
-
406
- for (const pattern of callbackPatterns) {
407
- if (url.includes(pattern)) {
408
- console.log('✅ OAuth success detected via callback parameter:', pattern);
409
- return true;
410
- }
411
- }
412
-
413
- // Check for specific callback URLs (more targeted than generic words)
414
- const callbackUrlPatterns = [
415
- '/callback',
416
- '/oauth/callback',
417
- '/auth/callback',
418
- 'redirect_uri',
419
- 'onairos.uk/callback',
420
- 'onairos.uk/oauth',
421
- ];
422
-
423
- for (const pattern of callbackUrlPatterns) {
424
- if (url.includes(pattern)) {
425
- console.log('✅ OAuth success detected via callback URL pattern:', pattern);
426
- return true;
427
- }
428
- }
429
-
430
- // Check for error patterns
431
- const errorPatterns = [
432
- 'error=',
433
- 'error_description=',
434
- 'oauth_error=',
435
- 'auth_error=',
436
- 'access_denied',
437
- 'user_cancelled',
438
- 'cancelled',
439
- 'denied',
440
- ];
441
-
442
- for (const pattern of errorPatterns) {
443
- if (url.includes(pattern)) {
444
- console.log('❌ OAuth error detected via pattern:', pattern);
445
- return false;
446
- }
447
- }
448
-
449
- return false;
450
- };
451
-
452
- // Extract OAuth result from URL
453
- const extractOAuthResult = (url: string): { success: boolean; code?: string; error?: string } => {
454
- try {
455
- const urlObj = new URL(url);
456
- const params = new URLSearchParams(urlObj.search);
457
-
458
- // Check for error first
459
- const error = params.get('error') || params.get('error_description') || params.get('oauth_error');
460
- if (error) {
461
- return { success: false, error };
462
- }
463
-
464
- // Check for success indicators
465
- const code = params.get('code') || params.get('authorization_code') || params.get('auth_code');
466
- const accessToken = params.get('access_token') || params.get('oauth_token') || params.get('token');
467
-
468
- if (code || accessToken) {
469
- return { success: true, code: code || accessToken };
470
- }
471
-
472
- // Check for success redirect to home page (Gmail pattern)
473
- const gmailSuccessPatterns = [
474
- 'https://onairos.uk/Home',
475
- 'https://onairos.uk/home',
476
- 'onairos.uk/Home',
477
- 'onairos.uk/home',
478
- ];
479
-
480
- for (const pattern of gmailSuccessPatterns) {
481
- if (url.includes(pattern)) {
482
- console.log('✅ Gmail OAuth success detected via home page redirect');
483
- return { success: true, code: 'gmail_home_redirect' };
484
- }
485
- }
486
-
487
- // If we reached here and isOAuthComplete returned true, assume success
488
- if (isOAuthComplete(url)) {
489
- return { success: true, code: 'oauth_complete' };
490
- }
491
-
492
- return { success: false, error: 'OAuth completion not detected' };
493
- } catch (error) {
494
- console.error('Error parsing OAuth URL:', error);
495
- return { success: false, error: 'Invalid OAuth callback URL' };
496
- }
497
- };
498
-
499
- if (error) {
500
- return (
501
- <SafeAreaView style={styles.container}>
502
- <View style={styles.header}>
503
- <TouchableOpacity onPress={onClose} style={styles.closeButton}>
504
- <Icon name="close" size={24} color="#000" />
505
- </TouchableOpacity>
506
- <View style={styles.titleContainer}>
507
- <Icon
508
- name={getPlatformIcon(platform)}
509
- size={20}
510
- color={getPlatformColor(platform)}
511
- />
512
- <Text style={styles.titleText}>{platform.charAt(0).toUpperCase() + platform.slice(1)} OAuth</Text>
513
- </View>
514
- </View>
515
-
516
- <View style={styles.errorContainer}>
517
- <Icon name="error-outline" size={48} color="#FF6B6B" />
518
- <Text style={styles.errorTitle}>Connection Error</Text>
519
- <Text style={styles.errorMessage}>{errorMessage || error}</Text>
520
-
521
- {/* Help text based on error type */}
522
- {error.includes('internet') || error.includes('network') ? (
523
- <View style={styles.helpContainer}>
524
- <Text style={styles.helpTitle}>💡 Troubleshooting Steps:</Text>
525
- <Text style={styles.helpText}>• Check your Wi-Fi or cellular connection</Text>
526
- <Text style={styles.helpText}>• Try switching between Wi-Fi and cellular</Text>
527
- <Text style={styles.helpText}>• Ensure you're not using a VPN that blocks OAuth</Text>
528
- <Text style={styles.helpText}>• Close other apps that might be using bandwidth</Text>
529
- </View>
530
- ) : error.includes('timeout') ? (
531
- <View style={styles.helpContainer}>
532
- <Text style={styles.helpTitle}>⏱️ Connection Timeout:</Text>
533
- <Text style={styles.helpText}>• Your connection might be slow</Text>
534
- <Text style={styles.helpText}>• Try again when you have a stronger signal</Text>
535
- <Text style={styles.helpText}>• Use "Open in Browser" for better reliability</Text>
536
- </View>
537
- ) : error.includes('secure') || error.includes('SSL') ? (
538
- <View style={styles.helpContainer}>
539
- <Text style={styles.helpTitle}>🔒 Security Error:</Text>
540
- <Text style={styles.helpText}>• Check your device's date and time settings</Text>
541
- <Text style={styles.helpText}>• Update your device's operating system</Text>
542
- <Text style={styles.helpText}>• Try "Open in Browser" as an alternative</Text>
543
- </View>
544
- ) : (
545
- <View style={styles.helpContainer}>
546
- <Text style={styles.helpTitle}>🔧 General Solutions:</Text>
547
- <Text style={styles.helpText}>• Close and reopen the app</Text>
548
- <Text style={styles.helpText}>• Check your internet connection</Text>
549
- <Text style={styles.helpText}>• Use "Open in Browser" for better reliability</Text>
550
- </View>
551
- )}
552
-
553
- <View style={styles.buttonContainer}>
554
- {isRetryable && (
555
- <TouchableOpacity style={styles.retryButton} onPress={handleRetry}>
556
- <Icon name="refresh" size={20} color="#fff" style={styles.buttonIcon} />
557
- <Text style={styles.retryButtonText}>Retry</Text>
558
- </TouchableOpacity>
559
- )}
560
- <TouchableOpacity style={styles.browserButton} onPress={handleOpenInBrowser}>
561
- <Icon name="open-in-browser" size={20} color="#666" style={styles.buttonIcon} />
562
- <Text style={styles.browserButtonText}>Open in Browser</Text>
563
- </TouchableOpacity>
564
- </View>
565
-
566
- {retryCount >= 3 && (
567
- <View style={styles.persistentErrorContainer}>
568
- <Text style={styles.persistentErrorText}>
569
- Still having trouble? Try these steps:
570
- </Text>
571
- <Text style={styles.persistentErrorStep}>
572
- 1. Use "Open in Browser" for more reliable authentication
573
- </Text>
574
- <Text style={styles.persistentErrorStep}>
575
- 2. Check if other apps can access the internet
576
- </Text>
577
- <Text style={styles.persistentErrorStep}>
578
- 3. Restart your device if the problem persists
579
- </Text>
580
- </View>
581
- )}
582
- </View>
583
- </SafeAreaView>
584
- );
585
- }
586
-
587
- return (
588
- <SafeAreaView style={styles.container}>
589
- <View style={styles.header}>
590
- <TouchableOpacity onPress={onClose} style={styles.closeButton}>
591
- <Icon name="close" size={24} color="#000" />
592
- </TouchableOpacity>
593
- <View style={styles.titleContainer}>
594
- <Icon
595
- name={getPlatformIcon(platform)}
596
- size={20}
597
- color={getPlatformColor(platform)}
598
- />
599
- <Text style={styles.titleText}>{platform.charAt(0).toUpperCase() + platform.slice(1)} OAuth</Text>
600
- </View>
601
- <TouchableOpacity onPress={handleOpenInBrowser} style={styles.browserButton}>
602
- <Icon name="open-in-browser" size={20} color="#666" />
603
- </TouchableOpacity>
604
- </View>
605
-
606
- <WebView
607
- ref={webViewRef}
608
- source={{ uri: url }}
609
- onNavigationStateChange={onNavigationStateChange}
610
- onLoadEnd={handleLoadEnd}
611
- onError={handleError}
612
- onHttpError={(syntheticEvent) => {
613
- const { nativeEvent } = syntheticEvent;
614
- console.error('WebView HTTP error:', nativeEvent);
615
- setError('Failed to load OAuth page. Please check your internet connection.');
616
- setIsLoading(false);
617
- }}
618
- style={styles.webView}
619
- javaScriptEnabled={true}
620
- domStorageEnabled={true}
621
- startInLoadingState={true}
622
- scalesPageToFit={true}
623
- allowsInlineMediaPlayback={true}
624
- mediaPlaybackRequiresUserAction={false}
625
- mixedContentMode="compatibility"
626
- thirdPartyCookiesEnabled={true}
627
- sharedCookiesEnabled={true}
628
- cacheEnabled={true}
629
- allowsBackForwardNavigationGestures={true}
630
- allowsLinkPreview={false}
631
- userAgent="Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1"
632
- onShouldStartLoadWithRequest={(request) => {
633
- console.log('WebView attempting to load:', request.url);
634
-
635
- // Block about:srcdoc and other problematic URLs
636
- if (request.url.startsWith('about:') ||
637
- request.url.startsWith('data:') ||
638
- request.url === 'about:blank') {
639
- console.log('Blocking problematic URL:', request.url);
640
- return false;
641
- }
642
-
643
- // Allow all other requests
644
- return true;
645
- }}
646
- onLoadStart={(syntheticEvent) => {
647
- const { nativeEvent } = syntheticEvent;
648
- console.log('WebView load started:', nativeEvent.url);
649
- setIsLoading(true);
650
- }}
651
- onLoadProgress={(syntheticEvent) => {
652
- const { nativeEvent } = syntheticEvent;
653
- console.log('WebView load progress:', nativeEvent.progress);
654
- }}
655
- renderError={(errorName) => (
656
- <View style={styles.errorContainer}>
657
- <Icon name="error-outline" size={48} color="#FF6B6B" />
658
- <Text style={styles.errorTitle}>WebView Error</Text>
659
- <Text style={styles.errorMessage}>
660
- Failed to load the authentication page. Error: {errorName}
661
- </Text>
662
- <TouchableOpacity style={styles.retryButton} onPress={handleRetry}>
663
- <Text style={styles.retryButtonText}>Retry</Text>
664
- </TouchableOpacity>
665
- </View>
666
- )}
667
- renderLoading={() => (
668
- <View style={styles.loadingContainer}>
669
- <ActivityIndicator size="large" color={COLORS.primary} />
670
- <Text style={styles.loadingText}>Loading {platform}...</Text>
671
- </View>
672
- )}
673
- injectedJavaScript={`
674
- // Prevent white screen issues
675
- window.addEventListener('error', function(e) {
676
- console.log('JavaScript error:', e.message);
677
- });
678
-
679
- // Handle OAuth redirects
680
- window.addEventListener('beforeunload', function(e) {
681
- console.log('Page unloading:', window.location.href);
682
- });
683
-
684
- // Monitor for OAuth completion
685
- setInterval(function() {
686
- if (window.location.href.includes('code=') ||
687
- window.location.href.includes('access_token=') ||
688
- window.location.href.includes('oauth_token=') ||
689
- window.location.href.includes('api2.onairos.uk')) {
690
- console.log('OAuth completion detected:', window.location.href);
691
- }
692
- }, 1000);
693
-
694
- true; // Required for injected JavaScript
695
- `}
696
- />
697
- </SafeAreaView>
698
- );
699
- };
700
-
701
- const styles = StyleSheet.create({
702
- container: {
703
- flex: 1,
704
- backgroundColor: '#fff',
705
- },
706
- header: {
707
- flexDirection: 'row',
708
- alignItems: 'center',
709
- height: 56,
710
- backgroundColor: '#f8f8f8',
711
- borderBottomWidth: 1,
712
- borderBottomColor: '#e0e0e0',
713
- paddingHorizontal: 16,
714
- },
715
- titleContainer: {
716
- flex: 1,
717
- flexDirection: 'row',
718
- alignItems: 'center',
719
- justifyContent: 'center',
720
- },
721
- titleText: {
722
- marginLeft: 8,
723
- fontSize: 16,
724
- fontWeight: '500',
725
- color: '#000',
726
- },
727
- closeButton: {
728
- padding: 8,
729
- position: 'absolute',
730
- left: 16,
731
- zIndex: 10,
732
- },
733
- browserButton: {
734
- backgroundColor: 'transparent',
735
- borderWidth: 1,
736
- borderColor: '#666',
737
- paddingHorizontal: 24,
738
- paddingVertical: 12,
739
- borderRadius: 8,
740
- flexDirection: 'row',
741
- alignItems: 'center',
742
- justifyContent: 'center',
743
- },
744
- webView: {
745
- flex: 1,
746
- },
747
- loadingContainer: {
748
- ...StyleSheet.absoluteFillObject,
749
- backgroundColor: 'rgba(255, 255, 255, 0.8)',
750
- alignItems: 'center',
751
- justifyContent: 'center',
752
- },
753
- loadingText: {
754
- marginTop: 10,
755
- fontSize: 16,
756
- color: '#666',
757
- },
758
- errorContainer: {
759
- flex: 1,
760
- alignItems: 'center',
761
- justifyContent: 'center',
762
- padding: 20,
763
- },
764
- errorTitle: {
765
- fontSize: 18,
766
- fontWeight: '600',
767
- color: '#333',
768
- marginTop: 16,
769
- marginBottom: 8,
770
- },
771
- errorMessage: {
772
- fontSize: 14,
773
- color: '#666',
774
- textAlign: 'center',
775
- marginBottom: 20,
776
- },
777
- retryButton: {
778
- backgroundColor: COLORS.primary,
779
- paddingHorizontal: 24,
780
- paddingVertical: 12,
781
- borderRadius: 8,
782
- marginRight: 10,
783
- flexDirection: 'row',
784
- alignItems: 'center',
785
- justifyContent: 'center',
786
- },
787
- retryButtonText: {
788
- color: '#fff',
789
- fontSize: 16,
790
- fontWeight: '600',
791
- },
792
- buttonContainer: {
793
- flexDirection: 'row',
794
- justifyContent: 'center',
795
- alignItems: 'center',
796
- marginTop: 10,
797
- },
798
- browserButtonText: {
799
- color: '#666',
800
- fontSize: 16,
801
- fontWeight: '600',
802
- },
803
- helpContainer: {
804
- marginBottom: 20,
805
- },
806
- helpTitle: {
807
- fontSize: 18,
808
- fontWeight: '600',
809
- color: '#333',
810
- marginBottom: 8,
811
- },
812
- helpText: {
813
- fontSize: 14,
814
- color: '#666',
815
- textAlign: 'center',
816
- },
817
- buttonIcon: {
818
- marginRight: 10,
819
- },
820
- persistentErrorContainer: {
821
- marginTop: 20,
822
- padding: 20,
823
- backgroundColor: '#f8f8f8',
824
- borderRadius: 8,
825
- },
826
- persistentErrorText: {
827
- fontSize: 16,
828
- fontWeight: '600',
829
- color: '#333',
830
- marginBottom: 10,
831
- },
832
- persistentErrorStep: {
833
- fontSize: 14,
834
- color: '#666',
835
- textAlign: 'center',
836
- marginBottom: 5,
837
- },
838
- });