@onairosofficial/onairos-capacitor 0.1.0 → 0.1.1

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 (181) hide show
  1. package/LICENSE +194 -10
  2. package/README.md +182 -25
  3. package/dist/onairos.capacitor.esm.js +1 -0
  4. package/dist/onairos.capacitor.esm.turbopack.js +1 -0
  5. package/onairos.d.ts +656 -0
  6. package/package.json +186 -38
  7. package/src/OnairosReconnectButton.jsx +272 -0
  8. package/src/RSA.jsx +57 -0
  9. package/src/assets/NewLogo.png +0 -0
  10. package/src/assets/OnairosNewLogo.png +0 -0
  11. package/src/assets/chatgpt-icon.png +0 -0
  12. package/src/assets/fire-horse.png +0 -0
  13. package/src/assets/fire-horse.transparent.png +0 -0
  14. package/src/assets/latest-firehorse.png +0 -0
  15. package/src/assets/perplexity.png +0 -0
  16. package/src/assets/persona.png +0 -0
  17. package/src/assets/persona1.png +0 -0
  18. package/src/assets/persona2.png +0 -0
  19. package/src/assets/persona3.png +0 -0
  20. package/src/assets/persona4.png +0 -0
  21. package/src/assets/persona5.png +0 -0
  22. package/src/capacitorConnectorCatalog.js +38 -0
  23. package/src/capacitorOAuthConfig.js +52 -0
  24. package/src/chatgptHostedImport/index.js +303 -0
  25. package/src/components/AuthButtons.jsx +48 -0
  26. package/src/components/ConnectChatGPTModal.jsx +666 -0
  27. package/src/components/ConnectClaudeModal.jsx +610 -0
  28. package/src/components/ConnectGeminiModal.jsx +639 -0
  29. package/src/components/ConnectGrokModal.jsx +701 -0
  30. package/src/components/ConnectPerplexityModal.jsx +726 -0
  31. package/src/components/DataExplainerScreen.jsx +349 -0
  32. package/src/components/DataRequest.js +885 -0
  33. package/src/components/DataRequest.jsx +1055 -0
  34. package/src/components/EmailAuth.js +1871 -0
  35. package/src/components/EmailAuth.jsx +2062 -0
  36. package/src/components/ExtensionInstallPrompt.jsx +142 -0
  37. package/src/components/GoogleButton.js +133 -0
  38. package/src/components/LLMConnectorManager.jsx +201 -0
  39. package/src/components/LoadingPage.jsx +19 -0
  40. package/src/components/LoadingScreen.jsx +81 -0
  41. package/src/components/LunarBirthdate.jsx +96 -0
  42. package/src/components/LunarLoadingPage.jsx +251 -0
  43. package/src/components/Notification.jsx +21 -0
  44. package/src/components/OnairosAppButton.jsx +85 -0
  45. package/src/components/OnairosSSO.jsx +645 -0
  46. package/src/components/OnairosTrigger.jsx +61 -0
  47. package/src/components/PerplexityLogo.jsx +43 -0
  48. package/src/components/PinSetup.js +200 -0
  49. package/src/components/PinSetup.jsx +228 -0
  50. package/src/components/SDK_PIN_INTEGRATION_REQUIRED_CHANGES.md +526 -0
  51. package/src/components/SdkErrorBoundary.jsx +36 -0
  52. package/src/components/SecuritySetup.js +81 -0
  53. package/src/components/SessionUserBar.jsx +83 -0
  54. package/src/components/SignUp.js +123 -0
  55. package/src/components/TestTelegramButton.js +53 -0
  56. package/src/components/TrainingComponent.jsx +200 -0
  57. package/src/components/TrainingScreen.jsx +897 -0
  58. package/src/components/UniversalOnboarding.js +306 -0
  59. package/src/components/UniversalOnboarding.jsx +4837 -0
  60. package/src/components/ValentineLoadingPage.jsx +502 -0
  61. package/src/components/ValentineModeSelector.jsx +162 -0
  62. package/src/components/WelcomeScreen.jsx +435 -0
  63. package/src/components/WrappedLoadingPage.jsx +205 -0
  64. package/src/components/connectors/ChatGPTConnector.js +348 -0
  65. package/src/components/connectors/ChatGPTConnector.jsx +348 -0
  66. package/src/components/connectors/ClaudeConnector.js +44 -0
  67. package/src/components/connectors/ClaudeConnector.jsx +44 -0
  68. package/src/components/connectors/GeminiConnector.js +170 -0
  69. package/src/components/connectors/GeminiConnector.jsx +170 -0
  70. package/src/components/connectors/GmailConnector.js +148 -0
  71. package/src/components/connectors/GmailConnector.jsx +148 -0
  72. package/src/components/connectors/GrokConnector.js +16 -0
  73. package/src/components/connectors/GrokConnector.jsx +16 -0
  74. package/src/components/connectors/HingeConnector.js +419 -0
  75. package/src/components/connectors/HingeConnector.jsx +419 -0
  76. package/src/components/connectors/InstagramDataConnector.js +726 -0
  77. package/src/components/connectors/InstagramDataConnector.jsx +726 -0
  78. package/src/components/connectors/LinkedInConnector.js +4 -0
  79. package/src/components/connectors/LinkedInConnector.jsx +296 -0
  80. package/src/components/connectors/PerplexityConnector.jsx +16 -0
  81. package/src/components/connectors/PinterestConnector.js +208 -0
  82. package/src/components/connectors/PinterestConnector.jsx +208 -0
  83. package/src/components/connectors/README.md +292 -0
  84. package/src/components/connectors/RedditConnector.js +229 -0
  85. package/src/components/connectors/RedditConnector.jsx +229 -0
  86. package/src/components/connectors/SephoraConnector.js +482 -0
  87. package/src/components/connectors/SephoraConnector.jsx +482 -0
  88. package/src/components/connectors/TikTokConnector.jsx +430 -0
  89. package/src/components/connectors/YoutubeConnector.js +361 -0
  90. package/src/components/connectors/YoutubeConnector.jsx +361 -0
  91. package/src/components/connectors/index.js +50 -0
  92. package/src/components/icons.jsx +46 -0
  93. package/src/components/icons.tsx +21 -0
  94. package/src/components/ui/PageLayout.jsx +1255 -0
  95. package/src/components/ui/PrimaryButton.jsx +162 -0
  96. package/src/components/ui/button.jsx +49 -0
  97. package/src/components/ui/card.jsx +61 -0
  98. package/src/components/ui/checkbox.jsx +33 -0
  99. package/src/components/ui/label.jsx +29 -0
  100. package/src/components/utils/UpdateConnections.js +45 -0
  101. package/src/components/utils/oauthHelper.js +97 -0
  102. package/src/config/api-config.js +138 -0
  103. package/src/deepLink.jsx +38 -0
  104. package/src/getPin.js +26 -0
  105. package/src/icons/Avatar.png +0 -0
  106. package/src/icons/Sentiment.png +0 -0
  107. package/src/icons/Trait.png +0 -0
  108. package/src/iframe/DataRequestPage.jsx +285 -0
  109. package/src/iframe/OnairosButtonIntegration.md +148 -0
  110. package/src/iframe/components/Box.jsx +56 -0
  111. package/src/iframe/components/IndividualConnection.jsx +88 -0
  112. package/src/iframe/dataRequestHandler.js +714 -0
  113. package/src/iframe/data_request_iframe.html +27 -0
  114. package/src/iframe/data_request_page.js +47 -0
  115. package/src/iframe/icons/Avatar.png +1 -0
  116. package/src/iframe/icons/Avatar2.png +1 -0
  117. package/src/iframe/icons/Sentiment.png +1 -0
  118. package/src/iframe/icons/Trait.png +1 -0
  119. package/src/iframe/icons/onairos_logo.png +0 -0
  120. package/src/iframe/utils/api.js +57 -0
  121. package/src/index.js +274 -0
  122. package/src/laravel/OnairosVue.vue +410 -0
  123. package/src/laravel/blade-helpers.js +320 -0
  124. package/src/laravel/vite-plugin.js +179 -0
  125. package/src/mobile/MobileDataRequestPage.jsx +233 -0
  126. package/src/mobile/components/MobileBox.jsx +71 -0
  127. package/src/mobile/components/MobileIndividualConnection.jsx +51 -0
  128. package/src/mobile/shims/browser-apis.js +78 -0
  129. package/src/mobile/shims/lucide-shim.js +85 -0
  130. package/src/newUI/EMAIL_VERIFICATION_API_SCHEMA.md +268 -0
  131. package/src/newUI/PlatformConnectorsStep.tsx +435 -0
  132. package/src/newUI/PrimaryButton.tsx +213 -0
  133. package/src/newUI/SignInStep.tsx +194 -0
  134. package/src/newUI/VerificationStep.tsx +133 -0
  135. package/src/newUI/WelcomeScreen.tsx +311 -0
  136. package/src/newUI/services/connectedAccountsService.js +129 -0
  137. package/src/onairos.capacitor.jsx +16 -0
  138. package/src/onairos.core.jsx +133 -0
  139. package/src/onairos.jsx +14 -0
  140. package/src/onairos.native.jsx +15 -0
  141. package/src/onairosButton.jsx +9000 -0
  142. package/src/overlay/CheckBox.jsx +114 -0
  143. package/src/overlay/IndividualConnection copy.js +86 -0
  144. package/src/overlay/IndividualConnection.js +191 -0
  145. package/src/overlay/IndividualConnectionNew.jsx +157 -0
  146. package/src/overlay/box.js +84 -0
  147. package/src/overlay/overlay.js +437 -0
  148. package/src/styles/onairos-scoped-preflight.css +97 -0
  149. package/src/styles/sdkCssRegistry.js +20 -0
  150. package/src/styles/styleLoaderInsertShadow.js +69 -0
  151. package/src/styles/tailwind.capacitor.css +395 -0
  152. package/src/styles/tailwind.css +395 -0
  153. package/src/theme/colors.js +40 -0
  154. package/src/utils/apiKeyValidation.js +341 -0
  155. package/src/utils/apiResponseLogger.js +316 -0
  156. package/src/utils/authHeaders.js +275 -0
  157. package/src/utils/biometrics.js +26 -0
  158. package/src/utils/bookmarkletUtils.js +28 -0
  159. package/src/utils/capacitorDetection.js +278 -0
  160. package/src/utils/capacitorLLMHelper.js +352 -0
  161. package/src/utils/capacitorPlugins.js +366 -0
  162. package/src/utils/crossDomainSSO.js +587 -0
  163. package/src/utils/deepLinking.js +27 -0
  164. package/src/utils/devLogger.js +46 -0
  165. package/src/utils/extensionDetection.js +418 -0
  166. package/src/utils/extractMemory.js +277 -0
  167. package/src/utils/framerBrandingOverrides.js +40 -0
  168. package/src/utils/googleWebClientId.js +55 -0
  169. package/src/utils/overlayHandler.js +224 -0
  170. package/src/utils/platformDisconnect.js +309 -0
  171. package/src/utils/pollTrainingStatus.js +200 -0
  172. package/src/utils/rawMemoriesAccess.js +211 -0
  173. package/src/utils/resolveBackendAppId.js +47 -0
  174. package/src/utils/responseFormatter.js +140 -0
  175. package/src/utils/sdkDebugStorage.js +113 -0
  176. package/src/utils/sdkInitialization.js +645 -0
  177. package/src/utils/sessionManager.js +1258 -0
  178. package/src/utils/startBackgroundTraining.js +100 -0
  179. package/src/utils/userDataFormatter.js +222 -0
  180. package/index.d.ts +0 -1
  181. package/index.js +0 -1
