@onairos/react-native 3.6.4 → 3.6.6

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 (222) hide show
  1. package/lib/commonjs/api/index.js +1 -1
  2. package/lib/commonjs/components/BodyText.js +1 -1
  3. package/lib/commonjs/components/BrandMark.js +1 -1
  4. package/lib/commonjs/components/CodeInput.js +1 -1
  5. package/lib/commonjs/components/EmailInput.js +1 -1
  6. package/lib/commonjs/components/GoogleButton.js +1 -1
  7. package/lib/commonjs/components/HeadingGroup.js +1 -1
  8. package/lib/commonjs/components/LLMDataInputModal.js +1 -1
  9. package/lib/commonjs/components/ModalHeader.js +1 -1
  10. package/lib/commonjs/components/ModalSheet.js +1 -1
  11. package/lib/commonjs/components/Onairos.js +1 -1
  12. package/lib/commonjs/components/OnairosButton.js +1 -1
  13. package/lib/commonjs/components/OnairosSignInButton.js +1 -1
  14. package/lib/commonjs/components/Overlay.js +1 -1
  15. package/lib/commonjs/components/PersonaImage.js +1 -1
  16. package/lib/commonjs/components/PersonaLoadingScreen.js +1 -1
  17. package/lib/commonjs/components/PersonalizationConsentScreen.js +1 -1
  18. package/lib/commonjs/components/PinCreationScreen.js +1 -1
  19. package/lib/commonjs/components/PinInput.js +1 -1
  20. package/lib/commonjs/components/PlatformConnectorsStep.js +1 -1
  21. package/lib/commonjs/components/PlatformList.js +1 -1
  22. package/lib/commonjs/components/PlatformToggle.js +1 -1
  23. package/lib/commonjs/components/PrimaryButton.js +1 -1
  24. package/lib/commonjs/components/SignInMatchAnimation.js +1 -1
  25. package/lib/commonjs/components/SignInStep.js +1 -1
  26. package/lib/commonjs/components/UniversalOnboarding.js +1 -1
  27. package/lib/commonjs/components/VerificationStep.js +1 -1
  28. package/lib/commonjs/components/WelcomeScreen.js +1 -1
  29. package/lib/commonjs/components/icons/Basicproficon.js +1 -1
  30. package/lib/commonjs/components/icons/Basicprofile.js +1 -1
  31. package/lib/commonjs/components/icons/Checkbox.js +1 -1
  32. package/lib/commonjs/components/icons/Checkmark.js +1 -1
  33. package/lib/commonjs/components/icons/Contentanalysis.js +1 -1
  34. package/lib/commonjs/components/icons/Contenticon.js +1 -1
  35. package/lib/commonjs/components/icons/EnochE.js +1 -1
  36. package/lib/commonjs/components/icons/Personalityicon.js +1 -1
  37. package/lib/commonjs/components/icons/Personalityprofile.js +1 -1
  38. package/lib/commonjs/components/icons/Personalitytraits.js +1 -1
  39. package/lib/commonjs/components/icons/Userpreferences.js +1 -1
  40. package/lib/commonjs/components/icons/index.js +1 -1
  41. package/lib/commonjs/components/onboarding/OAuthWebView.js +1 -1
  42. package/lib/commonjs/components/onboarding/OnboardingHeader.js +1 -1
  43. package/lib/commonjs/components/onboarding/PinInput.js +1 -1
  44. package/lib/commonjs/components/onboarding/PlatformConnector.js +1 -1
  45. package/lib/commonjs/config/api.js +1 -1
  46. package/lib/commonjs/constants/index.js +1 -1
  47. package/lib/commonjs/context/AuthContext.js +1 -1
  48. package/lib/commonjs/hooks/useConnectedAccounts.js +1 -1
  49. package/lib/commonjs/hooks/useConnections.js +1 -1
  50. package/lib/commonjs/hooks/useCredentials.js +1 -1
  51. package/lib/commonjs/hooks/useUserConnections.js +1 -1
  52. package/lib/commonjs/index.js +1 -1
  53. package/lib/commonjs/services/apiClient.js +1 -1
  54. package/lib/commonjs/services/apiKeyService.js +924 -9
  55. package/lib/commonjs/services/authService.js +627 -10
  56. package/lib/commonjs/services/biometricPinService.js +1 -1
  57. package/lib/commonjs/services/chatGPTConversationExtractor.js +1 -1
  58. package/lib/commonjs/services/chatGPTConversationService.js +1 -1
  59. package/lib/commonjs/services/claudeConversationExtractor.js +1 -1
  60. package/lib/commonjs/services/claudeConversationService.js +1 -1
  61. package/lib/commonjs/services/connectedAccountsService.js +1 -1
  62. package/lib/commonjs/services/googleAuthService.js +1 -1
  63. package/lib/commonjs/services/hingeDataExtractor.js +1 -1
  64. package/lib/commonjs/services/hingeDataService.js +1 -1
  65. package/lib/commonjs/services/imageCompressionService.js +1 -1
  66. package/lib/commonjs/services/instagramDataExtractor.js +1 -1
  67. package/lib/commonjs/services/instagramDataService.js +1 -1
  68. package/lib/commonjs/services/jwtStorageService.js +1 -1
  69. package/lib/commonjs/services/linkedinDOMExtractor.js +1 -1
  70. package/lib/commonjs/services/linkedinProfileService.js +1 -1
  71. package/lib/commonjs/services/linkedinScrapingService.js +1 -1
  72. package/lib/commonjs/services/llmDataStorage.js +1 -1
  73. package/lib/commonjs/services/mobileTrainingService.js +1 -1
  74. package/lib/commonjs/services/oauthService.js +391 -11
  75. package/lib/commonjs/services/pinEncryptionService.js +1 -1
  76. package/lib/commonjs/services/pinStorageUtils.js +1 -1
  77. package/lib/commonjs/services/platformAuthService.js +1 -1
  78. package/lib/commonjs/services/sephoraDataExtractor.js +1 -1
  79. package/lib/commonjs/services/sephoraDataService.js +1 -1
  80. package/lib/commonjs/services/storageService.js +1 -1
  81. package/lib/commonjs/services/telegramDataExtractor.js +1 -1
  82. package/lib/commonjs/services/telegramDataService.js +1 -1
  83. package/lib/commonjs/services/trainingApiHelpers.js +1 -1
  84. package/lib/commonjs/services/userConnectionsService.js +1 -1
  85. package/lib/commonjs/services/youtubeMigrationService.js +1 -1
  86. package/lib/commonjs/theme/index.js +1 -1
  87. package/lib/commonjs/types/index.js +1 -1
  88. package/lib/commonjs/types.js +1 -1
  89. package/lib/commonjs/utils/Portal.js +1 -1
  90. package/lib/commonjs/utils/api.js +1 -1
  91. package/lib/commonjs/utils/assetRegistry.js +1 -1
  92. package/lib/commonjs/utils/auth.js +1 -1
  93. package/lib/commonjs/utils/connectorTests.js +1 -1
  94. package/lib/commonjs/utils/crypto.js +1 -1
  95. package/lib/commonjs/utils/debugHelper.js +1 -1
  96. package/lib/commonjs/utils/encryption.js +1 -1
  97. package/lib/commonjs/utils/eventUtils.js +1 -1
  98. package/lib/commonjs/utils/haptics.js +1 -1
  99. package/lib/commonjs/utils/imagePreloader.js +1 -1
  100. package/lib/commonjs/utils/networkDiagnostics.js +1 -1
  101. package/lib/commonjs/utils/onairosApi.js +1 -1
  102. package/lib/commonjs/utils/programmaticFlow.js +1 -1
  103. package/lib/commonjs/utils/retryHelper.js +1 -1
  104. package/lib/commonjs/utils/secureStorage.js +1 -1
  105. package/lib/commonjs/utils/webviewScripts/chatgpt.js +1 -1
  106. package/lib/commonjs/utils/webviewScripts/claude.js +1 -1
  107. package/lib/commonjs/utils/webviewScripts/hinge.js +1 -1
  108. package/lib/commonjs/utils/webviewScripts/index.js +1 -1
  109. package/lib/commonjs/utils/webviewScripts/instagram.js +1 -1
  110. package/lib/commonjs/utils/webviewScripts/linkedin.js +1 -1
  111. package/lib/commonjs/utils/webviewScripts/sephora.js +1 -1
  112. package/lib/commonjs/utils/webviewScripts/telegram.js +1 -1
  113. package/lib/module/api/index.js +1 -1
  114. package/lib/module/components/BodyText.js +1 -1
  115. package/lib/module/components/BrandMark.js +1 -1
  116. package/lib/module/components/CodeInput.js +1 -1
  117. package/lib/module/components/EmailInput.js +1 -1
  118. package/lib/module/components/GoogleButton.js +1 -1
  119. package/lib/module/components/HeadingGroup.js +1 -1
  120. package/lib/module/components/LLMDataInputModal.js +1 -1
  121. package/lib/module/components/ModalHeader.js +1 -1
  122. package/lib/module/components/ModalSheet.js +1 -1
  123. package/lib/module/components/Onairos.js +1 -1
  124. package/lib/module/components/OnairosButton.js +1 -1
  125. package/lib/module/components/OnairosSignInButton.js +1 -1
  126. package/lib/module/components/Overlay.js +1 -1
  127. package/lib/module/components/PersonaImage.js +1 -1
  128. package/lib/module/components/PersonaLoadingScreen.js +1 -1
  129. package/lib/module/components/PersonalizationConsentScreen.js +1 -1
  130. package/lib/module/components/PinCreationScreen.js +1 -1
  131. package/lib/module/components/PinInput.js +1 -1
  132. package/lib/module/components/PlatformConnectorsStep.js +1 -1
  133. package/lib/module/components/PlatformList.js +1 -1
  134. package/lib/module/components/PlatformToggle.js +1 -1
  135. package/lib/module/components/PrimaryButton.js +1 -1
  136. package/lib/module/components/SignInMatchAnimation.js +1 -1
  137. package/lib/module/components/SignInStep.js +1 -1
  138. package/lib/module/components/UniversalOnboarding.js +1 -1
  139. package/lib/module/components/VerificationStep.js +1 -1
  140. package/lib/module/components/WelcomeScreen.js +1 -1
  141. package/lib/module/components/icons/Basicproficon.js +1 -1
  142. package/lib/module/components/icons/Basicprofile.js +1 -1
  143. package/lib/module/components/icons/Checkbox.js +1 -1
  144. package/lib/module/components/icons/Checkmark.js +1 -1
  145. package/lib/module/components/icons/Contentanalysis.js +1 -1
  146. package/lib/module/components/icons/Contenticon.js +1 -1
  147. package/lib/module/components/icons/EnochE.js +1 -1
  148. package/lib/module/components/icons/Personalityicon.js +1 -1
  149. package/lib/module/components/icons/Personalityprofile.js +1 -1
  150. package/lib/module/components/icons/Personalitytraits.js +1 -1
  151. package/lib/module/components/icons/Userpreferences.js +1 -1
  152. package/lib/module/components/onboarding/OAuthWebView.js +1 -1
  153. package/lib/module/components/onboarding/OnboardingHeader.js +1 -1
  154. package/lib/module/components/onboarding/PinInput.js +1 -1
  155. package/lib/module/components/onboarding/PlatformConnector.js +1 -1
  156. package/lib/module/config/api.js +1 -1
  157. package/lib/module/constants/index.js +1 -1
  158. package/lib/module/context/AuthContext.js +1 -1
  159. package/lib/module/hooks/useConnectedAccounts.js +1 -1
  160. package/lib/module/hooks/useConnections.js +1 -1
  161. package/lib/module/hooks/useCredentials.js +1 -1
  162. package/lib/module/hooks/useUserConnections.js +1 -1
  163. package/lib/module/index.js +1 -1
  164. package/lib/module/services/apiClient.js +1 -1
  165. package/lib/module/services/apiKeyService.js +898 -1
  166. package/lib/module/services/authService.js +602 -1
  167. package/lib/module/services/biometricPinService.js +1 -1
  168. package/lib/module/services/chatGPTConversationExtractor.js +1 -1
  169. package/lib/module/services/chatGPTConversationService.js +1 -1
  170. package/lib/module/services/claudeConversationExtractor.js +1 -1
  171. package/lib/module/services/claudeConversationService.js +1 -1
  172. package/lib/module/services/connectedAccountsService.js +1 -1
  173. package/lib/module/services/googleAuthService.js +1 -1
  174. package/lib/module/services/hingeDataExtractor.js +1 -1
  175. package/lib/module/services/hingeDataService.js +1 -1
  176. package/lib/module/services/imageCompressionService.js +1 -1
  177. package/lib/module/services/instagramDataExtractor.js +1 -1
  178. package/lib/module/services/instagramDataService.js +1 -1
  179. package/lib/module/services/jwtStorageService.js +1 -1
  180. package/lib/module/services/linkedinDOMExtractor.js +1 -1
  181. package/lib/module/services/linkedinProfileService.js +1 -1
  182. package/lib/module/services/linkedinScrapingService.js +1 -1
  183. package/lib/module/services/llmDataStorage.js +1 -1
  184. package/lib/module/services/mobileTrainingService.js +1 -1
  185. package/lib/module/services/oauthService.js +381 -1
  186. package/lib/module/services/pinEncryptionService.js +1 -1
  187. package/lib/module/services/pinStorageUtils.js +1 -1
  188. package/lib/module/services/platformAuthService.js +1 -1
  189. package/lib/module/services/sephoraDataExtractor.js +1 -1
  190. package/lib/module/services/sephoraDataService.js +1 -1
  191. package/lib/module/services/storageService.js +1 -1
  192. package/lib/module/services/telegramDataExtractor.js +1 -1
  193. package/lib/module/services/telegramDataService.js +1 -1
  194. package/lib/module/services/trainingApiHelpers.js +1 -1
  195. package/lib/module/services/userConnectionsService.js +1 -1
  196. package/lib/module/services/youtubeMigrationService.js +1 -1
  197. package/lib/module/theme/index.js +1 -1
  198. package/lib/module/types.js +1 -1
  199. package/lib/module/utils/Portal.js +1 -1
  200. package/lib/module/utils/api.js +1 -1
  201. package/lib/module/utils/assetRegistry.js +1 -1
  202. package/lib/module/utils/auth.js +1 -1
  203. package/lib/module/utils/connectorTests.js +1 -1
  204. package/lib/module/utils/crypto.js +1 -1
  205. package/lib/module/utils/debugHelper.js +1 -1
  206. package/lib/module/utils/encryption.js +1 -1
  207. package/lib/module/utils/eventUtils.js +1 -1
  208. package/lib/module/utils/haptics.js +1 -1
  209. package/lib/module/utils/networkDiagnostics.js +1 -1
  210. package/lib/module/utils/onairosApi.js +1 -1
  211. package/lib/module/utils/programmaticFlow.js +1 -1
  212. package/lib/module/utils/retryHelper.js +1 -1
  213. package/lib/module/utils/secureStorage.js +1 -1
  214. package/lib/module/utils/webviewScripts/chatgpt.js +1 -1
  215. package/lib/module/utils/webviewScripts/claude.js +1 -1
  216. package/lib/module/utils/webviewScripts/hinge.js +1 -1
  217. package/lib/module/utils/webviewScripts/index.js +1 -1
  218. package/lib/module/utils/webviewScripts/instagram.js +1 -1
  219. package/lib/module/utils/webviewScripts/linkedin.js +1 -1
  220. package/lib/module/utils/webviewScripts/sephora.js +1 -1
  221. package/lib/module/utils/webviewScripts/telegram.js +1 -1
  222. package/package.json +1 -1
