@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.
- package/lib/commonjs/api/index.js +219 -9
- package/lib/commonjs/assets/icons/spotify.png +0 -0
- package/lib/commonjs/assets/images/spotify.png +0 -0
- 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/assets/icons/spotify.png +0 -0
- package/lib/module/assets/images/spotify.png +0 -0
- 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';function _0x4633(_0x5ad732,_0x4633e7){_0x5ad732=_0x5ad732-0x0;const _0x471f09=_0x5ad7();let _0x19e67b=_0x471f09[_0x5ad732];return _0x19e67b;}import{TouchableOpacity,Text,StyleSheet,View,ActivityIndicator,Dimensions,Image,Alert}from'react-native';import _0x503cde from'react-native-linear-gradient';import{UniversalOnboarding}from'./UniversalOnboarding';import _0x46acfd from'./WelcomeScreen';import{isApiKeyInitialized,getApiConfig}from'../services/apiKeyService';import{BRAND_IMAGES}from'../utils/assetRegistry';const {width}=Dimensions['get'](_0x4633(0x0));export const OnairosButton=forwardRef(({AppName:_0x818f5a,buttonType:buttonType=_0x4633(0x1),buttonWidth:buttonWidth=0xb4,buttonHeight:buttonHeight=0x30,hasStroke:hasStroke=![],enabled:enabled=!![],buttonForm:buttonForm=_0x4633(0x2),onResolved:_0x54c364,onRejection:_0x56941d,preCheck:_0x5724a1,color:color=_0x4633(0x3),swerv:swerv=![],darkMode:darkMode=![],returnLink:_0x209755,preferredPlatform:_0x177ec3,autoFetch:autoFetch=![],inferenceData:_0x5d16a7,textLayout:textLayout=_0x4633(0x4),textColor:textColor='black',proofMode:proofMode=![],webpageName:_0x339370,debug:debug=![],testMode:testMode=![],requestData:_0x5b5406,onPress:_0x3a18a0,primaryAuthOnly:primaryAuthOnly=![],useNewWelcomeFlow:useNewWelcomeFlow=![]},_0x49b2fb)=>{const _0x2734cb={'dUfeK':_0x4633(0x5),'hhuzO':function(_0x5e0ceb){return _0x5e0ceb();},'hNHOk':function(_0x4ea3db,_0x14a2c2){return _0x4ea3db!==_0x14a2c2;},'opZnc':'opgig','UWyJC':function(_0x1d2221){return _0x1d2221();},'ofZDi':'Connect\x20Onairos','rcPgj':_0x4633(0x6),'HJUkv':function(_0x553513,_0x493303){return _0x553513===_0x493303;},'Ebgde':_0x4633(0x7),'CMrsT':_0x4633(0x8),'LOIkB':function(_0xc20478,_0x6796d7){return _0xc20478||_0x6796d7;},'tbHWm':function(_0xe97d2c,_0x56de85){return _0xe97d2c(_0x56de85);},'mXvfW':_0x4633(0x9),'jGaej':'UaFNb','iEXjJ':_0x4633(0xa),'eBQAJ':'The\x20Onairos\x20SDK\x20requires\x20initialization\x20with\x20a\x20valid\x20API\x20key.\x0a\x0aDevelopers:\x20Please\x20call\x20initializeApiKey()\x20before\x20using\x20OnairosButton.','tAFbu':function(_0x22808a){return _0x22808a();},'dzFWJ':function(_0x3c7f1d,_0x554290){return _0x3c7f1d!==_0x554290;},'SfCIJ':_0x4633(0xb),'mekTD':_0x4633(0xc),'cDqpM':function(_0x1165bd,_0x41aa05){return _0x1165bd+_0x41aa05;},'HrWIt':function(_0x423ff5,_0x1cc61f){return _0x423ff5===_0x1cc61f;},'dgsiW':function(_0x3ae2f8,_0x219c8c){return _0x3ae2f8===_0x219c8c;},'oZVbN':function(_0x29cbe8){return _0x29cbe8();},'PUUTq':_0x4633(0xd),'dtOeQ':function(_0x12dcd2,_0x6c3f62){return _0x12dcd2===_0x6c3f62;},'zkKNo':function(_0x247a83,_0xd2f825){return _0x247a83(_0xd2f825);},'IreuO':_0x4633(0xe),'ZpSbH':_0x4633(0xf),'zcDrr':_0x4633(0x10),'RtAaL':function(_0x203924,_0x44ccea){return _0x203924===_0x44ccea;},'xysNJ':function(_0x4af902,_0x1fb670){return _0x4af902(_0x1fb670);},'RGSyb':function(_0x7fd202,_0x4fd713){return _0x7fd202 instanceof _0x4fd713;},'OdLGF':_0x4633(0x11),'jqeYz':function(_0x57d51c,_0x185945){return _0x57d51c(_0x185945);},'PiMhW':_0x4633(0x12),'tZFsu':'Sign\x20up\x20with\x20Onairos','IflkD':function(_0x5a2522,_0x8c2d6a,_0x317225){return _0x5a2522(_0x8c2d6a,_0x317225);},'zjGuI':function(_0x5dfca1){return _0x5dfca1();},'MpJfW':'[OnairosButton]\x20handleOnboardingClose:\x20Setting\x20showOnboarding\x20to\x20false.','qxnPc':function(_0x529dff,_0xf3f6cd){return _0x529dff(_0xf3f6cd);},'CeYuH':_0x4633(0x13),'peccS':_0x4633(0x14),'gRAha':function(_0x4fabd4,_0x1c15e8,_0xaeeee2){return _0x4fabd4(_0x1c15e8,_0xaeeee2);},'VNQkR':function(_0x2afddd,_0x4d3dea,_0xb3a01b){return _0x2afddd(_0x4d3dea,_0xb3a01b);},'ADoHG':'[OnairosButton]\x20Rendering\x20JSX\x20with\x20props:','zxeyg':function(_0x29ed0a,_0x5c713e){return _0x29ed0a===_0x5c713e;},'egzGa':_0x4633(0x15),'kOyBM':'#f5e7c1','fWvWM':_0x4633(0x16),'Icxpj':_0x4633(0x17),'hqQcp':_0x4633(0x18),'Qxqfr':_0x4633(0x19),'LobDK':_0x4633(0x1a),'swOGo':function(_0x5ac087,_0x11e6da){return _0x5ac087||_0x11e6da;},'fDATd':_0x4633(0x1b),'RbLQL':_0x4633(0x1c),'SWRnj':_0x4633(0x1d),'UZDpR':_0x4633(0x1e),'WuSGe':_0x4633(0x1f),'tsuOR':_0x4633(0x20),'hlyWg':'Premium\x20tier','rynAp':_0x4633(0x21),'nzdnZ':_0x4633(0x22)},[_0x44383a,_0x184bc7]=_0x2734cb[_0x4633(0x23)](useState,![]),[_0x2983fe,_0x4a27e0]=useState(![]),[_0x35d235,_0x4da649]=useState(![]);console[_0x4633(0x24)](_0x2734cb[_0x4633(0x25)],_0x35d235),_0x2734cb[_0x4633(0x26)](useEffect,()=>{console['log'](_0x2734cb[_0x4633(0x27)],_0x35d235);},[_0x35d235]),_0x2734cb[_0x4633(0x26)](useImperativeHandle,_0x49b2fb,()=>({'trigger':async()=>{return await _0x2734cb[_0x4633(0x28)](_0x355f0e),Promise['resolve']();},'reset':async()=>{const _0x10e05c={'REVFT':_0x4633(0x5)};if(_0x2734cb['hNHOk'](_0x2734cb[_0x4633(0x29)],_0x2734cb[_0x4633(0x29)]))_0x221822[_0x4633(0x24)](_0x10e05c[_0x4633(0x2a)],_0x3e8c63);else return Promise['resolve']();}}));const _0x355f0e=async()=>{const _0x12777c={'yehFE':_0x2734cb[_0x4633(0x2b)],'fDkZk':_0x2734cb[_0x4633(0x2c)],'jtAvD':_0x4633(0x2d),'YOeNf':_0x4633(0x2e)};if(_0x2734cb['HJUkv'](_0x2734cb[_0x4633(0x2f)],_0x2734cb[_0x4633(0x2f)])){console['log'](_0x2734cb[_0x4633(0x30)]);if(_0x2734cb[_0x4633(0x31)](!enabled,_0x44383a))return;_0x2734cb[_0x4633(0x32)](_0x184bc7,!![]);try{if(_0x2734cb['hNHOk']('qhzCn',_0x2734cb[_0x4633(0x33)])){if(!_0x2734cb[_0x4633(0x34)](isApiKeyInitialized)){const _0x272306=_0x4633(0x35);console[_0x4633(0x36)](_0x4633(0x37),_0x272306);if(_0x56941d){if(_0x2734cb[_0x4633(0x38)](_0x2734cb[_0x4633(0x39)],_0x2734cb[_0x4633(0x39)]))_0x56941d(_0x272306);else return _0x12ba62[_0x4633(0x3a)]();}else Alert[_0x4633(0x3b)](_0x2734cb['iEXjJ'],_0x2734cb['eBQAJ'],[{'text':'OK'}]);_0x2734cb[_0x4633(0x32)](_0x184bc7,![]);return;}const _0x4b131f=_0x2734cb[_0x4633(0x3c)](getApiConfig);if(debug){if(_0x2734cb['dzFWJ'](_0x2734cb[_0x4633(0x3d)],_0x2734cb[_0x4633(0x3d)]))switch(_0x47baed){case _0x4633(0x12):return _0x12777c['yehFE'];case _0x12777c[_0x4633(0x3e)]:return _0x12777c[_0x4633(0x3f)];case _0x4633(0x40):return _0x12777c[_0x4633(0x41)];default:return _0x4633(0x42);}else{var _0x303c71;console[_0x4633(0x24)](_0x2734cb[_0x4633(0x43)],_0x2734cb[_0x4633(0x44)](_0x2734cb[_0x4633(0x45)](_0x4b131f,null)||_0x4b131f===void 0x0||(_0x303c71=_0x4b131f[_0x4633(0x46)])===null||_0x2734cb[_0x4633(0x47)](_0x303c71,void 0x0)?void 0x0:_0x303c71[_0x4633(0x48)](0x0,0x8),'...'));}}if(_0x5724a1){const _0x3addc3=await _0x2734cb[_0x4633(0x49)](_0x5724a1);if(!_0x3addc3){console['log'](_0x2734cb[_0x4633(0x4a)]),_0x2734cb['dtOeQ'](_0x56941d,null)||_0x2734cb[_0x4633(0x47)](_0x56941d,void 0x0)||_0x2734cb[_0x4633(0x23)](_0x56941d,_0x2734cb[_0x4633(0x4b)]),_0x2734cb[_0x4633(0x32)](_0x184bc7,![]);return;}}console[_0x4633(0x24)](_0x2734cb[_0x4633(0x4c)]),_0x2734cb[_0x4633(0x23)](_0x4da649,!![]),_0x2734cb['zkKNo'](_0x184bc7,![]);}else _0x36867b(_0x108007,_0x38363c);}catch(_0x385613){console[_0x4633(0x36)](_0x2734cb[_0x4633(0x4d)],_0x385613),_0x56941d===null||_0x2734cb['RtAaL'](_0x56941d,void 0x0)||_0x2734cb['xysNJ'](_0x56941d,_0x2734cb[_0x4633(0x4e)](_0x385613,Error)?_0x385613['message']:_0x2734cb[_0x4633(0x4f)]),_0x2734cb[_0x4633(0x50)](_0x184bc7,![]);}}else _0x2734cb[_0x4633(0x34)](_0x1bbf39);},_0x416366=()=>{switch(buttonForm){case _0x2734cb[_0x4633(0x51)]:return _0x4633(0x42);case _0x2734cb[_0x4633(0x2c)]:return'Sign\x20in\x20with\x20Onairos';case'signup':return _0x2734cb[_0x4633(0x52)];default:return'Connect\x20Onairos';}},_0x26208f=_0x2734cb[_0x4633(0x53)](useCallback,(_0x7a3edb,_0x4ff85a)=>{console[_0x4633(0x24)](_0x4633(0x54)),_0x2734cb[_0x4633(0x23)](_0x4da649,![]),_0x54c364&&_0x2734cb[_0x4633(0x55)](_0x54c364,_0x7a3edb,_0x4ff85a),_0x3a18a0&&_0x2734cb[_0x4633(0x56)](_0x3a18a0);},[_0x54c364,_0x3a18a0]),_0x41ae5c=useCallback(()=>{console[_0x4633(0x24)](_0x2734cb[_0x4633(0x57)]),_0x2734cb[_0x4633(0x23)](_0x4da649,![]),_0x56941d&&_0x2734cb[_0x4633(0x58)](_0x56941d,_0x2734cb[_0x4633(0x59)]);},[_0x56941d]);return console[_0x4633(0x24)](_0x2734cb[_0x4633(0x5a)],{'AppName':_0x818f5a,'buttonType':buttonType,'buttonWidth':buttonWidth,'buttonHeight':buttonHeight,'hasStroke':hasStroke,'enabled':enabled,'buttonForm':buttonForm,'onResolved':_0x54c364,'onRejection':_0x56941d,'preCheck':_0x5724a1,'color':color,'swerv':swerv,'darkMode':darkMode,'returnLink':_0x209755,'preferredPlatform':_0x177ec3,'autoFetch':autoFetch,'inferenceData':_0x5d16a7,'textLayout':textLayout,'textColor':textColor,'proofMode':proofMode,'webpageName':_0x339370,'debug':debug,'testMode':testMode,'requestData':_0x5b5406,'onPress':_0x3a18a0,'primaryAuthOnly':primaryAuthOnly,'useNewWelcomeFlow':useNewWelcomeFlow}),React[_0x4633(0x5b)](React[_0x4633(0x5c)],null,React['createElement'](View,null,React['createElement'](TouchableOpacity,{'style':[styles['button'],_0x2734cb[_0x4633(0x5d)](buttonType,_0x2734cb[_0x4633(0x5e)])&&styles[_0x4633(0x5f)],hasStroke&&styles['strokedButton'],{'width':buttonWidth,'height':buttonHeight},swerv&&styles[_0x4633(0x60)],!enabled&&styles['disabledButton']],'onPress':_0x355f0e,'disabled':!enabled||_0x44383a,'onPressIn':()=>_0x4a27e0(!![]),'onPressOut':()=>_0x4a27e0(![])},React[_0x4633(0x5b)](_0x503cde,{'colors':[_0x2734cb[_0x4633(0x61)],_0x4633(0x62),_0x2734cb[_0x4633(0x63)]],'start':{'x':0x0,'y':0x0},'end':{'x':0x1,'y':0x0},'style':{'position':_0x2734cb[_0x4633(0x64)],'left':0x0,'right':0x0,'top':0x0,'bottom':0x0,'borderRadius':_0x2734cb[_0x4633(0x47)](buttonType,_0x2734cb['egzGa'])?0x18:0x8}}),_0x44383a?React[_0x4633(0x5b)](ActivityIndicator,{'size':_0x2734cb[_0x4633(0x65)],'color':_0x2734cb[_0x4633(0x66)]}):React[_0x4633(0x5b)](View,{'style':styles[_0x4633(0x67)]},React[_0x4633(0x5b)](View,{'style':styles['logoContainer']},React['createElement'](Image,{'source':BRAND_IMAGES[_0x4633(0x68)],'style':styles[_0x4633(0x69)],'resizeMode':_0x2734cb[_0x4633(0x6a)]})),React[_0x4633(0x5b)](Text,{'style':[styles[_0x4633(0x6b)],{'color':_0x2734cb[_0x4633(0x66)]}]},_0x416366())))),useNewWelcomeFlow?React['createElement'](_0x46acfd,{'visible':_0x35d235,'onClose':_0x41ae5c,'onComplete':_0x26208f}):React[_0x4633(0x5b)](UniversalOnboarding,{'visible':_0x35d235,'onClose':_0x41ae5c,'AppName':_0x818f5a,'requestData':_0x2734cb[_0x4633(0x6c)](_0x5b5406,{'Small':{'type':_0x4633(0x6d),'descriptions':_0x2734cb['fDATd'],'reward':_0x2734cb[_0x4633(0x6e)]},'Medium':{'type':_0x2734cb[_0x4633(0x6f)],'descriptions':_0x2734cb[_0x4633(0x70)],'reward':_0x2734cb[_0x4633(0x71)]},'Large':{'type':_0x2734cb[_0x4633(0x72)],'descriptions':_0x2734cb[_0x4633(0x73)],'reward':_0x2734cb[_0x4633(0x74)]}}),'returnLink':_0x2734cb['LOIkB'](_0x209755,_0x2734cb[_0x4633(0x75)]),'onComplete':_0x26208f,'debug':debug,'test':testMode,'preferredPlatform':_0x177ec3,'primaryAuthOnly':primaryAuthOnly}));});const styles=StyleSheet[_0x4633(0x76)]({'button':{'flexDirection':_0x4633(0x77),'alignItems':_0x4633(0x78),'justifyContent':_0x4633(0x78),'paddingVertical':0xc,'paddingHorizontal':0x10,'borderRadius':0x8,'shadowColor':'#000','shadowOffset':{'width':0x0,'height':0x2},'shadowOpacity':0.2,'shadowRadius':0x4,'elevation':0x3,'overflow':_0x4633(0x79)},'buttonContent':{'flexDirection':_0x4633(0x77),'alignItems':'center','justifyContent':'center'},'logoContainer':{'width':0x18,'height':0x18,'alignItems':_0x4633(0x78),'justifyContent':_0x4633(0x78),'marginRight':0x4},'logoText':{'color':_0x4633(0x62),'fontWeight':_0x4633(0x7a),'fontSize':0xe},'logoImage':{'width':0x14,'height':0x14},'pillButton':{'borderRadius':0x18},'strokedButton':{'backgroundColor':_0x4633(0x7b),'borderWidth':0x1},'swervButton':{'transform':[{'rotate':_0x4633(0x7c)}]},'disabledButton':{'opacity':0.6},'buttonText':{'fontSize':0x10,'fontWeight':_0x4633(0x7d),'textAlign':'center'}});function _0x5ad7(){const _0x318617=['window','normal','default','#1BA9D4','right','[OnairosButton]\x20LogEffect:\x20showOnboarding\x20state\x20changed\x20to:','login','yopNS','[OnairosButton]\x20handlePress\x20called.','bTIrj','SDK\x20Not\x20Initialized','txFnm','[OnairosButton]\x20SDK\x20initialized\x20with\x20API\x20key:','[OnairosButton]\x20Precheck\x20failed.\x20Setting\x20showOnboarding\x20to\x20false\x20(indirectly,\x20by\x20not\x20setting\x20to\x20true).','Precheck\x20validation\x20failed','[OnairosButton]\x20handlePress:\x20Setting\x20showOnboarding\x20to\x20true.','[OnairosButton]\x20Error\x20in\x20handlePress:','Unknown\x20error','connect','User\x20closed\x20onboarding','[OnairosButton]\x20Initializing.\x20Initial\x20showOnboarding:','pill','#8B6914','absolute','small','#FFFFFF','contain','Basic\x20tier','Free\x20access','Medium','Standard\x20tier','Premium\x20features','Large','Full\x20personalization','onairosevents://auth/callback','zkKNo','log','peccS','gRAha','dUfeK','hhuzO','opZnc','REVFT','ofZDi','rcPgj','Sign\x20in\x20with\x20Onairos','Sign\x20up\x20with\x20Onairos','Ebgde','CMrsT','LOIkB','tbHWm','mXvfW','UWyJC','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','error','❌\x20[OnairosButton]\x20SDK\x20NOT\x20INITIALIZED:','HJUkv','jGaej','resolve','alert','tAFbu','SfCIJ','fDkZk','jtAvD','signup','YOeNf','Connect\x20Onairos','mekTD','cDqpM','HrWIt','apiKey','dgsiW','substring','oZVbN','PUUTq','IreuO','ZpSbH','zcDrr','RGSyb','OdLGF','jqeYz','PiMhW','tZFsu','VNQkR','[OnairosButton]\x20handleOnboardingComplete:\x20Setting\x20showOnboarding\x20to\x20false.','IflkD','zjGuI','MpJfW','qxnPc','CeYuH','ADoHG','createElement','Fragment','zxeyg','egzGa','pillButton','swervButton','kOyBM','#C7A047','fWvWM','Icxpj','hqQcp','Qxqfr','buttonContent','onairosLogoAlt','logoImage','LobDK','buttonText','swOGo','Small','RbLQL','SWRnj','UZDpR','WuSGe','tsuOR','hlyWg','rynAp','nzdnZ','create','row','center','hidden','bold','transparent','-2deg','600'];_0x5ad7=function(){return _0x318617;};return _0x5ad7();}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
|