@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
|
@@ -10,8 +10,8 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
10
10
|
// Service key for PIN storage
|
|
11
11
|
const PIN_SERVICE_KEY = 'OnairosEventsPIN';
|
|
12
12
|
const PIN_USERNAME = 'user_pin';
|
|
13
|
-
/**
|
|
14
|
-
* Check if biometric authentication is available on the device
|
|
13
|
+
/**
|
|
14
|
+
* Check if biometric authentication is available on the device
|
|
15
15
|
*/
|
|
16
16
|
const isBiometricAvailable = async () => {
|
|
17
17
|
try {
|
|
@@ -26,8 +26,8 @@ const isBiometricAvailable = async () => {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* Store PIN with biometric authentication
|
|
29
|
+
/**
|
|
30
|
+
* Store PIN with biometric authentication
|
|
31
31
|
*/
|
|
32
32
|
exports.isBiometricAvailable = isBiometricAvailable;
|
|
33
33
|
const storePinWithBiometric = async pin => {
|
|
@@ -96,8 +96,8 @@ const storePinWithBiometric = async pin => {
|
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
-
/**
|
|
100
|
-
* Retrieve PIN with biometric authentication
|
|
99
|
+
/**
|
|
100
|
+
* Retrieve PIN with biometric authentication
|
|
101
101
|
*/
|
|
102
102
|
exports.storePinWithBiometric = storePinWithBiometric;
|
|
103
103
|
const retrievePinWithBiometric = async () => {
|
|
@@ -129,8 +129,8 @@ const retrievePinWithBiometric = async () => {
|
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
-
/**
|
|
133
|
-
* Check if PIN is stored in secure storage
|
|
132
|
+
/**
|
|
133
|
+
* Check if PIN is stored in secure storage
|
|
134
134
|
*/
|
|
135
135
|
exports.retrievePinWithBiometric = retrievePinWithBiometric;
|
|
136
136
|
const isPinStored = async () => {
|
|
@@ -143,8 +143,8 @@ const isPinStored = async () => {
|
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
|
|
146
|
-
/**
|
|
147
|
-
* Remove PIN from secure storage
|
|
146
|
+
/**
|
|
147
|
+
* Remove PIN from secure storage
|
|
148
148
|
*/
|
|
149
149
|
exports.isPinStored = isPinStored;
|
|
150
150
|
const removePinFromStorage = async () => {
|
|
@@ -12,11 +12,11 @@ const API_BASE_URL = _api.API_CONFIG.BASE_URL;
|
|
|
12
12
|
|
|
13
13
|
// Interface for API response
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* NEW UNIFIED LOOKUP - Get connected accounts using the simplified lookup endpoint
|
|
17
|
-
* This is the preferred method that makes only ONE request to the backend
|
|
18
|
-
* @param userIdentifier - Can be email, username, userId, or any user identifier
|
|
19
|
-
* @returns Promise<ConnectedAccount[]>
|
|
15
|
+
/**
|
|
16
|
+
* NEW UNIFIED LOOKUP - Get connected accounts using the simplified lookup endpoint
|
|
17
|
+
* This is the preferred method that makes only ONE request to the backend
|
|
18
|
+
* @param userIdentifier - Can be email, username, userId, or any user identifier
|
|
19
|
+
* @returns Promise<ConnectedAccount[]>
|
|
20
20
|
*/
|
|
21
21
|
const getConnectedAccountsLookup = async userIdentifier => {
|
|
22
22
|
try {
|
|
@@ -48,13 +48,13 @@ const getConnectedAccountsLookup = async userIdentifier => {
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
/**
|
|
52
|
-
* SMART CONNECTED ACCOUNTS FETCHER - Uses new API with old API fallback
|
|
53
|
-
* This function tries the new unified lookup first, then falls back to old methods if needed
|
|
54
|
-
* @param userEmail - User's email (primary identifier)
|
|
55
|
-
* @param userId - User's ID (fallback)
|
|
56
|
-
* @param username - User's username (fallback)
|
|
57
|
-
* @returns Promise<ConnectedAccount[]>
|
|
51
|
+
/**
|
|
52
|
+
* SMART CONNECTED ACCOUNTS FETCHER - Uses new API with old API fallback
|
|
53
|
+
* This function tries the new unified lookup first, then falls back to old methods if needed
|
|
54
|
+
* @param userEmail - User's email (primary identifier)
|
|
55
|
+
* @param userId - User's ID (fallback)
|
|
56
|
+
* @param username - User's username (fallback)
|
|
57
|
+
* @returns Promise<ConnectedAccount[]>
|
|
58
58
|
*/
|
|
59
59
|
exports.getConnectedAccountsLookup = getConnectedAccountsLookup;
|
|
60
60
|
const getConnectedAccountsSmart = async (userEmail, userId, username) => {
|
|
@@ -108,10 +108,10 @@ const getConnectedAccountsSmart = async (userEmail, userId, username) => {
|
|
|
108
108
|
// These will be used as fallbacks if the new unified lookup fails
|
|
109
109
|
// =============================================================================
|
|
110
110
|
|
|
111
|
-
/**
|
|
112
|
-
* Get connected accounts by username
|
|
113
|
-
* @param username - Username to fetch connected accounts for
|
|
114
|
-
* @returns Promise<ConnectedAccount[]>
|
|
111
|
+
/**
|
|
112
|
+
* Get connected accounts by username
|
|
113
|
+
* @param username - Username to fetch connected accounts for
|
|
114
|
+
* @returns Promise<ConnectedAccount[]>
|
|
115
115
|
*/
|
|
116
116
|
exports.getConnectedAccountsSmart = getConnectedAccountsSmart;
|
|
117
117
|
const getConnectedAccountsByUsername = async username => {
|
|
@@ -137,10 +137,10 @@ const getConnectedAccountsByUsername = async username => {
|
|
|
137
137
|
}
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
-
/**
|
|
141
|
-
* Get connected accounts by email
|
|
142
|
-
* @param email - Email to fetch connected accounts for
|
|
143
|
-
* @returns Promise<ConnectedAccount[]>
|
|
140
|
+
/**
|
|
141
|
+
* Get connected accounts by email
|
|
142
|
+
* @param email - Email to fetch connected accounts for
|
|
143
|
+
* @returns Promise<ConnectedAccount[]>
|
|
144
144
|
*/
|
|
145
145
|
exports.getConnectedAccountsByUsername = getConnectedAccountsByUsername;
|
|
146
146
|
const getConnectedAccountsByEmail = async email => {
|
|
@@ -166,10 +166,10 @@ const getConnectedAccountsByEmail = async email => {
|
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
168
|
|
|
169
|
-
/**
|
|
170
|
-
* Get connected accounts by user ID
|
|
171
|
-
* @param userId - User ID to fetch connected accounts for
|
|
172
|
-
* @returns Promise<ConnectedAccount[]>
|
|
169
|
+
/**
|
|
170
|
+
* Get connected accounts by user ID
|
|
171
|
+
* @param userId - User ID to fetch connected accounts for
|
|
172
|
+
* @returns Promise<ConnectedAccount[]>
|
|
173
173
|
*/
|
|
174
174
|
exports.getConnectedAccountsByEmail = getConnectedAccountsByEmail;
|
|
175
175
|
const getConnectedAccountsByUserId = async userId => {
|
|
@@ -195,10 +195,10 @@ const getConnectedAccountsByUserId = async userId => {
|
|
|
195
195
|
}
|
|
196
196
|
};
|
|
197
197
|
|
|
198
|
-
/**
|
|
199
|
-
* Get platform icon based on platform name
|
|
200
|
-
* @param platform - Platform name (case insensitive)
|
|
201
|
-
* @returns Image source for the platform icon
|
|
198
|
+
/**
|
|
199
|
+
* Get platform icon based on platform name
|
|
200
|
+
* @param platform - Platform name (case insensitive)
|
|
201
|
+
* @returns Image source for the platform icon
|
|
202
202
|
*/
|
|
203
203
|
exports.getConnectedAccountsByUserId = getConnectedAccountsByUserId;
|
|
204
204
|
const getPlatformIcon = platform => {
|
|
@@ -230,10 +230,10 @@ const getPlatformIcon = platform => {
|
|
|
230
230
|
}
|
|
231
231
|
};
|
|
232
232
|
|
|
233
|
-
/**
|
|
234
|
-
* Get platform color based on platform name
|
|
235
|
-
* @param platform - Platform name (case insensitive)
|
|
236
|
-
* @returns Hex color code for the platform
|
|
233
|
+
/**
|
|
234
|
+
* Get platform color based on platform name
|
|
235
|
+
* @param platform - Platform name (case insensitive)
|
|
236
|
+
* @returns Hex color code for the platform
|
|
237
237
|
*/
|
|
238
238
|
exports.getPlatformIcon = getPlatformIcon;
|
|
239
239
|
const getPlatformColor = platform => {
|
|
@@ -7,17 +7,17 @@ exports.updateGoogleClientIds = exports.signOutFromGoogle = exports.signInWithGo
|
|
|
7
7
|
var _googleSignin = require("@react-native-google-signin/google-signin");
|
|
8
8
|
var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
/**
|
|
11
|
-
* Google Authentication Service
|
|
12
|
-
* Handles Google Sign-In for user authentication and account creation
|
|
10
|
+
/**
|
|
11
|
+
* Google Authentication Service
|
|
12
|
+
* Handles Google Sign-In for user authentication and account creation
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
// 🔑 Using the same client ID configuration as platform auth
|
|
16
16
|
let WEB_CLIENT_ID = '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com';
|
|
17
17
|
let IOS_CLIENT_ID = '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com';
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
* Update Google OAuth client IDs for custom configurations
|
|
19
|
+
/**
|
|
20
|
+
* Update Google OAuth client IDs for custom configurations
|
|
21
21
|
*/
|
|
22
22
|
const updateGoogleClientIds = config => {
|
|
23
23
|
if (config.webClientId) {
|
|
@@ -32,8 +32,8 @@ const updateGoogleClientIds = config => {
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
/**
|
|
36
|
-
* Initialize Google Sign-In for user authentication
|
|
35
|
+
/**
|
|
36
|
+
* Initialize Google Sign-In for user authentication
|
|
37
37
|
*/
|
|
38
38
|
exports.updateGoogleClientIds = updateGoogleClientIds;
|
|
39
39
|
const initializeGoogleAuth = () => {
|
|
@@ -51,8 +51,8 @@ const initializeGoogleAuth = () => {
|
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
/**
|
|
55
|
-
* Sign in with Google and create/authenticate user account
|
|
54
|
+
/**
|
|
55
|
+
* Sign in with Google and create/authenticate user account
|
|
56
56
|
*/
|
|
57
57
|
const signInWithGoogle = async () => {
|
|
58
58
|
try {
|
|
@@ -155,8 +155,8 @@ const signInWithGoogle = async () => {
|
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
157
|
|
|
158
|
-
/**
|
|
159
|
-
* Create or authenticate user account on backend
|
|
158
|
+
/**
|
|
159
|
+
* Create or authenticate user account on backend
|
|
160
160
|
*/
|
|
161
161
|
exports.signInWithGoogle = signInWithGoogle;
|
|
162
162
|
const createUserAccount = async userData => {
|
|
@@ -226,8 +226,8 @@ const createUserAccount = async userData => {
|
|
|
226
226
|
}
|
|
227
227
|
};
|
|
228
228
|
|
|
229
|
-
/**
|
|
230
|
-
* Check if user is already signed in with Google
|
|
229
|
+
/**
|
|
230
|
+
* Check if user is already signed in with Google
|
|
231
231
|
*/
|
|
232
232
|
const isGoogleSignedIn = async () => {
|
|
233
233
|
try {
|
|
@@ -250,8 +250,8 @@ const isGoogleSignedIn = async () => {
|
|
|
250
250
|
}
|
|
251
251
|
};
|
|
252
252
|
|
|
253
|
-
/**
|
|
254
|
-
* Sign out from Google
|
|
253
|
+
/**
|
|
254
|
+
* Sign out from Google
|
|
255
255
|
*/
|
|
256
256
|
exports.isGoogleSignedIn = isGoogleSignedIn;
|
|
257
257
|
const signOutFromGoogle = async () => {
|
|
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.convertImageToOptimizedBase64 = exports.compressProfilePicture = exports.compressImageToTarget = exports.compressForUpload = void 0;
|
|
7
7
|
var _reactNativeImageResizer = _interopRequireDefault(require("@bam.tech/react-native-image-resizer"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
/**
|
|
10
|
-
* Comprehensive image compression service for React Native
|
|
11
|
-
* Supports iterative compression to meet specific size targets
|
|
9
|
+
/**
|
|
10
|
+
* Comprehensive image compression service for React Native
|
|
11
|
+
* Supports iterative compression to meet specific size targets
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* Get file size from URI (React Native compatible)
|
|
14
|
+
/**
|
|
15
|
+
* Get file size from URI (React Native compatible)
|
|
16
16
|
*/
|
|
17
17
|
const getFileSizeFromUri = async uri => {
|
|
18
18
|
try {
|
|
@@ -25,8 +25,8 @@ const getFileSizeFromUri = async uri => {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
/**
|
|
29
|
-
* Convert image to base64 string
|
|
28
|
+
/**
|
|
29
|
+
* Convert image to base64 string
|
|
30
30
|
*/
|
|
31
31
|
const imageToBase64 = async uri => {
|
|
32
32
|
try {
|
|
@@ -53,8 +53,8 @@ const imageToBase64 = async uri => {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
/**
|
|
57
|
-
* Compress image with iterative quality reduction to meet size target
|
|
56
|
+
/**
|
|
57
|
+
* Compress image with iterative quality reduction to meet size target
|
|
58
58
|
*/
|
|
59
59
|
const compressImageToTarget = async (imageUri, options = {}) => {
|
|
60
60
|
const {
|
|
@@ -216,8 +216,8 @@ const compressImageToTarget = async (imageUri, options = {}) => {
|
|
|
216
216
|
}
|
|
217
217
|
};
|
|
218
218
|
|
|
219
|
-
/**
|
|
220
|
-
* Quick compression for profile pictures (300KB target)
|
|
219
|
+
/**
|
|
220
|
+
* Quick compression for profile pictures (300KB target)
|
|
221
221
|
*/
|
|
222
222
|
exports.compressImageToTarget = compressImageToTarget;
|
|
223
223
|
const compressProfilePicture = async imageUri => {
|
|
@@ -230,8 +230,8 @@ const compressProfilePicture = async imageUri => {
|
|
|
230
230
|
});
|
|
231
231
|
};
|
|
232
232
|
|
|
233
|
-
/**
|
|
234
|
-
* Compress image for upload with custom settings
|
|
233
|
+
/**
|
|
234
|
+
* Compress image for upload with custom settings
|
|
235
235
|
*/
|
|
236
236
|
exports.compressProfilePicture = compressProfilePicture;
|
|
237
237
|
const compressForUpload = async (imageUri, maxSizeKB = 300) => {
|
|
@@ -244,8 +244,8 @@ const compressForUpload = async (imageUri, maxSizeKB = 300) => {
|
|
|
244
244
|
});
|
|
245
245
|
};
|
|
246
246
|
|
|
247
|
-
/**
|
|
248
|
-
* Legacy function for backward compatibility
|
|
247
|
+
/**
|
|
248
|
+
* Legacy function for backward compatibility
|
|
249
249
|
*/
|
|
250
250
|
exports.compressForUpload = compressForUpload;
|
|
251
251
|
const convertImageToOptimizedBase64 = async (imageUri, quality = 0.8) => {
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.storeOnairosJWT = exports.storeJWT = exports.storeEnochJWT = exports.storeAuthToken = exports.replaceJWTAfterVerification = exports.hasValidJWT = exports.getTokenTypeForRoute = exports.getJWTForRoute = exports.getJWT = exports.getAllTokens = exports.clearJWT = exports.clearAllJWT = exports.TokenType = void 0;
|
|
7
7
|
var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
/**
|
|
10
|
-
* JWT Token Storage Service - CORRECTED APPROACH
|
|
11
|
-
* Manages 3 DISTINCT JWT token types for different route families
|
|
12
|
-
*
|
|
13
|
-
* TOKEN TYPES:
|
|
14
|
-
* 1. Enoch JWT (enoch_token) - For /enoch/*, /api/auth/*, /mobile-training/enoch
|
|
15
|
-
* 2. Onairos JWT (onairos_jwt_token) - For /youtube/*, /gmail/*, social connections
|
|
16
|
-
* 3. Auth Token (auth_token) - For context-specific auth flows
|
|
9
|
+
/**
|
|
10
|
+
* JWT Token Storage Service - CORRECTED APPROACH
|
|
11
|
+
* Manages 3 DISTINCT JWT token types for different route families
|
|
12
|
+
*
|
|
13
|
+
* TOKEN TYPES:
|
|
14
|
+
* 1. Enoch JWT (enoch_token) - For /enoch/*, /api/auth/*, /mobile-training/enoch
|
|
15
|
+
* 2. Onairos JWT (onairos_jwt_token) - For /youtube/*, /gmail/*, social connections
|
|
16
|
+
* 3. Auth Token (auth_token) - For context-specific auth flows
|
|
17
17
|
*/
|
|
18
18
|
let TokenType = exports.TokenType = /*#__PURE__*/function (TokenType) {
|
|
19
19
|
TokenType["ENOCH"] = "enoch_token";
|
|
@@ -21,9 +21,9 @@ let TokenType = exports.TokenType = /*#__PURE__*/function (TokenType) {
|
|
|
21
21
|
TokenType["AUTH"] = "auth_token";
|
|
22
22
|
return TokenType;
|
|
23
23
|
}({});
|
|
24
|
-
/**
|
|
25
|
-
* Route-based token mapping
|
|
26
|
-
* Determines which token type to use for which routes
|
|
24
|
+
/**
|
|
25
|
+
* Route-based token mapping
|
|
26
|
+
* Determines which token type to use for which routes
|
|
27
27
|
*/
|
|
28
28
|
const getTokenTypeForRoute = route => {
|
|
29
29
|
const cleanRoute = route.toLowerCase();
|
|
@@ -42,11 +42,11 @@ const getTokenTypeForRoute = route => {
|
|
|
42
42
|
return TokenType.AUTH;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
/**
|
|
46
|
-
* Store JWT token of specific type
|
|
47
|
-
* @param tokenType - Type of token to store
|
|
48
|
-
* @param token - JWT token to store
|
|
49
|
-
* @returns Promise<boolean> - Success status
|
|
45
|
+
/**
|
|
46
|
+
* Store JWT token of specific type
|
|
47
|
+
* @param tokenType - Type of token to store
|
|
48
|
+
* @param token - JWT token to store
|
|
49
|
+
* @returns Promise<boolean> - Success status
|
|
50
50
|
*/
|
|
51
51
|
exports.getTokenTypeForRoute = getTokenTypeForRoute;
|
|
52
52
|
const storeJWT = async (tokenType, token) => {
|
|
@@ -71,10 +71,10 @@ const storeJWT = async (tokenType, token) => {
|
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
/**
|
|
75
|
-
* Retrieve JWT token of specific type
|
|
76
|
-
* @param tokenType - Type of token to retrieve
|
|
77
|
-
* @returns Promise<string | null> - JWT token or null if not found
|
|
74
|
+
/**
|
|
75
|
+
* Retrieve JWT token of specific type
|
|
76
|
+
* @param tokenType - Type of token to retrieve
|
|
77
|
+
* @returns Promise<string | null> - JWT token or null if not found
|
|
78
78
|
*/
|
|
79
79
|
exports.storeJWT = storeJWT;
|
|
80
80
|
const getJWT = async tokenType => {
|
|
@@ -99,10 +99,10 @@ const getJWT = async tokenType => {
|
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
|
|
102
|
-
/**
|
|
103
|
-
* Get JWT token for specific route
|
|
104
|
-
* @param route - API route to get token for
|
|
105
|
-
* @returns Promise<string | null> - Appropriate JWT token or null
|
|
102
|
+
/**
|
|
103
|
+
* Get JWT token for specific route
|
|
104
|
+
* @param route - API route to get token for
|
|
105
|
+
* @returns Promise<string | null> - Appropriate JWT token or null
|
|
106
106
|
*/
|
|
107
107
|
exports.getJWT = getJWT;
|
|
108
108
|
const getJWTForRoute = async route => {
|
|
@@ -116,10 +116,10 @@ const getJWTForRoute = async route => {
|
|
|
116
116
|
return token;
|
|
117
117
|
};
|
|
118
118
|
|
|
119
|
-
/**
|
|
120
|
-
* Clear JWT token of specific type
|
|
121
|
-
* @param tokenType - Type of token to clear
|
|
122
|
-
* @returns Promise<boolean> - Success status
|
|
119
|
+
/**
|
|
120
|
+
* Clear JWT token of specific type
|
|
121
|
+
* @param tokenType - Type of token to clear
|
|
122
|
+
* @returns Promise<boolean> - Success status
|
|
123
123
|
*/
|
|
124
124
|
exports.getJWTForRoute = getJWTForRoute;
|
|
125
125
|
const clearJWT = async tokenType => {
|
|
@@ -133,9 +133,9 @@ const clearJWT = async tokenType => {
|
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
/**
|
|
137
|
-
* Clear all JWT tokens
|
|
138
|
-
* @returns Promise<boolean> - Success status
|
|
136
|
+
/**
|
|
137
|
+
* Clear all JWT tokens
|
|
138
|
+
* @returns Promise<boolean> - Success status
|
|
139
139
|
*/
|
|
140
140
|
exports.clearJWT = clearJWT;
|
|
141
141
|
const clearAllJWT = async () => {
|
|
@@ -149,11 +149,11 @@ const clearAllJWT = async () => {
|
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
-
/**
|
|
153
|
-
* Replace JWT token after verification - route-aware
|
|
154
|
-
* @param tokenType - Type of token being replaced
|
|
155
|
-
* @param newToken - New JWT token from verification response
|
|
156
|
-
* @returns Promise<boolean> - Success status
|
|
152
|
+
/**
|
|
153
|
+
* Replace JWT token after verification - route-aware
|
|
154
|
+
* @param tokenType - Type of token being replaced
|
|
155
|
+
* @param newToken - New JWT token from verification response
|
|
156
|
+
* @returns Promise<boolean> - Success status
|
|
157
157
|
*/
|
|
158
158
|
exports.clearAllJWT = clearAllJWT;
|
|
159
159
|
const replaceJWTAfterVerification = async (tokenType, newToken) => {
|
|
@@ -177,40 +177,40 @@ const replaceJWTAfterVerification = async (tokenType, newToken) => {
|
|
|
177
177
|
}
|
|
178
178
|
};
|
|
179
179
|
|
|
180
|
-
/**
|
|
181
|
-
* Store Enoch JWT token (from email verification)
|
|
182
|
-
* @param token - Enoch JWT token
|
|
183
|
-
* @returns Promise<boolean> - Success status
|
|
180
|
+
/**
|
|
181
|
+
* Store Enoch JWT token (from email verification)
|
|
182
|
+
* @param token - Enoch JWT token
|
|
183
|
+
* @returns Promise<boolean> - Success status
|
|
184
184
|
*/
|
|
185
185
|
exports.replaceJWTAfterVerification = replaceJWTAfterVerification;
|
|
186
186
|
const storeEnochJWT = async token => {
|
|
187
187
|
return await storeJWT(TokenType.ENOCH, token);
|
|
188
188
|
};
|
|
189
189
|
|
|
190
|
-
/**
|
|
191
|
-
* Store Onairos JWT token (from sign-in/registration)
|
|
192
|
-
* @param token - Onairos JWT token
|
|
193
|
-
* @returns Promise<boolean> - Success status
|
|
190
|
+
/**
|
|
191
|
+
* Store Onairos JWT token (from sign-in/registration)
|
|
192
|
+
* @param token - Onairos JWT token
|
|
193
|
+
* @returns Promise<boolean> - Success status
|
|
194
194
|
*/
|
|
195
195
|
exports.storeEnochJWT = storeEnochJWT;
|
|
196
196
|
const storeOnairosJWT = async token => {
|
|
197
197
|
return await storeJWT(TokenType.ONAIROS, token);
|
|
198
198
|
};
|
|
199
199
|
|
|
200
|
-
/**
|
|
201
|
-
* Store Auth token (for context-specific flows)
|
|
202
|
-
* @param token - Auth token
|
|
203
|
-
* @returns Promise<boolean> - Success status
|
|
200
|
+
/**
|
|
201
|
+
* Store Auth token (for context-specific flows)
|
|
202
|
+
* @param token - Auth token
|
|
203
|
+
* @returns Promise<boolean> - Success status
|
|
204
204
|
*/
|
|
205
205
|
exports.storeOnairosJWT = storeOnairosJWT;
|
|
206
206
|
const storeAuthToken = async token => {
|
|
207
207
|
return await storeJWT(TokenType.AUTH, token);
|
|
208
208
|
};
|
|
209
209
|
|
|
210
|
-
/**
|
|
211
|
-
* Validate JWT format
|
|
212
|
-
* @param token - Token to validate
|
|
213
|
-
* @returns boolean - True if valid JWT format
|
|
210
|
+
/**
|
|
211
|
+
* Validate JWT format
|
|
212
|
+
* @param token - Token to validate
|
|
213
|
+
* @returns boolean - True if valid JWT format
|
|
214
214
|
*/
|
|
215
215
|
exports.storeAuthToken = storeAuthToken;
|
|
216
216
|
const isValidJWTFormat = token => {
|
|
@@ -230,19 +230,19 @@ const isValidJWTFormat = token => {
|
|
|
230
230
|
return true;
|
|
231
231
|
};
|
|
232
232
|
|
|
233
|
-
/**
|
|
234
|
-
* Check if JWT token of specific type exists and is valid
|
|
235
|
-
* @param tokenType - Type of token to check
|
|
236
|
-
* @returns Promise<boolean> - True if valid token exists
|
|
233
|
+
/**
|
|
234
|
+
* Check if JWT token of specific type exists and is valid
|
|
235
|
+
* @param tokenType - Type of token to check
|
|
236
|
+
* @returns Promise<boolean> - True if valid token exists
|
|
237
237
|
*/
|
|
238
238
|
const hasValidJWT = async tokenType => {
|
|
239
239
|
const token = await getJWT(tokenType);
|
|
240
240
|
return token !== null;
|
|
241
241
|
};
|
|
242
242
|
|
|
243
|
-
/**
|
|
244
|
-
* Get all available tokens (for debugging)
|
|
245
|
-
* @returns Promise<Record<TokenType, string | null>> - All tokens
|
|
243
|
+
/**
|
|
244
|
+
* Get all available tokens (for debugging)
|
|
245
|
+
* @returns Promise<Record<TokenType, string | null>> - All tokens
|
|
246
246
|
*/
|
|
247
247
|
exports.hasValidJWT = hasValidJWT;
|
|
248
248
|
const getAllTokens = async () => {
|
|
@@ -10,9 +10,9 @@ var _authService = require("./authService");
|
|
|
10
10
|
|
|
11
11
|
const API_BASE_URL = 'https://api2.onairos.uk';
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* Mobile Training API Service
|
|
15
|
-
* Implements the updated training spec routes
|
|
13
|
+
/**
|
|
14
|
+
* Mobile Training API Service
|
|
15
|
+
* Implements the updated training spec routes
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
// Training Status Route
|
|
@@ -87,10 +87,10 @@ const getHealthCheck = async () => {
|
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
/**
|
|
91
|
-
* Start Enoch Training - Simplified Version
|
|
92
|
-
* Backend now handles all YouTube connection cases automatically (temporary mode, refresh tokens, etc.)
|
|
93
|
-
* No frontend migration checks needed anymore
|
|
90
|
+
/**
|
|
91
|
+
* Start Enoch Training - Simplified Version
|
|
92
|
+
* Backend now handles all YouTube connection cases automatically (temporary mode, refresh tokens, etc.)
|
|
93
|
+
* No frontend migration checks needed anymore
|
|
94
94
|
*/
|
|
95
95
|
exports.getHealthCheck = getHealthCheck;
|
|
96
96
|
const startEnochTrainingWithYouTubeCheck = async trainingData => {
|
|
@@ -112,9 +112,9 @@ const startEnochTrainingWithYouTubeCheck = async trainingData => {
|
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
-
/**
|
|
116
|
-
* Start Enoch Training
|
|
117
|
-
* Updated to use the new /mobile-training/enoch endpoint with proper error handling
|
|
115
|
+
/**
|
|
116
|
+
* Start Enoch Training
|
|
117
|
+
* Updated to use the new /mobile-training/enoch endpoint with proper error handling
|
|
118
118
|
*/
|
|
119
119
|
exports.startEnochTrainingWithYouTubeCheck = startEnochTrainingWithYouTubeCheck;
|
|
120
120
|
const startEnochTraining = async trainingData => {
|
|
@@ -154,8 +154,8 @@ const startEnochTraining = async trainingData => {
|
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
|
|
157
|
-
/**
|
|
158
|
-
* Helper function to check if training is in progress
|
|
157
|
+
/**
|
|
158
|
+
* Helper function to check if training is in progress
|
|
159
159
|
*/
|
|
160
160
|
exports.startEnochTraining = startEnochTraining;
|
|
161
161
|
const isTrainingInProgress = async username => {
|
|
@@ -168,8 +168,8 @@ const isTrainingInProgress = async username => {
|
|
|
168
168
|
}
|
|
169
169
|
};
|
|
170
170
|
|
|
171
|
-
/**
|
|
172
|
-
* Helper function to get training features info
|
|
171
|
+
/**
|
|
172
|
+
* Helper function to get training features info
|
|
173
173
|
*/
|
|
174
174
|
exports.isTrainingInProgress = isTrainingInProgress;
|
|
175
175
|
const getTrainingFeatures = async () => {
|
|
@@ -6,15 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.hashPin = exports.getEncryptedPinForAPI = exports.encryptPin = exports.decryptPin = void 0;
|
|
7
7
|
var _pinStorageUtils = require("./pinStorageUtils");
|
|
8
8
|
const CryptoJS = require('react-native-crypto-js');
|
|
9
|
-
/**
|
|
10
|
-
* Service for encrypting PIN data before sending to APIs
|
|
9
|
+
/**
|
|
10
|
+
* Service for encrypting PIN data before sending to APIs
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
// Encryption key - in production, this should come from a secure source
|
|
14
14
|
const ENCRYPTION_KEY = 'onairos-pin-encryption-key-2024';
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* Encrypt PIN using AES encryption
|
|
16
|
+
/**
|
|
17
|
+
* Encrypt PIN using AES encryption
|
|
18
18
|
*/
|
|
19
19
|
const encryptPin = pin => {
|
|
20
20
|
try {
|
|
@@ -27,8 +27,8 @@ const encryptPin = pin => {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
/**
|
|
31
|
-
* Decrypt PIN (for verification purposes)
|
|
30
|
+
/**
|
|
31
|
+
* Decrypt PIN (for verification purposes)
|
|
32
32
|
*/
|
|
33
33
|
exports.encryptPin = encryptPin;
|
|
34
34
|
const decryptPin = encryptedPin => {
|
|
@@ -43,8 +43,8 @@ const decryptPin = encryptedPin => {
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
/**
|
|
47
|
-
* Get encrypted PIN for API transmission
|
|
46
|
+
/**
|
|
47
|
+
* Get encrypted PIN for API transmission
|
|
48
48
|
*/
|
|
49
49
|
exports.decryptPin = decryptPin;
|
|
50
50
|
const getEncryptedPinForAPI = async () => {
|
|
@@ -66,8 +66,8 @@ const getEncryptedPinForAPI = async () => {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
/**
|
|
70
|
-
* Hash PIN for verification (one-way hash)
|
|
69
|
+
/**
|
|
70
|
+
* Hash PIN for verification (one-way hash)
|
|
71
71
|
*/
|
|
72
72
|
exports.getEncryptedPinForAPI = getEncryptedPinForAPI;
|
|
73
73
|
const hashPin = pin => {
|