@onairos/react-native 3.1.15 → 3.1.17
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/README.md +404 -0
- package/lib/commonjs/assets/images/Checkbox.svg +3 -3
- package/lib/commonjs/assets/images/EnochE.svg +19 -19
- package/lib/commonjs/assets/images/Personalityprofile.svg +3 -3
- package/lib/commonjs/assets/images/Personalitytraits.svg +3 -3
- package/lib/commonjs/assets/images/Userpreferences.svg +3 -3
- package/lib/commonjs/assets/images/arrow.svg +20 -20
- package/lib/commonjs/assets/images/basicproficon.svg +43 -43
- package/lib/commonjs/assets/images/basicprofile.svg +3 -3
- package/lib/commonjs/assets/images/checkmark.svg +4 -4
- package/lib/commonjs/assets/images/contentanalysis.svg +3 -3
- package/lib/commonjs/assets/images/contenticon.svg +23 -23
- package/lib/commonjs/assets/images/personalityicon.svg +18 -18
- package/lib/commonjs/assets/images/x-close.svg +3 -3
- package/lib/commonjs/components/OnairosSignInButton.js +32 -74
- package/lib/commonjs/components/OnairosSignInButton.js.map +1 -1
- package/lib/commonjs/components/UniversalOnboarding.js +4 -4
- package/lib/commonjs/config/api.js +2 -2
- package/lib/commonjs/hooks/useConnections.js +6 -6
- package/lib/commonjs/hooks/useUserConnections.js +10 -10
- package/lib/commonjs/index.js +5 -12
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/services/apiClient.js +35 -35
- package/lib/commonjs/services/apiKeyService.js +99 -99
- package/lib/commonjs/services/authService.js +82 -82
- package/lib/commonjs/services/biometricPinService.js +10 -10
- package/lib/commonjs/services/connectedAccountsService.js +32 -32
- package/lib/commonjs/services/googleAuthService.js +15 -15
- package/lib/commonjs/services/imageCompressionService.js +15 -15
- package/lib/commonjs/services/jwtStorageService.js +59 -59
- package/lib/commonjs/services/mobileTrainingService.js +14 -14
- package/lib/commonjs/services/pinEncryptionService.js +10 -10
- package/lib/commonjs/services/pinStorageUtils.js +15 -15
- package/lib/commonjs/services/platformAuthService.js +47 -47
- package/lib/commonjs/services/storageService.js +31 -31
- package/lib/commonjs/services/trainingApiHelpers.js +33 -33
- package/lib/commonjs/services/userConnectionsService.js +24 -24
- package/lib/commonjs/utils/Portal.js +4 -4
- package/lib/commonjs/utils/api.js +24 -24
- package/lib/commonjs/utils/auth.js +18 -18
- package/lib/commonjs/utils/crypto.js +13 -13
- package/lib/commonjs/utils/encryption.js +12 -12
- package/lib/commonjs/utils/eventUtils.js +52 -52
- package/lib/commonjs/utils/programmaticFlow.js +16 -16
- package/lib/commonjs/utils/retryHelper.js +27 -27
- package/lib/module/assets/images/Checkbox.svg +3 -3
- package/lib/module/assets/images/EnochE.svg +19 -19
- package/lib/module/assets/images/Personalityprofile.svg +3 -3
- package/lib/module/assets/images/Personalitytraits.svg +3 -3
- package/lib/module/assets/images/Userpreferences.svg +3 -3
- package/lib/module/assets/images/arrow.svg +20 -20
- package/lib/module/assets/images/basicproficon.svg +43 -43
- package/lib/module/assets/images/basicprofile.svg +3 -3
- package/lib/module/assets/images/checkmark.svg +4 -4
- package/lib/module/assets/images/contentanalysis.svg +3 -3
- package/lib/module/assets/images/contenticon.svg +23 -23
- package/lib/module/assets/images/personalityicon.svg +18 -18
- package/lib/module/assets/images/x-close.svg +3 -3
- package/lib/module/components/OnairosSignInButton.js +32 -74
- package/lib/module/components/OnairosSignInButton.js.map +1 -1
- package/lib/module/components/UniversalOnboarding.js +4 -4
- package/lib/module/config/api.js +2 -2
- package/lib/module/hooks/useConnections.js +6 -6
- package/lib/module/hooks/useUserConnections.js +10 -10
- package/lib/module/index.js +5 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/services/apiClient.js +35 -35
- package/lib/module/services/apiKeyService.js +99 -99
- package/lib/module/services/authService.js +82 -82
- package/lib/module/services/biometricPinService.js +10 -10
- package/lib/module/services/connectedAccountsService.js +32 -32
- package/lib/module/services/googleAuthService.js +15 -15
- package/lib/module/services/imageCompressionService.js +15 -15
- package/lib/module/services/jwtStorageService.js +59 -59
- package/lib/module/services/mobileTrainingService.js +14 -14
- package/lib/module/services/pinEncryptionService.js +10 -10
- package/lib/module/services/pinStorageUtils.js +15 -15
- package/lib/module/services/platformAuthService.js +47 -47
- package/lib/module/services/storageService.js +31 -31
- package/lib/module/services/trainingApiHelpers.js +33 -33
- package/lib/module/services/userConnectionsService.js +24 -24
- package/lib/module/utils/Portal.js +4 -4
- package/lib/module/utils/api.js +24 -24
- package/lib/module/utils/auth.js +18 -18
- package/lib/module/utils/crypto.js +13 -13
- package/lib/module/utils/encryption.js +12 -12
- package/lib/module/utils/eventUtils.js +52 -52
- package/lib/module/utils/programmaticFlow.js +16 -16
- package/lib/module/utils/retryHelper.js +27 -27
- package/lib/typescript/components/OnairosSignInButton.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +0 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +163 -163
- package/src/api/index.ts +151 -151
- package/src/assets/images/Checkbox.svg +3 -3
- package/src/assets/images/EnochE.svg +19 -19
- package/src/assets/images/Personalityprofile.svg +3 -3
- package/src/assets/images/Personalitytraits.svg +3 -3
- package/src/assets/images/Userpreferences.svg +3 -3
- package/src/assets/images/arrow.svg +20 -20
- package/src/assets/images/basicproficon.svg +43 -43
- package/src/assets/images/basicprofile.svg +3 -3
- package/src/assets/images/checkmark.svg +4 -4
- package/src/assets/images/contentanalysis.svg +3 -3
- package/src/assets/images/contenticon.svg +23 -23
- package/src/assets/images/personalityicon.svg +18 -18
- package/src/assets/images/x-close.svg +3 -3
- package/src/components/BodyText.tsx +33 -33
- package/src/components/BrandMark.tsx +62 -62
- package/src/components/CodeInput.tsx +32 -32
- package/src/components/DataRequestScreen.tsx +355 -355
- package/src/components/EmailInput.tsx +31 -31
- package/src/components/EmailVerificationModal.tsx +363 -363
- package/src/components/ExistingUserDataConfirmation.tsx +506 -506
- package/src/components/GoogleButton.tsx +55 -55
- package/src/components/HeadingGroup.tsx +49 -49
- package/src/components/ModalHeader.tsx +125 -125
- package/src/components/ModalSheet.tsx +57 -57
- package/src/components/Onairos.tsx +422 -422
- package/src/components/OnairosButton.tsx +339 -339
- package/src/components/OnairosSignInButton.tsx +130 -166
- package/src/components/Overlay.tsx +506 -506
- package/src/components/PersonaImage.tsx +79 -79
- package/src/components/PersonaLoadingScreen.tsx +201 -201
- package/src/components/PersonalizationConsentScreen.tsx +410 -410
- package/src/components/PinCreationScreen.tsx +492 -492
- package/src/components/PinInput.tsx +555 -555
- package/src/components/PlatformConnectorsStep.tsx +891 -891
- package/src/components/PlatformList.tsx +144 -144
- package/src/components/PlatformToggle.tsx +226 -226
- package/src/components/PrimaryButton.tsx +213 -213
- package/src/components/SignInMatchAnimation.tsx +225 -225
- package/src/components/SignInStep.tsx +217 -217
- package/src/components/TrainingModal.tsx +1047 -1047
- package/src/components/UniversalOnboarding.tsx +2887 -2887
- package/src/components/VerificationStep.tsx +198 -198
- package/src/components/WelcomeScreen.tsx +473 -473
- package/src/components/icons/Basicproficon.tsx +30 -30
- package/src/components/icons/Basicprofile.tsx +17 -17
- package/src/components/icons/Checkbox.tsx +17 -17
- package/src/components/icons/Checkmark.tsx +24 -24
- package/src/components/icons/Contentanalysis.tsx +17 -17
- package/src/components/icons/Contenticon.tsx +30 -30
- package/src/components/icons/EnochE.tsx +39 -39
- package/src/components/icons/Personalityicon.tsx +22 -22
- package/src/components/icons/Personalityprofile.tsx +17 -17
- package/src/components/icons/Personalitytraits.tsx +17 -17
- package/src/components/icons/Userpreferences.tsx +17 -17
- package/src/components/icons/index.ts +12 -12
- package/src/components/onboarding/OAuthWebView.tsx +232 -232
- package/src/config/api.ts +25 -25
- package/src/context/AuthContext.tsx +393 -393
- package/src/hooks/useConnectedAccounts.ts +138 -138
- package/src/hooks/useConnections.ts +161 -161
- package/src/hooks/useCredentials.ts +174 -174
- package/src/hooks/useUserConnections.ts +165 -165
- package/src/index.js +14 -14
- package/src/index.ts +94 -95
- package/src/services/apiClient.ts +336 -336
- package/src/services/apiKeyService.ts +919 -919
- package/src/services/authService.ts +1008 -1008
- package/src/services/biometricPinService.ts +192 -192
- package/src/services/connectedAccountsService.ts +289 -289
- package/src/services/googleAuthService.ts +279 -279
- package/src/services/imageCompressionService.ts +302 -302
- package/src/services/jwtStorageService.ts +256 -256
- package/src/services/mobileTrainingService.ts +203 -203
- package/src/services/pinEncryptionService.ts +75 -75
- package/src/services/pinStorageUtils.ts +96 -96
- package/src/services/platformAuthService.ts +1346 -1346
- package/src/services/storageService.ts +451 -451
- package/src/services/trainingApiHelpers.ts +66 -66
- package/src/services/userConnectionsService.ts +556 -556
- package/src/services/youtubeMigrationService.ts +453 -453
- package/src/theme/index.ts +239 -239
- package/src/types/ambient.d.ts +28 -28
- package/src/types/index.ts +265 -265
- package/src/types/node-fix.d.ts +18 -18
- package/src/types/node-override.d.ts +23 -23
- package/src/types/opacity.d.ts +15 -15
- package/src/types/types.d.ts +17 -17
- package/src/utils/Portal.tsx +82 -82
- package/src/utils/api.js +111 -111
- package/src/utils/auth.js +103 -103
- package/src/utils/crypto.js +59 -59
- package/src/utils/encryption.ts +68 -68
- package/src/utils/eventUtils.ts +302 -302
- package/src/utils/haptics.ts +58 -58
- package/src/utils/imagePreloader.ts +2 -2
- package/src/utils/programmaticFlow.ts +112 -112
- package/src/utils/retryHelper.ts +274 -274
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react';
|
|
2
2
|
import { TouchableOpacity, Text, StyleSheet, View, Image } from 'react-native';
|
|
3
3
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
4
|
-
import
|
|
5
|
-
import { UniversalOnboarding } from './UniversalOnboarding';
|
|
4
|
+
import WelcomeScreen from './WelcomeScreen';
|
|
6
5
|
import { triggerHaptic, HapticType } from '../utils/haptics';
|
|
7
6
|
export const OnairosSignInButton = ({
|
|
8
7
|
AppName,
|
|
@@ -14,60 +13,44 @@ export const OnairosSignInButton = ({
|
|
|
14
13
|
onRejection,
|
|
15
14
|
autoFocusEmailInput = true
|
|
16
15
|
}) => {
|
|
17
|
-
const [
|
|
18
|
-
const [showOnboardingModal, setShowOnboardingModal] = useState(false);
|
|
16
|
+
const [showWelcomeScreen, setShowWelcomeScreen] = useState(false);
|
|
19
17
|
const [userEmail, setUserEmail] = useState('');
|
|
20
|
-
const
|
|
21
|
-
console.log('🔍 OnairosSignInButton:
|
|
18
|
+
const handleWelcomeComplete = useCallback((token, email) => {
|
|
19
|
+
console.log('🔍 OnairosSignInButton: handleWelcomeComplete called with:', {
|
|
20
|
+
token,
|
|
21
|
+
email
|
|
22
|
+
});
|
|
22
23
|
|
|
23
|
-
// Check if we received a JWT token (real authentication) or just
|
|
24
|
-
const isJWTToken =
|
|
24
|
+
// Check if we received a JWT token (real authentication) or just a placeholder token
|
|
25
|
+
const isJWTToken = token && token.includes('.') && token.split('.').length === 3;
|
|
25
26
|
console.log('🔍 OnairosSignInButton: Is JWT token?', isJWTToken);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
|
|
28
|
+
// Close the welcome screen
|
|
29
|
+
setShowWelcomeScreen(false);
|
|
30
|
+
if (onResolved) {
|
|
31
|
+
// For JWT tokens, use the provided email or get from storage
|
|
32
|
+
if (isJWTToken) {
|
|
33
|
+
console.log('🔑 Received JWT token from WelcomeScreen, completing sign-in');
|
|
32
34
|
AsyncStorage.getItem('user_email').then(storedEmail => {
|
|
33
|
-
const emailToUse = storedEmail || userEmail;
|
|
35
|
+
const emailToUse = email || storedEmail || userEmail;
|
|
34
36
|
console.log('🔑 OnairosSignInButton: Returning JWT token with email:', emailToUse);
|
|
35
|
-
onResolved(
|
|
37
|
+
onResolved(token, emailToUse);
|
|
36
38
|
});
|
|
39
|
+
} else {
|
|
40
|
+
// For placeholder tokens, still complete the flow with the provided email
|
|
41
|
+
console.log('🔑 Received placeholder token from WelcomeScreen, completing sign-in');
|
|
42
|
+
const emailToUse = email || userEmail;
|
|
43
|
+
console.log('🔑 OnairosSignInButton: Returning token with email:', emailToUse);
|
|
44
|
+
onResolved(token, emailToUse);
|
|
37
45
|
}
|
|
38
|
-
} else {
|
|
39
|
-
// We received an email, continue to UniversalOnboarding platform connectors
|
|
40
|
-
console.log('📧 OnairosSignInButton: Received email, opening UniversalOnboarding platform connectors');
|
|
41
|
-
setUserEmail(emailOrToken);
|
|
42
|
-
setShowEmailModal(false);
|
|
43
|
-
setShowOnboardingModal(true);
|
|
44
|
-
console.log('📧 OnairosSignInButton: UniversalOnboarding modal should now be visible');
|
|
45
46
|
}
|
|
46
47
|
}, [onResolved, userEmail]);
|
|
47
|
-
const
|
|
48
|
-
|
|
48
|
+
const handleWelcomeCancel = useCallback(() => {
|
|
49
|
+
setShowWelcomeScreen(false);
|
|
49
50
|
if (onRejection) {
|
|
50
|
-
onRejection('User closed
|
|
51
|
+
onRejection('User closed welcome screen');
|
|
51
52
|
}
|
|
52
53
|
}, [onRejection]);
|
|
53
|
-
const handleOnboardingComplete = useCallback((token, email) => {
|
|
54
|
-
// Use setTimeout to prevent state updates during component unmount
|
|
55
|
-
setTimeout(() => {
|
|
56
|
-
setShowOnboardingModal(false);
|
|
57
|
-
if (onResolved) {
|
|
58
|
-
onResolved(token, email || userEmail);
|
|
59
|
-
}
|
|
60
|
-
}, 16);
|
|
61
|
-
}, [onResolved, userEmail]);
|
|
62
|
-
const handleOnboardingCancel = useCallback(() => {
|
|
63
|
-
// Use setTimeout to prevent state updates during component unmount
|
|
64
|
-
setTimeout(() => {
|
|
65
|
-
setShowOnboardingModal(false);
|
|
66
|
-
if (onRejection) {
|
|
67
|
-
onRejection('User closed onboarding');
|
|
68
|
-
}
|
|
69
|
-
}, 16);
|
|
70
|
-
}, [onRejection]);
|
|
71
54
|
return /*#__PURE__*/React.createElement(View, {
|
|
72
55
|
style: styles.container
|
|
73
56
|
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
@@ -78,7 +61,7 @@ export const OnairosSignInButton = ({
|
|
|
78
61
|
}],
|
|
79
62
|
onPress: () => {
|
|
80
63
|
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
81
|
-
|
|
64
|
+
setShowWelcomeScreen(true);
|
|
82
65
|
},
|
|
83
66
|
activeOpacity: 0.85
|
|
84
67
|
}, /*#__PURE__*/React.createElement(View, {
|
|
@@ -92,35 +75,10 @@ export const OnairosSignInButton = ({
|
|
|
92
75
|
style: [styles.buttonText, {
|
|
93
76
|
color: textColor
|
|
94
77
|
}]
|
|
95
|
-
}, "Sign in with Onairos"))), /*#__PURE__*/React.createElement(
|
|
96
|
-
visible:
|
|
97
|
-
|
|
98
|
-
onComplete:
|
|
99
|
-
autoFocusEmailInput: autoFocusEmailInput,
|
|
100
|
-
isPrimaryAuth: true
|
|
101
|
-
}), /*#__PURE__*/React.createElement(UniversalOnboarding, {
|
|
102
|
-
visible: showOnboardingModal,
|
|
103
|
-
onClose: handleOnboardingCancel,
|
|
104
|
-
onComplete: handleOnboardingComplete,
|
|
105
|
-
AppName: AppName,
|
|
106
|
-
primaryAuthOnly: false,
|
|
107
|
-
requestData: {
|
|
108
|
-
Small: {
|
|
109
|
-
type: "Small",
|
|
110
|
-
descriptions: "Basic tier",
|
|
111
|
-
reward: "1"
|
|
112
|
-
},
|
|
113
|
-
Medium: {
|
|
114
|
-
type: "Medium",
|
|
115
|
-
descriptions: "Standard tier",
|
|
116
|
-
reward: "2"
|
|
117
|
-
},
|
|
118
|
-
Large: {
|
|
119
|
-
type: "Large",
|
|
120
|
-
descriptions: "Premium tier",
|
|
121
|
-
reward: "3"
|
|
122
|
-
}
|
|
123
|
-
}
|
|
78
|
+
}, "Sign in with Onairos"))), /*#__PURE__*/React.createElement(WelcomeScreen, {
|
|
79
|
+
visible: showWelcomeScreen,
|
|
80
|
+
onClose: handleWelcomeCancel,
|
|
81
|
+
onComplete: handleWelcomeComplete
|
|
124
82
|
}));
|
|
125
83
|
};
|
|
126
84
|
const styles = StyleSheet.create({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","useCallback","TouchableOpacity","Text","StyleSheet","View","Image","AsyncStorage","
|
|
1
|
+
{"version":3,"names":["React","useState","useCallback","TouchableOpacity","Text","StyleSheet","View","Image","AsyncStorage","WelcomeScreen","triggerHaptic","HapticType","OnairosSignInButton","AppName","buttonWidth","buttonHeight","color","textColor","onResolved","onRejection","autoFocusEmailInput","showWelcomeScreen","setShowWelcomeScreen","userEmail","setUserEmail","handleWelcomeComplete","token","email","console","log","isJWTToken","includes","split","length","getItem","then","storedEmail","emailToUse","handleWelcomeCancel","createElement","style","styles","container","button","width","height","backgroundColor","onPress","BUTTON_PRESS","activeOpacity","contentRow","source","require","logo","resizeMode","accessibilityLabel","buttonText","visible","onClose","onComplete","create","borderRadius","justifyContent","alignItems","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","marginVertical","flexDirection","marginRight","fontSize","fontWeight","textAlign"],"sourceRoot":"../../../src","sources":["components/OnairosSignInButton.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,WAAW,QAAQ,OAAO;AACpD,SAASC,gBAAgB,EAAEC,IAAI,EAAEC,UAAU,EAAEC,IAAI,EAAEC,KAAK,QAAQ,cAAc;AAC9E,OAAOC,YAAY,MAAM,2CAA2C;AACpE,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,SAASC,aAAa,EAAEC,UAAU,QAAQ,kBAAkB;AAa5D,OAAO,MAAMC,mBAAuD,GAAGA,CAAC;EACtEC,OAAO;EACPC,WAAW,GAAG,GAAG;EACjBC,YAAY,GAAG,EAAE;EACjBC,KAAK,GAAG,SAAS;EACjBC,SAAS,GAAG,MAAM;EAClBC,UAAU;EACVC,WAAW;EACXC,mBAAmB,GAAG;AACxB,CAAC,KAAK;EACJ,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGrB,QAAQ,CAAC,KAAK,CAAC;EACjE,MAAM,CAACsB,SAAS,EAAEC,YAAY,CAAC,GAAGvB,QAAQ,CAAS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AAQ;IACpBC,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MAAErB,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;IACrCqB,aAAa,EAAE,GAAG;IAClBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE,CAAC;IACZC,cAAc,EAAE;EAClB,CAAC;EACDnB,UAAU,EAAE;IACVoB,aAAa,EAAE,KAAK;IACpBP,UAAU,EAAE,QAAQ;IACpBD,cAAc,EAAE;EAClB,CAAC;EACDT,IAAI,EAAE;IACJT,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACV0B,WAAW,EAAE;EACf,CAAC;EACDf,UAAU,EAAE;IACVgB,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBC,SAAS,EAAE;EACb,CAAC;EACDhC,SAAS,EAAE;IACT;EAAA;AAEJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -579,8 +579,8 @@ export const UniversalOnboarding = ({
|
|
|
579
579
|
}
|
|
580
580
|
}, [platformToggles, username]);
|
|
581
581
|
|
|
582
|
-
/**
|
|
583
|
-
* Handles OAuth callback URLs
|
|
582
|
+
/**
|
|
583
|
+
* Handles OAuth callback URLs
|
|
584
584
|
*/
|
|
585
585
|
const handleOAuthCallback = useCallback(url => {
|
|
586
586
|
try {
|
|
@@ -612,8 +612,8 @@ export const UniversalOnboarding = ({
|
|
|
612
612
|
}
|
|
613
613
|
}, [currentPlatform, username]);
|
|
614
614
|
|
|
615
|
-
/**
|
|
616
|
-
* Handles successful OAuth authentication from the OAuthWebView
|
|
615
|
+
/**
|
|
616
|
+
* Handles successful OAuth authentication from the OAuthWebView
|
|
617
617
|
*/
|
|
618
618
|
const handleOAuthSuccess = useCallback(async code => {
|
|
619
619
|
console.log(`🎉 OAuth success for ${currentPlatform} - backend callback completed`);
|
package/lib/module/config/api.js
CHANGED
|
@@ -6,8 +6,8 @@ export const useConnections = () => {
|
|
|
6
6
|
const [connections, setConnections] = useState({});
|
|
7
7
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* Connect a platform using OAuth or native SDK
|
|
9
|
+
/**
|
|
10
|
+
* Connect a platform using OAuth or native SDK
|
|
11
11
|
*/
|
|
12
12
|
const connectPlatform = useCallback(async (platform, username) => {
|
|
13
13
|
try {
|
|
@@ -76,8 +76,8 @@ export const useConnections = () => {
|
|
|
76
76
|
}
|
|
77
77
|
}, []);
|
|
78
78
|
|
|
79
|
-
/**
|
|
80
|
-
* Disconnect a platform
|
|
79
|
+
/**
|
|
80
|
+
* Disconnect a platform
|
|
81
81
|
*/
|
|
82
82
|
const disconnectPlatform = useCallback(async (platform, username) => {
|
|
83
83
|
try {
|
|
@@ -128,8 +128,8 @@ export const useConnections = () => {
|
|
|
128
128
|
}
|
|
129
129
|
}, []);
|
|
130
130
|
|
|
131
|
-
/**
|
|
132
|
-
* Get current connection status
|
|
131
|
+
/**
|
|
132
|
+
* Get current connection status
|
|
133
133
|
*/
|
|
134
134
|
const getConnectionStatus = useCallback(async () => {
|
|
135
135
|
// In a real app, you might fetch this from storage or API
|
|
@@ -7,8 +7,8 @@ export const useUserConnections = () => {
|
|
|
7
7
|
const [isLoading, setIsLoading] = useState(true);
|
|
8
8
|
const [error, setError] = useState(null);
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* Load connections from API with authentication validation
|
|
10
|
+
/**
|
|
11
|
+
* Load connections from API with authentication validation
|
|
12
12
|
*/
|
|
13
13
|
const loadConnections = useCallback(async () => {
|
|
14
14
|
try {
|
|
@@ -60,8 +60,8 @@ export const useUserConnections = () => {
|
|
|
60
60
|
}
|
|
61
61
|
}, []);
|
|
62
62
|
|
|
63
|
-
/**
|
|
64
|
-
* Refresh connections with authentication validation
|
|
63
|
+
/**
|
|
64
|
+
* Refresh connections with authentication validation
|
|
65
65
|
*/
|
|
66
66
|
const refreshConnections = useCallback(async () => {
|
|
67
67
|
console.log('🔄 [CONNECTIONS HOOK] Refreshing connections...');
|
|
@@ -69,8 +69,8 @@ export const useUserConnections = () => {
|
|
|
69
69
|
console.log('✅ [CONNECTIONS HOOK] Connections refresh completed');
|
|
70
70
|
}, [loadConnections]);
|
|
71
71
|
|
|
72
|
-
/**
|
|
73
|
-
* Get connections by username with authentication validation
|
|
72
|
+
/**
|
|
73
|
+
* Get connections by username with authentication validation
|
|
74
74
|
*/
|
|
75
75
|
const getConnectionsByUsername = useCallback(async username => {
|
|
76
76
|
try {
|
|
@@ -89,8 +89,8 @@ export const useUserConnections = () => {
|
|
|
89
89
|
}
|
|
90
90
|
}, []);
|
|
91
91
|
|
|
92
|
-
/**
|
|
93
|
-
* Get connections by user ID with authentication validation
|
|
92
|
+
/**
|
|
93
|
+
* Get connections by user ID with authentication validation
|
|
94
94
|
*/
|
|
95
95
|
const getConnectionsByUserId = useCallback(async userId => {
|
|
96
96
|
try {
|
|
@@ -109,8 +109,8 @@ export const useUserConnections = () => {
|
|
|
109
109
|
}
|
|
110
110
|
}, []);
|
|
111
111
|
|
|
112
|
-
/**
|
|
113
|
-
* Upload profile picture
|
|
112
|
+
/**
|
|
113
|
+
* Upload profile picture
|
|
114
114
|
*/
|
|
115
115
|
const uploadUserProfilePicture = useCallback(async (imageData, fileType = 'jpg') => {
|
|
116
116
|
try {
|
package/lib/module/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Onairos React Native SDK v4.0.0
|
|
3
|
-
* A React Native implementation for Onairos personalized data integration
|
|
4
|
-
*
|
|
5
|
-
* PUBLIC API - Complete redesigned UI and enhanced functionality
|
|
1
|
+
/**
|
|
2
|
+
* Onairos React Native SDK v4.0.0
|
|
3
|
+
* A React Native implementation for Onairos personalized data integration
|
|
4
|
+
*
|
|
5
|
+
* PUBLIC API - Complete redesigned UI and enhanced functionality
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
// Essential Types
|
|
9
9
|
|
|
10
10
|
// Core Components - Redesigned UI
|
|
11
11
|
export { OnairosButton } from './components/OnairosButton';
|
|
12
|
-
export { OnairosSignInButton } from './components/OnairosSignInButton';
|
|
13
12
|
export { Onairos } from './components/Onairos';
|
|
14
13
|
export { UniversalOnboarding } from './components/UniversalOnboarding';
|
|
15
14
|
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["OnairosButton","
|
|
1
|
+
{"version":3,"names":["OnairosButton","Onairos","UniversalOnboarding","default","WelcomeScreen","PrimaryButton","ModalSheet","ModalHeader","BrandMark","HeadingGroup","BodyText","SignInStep","VerificationStep","PlatformConnectorsStep","PersonalizationConsentScreen","PinCreationScreen","PersonaImage","initializeApiKey","ADMIN_API_KEY","extractUsernameFromJWT","extractUserDataFromJWT","decodeJWTPayload","getOnairosUsername","initiateOAuth","initiateNativeAuth","hasNativeSDK","isOAuthCallback","updateGoogleClientIds","ApiClient"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAYA;AACA,SAASA,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,SAASC,mBAAmB,QAAQ,kCAAkC;;AAEtE;AACA,SAASC,OAAO,IAAIC,aAAa,QAAQ,4BAA4B;AACrE,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,SAAS,QAAQ,wBAAwB;AAClD,SAASC,YAAY,QAAQ,2BAA2B;AACxD,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAAST,OAAO,IAAIU,sBAAsB,QAAQ,qCAAqC;AACvF,SAASC,4BAA4B,QAAQ,2CAA2C;AACxF,SAASC,iBAAiB,QAAQ,gCAAgC;;AAElE;AACA;AACA;AACA;AACA;;AAEA;AACA,SAASZ,OAAO,IAAIa,YAAY,QAAQ,2BAA2B;AACnE;AACA;;AAEA;AACA,SACEC,gBAAgB,EAChBC,aAAa,EACbC,sBAAsB,EACtBC,sBAAsB,EACtBC,gBAAgB,QACX,0BAA0B;;AAEjC;AACA,SACEC,kBAAkB,QACb,wBAAwB;AAE/B,SACEC,aAAa,EACbC,kBAAkB,EAClBC,YAAY,EACZC,eAAe,QACV,gCAAgC;AAEvC,SACEC,qBAAqB,QAChB,8BAA8B;;AAErC;AACA,SAASC,SAAS,QAAQ,sBAAsB;;AAEhD;AACA;;AAEA;AACA;;AAEA;AACA,SAAS5B,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,SAASC,mBAAmB,QAAQ,kCAAkC;AACtE,OAAOE,aAAa,MAAM,4BAA4B;AAEtD,eAAe;EACbJ,aAAa;EACbC,OAAO;EACPC,mBAAmB;EACnBE;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { getJWTForRoute, TokenType, getTokenTypeForRoute, clearJWT, getAllTokens } from './jwtStorageService';
|
|
2
2
|
import { API_CONFIG } from '../config/api';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Centralized API Client with Route-Based JWT Token Management
|
|
6
|
-
* CORRECTED APPROACH: Uses different JWT tokens for different route families
|
|
7
|
-
*
|
|
8
|
-
* TOKEN ROUTING:
|
|
9
|
-
* - Enoch JWT: /enoch/*, /api/auth/*, /mobile-training/enoch
|
|
10
|
-
* - Onairos JWT: /youtube/*, /gmail/*, social connections
|
|
11
|
-
* - Auth Token: Context-specific auth flows
|
|
4
|
+
/**
|
|
5
|
+
* Centralized API Client with Route-Based JWT Token Management
|
|
6
|
+
* CORRECTED APPROACH: Uses different JWT tokens for different route families
|
|
7
|
+
*
|
|
8
|
+
* TOKEN ROUTING:
|
|
9
|
+
* - Enoch JWT: /enoch/*, /api/auth/*, /mobile-training/enoch
|
|
10
|
+
* - Onairos JWT: /youtube/*, /gmail/*, social connections
|
|
11
|
+
* - Auth Token: Context-specific auth flows
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* Global request counter for tracking in-flight requests
|
|
14
|
+
/**
|
|
15
|
+
* Global request counter for tracking in-flight requests
|
|
16
16
|
*/
|
|
17
17
|
let currentRequestId = 0;
|
|
18
18
|
const activeRequests = new Map();
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* Route-specific authentication triggers
|
|
20
|
+
/**
|
|
21
|
+
* Route-specific authentication triggers
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* Create API client with route-based token management
|
|
24
|
+
/**
|
|
25
|
+
* Create API client with route-based token management
|
|
26
26
|
*/
|
|
27
27
|
class ApiClient {
|
|
28
28
|
constructor(baseUrl = API_CONFIG.BASE_URL, authTriggers = {}) {
|
|
@@ -30,9 +30,9 @@ class ApiClient {
|
|
|
30
30
|
this.authTriggers = authTriggers;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* Make authenticated API request with route-based token selection
|
|
35
|
-
* CRITICAL: Uses the correct token type based on route
|
|
33
|
+
/**
|
|
34
|
+
* Make authenticated API request with route-based token selection
|
|
35
|
+
* CRITICAL: Uses the correct token type based on route
|
|
36
36
|
*/
|
|
37
37
|
async request(endpoint, options = {}) {
|
|
38
38
|
const requestId = ++currentRequestId;
|
|
@@ -101,9 +101,9 @@ class ApiClient {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
/**
|
|
105
|
-
* Get request headers with route-appropriate token
|
|
106
|
-
* CRITICAL: Selects correct token based on route
|
|
104
|
+
/**
|
|
105
|
+
* Get request headers with route-appropriate token
|
|
106
|
+
* CRITICAL: Selects correct token based on route
|
|
107
107
|
*/
|
|
108
108
|
async getRequestHeaders(endpoint, requiresAuth) {
|
|
109
109
|
if (!requiresAuth) {
|
|
@@ -121,9 +121,9 @@ class ApiClient {
|
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
/**
|
|
125
|
-
* Handle 401 errors with route-specific re-authentication
|
|
126
|
-
* CRITICAL FIX: Different auth flows for different token types
|
|
124
|
+
/**
|
|
125
|
+
* Handle 401 errors with route-specific re-authentication
|
|
126
|
+
* CRITICAL FIX: Different auth flows for different token types
|
|
127
127
|
*/
|
|
128
128
|
async handle401Error(requestId, endpoint, tokenType, options) {
|
|
129
129
|
console.error(`🚫 [API Client] Request ${requestId} received 401 for ${tokenType} token on route: ${endpoint}`);
|
|
@@ -146,8 +146,8 @@ class ApiClient {
|
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
/**
|
|
150
|
-
* Trigger appropriate re-authentication based on token type
|
|
149
|
+
/**
|
|
150
|
+
* Trigger appropriate re-authentication based on token type
|
|
151
151
|
*/
|
|
152
152
|
async triggerReAuthForTokenType(tokenType, endpoint) {
|
|
153
153
|
console.log(`🔄 [API Client] Triggering re-auth for ${tokenType} token (endpoint: ${endpoint})`);
|
|
@@ -183,8 +183,8 @@ class ApiClient {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
/**
|
|
187
|
-
* Cancel requests using a specific token type
|
|
186
|
+
/**
|
|
187
|
+
* Cancel requests using a specific token type
|
|
188
188
|
*/
|
|
189
189
|
cancelRequestsForTokenType(tokenType, excludeRequestId) {
|
|
190
190
|
let cancelledCount = 0;
|
|
@@ -203,8 +203,8 @@ class ApiClient {
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
/**
|
|
207
|
-
* Replace token for specific type and cancel related requests
|
|
206
|
+
/**
|
|
207
|
+
* Replace token for specific type and cancel related requests
|
|
208
208
|
*/
|
|
209
209
|
async replaceTokenForType(tokenType, newToken) {
|
|
210
210
|
console.log(`🔄 [API Client] Replacing ${tokenType} token`);
|
|
@@ -223,8 +223,8 @@ class ApiClient {
|
|
|
223
223
|
return replaced;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
/**
|
|
227
|
-
* Debug: Get all current tokens
|
|
226
|
+
/**
|
|
227
|
+
* Debug: Get all current tokens
|
|
228
228
|
*/
|
|
229
229
|
async debugTokens() {
|
|
230
230
|
console.log('🔍 [API Client] Debug: Current token status');
|
|
@@ -239,8 +239,8 @@ class ApiClient {
|
|
|
239
239
|
return tokens;
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
/**
|
|
243
|
-
* Set authentication triggers
|
|
242
|
+
/**
|
|
243
|
+
* Set authentication triggers
|
|
244
244
|
*/
|
|
245
245
|
setAuthTriggers(triggers) {
|
|
246
246
|
this.authTriggers = {
|
|
@@ -250,8 +250,8 @@ class ApiClient {
|
|
|
250
250
|
console.log('🔧 [API Client] Authentication triggers updated');
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
/**
|
|
254
|
-
* Convenience methods for common HTTP verbs
|
|
253
|
+
/**
|
|
254
|
+
* Convenience methods for common HTTP verbs
|
|
255
255
|
*/
|
|
256
256
|
async get(endpoint, options = {}) {
|
|
257
257
|
return this.request(endpoint, {
|