@@ -1,10 +1,627 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("@react-native-async-storage/async-storage"),
5
- require("../config/api"),
6
- require("./apiKeyService"),
7
- require("./jwtStorageService")
8
- ];
9
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
10
- Object['defineProperty'](exports,_0x2ea1(0x0),{'value':!![]}),exports['verifyToken']=exports['sendEmailVerificationCode']=exports[_0x2ea1(0x1)]=exports['saveAuthToken']=exports[_0x2ea1(0x2)]=exports[_0x2ea1(0x3)]=exports[_0x2ea1(0x4)]=exports[_0x2ea1(0x5)]=exports[_0x2ea1(0x6)]=exports[_0x2ea1(0x7)]=exports[_0x2ea1(0x8)]=exports[_0x2ea1(0x9)]=exports[_0x2ea1(0xa)]=exports[_0x2ea1(0xb)]=exports[_0x2ea1(0xc)]=exports[_0x2ea1(0xd)]=exports[_0x2ea1(0xe)]=exports['authenticateWithApple']=void 0x0;var _asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x0)),_api=__ONAIROS_REQ_FUNC__(0x1),_apiKeyService=__ONAIROS_REQ_FUNC__(0x2),_jwtStorageService=__ONAIROS_REQ_FUNC__(0x3);function _interopRequireDefault(_0x547502){return _0x547502&&_0x547502[_0x2ea1(0x0)]?_0x547502:{'default':_0x547502};}const API_BASE_URL=_api[_0x2ea1(0xf)]['BASE_URL'],waitForSDKInit=async(_0x1babab=0x1f40)=>{const _0x52c44c={'LGYUY':_0x2ea1(0x10),'obYxT':_0x2ea1(0x11),'BTxhM':function(_0x61641c,_0x10e2ae){return _0x61641c!==_0x10e2ae;},'NyyHd':'wUIvj','gCcKr':'UYJpy','TEfQl':_0x2ea1(0x12),'SMSto':function(_0x23ff9a,_0x3369ab){return _0x23ff9a-_0x3369ab;}};if((0x0,_apiKeyService[_0x2ea1(0x13)])())return!![];console['log'](_0x52c44c[_0x2ea1(0x14)]);const _0x58d715=Date['now']();while(Date['now']()-_0x58d715<_0x1babab){if(_0x52c44c['BTxhM'](_0x52c44c['NyyHd'],_0x52c44c[_0x2ea1(0x15)])){await new Promise(_0x8356b=>setTimeout(()=>_0x8356b(),0x1f4));if((0x0,_apiKeyService[_0x2ea1(0x13)])())return console['log'](_0x52c44c[_0x2ea1(0x16)],_0x52c44c[_0x2ea1(0x17)](Date[_0x2ea1(0x18)](),_0x58d715),'ms'),!![];}else{_0x21435e[_0x2ea1(0x19)](_0x52c44c[_0x2ea1(0x1a)],_0x103e0c);throw _0x4a1871;}}return console[_0x2ea1(0x19)]('❌\x20[AUTH]\x20SDK\x20did\x20not\x20initialize\x20within',_0x1babab,'ms'),![];},authenticateWithOnairos=async _0x45086c=>{const _0x1159fe={'hWyNd':_0x2ea1(0x1b),'DrIRB':_0x2ea1(0x1c),'wARGX':function(_0x1fb478,_0x16b68e){return _0x1fb478!==_0x16b68e;},'YNfMn':'aSpqF','FgLym':_0x2ea1(0x1d),'dfPCr':_0x2ea1(0x1e),'CIjmh':_0x2ea1(0x1f),'YdnwP':'🔑\x20Onairos\x20auth\x20token\x20stored:','okzTb':_0x2ea1(0x20),'yPtCw':'❌\x20Onairos\x20authentication\x20error:'};try{if(_0x1159fe['wARGX'](_0x2ea1(0x21),_0x1159fe[_0x2ea1(0x22)])){console[_0x2ea1(0x23)](_0x1159fe[_0x2ea1(0x24)]),await(0x0,_jwtStorageService[_0x2ea1(0x25)])(_0x45086c[_0x2ea1(0x26)]);const _0xc6e867=await _asyncStorage[_0x2ea1(0x27)][_0x2ea1(0x28)](_0x1159fe[_0x2ea1(0x29)]),_0xcd7e10=_0xc6e867||_0x45086c[_0x2ea1(0x2a)][_0x2ea1(0x2b)]('@')[0x0]||_0x1159fe['CIjmh'];return await _asyncStorage['default'][_0x2ea1(0x2c)](_0x1159fe[_0x2ea1(0x29)],_0xcd7e10),await _asyncStorage['default'][_0x2ea1(0x2c)](_0x2ea1(0x2d),_0x45086c[_0x2ea1(0x2a)]),console[_0x2ea1(0x23)](_0x1159fe[_0x2ea1(0x2e)],_0x45086c[_0x2ea1(0x26)][_0x2ea1(0x2f)](0x0,0x14)+_0x2ea1(0x30)),console['log'](_0x1159fe[_0x2ea1(0x31)],{'email':_0x45086c['email'],'username':_0xcd7e10}),{'token':_0x45086c['token'],'user':{'id':Date['now']()[_0x2ea1(0x32)](),'name':_0xcd7e10,'email':_0x45086c[_0x2ea1(0x2a)],'profilePicture':''}};}else return _0x2868cf[_0x2ea1(0x23)](_0x1159fe[_0x2ea1(0x33)],_0x36a00d[_0x2ea1(0x19)]||_0x20dcf7[_0x2ea1(0x34)]),{'success':![],'message':_0x2aa4d9[_0x2ea1(0x19)]||_0x9f245b['message']||_0x1159fe[_0x2ea1(0x35)]};}catch(_0xd4f1bb){console[_0x2ea1(0x19)](_0x1159fe['yPtCw'],_0xd4f1bb);throw _0xd4f1bb;}};exports['authenticateWithOnairos']=authenticateWithOnairos;const authenticateWithOnairosSignIn=async _0x48ade5=>{const _0x3d4c33={'BFPuQ':_0x2ea1(0x36),'cOwwa':'admin@onairos.uk','cXtxV':_0x2ea1(0x37),'rIJUQ':_0x2ea1(0x38),'FBMSB':_0x2ea1(0x39),'hUBRZ':function(_0x38656f,_0x3a6cd7,_0x56e0ca){return _0x38656f(_0x3a6cd7,_0x56e0ca);},'IAZwT':function(_0x1dabb8,_0x1f5531){return _0x1dabb8!==_0x1f5531;},'JgJpv':'woyDs','jKaFs':'Onairos\x20sign-in\x20failed','pocss':_0x2ea1(0x3a),'dTzJn':function(_0x10308b,_0x431477){return _0x10308b!==_0x431477;},'QEbDE':_0x2ea1(0x3b),'XqdXj':'No\x20authentication\x20token\x20returned\x20from\x20Onairos\x20sign-in','bOuhk':_0x2ea1(0x1e),'yjuxp':_0x2ea1(0x2d),'ehGbJ':'🔑\x20Onairos\x20sign-in\x20token\x20stored:','wbImQ':function(_0xb9311f,_0x51853f){return _0xb9311f===_0x51853f;},'fMXAj':_0x2ea1(0x3c),'oLDaH':_0x2ea1(0x3d)};try{console[_0x2ea1(0x23)](_0x3d4c33[_0x2ea1(0x3e)]);const _0x3f7bc2=await _0x3d4c33[_0x2ea1(0x3f)](fetch,API_BASE_URL+_0x2ea1(0x40),{'method':'POST','headers':(0x0,_api[_0x2ea1(0x41)])(),'body':JSON[_0x2ea1(0x42)](_0x48ade5)});if(!_0x3f7bc2['ok']){if(_0x3d4c33[_0x2ea1(0x43)](_0x3d4c33[_0x2ea1(0x44)],_0x3d4c33[_0x2ea1(0x44)]))_0x4dc5a1['warn'](_0x2ea1(0x45)+_0x4fc50c+_0x2ea1(0x46));else{const _0x4d0610=await _0x3f7bc2[_0x2ea1(0x47)]();throw new Error(_0x4d0610[_0x2ea1(0x19)]||_0x3d4c33[_0x2ea1(0x48)]);}}const _0x3e4039=await _0x3f7bc2[_0x2ea1(0x47)]();console[_0x2ea1(0x23)](_0x3d4c33[_0x2ea1(0x49)]);if(!_0x3e4039['token']){if(_0x3d4c33[_0x2ea1(0x4a)](_0x2ea1(0x3b),_0x3d4c33[_0x2ea1(0x4b)]))return _0x205699[_0x2ea1(0x19)](_0x2ea1(0x4c),_0x17303d),null;else throw new Error(_0x3d4c33[_0x2ea1(0x4d)]);}return await(0x0,_jwtStorageService[_0x2ea1(0x25)])(_0x3e4039[_0x2ea1(0x26)]),_0x3e4039[_0x2ea1(0x4e)]&&await _asyncStorage[_0x2ea1(0x27)][_0x2ea1(0x2c)](_0x3d4c33[_0x2ea1(0x4f)],_0x3e4039[_0x2ea1(0x4e)]),await _asyncStorage[_0x2ea1(0x27)]['setItem'](_0x3d4c33[_0x2ea1(0x50)],_0x48ade5[_0x2ea1(0x2a)]),console[_0x2ea1(0x23)](_0x3d4c33[_0x2ea1(0x51)],_0x3e4039[_0x2ea1(0x26)][_0x2ea1(0x2f)](0x0,0x14)+'...'),{'token':_0x3e4039[_0x2ea1(0x26)],'user':{'id':Date[_0x2ea1(0x18)]()[_0x2ea1(0x32)](),'name':_0x3e4039[_0x2ea1(0x4e)],'email':_0x48ade5['email'],'profilePicture':''}};}catch(_0x15a990){if(_0x3d4c33[_0x2ea1(0x52)](_0x3d4c33[_0x2ea1(0x53)],_0x3d4c33[_0x2ea1(0x53)])){console[_0x2ea1(0x19)](_0x3d4c33[_0x2ea1(0x54)],_0x15a990);throw _0x15a990;}else{if(!_0x1f6a24)return _0x303571['log']('🔒\x20[Admin\x20Check]\x20No\x20email\x20provided'),![];const _0x4df221=[_0x3d4c33[_0x2ea1(0x55)],_0x2ea1(0x56),_0x2ea1(0x57),_0x3d4c33[_0x2ea1(0x58)]],_0x189066=_0x4df221[_0x2ea1(0x59)](_0xddea6[_0x2ea1(0x5a)]());return _0x189066?_0x49b807['log'](_0x3d4c33['cXtxV'],_0x468fbf):_0x91a746['log'](_0x3d4c33[_0x2ea1(0x5b)],_0x232b03),_0x189066;}}};exports[_0x2ea1(0xd)]=authenticateWithOnairosSignIn;const authenticateWithApple=async _0x532aca=>{const _0x3a6dff={'CKcHY':_0x2ea1(0x1f),'dnmrz':function(_0x1af11e,_0x3ff001,_0x41f91d){return _0x1af11e(_0x3ff001,_0x41f91d);},'pMfCj':function(_0x3bf51f,_0x47c26d){return _0x3bf51f===_0x47c26d;},'GdHtJ':'FgVSL','szkfn':'Apple\x20authentication\x20failed','MKUrD':_0x2ea1(0x5c),'CZpzk':function(_0x5c6311,_0x31a0f6){return _0x5c6311===_0x31a0f6;},'HhkQo':function(_0x4a3f90,_0x5bbabf){return _0x4a3f90===_0x5bbabf;},'sjqLY':_0x2ea1(0x2d),'hxnoP':function(_0x3e0ca9,_0x9eb9bc){return _0x3e0ca9===_0x9eb9bc;},'oIvwF':function(_0x49c44f,_0xc94484){return _0x49c44f===_0xc94484;},'smyzw':function(_0x4344c5,_0x4bede6){return _0x4344c5===_0x4bede6;},'MPmkX':_0x2ea1(0x5d)};try{var _0x47e54a,_0xa43dd6,_0x2c0fff,_0x583062;const _0x986a00=_0x532aca[_0x2ea1(0x5e)]?((_0x532aca[_0x2ea1(0x5e)][_0x2ea1(0x5f)]||'')+'\x20'+(_0x532aca[_0x2ea1(0x5e)][_0x2ea1(0x60)]||''))[_0x2ea1(0x61)]():_0x3a6dff[_0x2ea1(0x62)];console['log']('🍎\x20Authenticating\x20with\x20Apple\x20via\x20generic\x20SDK\x20endpoint...');const _0x54bd72=await _0x3a6dff[_0x2ea1(0x63)](fetch,API_BASE_URL+_0x2ea1(0x64),{'method':'POST','headers':(0x0,_api[_0x2ea1(0x41)])(),'body':JSON['stringify']({'idToken':_0x532aca[_0x2ea1(0x65)],'nonce':_0x532aca[_0x2ea1(0x66)],'name':_0x986a00,'email':_0x532aca['email']})});if(!_0x54bd72['ok']){if(_0x3a6dff[_0x2ea1(0x67)](_0x2ea1(0x68),_0x3a6dff[_0x2ea1(0x69)])){const _0x5ebace=await _0x54bd72['json']();throw new Error(_0x5ebace['error']||_0x3a6dff[_0x2ea1(0x6a)]);}else return _0x596124[_0x2ea1(0x23)](_0x2ea1(0x6b),_0x5c6486[_0x2ea1(0x2f)](0x0,0x14)+_0x2ea1(0x30)),_0x1dee70;}const _0x4f03fe=await _0x54bd72[_0x2ea1(0x47)]();console[_0x2ea1(0x23)](_0x3a6dff[_0x2ea1(0x6c)]);if(!_0x4f03fe[_0x2ea1(0x26)])throw new Error('No\x20authentication\x20token\x20returned\x20from\x20Apple\x20auth');await(0x0,_jwtStorageService[_0x2ea1(0x25)])(_0x4f03fe['token']);const _0x28a844=((_0x47e54a=_0x4f03fe['user'])===null||_0x3a6dff[_0x2ea1(0x6d)](_0x47e54a,void 0x0)?void 0x0:_0x47e54a[_0x2ea1(0x4e)])||_0x4f03fe[_0x2ea1(0x4e)]||_0x986a00;await _asyncStorage['default'][_0x2ea1(0x2c)]('onairos_username',_0x28a844);const _0x1501eb=(_0x3a6dff[_0x2ea1(0x67)](_0xa43dd6=_0x4f03fe['user'],null)||_0x3a6dff[_0x2ea1(0x6e)](_0xa43dd6,void 0x0)?void 0x0:_0xa43dd6[_0x2ea1(0x2a)])||_0x532aca['email']||_0x2ea1(0x6f)+_0x532aca[_0x2ea1(0x70)]+_0x2ea1(0x71);return await _asyncStorage[_0x2ea1(0x27)]['setItem'](_0x3a6dff[_0x2ea1(0x72)],_0x1501eb),console[_0x2ea1(0x23)](_0x2ea1(0x73),_0x4f03fe['token'][_0x2ea1(0x2f)](0x0,0x14)+_0x2ea1(0x30)),{'success':!![],'token':_0x4f03fe[_0x2ea1(0x26)],'user':{'id':(_0x3a6dff[_0x2ea1(0x74)](_0x2c0fff=_0x4f03fe[_0x2ea1(0x70)],null)||_0x3a6dff[_0x2ea1(0x6d)](_0x2c0fff,void 0x0)?void 0x0:_0x2c0fff['id'])||'','odeanId':_0x3a6dff['oIvwF'](_0x583062=_0x4f03fe[_0x2ea1(0x70)],null)||_0x3a6dff['smyzw'](_0x583062,void 0x0)?void 0x0:_0x583062[_0x2ea1(0x75)],'email':_0x1501eb,'username':_0x28a844},'isNewUser':_0x4f03fe[_0x2ea1(0x76)]||![]};}catch(_0x5a4d6d){console[_0x2ea1(0x19)](_0x3a6dff[_0x2ea1(0x77)],_0x5a4d6d);throw _0x5a4d6d;}};exports[_0x2ea1(0x78)]=authenticateWithApple;const saveAuthToken=async _0x38c6bc=>{const _0x2e17c4={'mNAuK':'auth_token','XnPMD':'Error\x20saving\x20auth\x20token:'};try{await _asyncStorage[_0x2ea1(0x27)][_0x2ea1(0x2c)](_0x2e17c4[_0x2ea1(0x79)],_0x38c6bc);}catch(_0x35eebc){console[_0x2ea1(0x19)](_0x2e17c4[_0x2ea1(0x7a)],_0x35eebc);throw _0x35eebc;}};function _0x379b(){const _0x2e2ef3=['__esModule','saveOnairosUsername','saveAdminStatus','removeAuthToken','isAuthenticated','isAdminEmail','getOnairosUsername','getAuthToken','getAdminStatus','ensureAuthentication','debugAuthStorage','confirmEmailVerificationCode','clearAllAuthTokens','authenticateWithOnairosSignIn','authenticateWithOnairos','API_CONFIG','Error\x20saving\x20auth\x20token:','⏳\x20[AUTH]\x20SDK\x20not\x20yet\x20initialized,\x20waiting...','✅\x20[AUTH]\x20SDK\x20initialized\x20after','isApiKeyInitialized','obYxT','gCcKr','TEfQl','SMSto','now','error','LGYUY','❌\x20[CODE\x20VERIFY]\x20Server\x20error:','Invalid\x20verification\x20code','🔑\x20Authenticating\x20with\x20Onairos...','onairos_username','Onairos\x20User','👤\x20User\x20info:','SUHfp','YNfMn','log','FgLym','storeJWT','token','default','getItem','dfPCr','email','split','setItem','user_email','YdnwP','substring','...','okzTb','toString','hWyNd','message','DrIRB','nicholas.berry@onairos.uk','🔑\x20[Admin\x20Check]\x20Admin\x20access\x20granted\x20for:','🚫\x20[Admin\x20Check]\x20No\x20admin\x20access\x20for:','🔑\x20Signing\x20in\x20with\x20Onairos\x20via\x20/login/signin\x20endpoint...','✅\x20Onairos\x20sign-in\x20successful','xLysT','GfnHO','❌\x20Onairos\x20sign-in\x20error:','FBMSB','hUBRZ','/login/signin','getApiHeaders','stringify','IAZwT','JgJpv','⚠️\x20[',']\x20No\x20valid\x20authentication\x20available\x20-\x20API\x20call\x20may\x20return\x20limited\x20data','json','jKaFs','pocss','dTzJn','QEbDE','Error\x20getting\x20Onairos\x20username:','XqdXj','username','bOuhk','yjuxp','ehGbJ','wbImQ','fMXAj','oLDaH','BFPuQ','zion.darko@onairos.uk','admin@enoch.events','cOwwa','includes','toLowerCase','rIJUQ','✅\x20Apple\x20authentication\x20successful','❌\x20Apple\x20authentication\x20error:','fullName','givenName','familyName','trim','CKcHY','dnmrz','/register/apple','identityToken','nonce','pMfCj','FgVSL','GdHtJ','szkfn','✅\x20[AUTH]\x20Found\x20JWT\x20token:','MKUrD','CZpzk','HhkQo','apple_','user','@privaterelay.apple.com','sjqLY','🔑\x20Apple\x20auth\x20token\x20stored:','hxnoP','odeanId','isNewUser','MPmkX','authenticateWithApple','mNAuK','XnPMD','saveAuthToken','🔍\x20[AUTH\x20STORAGE\x20DEBUG]\x20Checking\x20all\x20auth-related\x20storage:','🔑\x20sdk_jwt_token:','null','🔑\x20onairos_username:','🔑\x20auth_method:','ZwJBT','PMGxS','tRryz','xCLSa','auth_method','...\x22','hMeqD','Aorqd','WzjLO','ewSsp','rkHUQ','kFWRO','length','🔍\x20Token\x20appears\x20to\x20be\x20valid\x20JWT:','aasVY','🧹\x20[AUTH]\x20Clearing\x20all\x20auth\x20tokens...','lYbKY','clearJWT','multiRemove','IVaHE','onairos_user','Xbjwo','Error\x20removing\x20auth\x20token:','🔍\x20[CODE\x20VERIFY]\x20Headers\x20OK','❌\x20[AUTH]\x20No\x20valid\x20JWT\x20token\x20found','JfiAp','❌\x20[AUTH]\x20Error\x20during\x20token\x20retrieval:','rmtbU','kVEMm','JkgEx','getJWT','mWIwQ','warn','wqCIj','jjxkW','hCMqU','getDeveloperAuthHeaders','miobR','auth_token','cVeQI','removeItem','ysRAW','cynOs','PsyuL','HVTZy','Imsbh','fhUwD','aeftl','DQiil','ZEBiM','SWmNv','✅\x20[',']\x20Authentication\x20validated\x20for\x20API\x20call','SDK\x20is\x20still\x20initializing.\x20Please\x20wait\x20a\x20moment\x20and\x20try\x20again.','RGfBo','uFFar','🔒\x20[TOKEN\x20VERIFY]\x20No\x20token\x20available\x20for\x20verification','🔒\x20[TOKEN\x20VERIFY]\x20Token\x20preview:','🔒\x20[TOKEN\x20VERIFY]\x20Verification\x20response\x20status:','waqkH','ASmje','HFwHT','uPPwT','GMUic','MHeLw','CehKG','❌\x20[AUTH\x20VALIDATION]\x20Error\x20checking\x20authentication\x20status:','lreaA','KspfF','/api/auth/verify','getAuthHeaders','oGaJK','status','✅\x20[TOKEN\x20VERIFY]\x20Token\x20is\x20valid','Uzxot','oPphr','text','❌\x20[TOKEN\x20VERIFY]\x20Token\x20verification\x20failed:','uXGVO','LMjYz','DLZOg','❌\x20[TOKEN\x20VERIFY]\x20Token\x20verification\x20error:','❌\x20[EMAIL\x20VERIFY]\x20Failed\x20to\x20get\x20auth\x20headers:','RXdCt','🔒\x20[Admin\x20Check]\x20No\x20email\x20provided','RaxEV','DVbjU','ciSHu','user_admin_status','true','Error\x20getting\x20admin\x20status:','PYINw','FagVY','cNWbx','jvArV','Bkgfq','USNAq','OidFf','FnLbZ','GDhuI','nirpY','RkpPD','Error\x20saving\x20Onairos\x20username:','MBHPC','📧\x20[EMAIL\x20VERIFY]\x20Sending\x20verification\x20code\x20to:','📧\x20[EMAIL\x20VERIFY]\x20URL:','IBLoV','MmmAc','📧\x20[EMAIL\x20VERIFY]\x20Headers\x20OK,\x20key:','SDK\x20not\x20properly\x20initialized.\x20Please\x20restart\x20the\x20app\x20and\x20try\x20again.','JjFBH','zvDvu','📧\x20[EMAIL\x20VERIFY]\x20Response\x20status:','✅\x20[EMAIL\x20VERIFY]\x20Verification\x20code\x20sent\x20successfully','❌\x20[EMAIL\x20VERIFY]\x20Server\x20error:','TIMEOUT','❌\x20[EMAIL\x20VERIFY]\x20All\x20retries\x20exhausted:','Network\x20error.\x20Please\x20check\x20your\x20connection\x20and\x20try\x20again.','Network\x20error.\x20Please\x20try\x20again.','PNxxq','zvgRT','REMgZ','tYUBV','DoItQ','PlElQ','DPQku','PsgMK','nnWYH','XBqDv','jilVY','WNBJz','FjPPd','gLHcQ','request','TGsxW','hNwiR','FQhgx','IgWZy','📧\x20[EMAIL\x20VERIFY]\x20Attempt\x20','yFXEH','signal','ddWsh','IMRrL','success','zGXvO','vnwZr','Failed\x20to\x20send\x20verification\x20code','Gdbyl','name','AbortError','❌\x20[EMAIL\x20VERIFY]\x20Attempt\x20','PQEuR','gbJun','huOzC','xWbfa','MAcYD','🔄\x20[EMAIL\x20VERIFY]\x20Retrying\x20in\x20','ms...','qbLPt','sendEmailVerificationCode','❌\x20[CODE\x20VERIFY]\x20Failed\x20to\x20get\x20auth\x20headers:','jdLEk','oqmSp','🔍\x20[CODE\x20VERIFY]\x20Response\x20data:','iGXWk','✅\x20[CODE\x20VERIFY]\x20Email\x20verification\x20successful','returning_user','onboarding','EjUBG','KueWs','Verification\x20failed.\x20Please\x20check\x20your\x20connection\x20and\x20try\x20again.','Verification\x20failed.\x20Please\x20try\x20again.','jzjcE','gahkd','dKjWT','uykBk','Vdigg','HQYou','UewEW','/email/verification','RcLTC','YWCAt','🔍\x20[CODE\x20VERIFY]\x20Attempt\x20','WQKpR','🔍\x20[CODE\x20VERIFY]\x20Response\x20status:','oiQFO','jwtToken','nkOlx','LApuh','JQKcU','IciRP','existingUser','DPfbA','accountInfo','klHcC','existingUserData','GHWpv','FDunx','BRXyY','XizQZ','enochInstructions','JVtxI','TpVJL','mjlEv','MEKSE','LKeXB','❌\x20[CODE\x20VERIFY]\x20Attempt\x20','\x20failed:','XPoEF','Lbckb','woZWr','zcbef'];_0x379b=function(){return _0x2e2ef3;};return _0x379b();}exports[_0x2ea1(0x7b)]=saveAuthToken;const debugAuthStorage=async()=>{const _0x5ac9fa={'aasVY':'Error\x20saving\x20admin\x20status:','PMGxS':_0x2ea1(0x7c),'RpFbz':'sdk_jwt_token','tRryz':_0x2ea1(0x2d),'xCLSa':_0x2ea1(0x1e),'SJxRl':_0x2ea1(0x7d),'hMeqD':_0x2ea1(0x7e),'Aorqd':'🔑\x20user_email:','WzjLO':_0x2ea1(0x7f),'YcqIn':_0x2ea1(0x80),'ewSsp':function(_0x567b40,_0x7d3c57){return _0x567b40!==_0x7d3c57;},'AcIep':_0x2ea1(0x81),'kFWRO':function(_0x1f6a9d,_0x2e8848){return _0x1f6a9d===_0x2e8848;}};console[_0x2ea1(0x23)](_0x5ac9fa[_0x2ea1(0x82)]);const _0x560fae=await _asyncStorage['default']['getItem'](_0x5ac9fa['RpFbz']),_0x22cd41=await _asyncStorage[_0x2ea1(0x27)][_0x2ea1(0x28)](_0x5ac9fa[_0x2ea1(0x83)]),_0x367589=await _asyncStorage['default']['getItem'](_0x5ac9fa[_0x2ea1(0x84)]),_0x3c21eb=await _asyncStorage['default'][_0x2ea1(0x28)](_0x2ea1(0x85));console[_0x2ea1(0x23)](_0x5ac9fa['SJxRl'],_0x560fae?'\x22'+_0x560fae['substring'](0x0,0x1e)+_0x2ea1(0x86):_0x5ac9fa[_0x2ea1(0x87)]),console[_0x2ea1(0x23)](_0x5ac9fa[_0x2ea1(0x88)],_0x22cd41?'\x22'+_0x22cd41+'\x22':_0x2ea1(0x7e)),console['log'](_0x5ac9fa[_0x2ea1(0x89)],_0x367589?'\x22'+_0x367589+'\x22':_0x2ea1(0x7e)),console[_0x2ea1(0x23)](_0x5ac9fa['YcqIn'],_0x3c21eb?'\x22'+_0x3c21eb+'\x22':_0x5ac9fa[_0x2ea1(0x87)]);if(_0x560fae){if(_0x5ac9fa[_0x2ea1(0x8a)](_0x5ac9fa['AcIep'],_0x2ea1(0x8b))){const _0x15a28f=_0x5ac9fa[_0x2ea1(0x8c)](_0x560fae[_0x2ea1(0x2b)]('.')[_0x2ea1(0x8d)],0x3);console[_0x2ea1(0x23)](_0x2ea1(0x8e),_0x15a28f);}else _0x44ac8c[_0x2ea1(0x19)](_0x5ac9fa[_0x2ea1(0x8f)],_0x242152);}};exports[_0x2ea1(0xa)]=debugAuthStorage;const clearAllAuthTokens=async()=>{const _0x4c4f00={'lYbKY':_0x2ea1(0x90),'IVaHE':_0x2ea1(0x1e),'Xbjwo':'✅\x20[AUTH]\x20All\x20auth\x20tokens\x20and\x20data\x20cleared'};console[_0x2ea1(0x23)](_0x4c4f00[_0x2ea1(0x91)]),await(0x0,_jwtStorageService[_0x2ea1(0x92)])(),await _asyncStorage[_0x2ea1(0x27)][_0x2ea1(0x93)]([_0x2ea1(0x2d),_0x4c4f00[_0x2ea1(0x94)],_0x2ea1(0x85),_0x2ea1(0x95)]),console['log'](_0x4c4f00[_0x2ea1(0x96)]);};exports[_0x2ea1(0xc)]=clearAllAuthTokens;const getAuthToken=async()=>{const _0x128175={'JkgEx':_0x2ea1(0x97),'oKxxf':_0x2ea1(0x98),'rmtbU':function(_0x46d3ea,_0x47427f){return _0x46d3ea!==_0x47427f;},'kVEMm':'uuwZH','mWIwQ':'✅\x20[AUTH]\x20Found\x20JWT\x20token:','wqCIj':_0x2ea1(0x99),'jjxkW':function(_0x470280,_0x32461a){return _0x470280===_0x32461a;},'XqWSQ':_0x2ea1(0x9a),'hCMqU':_0x2ea1(0x9b)};try{if(_0x128175[_0x2ea1(0x9c)](_0x128175[_0x2ea1(0x9d)],_0x128175['kVEMm']))_0x3db869[_0x2ea1(0x19)](_0x128175[_0x2ea1(0x9e)],_0x48577c);else{const _0x1ef8fe=await(0x0,_jwtStorageService[_0x2ea1(0x9f)])();if(_0x1ef8fe)return console['log'](_0x128175[_0x2ea1(0xa0)],_0x1ef8fe['substring'](0x0,0x14)+_0x2ea1(0x30)),_0x1ef8fe;return console[_0x2ea1(0xa1)](_0x128175[_0x2ea1(0xa2)]),null;}}catch(_0xbfd386){if(_0x128175[_0x2ea1(0xa3)](_0x128175['XqWSQ'],_0x2ea1(0x9a)))return console[_0x2ea1(0x19)](_0x128175[_0x2ea1(0xa4)],_0xbfd386),null;else _0x38215e=(0x0,_0x250bd8[_0x2ea1(0xa5)])(),_0x27f2da[_0x2ea1(0x23)](_0x128175['oKxxf']);}};exports[_0x2ea1(0x7)]=getAuthToken;const removeAuthToken=async()=>{const _0x278f2b={'Imsbh':'Error\x20saving\x20Onairos\x20username:','cVeQI':_0x2ea1(0xa6),'ysRAW':_0x2ea1(0xa7),'cynOs':function(_0x31932c,_0x1be9ad){return _0x31932c===_0x1be9ad;},'PsyuL':'uJWyo','HVTZy':'Error\x20removing\x20auth\x20token:'};try{if(_0x278f2b[_0x2ea1(0xa8)]===_0x2ea1(0xa6))await _asyncStorage[_0x2ea1(0x27)][_0x2ea1(0xa9)](_0x278f2b[_0x2ea1(0xaa)]);else return _0x421ccb&&_0x1a9724['__esModule']?_0x284102:{'default':_0x14e82e};}catch(_0x4ca5bc){_0x278f2b[_0x2ea1(0xab)](_0x278f2b[_0x2ea1(0xac)],_0x278f2b[_0x2ea1(0xac)])?console[_0x2ea1(0x19)](_0x278f2b[_0x2ea1(0xad)],_0x4ca5bc):_0x2f518d['error'](_0x278f2b[_0x2ea1(0xae)],_0x5ca5e5);}};exports[_0x2ea1(0x3)]=removeAuthToken;const isAuthenticated=async()=>{const _0x511c07={'joybI':function(_0x86d713){return _0x86d713();},'OEvSi':function(_0x3f7c45,_0x2f0dc9){return _0x3f7c45!==_0x2f0dc9;},'fhUwD':function(_0xa30159,_0x41dd03){return _0xa30159>_0x41dd03;},'aeftl':'❌\x20[AUTH\x20VALIDATION]\x20Error\x20checking\x20authentication\x20status:'};try{const _0x38fbfd=await _0x511c07['joybI'](getAuthToken);return _0x511c07['OEvSi'](_0x38fbfd,null)&&_0x511c07[_0x2ea1(0xaf)](_0x38fbfd['length'],0x32);}catch(_0x279f68){return console[_0x2ea1(0x19)](_0x511c07[_0x2ea1(0xb0)],_0x279f68),![];}};function _0x2ea1(_0x379b06,_0x2ea14f){_0x379b06=_0x379b06-0x0;const _0xc4541=_0x379b();let _0x522f7b=_0xc4541[_0x379b06];return _0x522f7b;}exports['isAuthenticated']=isAuthenticated;const ensureAuthentication=async _0x126124=>{const _0x137c75={'bqbnD':'Error\x20getting\x20admin\x20status:','DQiil':function(_0x383168){return _0x383168();},'ZEBiM':function(_0x16ec61,_0x324837){return _0x16ec61!==_0x324837;},'SWmNv':'IzcpP'},_0x502a8b=await _0x137c75[_0x2ea1(0xb1)](isAuthenticated);if(!_0x502a8b)console[_0x2ea1(0xa1)](_0x2ea1(0x45)+_0x126124+']\x20No\x20valid\x20authentication\x20available\x20-\x20API\x20call\x20may\x20return\x20limited\x20data');else{if(_0x137c75[_0x2ea1(0xb2)](_0x137c75[_0x2ea1(0xb3)],_0x137c75[_0x2ea1(0xb3)]))return _0x4f20aa[_0x2ea1(0x19)](_0x137c75['bqbnD'],_0x3c3875),![];else console[_0x2ea1(0x23)](_0x2ea1(0xb4)+_0x126124+_0x2ea1(0xb5));}return _0x502a8b;};exports['ensureAuthentication']=ensureAuthentication;const verifyToken=async()=>{const _0x5e2ddf={'uPPwT':_0x2ea1(0xb6),'uXGVO':_0x2ea1(0x3d),'LMjYz':function(_0x10f8ec,_0x39603e){return _0x10f8ec===_0x39603e;},'RXdCt':function(_0xe7eab6,_0x34fa38){return _0xe7eab6===_0x34fa38;},'HFwHT':_0x2ea1(0xb7),'GMUic':function(_0x3d1694){return _0x3d1694();},'MHeLw':_0x2ea1(0xb8),'CehKG':_0x2ea1(0xb9),'xUxUU':'🔒\x20[TOKEN\x20VERIFY]\x20Verifying\x20token\x20with\x20backend...','lreaA':_0x2ea1(0xba),'KspfF':function(_0x1a897c,_0x26ad75,_0x2342d3){return _0x1a897c(_0x26ad75,_0x2342d3);},'oGaJK':_0x2ea1(0xbb),'Uzxot':'gHByp','oPphr':_0x2ea1(0xbc),'DLZOg':_0x2ea1(0xbd)};try{if('RGfBo'!==_0x5e2ddf[_0x2ea1(0xbe)])return{'success':![],'message':_0x5e2ddf[_0x2ea1(0xbf)]};else{const _0x396b63=await _0x5e2ddf[_0x2ea1(0xc0)](getAuthToken);if(!_0x396b63)return'BLPvh'!==_0x5e2ddf[_0x2ea1(0xc1)]?(console[_0x2ea1(0xa1)](_0x5e2ddf[_0x2ea1(0xc2)]),![]):(_0x3437b8[_0x2ea1(0x19)](_0x2ea1(0xc3),_0x5c387d),![]);console[_0x2ea1(0x23)](_0x5e2ddf['xUxUU']),console[_0x2ea1(0x23)](_0x5e2ddf[_0x2ea1(0xc4)],_0x396b63[_0x2ea1(0x2f)](0x0,0x14)+'...');const _0x2a9874=await _0x5e2ddf[_0x2ea1(0xc5)](fetch,API_BASE_URL+_0x2ea1(0xc6),{'method':'GET','headers':(0x0,_api[_0x2ea1(0xc7)])(_0x396b63)});console[_0x2ea1(0x23)](_0x5e2ddf[_0x2ea1(0xc8)],_0x2a9874[_0x2ea1(0xc9)]);if(_0x2a9874['ok'])return console[_0x2ea1(0x23)](_0x2ea1(0xca)),!![];else{if(_0x5e2ddf[_0x2ea1(0xcb)]!==_0x5e2ddf[_0x2ea1(0xcc)]){const _0xf7f245=await _0x2a9874[_0x2ea1(0xcd)]();return console[_0x2ea1(0xa1)](_0x2ea1(0xce),_0x2a9874['status'],_0xf7f245),![];}else{_0xd1133b['error'](_0x5e2ddf[_0x2ea1(0xcf)],_0x31940d);throw _0x2272b2;}}}}catch(_0x5c67c){return _0x5e2ddf[_0x2ea1(0xd0)](_0x5e2ddf['DLZOg'],_0x5e2ddf[_0x2ea1(0xd1)])?(console['error'](_0x2ea1(0xd2),_0x5c67c),![]):(_0x181cb1[_0x2ea1(0x19)](_0x2ea1(0xd3),_0x5e2ddf[_0x2ea1(0xd0)](_0x410c58,null)||_0x5e2ddf[_0x2ea1(0xd4)](_0x31a12f,void 0x0)?void 0x0:_0x3dccba[_0x2ea1(0x34)]),{'success':![],'message':'SDK\x20not\x20properly\x20initialized.\x20Please\x20restart\x20the\x20app\x20and\x20try\x20again.'});}};exports['verifyToken']=verifyToken;const isAdminEmail=_0x558cf0=>{const _0x3357e9={'lMsoI':_0x2ea1(0xd5),'IVOHC':_0x2ea1(0x36),'RaxEV':_0x2ea1(0x57),'DVbjU':'admin@onairos.uk','ciSHu':'🚫\x20[Admin\x20Check]\x20No\x20admin\x20access\x20for:'};if(!_0x558cf0)return console['log'](_0x3357e9['lMsoI']),![];const _0xe6fe2c=[_0x3357e9['IVOHC'],_0x2ea1(0x56),_0x3357e9[_0x2ea1(0xd6)],_0x3357e9[_0x2ea1(0xd7)]],_0xeddad0=_0xe6fe2c[_0x2ea1(0x59)](_0x558cf0['toLowerCase']());return _0xeddad0?console['log'](_0x2ea1(0x37),_0x558cf0):console['log'](_0x3357e9[_0x2ea1(0xd8)],_0x558cf0),_0xeddad0;};exports[_0x2ea1(0x5)]=isAdminEmail;const getAdminStatus=async()=>{const _0x5d6d40={'PYINw':_0x2ea1(0xd9),'FagVY':function(_0x4d7418,_0x1abd38){return _0x4d7418===_0x1abd38;},'cNWbx':_0x2ea1(0xda),'jvArV':_0x2ea1(0xdb)};try{const _0xd3bb79=await _asyncStorage[_0x2ea1(0x27)][_0x2ea1(0x28)](_0x5d6d40[_0x2ea1(0xdc)]);return _0x5d6d40[_0x2ea1(0xdd)](_0xd3bb79,_0x5d6d40[_0x2ea1(0xde)]);}catch(_0x158dd9){return console[_0x2ea1(0x19)](_0x5d6d40[_0x2ea1(0xdf)],_0x158dd9),![];}};exports[_0x2ea1(0x8)]=getAdminStatus;const saveAdminStatus=async _0x4f7f72=>{const _0x4f7f8a={'USNAq':_0x2ea1(0xd9),'OidFf':function(_0x503fa9,_0x5967f2){return _0x503fa9===_0x5967f2;},'FnLbZ':_0x2ea1(0xe0),'GDhuI':'Error\x20saving\x20admin\x20status:'};try{await _asyncStorage[_0x2ea1(0x27)][_0x2ea1(0x2c)](_0x4f7f8a[_0x2ea1(0xe1)],_0x4f7f72['toString']());}catch(_0x13b9b8){if(_0x4f7f8a[_0x2ea1(0xe2)](_0x4f7f8a[_0x2ea1(0xe3)],_0x4f7f8a[_0x2ea1(0xe3)]))console[_0x2ea1(0x19)](_0x4f7f8a[_0x2ea1(0xe4)],_0x13b9b8);else return _0x29e115['error'](_0x2ea1(0x9b),_0xca34b7),null;}};exports[_0x2ea1(0x2)]=saveAdminStatus;const getOnairosUsername=async()=>{const _0x2bb17f={'nirpY':_0x2ea1(0x1e),'RkpPD':_0x2ea1(0x4c)};try{return await _asyncStorage[_0x2ea1(0x27)][_0x2ea1(0x28)](_0x2bb17f[_0x2ea1(0xe5)]);}catch(_0xb9cc4d){return console[_0x2ea1(0x19)](_0x2bb17f[_0x2ea1(0xe6)],_0xb9cc4d),null;}};exports[_0x2ea1(0x6)]=getOnairosUsername;const saveOnairosUsername=async _0x5789e6=>{const _0x18f72c={'MBHPC':_0x2ea1(0xe7)};try{await _asyncStorage[_0x2ea1(0x27)][_0x2ea1(0x2c)]('onairos_username',_0x5789e6);}catch(_0x544328){console[_0x2ea1(0x19)](_0x18f72c[_0x2ea1(0xe8)],_0x544328);}};exports[_0x2ea1(0x1)]=saveOnairosUsername;const sendEmailVerificationCode=async _0x2cd951=>{const _0x20ddc6={'PlElQ':_0x2ea1(0xb6),'WNBJz':'No\x20authentication\x20token\x20returned\x20from\x20Onairos\x20sign-in','IgWZy':_0x2ea1(0x38),'xWbfa':_0x2ea1(0x5d),'PNxxq':_0x2ea1(0xe9),'zvgRT':_0x2ea1(0xea),'REMgZ':function(_0x3878ef){return _0x3878ef();},'tYUBV':function(_0x34b6e0,_0x3ab426){return _0x34b6e0!==_0x3ab426;},'DoItQ':_0x2ea1(0xeb),'mhoZC':'QMtet','DPQku':_0x2ea1(0xec),'pWiLq':_0x2ea1(0xed),'PsgMK':function(_0x48a4a3,_0x193dfa){return _0x48a4a3+_0x193dfa;},'nnWYH':function(_0x492d35,_0x1e891c){return _0x492d35===_0x1e891c;},'XBqDv':function(_0x50927f,_0xfd1a77){return _0x50927f===_0xfd1a77;},'jilVY':_0x2ea1(0x30),'cyrfj':_0x2ea1(0xd3),'FjPPd':function(_0x5c2309,_0x3efeac){return _0x5c2309===_0x3efeac;},'gLHcQ':_0x2ea1(0xee),'TGsxW':function(_0x2a7cc9,_0x221d14){return _0x2a7cc9<=_0x221d14;},'hNwiR':_0x2ea1(0xef),'FQhgx':_0x2ea1(0xf0),'yFXEH':function(_0x31df9f,_0x5e74f2,_0x109c9b){return _0x31df9f(_0x5e74f2,_0x109c9b);},'ddWsh':function(_0x1a81a6,_0x227a5c){return _0x1a81a6(_0x227a5c);},'IMRrL':_0x2ea1(0xf1),'zGXvO':_0x2ea1(0xf2),'vnwZr':_0x2ea1(0xf3),'Gdbyl':function(_0x42327c,_0x50431d){return _0x42327c===_0x50431d;},'PQEuR':_0x2ea1(0xf4),'pMJXR':function(_0x4deba4,_0x513233){return _0x4deba4===_0x513233;},'huOzC':'JMJTd','MAcYD':function(_0x578aad,_0x164a34){return _0x578aad*_0x164a34;},'GpHnQ':_0x2ea1(0xf5),'dWWSC':function(_0x4c7fbb,_0x40ea34){return _0x4c7fbb===_0x40ea34;},'qbLPt':_0x2ea1(0xf6),'CXWDc':_0x2ea1(0xf7)},_0xcc7e3b=API_BASE_URL+'/email/verification';console['log'](_0x20ddc6[_0x2ea1(0xf8)],_0x2cd951),console[_0x2ea1(0x23)](_0x20ddc6[_0x2ea1(0xf9)],_0xcc7e3b);const _0x19ea41=await _0x20ddc6[_0x2ea1(0xfa)](waitForSDKInit);if(!_0x19ea41)return _0x20ddc6[_0x2ea1(0xfb)](_0x20ddc6[_0x2ea1(0xfc)],_0x20ddc6['mhoZC'])?{'success':![],'message':_0x20ddc6[_0x2ea1(0xfd)]}:{'success':![],'message':_0x20ddc6[_0x2ea1(0xfd)]};let _0x5a9189;try{if(_0x20ddc6[_0x2ea1(0xfb)](_0x20ddc6[_0x2ea1(0xfe)],'EopLQ')){var _0x139066;_0x5a9189=(0x0,_apiKeyService[_0x2ea1(0xa5)])(),console[_0x2ea1(0x23)](_0x20ddc6['pWiLq'],_0x20ddc6[_0x2ea1(0xff)](_0x20ddc6[_0x2ea1(0x100)](_0x139066=_0x5a9189['Authorization'],null)||_0x20ddc6[_0x2ea1(0x101)](_0x139066,void 0x0)?void 0x0:_0x139066[_0x2ea1(0x2f)](0x0,0x14),_0x20ddc6[_0x2ea1(0x102)]));}else throw new _0x145bf5(_0x20ddc6[_0x2ea1(0x103)]);}catch(_0x38e887){return console['error'](_0x20ddc6['cyrfj'],_0x20ddc6[_0x2ea1(0x101)](_0x38e887,null)||_0x20ddc6[_0x2ea1(0x104)](_0x38e887,void 0x0)?void 0x0:_0x38e887[_0x2ea1(0x34)]),{'success':![],'message':_0x20ddc6[_0x2ea1(0x105)]};}const _0x2d1cf6=JSON[_0x2ea1(0x42)]({'email':_0x2cd951,'action':_0x2ea1(0x106)}),_0x5a7390=0x3;for(let _0x101084=0x1;_0x20ddc6[_0x2ea1(0x107)](_0x101084,_0x5a7390);_0x101084++){if(_0x20ddc6[_0x2ea1(0x108)]===_0x20ddc6[_0x2ea1(0x109)])_0x4ec452[_0x2ea1(0x23)](_0x20ddc6[_0x2ea1(0x10a)],_0x151bd1);else try{console[_0x2ea1(0x23)](_0x2ea1(0x10b)+_0x101084+'/'+_0x5a7390+_0x2ea1(0x30));const _0x8d3ac0=new AbortController(),_0x2a42d2=_0x20ddc6[_0x2ea1(0x10c)](setTimeout,()=>_0x8d3ac0['abort'](),0x3a98),_0x542382=await _0x20ddc6[_0x2ea1(0x10c)](fetch,_0xcc7e3b,{'method':'POST','headers':_0x5a9189,'body':_0x2d1cf6,'signal':_0x8d3ac0[_0x2ea1(0x10d)]});_0x20ddc6[_0x2ea1(0x10e)](clearTimeout,_0x2a42d2),console[_0x2ea1(0x23)](_0x20ddc6[_0x2ea1(0x10f)],_0x542382[_0x2ea1(0xc9)]);const _0x2976b6=await _0x542382[_0x2ea1(0x47)]();return _0x542382['ok']&&_0x2976b6[_0x2ea1(0x110)]?(console[_0x2ea1(0x23)](_0x20ddc6[_0x2ea1(0x111)]),{'success':!![]}):(console[_0x2ea1(0x23)](_0x20ddc6[_0x2ea1(0x112)],_0x2976b6[_0x2ea1(0x19)]||_0x2976b6[_0x2ea1(0x34)]),{'success':![],'message':_0x2976b6[_0x2ea1(0x19)]||_0x2976b6['message']||_0x2ea1(0x113)});}catch(_0x21abff){const _0x1c3bb2=_0x20ddc6[_0x2ea1(0x114)](_0x20ddc6[_0x2ea1(0x104)](_0x21abff,null)||_0x20ddc6['Gdbyl'](_0x21abff,void 0x0)?void 0x0:_0x21abff[_0x2ea1(0x115)],_0x2ea1(0x116));console['error'](_0x2ea1(0x117)+_0x101084+'\x20failed:',_0x1c3bb2?_0x20ddc6[_0x2ea1(0x118)]:_0x20ddc6['pMJXR'](_0x21abff,null)||_0x20ddc6['nnWYH'](_0x21abff,void 0x0)?void 0x0:_0x21abff[_0x2ea1(0x34)]);if(_0x101084<_0x5a7390){if(_0x2ea1(0x119)===_0x20ddc6[_0x2ea1(0x11a)]){_0x1cd9a2['error'](_0x20ddc6[_0x2ea1(0x11b)],_0x4de854);throw _0x5ba31a;}else{const _0x58b81c=_0x20ddc6[_0x2ea1(0x11c)](0x3e8,_0x101084);console[_0x2ea1(0x23)](_0x2ea1(0x11d)+_0x58b81c+_0x2ea1(0x11e)),await new Promise(_0x294ae8=>setTimeout(()=>_0x294ae8(),_0x58b81c));continue;}}return console[_0x2ea1(0x19)](_0x20ddc6['GpHnQ'],_0x20ddc6['dWWSC'](_0x21abff,null)||_0x20ddc6[_0x2ea1(0x114)](_0x21abff,void 0x0)?void 0x0:_0x21abff[_0x2ea1(0x34)]),{'success':![],'message':_0x20ddc6[_0x2ea1(0x11f)]};}}return{'success':![],'message':_0x20ddc6['CXWDc']};};exports[_0x2ea1(0x120)]=sendEmailVerificationCode;const confirmEmailVerificationCode=async(_0x431abc,_0x390a26)=>{const _0x444a1e={'dKjWT':function(_0x44c78d,_0x3a2802){return _0x44c78d===_0x3a2802;},'uykBk':'🔍\x20Token\x20appears\x20to\x20be\x20valid\x20JWT:','RJgoI':_0x2ea1(0xf3),'ctLxJ':_0x2ea1(0x113),'HQYou':_0x2ea1(0x121),'MEKSE':function(_0x35747b,_0x86f583){return _0x35747b===_0x86f583;},'UewEW':_0x2ea1(0xee),'jzjcE':'🔍\x20[CODE\x20VERIFY]\x20Verifying\x20code\x20for:','HjrhK':function(_0x1e1e37){return _0x1e1e37();},'gahkd':_0x2ea1(0x122),'Vdigg':_0x2ea1(0x98),'RcLTC':'verify','YWCAt':_0x2ea1(0x123),'WQKpR':function(_0x1bec67,_0x2c50b7){return _0x1bec67(_0x2c50b7);},'oiQFO':_0x2ea1(0x124),'nkOlx':function(_0x1ae3a8,_0x30770e){return _0x1ae3a8!==_0x30770e;},'LApuh':_0x2ea1(0x125),'JQKcU':_0x2ea1(0x126),'IciRP':function(_0x2bd27a,_0x26777b){return _0x2bd27a===_0x26777b;},'DPfbA':function(_0x36b799,_0x3d2d77){return _0x36b799===_0x3d2d77;},'klHcC':function(_0x2ce96d,_0x365a36){return _0x2ce96d===_0x365a36;},'FuJLR':_0x2ea1(0x127),'GHWpv':_0x2ea1(0x128),'FDunx':'user_email','BRXyY':'onairos_username','fBzbm':_0x2ea1(0x95),'XizQZ':_0x2ea1(0xda),'JVtxI':function(_0x1b1bd0,_0x1cbd63){return _0x1b1bd0===_0x1cbd63;},'TpVJL':_0x2ea1(0x129),'trCLS':_0x2ea1(0x12a),'mjlEv':_0x2ea1(0x1c),'LKeXB':function(_0x2f64a7,_0x1be911){return _0x2f64a7===_0x1be911;},'XPoEF':'❌\x20[CODE\x20VERIFY]\x20All\x20retries\x20exhausted:','Lbckb':function(_0x3a085f,_0x3750b6){return _0x3a085f===_0x3750b6;},'woZWr':_0x2ea1(0x12b),'zcbef':_0x2ea1(0x12c)};console['log'](_0x444a1e[_0x2ea1(0x12d)],_0x431abc);const _0x4eb01a=await _0x444a1e['HjrhK'](waitForSDKInit);if(!_0x4eb01a){if(_0x444a1e[_0x2ea1(0x12e)]!=='bIMdU')return{'success':![],'message':_0x2ea1(0xb6)};else{const _0x476869=_0x444a1e[_0x2ea1(0x12f)](_0x4c3a7a[_0x2ea1(0x2b)]('.')[_0x2ea1(0x8d)],0x3);_0x140b17[_0x2ea1(0x23)](_0x444a1e[_0x2ea1(0x130)],_0x476869);}}let _0x16fb49;try{_0x16fb49=(0x0,_apiKeyService[_0x2ea1(0xa5)])(),console[_0x2ea1(0x23)](_0x444a1e[_0x2ea1(0x131)]);}catch(_0x2d2c12){return console[_0x2ea1(0x19)](_0x444a1e[_0x2ea1(0x132)],_0x2d2c12===null||_0x2d2c12===void 0x0?void 0x0:_0x2d2c12[_0x2ea1(0x34)]),{'success':![],'message':_0x444a1e[_0x2ea1(0x133)]};}const _0x3cf08f=API_BASE_URL+_0x2ea1(0x134),_0x5aa6c5=JSON[_0x2ea1(0x42)]({'email':_0x431abc,'code':_0x390a26,'action':_0x444a1e[_0x2ea1(0x135)]}),_0x5b8a3a=0x3;for(let _0xf1e457=0x1;_0xf1e457<=_0x5b8a3a;_0xf1e457++){try{if(_0x444a1e['MEKSE'](_0x2ea1(0x123),_0x444a1e[_0x2ea1(0x136)])){console[_0x2ea1(0x23)](_0x2ea1(0x137)+_0xf1e457+'/'+_0x5b8a3a+'...');const _0x50da9f=new AbortController(),_0x2b7560=setTimeout(()=>_0x50da9f['abort'](),0x3a98),_0x5438b3=await fetch(_0x3cf08f,{'method':'POST','headers':_0x16fb49,'body':_0x5aa6c5,'signal':_0x50da9f[_0x2ea1(0x10d)]});_0x444a1e[_0x2ea1(0x138)](clearTimeout,_0x2b7560),console[_0x2ea1(0x23)](_0x2ea1(0x139),_0x5438b3[_0x2ea1(0xc9)]);const _0x577135=await _0x5438b3[_0x2ea1(0x47)]();console[_0x2ea1(0x23)](_0x444a1e[_0x2ea1(0x13a)],JSON['stringify'](_0x577135));const _0x4042f0=_0x577135[_0x2ea1(0x26)]||_0x577135[_0x2ea1(0x13b)];if(_0x5438b3['ok']&&_0x577135[_0x2ea1(0x110)]&&_0x4042f0){if(_0x444a1e[_0x2ea1(0x13c)](_0x444a1e[_0x2ea1(0x13d)],_0x444a1e['LApuh']))return _0x9e196b['log'](_0x2ea1(0xd5)),![];else{var _0x386008;console[_0x2ea1(0x23)](_0x444a1e[_0x2ea1(0x13e)]);const _0x3cc45=_0x444a1e[_0x2ea1(0x13f)](_0x577135[_0x2ea1(0x140)],!![]),_0x27922f=!_0x3cc45,_0x30142c=(_0x444a1e[_0x2ea1(0x141)](_0x386008=_0x577135[_0x2ea1(0x142)],null)||_0x444a1e[_0x2ea1(0x143)](_0x386008,void 0x0)?void 0x0:_0x386008[_0x2ea1(0x144)])||_0x577135[_0x2ea1(0x144)]||null,_0x5b0dc3=_0x577135['flowType']||(_0x3cc45?_0x444a1e['FuJLR']:_0x444a1e[_0x2ea1(0x145)]);await(0x0,_jwtStorageService[_0x2ea1(0x25)])(_0x4042f0),await _asyncStorage[_0x2ea1(0x27)][_0x2ea1(0x2c)](_0x444a1e[_0x2ea1(0x146)],_0x431abc);const _0x6389bd=_0x577135['userName']||_0x577135[_0x2ea1(0x4e)]||_0x431abc[_0x2ea1(0x2b)]('@')[0x0];return await _asyncStorage[_0x2ea1(0x27)][_0x2ea1(0x2c)](_0x444a1e[_0x2ea1(0x147)],_0x6389bd),await _asyncStorage[_0x2ea1(0x27)][_0x2ea1(0x2c)](_0x444a1e['fBzbm'],_0x444a1e[_0x2ea1(0x148)]),{'success':!![],'token':_0x4042f0,'username':_0x6389bd,'isNewUser':_0x27922f,'flowType':_0x5b0dc3,'existingUserData':_0x30142c,'enochInstructions':_0x577135[_0x2ea1(0x149)]};}}else return _0x444a1e[_0x2ea1(0x14a)](_0x444a1e[_0x2ea1(0x14b)],_0x444a1e['trCLS'])?(_0x3b99bb[_0x2ea1(0x23)](_0x444a1e['RJgoI'],_0x15cc36[_0x2ea1(0x19)]||_0x2fbf2b[_0x2ea1(0x34)]),{'success':![],'message':_0x50a99b[_0x2ea1(0x19)]||_0x34f15c[_0x2ea1(0x34)]||_0x444a1e['ctLxJ']}):(console[_0x2ea1(0x23)](_0x2ea1(0x1b),_0x577135[_0x2ea1(0x19)]||_0x577135[_0x2ea1(0x34)]),{'success':![],'message':_0x577135[_0x2ea1(0x19)]||_0x577135[_0x2ea1(0x34)]||_0x444a1e[_0x2ea1(0x14c)]});}else return _0x161ba5[_0x2ea1(0x19)](_0x444a1e[_0x2ea1(0x132)],_0x461c9c===null||_0x444a1e[_0x2ea1(0x14d)](_0x39110b,void 0x0)?void 0x0:_0x22b693[_0x2ea1(0x34)]),{'success':![],'message':_0x444a1e['UewEW']};}catch(_0x4936a3){const _0x836819=(_0x444a1e['LKeXB'](_0x4936a3,null)||_0x444a1e[_0x2ea1(0x14e)](_0x4936a3,void 0x0)?void 0x0:_0x4936a3[_0x2ea1(0x115)])==='AbortError';console[_0x2ea1(0x19)](_0x2ea1(0x14f)+_0xf1e457+_0x2ea1(0x150),_0x836819?_0x2ea1(0xf4):_0x4936a3===null||_0x4936a3===void 0x0?void 0x0:_0x4936a3[_0x2ea1(0x34)]);if(_0xf1e457<_0x5b8a3a){const _0x5dcf31=0x3e8*_0xf1e457;console[_0x2ea1(0x23)]('🔄\x20[CODE\x20VERIFY]\x20Retrying\x20in\x20'+_0x5dcf31+'ms...'),await new Promise(_0x1af35b=>setTimeout(()=>_0x1af35b(),_0x5dcf31));continue;}return console[_0x2ea1(0x19)](_0x444a1e[_0x2ea1(0x151)],_0x4936a3===null||_0x444a1e[_0x2ea1(0x152)](_0x4936a3,void 0x0)?void 0x0:_0x4936a3['message']),{'success':![],'message':_0x444a1e[_0x2ea1(0x153)]};}}return{'success':![],'message':_0x444a1e[_0x2ea1(0x154)]};};exports[_0x2ea1(0xb)]=confirmEmailVerificationCode;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.verifyToken = exports.sendEmailVerificationCode = exports.saveOnairosUsername = exports.saveAuthToken = exports.saveAdminStatus = exports.removeAuthToken = exports.isAuthenticated = exports.isAdminEmail = exports.getOnairosUsername = exports.getAuthToken = exports.getAdminStatus = exports.ensureAuthentication = exports.debugAuthStorage = exports.confirmEmailVerificationCode = exports.clearAllAuthTokens = exports.authenticateWithOnairosSignIn = exports.authenticateWithOnairos = exports.authenticateWithApple = void 0;
7
+ var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
8
+ var _api = require("../config/api");
9
+ var _apiKeyService = require("./apiKeyService");
10
+ var _jwtStorageService = require("./jwtStorageService");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ // CRITICAL FIX: Use static imports instead of dynamic imports to avoid Hermes transpilation issues
13
+
14
+ // API base URL
15
+ const API_BASE_URL = _api.API_CONFIG.BASE_URL;
16
+
17
+ /**
18
+ * Wait for SDK initialization to complete (up to maxWaitMs).
19
+ * Polls isApiKeyInitialized() every 500ms.
20
+ */
21
+ const waitForSDKInit = async (maxWaitMs = 8000) => {
22
+ if ((0, _apiKeyService.isApiKeyInitialized)()) return true;
23
+ console.log('⏳ [AUTH] SDK not yet initialized, waiting...');
24
+ const start = Date.now();
25
+ while (Date.now() - start < maxWaitMs) {
26
+ await new Promise(resolve => setTimeout(() => resolve(), 500));
27
+ if ((0, _apiKeyService.isApiKeyInitialized)()) {
28
+ console.log('✅ [AUTH] SDK initialized after', Date.now() - start, 'ms');
29
+ return true;
30
+ }
31
+ }
32
+ console.error('❌ [AUTH] SDK did not initialize within', maxWaitMs, 'ms');
33
+ return false;
34
+ };
35
+
36
+ // Legacy AuthResponse interface - kept for backward compatibility
37
+ // New code should use SDKAuthResponse
38
+
39
+ // Interface for Apple authentication payload
40
+
41
+ /**
42
+ * Generic SDK Authentication Response
43
+ * Used by all auth methods (Google, Apple, Email)
44
+ */
45
+
46
+ /**
47
+ * Authenticate with Apple
48
+ * @param appleAuthData Data from Apple authentication
49
+ * @returns Authentication response with token and user data
50
+ */
51
+ /**
52
+ * Authenticate with Onairos (similar to Apple authentication)
53
+ * @param onairosAuthData Data from Onairos authentication
54
+ * @returns Authentication response with token and user data
55
+ */
56
+ const authenticateWithOnairos = async onairosAuthData => {
57
+ try {
58
+ console.log('🔑 Authenticating with Onairos...');
59
+
60
+ // Store the token using simplified JWT storage
61
+ await (0, _jwtStorageService.storeJWT)(onairosAuthData.token);
62
+
63
+ // Extract username from email or use stored username
64
+ const storedUsername = await _asyncStorage.default.getItem('onairos_username');
65
+ const userName = storedUsername || onairosAuthData.email.split('@')[0] || 'Onairos User';
66
+
67
+ // Store username and email
68
+ await _asyncStorage.default.setItem('onairos_username', userName);
69
+ await _asyncStorage.default.setItem('user_email', onairosAuthData.email);
70
+ console.log('🔑 Onairos auth token stored:', `${onairosAuthData.token.substring(0, 20)}...`);
71
+ console.log('👤 User info:', {
72
+ email: onairosAuthData.email,
73
+ username: userName
74
+ });
75
+ return {
76
+ token: onairosAuthData.token,
77
+ user: {
78
+ id: Date.now().toString(),
79
+ name: userName,
80
+ email: onairosAuthData.email,
81
+ profilePicture: ''
82
+ }
83
+ };
84
+ } catch (error) {
85
+ console.error('❌ Onairos authentication error:', error);
86
+ throw error;
87
+ }
88
+ };
89
+
90
+ /**
91
+ * Authenticate with Onairos using the standardized /login/signin endpoint
92
+ * @param credentials Email and password for Onairos sign-in
93
+ * @returns Authentication response with token and user data
94
+ */
95
+ exports.authenticateWithOnairos = authenticateWithOnairos;
96
+ const authenticateWithOnairosSignIn = async credentials => {
97
+ try {
98
+ console.log('🔑 Signing in with Onairos via /login/signin endpoint...');
99
+ const response = await fetch(`${API_BASE_URL}/login/signin`, {
100
+ method: 'POST',
101
+ headers: (0, _api.getApiHeaders)(),
102
+ body: JSON.stringify(credentials)
103
+ });
104
+ if (!response.ok) {
105
+ const errorData = await response.json();
106
+ throw new Error(errorData.error || 'Onairos sign-in failed');
107
+ }
108
+ const authData = await response.json();
109
+ console.log('✅ Onairos sign-in successful');
110
+
111
+ // Check for authentication token
112
+ if (!authData.token) {
113
+ throw new Error('No authentication token returned from Onairos sign-in');
114
+ }
115
+
116
+ // Store token using simplified JWT storage
117
+ await (0, _jwtStorageService.storeJWT)(authData.token);
118
+
119
+ // Store username from response
120
+ if (authData.username) {
121
+ await _asyncStorage.default.setItem('onairos_username', authData.username);
122
+ }
123
+ await _asyncStorage.default.setItem('user_email', credentials.email);
124
+ console.log('🔑 Onairos sign-in token stored:', `${authData.token.substring(0, 20)}...`);
125
+ return {
126
+ token: authData.token,
127
+ user: {
128
+ id: Date.now().toString(),
129
+ name: authData.username,
130
+ email: credentials.email,
131
+ profilePicture: ''
132
+ }
133
+ };
134
+ } catch (error) {
135
+ console.error('❌ Onairos sign-in error:', error);
136
+ throw error;
137
+ }
138
+ };
139
+
140
+ /**
141
+ * Authenticate with Apple using generic SDK endpoint
142
+ * NOTE: This is generic SDK auth - does NOT create EnochUser
143
+ * Consuming apps should call /enoch/users/register after this if needed
144
+ */
145
+ exports.authenticateWithOnairosSignIn = authenticateWithOnairosSignIn;
146
+ const authenticateWithApple = async appleAuthData => {
147
+ try {
148
+ var _authData$user, _authData$user2, _authData$user3, _authData$user4;
149
+ const userName = appleAuthData.fullName ? `${appleAuthData.fullName.givenName || ''} ${appleAuthData.fullName.familyName || ''}`.trim() : 'Onairos User';
150
+
151
+ // Call the generic Apple authentication endpoint - SDK route, NOT Enoch-specific
152
+ console.log('🍎 Authenticating with Apple via generic SDK endpoint...');
153
+ const appleAuthResponse = await fetch(`${API_BASE_URL}/register/apple`, {
154
+ method: 'POST',
155
+ headers: (0, _api.getApiHeaders)(),
156
+ body: JSON.stringify({
157
+ idToken: appleAuthData.identityToken,
158
+ nonce: appleAuthData.nonce,
159
+ name: userName,
160
+ email: appleAuthData.email
161
+ })
162
+ });
163
+ if (!appleAuthResponse.ok) {
164
+ const errorData = await appleAuthResponse.json();
165
+ throw new Error(errorData.error || 'Apple authentication failed');
166
+ }
167
+ const authData = await appleAuthResponse.json();
168
+ console.log('✅ Apple authentication successful');
169
+
170
+ // Check for authentication token
171
+ if (!authData.token) {
172
+ throw new Error('No authentication token returned from Apple auth');
173
+ }
174
+
175
+ // Store token using simplified JWT storage
176
+ await (0, _jwtStorageService.storeJWT)(authData.token);
177
+
178
+ // Store username from response
179
+ const username = ((_authData$user = authData.user) === null || _authData$user === void 0 ? void 0 : _authData$user.username) || authData.username || userName;
180
+ await _asyncStorage.default.setItem('onairos_username', username);
181
+
182
+ // Store email - prefer backend's email (correct @placeholder.com format) over Apple's local email
183
+ const userEmail = ((_authData$user2 = authData.user) === null || _authData$user2 === void 0 ? void 0 : _authData$user2.email) || appleAuthData.email || `apple_${appleAuthData.user}@privaterelay.apple.com`;
184
+ await _asyncStorage.default.setItem('user_email', userEmail);
185
+ console.log('🔑 Apple auth token stored:', `${authData.token.substring(0, 20)}...`);
186
+ return {
187
+ success: true,
188
+ token: authData.token,
189
+ user: {
190
+ id: ((_authData$user3 = authData.user) === null || _authData$user3 === void 0 ? void 0 : _authData$user3.id) || '',
191
+ odeanId: (_authData$user4 = authData.user) === null || _authData$user4 === void 0 ? void 0 : _authData$user4.odeanId,
192
+ email: userEmail,
193
+ username: username
194
+ },
195
+ isNewUser: authData.isNewUser || false
196
+ };
197
+ } catch (error) {
198
+ console.error('❌ Apple authentication error:', error);
199
+ throw error;
200
+ }
201
+ };
202
+
203
+ /**
204
+ * Save authentication token
205
+ * @param token JWT token
206
+ */
207
+ exports.authenticateWithApple = authenticateWithApple;
208
+ const saveAuthToken = async token => {
209
+ try {
210
+ await _asyncStorage.default.setItem('auth_token', token);
211
+ } catch (error) {
212
+ console.error('Error saving auth token:', error);
213
+ throw error;
214
+ }
215
+ };
216
+
217
+ /**
218
+ * Debug function to check all auth-related storage
219
+ */
220
+ exports.saveAuthToken = saveAuthToken;
221
+ const debugAuthStorage = async () => {
222
+ console.log('🔍 [AUTH STORAGE DEBUG] Checking all auth-related storage:');
223
+ const sdkToken = await _asyncStorage.default.getItem('sdk_jwt_token');
224
+ const userEmail = await _asyncStorage.default.getItem('user_email');
225
+ const onairosUsername = await _asyncStorage.default.getItem('onairos_username');
226
+ const authMethod = await _asyncStorage.default.getItem('auth_method');
227
+ console.log('🔑 sdk_jwt_token:', sdkToken ? `"${sdkToken.substring(0, 30)}..."` : 'null');
228
+ console.log('🔑 user_email:', userEmail ? `"${userEmail}"` : 'null');
229
+ console.log('🔑 onairos_username:', onairosUsername ? `"${onairosUsername}"` : 'null');
230
+ console.log('🔑 auth_method:', authMethod ? `"${authMethod}"` : 'null');
231
+
232
+ // Check if token looks valid
233
+ if (sdkToken) {
234
+ const isValidJWT = sdkToken.split('.').length === 3;
235
+ console.log('🔍 Token appears to be valid JWT:', isValidJWT);
236
+ }
237
+ };
238
+
239
+ /**
240
+ * Clear all auth tokens and start fresh
241
+ */
242
+ exports.debugAuthStorage = debugAuthStorage;
243
+ const clearAllAuthTokens = async () => {
244
+ console.log('🧹 [AUTH] Clearing all auth tokens...');
245
+ await (0, _jwtStorageService.clearJWT)();
246
+
247
+ // Clear other auth-related data
248
+ await _asyncStorage.default.multiRemove(['user_email', 'onairos_username', 'auth_method', 'onairos_user']);
249
+ console.log('✅ [AUTH] All auth tokens and data cleared');
250
+ };
251
+
252
+ /**
253
+ * Get saved authentication token
254
+ * @returns Saved JWT token or null if not found
255
+ */
256
+ exports.clearAllAuthTokens = clearAllAuthTokens;
257
+ const getAuthToken = async () => {
258
+ try {
259
+ const token = await (0, _jwtStorageService.getJWT)();
260
+ if (token) {
261
+ console.log('✅ [AUTH] Found JWT token:', `${token.substring(0, 20)}...`);
262
+ return token;
263
+ }
264
+ console.warn('❌ [AUTH] No valid JWT token found');
265
+ return null;
266
+ } catch (error) {
267
+ console.error('❌ [AUTH] Error during token retrieval:', error);
268
+ return null;
269
+ }
270
+ };
271
+
272
+ /**
273
+ * Remove authentication token (logout)
274
+ */
275
+ exports.getAuthToken = getAuthToken;
276
+ const removeAuthToken = async () => {
277
+ try {
278
+ await _asyncStorage.default.removeItem('auth_token');
279
+ } catch (error) {
280
+ console.error('Error removing auth token:', error);
281
+ }
282
+ };
283
+
284
+ /**
285
+ * Validate if user is properly authenticated
286
+ * @returns boolean indicating if user has valid authentication
287
+ */
288
+ exports.removeAuthToken = removeAuthToken;
289
+ const isAuthenticated = async () => {
290
+ try {
291
+ const token = await getAuthToken();
292
+ return token !== null && token.length > 50;
293
+ } catch (error) {
294
+ console.error('❌ [AUTH VALIDATION] Error checking authentication status:', error);
295
+ return false;
296
+ }
297
+ };
298
+
299
+ /**
300
+ * Ensure authentication is available before making API calls
301
+ * @param apiName - Name of the API being called (for logging)
302
+ * @returns boolean indicating if authentication is available
303
+ */
304
+ exports.isAuthenticated = isAuthenticated;
305
+ const ensureAuthentication = async apiName => {
306
+ const isAuth = await isAuthenticated();
307
+ if (!isAuth) {
308
+ console.warn(`⚠️ [${apiName}] No valid authentication available - API call may return limited data`);
309
+ } else {
310
+ console.log(`✅ [${apiName}] Authentication validated for API call`);
311
+ }
312
+ return isAuth;
313
+ };
314
+
315
+ // NOTE: getEnochToken and saveEnochToken have been removed from SDK.
316
+ // SDK now uses a single simplified token. Enoch-specific token management
317
+ // should be handled by the consuming app if needed.
318
+
319
+ /**
320
+ * Verify token with backend
321
+ * @returns Boolean indicating if token is valid
322
+ */
323
+ exports.ensureAuthentication = ensureAuthentication;
324
+ const verifyToken = async () => {
325
+ try {
326
+ const token = await getAuthToken();
327
+ if (!token) {
328
+ console.warn('🔒 [TOKEN VERIFY] No token available for verification');
329
+ return false;
330
+ }
331
+ console.log('🔒 [TOKEN VERIFY] Verifying token with backend...');
332
+ console.log('🔒 [TOKEN VERIFY] Token preview:', `${token.substring(0, 20)}...`);
333
+ const response = await fetch(`${API_BASE_URL}/api/auth/verify`, {
334
+ method: 'GET',
335
+ headers: (0, _api.getAuthHeaders)(token)
336
+ });
337
+ console.log('🔒 [TOKEN VERIFY] Verification response status:', response.status);
338
+ if (response.ok) {
339
+ console.log('✅ [TOKEN VERIFY] Token is valid');
340
+ return true;
341
+ } else {
342
+ const errorText = await response.text();
343
+ console.warn('❌ [TOKEN VERIFY] Token verification failed:', response.status, errorText);
344
+ return false;
345
+ }
346
+ } catch (error) {
347
+ console.error('❌ [TOKEN VERIFY] Token verification error:', error);
348
+ return false;
349
+ }
350
+ };
351
+
352
+ // NOTE: getUserProfile, createOrUpdateProfile, and updateUserOnboardedStatus
353
+ // have been removed from SDK - these are Enoch-specific functions.
354
+ // Consuming apps (like OnairosEvents) should call these APIs directly.
355
+
356
+ // NOTE: getEventTimer has been removed from SDK - it's Enoch-specific.
357
+ // Consuming apps (like OnairosEvents) should call /enoch/event/timer directly.
358
+
359
+ /**
360
+ * Check if a user email has admin privileges
361
+ * @param email User email to check
362
+ * @returns True if user is an admin
363
+ */
364
+ exports.verifyToken = verifyToken;
365
+ const isAdminEmail = email => {
366
+ if (!email) {
367
+ console.log('🔒 [Admin Check] No email provided');
368
+ return false;
369
+ }
370
+ const adminEmails = ['nicholas.berry@onairos.uk', 'zion.darko@onairos.uk', 'admin@enoch.events', 'admin@onairos.uk'];
371
+ const isAdmin = adminEmails.includes(email.toLowerCase());
372
+ if (isAdmin) {
373
+ console.log('🔑 [Admin Check] Admin access granted for:', email);
374
+ } else {
375
+ console.log('🚫 [Admin Check] No admin access for:', email);
376
+ }
377
+ return isAdmin;
378
+ };
379
+
380
+ /**
381
+ * Get the current admin status from AsyncStorage
382
+ * This could be used for caching admin status between sessions
383
+ */
384
+ exports.isAdminEmail = isAdminEmail;
385
+ const getAdminStatus = async () => {
386
+ try {
387
+ const adminStatus = await _asyncStorage.default.getItem('user_admin_status');
388
+ return adminStatus === 'true';
389
+ } catch (error) {
390
+ console.error('Error getting admin status:', error);
391
+ return false;
392
+ }
393
+ };
394
+
395
+ /**
396
+ * Save admin status to AsyncStorage
397
+ * @param isAdmin Whether the user is an admin
398
+ */
399
+ exports.getAdminStatus = getAdminStatus;
400
+ const saveAdminStatus = async isAdmin => {
401
+ try {
402
+ await _asyncStorage.default.setItem('user_admin_status', isAdmin.toString());
403
+ } catch (error) {
404
+ console.error('Error saving admin status:', error);
405
+ }
406
+ };
407
+
408
+ /**
409
+ * Get stored Onairos username for API calls
410
+ * This is used for data connector APIs (Reddit, etc.) that need the username
411
+ * @returns Stored username or null if not found
412
+ */
413
+ exports.saveAdminStatus = saveAdminStatus;
414
+ const getOnairosUsername = async () => {
415
+ try {
416
+ return await _asyncStorage.default.getItem('onairos_username');
417
+ } catch (error) {
418
+ console.error('Error getting Onairos username:', error);
419
+ return null;
420
+ }
421
+ };
422
+
423
+ /**
424
+ * Save Onairos username for API calls
425
+ * @param username Username to store
426
+ */
427
+ exports.getOnairosUsername = getOnairosUsername;
428
+ const saveOnairosUsername = async username => {
429
+ try {
430
+ await _asyncStorage.default.setItem('onairos_username', username);
431
+ } catch (error) {
432
+ console.error('Error saving Onairos username:', error);
433
+ }
434
+ };
435
+
436
+ /**
437
+ * Send email verification code
438
+ * @param email Email address to send verification code to
439
+ * @returns Result with success status and optional message
440
+ */
441
+ exports.saveOnairosUsername = saveOnairosUsername;
442
+ const sendEmailVerificationCode = async email => {
443
+ const url = `${API_BASE_URL}/email/verification`;
444
+ console.log('📧 [EMAIL VERIFY] Sending verification code to:', email);
445
+ console.log('📧 [EMAIL VERIFY] URL:', url);
446
+
447
+ // Wait for SDK to finish initializing (handles race condition)
448
+ const sdkReady = await waitForSDKInit();
449
+ if (!sdkReady) {
450
+ return {
451
+ success: false,
452
+ message: 'SDK is still initializing. Please wait a moment and try again.'
453
+ };
454
+ }
455
+ let headers;
456
+ try {
457
+ var _headers$Authorizatio;
458
+ headers = (0, _apiKeyService.getDeveloperAuthHeaders)();
459
+ console.log('📧 [EMAIL VERIFY] Headers OK, key:', ((_headers$Authorizatio = headers.Authorization) === null || _headers$Authorizatio === void 0 ? void 0 : _headers$Authorizatio.substring(0, 20)) + '...');
460
+ } catch (headerError) {
461
+ console.error('❌ [EMAIL VERIFY] Failed to get auth headers:', headerError === null || headerError === void 0 ? void 0 : headerError.message);
462
+ return {
463
+ success: false,
464
+ message: 'SDK not properly initialized. Please restart the app and try again.'
465
+ };
466
+ }
467
+ const body = JSON.stringify({
468
+ email,
469
+ action: 'request'
470
+ });
471
+ const maxRetries = 3;
472
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
473
+ try {
474
+ console.log(`📧 [EMAIL VERIFY] Attempt ${attempt}/${maxRetries}...`);
475
+ const controller = new AbortController();
476
+ const timeoutId = setTimeout(() => controller.abort(), 15000);
477
+ const response = await fetch(url, {
478
+ method: 'POST',
479
+ headers,
480
+ body,
481
+ signal: controller.signal
482
+ });
483
+ clearTimeout(timeoutId);
484
+ console.log('📧 [EMAIL VERIFY] Response status:', response.status);
485
+ const data = await response.json();
486
+ if (response.ok && data.success) {
487
+ console.log('✅ [EMAIL VERIFY] Verification code sent successfully');
488
+ return {
489
+ success: true
490
+ };
491
+ } else {
492
+ console.log('❌ [EMAIL VERIFY] Server error:', data.error || data.message);
493
+ return {
494
+ success: false,
495
+ message: data.error || data.message || 'Failed to send verification code'
496
+ };
497
+ }
498
+ } catch (error) {
499
+ const isTimeout = (error === null || error === void 0 ? void 0 : error.name) === 'AbortError';
500
+ console.error(`❌ [EMAIL VERIFY] Attempt ${attempt} failed:`, isTimeout ? 'TIMEOUT' : error === null || error === void 0 ? void 0 : error.message);
501
+ if (attempt < maxRetries) {
502
+ const delay = 1000 * attempt;
503
+ console.log(`🔄 [EMAIL VERIFY] Retrying in ${delay}ms...`);
504
+ await new Promise(resolve => setTimeout(() => resolve(), delay));
505
+ continue;
506
+ }
507
+ console.error('❌ [EMAIL VERIFY] All retries exhausted:', error === null || error === void 0 ? void 0 : error.message);
508
+ return {
509
+ success: false,
510
+ message: 'Network error. Please check your connection and try again.'
511
+ };
512
+ }
513
+ }
514
+ return {
515
+ success: false,
516
+ message: 'Network error. Please try again.'
517
+ };
518
+ };
519
+
520
+ /**
521
+ * Confirm email verification code
522
+ * NOTE: This is generic SDK email verification - does NOT create EnochUser
523
+ * Consuming apps should call /enoch/users/register after this if needed
524
+ * @param email Email address that received the code
525
+ * @param code Verification code entered by user
526
+ * @returns Result with success status, optional token, and message
527
+ */
528
+ exports.sendEmailVerificationCode = sendEmailVerificationCode;
529
+ const confirmEmailVerificationCode = async (email, code) => {
530
+ console.log('🔍 [CODE VERIFY] Verifying code for:', email);
531
+
532
+ // Wait for SDK to finish initializing (handles race condition)
533
+ const sdkReady = await waitForSDKInit();
534
+ if (!sdkReady) {
535
+ return {
536
+ success: false,
537
+ message: 'SDK is still initializing. Please wait a moment and try again.'
538
+ };
539
+ }
540
+ let headers;
541
+ try {
542
+ headers = (0, _apiKeyService.getDeveloperAuthHeaders)();
543
+ console.log('🔍 [CODE VERIFY] Headers OK');
544
+ } catch (headerError) {
545
+ console.error('❌ [CODE VERIFY] Failed to get auth headers:', headerError === null || headerError === void 0 ? void 0 : headerError.message);
546
+ return {
547
+ success: false,
548
+ message: 'SDK not properly initialized. Please restart the app and try again.'
549
+ };
550
+ }
551
+ const url = `${API_BASE_URL}/email/verification`;
552
+ const body = JSON.stringify({
553
+ email,
554
+ code,
555
+ action: 'verify'
556
+ });
557
+ const maxRetries = 3;
558
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
559
+ try {
560
+ console.log(`🔍 [CODE VERIFY] Attempt ${attempt}/${maxRetries}...`);
561
+ const controller = new AbortController();
562
+ const timeoutId = setTimeout(() => controller.abort(), 15000);
563
+ const response = await fetch(url, {
564
+ method: 'POST',
565
+ headers,
566
+ body,
567
+ signal: controller.signal
568
+ });
569
+ clearTimeout(timeoutId);
570
+ console.log('🔍 [CODE VERIFY] Response status:', response.status);
571
+ const data = await response.json();
572
+ console.log('🔍 [CODE VERIFY] Response data:', JSON.stringify(data));
573
+ const token = data.token || data.jwtToken;
574
+ if (response.ok && data.success && token) {
575
+ var _data$accountInfo;
576
+ console.log('✅ [CODE VERIFY] Email verification successful');
577
+ const isReturningUser = data.existingUser === true;
578
+ const isNewUser = !isReturningUser;
579
+ const existingUserData = ((_data$accountInfo = data.accountInfo) === null || _data$accountInfo === void 0 ? void 0 : _data$accountInfo.existingUserData) || data.existingUserData || null;
580
+ const flowType = data.flowType || (isReturningUser ? 'returning_user' : 'onboarding');
581
+ await (0, _jwtStorageService.storeJWT)(token);
582
+ await _asyncStorage.default.setItem('user_email', email);
583
+ const username = data.userName || data.username || email.split('@')[0];
584
+ await _asyncStorage.default.setItem('onairos_username', username);
585
+ await _asyncStorage.default.setItem('onairos_user', 'true');
586
+ return {
587
+ success: true,
588
+ token,
589
+ username,
590
+ isNewUser,
591
+ flowType,
592
+ existingUserData,
593
+ enochInstructions: data.enochInstructions
594
+ };
595
+ } else {
596
+ console.log('❌ [CODE VERIFY] Server error:', data.error || data.message);
597
+ return {
598
+ success: false,
599
+ message: data.error || data.message || 'Invalid verification code'
600
+ };
601
+ }
602
+ } catch (error) {
603
+ const isTimeout = (error === null || error === void 0 ? void 0 : error.name) === 'AbortError';
604
+ console.error(`❌ [CODE VERIFY] Attempt ${attempt} failed:`, isTimeout ? 'TIMEOUT' : error === null || error === void 0 ? void 0 : error.message);
605
+ if (attempt < maxRetries) {
606
+ const delay = 1000 * attempt;
607
+ console.log(`🔄 [CODE VERIFY] Retrying in ${delay}ms...`);
608
+ await new Promise(resolve => setTimeout(() => resolve(), delay));
609
+ continue;
610
+ }
611
+ console.error('❌ [CODE VERIFY] All retries exhausted:', error === null || error === void 0 ? void 0 : error.message);
612
+ return {
613
+ success: false,
614
+ message: 'Verification failed. Please check your connection and try again.'
615
+ };
616
+ }
617
+ }
618
+ return {
619
+ success: false,
620
+ message: 'Verification failed. Please try again.'
621
+ };
622
+ };
623
+
624
+ // NOTE: checkEnochOnairosConnection has been removed from SDK - it's Enoch-specific.
625
+ // Consuming apps (like OnairosEvents) should call /enoch/user/onairos-connection-status directly.
626
+ exports.confirmEmailVerificationCode = confirmEmailVerificationCode;
627
+ //# sourceMappingURL=authService.js.map