@onairos/react-native 3.7.1 → 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 (241) hide show
  1. package/lib/commonjs/api/index.js +219 -9
  2. package/lib/commonjs/assets/icons/spotify.png +0 -0
  3. package/lib/commonjs/assets/images/spotify.png +0 -0
  4. package/lib/commonjs/components/BodyText.js +27 -9
  5. package/lib/commonjs/components/BrandMark.js +111 -10
  6. package/lib/commonjs/components/CodeInput.js +116 -9
  7. package/lib/commonjs/components/EmailInput.js +30 -8
  8. package/lib/commonjs/components/GoogleButton.js +56 -9
  9. package/lib/commonjs/components/HeadingGroup.js +43 -9
  10. package/lib/commonjs/components/LLMDataInputModal.js +664 -14
  11. package/lib/commonjs/components/ModalHeader.js +99 -9
  12. package/lib/commonjs/components/ModalSheet.js +47 -9
  13. package/lib/commonjs/components/Onairos.js +380 -14
  14. package/lib/commonjs/components/OnairosButton.js +313 -13
  15. package/lib/commonjs/components/OnairosSignInButton.js +130 -12
  16. package/lib/commonjs/components/Overlay.js +465 -13
  17. package/lib/commonjs/components/PersonaImage.js +137 -10
  18. package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
  19. package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
  20. package/lib/commonjs/components/PinCreationScreen.js +403 -12
  21. package/lib/commonjs/components/PinInput.js +464 -9
  22. package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
  23. package/lib/commonjs/components/PlatformList.js +137 -10
  24. package/lib/commonjs/components/PlatformToggle.js +180 -9
  25. package/lib/commonjs/components/PrimaryButton.js +180 -10
  26. package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
  27. package/lib/commonjs/components/SignInStep.js +345 -12
  28. package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
  29. package/lib/commonjs/components/VerificationStep.js +176 -11
  30. package/lib/commonjs/components/WelcomeScreen.js +461 -22
  31. package/lib/commonjs/components/icons/Basicproficon.js +37 -8
  32. package/lib/commonjs/components/icons/Basicprofile.js +21 -8
  33. package/lib/commonjs/components/icons/Checkbox.js +21 -8
  34. package/lib/commonjs/components/icons/Checkmark.js +27 -8
  35. package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
  36. package/lib/commonjs/components/icons/Contenticon.js +39 -8
  37. package/lib/commonjs/components/icons/EnochE.js +41 -8
  38. package/lib/commonjs/components/icons/Personalityicon.js +30 -8
  39. package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
  40. package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
  41. package/lib/commonjs/components/icons/Userpreferences.js +21 -8
  42. package/lib/commonjs/components/icons/index.js +84 -17
  43. package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
  44. package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
  45. package/lib/commonjs/components/onboarding/PinInput.js +283 -10
  46. package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
  47. package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
  48. package/lib/commonjs/config/api.js +56 -7
  49. package/lib/commonjs/constants/index.js +120 -7
  50. package/lib/commonjs/context/AuthContext.js +345 -10
  51. package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
  52. package/lib/commonjs/hooks/useConnections.js +102 -8
  53. package/lib/commonjs/hooks/useCredentials.js +178 -10
  54. package/lib/commonjs/hooks/useUserConnections.js +148 -10
  55. package/lib/commonjs/index.js +439 -34
  56. package/lib/commonjs/services/apiClient.js +298 -8
  57. package/lib/commonjs/services/biometricPinService.js +180 -8
  58. package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
  59. package/lib/commonjs/services/chatGPTConversationService.js +275 -9
  60. package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
  61. package/lib/commonjs/services/claudeConversationService.js +158 -9
  62. package/lib/commonjs/services/connectedAccountsService.js +310 -10
  63. package/lib/commonjs/services/googleAuthService.js +252 -11
  64. package/lib/commonjs/services/hingeDataExtractor.js +105 -8
  65. package/lib/commonjs/services/hingeDataService.js +150 -9
  66. package/lib/commonjs/services/imageCompressionService.js +260 -7
  67. package/lib/commonjs/services/instagramDataExtractor.js +126 -8
  68. package/lib/commonjs/services/instagramDataService.js +163 -9
  69. package/lib/commonjs/services/jwtStorageService.js +276 -7
  70. package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
  71. package/lib/commonjs/services/linkedinProfileService.js +222 -9
  72. package/lib/commonjs/services/linkedinScrapingService.js +230 -8
  73. package/lib/commonjs/services/llmDataStorage.js +294 -8
  74. package/lib/commonjs/services/mobileTrainingService.js +186 -8
  75. package/lib/commonjs/services/netflixDataExtractor.js +120 -8
  76. package/lib/commonjs/services/netflixDataService.js +198 -9
  77. package/lib/commonjs/services/pinEncryptionService.js +84 -8
  78. package/lib/commonjs/services/pinStorageUtils.js +105 -7
  79. package/lib/commonjs/services/platformAuthService.js +1484 -12
  80. package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
  81. package/lib/commonjs/services/sephoraDataService.js +200 -9
  82. package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
  83. package/lib/commonjs/services/spotifyDataService.js +241 -9
  84. package/lib/commonjs/services/storageService.js +404 -8
  85. package/lib/commonjs/services/telegramDataExtractor.js +115 -8
  86. package/lib/commonjs/services/telegramDataService.js +499 -9
  87. package/lib/commonjs/services/trainingApiHelpers.js +73 -7
  88. package/lib/commonjs/services/userConnectionsService.js +340 -10
  89. package/lib/commonjs/services/youtubeMigrationService.js +416 -10
  90. package/lib/commonjs/theme/index.js +250 -7
  91. package/lib/commonjs/types/ambient.d.js +2 -1
  92. package/lib/commonjs/types/declarations.d.js +2 -1
  93. package/lib/commonjs/types/index.js +6 -1
  94. package/lib/commonjs/types/node-fix.d.js +2 -1
  95. package/lib/commonjs/types/node-override.d.js +2 -1
  96. package/lib/commonjs/types/opacity.d.js +2 -1
  97. package/lib/commonjs/types.js +14 -1
  98. package/lib/commonjs/utils/Portal.js +98 -8
  99. package/lib/commonjs/utils/api.js +130 -9
  100. package/lib/commonjs/utils/assetRegistry.js +210 -35
  101. package/lib/commonjs/utils/auth.js +112 -9
  102. package/lib/commonjs/utils/connectorTests.js +613 -29
  103. package/lib/commonjs/utils/crypto.js +62 -8
  104. package/lib/commonjs/utils/debugHelper.js +64 -1
  105. package/lib/commonjs/utils/encryption.js +76 -7
  106. package/lib/commonjs/utils/eventUtils.js +288 -1
  107. package/lib/commonjs/utils/haptics.js +66 -9
  108. package/lib/commonjs/utils/imagePreloader.js +6 -1
  109. package/lib/commonjs/utils/networkDiagnostics.js +226 -8
  110. package/lib/commonjs/utils/onairosApi.js +350 -9
  111. package/lib/commonjs/utils/programmaticFlow.js +117 -9
  112. package/lib/commonjs/utils/retryHelper.js +220 -1
  113. package/lib/commonjs/utils/secureStorage.js +349 -10
  114. package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
  115. package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
  116. package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
  117. package/lib/commonjs/utils/webviewScripts/index.js +698 -15
  118. package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
  119. package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
  120. package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
  121. package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
  122. package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
  123. package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
  124. package/lib/module/api/index.js +211 -1
  125. package/lib/module/assets/icons/spotify.png +0 -0
  126. package/lib/module/assets/images/spotify.png +0 -0
  127. package/lib/module/components/BodyText.js +20 -1
  128. package/lib/module/components/BrandMark.js +104 -1
  129. package/lib/module/components/CodeInput.js +109 -1
  130. package/lib/module/components/EmailInput.js +23 -1
  131. package/lib/module/components/GoogleButton.js +49 -1
  132. package/lib/module/components/HeadingGroup.js +36 -1
  133. package/lib/module/components/LLMDataInputModal.js +656 -7
  134. package/lib/module/components/ModalHeader.js +92 -1
  135. package/lib/module/components/ModalSheet.js +39 -1
  136. package/lib/module/components/Onairos.js +373 -1
  137. package/lib/module/components/OnairosButton.js +305 -1
  138. package/lib/module/components/OnairosSignInButton.js +121 -1
  139. package/lib/module/components/Overlay.js +456 -1
  140. package/lib/module/components/PersonaImage.js +129 -1
  141. package/lib/module/components/PersonaLoadingScreen.js +310 -1
  142. package/lib/module/components/PersonalizationConsentScreen.js +460 -1
  143. package/lib/module/components/PinCreationScreen.js +396 -1
  144. package/lib/module/components/PinInput.js +456 -1
  145. package/lib/module/components/PlatformConnectorsStep.js +1302 -6
  146. package/lib/module/components/PlatformList.js +129 -1
  147. package/lib/module/components/PlatformToggle.js +173 -1
  148. package/lib/module/components/PrimaryButton.js +172 -1
  149. package/lib/module/components/SignInMatchAnimation.js +189 -1
  150. package/lib/module/components/SignInStep.js +338 -1
  151. package/lib/module/components/UniversalOnboarding.js +2770 -1
  152. package/lib/module/components/VerificationStep.js +168 -1
  153. package/lib/module/components/WelcomeScreen.js +453 -1
  154. package/lib/module/components/icons/Basicproficon.js +30 -1
  155. package/lib/module/components/icons/Basicprofile.js +14 -1
  156. package/lib/module/components/icons/Checkbox.js +14 -1
  157. package/lib/module/components/icons/Checkmark.js +20 -1
  158. package/lib/module/components/icons/Contentanalysis.js +14 -1
  159. package/lib/module/components/icons/Contenticon.js +32 -1
  160. package/lib/module/components/icons/EnochE.js +34 -1
  161. package/lib/module/components/icons/Personalityicon.js +23 -1
  162. package/lib/module/components/icons/Personalityprofile.js +14 -1
  163. package/lib/module/components/icons/Personalitytraits.js +14 -1
  164. package/lib/module/components/icons/Userpreferences.js +14 -1
  165. package/lib/module/components/icons/index.js +13 -1
  166. package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
  167. package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
  168. package/lib/module/components/onboarding/PinInput.js +274 -1
  169. package/lib/module/components/onboarding/PlatformConnector.js +240 -1
  170. package/lib/module/config/PLATFORM_APIS.md +849 -0
  171. package/lib/module/config/api.js +47 -1
  172. package/lib/module/constants/index.js +114 -1
  173. package/lib/module/context/AuthContext.js +335 -1
  174. package/lib/module/hooks/useConnectedAccounts.js +106 -1
  175. package/lib/module/hooks/useConnections.js +95 -1
  176. package/lib/module/hooks/useCredentials.js +171 -6
  177. package/lib/module/hooks/useUserConnections.js +140 -1
  178. package/lib/module/index.js +172 -1
  179. package/lib/module/services/apiClient.js +295 -1
  180. package/lib/module/services/biometricPinService.js +169 -1
  181. package/lib/module/services/chatGPTConversationExtractor.js +149 -1
  182. package/lib/module/services/chatGPTConversationService.js +268 -1
  183. package/lib/module/services/claudeConversationExtractor.js +97 -1
  184. package/lib/module/services/claudeConversationService.js +151 -1
  185. package/lib/module/services/connectedAccountsService.js +293 -1
  186. package/lib/module/services/googleAuthService.js +241 -1
  187. package/lib/module/services/hingeDataExtractor.js +99 -1
  188. package/lib/module/services/hingeDataService.js +143 -1
  189. package/lib/module/services/imageCompressionService.js +250 -1
  190. package/lib/module/services/instagramDataExtractor.js +120 -1
  191. package/lib/module/services/instagramDataService.js +156 -1
  192. package/lib/module/services/jwtStorageService.js +257 -1
  193. package/lib/module/services/linkedinDOMExtractor.js +234 -1
  194. package/lib/module/services/linkedinProfileService.js +210 -1
  195. package/lib/module/services/linkedinScrapingService.js +219 -1
  196. package/lib/module/services/llmDataStorage.js +277 -1
  197. package/lib/module/services/mobileTrainingService.js +173 -1
  198. package/lib/module/services/netflixDataExtractor.js +114 -1
  199. package/lib/module/services/netflixDataService.js +191 -1
  200. package/lib/module/services/pinEncryptionService.js +74 -6
  201. package/lib/module/services/pinStorageUtils.js +93 -1
  202. package/lib/module/services/platformAuthService.js +1461 -1
  203. package/lib/module/services/sephoraDataExtractor.js +134 -1
  204. package/lib/module/services/sephoraDataService.js +193 -1
  205. package/lib/module/services/spotifyDataExtractor.js +142 -1
  206. package/lib/module/services/spotifyDataService.js +234 -1
  207. package/lib/module/services/storageService.js +383 -1
  208. package/lib/module/services/telegramDataExtractor.js +109 -1
  209. package/lib/module/services/telegramDataService.js +493 -1
  210. package/lib/module/services/trainingApiHelpers.js +67 -1
  211. package/lib/module/services/userConnectionsService.js +329 -1
  212. package/lib/module/services/youtubeMigrationService.js +405 -1
  213. package/lib/module/theme/index.js +245 -1
  214. package/lib/module/types.js +10 -1
  215. package/lib/module/utils/Portal.js +90 -1
  216. package/lib/module/utils/api.js +118 -1
  217. package/lib/module/utils/assetRegistry.js +200 -34
  218. package/lib/module/utils/auth.js +100 -1
  219. package/lib/module/utils/connectorTests.js +600 -27
  220. package/lib/module/utils/crypto.js +54 -1
  221. package/lib/module/utils/debugHelper.js +54 -1
  222. package/lib/module/utils/encryption.js +67 -1
  223. package/lib/module/utils/eventUtils.js +270 -1
  224. package/lib/module/utils/haptics.js +59 -8
  225. package/lib/module/utils/imagePreloader.js +3 -1
  226. package/lib/module/utils/networkDiagnostics.js +217 -1
  227. package/lib/module/utils/onairosApi.js +333 -1
  228. package/lib/module/utils/programmaticFlow.js +111 -1
  229. package/lib/module/utils/retryHelper.js +211 -1
  230. package/lib/module/utils/secureStorage.js +330 -6
  231. package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
  232. package/lib/module/utils/webviewScripts/claude.js +370 -1
  233. package/lib/module/utils/webviewScripts/hinge.js +405 -1
  234. package/lib/module/utils/webviewScripts/index.js +434 -1
  235. package/lib/module/utils/webviewScripts/instagram.js +448 -1
  236. package/lib/module/utils/webviewScripts/linkedin.js +874 -1
  237. package/lib/module/utils/webviewScripts/netflix.js +376 -1
  238. package/lib/module/utils/webviewScripts/sephora.js +510 -1
  239. package/lib/module/utils/webviewScripts/spotify.js +413 -1
  240. package/lib/module/utils/webviewScripts/telegram.js +672 -1
  241. package/package.json +2 -2
