@onairos/react-native 3.1.16 → 3.1.18
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/ModalSheet.js +8 -2
- package/lib/commonjs/components/ModalSheet.js.map +1 -1
- package/lib/commonjs/components/OnairosButton.js +290 -0
- package/lib/commonjs/components/OnairosButton.js.map +1 -0
- package/lib/commonjs/components/OnairosSignInButton.js +32 -8
- package/lib/commonjs/components/OnairosSignInButton.js.map +1 -1
- package/lib/commonjs/components/UniversalOnboarding.js +4 -4
- package/lib/commonjs/components/WelcomeScreen.js +29 -13
- package/lib/commonjs/components/WelcomeScreen.js.map +1 -1
- 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 +13 -6
- 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/ModalSheet.js +7 -2
- package/lib/module/components/ModalSheet.js.map +1 -1
- package/lib/module/components/OnairosButton.js +282 -0
- package/lib/module/components/OnairosButton.js.map +1 -0
- package/lib/module/components/OnairosSignInButton.js +32 -8
- package/lib/module/components/OnairosSignInButton.js.map +1 -1
- package/lib/module/components/UniversalOnboarding.js +4 -4
- package/lib/module/components/WelcomeScreen.js +25 -10
- package/lib/module/components/WelcomeScreen.js.map +1 -1
- 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 +11 -11
- 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/ModalSheet.d.ts.map +1 -1
- package/lib/typescript/components/OnairosButton.d.ts +37 -0
- package/lib/typescript/components/OnairosButton.d.ts.map +1 -0
- package/lib/typescript/components/OnairosSignInButton.d.ts.map +1 -1
- package/lib/typescript/components/WelcomeScreen.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +3 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +145 -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 +59 -57
- package/src/components/Onairos.tsx +422 -422
- package/src/components/OnairosButton.tsx +339 -0
- package/src/components/OnairosSignInButton.tsx +31 -9
- 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 +490 -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 -0
- package/src/index.ts +99 -96
- 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
|
@@ -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 => {
|
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.setTemporaryPin = exports.hasStoredPin = exports.getTemporaryPin = exports.getStoredPinForTraining = exports.getPinForTraining = exports.clearTemporaryPin = exports.clearStoredPin = void 0;
|
|
7
7
|
var _biometricPinService = require("./biometricPinService");
|
|
8
|
-
/**
|
|
9
|
-
* Utility functions for PIN storage management
|
|
8
|
+
/**
|
|
9
|
+
* Utility functions for PIN storage management
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Get the stored PIN for training/authentication purposes
|
|
14
|
-
* This will prompt for biometric authentication
|
|
12
|
+
/**
|
|
13
|
+
* Get the stored PIN for training/authentication purposes
|
|
14
|
+
* This will prompt for biometric authentication
|
|
15
15
|
*/
|
|
16
16
|
const getStoredPinForTraining = async () => {
|
|
17
17
|
try {
|
|
@@ -39,8 +39,8 @@ const getStoredPinForTraining = async () => {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
/**
|
|
43
|
-
* Check if user has a PIN stored securely
|
|
42
|
+
/**
|
|
43
|
+
* Check if user has a PIN stored securely
|
|
44
44
|
*/
|
|
45
45
|
exports.getStoredPinForTraining = getStoredPinForTraining;
|
|
46
46
|
const hasStoredPin = async () => {
|
|
@@ -52,8 +52,8 @@ const hasStoredPin = async () => {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
/**
|
|
56
|
-
* Remove stored PIN (for logout/reset purposes)
|
|
55
|
+
/**
|
|
56
|
+
* Remove stored PIN (for logout/reset purposes)
|
|
57
57
|
*/
|
|
58
58
|
exports.hasStoredPin = hasStoredPin;
|
|
59
59
|
const clearStoredPin = async () => {
|
|
@@ -66,9 +66,9 @@ const clearStoredPin = async () => {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
/**
|
|
70
|
-
* Get PIN for passing to training component
|
|
71
|
-
* This function can be called from the onboarding flow
|
|
69
|
+
/**
|
|
70
|
+
* Get PIN for passing to training component
|
|
71
|
+
* This function can be called from the onboarding flow
|
|
72
72
|
*/
|
|
73
73
|
exports.clearStoredPin = clearStoredPin;
|
|
74
74
|
const getPinForTraining = async tempPin => {
|
|
@@ -82,9 +82,9 @@ const getPinForTraining = async tempPin => {
|
|
|
82
82
|
return await getStoredPinForTraining();
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
-
/**
|
|
86
|
-
* Store PIN temporarily in memory for training component
|
|
87
|
-
* This is used when PIN is entered but not yet stored biometrically
|
|
85
|
+
/**
|
|
86
|
+
* Store PIN temporarily in memory for training component
|
|
87
|
+
* This is used when PIN is entered but not yet stored biometrically
|
|
88
88
|
*/
|
|
89
89
|
exports.getPinForTraining = getPinForTraining;
|
|
90
90
|
let temporaryPin = null;
|
|
@@ -8,9 +8,9 @@ var _googleSignin = require("@react-native-google-signin/google-signin");
|
|
|
8
8
|
var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
|
|
9
9
|
var _api = require("../config/api");
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
/**
|
|
12
|
-
* Platform Authentication Service
|
|
13
|
-
* Handles OAuth flows for different platforms
|
|
11
|
+
/**
|
|
12
|
+
* Platform Authentication Service
|
|
13
|
+
* Handles OAuth flows for different platforms
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
// 🔑 CRITICAL: Using the same client ID for both web and iOS to avoid audience errors
|
|
@@ -92,16 +92,16 @@ const OAUTH_CONFIG = {
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
/**
|
|
96
|
-
* Check if the platform has a native SDK
|
|
95
|
+
/**
|
|
96
|
+
* Check if the platform has a native SDK
|
|
97
97
|
*/
|
|
98
98
|
const hasNativeSDK = platform => {
|
|
99
99
|
var _OAUTH_CONFIG$platfor;
|
|
100
100
|
return ((_OAUTH_CONFIG$platfor = OAUTH_CONFIG[platform]) === null || _OAUTH_CONFIG$platfor === void 0 ? void 0 : _OAUTH_CONFIG$platfor.hasNativeSDK) || false;
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
/**
|
|
104
|
-
* Initiate OAuth flow for a platform
|
|
103
|
+
/**
|
|
104
|
+
* Initiate OAuth flow for a platform
|
|
105
105
|
*/
|
|
106
106
|
exports.hasNativeSDK = hasNativeSDK;
|
|
107
107
|
const initiateOAuth = async (platform, username) => {
|
|
@@ -160,9 +160,9 @@ const initiateOAuth = async (platform, username) => {
|
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
162
|
|
|
163
|
-
/**
|
|
164
|
-
* Initialize Google Sign-In configuration with enhanced refresh token support
|
|
165
|
-
* Updated with CRITICAL parameters for refresh token generation
|
|
163
|
+
/**
|
|
164
|
+
* Initialize Google Sign-In configuration with enhanced refresh token support
|
|
165
|
+
* Updated with CRITICAL parameters for refresh token generation
|
|
166
166
|
*/
|
|
167
167
|
exports.initiateOAuth = initiateOAuth;
|
|
168
168
|
const initializeGoogleSignIn = () => {
|
|
@@ -186,9 +186,9 @@ const initializeGoogleSignIn = () => {
|
|
|
186
186
|
});
|
|
187
187
|
};
|
|
188
188
|
|
|
189
|
-
/**
|
|
190
|
-
* Force YouTube reconnection with consent screen to get refresh tokens
|
|
191
|
-
* This is the key function to fix YouTube token expiry issues
|
|
189
|
+
/**
|
|
190
|
+
* Force YouTube reconnection with consent screen to get refresh tokens
|
|
191
|
+
* This is the key function to fix YouTube token expiry issues
|
|
192
192
|
*/
|
|
193
193
|
const forceYouTubeReconnectionWithConsent = async username => {
|
|
194
194
|
try {
|
|
@@ -473,8 +473,8 @@ const forceYouTubeReconnectionWithConsent = async username => {
|
|
|
473
473
|
}
|
|
474
474
|
};
|
|
475
475
|
|
|
476
|
-
/**
|
|
477
|
-
* Alternative method: Force consent by revoking existing permissions
|
|
476
|
+
/**
|
|
477
|
+
* Alternative method: Force consent by revoking existing permissions
|
|
478
478
|
*/
|
|
479
479
|
exports.forceYouTubeReconnectionWithConsent = forceYouTubeReconnectionWithConsent;
|
|
480
480
|
const forceYouTubeReconnectionWithRevoke = async username => {
|
|
@@ -525,8 +525,8 @@ const forceYouTubeReconnectionWithRevoke = async username => {
|
|
|
525
525
|
}
|
|
526
526
|
};
|
|
527
527
|
|
|
528
|
-
/**
|
|
529
|
-
* Fix YouTube connection for a specific user (like nicholase50)
|
|
528
|
+
/**
|
|
529
|
+
* Fix YouTube connection for a specific user (like nicholase50)
|
|
530
530
|
*/
|
|
531
531
|
exports.forceYouTubeReconnectionWithRevoke = forceYouTubeReconnectionWithRevoke;
|
|
532
532
|
const fixUserYouTubeConnection = async username => {
|
|
@@ -551,8 +551,8 @@ const fixUserYouTubeConnection = async username => {
|
|
|
551
551
|
return false;
|
|
552
552
|
};
|
|
553
553
|
|
|
554
|
-
/**
|
|
555
|
-
* Get fresh tokens using refresh token
|
|
554
|
+
/**
|
|
555
|
+
* Get fresh tokens using refresh token
|
|
556
556
|
*/
|
|
557
557
|
exports.fixUserYouTubeConnection = fixUserYouTubeConnection;
|
|
558
558
|
const refreshGoogleTokens = async () => {
|
|
@@ -593,8 +593,8 @@ const refreshGoogleTokens = async () => {
|
|
|
593
593
|
}
|
|
594
594
|
};
|
|
595
595
|
|
|
596
|
-
/**
|
|
597
|
-
* Debug YouTube tokens to verify refresh token availability
|
|
596
|
+
/**
|
|
597
|
+
* Debug YouTube tokens to verify refresh token availability
|
|
598
598
|
*/
|
|
599
599
|
const debugYouTubeTokens = async () => {
|
|
600
600
|
try {
|
|
@@ -620,8 +620,8 @@ const debugYouTubeTokens = async () => {
|
|
|
620
620
|
}
|
|
621
621
|
};
|
|
622
622
|
|
|
623
|
-
/**
|
|
624
|
-
* Force fresh YouTube reconnection with proper refresh token
|
|
623
|
+
/**
|
|
624
|
+
* Force fresh YouTube reconnection with proper refresh token
|
|
625
625
|
*/
|
|
626
626
|
const reconnectYouTube = async username => {
|
|
627
627
|
try {
|
|
@@ -669,8 +669,8 @@ const reconnectYouTube = async username => {
|
|
|
669
669
|
}
|
|
670
670
|
};
|
|
671
671
|
|
|
672
|
-
/**
|
|
673
|
-
* Initiate native authentication for platforms with SDKs
|
|
672
|
+
/**
|
|
673
|
+
* Initiate native authentication for platforms with SDKs
|
|
674
674
|
*/
|
|
675
675
|
exports.reconnectYouTube = reconnectYouTube;
|
|
676
676
|
const initiateNativeAuth = async (platform, username) => {
|
|
@@ -1003,17 +1003,17 @@ const initiateNativeAuth = async (platform, username) => {
|
|
|
1003
1003
|
return false;
|
|
1004
1004
|
};
|
|
1005
1005
|
|
|
1006
|
-
/**
|
|
1007
|
-
* Check if a URL is an OAuth callback
|
|
1006
|
+
/**
|
|
1007
|
+
* Check if a URL is an OAuth callback
|
|
1008
1008
|
*/
|
|
1009
1009
|
exports.initiateNativeAuth = initiateNativeAuth;
|
|
1010
1010
|
const isOAuthCallback = url => {
|
|
1011
1011
|
return url.includes('auth/callback') || url.includes('code=');
|
|
1012
1012
|
};
|
|
1013
1013
|
|
|
1014
|
-
/**
|
|
1015
|
-
* Exchange authorization code for access token
|
|
1016
|
-
* This would typically be done on a server, but we're simulating it here
|
|
1014
|
+
/**
|
|
1015
|
+
* Exchange authorization code for access token
|
|
1016
|
+
* This would typically be done on a server, but we're simulating it here
|
|
1017
1017
|
*/
|
|
1018
1018
|
exports.isOAuthCallback = isOAuthCallback;
|
|
1019
1019
|
const exchangeCodeForToken = async (code, platform) => {
|
|
@@ -1053,9 +1053,9 @@ const exchangeCodeForToken = async (code, platform) => {
|
|
|
1053
1053
|
}
|
|
1054
1054
|
};
|
|
1055
1055
|
|
|
1056
|
-
/**
|
|
1057
|
-
* Refresh YouTube tokens when they expire
|
|
1058
|
-
* This should be called when the backend reports token expiry
|
|
1056
|
+
/**
|
|
1057
|
+
* Refresh YouTube tokens when they expire
|
|
1058
|
+
* This should be called when the backend reports token expiry
|
|
1059
1059
|
*/
|
|
1060
1060
|
exports.exchangeCodeForToken = exchangeCodeForToken;
|
|
1061
1061
|
const refreshYouTubeTokens = async () => {
|
|
@@ -1116,9 +1116,9 @@ const refreshYouTubeTokens = async () => {
|
|
|
1116
1116
|
}
|
|
1117
1117
|
};
|
|
1118
1118
|
|
|
1119
|
-
/**
|
|
1120
|
-
* Trigger training restart after YouTube re-authentication
|
|
1121
|
-
* This signals the backend to restart training with the new refresh token
|
|
1119
|
+
/**
|
|
1120
|
+
* Trigger training restart after YouTube re-authentication
|
|
1121
|
+
* This signals the backend to restart training with the new refresh token
|
|
1122
1122
|
*/
|
|
1123
1123
|
exports.refreshYouTubeTokens = refreshYouTubeTokens;
|
|
1124
1124
|
const triggerTrainingRestart = async (username, authToken) => {
|
|
@@ -1152,9 +1152,9 @@ const triggerTrainingRestart = async (username, authToken) => {
|
|
|
1152
1152
|
}
|
|
1153
1153
|
};
|
|
1154
1154
|
|
|
1155
|
-
/**
|
|
1156
|
-
* Test function to verify YouTube refresh token functionality
|
|
1157
|
-
* Call this in your app to test the YouTube connection
|
|
1155
|
+
/**
|
|
1156
|
+
* Test function to verify YouTube refresh token functionality
|
|
1157
|
+
* Call this in your app to test the YouTube connection
|
|
1158
1158
|
*/
|
|
1159
1159
|
const testYouTubeRefreshToken = async username => {
|
|
1160
1160
|
console.log('🧪 Testing YouTube refresh token functionality...');
|
|
@@ -1181,8 +1181,8 @@ const testYouTubeRefreshToken = async username => {
|
|
|
1181
1181
|
}
|
|
1182
1182
|
};
|
|
1183
1183
|
|
|
1184
|
-
/**
|
|
1185
|
-
* Request email verification code
|
|
1184
|
+
/**
|
|
1185
|
+
* Request email verification code
|
|
1186
1186
|
*/
|
|
1187
1187
|
exports.testYouTubeRefreshToken = testYouTubeRefreshToken;
|
|
1188
1188
|
const requestEmailVerification = async (email, testMode = false) => {
|
|
@@ -1218,8 +1218,8 @@ const requestEmailVerification = async (email, testMode = false) => {
|
|
|
1218
1218
|
}
|
|
1219
1219
|
};
|
|
1220
1220
|
|
|
1221
|
-
/**
|
|
1222
|
-
* Verify email code
|
|
1221
|
+
/**
|
|
1222
|
+
* Verify email code
|
|
1223
1223
|
*/
|
|
1224
1224
|
exports.requestEmailVerification = requestEmailVerification;
|
|
1225
1225
|
const verifyEmailCode = async (email, code, testMode = false) => {
|
|
@@ -1258,8 +1258,8 @@ const verifyEmailCode = async (email, code, testMode = false) => {
|
|
|
1258
1258
|
}
|
|
1259
1259
|
};
|
|
1260
1260
|
|
|
1261
|
-
/**
|
|
1262
|
-
* Check email verification status
|
|
1261
|
+
/**
|
|
1262
|
+
* Check email verification status
|
|
1263
1263
|
*/
|
|
1264
1264
|
exports.verifyEmailCode = verifyEmailCode;
|
|
1265
1265
|
const checkEmailVerificationStatus = async (email, testMode = false) => {
|
|
@@ -1288,8 +1288,8 @@ const checkEmailVerificationStatus = async (email, testMode = false) => {
|
|
|
1288
1288
|
}
|
|
1289
1289
|
};
|
|
1290
1290
|
|
|
1291
|
-
/**
|
|
1292
|
-
* Initialize platform auth service
|
|
1291
|
+
/**
|
|
1292
|
+
* Initialize platform auth service
|
|
1293
1293
|
*/
|
|
1294
1294
|
exports.checkEmailVerificationStatus = checkEmailVerificationStatus;
|
|
1295
1295
|
const initializePlatformAuthService = () => {
|