@onairos/react-native 3.0.49 → 3.0.51

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.
Files changed (34) hide show
  1. package/lib/commonjs/components/EmailVerificationModal.js +317 -0
  2. package/lib/commonjs/components/EmailVerificationModal.js.map +1 -0
  3. package/lib/commonjs/components/TrainingModal.js +66 -75
  4. package/lib/commonjs/components/TrainingModal.js.map +1 -1
  5. package/lib/commonjs/components/UniversalOnboarding.js +30 -5
  6. package/lib/commonjs/components/UniversalOnboarding.js.map +1 -1
  7. package/lib/commonjs/index.js +60 -2
  8. package/lib/commonjs/index.js.map +1 -1
  9. package/lib/commonjs/services/platformAuthService.js +505 -53
  10. package/lib/commonjs/services/platformAuthService.js.map +1 -1
  11. package/lib/module/components/EmailVerificationModal.js +308 -0
  12. package/lib/module/components/EmailVerificationModal.js.map +1 -0
  13. package/lib/module/components/TrainingModal.js +66 -75
  14. package/lib/module/components/TrainingModal.js.map +1 -1
  15. package/lib/module/components/UniversalOnboarding.js +31 -6
  16. package/lib/module/components/UniversalOnboarding.js.map +1 -1
  17. package/lib/module/index.js +3 -1
  18. package/lib/module/index.js.map +1 -1
  19. package/lib/module/services/platformAuthService.js +496 -52
  20. package/lib/module/services/platformAuthService.js.map +1 -1
  21. package/lib/typescript/components/EmailVerificationModal.d.ts +10 -0
  22. package/lib/typescript/components/EmailVerificationModal.d.ts.map +1 -0
  23. package/lib/typescript/components/TrainingModal.d.ts.map +1 -1
  24. package/lib/typescript/components/UniversalOnboarding.d.ts.map +1 -1
  25. package/lib/typescript/index.d.ts +4 -1
  26. package/lib/typescript/index.d.ts.map +1 -1
  27. package/lib/typescript/services/platformAuthService.d.ts +57 -1
  28. package/lib/typescript/services/platformAuthService.d.ts.map +1 -1
  29. package/package.json +2 -1
  30. package/src/components/EmailVerificationModal.tsx +356 -0
  31. package/src/components/TrainingModal.tsx +69 -73
  32. package/src/components/UniversalOnboarding.tsx +31 -6
  33. package/src/index.ts +14 -1
  34. package/src/services/platformAuthService.ts +527 -55
@@ -24,7 +24,7 @@ import { TrainingModal } from './TrainingModal';
24
24
  import { OAuthWebView } from './onboarding/OAuthWebView';
25
25
  import { useConnections } from '../hooks/useConnections';
26
26
  import { COLORS, DEEP_LINK_CONFIG } from '../constants';
27
- import { initiateOAuth, initiateNativeAuth, hasNativeSDK, isOAuthCallback, testApiConnectivity } from '../services/platformAuthService';
27
+ import { initiateOAuth, initiateNativeAuth, hasNativeSDK, isOAuthCallback, testApiConnectivity, handleOAuthCallbackUrl, refreshYouTubeTokens, requestEmailVerification, verifyEmailCode, checkEmailVerificationStatus, disconnectPlatform } from '../services/platformAuthService';
28
28
  import type { UniversalOnboardingProps, ConnectionStatus } from '../types';
29
29
  import {
30
30
  init as opacityInit,
@@ -278,7 +278,7 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
278
278
  if (hasNativeSDK(platformId)) {
279
279
  console.log(`📱 Using native SDK for ${platformId}`);
280
280
  // Use native SDK for authentication
281
- const success = await initiateNativeAuth(platformId);
281
+ const success = await initiateNativeAuth(platformId, username);
282
282
  if (success) {
283
283
  console.log(`✅ Native authentication successful for ${platformId}`);
284
284
  // Update platform toggle state
@@ -360,10 +360,35 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
360
360
  * Handles OAuth callback URLs
361
361
  */
362
362
  const handleOAuthCallback = useCallback((url: string) => {
363
- console.log('OAuth callback received:', url);
364
- // Handle the OAuth callback here
365
- // This would typically extract the authorization code and complete the OAuth flow
366
- }, []);
363
+ console.log('🔗 OAuth callback received:', url);
364
+
365
+ const result = handleOAuthCallbackUrl(url);
366
+
367
+ if (result.success && result.platform && result.code) {
368
+ console.log(`✅ OAuth successful for ${result.platform}`);
369
+
370
+ // Update connections state
371
+ setConnections(prev => ({
372
+ ...prev,
373
+ [result.platform!]: { userName: username, connected: true }
374
+ }));
375
+
376
+ // Update platform toggles
377
+ setPlatformToggles(prev => ({
378
+ ...prev,
379
+ [result.platform!]: true
380
+ }));
381
+
382
+ // Close OAuth window and return to connect step
383
+ setOauthUrl('');
384
+ setCurrentPlatform('');
385
+ setStep('connect');
386
+
387
+ console.log(`🎉 ${result.platform} successfully connected via OAuth`);
388
+ } else {
389
+ console.error('❌ OAuth callback failed or incomplete');
390
+ }
391
+ }, [username]);
367
392
 
368
393
  /**
369
394
  * Handles completion of the OAuth flow
package/src/index.ts CHANGED
@@ -21,6 +21,8 @@ export type {
21
21
  PinRequirements,
22
22
  } from './types';
23
23
 
24
+ export type { EmailVerificationModalProps } from './components/EmailVerificationModal';
25
+
24
26
  export type { StorageOptions, OnairosCredentials } from './utils/secureStorage';
25
27
  export type { OAuthConfig } from './services/oauthService';
26
28
  export type { ApiErrorType, ApiError } from './utils/onairosApi';
@@ -64,12 +66,22 @@ export {
64
66
  // Export services
65
67
  export {
66
68
  connectPlatform,
67
- disconnectPlatform,
68
69
  initializeOAuthService,
69
70
  cleanupOAuthService,
70
71
  storePlatformConnection,
71
72
  } from './services/oauthService';
72
73
 
74
+ export {
75
+ updateGoogleClientIds,
76
+ refreshYouTubeTokens,
77
+ hasNativeSDK,
78
+ testApiConnectivity,
79
+ requestEmailVerification,
80
+ verifyEmailCode,
81
+ checkEmailVerificationStatus,
82
+ disconnectPlatform,
83
+ } from './services/platformAuthService';
84
+
73
85
  // Export API and Services
74
86
  export { onairosApi } from './api';
75
87
  export { OAuthService } from './services/oauthService';
@@ -97,6 +109,7 @@ export { OnboardingHeader } from './components/onboarding/OnboardingHeader';
97
109
  export { PlatformList } from './components/PlatformList';
98
110
  export { PinInput } from './components/PinInput';
99
111
  export { TrainingModal } from './components/TrainingModal';
112
+ export { EmailVerificationModal } from './components/EmailVerificationModal';
100
113
  export { Overlay } from './components/Overlay';
101
114
  export { UniversalOnboarding } from './components/UniversalOnboarding';
102
115
  export { OnairosButton } from './components/OnairosButton';