@@ -1 +1,111 @@
1
- import{initializePlatformAuthService}from'../services/platformAuthService';export const executeOnairosFlow=async _0x3e220d=>{const _0x1f4a51={'LSHWZ':_0x3c05(0x0),'uNnUD':function(_0x434534,_0x3502c2){return _0x434534===_0x3502c2;},'jHGIK':_0x3c05(0x1),'xASYI':function(_0x4c6822){return _0x4c6822();},'kksSJ':'✅\x20Onairos\x20flow\x20completed\x20successfully','xesgk':_0x3c05(0x2),'xpbdV':function(_0x5d610e,_0x4bf970){return _0x5d610e!==_0x4bf970;},'sznao':_0x3c05(0x3),'yoSeH':function(_0x1ab48d,_0x1940af){return _0x1ab48d!==_0x1940af;},'kpUIh':_0x3c05(0x4),'yFcnB':function(_0x3edb79,_0x4d9633){return _0x3edb79||_0x4d9633;},'urmmS':_0x3c05(0x5),'TEUSf':_0x3c05(0x6),'iFnvX':'📱\x20Onairos\x20modal\x20should\x20be\x20displayed','oHIrs':_0x3c05(0x7),'CPIxE':_0x3c05(0x8),'mIbTk':'🚀\x20Starting\x20Onairos\x20flow\x20programmatically...','hWpom':function(_0x132b9a){return _0x132b9a();},'nxpyH':'../components/UniversalOnboarding'};try{if(_0x1f4a51[_0x3c05(0x9)](_0x1f4a51[_0x3c05(0xa)],_0x3c05(0x8))){console[_0x3c05(0xb)](_0x1f4a51[_0x3c05(0xc)]),await _0x1f4a51['hWpom'](initializePlatformAuthService);const {UniversalOnboarding:_0x56f3ce}=await import(_0x1f4a51[_0x3c05(0xd)]),React=await import('react');return new Promise((_0x5e7e31,_0x3e78ad)=>{const _0x1039e8={'jbOWG':_0x1f4a51[_0x3c05(0xe)],'DwhAu':function(_0x5dc050,_0x396aec){return _0x1f4a51['uNnUD'](_0x5dc050,_0x396aec);},'Skfwh':_0x1f4a51[_0x3c05(0xf)],'XnUaO':function(_0x3a33cf){return _0x1f4a51[_0x3c05(0x10)](_0x3a33cf);},'izJYq':_0x1f4a51[_0x3c05(0x11)],'dppks':_0x1f4a51[_0x3c05(0x12)],'KVrWT':function(_0x3d0947,_0xf3284b){return _0x1f4a51[_0x3c05(0x13)](_0x3d0947,_0xf3284b);},'dLJnk':_0x3c05(0x14),'yLypU':_0x1f4a51[_0x3c05(0x15)],'YolAk':function(_0x5a2085,_0x430697){return _0x1f4a51[_0x3c05(0x16)](_0x5a2085,_0x430697);},'xXzvC':'TbCis','eKGOb':_0x1f4a51[_0x3c05(0x17)],'VitCx':function(_0x50e55b,_0x234e98){return _0x1f4a51['yFcnB'](_0x50e55b,_0x234e98);},'hlCvW':_0x1f4a51[_0x3c05(0x18)]};if(_0x1f4a51[_0x3c05(0x13)](_0x1f4a51[_0x3c05(0x19)],'fSVOE'))_0x3f2445[_0x3c05(0x1a)](_0x1ffa06,_0x1acff3,_0x29c716);else{let _0xc31522=null;const _0xe2c76c=(_0x39bea2,_0x5e5bda,_0x5329b9)=>{_0x1039e8[_0x3c05(0x1b)]===_0x1039e8[_0x3c05(0x1b)]?(console[_0x3c05(0xb)](_0x3c05(0x1c)),_0xc31522&&_0xc31522['close']&&_0xc31522[_0x3c05(0x1d)](),_0x3e220d[_0x3c05(0x1a)]&&(_0x1039e8[_0x3c05(0x1e)](_0x1039e8[_0x3c05(0x1f)],_0x1039e8[_0x3c05(0x1f)])?_0x3e220d[_0x3c05(0x1a)](_0x39bea2,_0x5e5bda,_0x5329b9):_0x15d406['close']()),_0x1039e8[_0x3c05(0x20)](_0x5e7e31)):_0x31d929[_0x3c05(0x21)](_0x552a0a);},_0x3227f7=_0xd5c70c=>{const _0x119b5f={'VFYdB':_0x1039e8[_0x3c05(0x22)],'heQMm':function(_0x303db5){return _0x303db5();}};console[_0x3c05(0xb)](_0x1039e8['dppks'],_0xd5c70c),_0xc31522&&_0xc31522['close']&&(_0x1039e8[_0x3c05(0x23)](_0x1039e8['dLJnk'],_0x1039e8['yLypU'])?_0xc31522['close']():(_0x4b2535['log'](_0x119b5f['VFYdB']),_0x289063&&_0x267de6[_0x3c05(0x1d)]&&_0x3f226c[_0x3c05(0x1d)](),_0x3f0777['onResolved']&&_0x2c7ac4[_0x3c05(0x1a)](_0x3df5cc,_0x5e5d2c,_0x1a80cb),_0x119b5f[_0x3c05(0x24)](_0x1e12e4))),_0x3e220d[_0x3c05(0x21)]&&(_0x1039e8[_0x3c05(0x25)](_0x1039e8[_0x3c05(0x26)],_0x1039e8[_0x3c05(0x27)])?_0x3e220d[_0x3c05(0x21)](_0xd5c70c):_0x3ee5df[_0x3c05(0x1d)]()),_0x3e78ad(new Error(_0x1039e8['VitCx'](_0xd5c70c,_0x1039e8[_0x3c05(0x28)])));},_0x426dcc=React[_0x3c05(0x29)](_0x56f3ce,{'visible':!![],'onClose':()=>_0x3227f7(_0x3c05(0x2a)),'AppName':_0x3e220d[_0x3c05(0x2b)],'requestData':_0x3e220d[_0x3c05(0x2c)],'returnLink':_0x3e220d['returnLink'],'onComplete':_0xe2c76c,'preferredPlatform':_0x3e220d[_0x3c05(0x2d)],'debug':_0x3e220d[_0x3c05(0x2e)],'testMode':_0x3e220d[_0x3c05(0x2f)]});_0xc31522=_0x426dcc,console['log'](_0x1f4a51['iFnvX']);}});}else _0xa0925c['onRejection'](_0x1f4a51[_0x3c05(0x30)]);}catch(_0x394580){console[_0x3c05(0x31)](_0x3c05(0x32),_0x394580);throw _0x394580;}};function _0x1351(){const _0x3c512a=['kHAMF','nAJFN','❌\x20Onairos\x20flow\x20rejected:','xIXhg','ruMmv','Onairos\x20flow\x20was\x20rejected','fSVOE','Pre-check\x20failed','OCLPd','uNnUD','CPIxE','log','mIbTk','nxpyH','LSHWZ','jHGIK','xASYI','kksSJ','xesgk','xpbdV','khIqs','sznao','yoSeH','kpUIh','urmmS','TEUSf','onResolved','jbOWG','✅\x20Onairos\x20flow\x20completed\x20successfully','close','DwhAu','Skfwh','XnUaO','onRejection','izJYq','KVrWT','heQMm','YolAk','xXzvC','eKGOb','hlCvW','createElement','User\x20closed\x20the\x20modal','AppName','requestData','preferredPlatform','debug','testMode','oHIrs','error','❌\x20Failed\x20to\x20execute\x20Onairos\x20flow:','PBpPE','❌\x20Pre-check\x20failed,\x20not\x20starting\x20Onairos\x20flow','preCheck','oCZBZ','TGjZr','NgHxf','tVTxr','XpUnO','aotff','ESxui','rSYqR'];_0x1351=function(){return _0x3c512a;};return _0x1351();}function _0x3c05(_0x135141,_0x3c0539){_0x135141=_0x135141-0x0;const _0x22f406=_0x1351();let _0x8c3633=_0x22f406[_0x135141];return _0x8c3633;}export const startOnairosFlow=async _0x162a96=>{const _0x59a3e6={'tVTxr':_0x3c05(0x2),'XpUnO':function(_0x4ca874,_0x519c89){return _0x4ca874(_0x519c89);},'aotff':function(_0x273abb,_0xa413ac){return _0x273abb||_0xa413ac;},'ESxui':_0x3c05(0x5),'oCZBZ':_0x3c05(0x33),'TGjZr':_0x3c05(0x34),'NgHxf':'Pre-check\x20failed','rSYqR':function(_0x2395b2,_0x236a40){return _0x2395b2(_0x236a40);}};if(_0x162a96[_0x3c05(0x35)]){if(_0x3c05(0x33)===_0x59a3e6[_0x3c05(0x36)]){const _0x2eeb45=await _0x162a96[_0x3c05(0x35)]();if(!_0x2eeb45){console[_0x3c05(0xb)](_0x59a3e6[_0x3c05(0x37)]);_0x162a96[_0x3c05(0x21)]&&_0x162a96[_0x3c05(0x21)](_0x59a3e6[_0x3c05(0x38)]);return;}}else _0xac5a4['log'](_0x59a3e6[_0x3c05(0x39)],_0x7f00a2),_0x289735&&_0x3160c6[_0x3c05(0x1d)]&&_0x100db0[_0x3c05(0x1d)](),_0x262b0f['onRejection']&&_0x5066a6[_0x3c05(0x21)](_0x3d73be),_0x59a3e6[_0x3c05(0x3a)](_0x30f994,new _0x4e02a1(_0x59a3e6[_0x3c05(0x3b)](_0x63201e,_0x59a3e6[_0x3c05(0x3c)])));}return _0x59a3e6[_0x3c05(0x3d)](executeOnairosFlow,_0x162a96);};
1
+ /**
2
+ * Programmatic Onairos Flow
3
+ *
4
+ * This function executes the complete Onairos authentication and onboarding flow
5
+ * that can be attached to custom buttons or called programmatically.
6
+ */
7
+
8
+ import { initializePlatformAuthService } from '../services/platformAuthService';
9
+
10
+ /**
11
+ * Execute the complete Onairos flow programmatically
12
+ * This is the same logic that the OnairosButton uses internally
13
+ *
14
+ * @param options Configuration options for the flow
15
+ * @returns Promise that resolves when flow is complete
16
+ */
17
+ export const executeOnairosFlow = async options => {
18
+ try {
19
+ console.log('🚀 Starting Onairos flow programmatically...');
20
+
21
+ // Initialize API key service if not already initialized
22
+ await initializePlatformAuthService();
23
+
24
+ // Import components dynamically to avoid circular dependencies
25
+ const {
26
+ UniversalOnboarding
27
+ } = await import('../components/UniversalOnboarding');
28
+ const React = await import('react');
29
+
30
+ // Create a promise that resolves when the flow is complete
31
+ return new Promise((resolve, reject) => {
32
+ let modalRef = null;
33
+ const handleComplete = (apiUrl, token, userData) => {
34
+ console.log('✅ Onairos flow completed successfully');
35
+
36
+ // Clean up modal
37
+ if (modalRef && modalRef.close) {
38
+ modalRef.close();
39
+ }
40
+
41
+ // Call user's onResolved callback
42
+ if (options.onResolved) {
43
+ options.onResolved(apiUrl, token, userData);
44
+ }
45
+ resolve();
46
+ };
47
+ const handleRejection = error => {
48
+ console.log('❌ Onairos flow rejected:', error);
49
+
50
+ // Clean up modal
51
+ if (modalRef && modalRef.close) {
52
+ modalRef.close();
53
+ }
54
+
55
+ // Call user's onRejection callback
56
+ if (options.onRejection) {
57
+ options.onRejection(error);
58
+ }
59
+ reject(new Error(error || 'Onairos flow was rejected'));
60
+ };
61
+
62
+ // Create and show the Universal Onboarding modal
63
+ const modalElement = React.createElement(UniversalOnboarding, {
64
+ visible: true,
65
+ onClose: () => handleRejection('User closed the modal'),
66
+ AppName: options.AppName,
67
+ requestData: options.requestData,
68
+ returnLink: options.returnLink,
69
+ onComplete: handleComplete,
70
+ preferredPlatform: options.preferredPlatform,
71
+ debug: options.debug,
72
+ testMode: options.testMode
73
+ });
74
+
75
+ // Store modal reference for cleanup
76
+ modalRef = modalElement;
77
+
78
+ // Note: In a real implementation, you'd need to render this modal
79
+ // This is a simplified version - the actual implementation would
80
+ // need to handle React rendering in the current app context
81
+ console.log('📱 Onairos modal should be displayed');
82
+ });
83
+ } catch (error) {
84
+ console.error('❌ Failed to execute Onairos flow:', error);
85
+ throw error;
86
+ }
87
+ };
88
+
89
+ /**
90
+ * Simple wrapper function that matches the OnairosButton click behavior
91
+ *
92
+ * @param options Configuration options for the flow
93
+ * @returns Promise that resolves when flow is complete
94
+ */
95
+ export const startOnairosFlow = async options => {
96
+ // Pre-check if provided
97
+ if (options.preCheck) {
98
+ const canProceed = await options.preCheck();
99
+ if (!canProceed) {
100
+ console.log('❌ Pre-check failed, not starting Onairos flow');
101
+ if (options.onRejection) {
102
+ options.onRejection('Pre-check failed');
103
+ }
104
+ return;
105
+ }
106
+ }
107
+
108
+ // Execute the flow
109
+ return executeOnairosFlow(options);
110
+ };
111
+ //# sourceMappingURL=programmaticFlow.js.map
@@ -1 +1,211 @@
1
- export const DEFAULT_RETRY_OPTIONS={'maxRetries':0x3,'baseDelay':0x3e8,'maxDelay':0x1388,'exponentialBackoff':!![],'enableLogging':![],'shouldRetry':(_0x519b13,_0x2eafc9)=>{const _0x1319b1={'SMWVe':function(_0xfba001,_0x41ca56){return _0xfba001<_0x41ca56;},'vFMmU':function(_0x1bf396,_0x27c55c){return _0x1bf396!==_0x27c55c;},'hbPpu':function(_0x26a5f6,_0x2a9a10){return _0x26a5f6===_0x2a9a10;},'DeWUY':_0x3701(0x0),'hgYOx':_0x3701(0x1),'JyTHK':_0x3701(0x2),'ZekyC':_0x3701(0x3),'ffeza':function(_0x3d965f,_0x1a0e21){return _0x3d965f>=_0x1a0e21;},'QqLbq':_0x3701(0x4),'OMoxg':_0x3701(0x5)};if(_0x519b13[_0x3701(0x6)]>=0x190&&_0x1319b1[_0x3701(0x7)](_0x519b13[_0x3701(0x6)],0x1f4)&&_0x1319b1[_0x3701(0x8)](_0x519b13[_0x3701(0x6)],0x198)&&_0x519b13[_0x3701(0x6)]!==0x1ad)return![];if(_0x1319b1['hbPpu'](_0x519b13['name'],_0x1319b1[_0x3701(0x9)])||_0x519b13[_0x3701(0xa)][_0x3701(0xb)]('Network\x20request\x20failed')||_0x519b13[_0x3701(0xa)][_0x3701(0xb)](_0x1319b1[_0x3701(0xc)])||_0x519b13[_0x3701(0xa)]['includes'](_0x1319b1[_0x3701(0xd)])||_0x519b13[_0x3701(0xa)][_0x3701(0xb)](_0x1319b1[_0x3701(0xe)])||_0x1319b1[_0x3701(0xf)](_0x519b13[_0x3701(0x6)],0x1f4))return!![];if(_0x519b13['message'][_0x3701(0xb)](_0x1319b1[_0x3701(0x10)])||_0x519b13['message'][_0x3701(0xb)](_0x1319b1['OMoxg']))return!![];return![];}};export async function withRetry(_0x1bf532,_0x5a0bb1={}){const _0x2b3097={'ZkBry':function(_0x122cb9,_0x2d4a18){return _0x122cb9<_0x2d4a18;},'ApUGd':function(_0x56cf91,_0x119b8a){return _0x56cf91!==_0x119b8a;},'LPxNq':function(_0x134840,_0x3f93e6){return _0x134840!==_0x3f93e6;},'SIySn':function(_0x2b8779,_0x37061e){return _0x2b8779===_0x37061e;},'XzDRz':_0x3701(0x0),'mbAYg':'Network\x20request\x20failed','niZyW':_0x3701(0x1),'SnLei':_0x3701(0x2),'WzCNi':function(_0x46a185,_0x33669a){return _0x46a185>=_0x33669a;},'XJIow':_0x3701(0x4),'YLuaE':_0x3701(0x5),'XgDnp':function(_0x2f294c,_0x13ff01){return _0x2f294c+_0x13ff01;},'aPgjO':_0x3701(0x11),'OwsxG':function(_0x109795,_0x7158b1){return _0x109795>_0x7158b1;},'UrjfK':function(_0x3d5e67,_0x31d2a9){return _0x3d5e67+_0x31d2a9;},'SFUSC':function(_0x587f6f){return _0x587f6f();},'QKHXJ':function(_0x1033ce,_0x4fc59d){return _0x1033ce-_0x4fc59d;},'fIrDJ':function(_0x36a5aa,_0x44b248){return _0x36a5aa!==_0x44b248;},'OPtmR':_0x3701(0x12),'MWfVk':_0x3701(0x13),'Dczhr':'zJjIf','AXQnK':function(_0x10ebf5,_0x5efa34){return _0x10ebf5*_0x5efa34;},'IvUSq':function(_0x14f128,_0x43f0dc){return _0x14f128-_0x43f0dc;},'ngBiH':function(_0x2f5c46,_0x26c58a){return _0x2f5c46+_0x26c58a;},'LezQt':function(_0x186340,_0x5c5534){return _0x186340+_0x5c5534;},'ccdKM':_0x3701(0x14),'OZoAr':function(_0x105b97,_0x1d0812){return _0x105b97+_0x1d0812;}},_0x494ee7={...DEFAULT_RETRY_OPTIONS,..._0x5a0bb1},_0x149f16=Date['now']();let _0x2e4a14=null;for(let _0x2ffe79=0x1;_0x2ffe79<=_0x2b3097[_0x3701(0x15)](_0x494ee7[_0x3701(0x16)],0x1);_0x2ffe79++){try{if(_0x2b3097[_0x3701(0x17)](_0x3701(0x18),_0x2b3097[_0x3701(0x19)]))return!![];else{_0x494ee7[_0x3701(0x1a)]&&_0x2b3097['OwsxG'](_0x2ffe79,0x1)&&console[_0x3701(0x1b)](_0x3701(0x1c)+_0x2ffe79+'/'+_0x2b3097['UrjfK'](_0x494ee7['maxRetries'],0x1));const _0x175cd1=await _0x2b3097[_0x3701(0x1d)](_0x1bf532);return{'success':!![],'data':_0x175cd1,'attempts':_0x2ffe79,'totalDuration':_0x2b3097[_0x3701(0x1e)](Date['now'](),_0x149f16)};}}catch(_0x4e8bbd){if(_0x2b3097[_0x3701(0x1f)](_0x2b3097[_0x3701(0x20)],_0x3701(0x12)))return!![];else{_0x2e4a14=_0x4e8bbd;const _0x2227b7=_0x494ee7[_0x3701(0x21)]?_0x494ee7[_0x3701(0x21)](_0x4e8bbd,_0x2ffe79):!![];if(_0x2b3097[_0x3701(0x22)](_0x2ffe79,_0x494ee7['maxRetries'])||!_0x2227b7){if(_0x494ee7[_0x3701(0x1a)]){if(_0x2b3097[_0x3701(0x17)](_0x2b3097[_0x3701(0x23)],_0x2b3097[_0x3701(0x24)])){if(_0x2b1235['status']>=0x190&&_0x2b3097[_0x3701(0x25)](_0x17f5f3['status'],0x1f4)&&_0x2b3097[_0x3701(0x26)](_0x27bb59[_0x3701(0x6)],0x198)&&_0x2b3097[_0x3701(0x27)](_0x3a6fb8['status'],0x1ad))return![];if(_0x2b3097[_0x3701(0x17)](_0x3e3b21[_0x3701(0x28)],_0x2b3097[_0x3701(0x29)])||_0x101104['message']['includes'](_0x2b3097['mbAYg'])||_0x22e011[_0x3701(0xa)]['includes'](_0x2b3097['niZyW'])||_0x432feb[_0x3701(0xa)][_0x3701(0xb)](_0x2b3097[_0x3701(0x2a)])||_0x34c76a[_0x3701(0xa)][_0x3701(0xb)]('timeout')||_0x2b3097[_0x3701(0x2b)](_0x3c7fd9[_0x3701(0x6)],0x1f4))return!![];if(_0x14fd78[_0x3701(0xa)][_0x3701(0xb)](_0x2b3097['XJIow'])||_0x33016a[_0x3701(0xa)]['includes'](_0x2b3097[_0x3701(0x2c)]))return!![];return![];}else console[_0x3701(0x2d)](_0x3701(0x2e)+_0x4e8bbd[_0x3701(0xa)]);}break;}let _0x10f8a4=_0x494ee7[_0x3701(0x2f)];_0x494ee7['exponentialBackoff']&&(_0x10f8a4=Math[_0x3701(0x30)](_0x2b3097[_0x3701(0x31)](_0x494ee7['baseDelay'],Math['pow'](0x2,_0x2b3097[_0x3701(0x32)](_0x2ffe79,0x1))),_0x494ee7[_0x3701(0x33)]));const _0x4189c4=_0x2b3097[_0x3701(0x31)](Math[_0x3701(0x34)]()*0.1,_0x10f8a4);_0x10f8a4=Math['floor'](_0x2b3097[_0x3701(0x35)](_0x10f8a4,_0x4189c4)),_0x494ee7[_0x3701(0x36)]&&_0x494ee7[_0x3701(0x36)](_0x4e8bbd,_0x2ffe79,_0x10f8a4),_0x494ee7[_0x3701(0x1a)]&&console[_0x3701(0x1b)](_0x3701(0x37)+_0x10f8a4+_0x3701(0x38)+_0x2ffe79+'/'+_0x2b3097[_0x3701(0x39)](_0x494ee7['maxRetries'],0x1)+')'),await new Promise(_0x288d19=>setTimeout(()=>_0x288d19(),_0x10f8a4));}}}return{'success':![],'error':_0x2e4a14||new Error(_0x2b3097[_0x3701(0x3a)]),'attempts':_0x2b3097['OZoAr'](_0x494ee7['maxRetries'],0x1),'totalDuration':_0x2b3097['QKHXJ'](Date[_0x3701(0x3b)](),_0x149f16)};}function _0x5b57(){const _0xae596=['AbortError','fetch','ENOTFOUND','timeout','JSON\x20Parse\x20error','Unexpected\x20character','status','SMWVe','vFMmU','DeWUY','message','includes','hgYOx','JyTHK','ZekyC','ffeza','QqLbq','qzKlU','DyrNB','wdIpR','Unknown\x20error','XgDnp','maxRetries','SIySn','IuCWO','aPgjO','enableLogging','log','🔄\x20Retry\x20attempt\x20','SFUSC','QKHXJ','fIrDJ','OPtmR','shouldRetry','OwsxG','MWfVk','Dczhr','ZkBry','ApUGd','LPxNq','name','XzDRz','SnLei','WzCNi','YLuaE','error','❌\x20All\x20retry\x20attempts\x20exhausted\x20or\x20error\x20not\x20retryable:\x20','baseDelay','min','AXQnK','IvUSq','maxDelay','random','ngBiH','onRetry','⏳\x20Waiting\x20','ms\x20before\x20retry\x20(attempt\x20','LezQt','ccdKM','now','validation\x20endpoint','qAlDi','yvHeu','Network\x20request\x20failed','CXpyF','YDQyL','srElV','ktRFz','KFdMg','NwkIj','pow','CvmAC','CBZBe','pGpda','warn','⚠️\x20API\x20call\x20failed\x20(attempt\x20','),\x20retrying\x20in\x20','DNS','QrVyV','gYDVE','FRJWp','aEeRF','NNaeZ','success','lqTlU','OdHQG','TFqlg','ATaFP','data','yvfrl','SpTEe','RWaJP','nLjZm','IjDlz','Dsbwa','BrKDX','abort','signal','cUAhm','dWDyJ','RPyHT'];_0x5b57=function(){return _0xae596;};return _0x5b57();}export const API_RETRY_OPTIONS={'maxRetries':0x3,'baseDelay':0x3e8,'maxDelay':0x1388,'exponentialBackoff':!![],'shouldRetry':(_0x2eb8fc,_0x1428a0)=>{const _0x2ceae5={'NwkIj':function(_0x3e91c1,_0x573aa5){return _0x3e91c1*_0x573aa5;},'KGIXA':function(_0x20b06d,_0x2905a3){return _0x20b06d-_0x2905a3;},'pUSjC':function(_0x40da55,_0x31bc8c){return _0x40da55+_0x31bc8c;},'CXpyF':function(_0x3bf44c,_0x208ce1){return _0x3bf44c===_0x208ce1;},'YDQyL':_0x3701(0x3c),'srElV':function(_0x39d4c3,_0x46566e){return _0x39d4c3!==_0x46566e;},'ktRFz':'CewMV','KFdMg':_0x3701(0x3d),'jRHrh':function(_0x436329,_0x109c2f){return _0x436329<=_0x109c2f;},'NiPhL':function(_0x194161,_0x491eaa){return _0x194161===_0x491eaa;},'ZYKmK':_0x3701(0x3e),'ycHWW':_0x3701(0x0),'CvmAC':_0x3701(0x3),'zFefS':_0x3701(0x3f),'cmMcO':_0x3701(0x1),'CBZBe':'VzDTU','ODVei':_0x3701(0x4),'pGpda':_0x3701(0x5)};if(_0x2eb8fc['status']===0x191||_0x2ceae5[_0x3701(0x40)](_0x2eb8fc['status'],0x193))return![];if(_0x2ceae5[_0x3701(0x40)](_0x2eb8fc[_0x3701(0x6)],0x190)||_0x2eb8fc[_0x3701(0x6)]===0x194&&!_0x2eb8fc[_0x3701(0xa)][_0x3701(0xb)](_0x2ceae5[_0x3701(0x41)])){if(_0x2ceae5[_0x3701(0x42)](_0x2ceae5['ktRFz'],_0x2ceae5[_0x3701(0x43)]))_0x471d82['error']('❌\x20All\x20retry\x20attempts\x20exhausted\x20or\x20error\x20not\x20retryable:\x20'+_0x2295f0[_0x3701(0xa)]);else return![];}if(_0x2eb8fc['status']===0x1ad)return _0x2ceae5[_0x3701(0x40)](_0x2ceae5[_0x3701(0x44)],_0x2ceae5[_0x3701(0x44)])?_0x2ceae5['jRHrh'](_0x1428a0,0x2):!![];if(_0x2eb8fc['status']>=0x1f4){if(_0x2ceae5['NiPhL'](_0x2ceae5['ZYKmK'],_0x3701(0x3e)))return!![];else _0xe69e84=_0xd63b5e[_0x3701(0x30)](_0x2ceae5[_0x3701(0x45)](_0x2f036b[_0x3701(0x2f)],_0x3d28ce[_0x3701(0x46)](0x2,_0x2ceae5['KGIXA'](_0x1200f3,0x1))),_0x4f5041[_0x3701(0x33)]);}if(_0x2eb8fc['name']===_0x2ceae5['ycHWW']||_0x2eb8fc['message'][_0x3701(0xb)](_0x2ceae5[_0x3701(0x47)])||_0x2eb8fc['message']['includes'](_0x2ceae5['zFefS'])||_0x2eb8fc[_0x3701(0xa)][_0x3701(0xb)](_0x2ceae5['cmMcO'])||_0x2eb8fc[_0x3701(0xa)][_0x3701(0xb)](_0x3701(0x2))){if(_0x2ceae5[_0x3701(0x48)]===_0x2ceae5['CBZBe'])return!![];else _0x2d71f0[_0x3701(0x1b)]('⏳\x20Waiting\x20'+_0x3a4c76+_0x3701(0x38)+_0x2c9a95+'/'+_0x2ceae5['pUSjC'](_0x3fc798[_0x3701(0x16)],0x1)+')');}if(_0x2eb8fc[_0x3701(0xa)][_0x3701(0xb)](_0x2ceae5['ODVei'])||_0x2eb8fc['message'][_0x3701(0xb)](_0x2ceae5[_0x3701(0x49)])||_0x2eb8fc[_0x3701(0xa)][_0x3701(0xb)]('HTML\x20page\x20instead\x20of\x20JSON'))return!![];return![];},'onRetry':(_0xa56fdb,_0x2ddb97,_0x326dd4)=>{console[_0x3701(0x4a)](_0x3701(0x4b)+_0x2ddb97+_0x3701(0x4c)+_0x326dd4+'ms:\x20'+_0xa56fdb[_0x3701(0xa)]);}};function _0x3701(_0x5b5714,_0x370153){_0x5b5714=_0x5b5714-0x0;const _0x4b9908=_0x5b57();let _0x42108f=_0x4b9908[_0x5b5714];return _0x42108f;}export const NETWORK_RETRY_OPTIONS={'maxRetries':0x2,'baseDelay':0x7d0,'maxDelay':0x1f40,'exponentialBackoff':!![],'shouldRetry':(_0x12d5ea,_0x5af534)=>{const _0x3c0f9b={'hhAAf':_0x3701(0x3f),'QrVyV':_0x3701(0x2),'HCSyF':_0x3701(0x4d),'gDezM':function(_0x33e250,_0x1d4680){return _0x33e250===_0x1d4680;},'gYDVE':'AbortError'};return _0x12d5ea[_0x3701(0xa)][_0x3701(0xb)](_0x3c0f9b['hhAAf'])||_0x12d5ea[_0x3701(0xa)][_0x3701(0xb)](_0x3c0f9b[_0x3701(0x4e)])||_0x12d5ea[_0x3701(0xa)][_0x3701(0xb)](_0x3c0f9b['HCSyF'])||_0x3c0f9b['gDezM'](_0x12d5ea[_0x3701(0x28)],_0x3c0f9b[_0x3701(0x4f)]);}};export async function fetchWithRetry(_0x34d700,_0x5a6cf9={},_0x1245c0=API_RETRY_OPTIONS){const _0x2df7b2={'ATaFP':function(_0x7c72aa,_0x80be65){return _0x7c72aa+_0x80be65;},'NNaeZ':function(_0x2eccb1,_0x287116,_0x16f3df){return _0x2eccb1(_0x287116,_0x16f3df);},'lqTlU':function(_0x4e7142,_0x5f37b4){return _0x4e7142===_0x5f37b4;},'OdHQG':_0x3701(0x50),'TFqlg':_0x3701(0x51)},_0x5b2b4b=await _0x2df7b2[_0x3701(0x52)](withRetry,()=>fetch(_0x34d700,_0x5a6cf9),_0x1245c0);if(!_0x5b2b4b[_0x3701(0x53)]){if(_0x2df7b2[_0x3701(0x54)](_0x2df7b2[_0x3701(0x55)],_0x2df7b2[_0x3701(0x56)]))_0x7c6c40[_0x3701(0x1b)]('🔄\x20Retry\x20attempt\x20'+_0x390a61+'/'+_0x2df7b2[_0x3701(0x57)](_0x48f7da[_0x3701(0x16)],0x1));else throw _0x5b2b4b[_0x3701(0x2d)];}return _0x5b2b4b[_0x3701(0x58)];}export async function healthCheck(_0x33a708,_0x2687b8=0x1388){const _0xd5220f={'RWaJP':_0x3701(0x3f),'nLjZm':'ENOTFOUND','IjDlz':function(_0x3f06c8,_0x38e859){return _0x3f06c8===_0x38e859;},'Dsbwa':_0x3701(0x0),'yvfrl':function(_0x1ed7f1,_0x2c1945){return _0x1ed7f1!==_0x2c1945;},'SpTEe':'VmPtC','BrKDX':function(_0x14a7ae,_0x5d8418,_0x4b00cc){return _0x14a7ae(_0x5d8418,_0x4b00cc);},'cUAhm':'OnairosReactNative/HealthCheck','dWDyJ':function(_0x3fdf6c,_0x4a1133){return _0x3fdf6c(_0x4a1133);},'RPyHT':function(_0x47af7f,_0x258400){return _0x47af7f-_0x258400;}},_0x119531=Date[_0x3701(0x3b)]();try{if(_0xd5220f[_0x3701(0x59)](_0xd5220f['SpTEe'],_0xd5220f[_0x3701(0x5a)]))return _0xd4c4a5['message'][_0x3701(0xb)](_0xd5220f[_0x3701(0x5b)])||_0x23521e[_0x3701(0xa)][_0x3701(0xb)](_0xd5220f[_0x3701(0x5c)])||_0x5a3bda[_0x3701(0xa)]['includes'](_0x3701(0x4d))||_0xd5220f[_0x3701(0x5d)](_0x312f97[_0x3701(0x28)],_0xd5220f[_0x3701(0x5e)]);else{const _0x86d7ea=new AbortController(),_0x32787f=_0xd5220f[_0x3701(0x5f)](setTimeout,()=>_0x86d7ea[_0x3701(0x60)](),_0x2687b8),_0x11a29f=await _0xd5220f[_0x3701(0x5f)](fetch,_0x33a708,{'method':'GET','signal':_0x86d7ea[_0x3701(0x61)],'headers':{'User-Agent':_0xd5220f[_0x3701(0x62)]}});return _0xd5220f[_0x3701(0x63)](clearTimeout,_0x32787f),{'reachable':!![],'status':_0x11a29f[_0x3701(0x6)],'duration':_0xd5220f[_0x3701(0x64)](Date[_0x3701(0x3b)](),_0x119531)};}}catch(_0x5a6477){return{'reachable':![],'error':_0x5a6477[_0x3701(0xa)],'duration':_0xd5220f[_0x3701(0x64)](Date['now'](),_0x119531)};}}
1
+ /**
2
+ * 🔄 Retry Helper Utility
3
+ *
4
+ * Provides robust retry logic with exponential backoff for network operations.
5
+ * Used throughout the Onairos SDK for handling transient failures gracefully.
6
+ */
7
+
8
+ /**
9
+ * Default retry options for the Onairos SDK
10
+ */
11
+ export const DEFAULT_RETRY_OPTIONS = {
12
+ maxRetries: 3,
13
+ baseDelay: 1000,
14
+ maxDelay: 5000,
15
+ exponentialBackoff: true,
16
+ enableLogging: false,
17
+ shouldRetry: (error, attempt) => {
18
+ // Don't retry client errors (4xx) except for 408 (timeout) and 429 (rate limit)
19
+ if (error.status >= 400 && error.status < 500 && error.status !== 408 && error.status !== 429) {
20
+ return false;
21
+ }
22
+
23
+ // Retry network errors, timeouts, and server errors (5xx)
24
+ if (error.name === 'AbortError' || error.message.includes('Network request failed') || error.message.includes('fetch') || error.message.includes('ENOTFOUND') || error.message.includes('timeout') || error.status >= 500) {
25
+ return true;
26
+ }
27
+
28
+ // Retry JSON parse errors (likely server issues)
29
+ if (error.message.includes('JSON Parse error') || error.message.includes('Unexpected character')) {
30
+ return true;
31
+ }
32
+ return false;
33
+ }
34
+ };
35
+
36
+ /**
37
+ * Execute a function with retry logic and exponential backoff
38
+ * @param fn Function to execute (should return a Promise)
39
+ * @param options Retry configuration options
40
+ * @returns Promise with retry result
41
+ */
42
+ export async function withRetry(fn, options = {}) {
43
+ const config = {
44
+ ...DEFAULT_RETRY_OPTIONS,
45
+ ...options
46
+ };
47
+ const startTime = Date.now();
48
+ let lastError = null;
49
+ for (let attempt = 1; attempt <= config.maxRetries + 1; attempt++) {
50
+ try {
51
+ if (config.enableLogging && attempt > 1) {
52
+ console.log(`🔄 Retry attempt ${attempt}/${config.maxRetries + 1}`);
53
+ }
54
+ const result = await fn();
55
+ return {
56
+ success: true,
57
+ data: result,
58
+ attempts: attempt,
59
+ totalDuration: Date.now() - startTime
60
+ };
61
+ } catch (error) {
62
+ lastError = error;
63
+
64
+ // Check if we should retry this error
65
+ const shouldRetryError = config.shouldRetry ? config.shouldRetry(error, attempt) : true;
66
+
67
+ // If this is the last attempt or we shouldn't retry, throw the error
68
+ if (attempt > config.maxRetries || !shouldRetryError) {
69
+ if (config.enableLogging) {
70
+ console.error(`❌ All retry attempts exhausted or error not retryable: ${error.message}`);
71
+ }
72
+ break;
73
+ }
74
+
75
+ // Calculate delay for next attempt
76
+ let delay = config.baseDelay;
77
+ if (config.exponentialBackoff) {
78
+ delay = Math.min(config.baseDelay * Math.pow(2, attempt - 1), config.maxDelay);
79
+ }
80
+
81
+ // Add some jitter to prevent thundering herd
82
+ const jitter = Math.random() * 0.1 * delay;
83
+ delay = Math.floor(delay + jitter);
84
+ if (config.onRetry) {
85
+ config.onRetry(error, attempt, delay);
86
+ }
87
+ if (config.enableLogging) {
88
+ console.log(`⏳ Waiting ${delay}ms before retry (attempt ${attempt}/${config.maxRetries + 1})`);
89
+ }
90
+
91
+ // Wait before next attempt
92
+ await new Promise(resolve => setTimeout(() => resolve(), delay));
93
+ }
94
+ }
95
+ return {
96
+ success: false,
97
+ error: lastError || new Error('Unknown error'),
98
+ attempts: config.maxRetries + 1,
99
+ totalDuration: Date.now() - startTime
100
+ };
101
+ }
102
+
103
+ /**
104
+ * Retry configuration for API calls
105
+ */
106
+ export const API_RETRY_OPTIONS = {
107
+ maxRetries: 3,
108
+ baseDelay: 1000,
109
+ maxDelay: 5000,
110
+ exponentialBackoff: true,
111
+ shouldRetry: (error, attempt) => {
112
+ // Enhanced retry logic for API calls
113
+
114
+ // Never retry authentication errors (401) or permission errors (403)
115
+ if (error.status === 401 || error.status === 403) {
116
+ return false;
117
+ }
118
+
119
+ // Never retry bad request errors (400) or not found (404) unless it's a specific case
120
+ if (error.status === 400 || error.status === 404 && !error.message.includes('validation endpoint')) {
121
+ return false;
122
+ }
123
+
124
+ // Retry rate limiting (429) with longer delays
125
+ if (error.status === 429) {
126
+ return attempt <= 2; // Limit retries for rate limiting
127
+ }
128
+
129
+ // Retry server errors (5xx)
130
+ if (error.status >= 500) {
131
+ return true;
132
+ }
133
+
134
+ // Retry timeout and network errors
135
+ if (error.name === 'AbortError' || error.message.includes('timeout') || error.message.includes('Network request failed') || error.message.includes('fetch') || error.message.includes('ENOTFOUND')) {
136
+ return true;
137
+ }
138
+
139
+ // Retry JSON parse errors (server returning HTML instead of JSON)
140
+ if (error.message.includes('JSON Parse error') || error.message.includes('Unexpected character') || error.message.includes('HTML page instead of JSON')) {
141
+ return true;
142
+ }
143
+ return false;
144
+ },
145
+ onRetry: (error, attempt, delay) => {
146
+ console.warn(`⚠️ API call failed (attempt ${attempt}), retrying in ${delay}ms: ${error.message}`);
147
+ }
148
+ };
149
+
150
+ /**
151
+ * Specialized retry for network/connectivity issues
152
+ */
153
+ export const NETWORK_RETRY_OPTIONS = {
154
+ maxRetries: 2,
155
+ baseDelay: 2000,
156
+ maxDelay: 8000,
157
+ exponentialBackoff: true,
158
+ shouldRetry: (error, attempt) => {
159
+ // Only retry actual network/connectivity issues
160
+ return error.message.includes('Network request failed') || error.message.includes('ENOTFOUND') || error.message.includes('DNS') || error.name === 'AbortError';
161
+ }
162
+ };
163
+
164
+ /**
165
+ * Create a retry wrapper for fetch requests
166
+ * @param url Request URL
167
+ * @param options Fetch options
168
+ * @param retryOptions Retry configuration
169
+ * @returns Promise with fetch response
170
+ */
171
+ export async function fetchWithRetry(url, options = {}, retryOptions = API_RETRY_OPTIONS) {
172
+ const result = await withRetry(() => fetch(url, options), retryOptions);
173
+ if (!result.success) {
174
+ throw result.error;
175
+ }
176
+ return result.data;
177
+ }
178
+
179
+ /**
180
+ * Health check function with retry for testing connectivity
181
+ * @param url URL to check
182
+ * @param timeout Timeout in milliseconds
183
+ * @returns Promise indicating if the service is reachable
184
+ */
185
+ export async function healthCheck(url, timeout = 5000) {
186
+ const startTime = Date.now();
187
+ try {
188
+ const controller = new AbortController();
189
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
190
+ const response = await fetch(url, {
191
+ method: 'GET',
192
+ signal: controller.signal,
193
+ headers: {
194
+ 'User-Agent': 'OnairosReactNative/HealthCheck'
195
+ }
196
+ });
197
+ clearTimeout(timeoutId);
198
+ return {
199
+ reachable: true,
200
+ status: response.status,
201
+ duration: Date.now() - startTime
202
+ };
203
+ } catch (error) {
204
+ return {
205
+ reachable: false,
206
+ error: error.message,
207
+ duration: Date.now() - startTime
208
+ };
209
+ }
210
+ }
211
+ //# sourceMappingURL=retryHelper.js.map