@onairos/react-native 3.7.2 → 3.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/lib/commonjs/api/index.js +219 -9
  2. package/lib/commonjs/components/BodyText.js +27 -9
  3. package/lib/commonjs/components/BrandMark.js +111 -10
  4. package/lib/commonjs/components/CodeInput.js +116 -9
  5. package/lib/commonjs/components/EmailInput.js +30 -8
  6. package/lib/commonjs/components/GoogleButton.js +56 -9
  7. package/lib/commonjs/components/HeadingGroup.js +43 -9
  8. package/lib/commonjs/components/LLMDataInputModal.js +664 -14
  9. package/lib/commonjs/components/ModalHeader.js +99 -9
  10. package/lib/commonjs/components/ModalSheet.js +47 -9
  11. package/lib/commonjs/components/Onairos.js +380 -14
  12. package/lib/commonjs/components/OnairosButton.js +313 -13
  13. package/lib/commonjs/components/OnairosSignInButton.js +130 -12
  14. package/lib/commonjs/components/Overlay.js +465 -13
  15. package/lib/commonjs/components/PersonaImage.js +137 -10
  16. package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
  17. package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
  18. package/lib/commonjs/components/PinCreationScreen.js +403 -12
  19. package/lib/commonjs/components/PinInput.js +464 -9
  20. package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
  21. package/lib/commonjs/components/PlatformList.js +137 -10
  22. package/lib/commonjs/components/PlatformToggle.js +180 -9
  23. package/lib/commonjs/components/PrimaryButton.js +180 -10
  24. package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
  25. package/lib/commonjs/components/SignInStep.js +345 -12
  26. package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
  27. package/lib/commonjs/components/VerificationStep.js +176 -11
  28. package/lib/commonjs/components/WelcomeScreen.js +461 -22
  29. package/lib/commonjs/components/icons/Basicproficon.js +37 -8
  30. package/lib/commonjs/components/icons/Basicprofile.js +21 -8
  31. package/lib/commonjs/components/icons/Checkbox.js +21 -8
  32. package/lib/commonjs/components/icons/Checkmark.js +27 -8
  33. package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
  34. package/lib/commonjs/components/icons/Contenticon.js +39 -8
  35. package/lib/commonjs/components/icons/EnochE.js +41 -8
  36. package/lib/commonjs/components/icons/Personalityicon.js +30 -8
  37. package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
  38. package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
  39. package/lib/commonjs/components/icons/Userpreferences.js +21 -8
  40. package/lib/commonjs/components/icons/index.js +84 -17
  41. package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
  42. package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
  43. package/lib/commonjs/components/onboarding/PinInput.js +283 -10
  44. package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
  45. package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
  46. package/lib/commonjs/config/api.js +56 -7
  47. package/lib/commonjs/constants/index.js +120 -7
  48. package/lib/commonjs/context/AuthContext.js +345 -10
  49. package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
  50. package/lib/commonjs/hooks/useConnections.js +102 -8
  51. package/lib/commonjs/hooks/useCredentials.js +178 -10
  52. package/lib/commonjs/hooks/useUserConnections.js +148 -10
  53. package/lib/commonjs/index.js +439 -34
  54. package/lib/commonjs/services/apiClient.js +298 -8
  55. package/lib/commonjs/services/biometricPinService.js +180 -8
  56. package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
  57. package/lib/commonjs/services/chatGPTConversationService.js +275 -9
  58. package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
  59. package/lib/commonjs/services/claudeConversationService.js +158 -9
  60. package/lib/commonjs/services/connectedAccountsService.js +310 -10
  61. package/lib/commonjs/services/googleAuthService.js +252 -11
  62. package/lib/commonjs/services/hingeDataExtractor.js +105 -8
  63. package/lib/commonjs/services/hingeDataService.js +150 -9
  64. package/lib/commonjs/services/imageCompressionService.js +260 -7
  65. package/lib/commonjs/services/instagramDataExtractor.js +126 -8
  66. package/lib/commonjs/services/instagramDataService.js +163 -9
  67. package/lib/commonjs/services/jwtStorageService.js +276 -7
  68. package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
  69. package/lib/commonjs/services/linkedinProfileService.js +222 -9
  70. package/lib/commonjs/services/linkedinScrapingService.js +230 -8
  71. package/lib/commonjs/services/llmDataStorage.js +294 -8
  72. package/lib/commonjs/services/mobileTrainingService.js +186 -8
  73. package/lib/commonjs/services/netflixDataExtractor.js +120 -8
  74. package/lib/commonjs/services/netflixDataService.js +198 -9
  75. package/lib/commonjs/services/pinEncryptionService.js +84 -8
  76. package/lib/commonjs/services/pinStorageUtils.js +105 -7
  77. package/lib/commonjs/services/platformAuthService.js +1484 -12
  78. package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
  79. package/lib/commonjs/services/sephoraDataService.js +200 -9
  80. package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
  81. package/lib/commonjs/services/spotifyDataService.js +241 -9
  82. package/lib/commonjs/services/storageService.js +404 -8
  83. package/lib/commonjs/services/telegramDataExtractor.js +115 -8
  84. package/lib/commonjs/services/telegramDataService.js +499 -9
  85. package/lib/commonjs/services/trainingApiHelpers.js +73 -7
  86. package/lib/commonjs/services/userConnectionsService.js +340 -10
  87. package/lib/commonjs/services/youtubeMigrationService.js +416 -10
  88. package/lib/commonjs/theme/index.js +250 -7
  89. package/lib/commonjs/types/ambient.d.js +2 -1
  90. package/lib/commonjs/types/declarations.d.js +2 -1
  91. package/lib/commonjs/types/index.js +6 -1
  92. package/lib/commonjs/types/node-fix.d.js +2 -1
  93. package/lib/commonjs/types/node-override.d.js +2 -1
  94. package/lib/commonjs/types/opacity.d.js +2 -1
  95. package/lib/commonjs/types.js +14 -1
  96. package/lib/commonjs/utils/Portal.js +98 -8
  97. package/lib/commonjs/utils/api.js +130 -9
  98. package/lib/commonjs/utils/assetRegistry.js +210 -35
  99. package/lib/commonjs/utils/auth.js +112 -9
  100. package/lib/commonjs/utils/connectorTests.js +613 -29
  101. package/lib/commonjs/utils/crypto.js +62 -8
  102. package/lib/commonjs/utils/debugHelper.js +64 -1
  103. package/lib/commonjs/utils/encryption.js +76 -7
  104. package/lib/commonjs/utils/eventUtils.js +288 -1
  105. package/lib/commonjs/utils/haptics.js +66 -9
  106. package/lib/commonjs/utils/imagePreloader.js +6 -1
  107. package/lib/commonjs/utils/networkDiagnostics.js +226 -8
  108. package/lib/commonjs/utils/onairosApi.js +350 -9
  109. package/lib/commonjs/utils/programmaticFlow.js +117 -9
  110. package/lib/commonjs/utils/retryHelper.js +220 -1
  111. package/lib/commonjs/utils/secureStorage.js +349 -10
  112. package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
  113. package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
  114. package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
  115. package/lib/commonjs/utils/webviewScripts/index.js +698 -15
  116. package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
  117. package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
  118. package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
  119. package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
  120. package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
  121. package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
  122. package/lib/module/api/index.js +211 -1
  123. package/lib/module/components/BodyText.js +20 -1
  124. package/lib/module/components/BrandMark.js +104 -1
  125. package/lib/module/components/CodeInput.js +109 -1
  126. package/lib/module/components/EmailInput.js +23 -1
  127. package/lib/module/components/GoogleButton.js +49 -1
  128. package/lib/module/components/HeadingGroup.js +36 -1
  129. package/lib/module/components/LLMDataInputModal.js +656 -7
  130. package/lib/module/components/ModalHeader.js +92 -1
  131. package/lib/module/components/ModalSheet.js +39 -1
  132. package/lib/module/components/Onairos.js +373 -1
  133. package/lib/module/components/OnairosButton.js +305 -1
  134. package/lib/module/components/OnairosSignInButton.js +121 -1
  135. package/lib/module/components/Overlay.js +456 -1
  136. package/lib/module/components/PersonaImage.js +129 -1
  137. package/lib/module/components/PersonaLoadingScreen.js +310 -1
  138. package/lib/module/components/PersonalizationConsentScreen.js +460 -1
  139. package/lib/module/components/PinCreationScreen.js +396 -1
  140. package/lib/module/components/PinInput.js +456 -1
  141. package/lib/module/components/PlatformConnectorsStep.js +1302 -6
  142. package/lib/module/components/PlatformList.js +129 -1
  143. package/lib/module/components/PlatformToggle.js +173 -1
  144. package/lib/module/components/PrimaryButton.js +172 -1
  145. package/lib/module/components/SignInMatchAnimation.js +189 -1
  146. package/lib/module/components/SignInStep.js +338 -1
  147. package/lib/module/components/UniversalOnboarding.js +2770 -1
  148. package/lib/module/components/VerificationStep.js +168 -1
  149. package/lib/module/components/WelcomeScreen.js +453 -1
  150. package/lib/module/components/icons/Basicproficon.js +30 -1
  151. package/lib/module/components/icons/Basicprofile.js +14 -1
  152. package/lib/module/components/icons/Checkbox.js +14 -1
  153. package/lib/module/components/icons/Checkmark.js +20 -1
  154. package/lib/module/components/icons/Contentanalysis.js +14 -1
  155. package/lib/module/components/icons/Contenticon.js +32 -1
  156. package/lib/module/components/icons/EnochE.js +34 -1
  157. package/lib/module/components/icons/Personalityicon.js +23 -1
  158. package/lib/module/components/icons/Personalityprofile.js +14 -1
  159. package/lib/module/components/icons/Personalitytraits.js +14 -1
  160. package/lib/module/components/icons/Userpreferences.js +14 -1
  161. package/lib/module/components/icons/index.js +13 -1
  162. package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
  163. package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
  164. package/lib/module/components/onboarding/PinInput.js +274 -1
  165. package/lib/module/components/onboarding/PlatformConnector.js +240 -1
  166. package/lib/module/config/PLATFORM_APIS.md +849 -0
  167. package/lib/module/config/api.js +47 -1
  168. package/lib/module/constants/index.js +114 -1
  169. package/lib/module/context/AuthContext.js +335 -1
  170. package/lib/module/hooks/useConnectedAccounts.js +106 -1
  171. package/lib/module/hooks/useConnections.js +95 -1
  172. package/lib/module/hooks/useCredentials.js +171 -6
  173. package/lib/module/hooks/useUserConnections.js +140 -1
  174. package/lib/module/index.js +172 -1
  175. package/lib/module/services/apiClient.js +295 -1
  176. package/lib/module/services/biometricPinService.js +169 -1
  177. package/lib/module/services/chatGPTConversationExtractor.js +149 -1
  178. package/lib/module/services/chatGPTConversationService.js +268 -1
  179. package/lib/module/services/claudeConversationExtractor.js +97 -1
  180. package/lib/module/services/claudeConversationService.js +151 -1
  181. package/lib/module/services/connectedAccountsService.js +293 -1
  182. package/lib/module/services/googleAuthService.js +241 -1
  183. package/lib/module/services/hingeDataExtractor.js +99 -1
  184. package/lib/module/services/hingeDataService.js +143 -1
  185. package/lib/module/services/imageCompressionService.js +250 -1
  186. package/lib/module/services/instagramDataExtractor.js +120 -1
  187. package/lib/module/services/instagramDataService.js +156 -1
  188. package/lib/module/services/jwtStorageService.js +257 -1
  189. package/lib/module/services/linkedinDOMExtractor.js +234 -1
  190. package/lib/module/services/linkedinProfileService.js +210 -1
  191. package/lib/module/services/linkedinScrapingService.js +219 -1
  192. package/lib/module/services/llmDataStorage.js +277 -1
  193. package/lib/module/services/mobileTrainingService.js +173 -1
  194. package/lib/module/services/netflixDataExtractor.js +114 -1
  195. package/lib/module/services/netflixDataService.js +191 -1
  196. package/lib/module/services/pinEncryptionService.js +74 -6
  197. package/lib/module/services/pinStorageUtils.js +93 -1
  198. package/lib/module/services/platformAuthService.js +1461 -1
  199. package/lib/module/services/sephoraDataExtractor.js +134 -1
  200. package/lib/module/services/sephoraDataService.js +193 -1
  201. package/lib/module/services/spotifyDataExtractor.js +142 -1
  202. package/lib/module/services/spotifyDataService.js +234 -1
  203. package/lib/module/services/storageService.js +383 -1
  204. package/lib/module/services/telegramDataExtractor.js +109 -1
  205. package/lib/module/services/telegramDataService.js +493 -1
  206. package/lib/module/services/trainingApiHelpers.js +67 -1
  207. package/lib/module/services/userConnectionsService.js +329 -1
  208. package/lib/module/services/youtubeMigrationService.js +405 -1
  209. package/lib/module/theme/index.js +245 -1
  210. package/lib/module/types.js +10 -1
  211. package/lib/module/utils/Portal.js +90 -1
  212. package/lib/module/utils/api.js +118 -1
  213. package/lib/module/utils/assetRegistry.js +200 -34
  214. package/lib/module/utils/auth.js +100 -1
  215. package/lib/module/utils/connectorTests.js +600 -27
  216. package/lib/module/utils/crypto.js +54 -1
  217. package/lib/module/utils/debugHelper.js +54 -1
  218. package/lib/module/utils/encryption.js +67 -1
  219. package/lib/module/utils/eventUtils.js +270 -1
  220. package/lib/module/utils/haptics.js +59 -8
  221. package/lib/module/utils/imagePreloader.js +3 -1
  222. package/lib/module/utils/networkDiagnostics.js +217 -1
  223. package/lib/module/utils/onairosApi.js +333 -1
  224. package/lib/module/utils/programmaticFlow.js +111 -1
  225. package/lib/module/utils/retryHelper.js +211 -1
  226. package/lib/module/utils/secureStorage.js +330 -6
  227. package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
  228. package/lib/module/utils/webviewScripts/claude.js +370 -1
  229. package/lib/module/utils/webviewScripts/hinge.js +405 -1
  230. package/lib/module/utils/webviewScripts/index.js +434 -1
  231. package/lib/module/utils/webviewScripts/instagram.js +448 -1
  232. package/lib/module/utils/webviewScripts/linkedin.js +874 -1
  233. package/lib/module/utils/webviewScripts/netflix.js +376 -1
  234. package/lib/module/utils/webviewScripts/sephora.js +510 -1
  235. package/lib/module/utils/webviewScripts/spotify.js +413 -1
  236. package/lib/module/utils/webviewScripts/telegram.js +672 -1
  237. package/package.json +2 -2
