@onairosofficial/onairos-capacitor 0.1.0 โ 0.1.2
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/CAPACITOR_QUICK_START.md +379 -0
- package/CONNECTORS.md +122 -0
- package/LICENSE +194 -10
- package/OnairosofficialOnairosCapacitor.podspec +13 -0
- package/Package.swift +26 -0
- package/README.md +176 -25
- package/dist/onairos.capacitor.esm.js +1 -0
- package/dist/onairos.capacitor.esm.turbopack.js +1 -0
- package/docs/CAPACITOR_INTEGRATION_GUIDE.md +159 -0
- package/docs/CAPACITOR_MOCK_APP_TESTING.md +213 -0
- package/docs/CAPACITOR_SDK_FIXES_SUMMARY.md +65 -0
- package/docs/CROSS_SDK_PARITY.md +239 -0
- package/docs/DATA_FREQUENCY.md +57 -0
- package/docs/DEVELOPER_SDK_CHANGES.md +532 -0
- package/docs/INCIDENT_ENABLETRAINING_PIN_WEB_8.1.9.md +82 -0
- package/docs/ONAIROS_BUTTON_PROPS.md +152 -0
- package/docs/PLATFORM_APIS.md +559 -0
- package/docs/RAW_MEMORIES_API.md +305 -0
- package/docs/RAW_MEMORIES_SDK_UPDATE.md +54 -0
- package/docs/SDK_PARITY_ROLLUP_2026_04_24_to_05_02.md +96 -0
- package/docs/oldFixes.md +216 -0
- package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosChatGPTNativePlugin.swift +993 -0
- package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosNetflixNativePlugin.swift +33 -0
- package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosSpotifyNativePlugin.swift +1082 -0
- package/onairos.d.ts +656 -0
- package/package.json +188 -37
- package/src/OnairosReconnectButton.jsx +272 -0
- package/src/RSA.jsx +57 -0
- package/src/assets/NewLogo.png +0 -0
- package/src/assets/OnairosNewLogo.png +0 -0
- package/src/assets/chatgpt-icon.png +0 -0
- package/src/assets/fire-horse.png +0 -0
- package/src/assets/fire-horse.transparent.png +0 -0
- package/src/assets/latest-firehorse.png +0 -0
- package/src/assets/perplexity.png +0 -0
- package/src/assets/persona.png +0 -0
- package/src/assets/persona1.png +0 -0
- package/src/assets/persona2.png +0 -0
- package/src/assets/persona3.png +0 -0
- package/src/assets/persona4.png +0 -0
- package/src/assets/persona5.png +0 -0
- package/src/capacitorConnectorCatalog.js +38 -0
- package/src/capacitorOAuthConfig.js +52 -0
- package/src/chatgptHostedImport/index.js +303 -0
- package/src/components/AuthButtons.jsx +48 -0
- package/src/components/ConnectChatGPTModal.jsx +666 -0
- package/src/components/ConnectClaudeModal.jsx +610 -0
- package/src/components/ConnectGeminiModal.jsx +639 -0
- package/src/components/ConnectGrokModal.jsx +701 -0
- package/src/components/ConnectPerplexityModal.jsx +726 -0
- package/src/components/DataExplainerScreen.jsx +349 -0
- package/src/components/DataRequest.js +885 -0
- package/src/components/DataRequest.jsx +1055 -0
- package/src/components/EmailAuth.js +1871 -0
- package/src/components/EmailAuth.jsx +2062 -0
- package/src/components/ExtensionInstallPrompt.jsx +142 -0
- package/src/components/GoogleButton.js +133 -0
- package/src/components/LLMConnectorManager.jsx +201 -0
- package/src/components/LoadingPage.jsx +19 -0
- package/src/components/LoadingScreen.jsx +81 -0
- package/src/components/LunarBirthdate.jsx +96 -0
- package/src/components/LunarLoadingPage.jsx +251 -0
- package/src/components/Notification.jsx +21 -0
- package/src/components/OnairosAppButton.jsx +85 -0
- package/src/components/OnairosSSO.jsx +645 -0
- package/src/components/OnairosTrigger.jsx +61 -0
- package/src/components/PerplexityLogo.jsx +43 -0
- package/src/components/PinSetup.js +200 -0
- package/src/components/PinSetup.jsx +228 -0
- package/src/components/SDK_PIN_INTEGRATION_REQUIRED_CHANGES.md +526 -0
- package/src/components/SdkErrorBoundary.jsx +36 -0
- package/src/components/SecuritySetup.js +81 -0
- package/src/components/SessionUserBar.jsx +83 -0
- package/src/components/SignUp.js +123 -0
- package/src/components/TestTelegramButton.js +53 -0
- package/src/components/TrainingComponent.jsx +200 -0
- package/src/components/TrainingScreen.jsx +897 -0
- package/src/components/UniversalOnboarding.js +306 -0
- package/src/components/UniversalOnboarding.jsx +4837 -0
- package/src/components/ValentineLoadingPage.jsx +502 -0
- package/src/components/ValentineModeSelector.jsx +162 -0
- package/src/components/WelcomeScreen.jsx +435 -0
- package/src/components/WrappedLoadingPage.jsx +205 -0
- package/src/components/connectors/ChatGPTConnector.js +348 -0
- package/src/components/connectors/ChatGPTConnector.jsx +348 -0
- package/src/components/connectors/ClaudeConnector.js +44 -0
- package/src/components/connectors/ClaudeConnector.jsx +44 -0
- package/src/components/connectors/GeminiConnector.js +170 -0
- package/src/components/connectors/GeminiConnector.jsx +170 -0
- package/src/components/connectors/GmailConnector.js +148 -0
- package/src/components/connectors/GmailConnector.jsx +148 -0
- package/src/components/connectors/GrokConnector.js +16 -0
- package/src/components/connectors/GrokConnector.jsx +16 -0
- package/src/components/connectors/HingeConnector.js +419 -0
- package/src/components/connectors/HingeConnector.jsx +419 -0
- package/src/components/connectors/InstagramDataConnector.js +726 -0
- package/src/components/connectors/InstagramDataConnector.jsx +726 -0
- package/src/components/connectors/LinkedInConnector.js +4 -0
- package/src/components/connectors/LinkedInConnector.jsx +296 -0
- package/src/components/connectors/PerplexityConnector.jsx +16 -0
- package/src/components/connectors/PinterestConnector.js +208 -0
- package/src/components/connectors/PinterestConnector.jsx +208 -0
- package/src/components/connectors/README.md +292 -0
- package/src/components/connectors/RedditConnector.js +229 -0
- package/src/components/connectors/RedditConnector.jsx +229 -0
- package/src/components/connectors/SephoraConnector.js +482 -0
- package/src/components/connectors/SephoraConnector.jsx +482 -0
- package/src/components/connectors/TikTokConnector.jsx +430 -0
- package/src/components/connectors/YoutubeConnector.js +361 -0
- package/src/components/connectors/YoutubeConnector.jsx +361 -0
- package/src/components/connectors/index.js +50 -0
- package/src/components/icons.jsx +46 -0
- package/src/components/icons.tsx +21 -0
- package/src/components/ui/PageLayout.jsx +1255 -0
- package/src/components/ui/PrimaryButton.jsx +162 -0
- package/src/components/ui/button.jsx +49 -0
- package/src/components/ui/card.jsx +61 -0
- package/src/components/ui/checkbox.jsx +33 -0
- package/src/components/ui/label.jsx +29 -0
- package/src/components/utils/UpdateConnections.js +45 -0
- package/src/components/utils/oauthHelper.js +97 -0
- package/src/config/api-config.js +138 -0
- package/src/deepLink.jsx +38 -0
- package/src/getPin.js +26 -0
- package/src/icons/Avatar.png +0 -0
- package/src/icons/Sentiment.png +0 -0
- package/src/icons/Trait.png +0 -0
- package/src/iframe/DataRequestPage.jsx +285 -0
- package/src/iframe/OnairosButtonIntegration.md +148 -0
- package/src/iframe/components/Box.jsx +56 -0
- package/src/iframe/components/IndividualConnection.jsx +88 -0
- package/src/iframe/dataRequestHandler.js +714 -0
- package/src/iframe/data_request_iframe.html +27 -0
- package/src/iframe/data_request_page.js +47 -0
- package/src/iframe/icons/Avatar.png +1 -0
- package/src/iframe/icons/Avatar2.png +1 -0
- package/src/iframe/icons/Sentiment.png +1 -0
- package/src/iframe/icons/Trait.png +1 -0
- package/src/iframe/icons/onairos_logo.png +0 -0
- package/src/iframe/utils/api.js +57 -0
- package/src/index.js +274 -0
- package/src/laravel/OnairosVue.vue +410 -0
- package/src/laravel/blade-helpers.js +320 -0
- package/src/laravel/vite-plugin.js +179 -0
- package/src/mobile/MobileDataRequestPage.jsx +233 -0
- package/src/mobile/components/MobileBox.jsx +71 -0
- package/src/mobile/components/MobileIndividualConnection.jsx +51 -0
- package/src/mobile/shims/browser-apis.js +78 -0
- package/src/mobile/shims/lucide-shim.js +85 -0
- package/src/nativeConnectors.js +5 -0
- package/src/newUI/EMAIL_VERIFICATION_API_SCHEMA.md +268 -0
- package/src/newUI/PlatformConnectorsStep.tsx +435 -0
- package/src/newUI/PrimaryButton.tsx +213 -0
- package/src/newUI/SignInStep.tsx +194 -0
- package/src/newUI/VerificationStep.tsx +133 -0
- package/src/newUI/WelcomeScreen.tsx +311 -0
- package/src/newUI/services/connectedAccountsService.js +129 -0
- package/src/onairos.capacitor.jsx +15 -0
- package/src/onairos.core.jsx +133 -0
- package/src/onairos.jsx +14 -0
- package/src/onairos.native.jsx +15 -0
- package/src/onairosButton.jsx +9000 -0
- package/src/overlay/CheckBox.jsx +114 -0
- package/src/overlay/IndividualConnection copy.js +86 -0
- package/src/overlay/IndividualConnection.js +191 -0
- package/src/overlay/IndividualConnectionNew.jsx +157 -0
- package/src/overlay/box.js +84 -0
- package/src/overlay/overlay.js +437 -0
- package/src/styles/onairos-scoped-preflight.css +97 -0
- package/src/styles/sdkCssRegistry.js +20 -0
- package/src/styles/styleLoaderInsertShadow.js +69 -0
- package/src/styles/tailwind.capacitor.css +395 -0
- package/src/styles/tailwind.css +395 -0
- package/src/theme/colors.js +40 -0
- package/src/utils/apiKeyValidation.js +341 -0
- package/src/utils/apiResponseLogger.js +316 -0
- package/src/utils/authHeaders.js +275 -0
- package/src/utils/biometrics.js +26 -0
- package/src/utils/bookmarkletUtils.js +28 -0
- package/src/utils/capacitorDetection.js +278 -0
- package/src/utils/capacitorLLMHelper.js +352 -0
- package/src/utils/capacitorPlugins.js +366 -0
- package/src/utils/crossDomainSSO.js +587 -0
- package/src/utils/deepLinking.js +27 -0
- package/src/utils/devLogger.js +46 -0
- package/src/utils/extensionDetection.js +418 -0
- package/src/utils/extractMemory.js +277 -0
- package/src/utils/framerBrandingOverrides.js +40 -0
- package/src/utils/googleWebClientId.js +55 -0
- package/src/utils/overlayHandler.js +224 -0
- package/src/utils/platformDisconnect.js +309 -0
- package/src/utils/pollTrainingStatus.js +200 -0
- package/src/utils/rawMemoriesAccess.js +211 -0
- package/src/utils/resolveBackendAppId.js +47 -0
- package/src/utils/responseFormatter.js +140 -0
- package/src/utils/sdkDebugStorage.js +113 -0
- package/src/utils/sdkInitialization.js +645 -0
- package/src/utils/sessionManager.js +1258 -0
- package/src/utils/startBackgroundTraining.js +100 -0
- package/src/utils/userDataFormatter.js +222 -0
- package/index.d.ts +0 -1
- package/index.js +0 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Logged-in session strip (email + logout) โ same layout as DataRequestโs header.
|
|
5
|
+
*/
|
|
6
|
+
export default function SessionUserBar({ userEmail, onLogout, theme = 'default' }) {
|
|
7
|
+
if (!userEmail) return null;
|
|
8
|
+
const isGlass = theme === 'glass';
|
|
9
|
+
const shellStyle = {
|
|
10
|
+
padding: '4px 18px 5px',
|
|
11
|
+
borderBottom: `1px solid ${isGlass ? 'rgba(255,255,255,0.10)' : 'rgba(229,231,235,0.55)'}`,
|
|
12
|
+
flexShrink: 0,
|
|
13
|
+
boxSizing: 'border-box',
|
|
14
|
+
};
|
|
15
|
+
const barStyle = {
|
|
16
|
+
minWidth: 0,
|
|
17
|
+
maxWidth: '100%',
|
|
18
|
+
height: 34,
|
|
19
|
+
display: 'flex',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
justifyContent: 'space-between',
|
|
22
|
+
gap: 10,
|
|
23
|
+
padding: '0 10px 0 11px',
|
|
24
|
+
border: 'none',
|
|
25
|
+
background: 'transparent',
|
|
26
|
+
color: isGlass ? 'rgba(255,255,255,0.76)' : '#4B5563',
|
|
27
|
+
fontFamily: 'Inter, IBM Plex Sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
|
|
28
|
+
fontSize: 12,
|
|
29
|
+
lineHeight: '16px',
|
|
30
|
+
};
|
|
31
|
+
const emailStyle = {
|
|
32
|
+
minWidth: 0,
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
overflow: 'hidden',
|
|
36
|
+
fontWeight: 400,
|
|
37
|
+
};
|
|
38
|
+
const emailTextStyle = {
|
|
39
|
+
minWidth: 0,
|
|
40
|
+
overflow: 'hidden',
|
|
41
|
+
textOverflow: 'ellipsis',
|
|
42
|
+
whiteSpace: 'nowrap',
|
|
43
|
+
textDecoration: 'none',
|
|
44
|
+
};
|
|
45
|
+
const logoutStyle = {
|
|
46
|
+
flex: '0 0 auto',
|
|
47
|
+
border: 0,
|
|
48
|
+
background: 'transparent',
|
|
49
|
+
padding: '4px 2px',
|
|
50
|
+
margin: 0,
|
|
51
|
+
color: isGlass ? 'rgba(255,255,255,0.64)' : '#6B7280',
|
|
52
|
+
font: 'inherit',
|
|
53
|
+
fontSize: 12,
|
|
54
|
+
lineHeight: '16px',
|
|
55
|
+
fontWeight: 400,
|
|
56
|
+
cursor: 'pointer',
|
|
57
|
+
textDecoration: 'none',
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
className={`onairos-session-user-bar ${isGlass ? 'onairos-session-user-bar-glass' : ''}`}
|
|
63
|
+
style={shellStyle}
|
|
64
|
+
>
|
|
65
|
+
<div style={barStyle}>
|
|
66
|
+
<div style={emailStyle} title={userEmail}>
|
|
67
|
+
<span style={emailTextStyle}>{userEmail}</span>
|
|
68
|
+
</div>
|
|
69
|
+
{onLogout && (
|
|
70
|
+
<button
|
|
71
|
+
type="button"
|
|
72
|
+
onClick={onLogout}
|
|
73
|
+
className="onairos-session-logout"
|
|
74
|
+
title="Logout"
|
|
75
|
+
style={logoutStyle}
|
|
76
|
+
>
|
|
77
|
+
Log out
|
|
78
|
+
</button>
|
|
79
|
+
)}
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import AuthButtons from './AuthButtons.jsx';
|
|
3
|
+
import { getApiBaseUrl } from '../config/api-config.js';
|
|
4
|
+
|
|
5
|
+
export default function SignUp({ onSignUpSuccess, setOthent, setHashedOthentSub, setEncryptedPin }) {
|
|
6
|
+
const [formData, setFormData] = useState({
|
|
7
|
+
email: '',
|
|
8
|
+
username: '',
|
|
9
|
+
password: '',
|
|
10
|
+
confirmPassword: ''
|
|
11
|
+
});
|
|
12
|
+
const [error, setError] = useState(null);
|
|
13
|
+
|
|
14
|
+
const handleInputChange = (e) => {
|
|
15
|
+
setFormData({
|
|
16
|
+
...formData,
|
|
17
|
+
[e.target.name]: e.target.value
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const handleSubmit = async (e) => {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
|
|
24
|
+
if (formData.password !== formData.confirmPassword) {
|
|
25
|
+
setError("Passwords don't match");
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const response = await fetch(`${getApiBaseUrl()}/signup`, {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
headers: {
|
|
33
|
+
'Content-Type': 'application/json',
|
|
34
|
+
},
|
|
35
|
+
body: JSON.stringify({
|
|
36
|
+
email: formData.email,
|
|
37
|
+
username: formData.username,
|
|
38
|
+
password: formData.password,
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const data = await response.json();
|
|
43
|
+
|
|
44
|
+
if (response.ok) {
|
|
45
|
+
localStorage.setItem('onairosToken', data.token);
|
|
46
|
+
localStorage.setItem('username', formData.username);
|
|
47
|
+
onSignUpSuccess(formData.username);
|
|
48
|
+
} else {
|
|
49
|
+
setError(data.message || 'Sign up failed');
|
|
50
|
+
}
|
|
51
|
+
} catch (error) {
|
|
52
|
+
setError('Sign up failed. Please try again.');
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div className="flex flex-col items-center justify-start max-w-sm mx-auto space-y-6 pt-4">
|
|
58
|
+
{error && (
|
|
59
|
+
<div className="w-full bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg">
|
|
60
|
+
{error}
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
|
|
64
|
+
<AuthButtons
|
|
65
|
+
onLoginSuccess={onSignUpSuccess}
|
|
66
|
+
setOthent={setOthent}
|
|
67
|
+
setHashedOthentSub={setHashedOthentSub}
|
|
68
|
+
setEncryptedPin={setEncryptedPin}
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
<div className="w-full flex items-center justify-center space-x-4">
|
|
72
|
+
<hr className="flex-grow border-gray-300" />
|
|
73
|
+
<span className="text-gray-500">or</span>
|
|
74
|
+
<hr className="flex-grow border-gray-300" />
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<form onSubmit={handleSubmit} className="w-full space-y-4">
|
|
78
|
+
<input
|
|
79
|
+
type="email"
|
|
80
|
+
name="email"
|
|
81
|
+
value={formData.email}
|
|
82
|
+
onChange={handleInputChange}
|
|
83
|
+
placeholder="Email"
|
|
84
|
+
className="w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
85
|
+
required
|
|
86
|
+
/>
|
|
87
|
+
<input
|
|
88
|
+
type="text"
|
|
89
|
+
name="username"
|
|
90
|
+
value={formData.username}
|
|
91
|
+
onChange={handleInputChange}
|
|
92
|
+
placeholder="Username"
|
|
93
|
+
className="w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
94
|
+
required
|
|
95
|
+
/>
|
|
96
|
+
<input
|
|
97
|
+
type="password"
|
|
98
|
+
name="password"
|
|
99
|
+
value={formData.password}
|
|
100
|
+
onChange={handleInputChange}
|
|
101
|
+
placeholder="Password"
|
|
102
|
+
className="w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
103
|
+
required
|
|
104
|
+
/>
|
|
105
|
+
<input
|
|
106
|
+
type="password"
|
|
107
|
+
name="confirmPassword"
|
|
108
|
+
value={formData.confirmPassword}
|
|
109
|
+
onChange={handleInputChange}
|
|
110
|
+
placeholder="Confirm Password"
|
|
111
|
+
className="w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
112
|
+
required
|
|
113
|
+
/>
|
|
114
|
+
<button
|
|
115
|
+
type="submit"
|
|
116
|
+
className="w-full bg-blue-500 text-white font-semibold py-3 px-4 rounded-lg hover:bg-blue-600 transition-colors"
|
|
117
|
+
>
|
|
118
|
+
Sign Up
|
|
119
|
+
</button>
|
|
120
|
+
</form>
|
|
121
|
+
</div>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
export default function TestTelegramButton() {
|
|
4
|
+
const [error, setError] = useState(null);
|
|
5
|
+
const [logs, setLogs] = useState([]);
|
|
6
|
+
|
|
7
|
+
const addLog = (message) => {
|
|
8
|
+
setLogs((prevLogs) => [...prevLogs, message]);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const handleClick = () => {
|
|
12
|
+
try {
|
|
13
|
+
addLog('Opening external browser...');
|
|
14
|
+
const data = { key: 'value' }; // Example data
|
|
15
|
+
const queryString = new URLSearchParams(data).toString();
|
|
16
|
+
const testUrl = `https://internship.onairos.uk/auth?${queryString}`;
|
|
17
|
+
// const testUrl = `https://onairos.uk/auth?${queryString}`;
|
|
18
|
+
|
|
19
|
+
// Use standard JavaScript to open the link in a new tab
|
|
20
|
+
window.open(testUrl, '_blank');
|
|
21
|
+
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error('Failed to open link:', error);
|
|
24
|
+
addLog(`Failed to open link: ${error.message}`);
|
|
25
|
+
setError(`Failed to open link: ${error.message}`);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div className="flex flex-col items-center p-4">
|
|
31
|
+
<button
|
|
32
|
+
onClick={handleClick}
|
|
33
|
+
className="flex flex-col items-center justify-center px-4 py-2 border border-gray-300 rounded-full shadow-sm bg-white hover:bg-gray-50"
|
|
34
|
+
>
|
|
35
|
+
<div className="relative">
|
|
36
|
+
<img
|
|
37
|
+
src="google-icon.png"
|
|
38
|
+
alt="Google"
|
|
39
|
+
className="w-10 h-10 rounded-full"
|
|
40
|
+
/>
|
|
41
|
+
<svg
|
|
42
|
+
className="absolute bottom-0 right-0 w-4 h-4"
|
|
43
|
+
fill="currentColor"
|
|
44
|
+
viewBox="0 0 20 20"
|
|
45
|
+
>
|
|
46
|
+
<path d="M10 3a1 1 0 011 1v6h6a1 1 0 110 2h-6v6a1 1 0 11-2 0v-6H3a1 1 0 110-2h6V4a1 1 0 011-1z" />
|
|
47
|
+
</svg>
|
|
48
|
+
</div>
|
|
49
|
+
<span className="text-gray-700 mt-2">Google</span>
|
|
50
|
+
</button>
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { COLORS } from '../theme/colors.js';
|
|
3
|
+
|
|
4
|
+
export default function TrainingComponent({ onComplete, userEmail, appName = 'App', testMode = false }) {
|
|
5
|
+
const [currentStep, setCurrentStep] = useState(0);
|
|
6
|
+
const [progress, setProgress] = useState(0);
|
|
7
|
+
const [isComplete, setIsComplete] = useState(false);
|
|
8
|
+
|
|
9
|
+
const steps = [
|
|
10
|
+
{
|
|
11
|
+
title: 'Setting up your personal AI',
|
|
12
|
+
description: 'Initializing your secure data model',
|
|
13
|
+
icon: '๐ค',
|
|
14
|
+
duration: testMode ? 800 : 2000 // Much faster in test mode
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
title: 'Processing your connections',
|
|
18
|
+
description: 'Analyzing your social media patterns',
|
|
19
|
+
icon: '๐',
|
|
20
|
+
duration: testMode ? 600 : 2500
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
title: 'Training your model',
|
|
24
|
+
description: 'Building your personalized insights',
|
|
25
|
+
icon: '๐ง ',
|
|
26
|
+
duration: testMode ? 700 : 3000
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
title: 'Finalizing setup',
|
|
30
|
+
description: 'Preparing your Onairos experience',
|
|
31
|
+
icon: 'โจ',
|
|
32
|
+
duration: testMode ? 500 : 2000
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
let interval;
|
|
38
|
+
let stepTimeout;
|
|
39
|
+
|
|
40
|
+
if (currentStep < steps.length) {
|
|
41
|
+
const stepDuration = steps[currentStep].duration;
|
|
42
|
+
const stepProgress = 100 / steps.length;
|
|
43
|
+
|
|
44
|
+
// Update progress gradually
|
|
45
|
+
interval = setInterval(() => {
|
|
46
|
+
setProgress(prev => {
|
|
47
|
+
const newProgress = prev + (stepProgress / (stepDuration / 100));
|
|
48
|
+
return Math.min(newProgress, (currentStep + 1) * stepProgress);
|
|
49
|
+
});
|
|
50
|
+
}, 100);
|
|
51
|
+
|
|
52
|
+
// Move to next step after duration
|
|
53
|
+
stepTimeout = setTimeout(() => {
|
|
54
|
+
if (currentStep < steps.length - 1) {
|
|
55
|
+
setCurrentStep(prev => prev + 1);
|
|
56
|
+
} else {
|
|
57
|
+
setIsComplete(true);
|
|
58
|
+
const completionDelay = testMode ? 400 : 1000; // Faster completion in test mode
|
|
59
|
+
|
|
60
|
+
if (testMode) {
|
|
61
|
+
console.log('๐งช Test mode: Training simulation completed');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
onComplete({
|
|
66
|
+
trainingComplete: true,
|
|
67
|
+
timestamp: new Date().toISOString(),
|
|
68
|
+
userEmail: userEmail,
|
|
69
|
+
appName: appName,
|
|
70
|
+
testMode: testMode,
|
|
71
|
+
simulatedTraining: testMode
|
|
72
|
+
});
|
|
73
|
+
}, completionDelay);
|
|
74
|
+
}
|
|
75
|
+
}, stepDuration);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return () => {
|
|
79
|
+
if (interval) clearInterval(interval);
|
|
80
|
+
if (stepTimeout) clearTimeout(stepTimeout);
|
|
81
|
+
};
|
|
82
|
+
}, [currentStep, onComplete, userEmail, appName]);
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<div className="w-full flex flex-col items-center space-y-8">
|
|
86
|
+
<div className="text-center">
|
|
87
|
+
<div
|
|
88
|
+
className="w-20 h-20 rounded-full flex items-center justify-center mx-auto mb-4"
|
|
89
|
+
style={{
|
|
90
|
+
background: `linear-gradient(135deg, ${COLORS.info}, #8B5CF6)`
|
|
91
|
+
}}
|
|
92
|
+
>
|
|
93
|
+
<div className="text-3xl">
|
|
94
|
+
{isComplete ? '๐' : steps[currentStep]?.icon}
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
<h2
|
|
98
|
+
className="text-2xl font-bold mb-2"
|
|
99
|
+
style={{ color: COLORS.textPrimary }}
|
|
100
|
+
>
|
|
101
|
+
{isComplete ? 'All set!' : steps[currentStep]?.title}
|
|
102
|
+
</h2>
|
|
103
|
+
<p style={{ color: COLORS.textSecondary }}>
|
|
104
|
+
{isComplete
|
|
105
|
+
? 'Your personal AI is ready to use'
|
|
106
|
+
: steps[currentStep]?.description
|
|
107
|
+
}
|
|
108
|
+
</p>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
{/* Progress Bar */}
|
|
112
|
+
<div className="w-full">
|
|
113
|
+
<div
|
|
114
|
+
className="flex justify-between text-sm mb-2"
|
|
115
|
+
style={{ color: COLORS.textSecondary }}
|
|
116
|
+
>
|
|
117
|
+
<span>Progress</span>
|
|
118
|
+
<span>{Math.round(progress)}%</span>
|
|
119
|
+
</div>
|
|
120
|
+
<div
|
|
121
|
+
className="w-full rounded-full h-2"
|
|
122
|
+
style={{ backgroundColor: COLORS.borderLight }}
|
|
123
|
+
>
|
|
124
|
+
<div
|
|
125
|
+
className="h-2 rounded-full transition-all duration-300 ease-out"
|
|
126
|
+
style={{
|
|
127
|
+
width: `${progress}%`,
|
|
128
|
+
background: `linear-gradient(90deg, ${COLORS.info}, #8B5CF6)`
|
|
129
|
+
}}
|
|
130
|
+
/>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
{/* Steps Indicator */}
|
|
135
|
+
<div className="flex justify-center space-x-2">
|
|
136
|
+
{steps.map((_, index) => (
|
|
137
|
+
<div
|
|
138
|
+
key={index}
|
|
139
|
+
className="w-3 h-3 rounded-full transition-all duration-300"
|
|
140
|
+
style={{
|
|
141
|
+
backgroundColor: index <= currentStep ? COLORS.info : COLORS.border
|
|
142
|
+
}}
|
|
143
|
+
/>
|
|
144
|
+
))}
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
{/* Current Step Details */}
|
|
148
|
+
<div
|
|
149
|
+
className="p-4 rounded-lg w-full"
|
|
150
|
+
style={{ backgroundColor: COLORS.backgroundSecondary }}
|
|
151
|
+
>
|
|
152
|
+
<div className="flex items-center space-x-3">
|
|
153
|
+
<div
|
|
154
|
+
className="w-8 h-8 rounded-full flex items-center justify-center"
|
|
155
|
+
style={{ backgroundColor: '#DBEAFE' }}
|
|
156
|
+
>
|
|
157
|
+
<div className="text-sm">
|
|
158
|
+
{isComplete ? 'โ
' : steps[currentStep]?.icon}
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
<div>
|
|
162
|
+
<h3
|
|
163
|
+
className="font-medium"
|
|
164
|
+
style={{ color: COLORS.textPrimary }}
|
|
165
|
+
>
|
|
166
|
+
{isComplete ? 'Training Complete' : `Step ${currentStep + 1} of ${steps.length}`}
|
|
167
|
+
</h3>
|
|
168
|
+
<p
|
|
169
|
+
className="text-sm"
|
|
170
|
+
style={{ color: COLORS.textSecondary }}
|
|
171
|
+
>
|
|
172
|
+
{isComplete
|
|
173
|
+
? 'Your Onairos experience is ready'
|
|
174
|
+
: steps[currentStep]?.description
|
|
175
|
+
}
|
|
176
|
+
</p>
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
{/* App Info */}
|
|
182
|
+
<div className="text-center">
|
|
183
|
+
<p
|
|
184
|
+
className="text-sm"
|
|
185
|
+
style={{ color: COLORS.textSecondary }}
|
|
186
|
+
>
|
|
187
|
+
Setting up for <span className="font-medium">{appName}</span>
|
|
188
|
+
</p>
|
|
189
|
+
{userEmail && (
|
|
190
|
+
<p
|
|
191
|
+
className="text-xs mt-1"
|
|
192
|
+
style={{ color: COLORS.textMuted }}
|
|
193
|
+
>
|
|
194
|
+
{userEmail}
|
|
195
|
+
</p>
|
|
196
|
+
)}
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
);
|
|
200
|
+
}
|