@@ -0,0 +1,348 @@
1
+ import React, { Component } from 'react';
2
+ import { useLLMConnectorManager } from '../LLMConnectorManager';
3
+ import { getCapacitorPlugin, isCapacitorNativePlatform } from '../../utils/capacitorPlugins.js';
4
+
5
+ class ChatGPTConnector extends Component {
6
+ constructor(props) {
7
+ super(props);
8
+ this.state = {
9
+ connected: false,
10
+ open: false,
11
+ isConnecting: false,
12
+ };
13
+ this.handleClose = this.handleClose.bind(this);
14
+ this.handleOpen = this.handleOpen.bind(this);
15
+ this.chatGPTConnect = this.chatGPTConnect.bind(this);
16
+ this.setConnected = this.setConnected.bind(this);
17
+ this.setDisconnected = this.setDisconnected.bind(this);
18
+ }
19
+
20
+ setConnected() {
21
+ this.setState({ connected: true });
22
+ if (this.props.onConnectionChange) {
23
+ this.props.onConnectionChange('ChatGPT', true);
24
+ }
25
+ this.handleClose();
26
+ }
27
+
28
+ setDisconnected() {
29
+ this.setState({ connected: false });
30
+ if (this.props.onConnectionChange) {
31
+ this.props.onConnectionChange('ChatGPT', false);
32
+ }
33
+ this.handleClose();
34
+ }
35
+
36
+ handleOpen() {
37
+ // Capacitor native: do NOT show the web overlay/bookmarklet UI.
38
+ // We run a native consent → scrape flow instead.
39
+ try {
40
+ const plugin = getCapacitorPlugin('OnairosChatGPTNative', 'OnairosChatGPTNativePlugin');
41
+ if (isCapacitorNativePlatform() && plugin?.connectChatGPTNative) {
42
+ this.chatGPTConnect();
43
+ return;
44
+ }
45
+ } catch (_) {}
46
+ this.setState({ open: true });
47
+ }
48
+
49
+ handleClose() {
50
+ this.setState({ open: false });
51
+ if (this.props.onClose) {
52
+ this.props.onClose();
53
+ }
54
+ }
55
+
56
+ async chatGPTConnect() {
57
+ // Capacitor native path: use the in-app native connector (WKWebView cookie auth).
58
+ const plugin = getCapacitorPlugin('OnairosChatGPTNative', 'OnairosChatGPTNativePlugin');
59
+ if (isCapacitorNativePlatform() && plugin?.connectChatGPTNative) {
60
+ this.setState({ isConnecting: true });
61
+ try {
62
+ // Explicit consent before native scrape.
63
+ const ok = (() => {
64
+ try {
65
+ return window.confirm(
66
+ 'Allow Onairos to scrape your ChatGPT conversations and upload them to your Onairos account?'
67
+ );
68
+ } catch {
69
+ return true;
70
+ }
71
+ })();
72
+ if (!ok) return;
73
+
74
+ const userData = JSON.parse(localStorage.getItem('onairosUser') || '{}');
75
+ const jwtToken =
76
+ localStorage.getItem('onairos_user_token') ||
77
+ userData.token ||
78
+ userData.jwt ||
79
+ '';
80
+
81
+ await plugin.connectChatGPTNative({ jwtToken });
82
+ // Native plugin handles UI + backend send.
83
+ // Mark connected optimistically; UniversalOnboarding will re-check via backend.
84
+ this.setConnected();
85
+ } catch (e) {
86
+ console.error('❌ [ChatGPT] Native connect error:', e);
87
+ alert(`Failed to connect ChatGPT natively. ${e?.message || e}`);
88
+ } finally {
89
+ this.setState({ isConnecting: false });
90
+ }
91
+ return;
92
+ }
93
+
94
+ // Use the LLM Connector Manager if available, otherwise fallback to old behavior
95
+ const llmManager = this.props.llmConnectorManager;
96
+
97
+ if (llmManager) {
98
+ // New behavior: Use extension detection
99
+ llmManager.connectToLLM(
100
+ 'chatgpt',
101
+ (platform) => {
102
+ // Success callback
103
+ console.log(`✅ ${platform} connected via extension`);
104
+ this.setConnected();
105
+ },
106
+ (platform, error) => {
107
+ // Error callback
108
+ console.error(`❌ ${platform} connection error:`, error);
109
+ alert(`Failed to connect to ${platform}. ${error}`);
110
+ }
111
+ );
112
+ } else {
113
+ // Fallback: Original behavior for backward compatibility
114
+ this.setState({ isConnecting: true });
115
+
116
+ try {
117
+ console.log('🤖 Opening ChatGPT in new tab (fallback mode)...');
118
+
119
+ const chatGPTWindow = window.open('https://chatgpt.com', '_blank');
120
+
121
+ if (!chatGPTWindow) {
122
+ throw new Error('Popup blocked. Please allow popups for this site.');
123
+ }
124
+
125
+ setTimeout(() => {
126
+ console.log('✅ ChatGPT connection simulated (fallback)');
127
+ this.setConnected();
128
+ this.setState({ isConnecting: false });
129
+ }, 1000);
130
+
131
+ } catch (error) {
132
+ console.error('❌ ChatGPT connection error:', error);
133
+ this.setState({ isConnecting: false });
134
+ alert('Failed to open ChatGPT. Please ensure popups are allowed and try again.');
135
+ }
136
+ }
137
+ }
138
+
139
+ render() {
140
+ const { open = this.props.open || this.state.open } = this.props;
141
+
142
+ if (!open) return null;
143
+
144
+ // Bookmarklet code: fully inline so it works with ChatGPT CSP (no external script load)
145
+ const bookmarkletCode = `javascript:(function(){try{var ok=window.confirm('Allow Onairos to export your last 10 ChatGPT conversations to your Onairos account?');if(!ok){console.log('❌ Onairos ChatGPT export cancelled by user.');return;}console.log('✅ Onairos ChatGPT export consent granted. Extracting conversations...');setTimeout(function(){console.log('✅ Export complete! You can now return to your Onairos tab.');if(window.opener&&!window.opener.closed){window.opener.focus();}},1500);}catch(e){console.error('Onairos ChatGPT bookmarklet error:',e);}})();`;
146
+
147
+ return (
148
+ <>
149
+ <style>{`
150
+ @keyframes gentlePulse {
151
+ 0%, 100% {
152
+ box-shadow: 0 0 0 0 rgba(148, 163, 184, 0.35);
153
+ }
154
+ 50% {
155
+ box-shadow: 0 0 0 10px rgba(148, 163, 184, 0);
156
+ }
157
+ }
158
+ .bookmarklet-button {
159
+ background: rgba(15, 23, 42, 0.85);
160
+ border-radius: 9999px;
161
+ border: 1px solid rgba(255,255,255,0.16);
162
+ backdrop-filter: blur(18px);
163
+ }
164
+ .bookmarklet-button:hover {
165
+ background: rgba(15, 23, 42, 0.92);
166
+ }
167
+ @keyframes fadeInScale {
168
+ 0% { opacity: 0; transform: translateY(8px) scale(0.96); }
169
+ 100% { opacity: 1; transform: translateY(0) scale(1); }
170
+ }
171
+ .chatgpt-modal-card {
172
+ animation: fadeInScale 200ms cubic-bezier(0.16, 1, 0.3, 1);
173
+ }
174
+ .step-circle {
175
+ background: rgba(15, 23, 42, 0.9);
176
+ min-width: 28px;
177
+ width: 28px;
178
+ height: 28px;
179
+ }
180
+ `}</style>
181
+
182
+ {/* Backdrop (transparent so it feels like a sheet on top of the existing modal) */}
183
+ <div className="fixed inset-0 flex items-center justify-center z-[2147483647] p-4 pointer-events-none">
184
+
185
+ {/* Compact Modal Container */}
186
+ <div className="w-full max-w-md pointer-events-auto !text-white">
187
+ <div className="chatgpt-modal-card rounded-3xl overflow-hidden shadow-[0_30px_80px_rgba(15,23,42,0.70)] border border-white/10 bg-[radial-gradient(circle_at_top,_rgba(255,255,255,0.22),_transparent_55%),radial-gradient(circle_at_bottom,_rgba(15,23,42,0.9),_rgba(15,23,42,1))] backdrop-blur-3xl">
188
+
189
+ {/* Header */}
190
+ <div className="relative px-5 py-4 border-b border-white/10 bg-white/10">
191
+ <button
192
+ onClick={this.handleClose}
193
+ className="absolute right-4 top-4 p-1.5 hover:bg-white/20 rounded-full transition-colors"
194
+ aria-label="Close"
195
+ >
196
+ <svg className="w-4 h-4 text-slate-100" fill="none" stroke="currentColor" viewBox="0 0 24 24">
197
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
198
+ </svg>
199
+ </button>
200
+
201
+ <h2 className="text-xl font-semibold pr-8" style={{ color: '#FFFFFF' }}>
202
+ Connect ChatGPT
203
+ </h2>
204
+ <p className="text-sm mt-0.5" style={{ color: '#FFFFFF' }}>
205
+ Three quick steps to import your conversations
206
+ </p>
207
+
208
+ {/* Privacy Notice */}
209
+ <div className="mt-3 flex items-start gap-2 bg-white/12 rounded-2xl px-3 py-2">
210
+ <svg className="w-4 h-4 text-emerald-300 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
211
+ <path fillRule="evenodd" d="M2.166 4.999A11.954 11.954 0 0010 1.944 11.954 11.954 0 0017.834 5c.11.65.166 1.32.166 2.001 0 5.225-3.34 9.67-8 11.317C5.34 16.67 2 12.225 2 7c0-.682.057-1.35.166-2.001zm11.541 3.708a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clipRule="evenodd" />
212
+ </svg>
213
+ <p className="text-xs leading-relaxed" style={{ color: '#FFFFFF' }}>
214
+ <strong className="font-semibold">Private & secure.</strong> We only access your chat history. No one else sees this data.
215
+ </p>
216
+ </div>
217
+ </div>
218
+
219
+ {/* Steps Content */}
220
+ <div className="px-5 py-4 space-y-4">
221
+
222
+ {/* Step 1 */}
223
+ <div className="flex gap-3">
224
+ <div className="flex-shrink-0">
225
+ <div className="step-circle rounded-full flex items-center justify-center">
226
+ <span className="text-white font-bold text-sm">1</span>
227
+ </div>
228
+ </div>
229
+ <div className="flex-1 pt-0.5">
230
+ <h3 className="text-sm font-semibold mb-1" style={{ color: '#FFFFFF' }}>
231
+ Drag this button to your bookmarks bar
232
+ </h3>
233
+ <div className="relative inline-block mt-2">
234
+ <div className="absolute inset-0 rounded-full" style={{ animation: 'gentlePulse 2s ease-in-out infinite' }}></div>
235
+ <a
236
+ href={bookmarkletCode}
237
+ draggable="true"
238
+ onDragStart={(e) => {
239
+ e.dataTransfer.setData('text/plain', bookmarkletCode);
240
+ e.dataTransfer.effectAllowed = 'copy';
241
+ }}
242
+ onClick={(e) => {
243
+ e.preventDefault();
244
+ alert('Please drag this button to your bookmarks bar');
245
+ }}
246
+ className="bookmarklet-button relative inline-flex items-center gap-1.5 px-4 py-2 font-medium cursor-move select-none transition-all hover:scale-[1.03]"
247
+ style={{ color: '#FFFFFF' }}
248
+ >
249
+ <span className="text-base" style={{ color: '#FFFFFF' }}>✨</span>
250
+ <span className="text-sm" style={{ color: '#FFFFFF' }}>Onairos ChatGPT</span>
251
+ </a>
252
+ </div>
253
+ <p className="text-xs mt-2" style={{ color: '#E2E8F0' }}>
254
+ <kbd className="px-1.5 py-0.5 bg-white/10 rounded-full text-[10px] font-mono border border-white/10" style={{ color: '#F1F5F9' }}>Ctrl+Shift+B</kbd> to show bookmarks bar
255
+ </p>
256
+ </div>
257
+ </div>
258
+
259
+ {/* Divider */}
260
+ <div className="border-t border-white/10 ml-10"></div>
261
+
262
+ {/* Step 2 */}
263
+ <div className="flex gap-3">
264
+ <div className="flex-shrink-0">
265
+ <div className="step-circle rounded-full flex items-center justify-center">
266
+ <span className="text-white font-bold text-sm">2</span>
267
+ </div>
268
+ </div>
269
+ <div className="flex-1 pt-0.5">
270
+ <h3 className="text-sm font-semibold mb-1" style={{ color: '#FFFFFF' }}>
271
+ Open ChatGPT and log in
272
+ </h3>
273
+ <p className="text-xs mb-2" style={{ color: '#E2E8F0' }}>
274
+ Make sure you're logged into your ChatGPT account
275
+ </p>
276
+ <button
277
+ onClick={() => {
278
+ window.open('https://chatgpt.com', '_blank');
279
+ }}
280
+ className="inline-flex items-center gap-1.5 px-4 py-2 rounded-full bg-emerald-400/90 hover:bg-emerald-300 text-slate-900 text-xs font-medium transition-colors shadow-[0_0_25px_rgba(52,211,153,0.35)]"
281
+ >
282
+ <svg className="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
283
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
284
+ </svg>
285
+ Open ChatGPT
286
+ </button>
287
+ </div>
288
+ </div>
289
+
290
+ {/* Divider */}
291
+ <div className="border-t border-white/10 ml-10"></div>
292
+
293
+ {/* Step 3 */}
294
+ <div className="flex gap-3">
295
+ <div className="flex-shrink-0">
296
+ <div className="step-circle rounded-full flex items-center justify-center">
297
+ <span className="text-white font-bold text-sm">3</span>
298
+ </div>
299
+ </div>
300
+ <div className="flex-1 pt-0.5">
301
+ <h3 className="text-sm font-semibold mb-1" style={{ color: '#FFFFFF' }}>
302
+ Click the bookmark on ChatGPT
303
+ </h3>
304
+ <p className="text-xs" style={{ color: '#E2E8F0' }}>
305
+ Click the <strong style={{ color: '#FFFFFF' }}>"Onairos ChatGPT"</strong> bookmark you added. We'll securely import your last 10 conversations.
306
+ </p>
307
+ </div>
308
+ </div>
309
+
310
+ </div>
311
+
312
+ {/* Footer */}
313
+ <div className="px-5 py-4 bg-white/5 border-t border-white/10">
314
+ <style>{`
315
+ .chatgpt-got-it-button {
316
+ color: #FFFFFF !important;
317
+ background-color: rgba(15, 23, 42, 0.8) !important;
318
+ }
319
+ .chatgpt-got-it-button:hover {
320
+ background-color: rgba(15, 23, 42, 0.9) !important;
321
+ }
322
+ .chatgpt-got-it-button * {
323
+ color: #FFFFFF !important;
324
+ }
325
+ .chatgpt-got-it-button span {
326
+ color: #FFFFFF !important;
327
+ }
328
+ `}</style>
329
+ <button
330
+ onClick={() => {
331
+ this.setConnected();
332
+ }}
333
+ className="w-full px-4 py-2.5 rounded-full font-medium text-sm transition-all hover:scale-[1.01] active:scale-[0.99] shadow-[0_10px_30px_rgba(15,23,42,0.45)] border border-white/40 chatgpt-got-it-button"
334
+ style={{ color: '#FFFFFF' }}
335
+ >
336
+ <span style={{ color: '#FFFFFF' }}>Got it! ✓</span>
337
+ </button>
338
+ </div>
339
+
340
+ </div>
341
+ </div>
342
+ </div>
343
+ </>
344
+ );
345
+ }
346
+ }
347
+
348
+ export default ChatGPTConnector;
@@ -0,0 +1,44 @@
1
+ import React, { useEffect } from 'react';
2
+ import { isCapacitorNativePlatform } from '../../utils/capacitorPlugins.js';
3
+ import ConnectClaudeModal from '../ConnectClaudeModal.jsx';
4
+
5
+ export default function ClaudeConnector({ open, onClose, onConnectionChange }) {
6
+ const nativePlugin = isCapacitorNativePlatform()
7
+ ? window?.Capacitor?.Plugins?.OnairosClaudeNative
8
+ : null;
9
+
10
+ useEffect(() => {
11
+ if (!open || !nativePlugin?.connectClaudeNative) return;
12
+ let cancelled = false;
13
+ (async () => {
14
+ try {
15
+ const userData = JSON.parse(localStorage.getItem('onairosUser') || '{}');
16
+ const jwtToken = localStorage.getItem('onairos_user_token') || userData.token || userData.jwt || '';
17
+ await nativePlugin.connectClaudeNative({ jwtToken });
18
+ if (cancelled) return;
19
+ if (typeof onConnectionChange === 'function') onConnectionChange('Claude', true);
20
+ if (typeof onClose === 'function') onClose();
21
+ } catch (e) {
22
+ console.error('❌ [Claude] Native connect error:', e);
23
+ alert(`Failed to connect Claude natively. ${e?.message || e}`);
24
+ }
25
+ })();
26
+ return () => {
27
+ cancelled = true;
28
+ };
29
+ }, [open, nativePlugin, onClose, onConnectionChange]);
30
+
31
+ if (open && nativePlugin?.connectClaudeNative) return null;
32
+
33
+ return (
34
+ <ConnectClaudeModal
35
+ open={open}
36
+ onClose={onClose}
37
+ onConnected={() => {
38
+ if (typeof onConnectionChange === 'function') {
39
+ onConnectionChange('Claude', true);
40
+ }
41
+ }}
42
+ />
43
+ );
44
+ }
@@ -0,0 +1,44 @@
1
+ import React, { useEffect } from 'react';
2
+ import { isCapacitorNativePlatform } from '../../utils/capacitorPlugins.js';
3
+ import ConnectClaudeModal from '../ConnectClaudeModal.jsx';
4
+
5
+ export default function ClaudeConnector({ open, onClose, onConnectionChange }) {
6
+ const nativePlugin = isCapacitorNativePlatform()
7
+ ? window?.Capacitor?.Plugins?.OnairosClaudeNative
8
+ : null;
9
+
10
+ useEffect(() => {
11
+ if (!open || !nativePlugin?.connectClaudeNative) return;
12
+ let cancelled = false;
13
+ (async () => {
14
+ try {
15
+ const userData = JSON.parse(localStorage.getItem('onairosUser') || '{}');
16
+ const jwtToken = localStorage.getItem('onairos_user_token') || userData.token || userData.jwt || '';
17
+ await nativePlugin.connectClaudeNative({ jwtToken });
18
+ if (cancelled) return;
19
+ if (typeof onConnectionChange === 'function') onConnectionChange('Claude', true);
20
+ if (typeof onClose === 'function') onClose();
21
+ } catch (e) {
22
+ console.error('❌ [Claude] Native connect error:', e);
23
+ alert(`Failed to connect Claude natively. ${e?.message || e}`);
24
+ }
25
+ })();
26
+ return () => {
27
+ cancelled = true;
28
+ };
29
+ }, [open, nativePlugin, onClose, onConnectionChange]);
30
+
31
+ if (open && nativePlugin?.connectClaudeNative) return null;
32
+
33
+ return (
34
+ <ConnectClaudeModal
35
+ open={open}
36
+ onClose={onClose}
37
+ onConnected={() => {
38
+ if (typeof onConnectionChange === 'function') {
39
+ onConnectionChange('Claude', true);
40
+ }
41
+ }}
42
+ />
43
+ );
44
+ }
@@ -0,0 +1,170 @@
1
+ import React, { Component } from 'react';
2
+
3
+ class GeminiConnector extends Component {
4
+ constructor(props) {
5
+ super(props);
6
+ this.state = {
7
+ connected: false,
8
+ open: false,
9
+ isConnecting: false,
10
+ };
11
+ this.handleClose = this.handleClose.bind(this);
12
+ this.handleOpen = this.handleOpen.bind(this);
13
+ this.geminiConnect = this.geminiConnect.bind(this);
14
+ this.setConnected = this.setConnected.bind(this);
15
+ this.setDisconnected = this.setDisconnected.bind(this);
16
+ }
17
+
18
+ setConnected() {
19
+ this.setState({ connected: true });
20
+ if (this.props.onConnectionChange) {
21
+ this.props.onConnectionChange('Gemini', true);
22
+ }
23
+ this.handleClose();
24
+ }
25
+
26
+ setDisconnected() {
27
+ this.setState({ connected: false });
28
+ if (this.props.onConnectionChange) {
29
+ this.props.onConnectionChange('Gemini', false);
30
+ }
31
+ this.handleClose();
32
+ }
33
+
34
+ handleOpen() {
35
+ this.setState({ open: true });
36
+ }
37
+
38
+ handleClose() {
39
+ this.setState({ open: false });
40
+ if (this.props.onClose) {
41
+ this.props.onClose();
42
+ }
43
+ }
44
+
45
+ async geminiConnect() {
46
+ // Use the LLM Connector Manager if available, otherwise fallback to old behavior
47
+ const llmManager = this.props.llmConnectorManager;
48
+
49
+ if (llmManager) {
50
+ // New behavior: Use extension detection
51
+ llmManager.connectToLLM(
52
+ 'gemini',
53
+ (platform) => {
54
+ // Success callback
55
+ console.log(`✅ ${platform} connected via extension`);
56
+ this.setConnected();
57
+ },
58
+ (platform, error) => {
59
+ // Error callback
60
+ console.error(`❌ ${platform} connection error:`, error);
61
+ alert(`Failed to connect to ${platform}. ${error}`);
62
+ }
63
+ );
64
+ } else {
65
+ // Fallback: Original behavior for backward compatibility
66
+ this.setState({ isConnecting: true });
67
+
68
+ try {
69
+ console.log('🤖 Opening Gemini in new tab (fallback mode)...');
70
+
71
+ const geminiWindow = window.open('https://gemini.google.com', '_blank');
72
+
73
+ if (!geminiWindow) {
74
+ throw new Error('Popup blocked. Please allow popups for this site.');
75
+ }
76
+
77
+ setTimeout(() => {
78
+ console.log('✅ Gemini connection simulated (fallback)');
79
+ this.setConnected();
80
+ this.setState({ isConnecting: false });
81
+ }, 1000);
82
+
83
+ } catch (error) {
84
+ console.error('❌ Gemini connection error:', error);
85
+ this.setState({ isConnecting: false });
86
+ alert('Failed to open Gemini. Please ensure popups are allowed and try again.');
87
+ }
88
+ }
89
+ }
90
+
91
+ render() {
92
+ const { open = this.props.open || this.state.open } = this.props;
93
+
94
+ if (!open) return null;
95
+
96
+ return (
97
+ <div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[2147483647]">
98
+ <div className="bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-full md:max-h-[90vh] overflow-hidden">
99
+ <div className="p-6">
100
+ <div className="flex items-center mb-4">
101
+ <img
102
+ src="/gemini-color.png"
103
+ alt="Gemini"
104
+ className="w-8 h-8 mr-3"
105
+ onError={(e) => {
106
+ // Fallback to emoji if image fails to load
107
+ e.target.style.display = 'none';
108
+ e.target.nextSibling.style.display = 'inline';
109
+ }}
110
+ />
111
+ <span className="text-2xl mr-3" style={{display: 'none'}}>💎</span>
112
+ <h2 className="text-xl font-bold text-gray-900">
113
+ Connect to Gemini
114
+ </h2>
115
+ </div>
116
+
117
+ <div className="space-y-4 text-gray-700">
118
+ <p>
119
+ This will open Gemini in a new tab where you can interact with Google's advanced AI assistant.
120
+ </p>
121
+
122
+ <div>
123
+ <p className="font-medium mb-2">What you can do with Gemini:</p>
124
+ <ul className="list-disc ml-6 space-y-1">
125
+ <li>Ask questions and get comprehensive answers</li>
126
+ <li>Analyze images, documents, and multimedia content</li>
127
+ <li>Get help with research and fact-checking</li>
128
+ <li>Work on creative projects and brainstorming</li>
129
+ <li>Receive coding assistance and technical help</li>
130
+ </ul>
131
+ </div>
132
+
133
+ <div className="bg-blue-50 border border-blue-200 rounded-lg p-3">
134
+ <p className="text-blue-800 text-sm font-medium">
135
+ <strong>Note:</strong> Gemini will open in a new tab. You can return to this page anytime.
136
+ </p>
137
+ </div>
138
+
139
+ <p className="text-sm">
140
+ By connecting to Gemini, you'll be redirected to{' '}
141
+ <a href="https://gemini.google.com" className="text-blue-600 hover:underline" target="_blank" rel="noopener noreferrer">
142
+ gemini.google.com
143
+ </a>
144
+ </p>
145
+ </div>
146
+
147
+ <div className="flex space-x-3 mt-6">
148
+ <button
149
+ onClick={this.handleClose}
150
+ disabled={this.state.isConnecting}
151
+ className="flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 disabled:opacity-50"
152
+ >
153
+ Cancel
154
+ </button>
155
+ <button
156
+ onClick={this.geminiConnect}
157
+ disabled={this.state.isConnecting}
158
+ className="flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50"
159
+ >
160
+ {this.state.isConnecting ? 'Opening...' : 'Open Gemini'}
161
+ </button>
162
+ </div>
163
+ </div>
164
+ </div>
165
+ </div>
166
+ );
167
+ }
168
+ }
169
+
170
+ export default GeminiConnector;