@onairos/react-native 3.0.40 → 3.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/OnairosButton.js +2 -2
- package/lib/commonjs/components/OnairosButton.js.map +1 -1
- package/lib/commonjs/components/TrainingModal.js +14 -8
- package/lib/commonjs/components/TrainingModal.js.map +1 -1
- package/lib/commonjs/components/UniversalOnboarding.js +69 -17
- package/lib/commonjs/components/UniversalOnboarding.js.map +1 -1
- package/lib/commonjs/components/onboarding/OAuthWebView.js +56 -5
- package/lib/commonjs/components/onboarding/OAuthWebView.js.map +1 -1
- package/lib/commonjs/index.js +65 -53
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/services/platformAuthService.js +64 -1
- package/lib/commonjs/services/platformAuthService.js.map +1 -1
- package/lib/module/components/OnairosButton.js +2 -2
- package/lib/module/components/OnairosButton.js.map +1 -1
- package/lib/module/components/TrainingModal.js +14 -8
- package/lib/module/components/TrainingModal.js.map +1 -1
- package/lib/module/components/UniversalOnboarding.js +72 -20
- package/lib/module/components/UniversalOnboarding.js.map +1 -1
- package/lib/module/components/onboarding/OAuthWebView.js +56 -5
- package/lib/module/components/onboarding/OAuthWebView.js.map +1 -1
- package/lib/module/index.js +37 -37
- package/lib/module/index.js.map +1 -1
- package/lib/module/services/platformAuthService.js +62 -0
- package/lib/module/services/platformAuthService.js.map +1 -1
- package/lib/typescript/components/TrainingModal.d.ts.map +1 -1
- package/lib/typescript/components/UniversalOnboarding.d.ts.map +1 -1
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +26 -32
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/services/platformAuthService.d.ts +7 -0
- package/lib/typescript/services/platformAuthService.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/components/OnairosButton.tsx +2 -2
- package/src/components/TrainingModal.tsx +13 -7
- package/src/components/UniversalOnboarding.tsx +74 -18
- package/src/components/onboarding/OAuthWebView.tsx +51 -5
- package/src/index.ts +62 -67
- package/src/services/platformAuthService.ts +64 -0
- package/types/index.d.ts +5 -1
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["COLORS","PLATFORMS","API_ENDPOINTS","STORAGE_KEYS","PIN_REQUIREMENTS","DEEP_LINK_CONFIG","storeCredentials","getCredentials","hasCredentials","deleteCredentials","updateCredentials","generateDeviceUsername","verifyCredentials","validateCredentials","createAccount","authenticate","refreshToken","getPlatformData","getUserProfile","updatePlatformConnections","rsaEncrypt","sha256","base64ToBuffer","logDebug","logError","isDebugMode","connectPlatform","disconnectPlatform","initializeOAuthService","cleanupOAuthService","storePlatformConnection","onairosApi","OAuthService","useCredentials","useConnections","Portal","PortalHost","ConnectorScreen","PinCreationScreen","LoadingScreen","OAuthWebView","PlatformConnector","OnboardingHeader","PlatformList","PinInput","TrainingModal","Overlay","UniversalOnboarding","OnairosButton","Onairos","components","OnairosOverlay"],"sourceRoot":"..\\..\\src","sources":["index.ts"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA;;AAsBA;AACA,SAASA,MAAM,EAAEC,SAAS,EAAEC,aAAa,EAAEC,YAAY,EAAEC,gBAAgB,EAAEC,gBAAgB,QAAQ,aAAa;;AAEhH;AACA,SACEC,gBAAgB,EAChBC,cAAc,EACdC,cAAc,EACdC,iBAAiB,EACjBC,iBAAiB,EACjBC,sBAAsB,EACtBC,iBAAiB,QACZ,uBAAuB;AAE9B,SACEC,mBAAmB,EACnBC,aAAa,EACbC,YAAY,EACZC,YAAY,EACZC,eAAe,EACfC,cAAc,EACdC,yBAAyB,QACpB,oBAAoB;AAE3B,SACEC,UAAU,EACVC,MAAM,EACNC,cAAc,QACT,gBAAgB;AAEvB,SACEC,QAAQ,EACRC,QAAQ,EACRC,WAAW,QACN,qBAAqB;;AAE5B;AACA,SACEC,eAAe,EACfC,kBAAkB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*/
|
|
66
66
|
export const initiateOAuth = async (platform, username, appName) => {
|
|
67
67
|
try {
|
|
68
|
+
console.log('🚀 Initiating OAuth for platform:', platform);
|
|
69
|
+
console.log('👤 Username:', username);
|
|
70
|
+
console.log('📱 App name:', appName);
|
|
71
|
+
|
|
68
72
|
// Check if the platform is supported
|
|
69
73
|
if (!PLATFORM_AUTH_CONFIG[platform]) {
|
|
74
|
+
console.error('❌ Unsupported platform:', platform);
|
|
70
75
|
throw new Error(`Unsupported platform: ${platform}`);
|
|
71
76
|
}
|
|
72
77
|
|
|
73
78
|
// Check if platform has a native SDK
|
|
74
79
|
if (PLATFORM_AUTH_CONFIG[platform].hasNativeSDK) {
|
|
80
|
+
console.log('📱 Platform uses native SDK, returning null');
|
|
75
81
|
// Return null to indicate that we should use the native SDK
|
|
76
82
|
return null;
|
|
77
83
|
}
|
|
84
|
+
console.log('🌐 Platform uses OAuth WebView flow');
|
|
85
|
+
console.log('🔗 Auth endpoint:', PLATFORM_AUTH_CONFIG[platform].authEndpoint);
|
|
78
86
|
|
|
79
87
|
// Handle Instagram with specific API format
|
|
80
88
|
if (platform === 'instagram') {
|
|
@@ -85,6 +93,7 @@ export const initiateOAuth = async (platform, username, appName) => {
|
|
|
85
93
|
username: username || 'Avatar'
|
|
86
94
|
}
|
|
87
95
|
};
|
|
96
|
+
console.log('📤 Sending Instagram OAuth request:', jsonData);
|
|
88
97
|
const response = await fetch('https://api2.onairos.uk/instagram/authorize', {
|
|
89
98
|
method: 'POST',
|
|
90
99
|
headers: {
|
|
@@ -92,10 +101,20 @@ export const initiateOAuth = async (platform, username, appName) => {
|
|
|
92
101
|
},
|
|
93
102
|
body: JSON.stringify(jsonData)
|
|
94
103
|
});
|
|
104
|
+
console.log('📡 Instagram OAuth response status:', response.status);
|
|
105
|
+
console.log('📡 Instagram OAuth response headers:', response.headers);
|
|
106
|
+
if (!response.ok) {
|
|
107
|
+
const errorText = await response.text();
|
|
108
|
+
console.error('❌ Instagram OAuth API error:', errorText);
|
|
109
|
+
throw new Error(`Instagram OAuth API error: ${response.status} - ${errorText}`);
|
|
110
|
+
}
|
|
95
111
|
const responseData = await response.json();
|
|
112
|
+
console.log('📥 Instagram OAuth response data:', responseData);
|
|
96
113
|
if (responseData.instagramURL) {
|
|
114
|
+
console.log('✅ Instagram OAuth URL received:', responseData.instagramURL);
|
|
97
115
|
return responseData.instagramURL;
|
|
98
116
|
}
|
|
117
|
+
console.error('❌ No Instagram URL found in response');
|
|
99
118
|
throw new Error('No Instagram URL found in response');
|
|
100
119
|
}
|
|
101
120
|
|
|
@@ -108,6 +127,7 @@ export const initiateOAuth = async (platform, username, appName) => {
|
|
|
108
127
|
appName: appName || 'DefaultApp'
|
|
109
128
|
}
|
|
110
129
|
};
|
|
130
|
+
console.log(`📤 Sending ${platform} OAuth request:`, jsonData);
|
|
111
131
|
|
|
112
132
|
// Make the request to get the OAuth URL
|
|
113
133
|
const response = await fetch(PLATFORM_AUTH_CONFIG[platform].authEndpoint, {
|
|
@@ -117,9 +137,17 @@ export const initiateOAuth = async (platform, username, appName) => {
|
|
|
117
137
|
},
|
|
118
138
|
body: JSON.stringify(jsonData)
|
|
119
139
|
});
|
|
140
|
+
console.log(`📡 ${platform} OAuth response status:`, response.status);
|
|
141
|
+
console.log(`📡 ${platform} OAuth response headers:`, response.headers);
|
|
142
|
+
if (!response.ok) {
|
|
143
|
+
const errorText = await response.text();
|
|
144
|
+
console.error(`❌ ${platform} OAuth API error:`, errorText);
|
|
145
|
+
throw new Error(`${platform} OAuth API error: ${response.status} - ${errorText}`);
|
|
146
|
+
}
|
|
120
147
|
|
|
121
148
|
// Parse the response
|
|
122
149
|
const data = await response.json();
|
|
150
|
+
console.log(`📥 ${platform} OAuth response data:`, data);
|
|
123
151
|
|
|
124
152
|
// Check if the response contains the OAuth URL based on platform
|
|
125
153
|
switch (platform) {
|
|
@@ -239,4 +267,38 @@ export const isOAuthCallback = url => {
|
|
|
239
267
|
// Check if the URL starts with our redirect URI
|
|
240
268
|
return url.startsWith('onairosanime://auth/');
|
|
241
269
|
};
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Test connectivity to the Onairos API server
|
|
273
|
+
*/
|
|
274
|
+
export const testApiConnectivity = async () => {
|
|
275
|
+
try {
|
|
276
|
+
console.log('🔍 Testing connectivity to Onairos API...');
|
|
277
|
+
const response = await fetch('https://api2.onairos.uk/health', {
|
|
278
|
+
method: 'GET',
|
|
279
|
+
headers: {
|
|
280
|
+
'Content-Type': 'application/json'
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
console.log('🌐 API connectivity test response:', response.status);
|
|
284
|
+
if (response.ok) {
|
|
285
|
+
console.log('✅ API server is reachable');
|
|
286
|
+
return {
|
|
287
|
+
success: true
|
|
288
|
+
};
|
|
289
|
+
} else {
|
|
290
|
+
console.log('⚠️ API server responded with error:', response.status);
|
|
291
|
+
return {
|
|
292
|
+
success: false,
|
|
293
|
+
error: `API server error: ${response.status}`
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
} catch (error) {
|
|
297
|
+
console.error('❌ API connectivity test failed:', error);
|
|
298
|
+
return {
|
|
299
|
+
success: false,
|
|
300
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
};
|
|
242
304
|
//# sourceMappingURL=platformAuthService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PLATFORM_AUTH_CONFIG","instagram","hasNativeSDK","authEndpoint","color","youtube","nativeSDKPackage","reddit","pinterest","email","platform","config","getAuthEndpoint","getPlatformColor","initiateOAuth","username","appName","Error","state","jsonData","session","oauthState","response","fetch","method","headers","body","JSON","stringify","responseData","json","instagramURL","data","redditURL","pinterestURL","youtubeURL","emailURL","url","
|
|
1
|
+
{"version":3,"names":["PLATFORM_AUTH_CONFIG","instagram","hasNativeSDK","authEndpoint","color","youtube","nativeSDKPackage","reddit","pinterest","email","platform","config","getAuthEndpoint","getPlatformColor","initiateOAuth","username","appName","console","log","error","Error","state","jsonData","session","oauthState","response","fetch","method","headers","body","JSON","stringify","status","ok","errorText","text","responseData","json","instagramURL","data","redditURL","pinterestURL","youtubeURL","emailURL","url","initiateNativeAuth","GoogleSignin","statusCodes","require","configure","scopes","webClientId","offlineAccess","hostedDomain","forceCodeForRefreshToken","hasPlayServices","userInfo","signIn","tokens","getTokens","StatusCodes","code","SIGN_IN_CANCELLED","IN_PROGRESS","PLAY_SERVICES_NOT_AVAILABLE","handleOAuthCallback","parsedUrl","URL","searchParams","get","isOAuthCallback","startsWith","testApiConnectivity","success","message"],"sourceRoot":"..\\..\\..\\src","sources":["services/platformAuthService.ts"],"mappings":"AAGA;;AAQA;AACA,MAAMA,oBAAwD,GAAG;EAC/DC,SAAS,EAAE;IACTC,YAAY,EAAE,KAAK;IAAE;IACrBC,YAAY,EAAE,6CAA6C;IAC3DC,KAAK,EAAE;EACT,CAAC;EACDC,OAAO,EAAE;IACPH,YAAY,EAAE,IAAI;IAAE;IACpBI,gBAAgB,EAAE,2CAA2C;IAC7DH,YAAY,EAAE,2CAA2C;IACzDC,KAAK,EAAE;EACT,CAAC;EACDG,MAAM,EAAE;IACNL,YAAY,EAAE,KAAK;IACnBC,YAAY,EAAE,0CAA0C;IACxDC,KAAK,EAAE;EACT,CAAC;EACDI,SAAS,EAAE;IACTN,YAAY,EAAE,KAAK;IACnBC,YAAY,EAAE,6CAA6C;IAC3DC,KAAK,EAAE;EACT,CAAC;EACDK,KAAK,EAAE;IACLP,YAAY,EAAE,KAAK;IACnBC,YAAY,EAAE,yCAAyC;IACvDC,KAAK,EAAE;EACT;AACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMF,YAAY,GAAIQ,QAAgB,IAAc;EACzD,MAAMC,MAAM,GAAGX,oBAAoB,CAACU,QAAQ,CAAC;EAC7C,OAAO,CAAAC,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAET,YAAY,KAAI,KAAK;AACtC,CAAC;;AAED;A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AAEA,KAAK,CAAC;IACtD,OAAO,IAAI;EACb;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMmD,eAAe,GAAI1B,GAAW,IAAc;EACvD;EACA,OAAOA,GAAG,CAAC2B,UAAU,CAAC,sBAAsB,CAAC;AAC/C,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAG,MAAAA,CAAA,KAA2D;EAC5F,IAAI;IACFvD,OAAO,CAACC,GAAG,CAAC,2CAA2C,CAAC;IAExD,MAAMO,QAAQ,GAAG,MAAMC,KAAK,CAAC,gCAAgC,EAAE;MAC7DC,MAAM,EAAE,KAAK;MACbC,OAAO,EAAE;QACP,cAAc,EAAE;MAClB;IACF,CAAC,CAAC;IAEFX,OAAO,CAACC,GAAG,CAAC,oCAAoC,EAAEO,QAAQ,CAACO,MAAM,CAAC;IAElE,IAAIP,QAAQ,CAACQ,EAAE,EAAE;MACfhB,OAAO,CAACC,GAAG,CAAC,2BAA2B,CAAC;MACxC,OAAO;QAAEuD,OAAO,EAAE;MAAK,CAAC;IAC1B,CAAC,MAAM;MACLxD,OAAO,CAACC,GAAG,CAAC,qCAAqC,EAAEO,QAAQ,CAACO,MAAM,CAAC;MACnE,OAAO;QAAEyC,OAAO,EAAE,KAAK;QAAEtD,KAAK,EAAE,qBAAqBM,QAAQ,CAACO,MAAM;MAAG,CAAC;IAC1E;EACF,CAAC,CAAC,OAAOb,KAAK,EAAE;IACdF,OAAO,CAACE,KAAK,CAAC,iCAAiC,EAAEA,KAAK,CAAC;IACvD,OAAO;MAAEsD,OAAO,EAAE,KAAK;MAAEtD,KAAK,EAAEA,KAAK,YAAYC,KAAK,GAAGD,KAAK,CAACuD,OAAO,GAAG;IAAgB,CAAC;EAC5F;AACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TrainingModal.d.ts","sourceRoot":"","sources":["../../../src/components/TrainingModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAiB3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"TrainingModal.d.ts","sourceRoot":"","sources":["../../../src/components/TrainingModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAiB3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAoQtD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UniversalOnboarding.d.ts","sourceRoot":"","sources":["../../../src/components/UniversalOnboarding.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"UniversalOnboarding.d.ts","sourceRoot":"","sources":["../../../src/components/UniversalOnboarding.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AA2BxE,OAAO,KAAK,EAAE,wBAAwB,EAAoB,MAAM,UAAU,CAAC;AAI3E,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA0lBlE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthWebView.d.ts","sourceRoot":"","sources":["../../../../src/components/onboarding/OAuthWebView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAiBhD,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"OAuthWebView.d.ts","sourceRoot":"","sources":["../../../../src/components/onboarding/OAuthWebView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAiBhD,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAqZpD,CAAC"}
|
|
@@ -2,48 +2,42 @@
|
|
|
2
2
|
* Onairos React Native SDK
|
|
3
3
|
* A React Native implementation for Onairos personalized data integration
|
|
4
4
|
*/
|
|
5
|
-
export { Onairos } from './components/Onairos';
|
|
6
|
-
export { OnairosButton } from './components/OnairosButton';
|
|
7
|
-
export { Overlay } from './components/Overlay';
|
|
8
|
-
export { UniversalOnboarding } from './components/UniversalOnboarding';
|
|
9
|
-
export { Portal, PortalHost } from './utils/Portal';
|
|
10
|
-
export { ConnectorScreen } from './components/screens/ConnectorScreen';
|
|
11
|
-
export { PinCreationScreen } from './components/screens/PinCreationScreen';
|
|
12
|
-
export { LoadingScreen } from './components/screens/LoadingScreen';
|
|
13
|
-
export { OAuthWebView } from './components/onboarding/OAuthWebView';
|
|
14
|
-
export { PlatformConnector } from './components/onboarding/PlatformConnector';
|
|
15
|
-
export { OnboardingHeader } from './components/onboarding/OnboardingHeader';
|
|
16
|
-
export { PinInput } from './components/onboarding/PinInput';
|
|
17
|
-
export { useCredentials } from './hooks/useCredentials';
|
|
18
|
-
export { useConnections } from './hooks/useConnections';
|
|
19
|
-
export { storeCredentials, getCredentials, hasCredentials, deleteCredentials, updateCredentials, generateDeviceUsername, verifyCredentials, } from './utils/secureStorage';
|
|
20
|
-
export { validateCredentials, createAccount, authenticate, refreshToken, getPlatformData, getUserProfile, updatePlatformConnections, } from './utils/onairosApi';
|
|
21
|
-
export { rsaEncrypt, sha256, base64ToBuffer, } from './utils/crypto';
|
|
22
|
-
export { logDebug, logError, isDebugMode, } from './utils/debugHelper';
|
|
23
|
-
export { connectPlatform, disconnectPlatform, initializeOAuthService, cleanupOAuthService, storePlatformConnection, } from './services/oauthService';
|
|
24
5
|
export type { OnairosButtonProps, DataTier, UniversalOnboardingProps, ConnectionStatus, PlatformListProps, PinInputProps, TrainingModalProps, OAuthWebViewProps, PlatformConfig, ApiResponse, CredentialsResult, OverlayProps, BiometricOptions, PinRequirements, } from './types';
|
|
25
6
|
export type { StorageOptions, OnairosCredentials } from './utils/secureStorage';
|
|
26
7
|
export type { OAuthConfig } from './services/oauthService';
|
|
27
8
|
export type { ApiErrorType, ApiError } from './utils/onairosApi';
|
|
28
9
|
export { COLORS, PLATFORMS, API_ENDPOINTS, STORAGE_KEYS, PIN_REQUIREMENTS, DEEP_LINK_CONFIG } from './constants';
|
|
10
|
+
export { storeCredentials, getCredentials, hasCredentials, deleteCredentials, updateCredentials, generateDeviceUsername, verifyCredentials, } from './utils/secureStorage';
|
|
11
|
+
export { validateCredentials, createAccount, authenticate, refreshToken, getPlatformData, getUserProfile, updatePlatformConnections, } from './utils/onairosApi';
|
|
12
|
+
export { rsaEncrypt, sha256, base64ToBuffer, } from './utils/crypto';
|
|
13
|
+
export { logDebug, logError, isDebugMode, } from './utils/debugHelper';
|
|
14
|
+
export { connectPlatform, disconnectPlatform, initializeOAuthService, cleanupOAuthService, storePlatformConnection, } from './services/oauthService';
|
|
29
15
|
export { onairosApi } from './api';
|
|
30
16
|
export { OAuthService } from './services/oauthService';
|
|
31
17
|
export * from './utils/secureStorage';
|
|
32
18
|
export * from './utils/encryption';
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
}
|
|
19
|
+
export { useCredentials } from './hooks/useCredentials';
|
|
20
|
+
export { useConnections } from './hooks/useConnections';
|
|
21
|
+
export { Portal, PortalHost } from './utils/Portal';
|
|
22
|
+
export { ConnectorScreen } from './components/screens/ConnectorScreen';
|
|
23
|
+
export { PinCreationScreen } from './components/screens/PinCreationScreen';
|
|
24
|
+
export { LoadingScreen } from './components/screens/LoadingScreen';
|
|
25
|
+
export { OAuthWebView } from './components/onboarding/OAuthWebView';
|
|
26
|
+
export { PlatformConnector } from './components/onboarding/PlatformConnector';
|
|
27
|
+
export { OnboardingHeader } from './components/onboarding/OnboardingHeader';
|
|
28
|
+
export { PlatformList } from './components/PlatformList';
|
|
29
|
+
export { PinInput } from './components/PinInput';
|
|
30
|
+
export { TrainingModal } from './components/TrainingModal';
|
|
31
|
+
export { Overlay } from './components/Overlay';
|
|
32
|
+
export { UniversalOnboarding } from './components/UniversalOnboarding';
|
|
33
|
+
export { OnairosButton } from './components/OnairosButton';
|
|
34
|
+
export { Onairos } from './components/Onairos';
|
|
39
35
|
declare const components: {
|
|
40
|
-
Onairos:
|
|
41
|
-
OnairosButton:
|
|
42
|
-
OnairosOverlay:
|
|
43
|
-
UniversalOnboarding:
|
|
44
|
-
PortalHost:
|
|
45
|
-
children?: React.ReactNode;
|
|
46
|
-
}>;
|
|
36
|
+
Onairos: any;
|
|
37
|
+
OnairosButton: any;
|
|
38
|
+
OnairosOverlay: any;
|
|
39
|
+
UniversalOnboarding: any;
|
|
40
|
+
PortalHost: any;
|
|
47
41
|
};
|
|
48
42
|
export default components;
|
|
49
43
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../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E,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGpD,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAGnE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAG5E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAW/C,QAAA,MAAM,UAAU;;;;;;CAMf,CAAC;AAGF,eAAe,UAAU,CAAC"}
|
|
@@ -36,4 +36,11 @@ export declare const handleOAuthCallback: (url: string) => string | null;
|
|
|
36
36
|
* @returns True if the URL is an OAuth callback
|
|
37
37
|
*/
|
|
38
38
|
export declare const isOAuthCallback: (url: string) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Test connectivity to the Onairos API server
|
|
41
|
+
*/
|
|
42
|
+
export declare const testApiConnectivity: () => Promise<{
|
|
43
|
+
success: boolean;
|
|
44
|
+
error?: string;
|
|
45
|
+
}>;
|
|
39
46
|
//# sourceMappingURL=platformAuthService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platformAuthService.d.ts","sourceRoot":"","sources":["../../../src/services/platformAuthService.ts"],"names":[],"mappings":"AAyCA;;GAEG;AACH,eAAO,MAAM,YAAY,aAAc,MAAM,KAAG,OAG/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,aAAc,MAAM,KAAG,MAGlD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,aAAc,MAAM,KAAG,MAGnD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,aAAoB,MAAM,YAAY,MAAM,YAAY,MAAM,KAAG,QAAQ,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"platformAuthService.d.ts","sourceRoot":"","sources":["../../../src/services/platformAuthService.ts"],"names":[],"mappings":"AAyCA;;GAEG;AACH,eAAO,MAAM,YAAY,aAAc,MAAM,KAAG,OAG/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,aAAc,MAAM,KAAG,MAGlD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,aAAc,MAAM,KAAG,MAGnD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,aAAoB,MAAM,YAAY,MAAM,YAAY,MAAM,KAAG,QAAQ,MAAM,GAAG,IAAI,CAwH/G,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,aAAoB,MAAM,KAAG,QAAQ,OAAO,CA0D1E,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,QAAS,MAAM,KAAG,MAAM,GAAG,IAW1D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAAS,MAAM,KAAG,OAG7C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAa,QAAQ;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAwBxF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onairos/react-native",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.44",
|
|
4
4
|
"description": "Onairos React Native SDK for social media authentication and AI model training",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
"@types/react": "^18.0.0",
|
|
86
86
|
"@types/react-native": "^0.70.0",
|
|
87
87
|
"@types/react-native-vector-icons": "^6.4.13",
|
|
88
|
+
"@types/socket.io-client": "^3.0.0",
|
|
88
89
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
89
90
|
"del-cli": "^5.1.0",
|
|
90
91
|
"eslint": "^8.4.1",
|
|
@@ -203,9 +203,9 @@ export const OnairosButton = forwardRef<OnairosButtonRef, OnairosButtonProps>(({
|
|
|
203
203
|
}
|
|
204
204
|
} catch (error) {
|
|
205
205
|
console.error('Error during button press flow:', error);
|
|
206
|
-
//
|
|
206
|
+
// Only call onRejection for actual errors, not when user cancels
|
|
207
|
+
// The onboarding component will handle user cancellation separately
|
|
207
208
|
setShowOnboarding(true);
|
|
208
|
-
onRejection?.(error instanceof Error ? error.message : 'Unknown error');
|
|
209
209
|
} finally {
|
|
210
210
|
setIsLoading(false);
|
|
211
211
|
}
|
|
@@ -28,8 +28,6 @@ export const TrainingModal: React.FC<TrainingModalProps> = ({
|
|
|
28
28
|
modelKey,
|
|
29
29
|
username,
|
|
30
30
|
}) => {
|
|
31
|
-
const progressPercentage = Math.round(progress * 100);
|
|
32
|
-
|
|
33
31
|
// Socket and training state
|
|
34
32
|
const socketRef = useRef<Socket | null>(null);
|
|
35
33
|
const [socketConnected, setSocketConnected] = useState(false);
|
|
@@ -38,6 +36,11 @@ export const TrainingModal: React.FC<TrainingModalProps> = ({
|
|
|
38
36
|
const [isTrainingComplete, setIsTrainingComplete] = useState(false);
|
|
39
37
|
const [userTraits, setUserTraits] = useState<any>(null);
|
|
40
38
|
const [inferenceResults, setInferenceResults] = useState<any>(null);
|
|
39
|
+
const [internalProgress, setInternalProgress] = useState(0);
|
|
40
|
+
|
|
41
|
+
// Use internal progress if available, otherwise fall back to prop progress
|
|
42
|
+
const currentProgress = internalProgress > 0 ? internalProgress / 100 : progress;
|
|
43
|
+
const progressPercentage = Math.round(currentProgress * 100);
|
|
41
44
|
|
|
42
45
|
// Mock user data for now - in real implementation this would come from props
|
|
43
46
|
const userToken = 'mock-token'; // TODO: Get from actual auth
|
|
@@ -52,6 +55,7 @@ export const TrainingModal: React.FC<TrainingModalProps> = ({
|
|
|
52
55
|
const startEnochTraining = async (socketId: string) => {
|
|
53
56
|
try {
|
|
54
57
|
setTrainingStatus('Starting training...');
|
|
58
|
+
setInternalProgress(10);
|
|
55
59
|
|
|
56
60
|
if (!userToken) {
|
|
57
61
|
throw new Error('No authentication token available');
|
|
@@ -87,6 +91,7 @@ export const TrainingModal: React.FC<TrainingModalProps> = ({
|
|
|
87
91
|
if (result.success) {
|
|
88
92
|
console.log('🚀 Training Started:', result.message);
|
|
89
93
|
setTrainingStatus('Training model...');
|
|
94
|
+
setInternalProgress(20);
|
|
90
95
|
} else {
|
|
91
96
|
console.error('Training start failed:', result.error);
|
|
92
97
|
setTrainingStatus(`Error: ${result.error}`);
|
|
@@ -97,6 +102,7 @@ export const TrainingModal: React.FC<TrainingModalProps> = ({
|
|
|
97
102
|
// Simulate successful training start
|
|
98
103
|
console.log('🚀 Training Started (simulated)');
|
|
99
104
|
setTrainingStatus('Training model...');
|
|
105
|
+
setInternalProgress(20);
|
|
100
106
|
|
|
101
107
|
} catch (error) {
|
|
102
108
|
console.error('Training start error:', error);
|
|
@@ -139,11 +145,13 @@ export const TrainingModal: React.FC<TrainingModalProps> = ({
|
|
|
139
145
|
socketRef.current.on('trainingCompleted', (data) => {
|
|
140
146
|
console.log('✅ Training Complete:', data);
|
|
141
147
|
setTrainingStatus('Running test inference...');
|
|
148
|
+
setInternalProgress(60);
|
|
142
149
|
});
|
|
143
150
|
|
|
144
151
|
socketRef.current.on('inferenceCompleted', (data) => {
|
|
145
152
|
console.log('🧠 Inference Complete:', data);
|
|
146
153
|
setTrainingStatus('Uploading to S3...');
|
|
154
|
+
setInternalProgress(80);
|
|
147
155
|
setUserTraits(data.traits);
|
|
148
156
|
setInferenceResults(data.inferenceResults);
|
|
149
157
|
});
|
|
@@ -152,6 +160,7 @@ export const TrainingModal: React.FC<TrainingModalProps> = ({
|
|
|
152
160
|
console.log('🎉 All Complete:', data);
|
|
153
161
|
setIsTrainingComplete(true);
|
|
154
162
|
setTrainingStatus('Complete!');
|
|
163
|
+
setInternalProgress(100);
|
|
155
164
|
});
|
|
156
165
|
|
|
157
166
|
socketRef.current.on('trainingUpdate', (data) => {
|
|
@@ -160,6 +169,7 @@ export const TrainingModal: React.FC<TrainingModalProps> = ({
|
|
|
160
169
|
setTrainingStatus(`Error: ${data.error}`);
|
|
161
170
|
setHasError(true);
|
|
162
171
|
} else if (data.progress) {
|
|
172
|
+
setInternalProgress(data.progress);
|
|
163
173
|
setTrainingStatus(data.status || 'Training in progress...');
|
|
164
174
|
}
|
|
165
175
|
});
|
|
@@ -252,7 +262,7 @@ export const TrainingModal: React.FC<TrainingModalProps> = ({
|
|
|
252
262
|
<Text style={styles.cancelButtonText}>Cancel</Text>
|
|
253
263
|
</TouchableOpacity>
|
|
254
264
|
|
|
255
|
-
{(
|
|
265
|
+
{(currentProgress >= 1 || isTrainingComplete) && (
|
|
256
266
|
<TouchableOpacity
|
|
257
267
|
style={styles.completeButton}
|
|
258
268
|
onPress={onComplete}
|
|
@@ -399,10 +409,6 @@ const styles = StyleSheet.create({
|
|
|
399
409
|
onairosLogo: {
|
|
400
410
|
width: 48,
|
|
401
411
|
height: 48,
|
|
402
|
-
borderRadius: 24,
|
|
403
|
-
backgroundColor: COLORS.primary,
|
|
404
|
-
justifyContent: 'center',
|
|
405
|
-
alignItems: 'center',
|
|
406
412
|
},
|
|
407
413
|
errorContainer: {
|
|
408
414
|
flexDirection: 'row',
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
Image,
|
|
16
16
|
Switch,
|
|
17
17
|
Linking,
|
|
18
|
+
Alert,
|
|
18
19
|
} from 'react-native';
|
|
19
20
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
20
21
|
import { PlatformList } from './PlatformList';
|
|
@@ -23,7 +24,7 @@ import { TrainingModal } from './TrainingModal';
|
|
|
23
24
|
import { OAuthWebView } from './onboarding/OAuthWebView';
|
|
24
25
|
import { useConnections } from '../hooks/useConnections';
|
|
25
26
|
import { COLORS, DEEP_LINK_CONFIG } from '../constants';
|
|
26
|
-
import { initiateOAuth, initiateNativeAuth, hasNativeSDK, isOAuthCallback } from '../services/platformAuthService';
|
|
27
|
+
import { initiateOAuth, initiateNativeAuth, hasNativeSDK, isOAuthCallback, testApiConnectivity } from '../services/platformAuthService';
|
|
27
28
|
import type { UniversalOnboardingProps, ConnectionStatus } from '../types';
|
|
28
29
|
|
|
29
30
|
const { height, width } = Dimensions.get('window');
|
|
@@ -55,6 +56,10 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
|
|
|
55
56
|
const [username, setUsername] = useState<string>('Avatar');
|
|
56
57
|
const [isConnectingPlatform, setIsConnectingPlatform] = useState<boolean>(false);
|
|
57
58
|
const [showLoginWebView, setShowLoginWebView] = useState<boolean>(false);
|
|
59
|
+
|
|
60
|
+
// Add refs for cleanup
|
|
61
|
+
const successTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
62
|
+
const isMountedRef = useRef<boolean>(true);
|
|
58
63
|
|
|
59
64
|
const platforms = [
|
|
60
65
|
{ id: 'instagram', name: 'Instagram', icon: require('../assets/images/instagram.png') },
|
|
@@ -72,6 +77,9 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
|
|
|
72
77
|
} = useConnections();
|
|
73
78
|
|
|
74
79
|
useEffect(() => {
|
|
80
|
+
// Set mounted flag
|
|
81
|
+
isMountedRef.current = true;
|
|
82
|
+
|
|
75
83
|
if (visible) {
|
|
76
84
|
loadInitialStatus();
|
|
77
85
|
// Animate in
|
|
@@ -96,12 +104,6 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
|
|
|
96
104
|
}
|
|
97
105
|
});
|
|
98
106
|
|
|
99
|
-
// Return cleanup function
|
|
100
|
-
return () => {
|
|
101
|
-
// Remove event listener using the subscription
|
|
102
|
-
subscription.remove();
|
|
103
|
-
};
|
|
104
|
-
|
|
105
107
|
// Initialize platform toggles
|
|
106
108
|
const initialToggles: { [key: string]: boolean } = {};
|
|
107
109
|
platforms.forEach((platform) => {
|
|
@@ -128,6 +130,12 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
|
|
|
128
130
|
[preferredPlatform]: { userName: `${preferredPlatform}_user`, connected: true }
|
|
129
131
|
}));
|
|
130
132
|
}
|
|
133
|
+
|
|
134
|
+
// Return cleanup function
|
|
135
|
+
return () => {
|
|
136
|
+
// Remove event listener using the subscription
|
|
137
|
+
subscription.remove();
|
|
138
|
+
};
|
|
131
139
|
} else {
|
|
132
140
|
// Animate out
|
|
133
141
|
Animated.timing(slideAnim, {
|
|
@@ -140,13 +148,38 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
|
|
|
140
148
|
}
|
|
141
149
|
}, [visible, preferredPlatform]);
|
|
142
150
|
|
|
151
|
+
// Cleanup effect for unmounting
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
return () => {
|
|
154
|
+
// Set mounted flag to false
|
|
155
|
+
isMountedRef.current = false;
|
|
156
|
+
|
|
157
|
+
// Clear any pending timeouts
|
|
158
|
+
if (successTimeoutRef.current) {
|
|
159
|
+
clearTimeout(successTimeoutRef.current);
|
|
160
|
+
successTimeoutRef.current = null;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}, []);
|
|
164
|
+
|
|
143
165
|
const handleClose = () => {
|
|
166
|
+
// Clear any pending timeouts before closing
|
|
167
|
+
if (successTimeoutRef.current) {
|
|
168
|
+
clearTimeout(successTimeoutRef.current);
|
|
169
|
+
successTimeoutRef.current = null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Set mounted flag to false
|
|
173
|
+
isMountedRef.current = false;
|
|
174
|
+
|
|
144
175
|
// Animate out and then call onClose
|
|
145
176
|
Animated.timing(slideAnim, {
|
|
146
177
|
toValue: height,
|
|
147
178
|
duration: 250,
|
|
148
179
|
useNativeDriver: true,
|
|
149
180
|
}).start(() => {
|
|
181
|
+
// Only call onClose if component is still meant to be mounted
|
|
182
|
+
// This prevents the "User closed onboarding" error
|
|
150
183
|
onClose();
|
|
151
184
|
});
|
|
152
185
|
};
|
|
@@ -161,15 +194,27 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
|
|
|
161
194
|
// Attempt to connect platform
|
|
162
195
|
try {
|
|
163
196
|
setIsConnectingPlatform(true);
|
|
164
|
-
console.log(
|
|
197
|
+
console.log(`🔌 Initiating connection for ${platformId}`);
|
|
198
|
+
|
|
199
|
+
// Test API connectivity first
|
|
200
|
+
console.log('🔍 Testing API connectivity...');
|
|
201
|
+
const connectivityTest = await testApiConnectivity();
|
|
202
|
+
|
|
203
|
+
if (!connectivityTest.success) {
|
|
204
|
+
console.error('❌ API connectivity test failed:', connectivityTest.error);
|
|
205
|
+
Alert.alert('Network Error', `${connectivityTest.error}\n\nPlease check your internet connection and try again.`);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
console.log('✅ API connectivity confirmed');
|
|
165
210
|
|
|
166
211
|
// Check if platform has a native SDK
|
|
167
212
|
if (hasNativeSDK(platformId)) {
|
|
168
|
-
console.log(
|
|
213
|
+
console.log(`📱 Using native SDK for ${platformId}`);
|
|
169
214
|
// Use native SDK for authentication
|
|
170
215
|
const success = await initiateNativeAuth(platformId);
|
|
171
216
|
if (success) {
|
|
172
|
-
console.log(
|
|
217
|
+
console.log(`✅ Native authentication successful for ${platformId}`);
|
|
173
218
|
// Update platform toggle state
|
|
174
219
|
setPlatformToggles(prev => ({
|
|
175
220
|
...prev,
|
|
@@ -183,26 +228,28 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
|
|
|
183
228
|
}));
|
|
184
229
|
}
|
|
185
230
|
} else {
|
|
186
|
-
console.log(
|
|
231
|
+
console.log(`🌐 Initiating OAuth flow for ${platformId}`);
|
|
187
232
|
// Use OAuth flow through proxy server
|
|
188
233
|
const oauthUrl = await initiateOAuth(platformId, username, AppName);
|
|
189
234
|
if (oauthUrl) {
|
|
190
|
-
console.log(
|
|
235
|
+
console.log(`✅ Received OAuth URL for ${platformId}:`, oauthUrl);
|
|
191
236
|
setCurrentPlatform(platformId);
|
|
192
237
|
setOauthUrl(oauthUrl);
|
|
193
238
|
setStep('oauth');
|
|
194
239
|
} else {
|
|
195
|
-
console.error(
|
|
240
|
+
console.error(`❌ No OAuth URL returned for ${platformId}`);
|
|
241
|
+
Alert.alert('Error', 'Failed to get authorization URL for this platform. Please try again.');
|
|
196
242
|
}
|
|
197
243
|
}
|
|
198
244
|
} catch (error) {
|
|
199
|
-
console.error(
|
|
245
|
+
console.error(`❌ Error connecting ${platformId}:`, error);
|
|
246
|
+
Alert.alert('Connection Error', `Failed to connect to ${platformId}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
200
247
|
} finally {
|
|
201
248
|
setIsConnectingPlatform(false);
|
|
202
249
|
}
|
|
203
250
|
} else {
|
|
204
251
|
// Disconnect platform
|
|
205
|
-
console.log(
|
|
252
|
+
console.log(`🔌 Disconnecting ${platformId}`);
|
|
206
253
|
setPlatformToggles(prev => ({
|
|
207
254
|
...prev,
|
|
208
255
|
[platformId]: false
|
|
@@ -215,7 +262,7 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
|
|
|
215
262
|
return newConnections;
|
|
216
263
|
});
|
|
217
264
|
}
|
|
218
|
-
}, [platformToggles, username]);
|
|
265
|
+
}, [platformToggles, username, AppName]);
|
|
219
266
|
|
|
220
267
|
/**
|
|
221
268
|
* Handles OAuth callback URLs
|
|
@@ -352,9 +399,18 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
|
|
|
352
399
|
// Show success screen first
|
|
353
400
|
setStep('success');
|
|
354
401
|
|
|
402
|
+
// Clear any existing timeout
|
|
403
|
+
if (successTimeoutRef.current) {
|
|
404
|
+
clearTimeout(successTimeoutRef.current);
|
|
405
|
+
}
|
|
406
|
+
|
|
355
407
|
// After a delay, proceed to PIN
|
|
356
|
-
setTimeout(() => {
|
|
357
|
-
|
|
408
|
+
successTimeoutRef.current = setTimeout(() => {
|
|
409
|
+
// Only proceed if component is still mounted and visible
|
|
410
|
+
if (isMountedRef.current && visible) {
|
|
411
|
+
setStep('pin');
|
|
412
|
+
}
|
|
413
|
+
successTimeoutRef.current = null;
|
|
358
414
|
}, 3000);
|
|
359
415
|
};
|
|
360
416
|
|