@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
|
@@ -41,8 +41,8 @@ const STORAGE_KEYS = exports.STORAGE_KEYS = {
|
|
|
41
41
|
|
|
42
42
|
// Authentication state
|
|
43
43
|
|
|
44
|
-
/**
|
|
45
|
-
* Save user progress to track where they left off
|
|
44
|
+
/**
|
|
45
|
+
* Save user progress to track where they left off
|
|
46
46
|
*/
|
|
47
47
|
const saveUserProgress = async progress => {
|
|
48
48
|
try {
|
|
@@ -59,8 +59,8 @@ const saveUserProgress = async progress => {
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
/**
|
|
63
|
-
* Get user progress to determine where to resume
|
|
62
|
+
/**
|
|
63
|
+
* Get user progress to determine where to resume
|
|
64
64
|
*/
|
|
65
65
|
exports.saveUserProgress = saveUserProgress;
|
|
66
66
|
const getUserProgress = async () => {
|
|
@@ -89,8 +89,8 @@ const getUserProgress = async () => {
|
|
|
89
89
|
};
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
-
/**
|
|
93
|
-
* Save authentication state
|
|
92
|
+
/**
|
|
93
|
+
* Save authentication state
|
|
94
94
|
*/
|
|
95
95
|
exports.getUserProgress = getUserProgress;
|
|
96
96
|
const saveAuthState = async authState => {
|
|
@@ -111,8 +111,8 @@ const saveAuthState = async authState => {
|
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
|
|
114
|
-
/**
|
|
115
|
-
* Get authentication state
|
|
114
|
+
/**
|
|
115
|
+
* Get authentication state
|
|
116
116
|
*/
|
|
117
117
|
exports.saveAuthState = saveAuthState;
|
|
118
118
|
const getAuthState = async () => {
|
|
@@ -134,8 +134,8 @@ const getAuthState = async () => {
|
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
/**
|
|
138
|
-
* Clear all user data (for logout)
|
|
137
|
+
/**
|
|
138
|
+
* Clear all user data (for logout)
|
|
139
139
|
*/
|
|
140
140
|
exports.getAuthState = getAuthState;
|
|
141
141
|
const clearUserData = async () => {
|
|
@@ -158,8 +158,8 @@ const clearUserData = async () => {
|
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
160
|
|
|
161
|
-
/**
|
|
162
|
-
* Get resume navigation target based on user progress
|
|
161
|
+
/**
|
|
162
|
+
* Get resume navigation target based on user progress
|
|
163
163
|
*/
|
|
164
164
|
exports.clearUserData = clearUserData;
|
|
165
165
|
const getResumeTarget = async () => {
|
|
@@ -244,8 +244,8 @@ const getResumeTarget = async () => {
|
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
246
|
|
|
247
|
-
/**
|
|
248
|
-
* Check if user has completed onboarding flow
|
|
247
|
+
/**
|
|
248
|
+
* Check if user has completed onboarding flow
|
|
249
249
|
*/
|
|
250
250
|
exports.getResumeTarget = getResumeTarget;
|
|
251
251
|
const hasCompletedOnboarding = async () => {
|
|
@@ -258,9 +258,9 @@ const hasCompletedOnboarding = async () => {
|
|
|
258
258
|
}
|
|
259
259
|
};
|
|
260
260
|
|
|
261
|
-
/**
|
|
262
|
-
* Mark user as having reached the event page (completed full onboarding)
|
|
263
|
-
* This creates the token that ensures they always return to Results
|
|
261
|
+
/**
|
|
262
|
+
* Mark user as having reached the event page (completed full onboarding)
|
|
263
|
+
* This creates the token that ensures they always return to Results
|
|
264
264
|
*/
|
|
265
265
|
exports.hasCompletedOnboarding = hasCompletedOnboarding;
|
|
266
266
|
const markEventPageReached = async eventData => {
|
|
@@ -290,8 +290,8 @@ const markEventPageReached = async eventData => {
|
|
|
290
290
|
}
|
|
291
291
|
};
|
|
292
292
|
|
|
293
|
-
/**
|
|
294
|
-
* Check if user has the event access token (completed onboarding)
|
|
293
|
+
/**
|
|
294
|
+
* Check if user has the event access token (completed onboarding)
|
|
295
295
|
*/
|
|
296
296
|
exports.markEventPageReached = markEventPageReached;
|
|
297
297
|
const hasEventAccessToken = async () => {
|
|
@@ -305,8 +305,8 @@ const hasEventAccessToken = async () => {
|
|
|
305
305
|
}
|
|
306
306
|
};
|
|
307
307
|
|
|
308
|
-
/**
|
|
309
|
-
* Mark a step as completed
|
|
308
|
+
/**
|
|
309
|
+
* Mark a step as completed
|
|
310
310
|
*/
|
|
311
311
|
exports.hasEventAccessToken = hasEventAccessToken;
|
|
312
312
|
const markStepCompleted = async step => {
|
|
@@ -321,8 +321,8 @@ const markStepCompleted = async step => {
|
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
323
|
|
|
324
|
-
/**
|
|
325
|
-
* Update user's last screen
|
|
324
|
+
/**
|
|
325
|
+
* Update user's last screen
|
|
326
326
|
*/
|
|
327
327
|
exports.markStepCompleted = markStepCompleted;
|
|
328
328
|
const updateLastScreen = async (screen, params) => {
|
|
@@ -336,8 +336,8 @@ const updateLastScreen = async (screen, params) => {
|
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
338
|
|
|
339
|
-
/**
|
|
340
|
-
* Check if this is a returning user with existing progress
|
|
339
|
+
/**
|
|
340
|
+
* Check if this is a returning user with existing progress
|
|
341
341
|
*/
|
|
342
342
|
exports.updateLastScreen = updateLastScreen;
|
|
343
343
|
const isReturningUser = async () => {
|
|
@@ -351,8 +351,8 @@ const isReturningUser = async () => {
|
|
|
351
351
|
}
|
|
352
352
|
};
|
|
353
353
|
|
|
354
|
-
/**
|
|
355
|
-
* Mark app as active (call this when app becomes active)
|
|
354
|
+
/**
|
|
355
|
+
* Mark app as active (call this when app becomes active)
|
|
356
356
|
*/
|
|
357
357
|
exports.isReturningUser = isReturningUser;
|
|
358
358
|
const markAppActive = async () => {
|
|
@@ -366,8 +366,8 @@ const markAppActive = async () => {
|
|
|
366
366
|
}
|
|
367
367
|
};
|
|
368
368
|
|
|
369
|
-
/**
|
|
370
|
-
* Development utility: Get all stored progress data for debugging
|
|
369
|
+
/**
|
|
370
|
+
* Development utility: Get all stored progress data for debugging
|
|
371
371
|
*/
|
|
372
372
|
exports.markAppActive = markAppActive;
|
|
373
373
|
const getDebugStorageInfo = async () => {
|
|
@@ -388,8 +388,8 @@ const getDebugStorageInfo = async () => {
|
|
|
388
388
|
}
|
|
389
389
|
};
|
|
390
390
|
|
|
391
|
-
/**
|
|
392
|
-
* Development utility: Clear all progress (for testing)
|
|
391
|
+
/**
|
|
392
|
+
* Development utility: Clear all progress (for testing)
|
|
393
393
|
*/
|
|
394
394
|
exports.getDebugStorageInfo = getDebugStorageInfo;
|
|
395
395
|
const clearAllProgress = async () => {
|
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.addEncryptedPinToTrainingData = void 0;
|
|
7
7
|
var _pinEncryptionService = require("./pinEncryptionService");
|
|
8
|
-
/**
|
|
9
|
-
* Helper functions for training API modifications
|
|
8
|
+
/**
|
|
9
|
+
* Helper functions for training API modifications
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Add encrypted PIN to training data if available
|
|
12
|
+
/**
|
|
13
|
+
* Add encrypted PIN to training data if available
|
|
14
14
|
*/
|
|
15
15
|
const addEncryptedPinToTrainingData = async trainingData => {
|
|
16
16
|
try {
|
|
@@ -39,35 +39,35 @@ const addEncryptedPinToTrainingData = async trainingData => {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
/**
|
|
43
|
-
* Example of how to modify the training API call to include PIN
|
|
44
|
-
*
|
|
45
|
-
* Usage in UniversalOnboarding.tsx:
|
|
46
|
-
*
|
|
47
|
-
* ```typescript
|
|
48
|
-
* // Before sending to API
|
|
49
|
-
* const trainingData = {
|
|
50
|
-
* socketId,
|
|
51
|
-
* username: finalUsername,
|
|
52
|
-
* email: userInfo?.email || null,
|
|
53
|
-
* modelKey: null,
|
|
54
|
-
* connectedPlatforms: platformsList,
|
|
55
|
-
* platformConnections: connections
|
|
56
|
-
* };
|
|
57
|
-
*
|
|
58
|
-
* // Add encrypted PIN if needed
|
|
59
|
-
* const trainingDataWithPin = await addEncryptedPinToTrainingData(trainingData);
|
|
60
|
-
*
|
|
61
|
-
* // Send to API
|
|
62
|
-
* const response = await fetch('https://api2.onairos.uk/mobile-training/enoch', {
|
|
63
|
-
* method: 'POST',
|
|
64
|
-
* headers: {
|
|
65
|
-
* 'Content-Type': 'application/json',
|
|
66
|
-
* 'Authorization': `Bearer ${token}`
|
|
67
|
-
* },
|
|
68
|
-
* body: JSON.stringify(trainingDataWithPin)
|
|
69
|
-
* });
|
|
70
|
-
* ```
|
|
42
|
+
/**
|
|
43
|
+
* Example of how to modify the training API call to include PIN
|
|
44
|
+
*
|
|
45
|
+
* Usage in UniversalOnboarding.tsx:
|
|
46
|
+
*
|
|
47
|
+
* ```typescript
|
|
48
|
+
* // Before sending to API
|
|
49
|
+
* const trainingData = {
|
|
50
|
+
* socketId,
|
|
51
|
+
* username: finalUsername,
|
|
52
|
+
* email: userInfo?.email || null,
|
|
53
|
+
* modelKey: null,
|
|
54
|
+
* connectedPlatforms: platformsList,
|
|
55
|
+
* platformConnections: connections
|
|
56
|
+
* };
|
|
57
|
+
*
|
|
58
|
+
* // Add encrypted PIN if needed
|
|
59
|
+
* const trainingDataWithPin = await addEncryptedPinToTrainingData(trainingData);
|
|
60
|
+
*
|
|
61
|
+
* // Send to API
|
|
62
|
+
* const response = await fetch('https://api2.onairos.uk/mobile-training/enoch', {
|
|
63
|
+
* method: 'POST',
|
|
64
|
+
* headers: {
|
|
65
|
+
* 'Content-Type': 'application/json',
|
|
66
|
+
* 'Authorization': `Bearer ${token}`
|
|
67
|
+
* },
|
|
68
|
+
* body: JSON.stringify(trainingDataWithPin)
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
71
|
*/
|
|
72
72
|
exports.addEncryptedPinToTrainingData = addEncryptedPinToTrainingData;
|
|
73
73
|
//# sourceMappingURL=trainingApiHelpers.js.map
|
|
@@ -9,10 +9,10 @@ var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/
|
|
|
9
9
|
var _imageCompressionService = require("./imageCompressionService");
|
|
10
10
|
var _api = require("../config/api");
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
/**
|
|
13
|
-
* Get user identifier (ID or username) using multiple fallback methods
|
|
14
|
-
* Backend now supports both user IDs and usernames for profile picture uploads
|
|
15
|
-
* @returns Promise<string | null>
|
|
12
|
+
/**
|
|
13
|
+
* Get user identifier (ID or username) using multiple fallback methods
|
|
14
|
+
* Backend now supports both user IDs and usernames for profile picture uploads
|
|
15
|
+
* @returns Promise<string | null>
|
|
16
16
|
*/
|
|
17
17
|
const getUserIdWithFallbacks = async () => {
|
|
18
18
|
try {
|
|
@@ -90,8 +90,8 @@ const API_BASE_URL = _api.API_CONFIG.BASE_URL;
|
|
|
90
90
|
|
|
91
91
|
// Interface for the transformed connection used by UI
|
|
92
92
|
|
|
93
|
-
/**
|
|
94
|
-
* Transform API connection to UI connection format
|
|
93
|
+
/**
|
|
94
|
+
* Transform API connection to UI connection format
|
|
95
95
|
*/
|
|
96
96
|
const transformAPIConnection = apiConnection => {
|
|
97
97
|
var _apiConnection$photo, _apiConnection$mutual;
|
|
@@ -132,10 +132,10 @@ const transformAPIConnection = apiConnection => {
|
|
|
132
132
|
};
|
|
133
133
|
};
|
|
134
134
|
|
|
135
|
-
/**
|
|
136
|
-
* Get user connections by username
|
|
137
|
-
* @param username - Username to fetch connections for
|
|
138
|
-
* @returns Promise<Connection[]>
|
|
135
|
+
/**
|
|
136
|
+
* Get user connections by username
|
|
137
|
+
* @param username - Username to fetch connections for
|
|
138
|
+
* @returns Promise<Connection[]>
|
|
139
139
|
*/
|
|
140
140
|
const getUserConnectionsByUsername = async username => {
|
|
141
141
|
try {
|
|
@@ -182,10 +182,10 @@ const getUserConnectionsByUsername = async username => {
|
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
184
|
|
|
185
|
-
/**
|
|
186
|
-
* Get user connections by user ID
|
|
187
|
-
* @param userId - User ID to fetch connections for
|
|
188
|
-
* @returns Promise<Connection[]>
|
|
185
|
+
/**
|
|
186
|
+
* Get user connections by user ID
|
|
187
|
+
* @param userId - User ID to fetch connections for
|
|
188
|
+
* @returns Promise<Connection[]>
|
|
189
189
|
*/
|
|
190
190
|
exports.getUserConnectionsByUsername = getUserConnectionsByUsername;
|
|
191
191
|
const getUserConnectionsByUserId = async userId => {
|
|
@@ -230,10 +230,10 @@ const getUserConnectionsByUserId = async userId => {
|
|
|
230
230
|
}
|
|
231
231
|
};
|
|
232
232
|
|
|
233
|
-
/**
|
|
234
|
-
* Get user connections with automatic detection of user info
|
|
235
|
-
* PRIORITIZES the working email/username endpoint over the failing user ID endpoint
|
|
236
|
-
* @returns Promise<Connection[]>
|
|
233
|
+
/**
|
|
234
|
+
* Get user connections with automatic detection of user info
|
|
235
|
+
* PRIORITIZES the working email/username endpoint over the failing user ID endpoint
|
|
236
|
+
* @returns Promise<Connection[]>
|
|
237
237
|
*/
|
|
238
238
|
exports.getUserConnectionsByUserId = getUserConnectionsByUserId;
|
|
239
239
|
const getUserConnections = async () => {
|
|
@@ -317,12 +317,12 @@ const getUserConnections = async () => {
|
|
|
317
317
|
}
|
|
318
318
|
};
|
|
319
319
|
|
|
320
|
-
/**
|
|
321
|
-
* Upload profile picture using base64 data with compression
|
|
322
|
-
* The backend identifies the user from the JWT token, no need for user ID in URL
|
|
323
|
-
* @param imageUri - Image URI (file:// or base64)
|
|
324
|
-
* @param fileType - File type (jpg, png) - optional, will be extracted from imageUri if not provided
|
|
325
|
-
* @returns Promise<{ success: boolean; photoUrl?: string; error?: string }>
|
|
320
|
+
/**
|
|
321
|
+
* Upload profile picture using base64 data with compression
|
|
322
|
+
* The backend identifies the user from the JWT token, no need for user ID in URL
|
|
323
|
+
* @param imageUri - Image URI (file:// or base64)
|
|
324
|
+
* @param fileType - File type (jpg, png) - optional, will be extracted from imageUri if not provided
|
|
325
|
+
* @returns Promise<{ success: boolean; photoUrl?: string; error?: string }>
|
|
326
326
|
*/
|
|
327
327
|
exports.getUserConnections = getUserConnections;
|
|
328
328
|
const uploadProfilePicture = async (imageUri, fileType) => {
|
|
@@ -18,8 +18,8 @@ const PortalContext = /*#__PURE__*/_react.default.createContext({
|
|
|
18
18
|
unmount: () => {}
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
/**
|
|
22
|
-
* Portal Host component - place this at the root of your app
|
|
21
|
+
/**
|
|
22
|
+
* Portal Host component - place this at the root of your app
|
|
23
23
|
*/
|
|
24
24
|
const PortalHost = ({
|
|
25
25
|
children
|
|
@@ -67,8 +67,8 @@ const PortalHost = ({
|
|
|
67
67
|
}, portals[Number(key)])));
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
/**
|
|
71
|
-
* Portal component - renders children into the PortalHost
|
|
70
|
+
/**
|
|
71
|
+
* Portal component - renders children into the PortalHost
|
|
72
72
|
*/
|
|
73
73
|
exports.PortalHost = PortalHost;
|
|
74
74
|
const Portal = ({
|
|
@@ -9,9 +9,9 @@ var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/
|
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
const API_URL = 'https://api2.onairos.uk';
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Create an API instance with authorization headers
|
|
14
|
-
* @returns {Promise<Object>} - The axios instance
|
|
12
|
+
/**
|
|
13
|
+
* Create an API instance with authorization headers
|
|
14
|
+
* @returns {Promise<Object>} - The axios instance
|
|
15
15
|
*/
|
|
16
16
|
const createApiInstance = async () => {
|
|
17
17
|
const token = await _asyncStorage.default.getItem('onairosToken');
|
|
@@ -26,9 +26,9 @@ const createApiInstance = async () => {
|
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* Validate the domain with the Onairos API
|
|
31
|
-
* @returns {Promise<Object>} - The validation response
|
|
29
|
+
/**
|
|
30
|
+
* Validate the domain with the Onairos API
|
|
31
|
+
* @returns {Promise<Object>} - The validation response
|
|
32
32
|
*/
|
|
33
33
|
exports.createApiInstance = createApiInstance;
|
|
34
34
|
const validateDomain = async () => {
|
|
@@ -44,11 +44,11 @@ const validateDomain = async () => {
|
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
/**
|
|
48
|
-
* Fetch account information
|
|
49
|
-
* @param {string} identifier - The username or email
|
|
50
|
-
* @param {boolean} isEmail - Whether the identifier is an email
|
|
51
|
-
* @returns {Promise<Object>} - The account information
|
|
47
|
+
/**
|
|
48
|
+
* Fetch account information
|
|
49
|
+
* @param {string} identifier - The username or email
|
|
50
|
+
* @param {boolean} isEmail - Whether the identifier is an email
|
|
51
|
+
* @returns {Promise<Object>} - The account information
|
|
52
52
|
*/
|
|
53
53
|
exports.validateDomain = validateDomain;
|
|
54
54
|
const fetchAccountInfo = async (identifier, isEmail = false) => {
|
|
@@ -72,12 +72,12 @@ const fetchAccountInfo = async (identifier, isEmail = false) => {
|
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
-
/**
|
|
76
|
-
* Get API URL for data requests
|
|
77
|
-
* @param {Array} approvedRequests - The approved data requests
|
|
78
|
-
* @param {string} pin - The encrypted PIN
|
|
79
|
-
* @param {string} othentSub - The hashed Othent sub
|
|
80
|
-
* @returns {Promise<Object>} - The API URL response
|
|
75
|
+
/**
|
|
76
|
+
* Get API URL for data requests
|
|
77
|
+
* @param {Array} approvedRequests - The approved data requests
|
|
78
|
+
* @param {string} pin - The encrypted PIN
|
|
79
|
+
* @param {string} othentSub - The hashed Othent sub
|
|
80
|
+
* @returns {Promise<Object>} - The API URL response
|
|
81
81
|
*/
|
|
82
82
|
exports.fetchAccountInfo = fetchAccountInfo;
|
|
83
83
|
const getApiUrl = async (approvedRequests, pin, othentSub) => {
|
|
@@ -101,13 +101,13 @@ const getApiUrl = async (approvedRequests, pin, othentSub) => {
|
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
/**
|
|
105
|
-
* Create a new user account
|
|
106
|
-
* @param {string} othentSub - The hashed Othent sub
|
|
107
|
-
* @param {string} pin - The PIN
|
|
108
|
-
* @param {Array} socialAccounts - The selected social accounts
|
|
109
|
-
* @param {string} email - The user's email
|
|
110
|
-
* @returns {Promise<Object>} - The account creation response
|
|
104
|
+
/**
|
|
105
|
+
* Create a new user account
|
|
106
|
+
* @param {string} othentSub - The hashed Othent sub
|
|
107
|
+
* @param {string} pin - The PIN
|
|
108
|
+
* @param {Array} socialAccounts - The selected social accounts
|
|
109
|
+
* @param {string} email - The user's email
|
|
110
|
+
* @returns {Promise<Object>} - The account creation response
|
|
111
111
|
*/
|
|
112
112
|
exports.getApiUrl = getApiUrl;
|
|
113
113
|
const createAccount = async (othentSub, pin, socialAccounts, email) => {
|
|
@@ -9,10 +9,10 @@ var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/
|
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
const API_URL = 'https://api2.onairos.uk';
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Get the encrypted PIN for a user
|
|
14
|
-
* @param {string} hashedOthentSub - The hashed Othent sub
|
|
15
|
-
* @returns {Promise<Object>} - The response containing the encrypted PIN
|
|
12
|
+
/**
|
|
13
|
+
* Get the encrypted PIN for a user
|
|
14
|
+
* @param {string} hashedOthentSub - The hashed Othent sub
|
|
15
|
+
* @returns {Promise<Object>} - The response containing the encrypted PIN
|
|
16
16
|
*/
|
|
17
17
|
const getPin = async hashedOthentSub => {
|
|
18
18
|
try {
|
|
@@ -26,10 +26,10 @@ const getPin = async hashedOthentSub => {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* Verify a token with the Onairos API
|
|
31
|
-
* @param {string} token - The token to verify
|
|
32
|
-
* @returns {Promise<boolean>} - Whether the token is valid
|
|
29
|
+
/**
|
|
30
|
+
* Verify a token with the Onairos API
|
|
31
|
+
* @param {string} token - The token to verify
|
|
32
|
+
* @returns {Promise<boolean>} - Whether the token is valid
|
|
33
33
|
*/
|
|
34
34
|
exports.getPin = getPin;
|
|
35
35
|
const verifyToken = async token => {
|
|
@@ -46,11 +46,11 @@ const verifyToken = async token => {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* Store authentication data
|
|
51
|
-
* @param {string} token - The authentication token
|
|
52
|
-
* @param {string} username - The username
|
|
53
|
-
* @param {Object} othentData - The Othent user data
|
|
49
|
+
/**
|
|
50
|
+
* Store authentication data
|
|
51
|
+
* @param {string} token - The authentication token
|
|
52
|
+
* @param {string} username - The username
|
|
53
|
+
* @param {Object} othentData - The Othent user data
|
|
54
54
|
*/
|
|
55
55
|
exports.verifyToken = verifyToken;
|
|
56
56
|
const storeAuthData = async (token, username = null, othentData = null) => {
|
|
@@ -68,8 +68,8 @@ const storeAuthData = async (token, username = null, othentData = null) => {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
/**
|
|
72
|
-
* Clear authentication data
|
|
71
|
+
/**
|
|
72
|
+
* Clear authentication data
|
|
73
73
|
*/
|
|
74
74
|
exports.storeAuthData = storeAuthData;
|
|
75
75
|
const clearAuthData = async () => {
|
|
@@ -83,9 +83,9 @@ const clearAuthData = async () => {
|
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
/**
|
|
87
|
-
* Get stored authentication data
|
|
88
|
-
* @returns {Promise<Object>} - The stored authentication data
|
|
86
|
+
/**
|
|
87
|
+
* Get stored authentication data
|
|
88
|
+
* @returns {Promise<Object>} - The stored authentication data
|
|
89
89
|
*/
|
|
90
90
|
exports.clearAuthData = clearAuthData;
|
|
91
91
|
const getStoredAuthData = async () => {
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.sha256 = exports.rsaEncrypt = exports.base64ToBuffer = void 0;
|
|
7
7
|
var _reactNativeRsaNative = require("react-native-rsa-native");
|
|
8
8
|
var _reactNativeCryptoJs = require("react-native-crypto-js");
|
|
9
|
-
/**
|
|
10
|
-
* Encrypt data using RSA
|
|
11
|
-
* @param {string} publicKey - The RSA public key
|
|
12
|
-
* @param {string} data - The data to encrypt
|
|
13
|
-
* @returns {Promise<string>} - The encrypted data
|
|
9
|
+
/**
|
|
10
|
+
* Encrypt data using RSA
|
|
11
|
+
* @param {string} publicKey - The RSA public key
|
|
12
|
+
* @param {string} data - The data to encrypt
|
|
13
|
+
* @returns {Promise<string>} - The encrypted data
|
|
14
14
|
*/
|
|
15
15
|
const rsaEncrypt = async (publicKey, data) => {
|
|
16
16
|
try {
|
|
@@ -29,20 +29,20 @@ const rsaEncrypt = async (publicKey, data) => {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
/**
|
|
33
|
-
* Hash data using SHA-256
|
|
34
|
-
* @param {string} data - The data to hash
|
|
35
|
-
* @returns {string} - The hashed data
|
|
32
|
+
/**
|
|
33
|
+
* Hash data using SHA-256
|
|
34
|
+
* @param {string} data - The data to hash
|
|
35
|
+
* @returns {string} - The hashed data
|
|
36
36
|
*/
|
|
37
37
|
exports.rsaEncrypt = rsaEncrypt;
|
|
38
38
|
const sha256 = data => {
|
|
39
39
|
return (0, _reactNativeCryptoJs.sha256)(data).toString();
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
/**
|
|
43
|
-
* Convert a base64 string to a buffer
|
|
44
|
-
* @param {string} base64String - The base64 string to convert
|
|
45
|
-
* @returns {ArrayBuffer} - The converted buffer
|
|
42
|
+
/**
|
|
43
|
+
* Convert a base64 string to a buffer
|
|
44
|
+
* @param {string} base64String - The base64 string to convert
|
|
45
|
+
* @returns {ArrayBuffer} - The converted buffer
|
|
46
46
|
*/
|
|
47
47
|
exports.sha256 = sha256;
|
|
48
48
|
const base64ToBuffer = base64String => {
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.hashString = exports.getServerPublicKey = exports.encryptModelKey = void 0;
|
|
7
7
|
var _api = require("../api");
|
|
8
|
-
/**
|
|
9
|
-
* Encrypt a model key using RSA with a public key
|
|
10
|
-
* @param publicKey The public key to encrypt with
|
|
11
|
-
* @param modelKey The model key to encrypt
|
|
12
|
-
* @returns The encrypted model key
|
|
8
|
+
/**
|
|
9
|
+
* Encrypt a model key using RSA with a public key
|
|
10
|
+
* @param publicKey The public key to encrypt with
|
|
11
|
+
* @param modelKey The model key to encrypt
|
|
12
|
+
* @returns The encrypted model key
|
|
13
13
|
*/
|
|
14
14
|
const encryptModelKey = (publicKey, modelKey) => {
|
|
15
15
|
try {
|
|
@@ -30,9 +30,9 @@ const encryptModelKey = (publicKey, modelKey) => {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* Get the server's public key
|
|
35
|
-
* @returns The server's public key
|
|
33
|
+
/**
|
|
34
|
+
* Get the server's public key
|
|
35
|
+
* @returns The server's public key
|
|
36
36
|
*/
|
|
37
37
|
exports.encryptModelKey = encryptModelKey;
|
|
38
38
|
const getServerPublicKey = async () => {
|
|
@@ -56,10 +56,10 @@ const getServerPublicKey = async () => {
|
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
/**
|
|
60
|
-
* Hash a string using SHA-256
|
|
61
|
-
* @param input The string to hash
|
|
62
|
-
* @returns The hashed string
|
|
59
|
+
/**
|
|
60
|
+
* Hash a string using SHA-256
|
|
61
|
+
* @param input The string to hash
|
|
62
|
+
* @returns The hashed string
|
|
63
63
|
*/
|
|
64
64
|
exports.getServerPublicKey = getServerPublicKey;
|
|
65
65
|
const hashString = async input => {
|