@onairos/react-native 3.7.2 → 3.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/api/index.js +219 -9
- package/lib/commonjs/components/BodyText.js +27 -9
- package/lib/commonjs/components/BrandMark.js +111 -10
- package/lib/commonjs/components/CodeInput.js +116 -9
- package/lib/commonjs/components/EmailInput.js +30 -8
- package/lib/commonjs/components/GoogleButton.js +56 -9
- package/lib/commonjs/components/HeadingGroup.js +43 -9
- package/lib/commonjs/components/LLMDataInputModal.js +664 -14
- package/lib/commonjs/components/ModalHeader.js +99 -9
- package/lib/commonjs/components/ModalSheet.js +47 -9
- package/lib/commonjs/components/Onairos.js +380 -14
- package/lib/commonjs/components/OnairosButton.js +313 -13
- package/lib/commonjs/components/OnairosSignInButton.js +130 -12
- package/lib/commonjs/components/Overlay.js +465 -13
- package/lib/commonjs/components/PersonaImage.js +137 -10
- package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
- package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
- package/lib/commonjs/components/PinCreationScreen.js +403 -12
- package/lib/commonjs/components/PinInput.js +464 -9
- package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
- package/lib/commonjs/components/PlatformList.js +137 -10
- package/lib/commonjs/components/PlatformToggle.js +180 -9
- package/lib/commonjs/components/PrimaryButton.js +180 -10
- package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
- package/lib/commonjs/components/SignInStep.js +345 -12
- package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
- package/lib/commonjs/components/VerificationStep.js +176 -11
- package/lib/commonjs/components/WelcomeScreen.js +461 -22
- package/lib/commonjs/components/icons/Basicproficon.js +37 -8
- package/lib/commonjs/components/icons/Basicprofile.js +21 -8
- package/lib/commonjs/components/icons/Checkbox.js +21 -8
- package/lib/commonjs/components/icons/Checkmark.js +27 -8
- package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
- package/lib/commonjs/components/icons/Contenticon.js +39 -8
- package/lib/commonjs/components/icons/EnochE.js +41 -8
- package/lib/commonjs/components/icons/Personalityicon.js +30 -8
- package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
- package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
- package/lib/commonjs/components/icons/Userpreferences.js +21 -8
- package/lib/commonjs/components/icons/index.js +84 -17
- package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
- package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
- package/lib/commonjs/components/onboarding/PinInput.js +283 -10
- package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
- package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
- package/lib/commonjs/config/api.js +56 -7
- package/lib/commonjs/constants/index.js +120 -7
- package/lib/commonjs/context/AuthContext.js +345 -10
- package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
- package/lib/commonjs/hooks/useConnections.js +102 -8
- package/lib/commonjs/hooks/useCredentials.js +178 -10
- package/lib/commonjs/hooks/useUserConnections.js +148 -10
- package/lib/commonjs/index.js +439 -34
- package/lib/commonjs/services/apiClient.js +298 -8
- package/lib/commonjs/services/biometricPinService.js +180 -8
- package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
- package/lib/commonjs/services/chatGPTConversationService.js +275 -9
- package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
- package/lib/commonjs/services/claudeConversationService.js +158 -9
- package/lib/commonjs/services/connectedAccountsService.js +310 -10
- package/lib/commonjs/services/googleAuthService.js +252 -11
- package/lib/commonjs/services/hingeDataExtractor.js +105 -8
- package/lib/commonjs/services/hingeDataService.js +150 -9
- package/lib/commonjs/services/imageCompressionService.js +260 -7
- package/lib/commonjs/services/instagramDataExtractor.js +126 -8
- package/lib/commonjs/services/instagramDataService.js +163 -9
- package/lib/commonjs/services/jwtStorageService.js +276 -7
- package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
- package/lib/commonjs/services/linkedinProfileService.js +222 -9
- package/lib/commonjs/services/linkedinScrapingService.js +230 -8
- package/lib/commonjs/services/llmDataStorage.js +294 -8
- package/lib/commonjs/services/mobileTrainingService.js +186 -8
- package/lib/commonjs/services/netflixDataExtractor.js +120 -8
- package/lib/commonjs/services/netflixDataService.js +198 -9
- package/lib/commonjs/services/pinEncryptionService.js +84 -8
- package/lib/commonjs/services/pinStorageUtils.js +105 -7
- package/lib/commonjs/services/platformAuthService.js +1484 -12
- package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
- package/lib/commonjs/services/sephoraDataService.js +200 -9
- package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
- package/lib/commonjs/services/spotifyDataService.js +241 -9
- package/lib/commonjs/services/storageService.js +404 -8
- package/lib/commonjs/services/telegramDataExtractor.js +115 -8
- package/lib/commonjs/services/telegramDataService.js +499 -9
- package/lib/commonjs/services/trainingApiHelpers.js +73 -7
- package/lib/commonjs/services/userConnectionsService.js +340 -10
- package/lib/commonjs/services/youtubeMigrationService.js +416 -10
- package/lib/commonjs/theme/index.js +250 -7
- package/lib/commonjs/types/ambient.d.js +2 -1
- package/lib/commonjs/types/declarations.d.js +2 -1
- package/lib/commonjs/types/index.js +6 -1
- package/lib/commonjs/types/node-fix.d.js +2 -1
- package/lib/commonjs/types/node-override.d.js +2 -1
- package/lib/commonjs/types/opacity.d.js +2 -1
- package/lib/commonjs/types.js +14 -1
- package/lib/commonjs/utils/Portal.js +98 -8
- package/lib/commonjs/utils/api.js +130 -9
- package/lib/commonjs/utils/assetRegistry.js +210 -35
- package/lib/commonjs/utils/auth.js +112 -9
- package/lib/commonjs/utils/connectorTests.js +613 -29
- package/lib/commonjs/utils/crypto.js +62 -8
- package/lib/commonjs/utils/debugHelper.js +64 -1
- package/lib/commonjs/utils/encryption.js +76 -7
- package/lib/commonjs/utils/eventUtils.js +288 -1
- package/lib/commonjs/utils/haptics.js +66 -9
- package/lib/commonjs/utils/imagePreloader.js +6 -1
- package/lib/commonjs/utils/networkDiagnostics.js +226 -8
- package/lib/commonjs/utils/onairosApi.js +350 -9
- package/lib/commonjs/utils/programmaticFlow.js +117 -9
- package/lib/commonjs/utils/retryHelper.js +220 -1
- package/lib/commonjs/utils/secureStorage.js +349 -10
- package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
- package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
- package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
- package/lib/commonjs/utils/webviewScripts/index.js +698 -15
- package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
- package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
- package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
- package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
- package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
- package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
- package/lib/module/api/index.js +211 -1
- package/lib/module/components/BodyText.js +20 -1
- package/lib/module/components/BrandMark.js +104 -1
- package/lib/module/components/CodeInput.js +109 -1
- package/lib/module/components/EmailInput.js +23 -1
- package/lib/module/components/GoogleButton.js +49 -1
- package/lib/module/components/HeadingGroup.js +36 -1
- package/lib/module/components/LLMDataInputModal.js +656 -7
- package/lib/module/components/ModalHeader.js +92 -1
- package/lib/module/components/ModalSheet.js +39 -1
- package/lib/module/components/Onairos.js +373 -1
- package/lib/module/components/OnairosButton.js +305 -1
- package/lib/module/components/OnairosSignInButton.js +121 -1
- package/lib/module/components/Overlay.js +456 -1
- package/lib/module/components/PersonaImage.js +129 -1
- package/lib/module/components/PersonaLoadingScreen.js +310 -1
- package/lib/module/components/PersonalizationConsentScreen.js +460 -1
- package/lib/module/components/PinCreationScreen.js +396 -1
- package/lib/module/components/PinInput.js +456 -1
- package/lib/module/components/PlatformConnectorsStep.js +1302 -6
- package/lib/module/components/PlatformList.js +129 -1
- package/lib/module/components/PlatformToggle.js +173 -1
- package/lib/module/components/PrimaryButton.js +172 -1
- package/lib/module/components/SignInMatchAnimation.js +189 -1
- package/lib/module/components/SignInStep.js +338 -1
- package/lib/module/components/UniversalOnboarding.js +2770 -1
- package/lib/module/components/VerificationStep.js +168 -1
- package/lib/module/components/WelcomeScreen.js +453 -1
- package/lib/module/components/icons/Basicproficon.js +30 -1
- package/lib/module/components/icons/Basicprofile.js +14 -1
- package/lib/module/components/icons/Checkbox.js +14 -1
- package/lib/module/components/icons/Checkmark.js +20 -1
- package/lib/module/components/icons/Contentanalysis.js +14 -1
- package/lib/module/components/icons/Contenticon.js +32 -1
- package/lib/module/components/icons/EnochE.js +34 -1
- package/lib/module/components/icons/Personalityicon.js +23 -1
- package/lib/module/components/icons/Personalityprofile.js +14 -1
- package/lib/module/components/icons/Personalitytraits.js +14 -1
- package/lib/module/components/icons/Userpreferences.js +14 -1
- package/lib/module/components/icons/index.js +13 -1
- package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
- package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
- package/lib/module/components/onboarding/PinInput.js +274 -1
- package/lib/module/components/onboarding/PlatformConnector.js +240 -1
- package/lib/module/config/PLATFORM_APIS.md +849 -0
- package/lib/module/config/api.js +47 -1
- package/lib/module/constants/index.js +114 -1
- package/lib/module/context/AuthContext.js +335 -1
- package/lib/module/hooks/useConnectedAccounts.js +106 -1
- package/lib/module/hooks/useConnections.js +95 -1
- package/lib/module/hooks/useCredentials.js +171 -6
- package/lib/module/hooks/useUserConnections.js +140 -1
- package/lib/module/index.js +172 -1
- package/lib/module/services/apiClient.js +295 -1
- package/lib/module/services/biometricPinService.js +169 -1
- package/lib/module/services/chatGPTConversationExtractor.js +149 -1
- package/lib/module/services/chatGPTConversationService.js +268 -1
- package/lib/module/services/claudeConversationExtractor.js +97 -1
- package/lib/module/services/claudeConversationService.js +151 -1
- package/lib/module/services/connectedAccountsService.js +293 -1
- package/lib/module/services/googleAuthService.js +241 -1
- package/lib/module/services/hingeDataExtractor.js +99 -1
- package/lib/module/services/hingeDataService.js +143 -1
- package/lib/module/services/imageCompressionService.js +250 -1
- package/lib/module/services/instagramDataExtractor.js +120 -1
- package/lib/module/services/instagramDataService.js +156 -1
- package/lib/module/services/jwtStorageService.js +257 -1
- package/lib/module/services/linkedinDOMExtractor.js +234 -1
- package/lib/module/services/linkedinProfileService.js +210 -1
- package/lib/module/services/linkedinScrapingService.js +219 -1
- package/lib/module/services/llmDataStorage.js +277 -1
- package/lib/module/services/mobileTrainingService.js +173 -1
- package/lib/module/services/netflixDataExtractor.js +114 -1
- package/lib/module/services/netflixDataService.js +191 -1
- package/lib/module/services/pinEncryptionService.js +74 -6
- package/lib/module/services/pinStorageUtils.js +93 -1
- package/lib/module/services/platformAuthService.js +1461 -1
- package/lib/module/services/sephoraDataExtractor.js +134 -1
- package/lib/module/services/sephoraDataService.js +193 -1
- package/lib/module/services/spotifyDataExtractor.js +142 -1
- package/lib/module/services/spotifyDataService.js +234 -1
- package/lib/module/services/storageService.js +383 -1
- package/lib/module/services/telegramDataExtractor.js +109 -1
- package/lib/module/services/telegramDataService.js +493 -1
- package/lib/module/services/trainingApiHelpers.js +67 -1
- package/lib/module/services/userConnectionsService.js +329 -1
- package/lib/module/services/youtubeMigrationService.js +405 -1
- package/lib/module/theme/index.js +245 -1
- package/lib/module/types.js +10 -1
- package/lib/module/utils/Portal.js +90 -1
- package/lib/module/utils/api.js +118 -1
- package/lib/module/utils/assetRegistry.js +200 -34
- package/lib/module/utils/auth.js +100 -1
- package/lib/module/utils/connectorTests.js +600 -27
- package/lib/module/utils/crypto.js +54 -1
- package/lib/module/utils/debugHelper.js +54 -1
- package/lib/module/utils/encryption.js +67 -1
- package/lib/module/utils/eventUtils.js +270 -1
- package/lib/module/utils/haptics.js +59 -8
- package/lib/module/utils/imagePreloader.js +3 -1
- package/lib/module/utils/networkDiagnostics.js +217 -1
- package/lib/module/utils/onairosApi.js +333 -1
- package/lib/module/utils/programmaticFlow.js +111 -1
- package/lib/module/utils/retryHelper.js +211 -1
- package/lib/module/utils/secureStorage.js +330 -6
- package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
- package/lib/module/utils/webviewScripts/claude.js +370 -1
- package/lib/module/utils/webviewScripts/hinge.js +405 -1
- package/lib/module/utils/webviewScripts/index.js +434 -1
- package/lib/module/utils/webviewScripts/instagram.js +448 -1
- package/lib/module/utils/webviewScripts/linkedin.js +874 -1
- package/lib/module/utils/webviewScripts/netflix.js +376 -1
- package/lib/module/utils/webviewScripts/sephora.js +510 -1
- package/lib/module/utils/webviewScripts/spotify.js +413 -1
- package/lib/module/utils/webviewScripts/telegram.js +672 -1
- package/package.json +2 -2
|
@@ -1 +1,305 @@
|
|
|
1
|
-
import React,{useState,useCallback,forwardRef,useImperativeHandle,useEffect}from'react';import{TouchableOpacity,Text,StyleSheet,View,ActivityIndicator,Dimensions,Image,Alert}from'react-native';import _0x39abd8 from'react-native-linear-gradient';import{UniversalOnboarding}from'./UniversalOnboarding';function _0x1527(){const _0x3a1764=['get','window','normal','default','#1BA9D4','right','[OnairosButton]\x20LogEffect:\x20showOnboarding\x20state\x20changed\x20to:','[OnairosButton]\x20SDK\x20initialized\x20with\x20API\x20key:','knKHj','Onairos\x20SDK\x20not\x20initialized.\x20Developers\x20must\x20call\x20initializeApiKey()\x20with\x20a\x20valid\x20API\x20key\x20before\x20using\x20SDK\x20components.\x20Get\x20your\x20API\x20key\x20from\x20https://dashboard.onairos.uk','The\x20Onairos\x20SDK\x20requires\x20initialization\x20with\x20a\x20valid\x20API\x20key.\x0a\x0aDevelopers:\x20Please\x20call\x20initializeApiKey()\x20before\x20using\x20OnairosButton.','[OnairosButton]\x20handleOnboardingComplete:\x20Setting\x20showOnboarding\x20to\x20false.','Precheck\x20validation\x20failed','mMyOm','vXWqP','XfdBk','ewNHY','PkepT','rGcrP','[OnairosButton]\x20Precheck\x20failed.\x20Setting\x20showOnboarding\x20to\x20false\x20(indirectly,\x20by\x20not\x20setting\x20to\x20true).','login','Sign\x20in\x20with\x20Onairos','Sign\x20up\x20with\x20Onairos','User\x20closed\x20onboarding','tWzOB','cSKMK','[OnairosButton]\x20handleOnboardingClose:\x20Setting\x20showOnboarding\x20to\x20false.','#C7A047','#8B6914','small','#FFFFFF','Small','Free\x20access','Medium','Premium\x20features','Large','Premium\x20tier','Full\x20personalization','VHZvf','CznbS','log','kRgqj','APTDt','fuFWV','gnvId','HxpJL','AlPVv','rgaIB','apiKey','substring','...','resolve','tJLlK','SlnOP','bGaDM','DkOsk','wAxpu','MiaGH','lElbx','QewwZ','error','DqzaP','uzkTw','zuaTA','❌\x20[OnairosButton]\x20SDK\x20NOT\x20INITIALIZED:','alert','qZNFO','NYzhl','enhGB','oRqXT','iTROF','creWQ','jzUJk','Pjiba','ummOj','BLtPY','EQtkB','mMSnu','faRsb','tTKcT','LfdGg','Olybw','mCATX','slJOv','ReHnh','RiNin','gzFmD','[OnairosButton]\x20Error\x20in\x20handlePress:','IydYe','message','bFOET','VnGFD','BhnuC','HhGwN','tHiMN','vOCOj','ngCJZ','signup','gxtXj','Connect\x20Onairos','fcPjr','hfuDi','cGSJW','KKNVb','HUVSd','gtqSa','uXWYM','zyopB','GMzec','AlcTa','inSuL','createElement','button','pillButton','strokedButton','swervButton','disabledButton','FhTAi','tNGFT','YIMOI','dGcix','dyNaa','pill','ujnCl','lzBoD','buttonContent','logoContainer','onairosLogoAlt','logoImage','buttonText','fEPoF','fRAXI','Basic\x20tier','zANLi','HetVg','PXTGS','AAFIA','gcrQN','qXOmg','AsVRZ','create','row','center','#000','bold','transparent','-2deg','600'];_0x1527=function(){return _0x3a1764;};return _0x1527();}function _0x47c5(_0x1527bc,_0x47c55d){_0x1527bc=_0x1527bc-0x0;const _0x3bae84=_0x1527();let _0x189595=_0x3bae84[_0x1527bc];return _0x189595;}import _0x1d405b from'./WelcomeScreen';import{isApiKeyInitialized,getApiConfig}from'../services/apiKeyService';import{BRAND_IMAGES}from'../utils/assetRegistry';const {width}=Dimensions[_0x47c5(0x0)](_0x47c5(0x1));export const OnairosButton=forwardRef(({AppName:_0x14c0e5,buttonType:buttonType=_0x47c5(0x2),buttonWidth:buttonWidth=0xb4,buttonHeight:buttonHeight=0x30,hasStroke:hasStroke=![],enabled:enabled=!![],buttonForm:buttonForm=_0x47c5(0x3),onResolved:_0x4105ef,onRejection:_0x56e593,preCheck:_0x3b4d73,color:color=_0x47c5(0x4),swerv:swerv=![],darkMode:darkMode=![],returnLink:_0x341f96,preferredPlatform:_0x363be4,autoFetch:autoFetch=![],inferenceData:_0x5a2ee8,textLayout:textLayout=_0x47c5(0x5),textColor:textColor='black',proofMode:proofMode=![],webpageName:_0x4d40b9,debug:debug=![],testMode:testMode=![],requestData:_0x2c6207,onPress:_0x3887fc,primaryAuthOnly:primaryAuthOnly=![],useNewWelcomeFlow:useNewWelcomeFlow=![]},_0x3a544a)=>{const _0x5bf470={'APTDt':_0x47c5(0x6),'gnvId':_0x47c5(0x7),'jzUJk':function(_0x2d92dc,_0x50179a){return _0x2d92dc+_0x50179a;},'HxpJL':function(_0x3885c5,_0x3d7956){return _0x3885c5===_0x3d7956;},'AlPVv':function(_0x5222e0,_0x22788c){return _0x5222e0===_0x22788c;},'rgaIB':function(_0x30f572,_0x353626){return _0x30f572===_0x353626;},'OseeS':_0x47c5(0x8),'wAxpu':function(_0x2bf4fc){return _0x2bf4fc();},'zuaTA':_0x47c5(0x9),'CznbS':function(_0x3ff14f,_0x4d81e9){return _0x3ff14f(_0x4d81e9);},'NYzhl':'SDK\x20Not\x20Initialized','qZNFO':_0x47c5(0xa),'ReHnh':_0x47c5(0xb),'SlnOP':function(_0x3f512d,_0x4b1fa1){return _0x3f512d(_0x4b1fa1);},'RiNin':function(_0x487474,_0x259827,_0x27fea8){return _0x487474(_0x259827,_0x27fea8);},'gzFmD':function(_0x6369a5){return _0x6369a5();},'Pjiba':function(_0xe90b70,_0x11e67a){return _0xe90b70===_0x11e67a;},'tJLlK':_0x47c5(0xc),'bGaDM':'[OnairosButton]\x20handlePress\x20called.','Yllpg':function(_0xdfb6e9,_0x497a32){return _0xdfb6e9||_0x497a32;},'DkOsk':_0x47c5(0xd),'MiaGH':function(_0x92d3b8,_0x371123){return _0x92d3b8!==_0x371123;},'lElbx':_0x47c5(0xe),'DqzaP':_0x47c5(0xf),'uzkTw':_0x47c5(0x10),'iTROF':'rYETn','creWQ':_0x47c5(0x11),'ummOj':function(_0x53770b,_0x45f2c4){return _0x53770b===_0x45f2c4;},'BLtPY':function(_0x125154,_0x249371){return _0x125154===_0x249371;},'HWPaZ':'...','tTKcT':_0x47c5(0x12),'HUVSd':function(_0x1acfc0){return _0x1acfc0();},'LfdGg':_0x47c5(0x13),'Olybw':function(_0x33c404,_0x2e16d9){return _0x33c404===_0x2e16d9;},'mCATX':function(_0x28a4cf,_0x3b68f9){return _0x28a4cf===_0x3b68f9;},'slJOv':function(_0x19513e,_0x35eb26){return _0x19513e(_0x35eb26);},'ElxEf':'[OnairosButton]\x20handlePress:\x20Setting\x20showOnboarding\x20to\x20true.','GMzec':function(_0x100eff,_0x45aafc){return _0x100eff(_0x45aafc);},'IydYe':function(_0xe30de7,_0x30c0be){return _0xe30de7===_0x30c0be;},'bFOET':'Unknown\x20error','VnGFD':'FEgdK','HhGwN':'connect','tHiMN':'Connect\x20Onairos','vOCOj':_0x47c5(0x14),'ngCJZ':_0x47c5(0x15),'gxtXj':_0x47c5(0x16),'AlcTa':_0x47c5(0x17),'VHZvf':function(_0x2a839c,_0x22f77f){return _0x2a839c(_0x22f77f);},'cmitq':function(_0x5761fa,_0xe2ccdd){return _0x5761fa===_0xe2ccdd;},'hfuDi':'cGSJW','lbNBM':function(_0x436db8,_0x3addb2){return _0x436db8===_0x3addb2;},'gtqSa':_0x47c5(0x18),'uXWYM':_0x47c5(0x19),'zyopB':_0x47c5(0x1a),'kRgqj':'[OnairosButton]\x20Initializing.\x20Initial\x20showOnboarding:','swefP':function(_0x1c05d8,_0x2ec72f,_0x15e68b){return _0x1c05d8(_0x2ec72f,_0x15e68b);},'fuFWV':function(_0x3fd290,_0x96785c,_0xe678){return _0x3fd290(_0x96785c,_0xe678);},'fcPjr':function(_0x2ec01a,_0xc98343,_0x465b47){return _0x2ec01a(_0xc98343,_0x465b47);},'inSuL':'[OnairosButton]\x20Rendering\x20JSX\x20with\x20props:','viAXL':'pill','FhTAi':'#f5e7c1','tNGFT':_0x47c5(0x1b),'YIMOI':_0x47c5(0x1c),'dGcix':'absolute','dyNaa':function(_0x17375c,_0x19c66f){return _0x17375c===_0x19c66f;},'ujnCl':_0x47c5(0x1d),'lzBoD':_0x47c5(0x1e),'nqTmy':'contain','fEPoF':function(_0x4533ac,_0x3bfec0){return _0x4533ac||_0x3bfec0;},'fRAXI':_0x47c5(0x1f),'zANLi':_0x47c5(0x20),'HetVg':_0x47c5(0x21),'CaNDi':'Standard\x20tier','rgryX':_0x47c5(0x22),'PXTGS':_0x47c5(0x23),'AAFIA':_0x47c5(0x24),'gcrQN':_0x47c5(0x25),'qXOmg':function(_0x2f8601,_0x29192c){return _0x2f8601||_0x29192c;},'AsVRZ':'onairosevents://auth/callback'},[_0xa106b,_0x3fb4f4]=_0x5bf470['CznbS'](useState,![]),[_0x3cb080,_0x158e2c]=_0x5bf470[_0x47c5(0x26)](useState,![]),[_0x3d3d6a,_0x3c6411]=_0x5bf470[_0x47c5(0x27)](useState,![]);console[_0x47c5(0x28)](_0x5bf470[_0x47c5(0x29)],_0x3d3d6a),_0x5bf470['swefP'](useEffect,()=>{console['log'](_0x5bf470[_0x47c5(0x2a)],_0x3d3d6a);},[_0x3d3d6a]),_0x5bf470[_0x47c5(0x2b)](useImperativeHandle,_0x3a544a,()=>({'trigger':async()=>{if('knKHj'!==_0x5bf470['OseeS']){var _0x32d700;_0x675219[_0x47c5(0x28)](_0x5bf470[_0x47c5(0x2c)],_0x5bf470['jzUJk'](_0x5bf470[_0x47c5(0x2d)](_0x5ae17a,null)||_0x5bf470[_0x47c5(0x2e)](_0x4087e3,void 0x0)||_0x5bf470[_0x47c5(0x2f)](_0x32d700=_0x56d64c[_0x47c5(0x30)],null)||_0x5bf470[_0x47c5(0x2f)](_0x32d700,void 0x0)?void 0x0:_0x32d700[_0x47c5(0x31)](0x0,0x8),_0x47c5(0x32)));}else return await _0x5bf470['wAxpu'](_0xe9a189),Promise['resolve']();},'reset':async()=>{return Promise[_0x47c5(0x33)]();}}));const _0xe9a189=async()=>{const _0x232459={'enhGB':_0x5bf470['NYzhl'],'oRqXT':_0x47c5(0xa),'EQtkB':function(_0x490d6a,_0x47c634){return _0x5bf470['Pjiba'](_0x490d6a,_0x47c634);},'mMSnu':_0x5bf470[_0x47c5(0x34)],'faRsb':function(_0x39a03c,_0x240264){return _0x5bf470[_0x47c5(0x35)](_0x39a03c,_0x240264);}};console['log'](_0x5bf470[_0x47c5(0x36)]);if(_0x5bf470['Yllpg'](!enabled,_0xa106b))return;_0x5bf470[_0x47c5(0x35)](_0x3fb4f4,!![]);try{if(_0x5bf470['HxpJL'](_0x5bf470[_0x47c5(0x37)],_0x5bf470[_0x47c5(0x37)])){if(!_0x5bf470[_0x47c5(0x38)](isApiKeyInitialized)){if(_0x5bf470[_0x47c5(0x39)](_0x5bf470[_0x47c5(0x3a)],_0x47c5(0x3b))){const _0x297f6e=_0x47c5(0x9);console[_0x47c5(0x3c)]('❌\x20[OnairosButton]\x20SDK\x20NOT\x20INITIALIZED:',_0x297f6e);if(_0x56e593){if(_0x5bf470[_0x47c5(0x3d)]!==_0x5bf470[_0x47c5(0x3e)])_0x56e593(_0x297f6e);else{const _0x67c738=_0x5bf470[_0x47c5(0x3f)];_0x28dbb5[_0x47c5(0x3c)](_0x47c5(0x40),_0x67c738);_0x412a3d?_0x5bf470[_0x47c5(0x27)](_0x179641,_0x67c738):Alert[_0x47c5(0x41)](_0x5bf470['NYzhl'],_0x5bf470[_0x47c5(0x42)],[{'text':'OK'}]);_0x5bf470[_0x47c5(0x27)](_0x5e8dcf,![]);return;}}else Alert['alert'](_0x5bf470[_0x47c5(0x43)],_0x5bf470[_0x47c5(0x42)],[{'text':'OK'}]);_0x3fb4f4(![]);return;}else Alert['alert'](_0x232459[_0x47c5(0x44)],_0x232459[_0x47c5(0x45)],[{'text':'OK'}]);}const _0xb8b633=_0x5bf470['wAxpu'](getApiConfig);if(debug){if(_0x5bf470[_0x47c5(0x46)]!==_0x5bf470[_0x47c5(0x47)]){var _0x1e85e7;console[_0x47c5(0x28)](_0x5bf470['gnvId'],_0x5bf470[_0x47c5(0x48)](_0x5bf470[_0x47c5(0x2d)](_0xb8b633,null)||_0x5bf470[_0x47c5(0x49)](_0xb8b633,void 0x0)||_0x5bf470[_0x47c5(0x4a)](_0x1e85e7=_0xb8b633[_0x47c5(0x30)],null)||_0x5bf470[_0x47c5(0x4b)](_0x1e85e7,void 0x0)?void 0x0:_0x1e85e7[_0x47c5(0x31)](0x0,0x8),_0x5bf470['HWPaZ']));}else{_0x362978[_0x47c5(0x28)]('[OnairosButton]\x20Precheck\x20failed.\x20Setting\x20showOnboarding\x20to\x20false\x20(indirectly,\x20by\x20not\x20setting\x20to\x20true).'),_0x232459['EQtkB'](_0x1850ee,null)||_0x232459[_0x47c5(0x4c)](_0x2a7bb3,void 0x0)||_0x56a021(_0x232459[_0x47c5(0x4d)]),_0x232459[_0x47c5(0x4e)](_0x250c57,![]);return;}}if(_0x3b4d73){if(_0x5bf470[_0x47c5(0x4f)]==='rGcrP'){const _0x3a8959=await _0x5bf470['HUVSd'](_0x3b4d73);if(!_0x3a8959){console[_0x47c5(0x28)](_0x5bf470[_0x47c5(0x50)]),_0x5bf470[_0x47c5(0x51)](_0x56e593,null)||_0x5bf470[_0x47c5(0x52)](_0x56e593,void 0x0)||_0x5bf470[_0x47c5(0x53)](_0x56e593,_0x5bf470['tJLlK']),_0x5bf470[_0x47c5(0x27)](_0x3fb4f4,![]);return;}}else _0x13ca90();}console[_0x47c5(0x28)](_0x5bf470['ElxEf']),_0x5bf470[_0x47c5(0x53)](_0x3c6411,!![]),_0x5bf470['GMzec'](_0x3fb4f4,![]);}else _0x148e3b['log'](_0x5bf470[_0x47c5(0x54)]),_0x5bf470[_0x47c5(0x35)](_0xa6108,![]),_0x26a44c&&_0x5bf470[_0x47c5(0x55)](_0x56f3aa,_0x16d25e,_0x3a357d),_0x8fa5fb&&_0x5bf470[_0x47c5(0x56)](_0xf2930f);}catch(_0x39ad21){console['error'](_0x47c5(0x57),_0x39ad21),_0x56e593===null||_0x5bf470[_0x47c5(0x58)](_0x56e593,void 0x0)||_0x56e593(_0x39ad21 instanceof Error?_0x39ad21[_0x47c5(0x59)]:_0x5bf470[_0x47c5(0x5a)]),_0x5bf470[_0x47c5(0x35)](_0x3fb4f4,![]);}},_0x52833c=()=>{if(_0x5bf470[_0x47c5(0x51)](_0x5bf470[_0x47c5(0x5b)],_0x47c5(0x5c)))return _0x4959fd[_0x47c5(0x33)]();else switch(buttonForm){case _0x5bf470[_0x47c5(0x5d)]:return _0x5bf470[_0x47c5(0x5e)];case _0x5bf470[_0x47c5(0x5f)]:return _0x5bf470[_0x47c5(0x60)];case _0x47c5(0x61):return _0x5bf470[_0x47c5(0x62)];default:return _0x47c5(0x63);}},_0x5825f9=_0x5bf470[_0x47c5(0x64)](useCallback,(_0x12f36b,_0xb778bd)=>{const _0x318c56={'KKNVb':_0x5bf470['AlcTa']};console[_0x47c5(0x28)](_0x5bf470[_0x47c5(0x54)]),_0x5bf470['VHZvf'](_0x3c6411,![]),_0x4105ef&&(_0x5bf470['cmitq'](_0x5bf470[_0x47c5(0x65)],_0x47c5(0x66))?_0x5bf470[_0x47c5(0x55)](_0x4105ef,_0x12f36b,_0xb778bd):(_0x149c19['log']('[OnairosButton]\x20handleOnboardingClose:\x20Setting\x20showOnboarding\x20to\x20false.'),_0x25f880(![]),_0x514d04&&_0x54dece(_0x318c56[_0x47c5(0x67)]))),_0x3887fc&&_0x5bf470[_0x47c5(0x68)](_0x3887fc);},[_0x4105ef,_0x3887fc]),_0xe40fc1=_0x5bf470['swefP'](useCallback,()=>{_0x5bf470['lbNBM'](_0x5bf470[_0x47c5(0x69)],_0x5bf470[_0x47c5(0x6a)])?_0x1a105a('User\x20closed\x20onboarding'):(console[_0x47c5(0x28)](_0x5bf470[_0x47c5(0x6b)]),_0x5bf470[_0x47c5(0x6c)](_0x3c6411,![]),_0x56e593&&_0x56e593(_0x5bf470[_0x47c5(0x6d)]));},[_0x56e593]);return console[_0x47c5(0x28)](_0x5bf470[_0x47c5(0x6e)],{'AppName':_0x14c0e5,'buttonType':buttonType,'buttonWidth':buttonWidth,'buttonHeight':buttonHeight,'hasStroke':hasStroke,'enabled':enabled,'buttonForm':buttonForm,'onResolved':_0x4105ef,'onRejection':_0x56e593,'preCheck':_0x3b4d73,'color':color,'swerv':swerv,'darkMode':darkMode,'returnLink':_0x341f96,'preferredPlatform':_0x363be4,'autoFetch':autoFetch,'inferenceData':_0x5a2ee8,'textLayout':textLayout,'textColor':textColor,'proofMode':proofMode,'webpageName':_0x4d40b9,'debug':debug,'testMode':testMode,'requestData':_0x2c6207,'onPress':_0x3887fc,'primaryAuthOnly':primaryAuthOnly,'useNewWelcomeFlow':useNewWelcomeFlow}),React['createElement'](React['Fragment'],null,React[_0x47c5(0x6f)](View,null,React['createElement'](TouchableOpacity,{'style':[styles[_0x47c5(0x70)],_0x5bf470['rgaIB'](buttonType,_0x5bf470['viAXL'])&&styles[_0x47c5(0x71)],hasStroke&&styles[_0x47c5(0x72)],{'width':buttonWidth,'height':buttonHeight},swerv&&styles[_0x47c5(0x73)],!enabled&&styles[_0x47c5(0x74)]],'onPress':_0xe9a189,'disabled':_0x5bf470['Yllpg'](!enabled,_0xa106b),'onPressIn':()=>_0x158e2c(!![]),'onPressOut':()=>_0x158e2c(![])},React[_0x47c5(0x6f)](_0x39abd8,{'colors':[_0x5bf470[_0x47c5(0x75)],_0x5bf470[_0x47c5(0x76)],_0x5bf470[_0x47c5(0x77)]],'start':{'x':0x0,'y':0x0},'end':{'x':0x1,'y':0x0},'style':{'position':_0x5bf470[_0x47c5(0x78)],'left':0x0,'right':0x0,'top':0x0,'bottom':0x0,'borderRadius':_0x5bf470[_0x47c5(0x79)](buttonType,_0x47c5(0x7a))?0x18:0x8}}),_0xa106b?React['createElement'](ActivityIndicator,{'size':_0x5bf470[_0x47c5(0x7b)],'color':_0x5bf470[_0x47c5(0x7c)]}):React['createElement'](View,{'style':styles[_0x47c5(0x7d)]},React['createElement'](View,{'style':styles[_0x47c5(0x7e)]},React[_0x47c5(0x6f)](Image,{'source':BRAND_IMAGES[_0x47c5(0x7f)],'style':styles[_0x47c5(0x80)],'resizeMode':_0x5bf470['nqTmy']})),React[_0x47c5(0x6f)](Text,{'style':[styles[_0x47c5(0x81)],{'color':_0x5bf470[_0x47c5(0x7c)]}]},_0x52833c())))),useNewWelcomeFlow?React[_0x47c5(0x6f)](_0x1d405b,{'visible':_0x3d3d6a,'onClose':_0xe40fc1,'onComplete':_0x5825f9}):React[_0x47c5(0x6f)](UniversalOnboarding,{'visible':_0x3d3d6a,'onClose':_0xe40fc1,'AppName':_0x14c0e5,'requestData':_0x5bf470[_0x47c5(0x82)](_0x2c6207,{'Small':{'type':_0x5bf470[_0x47c5(0x83)],'descriptions':_0x47c5(0x84),'reward':_0x5bf470[_0x47c5(0x85)]},'Medium':{'type':_0x5bf470[_0x47c5(0x86)],'descriptions':_0x5bf470['CaNDi'],'reward':_0x5bf470['rgryX']},'Large':{'type':_0x5bf470[_0x47c5(0x87)],'descriptions':_0x5bf470[_0x47c5(0x88)],'reward':_0x5bf470[_0x47c5(0x89)]}}),'returnLink':_0x5bf470[_0x47c5(0x8a)](_0x341f96,_0x5bf470[_0x47c5(0x8b)]),'onComplete':_0x5825f9,'debug':debug,'test':testMode,'preferredPlatform':_0x363be4,'primaryAuthOnly':primaryAuthOnly}));});const styles=StyleSheet[_0x47c5(0x8c)]({'button':{'flexDirection':_0x47c5(0x8d),'alignItems':_0x47c5(0x8e),'justifyContent':_0x47c5(0x8e),'paddingVertical':0xc,'paddingHorizontal':0x10,'borderRadius':0x8,'shadowColor':_0x47c5(0x8f),'shadowOffset':{'width':0x0,'height':0x2},'shadowOpacity':0.2,'shadowRadius':0x4,'elevation':0x3,'overflow':'hidden'},'buttonContent':{'flexDirection':_0x47c5(0x8d),'alignItems':_0x47c5(0x8e),'justifyContent':_0x47c5(0x8e)},'logoContainer':{'width':0x18,'height':0x18,'alignItems':_0x47c5(0x8e),'justifyContent':_0x47c5(0x8e),'marginRight':0x4},'logoText':{'color':_0x47c5(0x1b),'fontWeight':_0x47c5(0x90),'fontSize':0xe},'logoImage':{'width':0x14,'height':0x14},'pillButton':{'borderRadius':0x18},'strokedButton':{'backgroundColor':_0x47c5(0x91),'borderWidth':0x1},'swervButton':{'transform':[{'rotate':_0x47c5(0x92)}]},'disabledButton':{'opacity':0.6},'buttonText':{'fontSize':0x10,'fontWeight':_0x47c5(0x93),'textAlign':'center'}});export default OnairosButton;
|
|
1
|
+
import React, { useState, useCallback, forwardRef, useImperativeHandle, useEffect } from 'react';
|
|
2
|
+
import { TouchableOpacity, Text, StyleSheet, View, ActivityIndicator, Dimensions, Image, Alert } from 'react-native';
|
|
3
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
4
|
+
import { UniversalOnboarding } from './UniversalOnboarding';
|
|
5
|
+
import WelcomeScreen from './WelcomeScreen';
|
|
6
|
+
import { isApiKeyInitialized, getApiConfig } from '../services/apiKeyService';
|
|
7
|
+
import { BRAND_IMAGES } from '../utils/assetRegistry';
|
|
8
|
+
const {
|
|
9
|
+
width
|
|
10
|
+
} = Dimensions.get('window');
|
|
11
|
+
export const OnairosButton = /*#__PURE__*/forwardRef(({
|
|
12
|
+
AppName,
|
|
13
|
+
buttonType = 'normal',
|
|
14
|
+
buttonWidth = 180,
|
|
15
|
+
buttonHeight = 48,
|
|
16
|
+
hasStroke = false,
|
|
17
|
+
enabled = true,
|
|
18
|
+
buttonForm = 'default',
|
|
19
|
+
onResolved,
|
|
20
|
+
onRejection,
|
|
21
|
+
preCheck,
|
|
22
|
+
color = '#1BA9D4',
|
|
23
|
+
swerv = false,
|
|
24
|
+
darkMode = false,
|
|
25
|
+
returnLink,
|
|
26
|
+
preferredPlatform,
|
|
27
|
+
autoFetch = false,
|
|
28
|
+
inferenceData,
|
|
29
|
+
textLayout = 'right',
|
|
30
|
+
textColor = 'black',
|
|
31
|
+
proofMode = false,
|
|
32
|
+
webpageName,
|
|
33
|
+
debug = false,
|
|
34
|
+
testMode = false,
|
|
35
|
+
requestData,
|
|
36
|
+
onPress,
|
|
37
|
+
primaryAuthOnly = false,
|
|
38
|
+
useNewWelcomeFlow = false
|
|
39
|
+
}, ref) => {
|
|
40
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
41
|
+
const [isPressed, setIsPressed] = useState(false);
|
|
42
|
+
const [showOnboarding, setShowOnboarding] = useState(false);
|
|
43
|
+
console.log('[OnairosButton] Initializing. Initial showOnboarding:', showOnboarding);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
console.log('[OnairosButton] LogEffect: showOnboarding state changed to:', showOnboarding);
|
|
46
|
+
}, [showOnboarding]);
|
|
47
|
+
|
|
48
|
+
// Expose methods via ref
|
|
49
|
+
useImperativeHandle(ref, () => ({
|
|
50
|
+
trigger: async () => {
|
|
51
|
+
await handlePress();
|
|
52
|
+
return Promise.resolve();
|
|
53
|
+
},
|
|
54
|
+
reset: async () => {
|
|
55
|
+
return Promise.resolve();
|
|
56
|
+
}
|
|
57
|
+
}));
|
|
58
|
+
const handlePress = async () => {
|
|
59
|
+
console.log('[OnairosButton] handlePress called.');
|
|
60
|
+
if (!enabled || isLoading) return;
|
|
61
|
+
setIsLoading(true);
|
|
62
|
+
try {
|
|
63
|
+
// 🔒 CRITICAL: Check if SDK is properly initialized with valid API key
|
|
64
|
+
if (!isApiKeyInitialized()) {
|
|
65
|
+
const errorMessage = 'Onairos SDK not initialized. Developers must call initializeApiKey() with a valid API key before using SDK components. Get your API key from https://dashboard.onairos.uk';
|
|
66
|
+
console.error('❌ [OnairosButton] SDK NOT INITIALIZED:', errorMessage);
|
|
67
|
+
if (onRejection) {
|
|
68
|
+
onRejection(errorMessage);
|
|
69
|
+
} else {
|
|
70
|
+
Alert.alert('SDK Not Initialized', 'The Onairos SDK requires initialization with a valid API key.\n\nDevelopers: Please call initializeApiKey() before using OnairosButton.', [{
|
|
71
|
+
text: 'OK'
|
|
72
|
+
}]);
|
|
73
|
+
}
|
|
74
|
+
setIsLoading(false);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Log API key status for debugging
|
|
79
|
+
const config = getApiConfig();
|
|
80
|
+
if (debug) {
|
|
81
|
+
var _config$apiKey;
|
|
82
|
+
console.log('[OnairosButton] SDK initialized with API key:', (config === null || config === void 0 || (_config$apiKey = config.apiKey) === null || _config$apiKey === void 0 ? void 0 : _config$apiKey.substring(0, 8)) + '...');
|
|
83
|
+
}
|
|
84
|
+
if (preCheck) {
|
|
85
|
+
const shouldProceed = await preCheck();
|
|
86
|
+
if (!shouldProceed) {
|
|
87
|
+
console.log('[OnairosButton] Precheck failed. Setting showOnboarding to false (indirectly, by not setting to true).');
|
|
88
|
+
onRejection === null || onRejection === void 0 || onRejection('Precheck validation failed');
|
|
89
|
+
setIsLoading(false);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
console.log('[OnairosButton] handlePress: Setting showOnboarding to true.');
|
|
94
|
+
setShowOnboarding(true);
|
|
95
|
+
setIsLoading(false);
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.error('[OnairosButton] Error in handlePress:', error);
|
|
98
|
+
onRejection === null || onRejection === void 0 || onRejection(error instanceof Error ? error.message : 'Unknown error');
|
|
99
|
+
setIsLoading(false);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// Compute button text based on buttonForm
|
|
104
|
+
const getButtonText = () => {
|
|
105
|
+
switch (buttonForm) {
|
|
106
|
+
case 'connect':
|
|
107
|
+
return 'Connect Onairos';
|
|
108
|
+
case 'login':
|
|
109
|
+
return 'Sign in with Onairos';
|
|
110
|
+
case 'signup':
|
|
111
|
+
return 'Sign up with Onairos';
|
|
112
|
+
default:
|
|
113
|
+
return 'Connect Onairos';
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// Handle onboarding completion
|
|
118
|
+
const handleOnboardingComplete = useCallback((token, email) => {
|
|
119
|
+
console.log('[OnairosButton] handleOnboardingComplete: Setting showOnboarding to false.');
|
|
120
|
+
setShowOnboarding(false);
|
|
121
|
+
if (onResolved) {
|
|
122
|
+
// Call onResolved with the token and email
|
|
123
|
+
onResolved(token, email);
|
|
124
|
+
}
|
|
125
|
+
if (onPress) {
|
|
126
|
+
onPress();
|
|
127
|
+
}
|
|
128
|
+
}, [onResolved, onPress]);
|
|
129
|
+
|
|
130
|
+
// Handle onboarding close
|
|
131
|
+
const handleOnboardingClose = useCallback(() => {
|
|
132
|
+
console.log('[OnairosButton] handleOnboardingClose: Setting showOnboarding to false.');
|
|
133
|
+
setShowOnboarding(false);
|
|
134
|
+
if (onRejection) {
|
|
135
|
+
onRejection('User closed onboarding');
|
|
136
|
+
}
|
|
137
|
+
}, [onRejection]);
|
|
138
|
+
console.log('[OnairosButton] Rendering JSX with props:', {
|
|
139
|
+
AppName,
|
|
140
|
+
buttonType,
|
|
141
|
+
buttonWidth,
|
|
142
|
+
buttonHeight,
|
|
143
|
+
hasStroke,
|
|
144
|
+
enabled,
|
|
145
|
+
buttonForm,
|
|
146
|
+
onResolved,
|
|
147
|
+
onRejection,
|
|
148
|
+
preCheck,
|
|
149
|
+
color,
|
|
150
|
+
swerv,
|
|
151
|
+
darkMode,
|
|
152
|
+
returnLink,
|
|
153
|
+
preferredPlatform,
|
|
154
|
+
autoFetch,
|
|
155
|
+
inferenceData,
|
|
156
|
+
textLayout,
|
|
157
|
+
textColor,
|
|
158
|
+
proofMode,
|
|
159
|
+
webpageName,
|
|
160
|
+
debug,
|
|
161
|
+
testMode,
|
|
162
|
+
requestData,
|
|
163
|
+
onPress,
|
|
164
|
+
primaryAuthOnly,
|
|
165
|
+
useNewWelcomeFlow
|
|
166
|
+
});
|
|
167
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
168
|
+
style: [styles.button, buttonType === 'pill' && styles.pillButton, hasStroke && styles.strokedButton, {
|
|
169
|
+
width: buttonWidth,
|
|
170
|
+
height: buttonHeight
|
|
171
|
+
}, swerv && styles.swervButton, !enabled && styles.disabledButton],
|
|
172
|
+
onPress: handlePress,
|
|
173
|
+
disabled: !enabled || isLoading,
|
|
174
|
+
onPressIn: () => setIsPressed(true),
|
|
175
|
+
onPressOut: () => setIsPressed(false)
|
|
176
|
+
}, /*#__PURE__*/React.createElement(LinearGradient, {
|
|
177
|
+
colors: ['#f5e7c1', '#C7A047', '#8B6914'],
|
|
178
|
+
start: {
|
|
179
|
+
x: 0,
|
|
180
|
+
y: 0
|
|
181
|
+
},
|
|
182
|
+
end: {
|
|
183
|
+
x: 1,
|
|
184
|
+
y: 0
|
|
185
|
+
},
|
|
186
|
+
style: {
|
|
187
|
+
position: 'absolute',
|
|
188
|
+
left: 0,
|
|
189
|
+
right: 0,
|
|
190
|
+
top: 0,
|
|
191
|
+
bottom: 0,
|
|
192
|
+
borderRadius: buttonType === 'pill' ? 24 : 8
|
|
193
|
+
}
|
|
194
|
+
}), isLoading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
195
|
+
size: "small",
|
|
196
|
+
color: "#FFFFFF"
|
|
197
|
+
}) : /*#__PURE__*/React.createElement(View, {
|
|
198
|
+
style: styles.buttonContent
|
|
199
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
200
|
+
style: styles.logoContainer
|
|
201
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
202
|
+
source: BRAND_IMAGES.onairosLogoAlt,
|
|
203
|
+
style: styles.logoImage,
|
|
204
|
+
resizeMode: "contain"
|
|
205
|
+
})), /*#__PURE__*/React.createElement(Text, {
|
|
206
|
+
style: [styles.buttonText, {
|
|
207
|
+
color: '#FFFFFF'
|
|
208
|
+
}]
|
|
209
|
+
}, getButtonText())))), useNewWelcomeFlow ? /*#__PURE__*/React.createElement(WelcomeScreen, {
|
|
210
|
+
visible: showOnboarding,
|
|
211
|
+
onClose: handleOnboardingClose,
|
|
212
|
+
onComplete: handleOnboardingComplete
|
|
213
|
+
}) : /*#__PURE__*/React.createElement(UniversalOnboarding, {
|
|
214
|
+
visible: showOnboarding,
|
|
215
|
+
onClose: handleOnboardingClose,
|
|
216
|
+
AppName: AppName,
|
|
217
|
+
requestData: requestData || {
|
|
218
|
+
Small: {
|
|
219
|
+
type: 'Small',
|
|
220
|
+
descriptions: 'Basic tier',
|
|
221
|
+
reward: 'Free access'
|
|
222
|
+
},
|
|
223
|
+
Medium: {
|
|
224
|
+
type: 'Medium',
|
|
225
|
+
descriptions: 'Standard tier',
|
|
226
|
+
reward: 'Premium features'
|
|
227
|
+
},
|
|
228
|
+
Large: {
|
|
229
|
+
type: 'Large',
|
|
230
|
+
descriptions: 'Premium tier',
|
|
231
|
+
reward: 'Full personalization'
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
returnLink: returnLink || 'onairosevents://auth/callback',
|
|
235
|
+
onComplete: handleOnboardingComplete,
|
|
236
|
+
debug: debug,
|
|
237
|
+
test: testMode,
|
|
238
|
+
preferredPlatform: preferredPlatform,
|
|
239
|
+
primaryAuthOnly: primaryAuthOnly
|
|
240
|
+
}));
|
|
241
|
+
});
|
|
242
|
+
const styles = StyleSheet.create({
|
|
243
|
+
button: {
|
|
244
|
+
flexDirection: 'row',
|
|
245
|
+
alignItems: 'center',
|
|
246
|
+
justifyContent: 'center',
|
|
247
|
+
paddingVertical: 12,
|
|
248
|
+
paddingHorizontal: 16,
|
|
249
|
+
borderRadius: 8,
|
|
250
|
+
shadowColor: '#000',
|
|
251
|
+
shadowOffset: {
|
|
252
|
+
width: 0,
|
|
253
|
+
height: 2
|
|
254
|
+
},
|
|
255
|
+
shadowOpacity: 0.2,
|
|
256
|
+
shadowRadius: 4,
|
|
257
|
+
elevation: 3,
|
|
258
|
+
overflow: 'hidden'
|
|
259
|
+
},
|
|
260
|
+
buttonContent: {
|
|
261
|
+
flexDirection: 'row',
|
|
262
|
+
alignItems: 'center',
|
|
263
|
+
justifyContent: 'center'
|
|
264
|
+
},
|
|
265
|
+
logoContainer: {
|
|
266
|
+
width: 24,
|
|
267
|
+
height: 24,
|
|
268
|
+
// borderRadius: 12, // Removed to eliminate circle shape
|
|
269
|
+
// backgroundColor: '#FFFFFF', // Removed to eliminate white background
|
|
270
|
+
alignItems: 'center',
|
|
271
|
+
justifyContent: 'center',
|
|
272
|
+
marginRight: 4
|
|
273
|
+
},
|
|
274
|
+
logoText: {
|
|
275
|
+
color: '#C7A047',
|
|
276
|
+
fontWeight: 'bold',
|
|
277
|
+
fontSize: 14
|
|
278
|
+
},
|
|
279
|
+
logoImage: {
|
|
280
|
+
width: 20,
|
|
281
|
+
height: 20
|
|
282
|
+
},
|
|
283
|
+
pillButton: {
|
|
284
|
+
borderRadius: 24
|
|
285
|
+
},
|
|
286
|
+
strokedButton: {
|
|
287
|
+
backgroundColor: 'transparent',
|
|
288
|
+
borderWidth: 1
|
|
289
|
+
},
|
|
290
|
+
swervButton: {
|
|
291
|
+
transform: [{
|
|
292
|
+
rotate: '-2deg'
|
|
293
|
+
}]
|
|
294
|
+
},
|
|
295
|
+
disabledButton: {
|
|
296
|
+
opacity: 0.6
|
|
297
|
+
},
|
|
298
|
+
buttonText: {
|
|
299
|
+
fontSize: 16,
|
|
300
|
+
fontWeight: '600',
|
|
301
|
+
textAlign: 'center'
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
export default OnairosButton;
|
|
305
|
+
//# sourceMappingURL=OnairosButton.js.map
|
|
@@ -1 +1,121 @@
|
|
|
1
|
-
import React,
|
|
1
|
+
import React, { useState, useCallback } from 'react';
|
|
2
|
+
import { TouchableOpacity, Text, StyleSheet, View, Image } from 'react-native';
|
|
3
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
4
|
+
import WelcomeScreen from './WelcomeScreen';
|
|
5
|
+
import { triggerHaptic, HapticType } from '../utils/haptics';
|
|
6
|
+
import { BRAND_IMAGES } from '../utils/assetRegistry';
|
|
7
|
+
export const OnairosSignInButton = ({
|
|
8
|
+
AppName,
|
|
9
|
+
buttonWidth = 280,
|
|
10
|
+
buttonHeight = 44,
|
|
11
|
+
color = '#D4A536',
|
|
12
|
+
textColor = '#000',
|
|
13
|
+
onResolved,
|
|
14
|
+
onRejection,
|
|
15
|
+
autoFocusEmailInput = true
|
|
16
|
+
}) => {
|
|
17
|
+
const [showWelcomeScreen, setShowWelcomeScreen] = useState(false);
|
|
18
|
+
const [userEmail, setUserEmail] = useState('');
|
|
19
|
+
const handleWelcomeComplete = useCallback((token, email) => {
|
|
20
|
+
console.log('🔍 OnairosSignInButton: handleWelcomeComplete called with:', {
|
|
21
|
+
token,
|
|
22
|
+
email
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Check if we received a JWT token (real authentication) or just a placeholder token
|
|
26
|
+
const isJWTToken = token && token.includes('.') && token.split('.').length === 3;
|
|
27
|
+
console.log('🔍 OnairosSignInButton: Is JWT token?', isJWTToken);
|
|
28
|
+
|
|
29
|
+
// Close the welcome screen
|
|
30
|
+
setShowWelcomeScreen(false);
|
|
31
|
+
if (onResolved) {
|
|
32
|
+
// For JWT tokens, use the provided email or get from storage
|
|
33
|
+
if (isJWTToken) {
|
|
34
|
+
console.log('🔑 Received JWT token from WelcomeScreen, completing sign-in');
|
|
35
|
+
AsyncStorage.getItem('user_email').then(storedEmail => {
|
|
36
|
+
const emailToUse = email || storedEmail || userEmail;
|
|
37
|
+
console.log('🔑 OnairosSignInButton: Returning JWT token with email:', emailToUse);
|
|
38
|
+
onResolved(token, emailToUse);
|
|
39
|
+
});
|
|
40
|
+
} else {
|
|
41
|
+
// For placeholder tokens, still complete the flow with the provided email
|
|
42
|
+
console.log('🔑 Received placeholder token from WelcomeScreen, completing sign-in');
|
|
43
|
+
const emailToUse = email || userEmail;
|
|
44
|
+
console.log('🔑 OnairosSignInButton: Returning token with email:', emailToUse);
|
|
45
|
+
onResolved(token, emailToUse);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, [onResolved, userEmail]);
|
|
49
|
+
const handleWelcomeCancel = useCallback(() => {
|
|
50
|
+
setShowWelcomeScreen(false);
|
|
51
|
+
if (onRejection) {
|
|
52
|
+
onRejection('User closed welcome screen');
|
|
53
|
+
}
|
|
54
|
+
}, [onRejection]);
|
|
55
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
56
|
+
style: styles.container
|
|
57
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
58
|
+
style: [styles.button, {
|
|
59
|
+
width: buttonWidth,
|
|
60
|
+
height: buttonHeight,
|
|
61
|
+
backgroundColor: color
|
|
62
|
+
}],
|
|
63
|
+
onPress: () => {
|
|
64
|
+
console.log('🔘 OnairosSignInButton pressed, showing WelcomeScreen');
|
|
65
|
+
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
66
|
+
setShowWelcomeScreen(true);
|
|
67
|
+
console.log('🔘 showWelcomeScreen state set to true');
|
|
68
|
+
},
|
|
69
|
+
activeOpacity: 0.85
|
|
70
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
71
|
+
style: styles.contentRow
|
|
72
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
73
|
+
source: BRAND_IMAGES.onairosLogoAlt,
|
|
74
|
+
style: styles.logo,
|
|
75
|
+
resizeMode: "contain",
|
|
76
|
+
accessibilityLabel: "Onairos logo"
|
|
77
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
78
|
+
style: [styles.buttonText, {
|
|
79
|
+
color: textColor
|
|
80
|
+
}]
|
|
81
|
+
}, "Sign in with Onairos"))), /*#__PURE__*/React.createElement(WelcomeScreen, {
|
|
82
|
+
visible: showWelcomeScreen,
|
|
83
|
+
onClose: handleWelcomeCancel,
|
|
84
|
+
onComplete: handleWelcomeComplete
|
|
85
|
+
}));
|
|
86
|
+
};
|
|
87
|
+
const styles = StyleSheet.create({
|
|
88
|
+
button: {
|
|
89
|
+
borderRadius: 24,
|
|
90
|
+
justifyContent: 'center',
|
|
91
|
+
alignItems: 'center',
|
|
92
|
+
shadowColor: '#000',
|
|
93
|
+
shadowOffset: {
|
|
94
|
+
width: 0,
|
|
95
|
+
height: 2
|
|
96
|
+
},
|
|
97
|
+
shadowOpacity: 0.1,
|
|
98
|
+
shadowRadius: 4,
|
|
99
|
+
elevation: 2,
|
|
100
|
+
marginVertical: 8
|
|
101
|
+
},
|
|
102
|
+
contentRow: {
|
|
103
|
+
flexDirection: 'row',
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
justifyContent: 'center'
|
|
106
|
+
},
|
|
107
|
+
logo: {
|
|
108
|
+
width: 26,
|
|
109
|
+
height: 26,
|
|
110
|
+
marginRight: 10
|
|
111
|
+
},
|
|
112
|
+
buttonText: {
|
|
113
|
+
fontSize: 16,
|
|
114
|
+
fontWeight: '600',
|
|
115
|
+
textAlign: 'center'
|
|
116
|
+
},
|
|
117
|
+
container: {
|
|
118
|
+
// Add any necessary styles for the container
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
//# sourceMappingURL=OnairosSignInButton.js.map
|