@onairos/react-native 3.0.67 → 3.0.68
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/UniversalOnboarding.js +234 -35
- package/lib/commonjs/components/UniversalOnboarding.js.map +1 -1
- package/lib/commonjs/index.js +13 -54
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/services/platformAuthService.js +12 -1
- package/lib/commonjs/services/platformAuthService.js.map +1 -1
- package/lib/module/components/UniversalOnboarding.js +234 -35
- package/lib/module/components/UniversalOnboarding.js.map +1 -1
- package/lib/module/services/platformAuthService.js +12 -1
- package/lib/module/services/platformAuthService.js.map +1 -1
- package/lib/typescript/components/UniversalOnboarding.d.ts.map +1 -1
- package/lib/typescript/services/platformAuthService.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/UniversalOnboarding.tsx +229 -34
- package/src/services/platformAuthService.ts +12 -1
|
@@ -685,45 +685,240 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
|
|
|
685
685
|
}
|
|
686
686
|
}, [connections, selectedTier, platformToggles, username, AppName, auto, inferenceData, partner]);
|
|
687
687
|
|
|
688
|
-
const handleTrainingComplete = useCallback(() => {
|
|
688
|
+
const handleTrainingComplete = useCallback(async () => {
|
|
689
689
|
console.log('🎉 Training completed successfully');
|
|
690
|
+
console.log('🔍 Auto mode enabled:', auto);
|
|
691
|
+
console.log('🔍 Inference data available:', !!inferenceData);
|
|
690
692
|
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
693
|
+
try {
|
|
694
|
+
if (auto && inferenceData) {
|
|
695
|
+
console.log('🤖 Auto mode: Making API request to get URL and perform inference');
|
|
696
|
+
|
|
697
|
+
// First, get the API URL from backend
|
|
698
|
+
const apiUrlResponse = await fetch('https://api2.onairos.uk/', {
|
|
699
|
+
method: 'POST',
|
|
700
|
+
headers: {
|
|
701
|
+
'Content-Type': 'application/json',
|
|
702
|
+
},
|
|
703
|
+
body: JSON.stringify({
|
|
704
|
+
Info: {
|
|
705
|
+
storage: 'secure',
|
|
706
|
+
appId: AppName,
|
|
707
|
+
confirmations: Object.keys(requestData || {}),
|
|
708
|
+
EncryptedUserPin: pin, // Use the actual PIN from user
|
|
709
|
+
account: email.trim(),
|
|
710
|
+
proofMode: false,
|
|
711
|
+
}
|
|
712
|
+
})
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
if (!apiUrlResponse.ok) {
|
|
716
|
+
throw new Error(`Failed to get API URL: ${apiUrlResponse.status}`);
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
const { apiUrl, token } = await apiUrlResponse.json();
|
|
720
|
+
console.log('✅ Received API URL:', apiUrl);
|
|
721
|
+
console.log('✅ Received token:', token?.substring(0, 20) + '...');
|
|
722
|
+
|
|
723
|
+
// Now make the inference call with the provided data
|
|
724
|
+
const inferenceResponse = await fetch(apiUrl, {
|
|
725
|
+
method: 'POST',
|
|
726
|
+
headers: {
|
|
727
|
+
'Content-Type': 'application/json',
|
|
728
|
+
'Authorization': `Bearer ${token}`,
|
|
729
|
+
},
|
|
730
|
+
body: JSON.stringify({
|
|
731
|
+
...inferenceData,
|
|
732
|
+
userEmail: email.trim(),
|
|
733
|
+
appName: AppName,
|
|
734
|
+
timestamp: new Date().toISOString(),
|
|
735
|
+
})
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
if (!inferenceResponse.ok) {
|
|
739
|
+
throw new Error(`Inference API failed: ${inferenceResponse.status}`);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
const inferenceResults = await inferenceResponse.json();
|
|
743
|
+
console.log('✅ Auto mode inference results:', inferenceResults);
|
|
744
|
+
|
|
745
|
+
// Close the modal first
|
|
746
|
+
handleClose();
|
|
747
|
+
|
|
748
|
+
// Complete onboarding with inference results
|
|
749
|
+
setTimeout(() => {
|
|
750
|
+
onComplete(apiUrl, token, {
|
|
751
|
+
pin,
|
|
752
|
+
connections,
|
|
753
|
+
platformToggles,
|
|
754
|
+
selectedTier,
|
|
755
|
+
tierData: requestData?.[selectedTier],
|
|
756
|
+
sessionSaved: true,
|
|
757
|
+
// Add inference data if auto mode is enabled
|
|
758
|
+
...(auto && inferenceData && { inferenceData }),
|
|
759
|
+
// Add partner info for special partners
|
|
760
|
+
...(partner && { partner: partner === 'couplebible' ? 'CoupleBible' : partner }),
|
|
761
|
+
autoMode: true,
|
|
762
|
+
inferenceResults,
|
|
763
|
+
apiUrl,
|
|
764
|
+
token,
|
|
765
|
+
});
|
|
766
|
+
}, 100);
|
|
767
|
+
|
|
768
|
+
} else {
|
|
769
|
+
console.log('📋 Standard mode: Returning API URL for manual use');
|
|
770
|
+
|
|
771
|
+
// Prepare completion data
|
|
772
|
+
const completionData = {
|
|
773
|
+
pin,
|
|
774
|
+
connections,
|
|
775
|
+
platformToggles,
|
|
776
|
+
selectedTier,
|
|
777
|
+
tierData: requestData?.[selectedTier],
|
|
778
|
+
sessionSaved: true,
|
|
779
|
+
// Add inference data if auto mode is enabled
|
|
780
|
+
...(auto && inferenceData && { inferenceData }),
|
|
781
|
+
// Add partner info for special partners
|
|
782
|
+
...(partner && { partner: partner === 'couplebible' ? 'CoupleBible' : partner }),
|
|
783
|
+
autoMode: false,
|
|
784
|
+
};
|
|
785
|
+
|
|
786
|
+
console.log('Completion data prepared:', completionData);
|
|
787
|
+
|
|
788
|
+
// Close the modal first
|
|
789
|
+
handleClose();
|
|
790
|
+
|
|
791
|
+
// Then call the completion callback
|
|
792
|
+
setTimeout(() => {
|
|
793
|
+
onComplete('https://api2.onairos.uk', 'dummy-token', completionData);
|
|
794
|
+
}, 100);
|
|
795
|
+
}
|
|
796
|
+
} catch (error) {
|
|
797
|
+
console.error('❌ Error in training complete:', error);
|
|
798
|
+
|
|
799
|
+
// Fallback to standard mode
|
|
800
|
+
const completionData = {
|
|
801
|
+
pin,
|
|
802
|
+
connections,
|
|
803
|
+
platformToggles,
|
|
804
|
+
selectedTier,
|
|
805
|
+
tierData: requestData?.[selectedTier],
|
|
806
|
+
sessionSaved: true,
|
|
807
|
+
// Add inference data if auto mode is enabled
|
|
808
|
+
...(auto && inferenceData && { inferenceData }),
|
|
809
|
+
// Add partner info for special partners
|
|
810
|
+
...(partner && { partner: partner === 'couplebible' ? 'CoupleBible' : partner }),
|
|
811
|
+
autoMode: false,
|
|
812
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
813
|
+
};
|
|
814
|
+
|
|
815
|
+
console.log('Fallback completion data:', completionData);
|
|
816
|
+
|
|
817
|
+
// Close the modal first
|
|
818
|
+
handleClose();
|
|
819
|
+
|
|
820
|
+
// Then call the completion callback
|
|
821
|
+
setTimeout(() => {
|
|
822
|
+
onComplete('https://api2.onairos.uk', 'dummy-token', completionData);
|
|
823
|
+
}, 100);
|
|
824
|
+
}
|
|
825
|
+
}, [pin, connections, platformToggles, selectedTier, requestData, auto, inferenceData, partner, handleClose, onComplete, AppName, email]);
|
|
715
826
|
|
|
716
|
-
const handleDataRequestAccept = useCallback(() => {
|
|
827
|
+
const handleDataRequestAccept = useCallback(async () => {
|
|
717
828
|
console.log('Data request accepted for existing user');
|
|
829
|
+
console.log('🔍 Auto mode enabled:', auto);
|
|
830
|
+
console.log('🔍 Inference data available:', !!inferenceData);
|
|
718
831
|
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
832
|
+
try {
|
|
833
|
+
if (auto && inferenceData) {
|
|
834
|
+
console.log('🤖 Auto mode: Making API request to get URL and perform inference');
|
|
835
|
+
|
|
836
|
+
// First, get the API URL from backend
|
|
837
|
+
const apiUrlResponse = await fetch('https://api2.onairos.uk/', {
|
|
838
|
+
method: 'POST',
|
|
839
|
+
headers: {
|
|
840
|
+
'Content-Type': 'application/json',
|
|
841
|
+
},
|
|
842
|
+
body: JSON.stringify({
|
|
843
|
+
Info: {
|
|
844
|
+
storage: 'secure', // or whatever storage type
|
|
845
|
+
appId: AppName,
|
|
846
|
+
confirmations: Object.keys(requestData || {}),
|
|
847
|
+
EncryptedUserPin: 'temp-pin', // This would come from user PIN in real flow
|
|
848
|
+
account: email.trim(),
|
|
849
|
+
proofMode: false,
|
|
850
|
+
}
|
|
851
|
+
})
|
|
852
|
+
});
|
|
853
|
+
|
|
854
|
+
if (!apiUrlResponse.ok) {
|
|
855
|
+
throw new Error(`Failed to get API URL: ${apiUrlResponse.status}`);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
const { apiUrl, token } = await apiUrlResponse.json();
|
|
859
|
+
console.log('✅ Received API URL:', apiUrl);
|
|
860
|
+
console.log('✅ Received token:', token?.substring(0, 20) + '...');
|
|
861
|
+
|
|
862
|
+
// Now make the inference call with the provided data
|
|
863
|
+
const inferenceResponse = await fetch(apiUrl, {
|
|
864
|
+
method: 'POST',
|
|
865
|
+
headers: {
|
|
866
|
+
'Content-Type': 'application/json',
|
|
867
|
+
'Authorization': `Bearer ${token}`,
|
|
868
|
+
},
|
|
869
|
+
body: JSON.stringify({
|
|
870
|
+
...inferenceData,
|
|
871
|
+
userEmail: email.trim(),
|
|
872
|
+
appName: AppName,
|
|
873
|
+
timestamp: new Date().toISOString(),
|
|
874
|
+
})
|
|
875
|
+
});
|
|
876
|
+
|
|
877
|
+
if (!inferenceResponse.ok) {
|
|
878
|
+
throw new Error(`Inference API failed: ${inferenceResponse.status}`);
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
const inferenceResults = await inferenceResponse.json();
|
|
882
|
+
console.log('✅ Auto mode inference results:', inferenceResults);
|
|
883
|
+
|
|
884
|
+
// Complete onboarding with inference results
|
|
885
|
+
onComplete(apiUrl, token, {
|
|
886
|
+
existingAccount: true,
|
|
887
|
+
email: email.trim(),
|
|
888
|
+
dataRequestAccepted: true,
|
|
889
|
+
requestData,
|
|
890
|
+
autoMode: true,
|
|
891
|
+
inferenceResults,
|
|
892
|
+
apiUrl,
|
|
893
|
+
token,
|
|
894
|
+
});
|
|
895
|
+
|
|
896
|
+
} else {
|
|
897
|
+
console.log('📋 Standard mode: Returning API URL for manual use');
|
|
898
|
+
|
|
899
|
+
// Standard mode: just return the API URL
|
|
900
|
+
onComplete('https://api2.onairos.uk', 'existing-session-token', {
|
|
901
|
+
existingAccount: true,
|
|
902
|
+
email: email.trim(),
|
|
903
|
+
dataRequestAccepted: true,
|
|
904
|
+
requestData,
|
|
905
|
+
autoMode: false,
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
} catch (error) {
|
|
909
|
+
console.error('❌ Error in data request accept:', error);
|
|
910
|
+
|
|
911
|
+
// Fallback to standard mode
|
|
912
|
+
onComplete('https://api2.onairos.uk', 'existing-session-token', {
|
|
913
|
+
existingAccount: true,
|
|
914
|
+
email: email.trim(),
|
|
915
|
+
dataRequestAccepted: true,
|
|
916
|
+
requestData,
|
|
917
|
+
autoMode: false,
|
|
918
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
}, [email, onComplete, requestData, auto, inferenceData, AppName]);
|
|
727
922
|
|
|
728
923
|
const handleDataRequestDecline = useCallback(() => {
|
|
729
924
|
console.log('Data request declined');
|
|
@@ -174,6 +174,12 @@ export const initiateOAuth = async (platform: string, username: string, appName?
|
|
|
174
174
|
const data = await response.json();
|
|
175
175
|
console.log(`📥 ${platform} OAuth response data:`, data);
|
|
176
176
|
|
|
177
|
+
// Extra logging for Gmail to help debug
|
|
178
|
+
if (platform === 'email') {
|
|
179
|
+
console.log('🔍 Gmail OAuth response keys:', Object.keys(data));
|
|
180
|
+
console.log('🔍 Gmail OAuth full response:', JSON.stringify(data, null, 2));
|
|
181
|
+
}
|
|
182
|
+
|
|
177
183
|
// Check if the response contains the OAuth URL based on platform
|
|
178
184
|
switch (platform) {
|
|
179
185
|
case 'reddit':
|
|
@@ -186,13 +192,18 @@ export const initiateOAuth = async (platform: string, username: string, appName?
|
|
|
186
192
|
if (data.youtubeURL) return data.youtubeURL;
|
|
187
193
|
break;
|
|
188
194
|
case 'email':
|
|
195
|
+
// Gmail might return under different field names
|
|
189
196
|
if (data.emailURL) return data.emailURL;
|
|
197
|
+
if (data.gmailURL) return data.gmailURL;
|
|
198
|
+
if (data.authUrl) return data.authUrl;
|
|
199
|
+
if (data.url) return data.url;
|
|
190
200
|
break;
|
|
191
201
|
default:
|
|
192
202
|
if (data.url) return data.url;
|
|
193
203
|
break;
|
|
194
204
|
}
|
|
195
205
|
|
|
206
|
+
console.error(`❌ No OAuth URL found in response for ${platform}. Response:`, data);
|
|
196
207
|
throw new Error(`No OAuth URL found in response for ${platform}`);
|
|
197
208
|
} catch (error) {
|
|
198
209
|
console.error(`Error initiating OAuth for ${platform}:`, error);
|
|
@@ -725,7 +736,7 @@ export const verifyEmailCode = async (email: string, code: string, testMode = fa
|
|
|
725
736
|
|
|
726
737
|
// Production mode: Make real API call with proper validation
|
|
727
738
|
try {
|
|
728
|
-
const response = await fetch('https://api2.onairos.uk/email/verify', {
|
|
739
|
+
const response = await fetch('https://api2.onairos.uk/email/verify/confirm', {
|
|
729
740
|
method: 'POST',
|
|
730
741
|
headers: {
|
|
731
742
|
'Content-Type': 'application/json',
|