@@ -1 +1,47 @@
1
- function _0x3ccf(){const _0x2a689b=['/auth','/user','/training','/oauth','Bearer\x20','JDMmq'];_0x3ccf=function(){return _0x2a689b;};return _0x3ccf();}function _0x5efc(_0x3ccfe0,_0x5efccd){_0x3ccfe0=_0x3ccfe0-0x0;const _0x5adec8=_0x3ccf();let _0xdcf21b=_0x5adec8[_0x3ccfe0];return _0xdcf21b;}import{getAuthToken}from'../services/authService';export const API_CONFIG={'BASE_URL':'https://api2.onairos.uk','ENDPOINTS':{'AUTH':_0x5efc(0x0),'USER':_0x5efc(0x1),'CONNECTIONS':'/connections','TRAINING':_0x5efc(0x2),'OAUTH':_0x5efc(0x3)},'TIMEOUT':0x7530};export const getApiHeaders=()=>({'Content-Type':'application/json','Accept':'application/json'});export const getAuthHeaders=_0x5c2cc0=>({...getApiHeaders(),..._0x5c2cc0&&{'Authorization':_0x5efc(0x4)+_0x5c2cc0}});export const getUserAuthHeaders=async()=>{const _0x402421={'JDMmq':'User\x20not\x20authenticated\x20-\x20no\x20JWT\x20token\x20found'},_0x204ee5=await getAuthToken();if(!_0x204ee5)throw new Error(_0x402421[_0x5efc(0x5)]);return{...getApiHeaders(),'Authorization':_0x5efc(0x4)+_0x204ee5};};
1
+ /**
2
+ * API Configuration for Onairos SDK
3
+ *
4
+ * IMPORTANT: This is the single source of truth for the API base URL.
5
+ * All files should import API_CONFIG.BASE_URL instead of hardcoding URLs.
6
+ */
7
+
8
+ import { getAuthToken } from '../services/authService';
9
+ export const API_CONFIG = {
10
+ BASE_URL: 'https://api2.onairos.uk',
11
+ ENDPOINTS: {
12
+ AUTH: '/auth',
13
+ USER: '/user',
14
+ CONNECTIONS: '/connections',
15
+ TRAINING: '/training',
16
+ OAUTH: '/oauth'
17
+ },
18
+ TIMEOUT: 30000
19
+ };
20
+ export const getApiHeaders = () => ({
21
+ 'Content-Type': 'application/json',
22
+ 'Accept': 'application/json'
23
+ });
24
+ export const getAuthHeaders = token => ({
25
+ ...getApiHeaders(),
26
+ ...(token && {
27
+ 'Authorization': `Bearer ${token}`
28
+ })
29
+ });
30
+
31
+ /**
32
+ * Get headers with User JWT for authenticated requests
33
+ * Use this for all post-login API calls (platform connects, etc.)
34
+ *
35
+ * TIER 2 Authentication: User must be logged in
36
+ */
37
+ export const getUserAuthHeaders = async () => {
38
+ const token = await getAuthToken();
39
+ if (!token) {
40
+ throw new Error('User not authenticated - no JWT token found');
41
+ }
42
+ return {
43
+ ...getApiHeaders(),
44
+ 'Authorization': `Bearer ${token}`
45
+ };
46
+ };
47
+ //# sourceMappingURL=api.js.map
@@ -1 +1,114 @@
1
- import{API_CONFIG}from'../config/api';export const COLORS={'primary':_0x31bd(0x0),'headerBg':_0x31bd(0x1),'text':{'primary':'#000000','secondary':_0x31bd(0x2)},'border':_0x31bd(0x3),'success':_0x31bd(0x4),'error':_0x31bd(0x5),'instagram':_0x31bd(0x6),'pinterest':'#E60023','reddit':_0x31bd(0x7),'youtube':_0x31bd(0x8),'chatgpt':_0x31bd(0x9),'llm':_0x31bd(0x9),'netflix':'#E50914','spotify':_0x31bd(0xa),'white':_0x31bd(0xb),'black':'#000000','gray':_0x31bd(0x2),'lightGray':_0x31bd(0x3)};export const PLATFORMS={'instagram':{'name':'Instagram','icon':'instagram','color':COLORS[_0x31bd(0xc)],'description':_0x31bd(0xd)},'pinterest':{'name':_0x31bd(0xe),'icon':_0x31bd(0xf),'color':COLORS[_0x31bd(0xf)],'description':_0x31bd(0x10)},'reddit':{'name':_0x31bd(0x11),'icon':'reddit','color':COLORS['reddit'],'description':_0x31bd(0x12)},'youtube':{'name':'YouTube','icon':'youtube','color':COLORS[_0x31bd(0x13)],'description':_0x31bd(0x14)},'chatgpt':{'name':_0x31bd(0x15),'icon':_0x31bd(0x16),'color':COLORS['chatgpt'],'description':_0x31bd(0x17)},'llm':{'name':_0x31bd(0x18),'icon':'psychology','color':COLORS[_0x31bd(0x19)],'description':_0x31bd(0x1a)},'netflix':{'name':'Netflix','icon':_0x31bd(0x1b),'color':COLORS[_0x31bd(0x1b)],'description':'Connect\x20your\x20Netflix\x20viewing\x20history\x20for\x20personalized\x20insights'},'spotify':{'name':_0x31bd(0x1c),'icon':_0x31bd(0x1d),'color':COLORS['spotify'],'description':_0x31bd(0x1e)}};export const API_ENDPOINTS={'base':API_CONFIG[_0x31bd(0x1f)],'oauth':{'instagram':'/instagram/auth','pinterest':_0x31bd(0x20),'reddit':_0x31bd(0x21),'youtube':_0x31bd(0x22),'chatgpt':_0x31bd(0x23),'llm':'/chatgpt/auth'},'callback':{'instagram':_0x31bd(0x24),'pinterest':_0x31bd(0x25),'reddit':_0x31bd(0x26),'youtube':_0x31bd(0x27),'chatgpt':_0x31bd(0x28),'llm':'/chatgpt/callback'},'llm':{'dataIngest':_0x31bd(0x29),'dataRequest':_0x31bd(0x2a)}};export const STORAGE_KEYS={'credentials':'onairos_credentials','connections':_0x31bd(0x2b)};function _0x5640(){const _0x434a36=['#1BA9D4','#F8F9FA','#666666','#E5E5E5','#34C759','#FF3B30','#E1306C','#FF4500','#FF0000','#10A37F','#1DB954','#FFFFFF','instagram','Connect\x20your\x20Instagram\x20account\x20to\x20train\x20your\x20AI\x20model','Pinterest','pinterest','Use\x20your\x20Pinterest\x20boards\x20for\x20AI\x20training','Reddit','Connect\x20Reddit\x20to\x20enhance\x20your\x20AI\x20model','youtube','Use\x20YouTube\x20data\x20to\x20improve\x20AI\x20recommendations','ChatGPT','chat','Connect\x20your\x20ChatGPT\x20conversations\x20for\x20AI\x20insights','LLM\x20Data','llm','Connect\x20your\x20AI\x20conversation\x20data','netflix','Spotify','spotify','Connect\x20your\x20Spotify\x20listening\x20data\x20for\x20music\x20preferences','BASE_URL','/pinterest/auth','/reddit/auth','/youtube/auth','/chatgpt/auth','/instagram/callback','/pinterest/callback','/reddit/callback','/youtube/callback','/chatgpt/callback','/llmdata','/llmdata/request','onairos_connections','onairosanime','onairosanime://auth/'];_0x5640=function(){return _0x434a36;};return _0x5640();}function _0x31bd(_0x5640a9,_0x31bd8d){_0x5640a9=_0x5640a9-0x0;const _0x1a6bbe=_0x5640();let _0x2ac34f=_0x1a6bbe[_0x5640a9];return _0x2ac34f;}export const PIN_REQUIREMENTS={'minLength':0x8,'requireUppercase':!![],'requireLowercase':!![],'requireNumber':!![],'requireSpecialChar':!![]};export const DEEP_LINK_CONFIG={'scheme':_0x31bd(0x2c),'host':'authenticate','redirectUri':_0x31bd(0x2d)};
1
+ import { API_CONFIG } from '../config/api';
2
+ export const COLORS = {
3
+ primary: '#1BA9D4',
4
+ headerBg: '#F8F9FA',
5
+ text: {
6
+ primary: '#000000',
7
+ secondary: '#666666'
8
+ },
9
+ border: '#E5E5E5',
10
+ success: '#34C759',
11
+ error: '#FF3B30',
12
+ instagram: '#E1306C',
13
+ pinterest: '#E60023',
14
+ reddit: '#FF4500',
15
+ youtube: '#FF0000',
16
+ chatgpt: '#10A37F',
17
+ llm: '#10A37F',
18
+ netflix: '#E50914',
19
+ spotify: '#1DB954',
20
+ white: '#FFFFFF',
21
+ black: '#000000',
22
+ gray: '#666666',
23
+ lightGray: '#E5E5E5'
24
+ };
25
+ export const PLATFORMS = {
26
+ instagram: {
27
+ name: 'Instagram',
28
+ icon: 'instagram',
29
+ color: COLORS.instagram,
30
+ description: 'Connect your Instagram account to train your AI model'
31
+ },
32
+ pinterest: {
33
+ name: 'Pinterest',
34
+ icon: 'pinterest',
35
+ color: COLORS.pinterest,
36
+ description: 'Use your Pinterest boards for AI training'
37
+ },
38
+ reddit: {
39
+ name: 'Reddit',
40
+ icon: 'reddit',
41
+ color: COLORS.reddit,
42
+ description: 'Connect Reddit to enhance your AI model'
43
+ },
44
+ youtube: {
45
+ name: 'YouTube',
46
+ icon: 'youtube',
47
+ color: COLORS.youtube,
48
+ description: 'Use YouTube data to improve AI recommendations'
49
+ },
50
+ chatgpt: {
51
+ name: 'ChatGPT',
52
+ icon: 'chat',
53
+ color: COLORS.chatgpt,
54
+ description: 'Connect your ChatGPT conversations for AI insights'
55
+ },
56
+ llm: {
57
+ name: 'LLM Data',
58
+ icon: 'psychology',
59
+ color: COLORS.llm,
60
+ description: 'Connect your AI conversation data'
61
+ },
62
+ netflix: {
63
+ name: 'Netflix',
64
+ icon: 'netflix',
65
+ color: COLORS.netflix,
66
+ description: 'Connect your Netflix viewing history for personalized insights'
67
+ },
68
+ spotify: {
69
+ name: 'Spotify',
70
+ icon: 'spotify',
71
+ color: COLORS.spotify,
72
+ description: 'Connect your Spotify listening data for music preferences'
73
+ }
74
+ };
75
+ export const API_ENDPOINTS = {
76
+ base: API_CONFIG.BASE_URL,
77
+ oauth: {
78
+ instagram: '/instagram/auth',
79
+ pinterest: '/pinterest/auth',
80
+ reddit: '/reddit/auth',
81
+ youtube: '/youtube/auth',
82
+ chatgpt: '/chatgpt/auth',
83
+ llm: '/chatgpt/auth'
84
+ },
85
+ callback: {
86
+ instagram: '/instagram/callback',
87
+ pinterest: '/pinterest/callback',
88
+ reddit: '/reddit/callback',
89
+ youtube: '/youtube/callback',
90
+ chatgpt: '/chatgpt/callback',
91
+ llm: '/chatgpt/callback'
92
+ },
93
+ llm: {
94
+ dataIngest: '/llmdata',
95
+ dataRequest: '/llmdata/request'
96
+ }
97
+ };
98
+ export const STORAGE_KEYS = {
99
+ credentials: 'onairos_credentials',
100
+ connections: 'onairos_connections'
101
+ };
102
+ export const PIN_REQUIREMENTS = {
103
+ minLength: 8,
104
+ requireUppercase: true,
105
+ requireLowercase: true,
106
+ requireNumber: true,
107
+ requireSpecialChar: true
108
+ };
109
+ export const DEEP_LINK_CONFIG = {
110
+ scheme: 'onairosanime',
111
+ host: 'authenticate',
112
+ redirectUri: 'onairosanime://auth/'
113
+ };
114
+ //# sourceMappingURL=index.js.map
@@ -1 +1,335 @@
1
- import React,{createContext,useState,useEffect,useContext}from'react';function _0x4be5(){const _0x45ed38=['Failed\x20to\x20complete\x20onboarding:','user','lirnq','5|0|4|1|2|3','🎯\x20Found\x20event\x20access\x20token\x20-\x20user\x20has\x20completed\x20onboarding,\x20authentication\x20confirmed','vufQl','HXjbz','yxOAf','LztXG','NRYWd','Failed\x20to\x20fetch\x20user\x20profile:','🌐\x20Profile\x20fetch\x20failed\x20(likely\x20network),\x20keeping\x20authentication\x20state','Onairos\x20User','onboardingCompleted','Failed\x20to\x20load\x20authentication\x20state:','onairos','authentication','User\x20logged\x20in\x20with\x20onboarded=false:','Failed\x20to\x20save\x20user\x20data:','onairosUserId','lastConnectedAt','🔗\x20No\x20Onairos\x20connection\x20info\x20from\x20backend,\x20defaulting\x20to\x20false','🍎\x20Apple\x20sign-in\x20completed\x20-\x20auth_method\x20set\x20to\x20\x22apple\x22','Apple\x20sign-in\x20failed:','bvjRK','Failed\x20to\x20remove\x20user\x20data:','MPlVg','eRRKP','ALCRX','LIBUi','Failed\x20to\x20update\x20user\x20data:','2|6|3|5|4|0|1','Failed\x20to\x20delete\x20account:','dmwbs','GhwYc','wYRQY','biKsM','rnMCQ','bitNA','sISED','cALeI','VUfSt','LjTki','JTLjZ','MRwfw','mQXvc','Zyvai','JPPhF','vDcII','DnRyd','awHeg','EdmBu','HFCOQ','TluaR','JXnjD','💾\x20Network\x20unreachable,\x20trusting\x20local\x20authentication\x20state','ziXFN','KKRWF','EZvaQ','Voumr','mZEop','VmyUr','split','oJuJC','bDAcA','log','nGiQq','CzgRZ','tUyGf','pqygd','error','warn','FVJcy','gbPrB','nwOyB','AYssn','aRqvI','nrIXr','OQmAS','parse','stringify','IrNtN','zWHPQ','WKPfg','message','includes','401','sSYuT','PqzTn','STZpy','MQdnq','setItem','RdgaK','WzMzR','getItem','WSAXt','true','cgqox','cvXGN','FogCC','email','apple','lMEpb','aEHjM','name','CgUdJ','ZmRaS','VPMeo','token','hasConnectedOnairos','upGfC','LmDfz','ZUmXS','profilePicture','BzJqw','BmAWm','qQCVz','XEJfE','ElPVq','auth_method','qJzaM','cKZmr','xBrhJ','zaeIS','ZfouE','HjYgt','QPjtA','nuCbb','sZLxm','wBsrc','uvcLJ','odMSP','WTRtw','hxdCQ','TTHpb','YqNkj','QMoCd','JQhpp','NsdrO','aakWn','aOncR','UnIzd','removeItem','wfRUx','createElement','Provider','lXUiL','useAuth\x20must\x20be\x20used\x20within\x20an\x20AuthProvider'];_0x4be5=function(){return _0x45ed38;};return _0x4be5();}import AsyncStorage from'@react-native-async-storage/async-storage';import{saveAuthToken,getAuthToken,removeAuthToken,verifyToken,getUserProfile,authenticateWithApple,authenticateWithOnairos,updateUserOnboardedStatus}from'../services/authService';import{saveAuthState,clearUserData,getResumeTarget,markStepCompleted,updateLastScreen,isReturningUser,markEventPageReached,hasEventAccessToken}from'../services/storageService';const AuthContext=createContext(undefined);export const AuthProvider=({children:_0x2712d1})=>{const _0x15c7ce={'GhwYc':function(_0x2d5725,_0x4ffcca){return _0x2d5725(_0x4ffcca);},'odMSP':_0x207c(0x0),'DnRyd':function(_0x36703c){return _0x36703c();},'wYRQY':_0x207c(0x1),'biKsM':_0x207c(0x2),'rnMCQ':_0x207c(0x3),'bitNA':_0x207c(0x4),'sISED':'QNmIF','Fiilo':_0x207c(0x5),'VUfSt':'🌐\x20Network\x20verification\x20failed,\x20using\x20local\x20token\x20validation:','LjTki':function(_0x31ca68,_0x29eda3){return _0x31ca68===_0x29eda3;},'JTLjZ':_0x207c(0x6),'BlZmc':_0x207c(0x7),'MRwfw':'💾\x20Network\x20unreachable,\x20trusting\x20local\x20authentication\x20state','LOJcX':_0x207c(0x8),'mQXvc':function(_0x387bfc,_0x1975e7){return _0x387bfc!==_0x1975e7;},'Zyvai':_0x207c(0x9),'gjAGT':_0x207c(0xa),'JPPhF':function(_0x497e2e,_0x35b50f){return _0x497e2e instanceof _0x35b50f;},'vDcII':'403','awHeg':_0x207c(0xb),'gBqaX':'offline_user','EdmBu':_0x207c(0xc),'HFCOQ':function(_0x180a06,_0x281575){return _0x180a06(_0x281575);},'TluaR':_0x207c(0xd),'JXnjD':_0x207c(0xe),'FogCC':function(_0x3256a5,_0x165b07){return _0x3256a5(_0x165b07);},'lMEpb':'apple','aEHjM':_0x207c(0xf),'zQobM':_0x207c(0x10),'CgUdJ':_0x207c(0x11),'ZmRaS':_0x207c(0x12),'VPMeo':function(_0x35693a,_0x6b51e3){return _0x35693a(_0x6b51e3);},'upGfC':'hasConnectedOnairos','EZxYC':_0x207c(0x13),'FGYka':_0x207c(0x14),'LmDfz':'false','ZUmXS':_0x207c(0x15),'BzJqw':function(_0xb85b81,_0x4309e3){return _0xb85b81(_0x4309e3);},'BmAWm':_0x207c(0x16),'qQCVz':_0x207c(0x17),'XEJfE':function(_0x38716b,_0x340e42){return _0x38716b(_0x340e42);},'ElPVq':_0x207c(0x18),'qJzaM':function(_0x336186,_0x96a87b){return _0x336186(_0x96a87b);},'cKZmr':function(_0x53eae9,_0x2a60fb){return _0x53eae9(_0x2a60fb);},'xBrhJ':'🔑\x20Onairos\x20sign-in\x20completed\x20-\x20auth_method\x20set\x20to\x20\x22onairos\x22','HjYgt':function(_0x1cbdb6){return _0x1cbdb6();},'dbizJ':_0x207c(0x19),'QPjtA':function(_0x3d47df,_0x142867){return _0x3d47df(_0x142867);},'mYiml':_0x207c(0x1a),'wBsrc':_0x207c(0x1b),'uvcLJ':_0x207c(0x1c),'JQhpp':function(_0x9b5a69,_0x36978e){return _0x9b5a69(_0x36978e);},'WTRtw':function(_0x4f8014,_0xf0c1b3){return _0x4f8014!==_0xf0c1b3;},'hxdCQ':_0x207c(0x1d),'TTHpb':'PNXTz','YqNkj':function(_0x203036,_0xf8f15c){return _0x203036(_0xf8f15c);},'QMoCd':_0x207c(0x1e),'NsdrO':'WqyTW','aakWn':'Failed\x20to\x20update\x20onboarded\x20status:','aOncR':_0x207c(0x1f),'etowe':function(_0x506b19,_0x33d48d){return _0x506b19(_0x33d48d);},'UnIzd':'Account\x20deleted\x20successfully','wfRUx':function(_0x4f164f,_0x34f100){return _0x4f164f(_0x34f100);},'WTftY':_0x207c(0x20),'OKOAT':function(_0x597f94,_0x32c5ee){return _0x597f94(_0x32c5ee);},'dmwbs':function(_0x525bc9,_0x4f3fee){return _0x525bc9(_0x4f3fee);},'ySwKW':function(_0x4d7f59,_0xebc5b5){return _0x4d7f59(_0xebc5b5);}},[_0xbcd69f,_0x1eb9ee]=_0x15c7ce['OKOAT'](useState,null),[_0x306715,_0x16b445]=_0x15c7ce[_0x207c(0x21)](useState,!![]),[_0x506c73,_0x17d7a8]=_0x15c7ce['OKOAT'](useState,![]),[_0x2949fb,_0x19a2c4]=_0x15c7ce['ySwKW'](useState,![]);useEffect(()=>{const _0x1d9bd9={'QNNac':function(_0x2c3734,_0x121729){return _0x15c7ce[_0x207c(0x22)](_0x2c3734,_0x121729);},'ziXFN':function(_0x395284,_0x1b7a21){return _0x395284(_0x1b7a21);},'BVvbg':_0x15c7ce['odMSP'],'KKRWF':function(_0x1b011e){return _0x15c7ce['DnRyd'](_0x1b011e);},'EZvaQ':_0x15c7ce[_0x207c(0x23)],'Voumr':function(_0x146c08,_0x51d7a0){return _0x146c08&&_0x51d7a0;},'mZEop':_0x15c7ce[_0x207c(0x24)],'VmyUr':_0x15c7ce[_0x207c(0x25)],'oJuJC':function(_0x5e435d,_0x2badb7){return _0x15c7ce['GhwYc'](_0x5e435d,_0x2badb7);},'bDAcA':function(_0x12c2e0,_0x4caa84){return _0x15c7ce[_0x207c(0x22)](_0x12c2e0,_0x4caa84);},'qUszh':_0x15c7ce[_0x207c(0x26)],'ElFCn':_0x15c7ce[_0x207c(0x27)],'CzgRZ':_0x15c7ce['Fiilo'],'pqygd':_0x207c(0x28),'FVJcy':_0x15c7ce[_0x207c(0x29)],'gbPrB':function(_0x4f7ed6,_0xc5fd6b){return _0x15c7ce[_0x207c(0x2a)](_0x4f7ed6,_0xc5fd6b);},'eCBBX':_0x15c7ce[_0x207c(0x2b)],'nwOyB':_0x15c7ce['BlZmc'],'RXozq':_0x15c7ce[_0x207c(0x2c)],'aRqvI':_0x15c7ce['LOJcX'],'nrIXr':function(_0x13be15,_0x1fe087){return _0x15c7ce[_0x207c(0x2d)](_0x13be15,_0x1fe087);},'MSkJm':function(_0x3abc5e,_0x1075b3){return _0x3abc5e(_0x1075b3);},'IrNtN':_0x15c7ce[_0x207c(0x2e)],'FnDSG':_0x15c7ce['gjAGT'],'WKPfg':function(_0x26c22b,_0x55ec15){return _0x15c7ce[_0x207c(0x2f)](_0x26c22b,_0x55ec15);},'sriVj':_0x15c7ce[_0x207c(0x30)],'sSYuT':function(_0x359920){return _0x15c7ce[_0x207c(0x31)](_0x359920);},'PqzTn':_0x15c7ce[_0x207c(0x32)],'STZpy':_0x15c7ce['gBqaX'],'MQdnq':_0x15c7ce[_0x207c(0x33)],'fvfts':'user@onairos.com','oMYca':function(_0x52c149,_0xa8e5d5){return _0x15c7ce[_0x207c(0x34)](_0x52c149,_0xa8e5d5);},'WzMzR':function(_0xa31f55){return _0xa31f55();},'WSAXt':_0x15c7ce[_0x207c(0x35)],'bJZWz':function(_0x16b5e9,_0x210887){return _0x15c7ce['LjTki'](_0x16b5e9,_0x210887);},'cgqox':_0x15c7ce[_0x207c(0x36)],'cvXGN':function(_0x5f387e,_0x558bb7){return _0x15c7ce[_0x207c(0x34)](_0x5f387e,_0x558bb7);}},_0x2de3fa=async()=>{const _0x274530={'nGiQq':function(_0x56e112,_0x4087e8){return _0x1d9bd9['QNNac'](_0x56e112,_0x4087e8);},'tUyGf':_0x207c(0x37),'AYssn':function(_0x1b58b0,_0x18f6d1){return _0x1d9bd9[_0x207c(0x38)](_0x1b58b0,_0x18f6d1);},'RdgaK':_0x1d9bd9['BVvbg']};try{const _0x79cde9=await _0x1d9bd9[_0x207c(0x39)](hasEventAccessToken),_0x40382c=await AsyncStorage['getItem'](_0x1d9bd9[_0x207c(0x3a)]);if(_0x1d9bd9[_0x207c(0x3b)](_0x79cde9,_0x40382c)){if(_0x1d9bd9['mZEop']===_0x1d9bd9[_0x207c(0x3c)]){const _0x36c91a=_0x1d9bd9[_0x207c(0x3d)][_0x207c(0x3e)]('|');let _0x7dc223=0x0;while(!![]){switch(_0x36c91a[_0x7dc223++]){case'0':_0x1d9bd9[_0x207c(0x3f)](_0x1eb9ee,JSON['parse'](_0x40382c));continue;case'1':_0x17d7a8(!![]);continue;case'2':_0x1d9bd9[_0x207c(0x40)](_0x16b445,![]);continue;case'3':return;case'4':_0x1d9bd9['bDAcA'](_0x19a2c4,!![]);continue;case'5':console[_0x207c(0x41)](_0x1d9bd9['qUszh']);continue;}break;}}else _0x274530[_0x207c(0x42)](_0x4ee485,![]);}const _0xe1f80=await getAuthToken();if(_0xe1f80){let _0xb1fdb0=![];try{_0x1d9bd9['ElFCn']!==_0x1d9bd9[_0x207c(0x43)]?_0xb1fdb0=await _0x1d9bd9[_0x207c(0x39)](verifyToken):(_0x1141c8[_0x207c(0x41)](_0x274530[_0x207c(0x44)]),_0x1d8af1=!![]);}catch(_0x15d1c3){_0x1d9bd9[_0x207c(0x45)]!==_0x1d9bd9[_0x207c(0x45)]?_0x43cc5a[_0x207c(0x46)](_0x207c(0xe),_0x8c2bfc):(console[_0x207c(0x47)](_0x1d9bd9[_0x207c(0x48)],_0x15d1c3),_0x40382c&&(_0x1d9bd9[_0x207c(0x49)](_0x1d9bd9['eCBBX'],_0x1d9bd9[_0x207c(0x4a)])?_0x274530[_0x207c(0x4b)](_0x1c43f2,![]):(console[_0x207c(0x41)](_0x1d9bd9['RXozq']),_0xb1fdb0=!![])));}if(_0xb1fdb0){if(_0x1d9bd9['gbPrB'](_0x1d9bd9[_0x207c(0x4c)],_0x1d9bd9[_0x207c(0x4c)])){if(_0x40382c){if(_0x1d9bd9[_0x207c(0x4d)](_0x207c(0x4e),_0x207c(0x4e)))throw new _0xdb6786('useAuth\x20must\x20be\x20used\x20within\x20an\x20AuthProvider');else _0x1eb9ee(JSON[_0x207c(0x4f)](_0x40382c)),_0x1d9bd9[_0x207c(0x3f)](_0x19a2c4,!![]);}else try{const _0x3ee4a8=await _0x1d9bd9[_0x207c(0x39)](getUserProfile);await AsyncStorage['setItem'](_0x207c(0x1),JSON[_0x207c(0x50)](_0x3ee4a8)),_0x1d9bd9['MSkJm'](_0x1eb9ee,_0x3ee4a8),_0x19a2c4(!![]);}catch(_0x21d19e){if(_0x1d9bd9[_0x207c(0x51)]===_0x207c(0x52))_0x5473a4['error']('Failed\x20to\x20update\x20user\x20data:',_0x4df1a4);else{console[_0x207c(0x46)](_0x1d9bd9['FnDSG'],_0x21d19e);const _0x50529c=_0x1d9bd9[_0x207c(0x53)](_0x21d19e,Error)?_0x21d19e[_0x207c(0x54)]:String(_0x21d19e);if(_0x50529c[_0x207c(0x55)](_0x207c(0x56))||_0x50529c[_0x207c(0x55)](_0x1d9bd9['sriVj']))await _0x1d9bd9[_0x207c(0x57)](removeAuthToken);else{console[_0x207c(0x41)](_0x1d9bd9[_0x207c(0x58)]);if(_0xe1f80){const _0x3ce616={'id':_0x1d9bd9[_0x207c(0x59)],'name':_0x1d9bd9[_0x207c(0x5a)],'email':_0x1d9bd9['fvfts'],'onboarded':![]};await AsyncStorage[_0x207c(0x5b)](_0x1d9bd9['EZvaQ'],JSON[_0x207c(0x50)](_0x3ce616)),_0x1d9bd9['oMYca'](_0x1eb9ee,_0x3ce616),_0x1d9bd9[_0x207c(0x40)](_0x19a2c4,!![]);}}}}}else{_0x2cc92f[_0x207c(0x46)](_0x274530[_0x207c(0x5c)],_0x100880);throw _0x302e7b;}}else await _0x1d9bd9[_0x207c(0x5d)](removeAuthToken);}const _0x2bcbbf=await AsyncStorage[_0x207c(0x5e)](_0x1d9bd9[_0x207c(0x5f)]);_0x1d9bd9['bJZWz'](_0x2bcbbf,_0x207c(0x60))&&_0x1d9bd9[_0x207c(0x3f)](_0x17d7a8,!![]);}catch(_0x3a898d){console[_0x207c(0x46)](_0x1d9bd9[_0x207c(0x61)],_0x3a898d);}finally{_0x1d9bd9[_0x207c(0x62)](_0x16b445,![]);}};_0x15c7ce[_0x207c(0x31)](_0x2de3fa);},[]);const _0x1e4b75=async _0x2233df=>{try{var _0x5a1d12;const _0x48181d={..._0x2233df,'onboarded':![]};await AsyncStorage[_0x207c(0x5b)](_0x15c7ce[_0x207c(0x23)],JSON[_0x207c(0x50)](_0x48181d)),_0x1eb9ee(_0x48181d),_0x15c7ce[_0x207c(0x22)](_0x19a2c4,!![]),await _0x15c7ce[_0x207c(0x63)](saveAuthState,{'isAuthenticated':!![],'authMethod':_0x15c7ce['mQXvc'](_0x5a1d12=_0x2233df[_0x207c(0x64)],null)&&_0x5a1d12!==void 0x0&&_0x5a1d12['includes'](_0x207c(0x65))?_0x15c7ce[_0x207c(0x66)]:_0x15c7ce[_0x207c(0x67)],'hasValidToken':!![],'userEmail':_0x2233df[_0x207c(0x64)],'userName':_0x2233df[_0x207c(0x68)]}),await markStepCompleted(_0x15c7ce['zQobM']),console[_0x207c(0x41)](_0x15c7ce[_0x207c(0x69)],_0x48181d);}catch(_0x5b379c){console[_0x207c(0x46)](_0x15c7ce[_0x207c(0x6a)],_0x5b379c);}},_0xb18fc9=async _0xd197f=>{try{_0x15c7ce[_0x207c(0x63)](_0x16b445,!![]);const _0x227799=await _0x15c7ce[_0x207c(0x6b)](authenticateWithApple,_0xd197f);await _0x15c7ce['GhwYc'](saveAuthToken,_0x227799[_0x207c(0x6c)]),await AsyncStorage[_0x207c(0x5b)]('auth_method',_0x207c(0x65));_0x227799[_0x207c(0xf)]?(await AsyncStorage[_0x207c(0x5b)](_0x15c7ce['upGfC'],_0x227799[_0x207c(0xf)][_0x207c(0x6d)]['toString']()),_0x227799[_0x207c(0xf)][_0x207c(0x13)]&&await AsyncStorage['setItem'](_0x15c7ce['EZxYC'],_0x227799['onairos']['onairosUserId']),_0x227799[_0x207c(0xf)][_0x207c(0x14)]&&await AsyncStorage[_0x207c(0x5b)](_0x15c7ce['FGYka'],_0x227799[_0x207c(0xf)][_0x207c(0x14)]),console[_0x207c(0x41)]('🔗\x20Stored\x20Onairos\x20connection\x20status:',_0x227799[_0x207c(0xf)]['hasConnectedOnairos'])):(await AsyncStorage[_0x207c(0x5b)](_0x15c7ce[_0x207c(0x6e)],_0x15c7ce[_0x207c(0x6f)]),console[_0x207c(0x41)](_0x15c7ce[_0x207c(0x70)]));const _0x37136c={'id':_0x227799['user']['id'],'name':_0x227799['user']['name']||'Onairos\x20User','email':_0x227799[_0x207c(0x1)][_0x207c(0x64)],'profilePicture':_0x227799[_0x207c(0x1)][_0x207c(0x71)],'onboarded':![]};return await AsyncStorage[_0x207c(0x5b)](_0x15c7ce[_0x207c(0x23)],JSON['stringify'](_0x37136c)),_0x1eb9ee(_0x37136c),_0x15c7ce[_0x207c(0x72)](_0x19a2c4,!![]),console[_0x207c(0x41)](_0x15c7ce[_0x207c(0x73)]),_0x37136c;}catch(_0x5448bc){console[_0x207c(0x46)](_0x15c7ce[_0x207c(0x74)],_0x5448bc);throw _0x5448bc;}finally{_0x15c7ce[_0x207c(0x75)](_0x16b445,![]);}},_0x671d2a=async _0x9b9de9=>{const _0x216784={'zaeIS':_0x15c7ce[_0x207c(0x29)],'ZfouE':_0x15c7ce[_0x207c(0x2c)]};try{if(_0x15c7ce[_0x207c(0x2a)]('bvjRK',_0x15c7ce[_0x207c(0x76)])){_0x16b445(!![]);const _0xbe9c95=await _0x15c7ce[_0x207c(0x22)](authenticateWithOnairos,_0x9b9de9);await _0x15c7ce['BzJqw'](saveAuthToken,_0xbe9c95[_0x207c(0x6c)]),await AsyncStorage[_0x207c(0x5b)](_0x207c(0x77),_0x15c7ce[_0x207c(0x67)]);const _0x8c67={'id':_0xbe9c95[_0x207c(0x1)]['id'],'name':_0xbe9c95['user'][_0x207c(0x68)]||_0x15c7ce[_0x207c(0x33)],'email':_0xbe9c95['user'][_0x207c(0x64)],'profilePicture':_0xbe9c95[_0x207c(0x1)][_0x207c(0x71)],'onboarded':![]};return await AsyncStorage[_0x207c(0x5b)](_0x15c7ce[_0x207c(0x23)],JSON['stringify'](_0x8c67)),_0x15c7ce[_0x207c(0x78)](_0x1eb9ee,_0x8c67),_0x15c7ce[_0x207c(0x79)](_0x19a2c4,!![]),console['log'](_0x15c7ce[_0x207c(0x7a)]),_0x8c67;}else _0x2c7a6a[_0x207c(0x47)](_0x216784[_0x207c(0x7b)],_0x5339a1),_0x33fb09&&(_0x3aac08[_0x207c(0x41)](_0x216784[_0x207c(0x7c)]),_0x3e99fa=!![]);}catch(_0x296690){console[_0x207c(0x46)]('Onairos\x20sign-in\x20failed:',_0x296690);throw _0x296690;}finally{_0x15c7ce[_0x207c(0x63)](_0x16b445,![]);}},_0x142848=async()=>{try{await _0x15c7ce[_0x207c(0x7d)](clearUserData),_0x15c7ce[_0x207c(0x63)](_0x1eb9ee,null),_0x15c7ce['qJzaM'](_0x19a2c4,![]);}catch(_0x5a5c6e){console[_0x207c(0x46)](_0x15c7ce['dbizJ'],_0x5a5c6e);}},_0x3949f5=async _0x3af304=>{const _0x120bd5={'sZLxm':function(_0x3ff650,_0x20cbae){return _0x15c7ce[_0x207c(0x7e)](_0x3ff650,_0x20cbae);}};if(_0x207c(0x7f)===_0x15c7ce['mYiml'])_0x120bd5[_0x207c(0x80)](_0x21c851,_0x5c8b9d[_0x207c(0x4f)](_0x17617e)),_0x120bd5[_0x207c(0x80)](_0x57aa71,!![]);else try{const _0x2cc0b8={..._0xbcd69f,..._0x3af304};await AsyncStorage[_0x207c(0x5b)](_0x15c7ce[_0x207c(0x23)],JSON[_0x207c(0x50)](_0x2cc0b8)),_0x15c7ce[_0x207c(0x78)](_0x1eb9ee,_0x2cc0b8),await _0x328542();}catch(_0x2c515b){if(_0x15c7ce[_0x207c(0x2a)](_0x15c7ce[_0x207c(0x81)],_0x15c7ce[_0x207c(0x82)]))_0x15c7ce[_0x207c(0x6b)](_0x4f82d3,![]);else{console[_0x207c(0x46)](_0x15c7ce[_0x207c(0x83)],_0x2c515b);throw _0x2c515b;}}},_0x59577b=async _0x17b1ca=>{if(_0x15c7ce[_0x207c(0x84)](_0x15c7ce[_0x207c(0x85)],_0x15c7ce[_0x207c(0x86)]))try{if(!_0xbcd69f)return;const _0x568bcd={..._0xbcd69f,..._0x17b1ca};await AsyncStorage[_0x207c(0x5b)](_0x15c7ce[_0x207c(0x23)],JSON['stringify'](_0x568bcd)),_0x15c7ce[_0x207c(0x87)](_0x1eb9ee,_0x568bcd);}catch(_0x3d6fcb){console[_0x207c(0x46)](_0x15c7ce[_0x207c(0x88)],_0x3d6fcb);}else{_0x1ba157['log'](_0x207c(0x4)),_0x15c7ce[_0x207c(0x89)](_0x31e1c7,_0x5a355b[_0x207c(0x4f)](_0x1f3f4f)),_0x257858(!![]),_0x4a879f(!![]),_0xcb4b8f(![]);return;}},_0x328542=async()=>{const _0x4c8c11={'SpEZa':_0x207c(0x20)};if(_0x15c7ce[_0x207c(0x2a)](_0x15c7ce[_0x207c(0x8a)],_0x15c7ce[_0x207c(0x8a)]))try{_0x16b445(!![]),await _0x15c7ce[_0x207c(0x31)](updateUserOnboardedStatus);if(_0xbcd69f){const _0x210282={..._0xbcd69f,'onboarded':!![]};await AsyncStorage[_0x207c(0x5b)](_0x15c7ce[_0x207c(0x23)],JSON['stringify'](_0x210282)),_0x1eb9ee(_0x210282);}}catch(_0x18e728){console[_0x207c(0x46)](_0x15c7ce[_0x207c(0x8b)],_0x18e728);throw _0x18e728;}finally{_0x15c7ce[_0x207c(0x34)](_0x16b445,![]);}else{_0x84f9b2[_0x207c(0x46)](_0x4c8c11['SpEZa'],_0x50dae1);throw _0x52fbe2;}},_0x42d645=async()=>{try{const _0x533175=_0x15c7ce[_0x207c(0x8c)][_0x207c(0x3e)]('|');let _0x226283=0x0;while(!![]){switch(_0x533175[_0x226283++]){case'0':_0x15c7ce['etowe'](_0x17d7a8,![]);continue;case'1':console['log'](_0x15c7ce[_0x207c(0x8d)]);continue;case'2':await AsyncStorage[_0x207c(0x8e)](_0x15c7ce[_0x207c(0x23)]);continue;case'3':await AsyncStorage[_0x207c(0x8e)](_0x15c7ce['TluaR']);continue;case'4':_0x15c7ce[_0x207c(0x8f)](_0x19a2c4,![]);continue;case'5':_0x1eb9ee(null);continue;case'6':await removeAuthToken();continue;}break;}}catch(_0x264fbe){console['error'](_0x15c7ce['WTftY'],_0x264fbe);throw _0x264fbe;}};return React[_0x207c(0x90)](AuthContext[_0x207c(0x91)],{'value':{'user':_0xbcd69f,'isLoading':_0x306715,'hasCompletedOnboarding':_0x506c73,'login':_0x1e4b75,'logout':_0x142848,'deleteAccount':_0x42d645,'completeOnboarding':_0x3949f5,'updateUser':_0x59577b,'appleSignIn':_0xb18fc9,'onairosSignIn':_0x671d2a,'isAuthenticated':_0x2949fb,'updateOnboardedStatus':_0x328542,'getResumeTarget':getResumeTarget,'markStepCompleted':markStepCompleted,'updateLastScreen':updateLastScreen,'isReturningUser':isReturningUser,'markEventPageReached':markEventPageReached,'hasEventAccessToken':hasEventAccessToken}},_0x2712d1);};function _0x207c(_0x4be5c3,_0x207cbb){_0x4be5c3=_0x4be5c3-0x0;const _0x13ce25=_0x4be5();let _0x36a9b5=_0x13ce25[_0x4be5c3];return _0x36a9b5;}export const useAuth=()=>{const _0x780398={'lXUiL':function(_0x2c16f9,_0x54e00d){return _0x2c16f9===_0x54e00d;}},_0x369e06=useContext(AuthContext);if(_0x780398[_0x207c(0x92)](_0x369e06,undefined))throw new Error(_0x207c(0x93));return _0x369e06;};
1
+ import React, { createContext, useState, useEffect, useContext } from 'react';
2
+ import AsyncStorage from '@react-native-async-storage/async-storage';
3
+ import { saveAuthToken, getAuthToken, removeAuthToken, verifyToken, getUserProfile, authenticateWithApple, authenticateWithOnairos, updateUserOnboardedStatus } from '../services/authService';
4
+ import { saveAuthState, clearUserData, getResumeTarget, markStepCompleted, updateLastScreen, isReturningUser, markEventPageReached, hasEventAccessToken } from '../services/storageService';
5
+ const AuthContext = /*#__PURE__*/createContext(undefined);
6
+ export const AuthProvider = ({
7
+ children
8
+ }) => {
9
+ const [user, setUser] = useState(null);
10
+ const [isLoading, setIsLoading] = useState(true);
11
+ const [hasCompletedOnboarding, setHasCompletedOnboarding] = useState(false);
12
+ const [isAuthenticated, setIsAuthenticated] = useState(false);
13
+ useEffect(() => {
14
+ // Check if user is already logged in
15
+ const loadStoredUser = async () => {
16
+ try {
17
+ // PRIORITY 1: Check if user has completed onboarding (for release mode reliability)
18
+ const hasEventToken = await hasEventAccessToken();
19
+ const storedUser = await AsyncStorage.getItem('user');
20
+ if (hasEventToken && storedUser) {
21
+ console.log('🎯 Found event access token - user has completed onboarding, authentication confirmed');
22
+ setUser(JSON.parse(storedUser));
23
+ setIsAuthenticated(true);
24
+ setHasCompletedOnboarding(true);
25
+ setIsLoading(false);
26
+ return; // Skip network verification for completed users
27
+ }
28
+
29
+ // PRIORITY 2: Check if we have a JWT token for users still in onboarding
30
+ const token = await getAuthToken();
31
+ if (token) {
32
+ // For users with tokens but no completion token, try network verification
33
+ // but don't fail if network is unreachable (important for release mode)
34
+ let isValid = false;
35
+ try {
36
+ isValid = await verifyToken();
37
+ } catch (networkError) {
38
+ console.warn('🌐 Network verification failed, using local token validation:', networkError);
39
+ // In release mode, network might be slow/unreliable
40
+ // If we have a token and stored user, trust the local state
41
+ if (storedUser) {
42
+ console.log('💾 Network unreachable, trusting local authentication state');
43
+ isValid = true; // Trust local state when network fails
44
+ }
45
+ }
46
+ if (isValid) {
47
+ // Token is valid (or we're trusting local state), get user data
48
+ if (storedUser) {
49
+ setUser(JSON.parse(storedUser));
50
+ setIsAuthenticated(true);
51
+ } else {
52
+ // If user data is not in AsyncStorage, try to fetch it
53
+ try {
54
+ const userData = await getUserProfile();
55
+ await AsyncStorage.setItem('user', JSON.stringify(userData));
56
+ setUser(userData);
57
+ setIsAuthenticated(true);
58
+ } catch (profileError) {
59
+ console.error('Failed to fetch user profile:', profileError);
60
+ // Only remove token if we're sure it's invalid (not just network issues)
61
+ const errorMessage = profileError instanceof Error ? profileError.message : String(profileError);
62
+ if (errorMessage.includes('401') || errorMessage.includes('403')) {
63
+ await removeAuthToken();
64
+ } else {
65
+ console.log('🌐 Profile fetch failed (likely network), keeping authentication state');
66
+ // Create fallback user for offline scenarios
67
+ if (token) {
68
+ const fallbackUser = {
69
+ id: 'offline_user',
70
+ name: 'Onairos User',
71
+ email: 'user@onairos.com',
72
+ onboarded: false
73
+ };
74
+ await AsyncStorage.setItem('user', JSON.stringify(fallbackUser));
75
+ setUser(fallbackUser);
76
+ setIsAuthenticated(true);
77
+ }
78
+ }
79
+ }
80
+ }
81
+ } else {
82
+ // Token verification definitely failed - remove it
83
+ await removeAuthToken();
84
+ }
85
+ }
86
+ const onboardingCompleted = await AsyncStorage.getItem('onboardingCompleted');
87
+ if (onboardingCompleted === 'true') {
88
+ setHasCompletedOnboarding(true);
89
+ }
90
+ } catch (error) {
91
+ console.error('Failed to load authentication state:', error);
92
+ } finally {
93
+ setIsLoading(false);
94
+ }
95
+ };
96
+ loadStoredUser();
97
+ }, []);
98
+ const login = async userData => {
99
+ try {
100
+ var _userData$email;
101
+ // Ensure onboarded is set to false for new users
102
+ const userWithOnboarded = {
103
+ ...userData,
104
+ onboarded: false // Always force camera flow for new logins
105
+ };
106
+ await AsyncStorage.setItem('user', JSON.stringify(userWithOnboarded));
107
+ setUser(userWithOnboarded);
108
+ setIsAuthenticated(true);
109
+
110
+ // Save auth state and mark authentication step as completed
111
+ await saveAuthState({
112
+ isAuthenticated: true,
113
+ authMethod: (_userData$email = userData.email) !== null && _userData$email !== void 0 && _userData$email.includes('apple') ? 'apple' : 'onairos',
114
+ hasValidToken: true,
115
+ userEmail: userData.email,
116
+ userName: userData.name
117
+ });
118
+ await markStepCompleted('authentication');
119
+ console.log('User logged in with onboarded=false:', userWithOnboarded);
120
+ } catch (error) {
121
+ console.error('Failed to save user data:', error);
122
+ }
123
+ };
124
+
125
+ // Handle Apple Sign-In
126
+ const appleSignIn = async appleAuthData => {
127
+ try {
128
+ setIsLoading(true);
129
+
130
+ // Call the API to authenticate with Apple
131
+ const authResponse = await authenticateWithApple(appleAuthData);
132
+
133
+ // Save the JWT token
134
+ await saveAuthToken(authResponse.token);
135
+
136
+ // CRITICAL: Save auth method as 'apple' for proper button logic
137
+ await AsyncStorage.setItem('auth_method', 'apple');
138
+
139
+ // Save Onairos connection status from backend response
140
+ if (authResponse.onairos) {
141
+ await AsyncStorage.setItem('hasConnectedOnairos', authResponse.onairos.hasConnectedOnairos.toString());
142
+ if (authResponse.onairos.onairosUserId) {
143
+ await AsyncStorage.setItem('onairosUserId', authResponse.onairos.onairosUserId);
144
+ }
145
+ if (authResponse.onairos.lastConnectedAt) {
146
+ await AsyncStorage.setItem('lastConnectedAt', authResponse.onairos.lastConnectedAt);
147
+ }
148
+ console.log('🔗 Stored Onairos connection status:', authResponse.onairos.hasConnectedOnairos);
149
+ } else {
150
+ // Default to false if no Onairos info provided
151
+ await AsyncStorage.setItem('hasConnectedOnairos', 'false');
152
+ console.log('🔗 No Onairos connection info from backend, defaulting to false');
153
+ }
154
+
155
+ // Create user object from response
156
+ const userData = {
157
+ id: authResponse.user.id,
158
+ name: authResponse.user.name || 'Onairos User',
159
+ email: authResponse.user.email,
160
+ profilePicture: authResponse.user.profilePicture,
161
+ onboarded: false // Default to false for new Apple sign-ins
162
+ };
163
+
164
+ // Save user data to AsyncStorage and update state
165
+ await AsyncStorage.setItem('user', JSON.stringify(userData));
166
+ setUser(userData);
167
+ setIsAuthenticated(true);
168
+ console.log('🍎 Apple sign-in completed - auth_method set to "apple"');
169
+ return userData;
170
+ } catch (error) {
171
+ console.error('Apple sign-in failed:', error);
172
+ throw error;
173
+ } finally {
174
+ setIsLoading(false);
175
+ }
176
+ };
177
+
178
+ // Handle Onairos Sign-In (similar to Apple)
179
+ const onairosSignIn = async onairosAuthData => {
180
+ try {
181
+ setIsLoading(true);
182
+
183
+ // Call the API to authenticate with Onairos
184
+ const authResponse = await authenticateWithOnairos(onairosAuthData);
185
+
186
+ // Save the JWT token
187
+ await saveAuthToken(authResponse.token);
188
+
189
+ // CRITICAL: Save auth method as 'onairos' for proper button logic
190
+ await AsyncStorage.setItem('auth_method', 'onairos');
191
+
192
+ // Create user object from response
193
+ const userData = {
194
+ id: authResponse.user.id,
195
+ name: authResponse.user.name || 'Onairos User',
196
+ email: authResponse.user.email,
197
+ profilePicture: authResponse.user.profilePicture,
198
+ onboarded: false // Default to false for new Onairos sign-ins
199
+ };
200
+
201
+ // Save user data to AsyncStorage and update state
202
+ await AsyncStorage.setItem('user', JSON.stringify(userData));
203
+ setUser(userData);
204
+ setIsAuthenticated(true);
205
+ console.log('🔑 Onairos sign-in completed - auth_method set to "onairos"');
206
+ return userData;
207
+ } catch (error) {
208
+ console.error('Onairos sign-in failed:', error);
209
+ throw error;
210
+ } finally {
211
+ setIsLoading(false);
212
+ }
213
+ };
214
+ const logout = async () => {
215
+ try {
216
+ // Clear all user data using the new storage service
217
+ await clearUserData();
218
+ setUser(null);
219
+ setIsAuthenticated(false);
220
+ } catch (error) {
221
+ console.error('Failed to remove user data:', error);
222
+ }
223
+ };
224
+ const completeOnboarding = async userData => {
225
+ try {
226
+ // Update user data
227
+ const updatedUser = {
228
+ ...user,
229
+ ...userData
230
+ };
231
+ await AsyncStorage.setItem('user', JSON.stringify(updatedUser));
232
+ setUser(updatedUser);
233
+
234
+ // Update onboarded status on backend
235
+ await updateOnboardedStatus();
236
+ } catch (error) {
237
+ console.error('Failed to complete onboarding:', error);
238
+ throw error;
239
+ }
240
+ };
241
+ const updateUser = async userData => {
242
+ try {
243
+ if (!user) return;
244
+ const updatedUser = {
245
+ ...user,
246
+ ...userData
247
+ };
248
+ await AsyncStorage.setItem('user', JSON.stringify(updatedUser));
249
+ setUser(updatedUser);
250
+ } catch (error) {
251
+ console.error('Failed to update user data:', error);
252
+ }
253
+ };
254
+
255
+ // Update user onboarded status
256
+ const updateOnboardedStatus = async () => {
257
+ try {
258
+ setIsLoading(true);
259
+
260
+ // Call the API to update onboarded status
261
+ await updateUserOnboardedStatus();
262
+
263
+ // Update local user data
264
+ if (user) {
265
+ const updatedUser = {
266
+ ...user,
267
+ onboarded: true
268
+ };
269
+ await AsyncStorage.setItem('user', JSON.stringify(updatedUser));
270
+ setUser(updatedUser);
271
+ }
272
+ } catch (error) {
273
+ console.error('Failed to update onboarded status:', error);
274
+ throw error;
275
+ } finally {
276
+ setIsLoading(false);
277
+ }
278
+ };
279
+ const deleteAccount = async () => {
280
+ try {
281
+ // In a real app, you would make an API call to delete the user account on the server
282
+ // For example: await api.deleteUser(user.id);
283
+
284
+ // Remove user data from AsyncStorage
285
+ await AsyncStorage.removeItem('user');
286
+
287
+ // Remove JWT token
288
+ await removeAuthToken();
289
+
290
+ // Clear any other user-related data from AsyncStorage
291
+ await AsyncStorage.removeItem('onboardingCompleted');
292
+
293
+ // Update state
294
+ setUser(null);
295
+ setIsAuthenticated(false);
296
+ setHasCompletedOnboarding(false);
297
+ console.log('Account deleted successfully');
298
+ } catch (error) {
299
+ console.error('Failed to delete account:', error);
300
+ throw error;
301
+ }
302
+ };
303
+ return /*#__PURE__*/React.createElement(AuthContext.Provider, {
304
+ value: {
305
+ user,
306
+ isLoading,
307
+ hasCompletedOnboarding,
308
+ login,
309
+ logout,
310
+ deleteAccount,
311
+ completeOnboarding,
312
+ updateUser,
313
+ appleSignIn,
314
+ onairosSignIn,
315
+ isAuthenticated,
316
+ updateOnboardedStatus,
317
+ // Progress tracking methods
318
+ getResumeTarget,
319
+ markStepCompleted,
320
+ updateLastScreen,
321
+ isReturningUser,
322
+ // Event access token methods
323
+ markEventPageReached,
324
+ hasEventAccessToken
325
+ }
326
+ }, children);
327
+ };
328
+ export const useAuth = () => {
329
+ const context = useContext(AuthContext);
330
+ if (context === undefined) {
331
+ throw new Error('useAuth must be used within an AuthProvider');
332
+ }
333
+ return context;
334
+ };
335
+ //# sourceMappingURL=AuthContext.js.map