@onairosofficial/onairos-capacitor 0.1.3 → 0.1.5

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 (95) hide show
  1. package/OnairosofficialOnairosCapacitor.podspec +1 -1
  2. package/README.md +1 -1
  3. package/dist/onairos.capacitor.esm.js +509 -1
  4. package/dist/onairos.capacitor.esm.turbopack.js +509 -1
  5. package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosChatGPTNativePlugin.swift +187 -945
  6. package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosRNScrapers.swift +1800 -0
  7. package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosSpotifyNativePlugin.swift +180 -629
  8. package/onairos.d.ts +24 -0
  9. package/package.json +5 -2
  10. package/src/assets/connectors/Linkedinicon.png +0 -0
  11. package/src/assets/connectors/Redditicon.png +0 -0
  12. package/src/assets/connectors/YouTubeicon2.png +0 -0
  13. package/src/assets/connectors/chatgpt.png +0 -0
  14. package/src/assets/connectors/claude.png +0 -0
  15. package/src/assets/connectors/instagram.png +0 -0
  16. package/src/assets/connectors/netflix.png +0 -0
  17. package/src/assets/connectors/pinterest.png +0 -0
  18. package/src/assets/connectors/sephora.png +0 -0
  19. package/src/assets/connectors/spotify.png +0 -0
  20. package/src/assets/connectors/tiktok.png +0 -0
  21. package/src/assets/permissions/onairos.png +0 -0
  22. package/src/assets/permissions/personalization.png +0 -0
  23. package/src/assets/permissions/public-profile-person.png +0 -0
  24. package/src/assets/permissions/raw-memories.png +0 -0
  25. package/src/capacitorConnectorCatalog.js +2 -6
  26. package/src/components/DataRequest.jsx +96 -532
  27. package/src/components/EmailAuth.jsx +4 -116
  28. package/src/components/PinSetup.jsx +39 -226
  29. package/src/components/SDKDesignPreview.jsx +33 -0
  30. package/src/components/SessionUserBar.jsx +2 -1
  31. package/src/components/TrainingScreen.jsx +18 -12
  32. package/src/components/UniversalOnboarding.jsx +191 -424
  33. package/src/components/WelcomeScreen.jsx +19 -12
  34. package/src/components/parity/NativeConnections.jsx +136 -0
  35. package/src/components/parity/NativeScreens.jsx +48 -0
  36. package/src/components/ui/PageLayout.jsx +7 -3
  37. package/src/nativeImport/ConnectorLoading.jsx +13 -0
  38. package/src/nativeImport/CustomImportSession.js +115 -0
  39. package/src/nativeImport/ImportIcon.jsx +29 -0
  40. package/src/nativeImport/ImportProgress.jsx +24 -0
  41. package/src/nativeImport/ImportStatus.jsx +9 -0
  42. package/src/nativeImport/NativeChatImport.jsx +28 -0
  43. package/src/nativeImport/NativeImportSession.js +123 -0
  44. package/src/nativeImport/NativeScraperImport.jsx +57 -0
  45. package/src/nativeImport/SmartFilter.jsx +28 -0
  46. package/src/nativeImport/customPayload.js +37 -0
  47. package/src/nativeImport/netflixExport.js +30 -0
  48. package/src/nativeImport/netflixHistory.js +28 -0
  49. package/src/nativeImport/netflixSession.js +59 -0
  50. package/src/nativeImport/rawHandoff.js +7 -0
  51. package/src/nativeImport/rn/config/api.js +5 -0
  52. package/src/nativeImport/rn/services/apiKeyService.js +2 -0
  53. package/src/nativeImport/rn/services/hingePayload.js +37 -0
  54. package/src/nativeImport/rn/services/nativeConversationImport.js +138 -0
  55. package/src/nativeImport/rn/services/nativeFileTransfer.js +127 -0
  56. package/src/nativeImport/rn/services/nativeRawRedaction.js +136 -0
  57. package/src/nativeImport/rn/services/netflixPayload.js +70 -0
  58. package/src/nativeImport/rn/services/rawMemoryPolicy.js +38 -0
  59. package/src/nativeImport/rn/services/sephoraPayload.js +166 -0
  60. package/src/nativeImport/rn/services/spotifyPayload.js +99 -0
  61. package/src/nativeImport/rn/source-manifest.json +45 -0
  62. package/src/nativeImport/rn/utils/importedFiles.js +74 -0
  63. package/src/nativeImport/rn/utils/nativeImportDates.js +45 -0
  64. package/src/nativeImport/rn/utils/nativeImportFileReceiver.js +51 -0
  65. package/src/nativeImport/rn/utils/nativeImportMetadata.js +74 -0
  66. package/src/nativeImport/rn/utils/nativeImportTopics.js +56 -0
  67. package/src/nativeImport/rn/utils/rawExportDelivery.js +12 -0
  68. package/src/nativeImport/rn/utils/webviewScripts/chatgptDiscovery.js +99 -0
  69. package/src/nativeImport/rn/utils/webviewScripts/claude.js +349 -0
  70. package/src/nativeImport/rn/utils/webviewScripts/gemini.js +356 -0
  71. package/src/nativeImport/rn/utils/webviewScripts/hinge.js +375 -0
  72. package/src/nativeImport/rn/utils/webviewScripts/instagram.js +152 -0
  73. package/src/nativeImport/rn/utils/webviewScripts/linkedin.js +825 -0
  74. package/src/nativeImport/rn/utils/webviewScripts/nativeChatGPTImport.js +202 -0
  75. package/src/nativeImport/rn/utils/webviewScripts/nativeChatGPTSession.js +63 -0
  76. package/src/nativeImport/rn/utils/webviewScripts/nativeImportFiles.js +132 -0
  77. package/src/nativeImport/rn/utils/webviewScripts/nativeImportProviders.js +80 -0
  78. package/src/nativeImport/rn/utils/webviewScripts/nativeLoginViewport.js +28 -0
  79. package/src/nativeImport/rn/utils/webviewScripts/netflix.js +257 -0
  80. package/src/nativeImport/rn/utils/webviewScripts/sephora.js +862 -0
  81. package/src/nativeImport/rn/utils/webviewScripts/sephoraSession.js +160 -0
  82. package/src/nativeImport/rn/utils/webviewScripts/spotify.js +1868 -0
  83. package/src/nativeImport/rn/utils/webviewScripts/telegram.js +630 -0
  84. package/src/nativeImport/rn/utils/webviewScripts/tiktok.js +2920 -0
  85. package/src/onairos.capacitor.jsx +14 -2
  86. package/src/onairos.core.jsx +3 -0
  87. package/src/onairosButton.jsx +23 -17
  88. package/src/styles/onairos-fonts.css +20 -0
  89. package/src/styles/onairos-native.css +709 -0
  90. package/src/styles/onairos-rn-parity.css +175 -0
  91. package/src/styles/sdkCssRegistry.js +83 -1
  92. package/src/styles/tailwind.capacitor.css +6 -0
  93. package/src/utils/capacitorPlugins.js +20 -12
  94. package/src/utils/nativeConnectorSession.js +18 -0
  95. package/src/utils/parityPolicy.js +41 -0
@@ -1,3 +1,8 @@
1
+ import NativeScraperImport from '../nativeImport/NativeScraperImport.jsx';
2
+ import NativeChatImport from '../nativeImport/NativeChatImport.jsx';
3
+ import {NativeConnections} from './parity/NativeScreens.jsx';
4
+ import {TEMP_DISABLED_CONNECTORS} from '../capacitorConnectorCatalog.js';
5
+ import {filterAllowedPlatforms, orderPlatforms} from '../utils/parityPolicy.js';
1
6
  import React, { useEffect, useId, useState, useRef, useMemo } from 'react';
2
7
  import Lottie from 'lottie-react';
3
8
  import personaAnim from '../../public/persona-anim.json';
@@ -46,18 +51,7 @@ const detectInAppBrowserFromUserAgent = () => {
46
51
  return { isInAppBrowser: isGenericWebView, app: isGenericWebView ? 'unknown' : null };
47
52
  };
48
53
  /** RN parity: show `recommendedPlatforms` first in the connector carousel (order only). */
49
- function sortRecommendedPlatformsFirst(platforms, recommended) {
50
- if (!recommended || !Array.isArray(recommended) || recommended.length === 0) return platforms || [];
51
- const norm = (x) => String(x || '').trim().toLowerCase();
52
- const rec = new Set(recommended.map(norm));
53
- const pri = [];
54
- const rest = [];
55
- for (const p of platforms || []) {
56
- if (rec.has(norm(p?.name)) || rec.has(norm(p?.connector))) pri.push(p);
57
- else rest.push(p);
58
- }
59
- return [...pri, ...rest];
60
- }
54
+
61
55
 
62
56
  // Inline SVG brand marks (simple-icons paths) — avoid third-party CDN flicker on first paint.
63
57
  // LinkedIn brand was pulled from simple-icons; using a single-fill version of the "in" mark.
@@ -93,6 +87,7 @@ const fadeSlideInKeyframes = `
93
87
 
94
88
  export default function UniversalOnboarding({
95
89
  onComplete,
90
+ onNativeRawImport,
96
91
  onBack,
97
92
  appIcon,
98
93
  appName,
@@ -118,6 +113,8 @@ export default function UniversalOnboarding({
118
113
  allowContinueWithoutConnections = false,
119
114
  combineConsentWithOnboarding = false,
120
115
  }) {
116
+ const [nativeChatImport,setNativeChatImport]=useState(null);
117
+ const [nativeScraperImport,setNativeScraperImport]=useState(null);
121
118
  const lottieRef = useRef(null);
122
119
  const lastFrameRef = useRef(0);
123
120
  const rafRef = useRef(null);
@@ -182,7 +179,7 @@ export default function UniversalOnboarding({
182
179
  // Visual-only optimistic state: black toggle while a connection is pending.
183
180
  // Do not persist this as a connected account; success handlers flip the real state to green.
184
181
  const [pendingTogglePlatform, setPendingTogglePlatform] = useState(null);
185
- const [selected, setSelected] = useState('YouTube');
182
+ const [selected, setSelected] = useState('');
186
183
  const [currentPage, setCurrentPage] = useState(1);
187
184
  const [showChatGPTModal, setShowChatGPTModal] = useState(false);
188
185
  const [showClaudeModal, setShowClaudeModal] = useState(false);
@@ -215,8 +212,8 @@ export default function UniversalOnboarding({
215
212
  setPendingTogglePlatform(platformName);
216
213
  connectHostedImport({
217
214
  provider,
218
- onStatus: (s) => { try { console.log(`🤖 [${platformName} hosted import] status:`, s?.status); } catch (_) {} },
219
- onPreview: (preview) => { try { console.log(`🤖 [${platformName} hosted import] preview items:`, Array.isArray(preview) ? preview.length : 0); } catch (_) {} },
215
+ onStatus: (s) => { try { } catch (_) {} },
216
+ onPreview: (preview) => { try { } catch (_) {} },
220
217
  })
221
218
  .then((result) => {
222
219
  if (result?.status === 'complete') {
@@ -228,7 +225,7 @@ export default function UniversalOnboarding({
228
225
  }
229
226
  })
230
227
  .catch((err) => {
231
- console.error(`❌ [${platformName} hosted import] error:`, err);
228
+ console.error('[Onairos] Request failed.');
232
229
  setConnectError(err?.message || `${platformName} import failed to start. Please try again.`);
233
230
  setConnectedAccounts((s) => ({ ...s, [platformName]: false }));
234
231
  setPendingTogglePlatform((prev) => (prev === platformName ? null : prev));
@@ -286,97 +283,27 @@ export default function UniversalOnboarding({
286
283
  };
287
284
  const userId = deriveUserId(jwtToken) || (userData.email || userData.username || username || '');
288
285
 
289
- let cancelNativeWait = null;
290
- const waitForDone = () =>
291
- new Promise((resolve, reject) => {
292
- let sub = null;
293
- let settled = false;
294
- let timer = null;
295
- const cleanup = () => {
296
- settled = true;
297
- try { if (timer) clearTimeout(timer); } catch (_) {}
298
- try { sub?.remove?.(); } catch (_) {}
299
- };
300
- cancelNativeWait = cleanup;
301
- timer = setTimeout(() => {
302
- if (settled) return;
303
- cleanup();
304
- reject(new Error(`${displayName} native connector timed out`));
305
- }, 120000);
306
- const finish = (value) => {
307
- if (settled) return;
308
- cleanup();
309
- resolve(value);
310
- };
311
- const fail = (error) => {
312
- if (settled) return;
313
- cleanup();
314
- reject(error);
315
- };
316
-
317
- try {
318
- if (typeof plugin.addListener !== 'function') {
319
- finish({ status: 'listener_unavailable' });
320
- return;
321
- }
322
- const r = plugin.addListener('onairosNativeConnectorEvent', (evt) => {
323
- try {
324
- const eventPlatform = String(evt?.platform || '').toLowerCase();
325
- if (eventPlatform && eventPlatform !== platform) return;
326
- const status = String(evt?.status || '');
327
- if (status === 'verifying_session') setNativeProgressText('Verifying session...');
328
- else if (status === 'authenticated') setNativeProgressText('Authenticated. Starting import...');
329
- else if (status === 'scraping_started') setNativeProgressText(`Importing ${displayName} data...`);
330
- else if (status.startsWith('success')) setNativeProgressText('Saved data. Finishing...');
331
- else if (status === 'done') setNativeProgressText('Done.');
332
- else if (status === 'error') setNativeProgressText(evt?.message ? `Error: ${String(evt.message)}` : 'Error.');
333
- else if (status) setNativeProgressText(status);
334
-
335
- if (status.startsWith('success') || status === 'done') {
336
- setConnectedAccounts((s) => ({ ...s, [displayName]: true }));
337
- finish(evt);
338
- }
339
- if (status === 'error') {
340
- fail(new Error(evt?.message || `${displayName} native import failed`));
341
- }
342
- } catch (_) {}
343
- });
344
- if (r && typeof r.then === 'function') {
345
- r.then((s) => { sub = s; }).catch(() => finish({ status: 'listener_unavailable' }));
346
- } else {
347
- sub = r;
348
- }
349
- } catch (_) {
350
- finish({ status: 'listener_unavailable' });
351
- }
352
- });
353
-
286
+ let nativeListener;
354
287
  try {
355
- const donePromise = waitForDone();
356
- donePromise.catch(() => {});
357
- const result = await connectMethod.call(plugin, {
358
- jwtToken,
359
- userId,
360
- apiKey: sdkConfig.apiKey || (typeof window !== 'undefined' ? window.onairosApiKey : ''),
361
- baseUrl: sdkConfig.baseUrl,
288
+ nativeListener=await plugin.addListener?.('onairosNativeConnectorEvent',event=>{
289
+ if(String(event?.platform||'').toLowerCase()===platform&&typeof event.message==='string')setNativeProgressText(event.message);
362
290
  });
363
- const immediateStatus = String(result?.status || '').toLowerCase();
364
- if (result?.success === true || immediateStatus.startsWith('success') || immediateStatus === 'done') {
365
- try { cancelNativeWait?.(); } catch (_) {}
366
- setConnectedAccounts((s) => ({ ...s, [displayName]: true }));
367
- } else {
368
- await donePromise;
369
- setConnectedAccounts((s) => ({ ...s, [displayName]: true }));
370
- }
291
+ const result=await connectMethod.call(plugin,{
292
+ jwtToken,userId,
293
+ apiKey:sdkConfig.apiKey||(typeof window!=='undefined'?window.onairosApiKey:''),
294
+ baseUrl:sdkConfig.baseUrl,
295
+ });
296
+ if(result?.success!==true)throw new Error(`${displayName} did not confirm a completed import. Please retry.`);
297
+ setConnectedAccounts(previous=>({...previous,[displayName]:true}));
371
298
  setNativeProgressText('Connected');
372
299
  } catch (e) {
373
300
  setConnectError(e?.message || String(e));
374
301
  setConnectedAccounts((s) => ({ ...s, [displayName]: false }));
375
302
  setPendingTogglePlatform((prev) => (prev === displayName ? null : prev));
376
303
  } finally {
304
+ try { await nativeListener?.remove?.(); } catch {}
377
305
  setIsConnecting(false);
378
306
  setConnectingPlatform(null);
379
- try { cancelNativeWait?.(); } catch (_) {}
380
307
  try {
381
308
  setTimeout(() => setNativeProgressText(''), 2000);
382
309
  } catch (_) {}
@@ -647,17 +574,6 @@ export default function UniversalOnboarding({
647
574
 
648
575
  // TODO(onairos-capacitor): Re-enable these once the native/mobile connector UX
649
576
  // is stable enough for consumer apps.
650
- const TEMP_DISABLED_CONNECTORS = new Set([
651
- 'claude',
652
- 'gemini',
653
- 'grok',
654
- 'perplexity',
655
- 'sephora',
656
- 'instagram-data',
657
- 'gmail',
658
- 'hinge',
659
- 'netflix',
660
- ]);
661
577
  const filterTemporarilyHiddenPlatforms = (platformList = []) =>
662
578
  platformList.filter((platform) => {
663
579
  const connector = String(platform?.connector || '').toLowerCase();
@@ -788,45 +704,22 @@ export default function UniversalOnboarding({
788
704
  }
789
705
 
790
706
  // 2. For non-special apps, developer props control the platforms
791
-
707
+
792
708
  // rawMemoriesOnly: Show only LLM platforms (when export is offered for this app)
793
- if (rawMemoriesOnly && rawMemoriesOffered !== false) {
709
+ if (rawMemoriesOnly) {
794
710
  return filterTemporarilyHiddenPlatforms(llmOnlyPlatforms);
795
711
  }
796
712
 
797
- // allowedPlatforms: Filter to specific platforms the developer specified
798
- if (allowedPlatforms && Array.isArray(allowedPlatforms) && allowedPlatforms.length > 0) {
799
- // Normalize allowed platform names for matching
800
- const normalizeForMatch = (name) => String(name || '').trim().toLowerCase();
801
- const allowedSet = new Set(allowedPlatforms.map(normalizeForMatch));
802
-
803
- // Filter allPlatformsDefault to only include allowed platforms
804
- const filtered = allPlatformsDefault.filter((p) => {
805
- const nameMatch = allowedSet.has(normalizeForMatch(p.name));
806
- const connectorMatch = allowedSet.has(normalizeForMatch(p.connector));
807
- return nameMatch || connectorMatch;
808
- });
809
-
810
- // If filtering results in empty list, log warning and fall back to default
811
- if (filtered.length === 0) {
812
- console.warn('⚠️ allowedPlatforms resulted in empty list, falling back to all platforms');
813
- return filterTemporarilyHiddenPlatforms(allPlatformsDefault);
814
- }
815
-
816
- const visibleFiltered = filterTemporarilyHiddenPlatforms(filtered);
817
- return visibleFiltered;
818
- }
819
-
820
713
  // 3. Default: show all platforms
821
714
  return filterTemporarilyHiddenPlatforms(allPlatformsDefault);
822
715
  };
823
716
 
824
- const basePlatforms = getBasePlatforms();
717
+ const basePlatforms = filterAllowedPlatforms(getBasePlatforms(), allowedPlatforms);
825
718
  const inAppBrowser = detectInAppBrowserFromUserAgent();
826
719
  const hideUnsupportedInstagramInAppConnectors =
827
720
  inAppBrowser?.isInAppBrowser === true && inAppBrowser?.app === 'instagram';
828
721
  const INSTAGRAM_IN_APP_HIDDEN_CONNECTORS = new Set(['tiktok', 'chatgpt']);
829
-
722
+
830
723
  // Capacitor native keeps the same connector picker as web/RN. Individual
831
724
  // connectors still surface their own "native plugin missing" messages when a
832
725
  // host app has not registered the optional WKWebView bridge.
@@ -844,24 +737,11 @@ export default function UniversalOnboarding({
844
737
  ? rawExportFilteredPlatforms.filter((p) => !INSTAGRAM_IN_APP_HIDDEN_CONNECTORS.has(String(p?.connector || '').toLowerCase()))
845
738
  : rawExportFilteredPlatforms;
846
739
 
847
- // Always keep the connection step useful when host configuration filters out everything.
848
- const defaultFallbackPlatforms = allPlatformsDefault.filter((p) =>
849
- ['youtube', 'chatgpt', 'reddit'].includes(String(p?.connector || '').toLowerCase())
850
- );
851
- const environmentFilteredFallbackPlatforms = filterForEnvironment(defaultFallbackPlatforms);
852
- const rawExportFilteredFallbackPlatforms = filterPlatformsForRawExport(
853
- environmentFilteredFallbackPlatforms,
854
- rawMemoriesOffered,
855
- { rawMemoriesOnly, rawMemoriesConfig, requestData }
856
- );
857
- const visibleFallbackPlatforms = hideUnsupportedInstagramInAppConnectors
858
- ? rawExportFilteredFallbackPlatforms.filter((p) => !INSTAGRAM_IN_APP_HIDDEN_CONNECTORS.has(String(p?.connector || '').toLowerCase()))
859
- : rawExportFilteredFallbackPlatforms;
860
- const allPlatforms = filteredPlatforms.length > 0 ? filteredPlatforms : visibleFallbackPlatforms;
861
-
740
+ // An explicit allowlist is a boundary, including [] and unknown IDs.
741
+ const allPlatforms = filteredPlatforms;
862
742
  const platformsForUi = useMemo(
863
- () => sortRecommendedPlatformsFirst(allPlatforms, recommendedPlatforms),
864
- [allPlatforms, recommendedPlatforms],
743
+ () => orderPlatforms(allPlatforms, recommendedPlatforms, priorityPlatform),
744
+ [allPlatforms, recommendedPlatforms, priorityPlatform],
865
745
  );
866
746
 
867
747
  // Keep the selected platform valid whenever filtering changes the visible list.
@@ -876,7 +756,7 @@ export default function UniversalOnboarding({
876
756
  return;
877
757
  }
878
758
  if (!names.has(selected)) {
879
- const first = allPlatforms[0]?.name;
759
+ const first = platformsForUi[0]?.name;
880
760
  if (first) setSelected(first);
881
761
  setCurrentPage(1);
882
762
  }
@@ -889,12 +769,12 @@ export default function UniversalOnboarding({
889
769
  const raw = String(value || '').trim();
890
770
  if (!raw) return '';
891
771
  const lower = raw.toLowerCase();
892
-
772
+
893
773
  // Handle Twitter/X aliasing (twitter and x are the same platform)
894
774
  if (lower === 'twitter') {
895
775
  return 'X';
896
776
  }
897
-
777
+
898
778
  const byConnector = allPlatforms.find((p) => String(p.connector).toLowerCase() === lower);
899
779
  if (byConnector) return byConnector.name;
900
780
  const byPlatformId = allPlatforms.find((p) => String(p.platformId || '').toLowerCase() === lower);
@@ -992,7 +872,7 @@ export default function UniversalOnboarding({
992
872
  });
993
873
  if (base[canonical] === false) delete base[canonical];
994
874
  const updated = { ...base, [canonical]: true };
995
- console.log(`✅ Connected ${canonical} (${source}) - adding to:`, currentState, '→ result:', updated);
875
+
996
876
  return updated;
997
877
  });
998
878
  try {
@@ -1046,7 +926,7 @@ export default function UniversalOnboarding({
1046
926
  }
1047
927
  return acc;
1048
928
  }, {});
1049
- console.log('🔄 Syncing connected accounts from props:', propState);
929
+
1050
930
  try {
1051
931
  initialPlatformsRef.current = new Set(Object.keys(propState).filter(Boolean));
1052
932
  } catch (_) {}
@@ -1060,7 +940,7 @@ export default function UniversalOnboarding({
1060
940
  for (const k of disabled) {
1061
941
  if (k) merged[k] = false;
1062
942
  }
1063
- console.log('🔄 [sync] disabled:', Array.from(disabled), 'result ChatGPT:', merged['ChatGPT']);
943
+
1064
944
  // Deep-equality check: skip state update if values haven't actually changed.
1065
945
  // Without this, identical values create new object references, triggering the
1066
946
  // persistence useEffect and causing unnecessary re-renders.
@@ -1202,7 +1082,7 @@ export default function UniversalOnboarding({
1202
1082
  // Otherwise a stale/partial `initialConnectedAccounts` prop from the parent can
1203
1083
  // overwrite the fuller localStorage snapshot before we merge it back in.
1204
1084
  if (!initialLoadDone.current) {
1205
- console.log('⏭️ Skipping persistence until initial connected-account rehydration completes');
1085
+
1206
1086
  return;
1207
1087
  }
1208
1088
 
@@ -1212,13 +1092,7 @@ export default function UniversalOnboarding({
1212
1092
  .map(([k]) => canonicalizePlatformName(k))
1213
1093
  .filter(Boolean);
1214
1094
 
1215
- console.log('💾 Persistence useEffect triggered.', {
1216
- connectedAccounts,
1217
- keyCount: Object.keys(connectedAccounts).length,
1218
- connectedArray,
1219
- connectedCount: connectedArray.length,
1220
- initialLoadDone: !!initialLoadDone.current,
1221
- });
1095
+
1222
1096
 
1223
1097
  // IMPORTANT:
1224
1098
  // - We used to skip persistence when empty to avoid auto-toggling for new users on first mount.
@@ -1236,11 +1110,7 @@ export default function UniversalOnboarding({
1236
1110
  const inPendingOAuth =
1237
1111
  pending && Number.isFinite(pendingTs) && (Date.now() - pendingTs < 10 * 60 * 1000); // 10min window
1238
1112
  if (connectedArray.length === 0 && (inRecentOAuthFlow || inPendingOAuth)) {
1239
- console.log('⏭️ Skipping persistence (empty state during OAuth - preventing data loss)', {
1240
- inRecentOAuthFlow,
1241
- inPendingOAuth,
1242
- pending,
1243
- });
1113
+
1244
1114
  return;
1245
1115
  }
1246
1116
 
@@ -1255,10 +1125,10 @@ export default function UniversalOnboarding({
1255
1125
 
1256
1126
  userData.connectedAccounts = nextConnectedArray;
1257
1127
  localStorage.setItem('onairosUser', JSON.stringify(userData));
1258
- console.log('✅ Auto-persisted connected accounts:', nextConnectedArray);
1128
+
1259
1129
  notifyConnectedAccountsUpdate();
1260
1130
  } catch (e) {
1261
- console.error('❌ Error auto-persisting connected accounts:', e);
1131
+ console.error('[Onairos] Request failed.');
1262
1132
  }
1263
1133
  }, [connectedAccounts]);
1264
1134
 
@@ -1357,7 +1227,7 @@ export default function UniversalOnboarding({
1357
1227
  if (!isWrappedApp && !isValentineApp && !isLunarApp) return;
1358
1228
  const targetPlatforms = isWrappedApp ? wrappedPlatforms : (isValentineApp ? valentinePlatforms : lunarPlatforms);
1359
1229
  const allowed = new Set(targetPlatforms.map((p) => p.name));
1360
-
1230
+
1361
1231
  if (!allowed.has(selected)) {
1362
1232
  // For wrapped/valentine/lunar apps, set a valid default selection if current one is invalid
1363
1233
  // Do NOT set connectedAccounts state here, just the UI selection
@@ -1371,7 +1241,7 @@ export default function UniversalOnboarding({
1371
1241
  try {
1372
1242
  const platform = e?.detail?.platform;
1373
1243
  if (!platform) return;
1374
- console.log(`⚡️ Event received: OAuth success for ${platform}`);
1244
+
1375
1245
  const plat = resolvePlatform(platform);
1376
1246
  if (plat) {
1377
1247
  addConnectedPlatform(plat.name, 'event');
@@ -1405,9 +1275,9 @@ export default function UniversalOnboarding({
1405
1275
  // Note: OnairosButton cleans up URL params, so we might check sessionStorage set by it
1406
1276
  const sessionSuccess = sessionStorage.getItem('onairos_oauth_return_success');
1407
1277
  const sessionPlatform = sessionStorage.getItem('onairos_oauth_return_platform');
1408
-
1278
+
1409
1279
  if (sessionSuccess === 'true' && sessionPlatform) {
1410
- console.log(`✅ ${sessionPlatform} OAuth detected via session signal`);
1280
+
1411
1281
  // Guard: in rare edge cases the bundled function ref can be corrupted; don’t crash.
1412
1282
  if (typeof markConnectedByConnector === 'function') {
1413
1283
  markConnectedByConnector(sessionPlatform, 'session');
@@ -1423,28 +1293,28 @@ export default function UniversalOnboarding({
1423
1293
  // 2. Fallback to existing localStorage logic (same-domain or preserved state)
1424
1294
  const oauthContext = localStorage.getItem('onairos_oauth_context');
1425
1295
  const platformConnector = localStorage.getItem('onairos_oauth_platform');
1426
-
1296
+
1427
1297
  // Only process if we're coming back from platform connector flow
1428
1298
  if (oauthContext === 'platform-connector' && platformConnector) {
1429
1299
  const localStorageKey = `onairos_${platformConnector}_success`;
1430
1300
  const timestampKey = `onairos_${platformConnector}_timestamp`;
1431
1301
  const success = localStorage.getItem(localStorageKey);
1432
1302
  const timestamp = localStorage.getItem(timestampKey);
1433
-
1303
+
1434
1304
  if (success === 'true' && timestamp) {
1435
1305
  const timestampNum = parseInt(timestamp, 10);
1436
1306
  const now = Date.now();
1437
-
1307
+
1438
1308
  // Only process if timestamp is recent (within last 30 seconds)
1439
1309
  if (now - timestampNum < 30000) {
1440
- console.log(`✅ ${platformConnector} OAuth completed - processing redirect back`);
1441
-
1310
+
1311
+
1442
1312
  // Find platform by connector
1443
1313
  const plat = (allPlatforms || []).find((p) => p.connector === platformConnector);
1444
1314
  if (plat) {
1445
1315
  addConnectedPlatform(plat.name, 'context');
1446
1316
  }
1447
-
1317
+
1448
1318
  // Clean up localStorage
1449
1319
  localStorage.removeItem(localStorageKey);
1450
1320
  localStorage.removeItem(timestampKey);
@@ -1479,7 +1349,7 @@ export default function UniversalOnboarding({
1479
1349
  return false;
1480
1350
  } catch (err) {
1481
1351
  try {
1482
- console.warn('⚠️ checkOAuthSuccess failed (non-fatal):', err);
1352
+
1483
1353
  } catch (_) {}
1484
1354
  return false;
1485
1355
  }
@@ -1490,7 +1360,7 @@ export default function UniversalOnboarding({
1490
1360
  try {
1491
1361
  const _cap = typeof window !== 'undefined' ? window.Capacitor : undefined;
1492
1362
  const _keys = Object.keys(_cap?.Plugins || {});
1493
- console.log('🔍 [mount] Capacitor plugins:', _keys, 'isNative:', !!_cap?.isNativePlatform?.());
1363
+
1494
1364
  } catch (_) {}
1495
1365
 
1496
1366
  // CRITICAL (mobile web): returning from same-tab OAuth remounts this component.
@@ -1498,7 +1368,7 @@ export default function UniversalOnboarding({
1498
1368
  // We therefore MERGE persisted connections into current state (current state wins if it already has OAuth updates).
1499
1369
  try {
1500
1370
  const userData = JSON.parse(localStorage.getItem('onairosUser') || '{}');
1501
- console.log('🔄 UniversalOnboarding mount: Loading persisted accounts from localStorage:', userData.connectedAccounts);
1371
+
1502
1372
  if (userData.connectedAccounts && Array.isArray(userData.connectedAccounts)) {
1503
1373
  // Convert array to object format
1504
1374
  const accountsObj = userData.connectedAccounts.reduce((acc, platform) => {
@@ -1510,7 +1380,7 @@ export default function UniversalOnboarding({
1510
1380
  for (const k of disabled) {
1511
1381
  if (k) delete accountsObj[k];
1512
1382
  }
1513
- console.log('✅ Loaded connected accounts:', accountsObj);
1383
+
1514
1384
 
1515
1385
  // If props didn't provide an initial baseline, derive it from persisted connected accounts
1516
1386
  // so we can detect removals (disconnects) as well as additions.
@@ -1529,20 +1399,20 @@ export default function UniversalOnboarding({
1529
1399
  return merged;
1530
1400
  });
1531
1401
  } else {
1532
- console.log('⚠️ No valid connectedAccounts in localStorage');
1402
+
1533
1403
  // CRITICAL: avoid auto-toggles for new users.
1534
1404
  // But also: do NOT wipe in-memory state (e.g. if OAuth already updated it).
1535
1405
  setConnectedAccounts((currentState) => (currentState && Object.keys(currentState).length ? currentState : {}));
1536
1406
  }
1537
1407
  } catch (error) {
1538
- console.error('❌ Failed to load persisted connected accounts:', error);
1408
+ console.error('[Onairos] Request failed.');
1539
1409
  }
1540
-
1410
+
1541
1411
  initialLoadDone.current = true;
1542
-
1412
+
1543
1413
  // THEN: Check for OAuth success (which will ADD to existing connections)
1544
1414
  checkOAuthSuccess();
1545
-
1415
+
1546
1416
  // Legacy: Load OAuth platform returns (for backward compatibility)
1547
1417
  const p = localStorage.getItem('onairos_oauth_platform');
1548
1418
  if (p && !localStorage.getItem('onairos_oauth_context')) {
@@ -1560,12 +1430,12 @@ export default function UniversalOnboarding({
1560
1430
  } else {
1561
1431
  localStorage.removeItem('onairos_oauth_platform');
1562
1432
  localStorage.removeItem('onairos_oauth_return');
1563
-
1433
+
1564
1434
  const canonical = canonicalizePlatformName(p);
1565
1435
  addConnectedPlatform(canonical, 'legacy');
1566
1436
  }
1567
1437
  }
1568
-
1438
+
1569
1439
  return () => {
1570
1440
  if (typeof window !== 'undefined') {
1571
1441
  if (typeof handleAuthSuccess === 'function') {
@@ -1663,18 +1533,18 @@ export default function UniversalOnboarding({
1663
1533
 
1664
1534
  // IMPORTANT: do NOT optimistically mark as connected before OAuth completes.
1665
1535
  // Otherwise users can hit "Update" and persist a fake connection.
1666
- console.log(`🔌 Connecting to ${name} - starting OAuth (no optimistic connected state)`);
1536
+
1667
1537
  setIsConnecting(true);
1668
1538
  setConnectingPlatform(name);
1669
-
1539
+
1670
1540
  // BYPASS: Twitter endpoint is 404, so just keep toggle ON without API call
1671
1541
  if (name === 'Twitter') {
1672
- console.log('🐦 Twitter: Bypassing API call (endpoint not available), keeping toggle ON');
1542
+
1673
1543
  setIsConnecting(false);
1674
1544
  setConnectingPlatform(null);
1675
1545
  return true;
1676
1546
  }
1677
-
1547
+
1678
1548
  // IMPORTANT: Backend connectors (notably Reddit) validate the Onairos account by username/email.
1679
1549
  // If we accidentally send the fallback 'user@example.com', the backend will respond with
1680
1550
  // `oauth-callback.html?success=false&error=Account%20Doesn%27t%20Exist` even when the user exists.
@@ -1749,7 +1619,7 @@ export default function UniversalOnboarding({
1749
1619
  : resolvedUsername;
1750
1620
 
1751
1621
  if (!resolvedUsername) {
1752
- console.warn('⚠️ No username/email available for OAuth authorize payload; aborting connect to avoid backend Account Does Not Exist.');
1622
+
1753
1623
  throw new Error('missing username');
1754
1624
  }
1755
1625
 
@@ -1850,7 +1720,7 @@ export default function UniversalOnboarding({
1850
1720
  return raw;
1851
1721
  }
1852
1722
  };
1853
-
1723
+
1854
1724
  const isMobileBrowser = typeof navigator !== 'undefined' &&
1855
1725
  /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
1856
1726
 
@@ -1890,9 +1760,9 @@ export default function UniversalOnboarding({
1890
1760
  isCapacitorNative,
1891
1761
  isTikTokInAppBrowser,
1892
1762
  });
1893
-
1763
+
1894
1764
  if (isSafariDesktop) {
1895
- console.log('🦁 Safari Desktop detected: using mobile OAuth flow (new tab + redirect) instead of popup');
1765
+
1896
1766
  }
1897
1767
 
1898
1768
  // Mobile webviews/emulators generally use same-tab OAuth and rely on the return markers below
@@ -1949,7 +1819,7 @@ export default function UniversalOnboarding({
1949
1819
  bridgeTab.document.write(bridgeHtml);
1950
1820
  bridgeTab.document.close();
1951
1821
  } catch (writeErr) {
1952
- console.warn('Failed to write bridge HTML into popup, will rely on storage poll only:', writeErr);
1822
+
1953
1823
  }
1954
1824
  } else {
1955
1825
  bridgeKey = null;
@@ -1965,7 +1835,7 @@ export default function UniversalOnboarding({
1965
1835
  }
1966
1836
 
1967
1837
  let returnUrl = ''; // Default to empty for Desktop Web
1968
-
1838
+
1969
1839
  // SDK parity: Capacitor native should behave like mobile web.
1970
1840
  // Same-tab mobile OAuth must send a return URL; otherwise the hosted
1971
1841
  // oauth-callback page can complete successfully but strand the browser there.
@@ -2086,7 +1956,7 @@ export default function UniversalOnboarding({
2086
1956
 
2087
1957
  // TIER 2: Use User JWT for OAuth connections
2088
1958
  if (!isUserAuthenticated()) {
2089
- console.error('[UniversalOnboarding] User not authenticated - cannot connect');
1959
+ console.error('[Onairos] Request failed.');
2090
1960
  throw new Error('User not authenticated');
2091
1961
  }
2092
1962
 
@@ -2172,7 +2042,7 @@ export default function UniversalOnboarding({
2172
2042
  // Retry connector authorize with developer auth, but KEEP the user JWT.
2173
2043
  // Wiping it here breaks later steps that require the user token
2174
2044
  // (store-pin, training) and silently strands the user on PIN setup.
2175
- console.warn(`⚠️ ${plat.connector} authorize got JWT_INVALID. Retrying with developer auth (preserving user token).`);
2045
+
2176
2046
 
2177
2047
  res = await fetch(`${connectorBaseUrl}/${plat.connector}/authorize`, {
2178
2048
  method: 'POST',
@@ -2253,7 +2123,7 @@ export default function UniversalOnboarding({
2253
2123
  ]));
2254
2124
 
2255
2125
  let oauthUrl = null;
2256
-
2126
+
2257
2127
  // Fallback: Check for URL in data object (case-insensitive)
2258
2128
  if (!oauthUrl) {
2259
2129
  const keys = Object.keys(data);
@@ -2304,9 +2174,9 @@ export default function UniversalOnboarding({
2304
2174
 
2305
2175
  oauthUrl = findOauthUrl(data);
2306
2176
  }
2307
-
2177
+
2308
2178
  if (!oauthUrl) {
2309
- console.error(`❌ No URL found for ${plat.connector} in response:`, data);
2179
+ console.error('[Onairos] Request failed.');
2310
2180
  addOauthDebug('oauth-url:missing', {
2311
2181
  keys: data && typeof data === 'object' ? Object.keys(data).slice(0, 20) : [],
2312
2182
  });
@@ -2551,7 +2421,7 @@ export default function UniversalOnboarding({
2551
2421
  localStorage.setItem('onairos_oauth_context_ts', Date.now().toString());
2552
2422
  localStorage.setItem('onairos_oauth_platform', plat.connector);
2553
2423
  try { sessionStorage.setItem('onairos_in_onboarding_flow', 'true'); } catch (_) {}
2554
- console.log(`📌 Stored return URL for ${plat.connector}:`, returnUrlToStore);
2424
+
2555
2425
  } catch (e) {
2556
2426
  // ignore storage failures
2557
2427
  }
@@ -2607,7 +2477,7 @@ export default function UniversalOnboarding({
2607
2477
  // - Our `oauth-callback.html` will redirect to a deep link (returnUrl) to bring the user back.
2608
2478
  if (isCapacitorNative) {
2609
2479
  const targetUrl = normalizeRedditMobileOAuthUrl(withMobileReturnUrl(oauthUrl));
2610
- console.log(`📱 Capacitor Native: opening system browser for ${plat.connector} OAuth`);
2480
+
2611
2481
 
2612
2482
  // Make sure the UI doesn't get stuck disabled while the user completes OAuth in the browser.
2613
2483
  setIsConnecting(false);
@@ -2741,7 +2611,7 @@ export default function UniversalOnboarding({
2741
2611
  if (!resp.ok) return false;
2742
2612
  const data = await resp.json();
2743
2613
  if (isPlatformConnectedFromAccountStatus(data)) {
2744
- console.log(`✅ Capacitor: ${plat.name} connected via backend poll; closing OAuth browser`);
2614
+
2745
2615
  markCapacitorOauthConnected('capacitor-backend-poll');
2746
2616
  return true;
2747
2617
  }
@@ -2773,7 +2643,7 @@ export default function UniversalOnboarding({
2773
2643
  (() => { try { return sessionStorage.getItem('onairos_oauth_return_success') === 'true' &&
2774
2644
  sessionStorage.getItem('onairos_oauth_return_platform') === plat.connector; } catch { return false; } })();
2775
2645
  if (dlHandled) {
2776
- console.log(`📱 Capacitor: browserFinished for ${plat.name} — already handled by deep link`);
2646
+
2777
2647
  return;
2778
2648
  }
2779
2649
  // Read the pending platform marker set just before the browser was opened.
@@ -2782,7 +2652,7 @@ export default function UniversalOnboarding({
2782
2652
  const isRecentPending = !!pendingConnector && (Date.now() - pendingTs < 10 * 60 * 1000);
2783
2653
  if (!isRecentPending || pendingConnector !== plat.connector) return;
2784
2654
 
2785
- console.log(`📱 Capacitor: browserFinished for ${plat.name}; checking backend truth`);
2655
+
2786
2656
  setTimeout(() => { void checkCapacitorBackendCompletion(); }, 300);
2787
2657
  };
2788
2658
  try {
@@ -2794,7 +2664,7 @@ export default function UniversalOnboarding({
2794
2664
  capBrowserFinishedHandle = listenerResult;
2795
2665
  }
2796
2666
  } catch (listenerErr) {
2797
- console.warn('⚠️ Capacitor: could not add browserFinished listener:', listenerErr);
2667
+
2798
2668
  }
2799
2669
  }
2800
2670
 
@@ -2852,7 +2722,7 @@ export default function UniversalOnboarding({
2852
2722
  // NOTE: this will temporarily navigate away from the SDK/modal, and `onairosButton.jsx`
2853
2723
  // will restore onboarding on return using the stored `onairos_post_oauth_flow` markers.
2854
2724
  if (preferSameTabOAuth) {
2855
- console.log(`📱 Mobile: preferSameTabOAuth enabled for ${plat.connector} → navigating same tab`);
2725
+
2856
2726
  // IMPORTANT:
2857
2727
  // For same-tab OAuth (Valentine/Reddit), do NOT route through `/oauth-bridge.html`.
2858
2728
  // In mobile simulator / iOS UA emulation, the bridge logic can hijack the navigation and
@@ -2882,7 +2752,7 @@ export default function UniversalOnboarding({
2882
2752
  // Mobile: DO NOT navigate this tab away (it makes the SDK look like it "closed").
2883
2753
  // Instead open OAuth in a new tab and keep UniversalOnboarding visible here while we listen/poll
2884
2754
  // for the completion signal (written to localStorage when the OAuth-return tab loads the app).
2885
- console.log(`📱 Mobile browser detected: opening ${plat.connector} OAuth in a new tab (keeping modal open)`);
2755
+
2886
2756
 
2887
2757
  // Store return URL and context for redirect back
2888
2758
  let returnUrl = stripOnairosOauthParams(window.location.href);
@@ -2891,7 +2761,7 @@ export default function UniversalOnboarding({
2891
2761
  localStorage.setItem('onairos_oauth_context', 'platform-connector');
2892
2762
  localStorage.setItem('onairos_oauth_context_ts', Date.now().toString());
2893
2763
  localStorage.setItem('onairos_oauth_platform', plat.connector);
2894
- console.log(`📌 Stored return URL for ${plat.connector}:`, returnUrl);
2764
+
2895
2765
 
2896
2766
  const localStorageKey = `onairos_${plat.connector}_success`;
2897
2767
  const timestampKey = `onairos_${plat.connector}_timestamp`;
@@ -3044,7 +2914,7 @@ export default function UniversalOnboarding({
3044
2914
  if (!resp.ok) return;
3045
2915
  const data = await resp.json();
3046
2916
  if (isPlatformConnectedFromAccountStatus(data)) {
3047
- console.log(`✅ Connected ${plat.name} (backend poll)`);
2917
+
3048
2918
  finishSuccess();
3049
2919
  }
3050
2920
  } catch (_) {
@@ -3096,7 +2966,7 @@ export default function UniversalOnboarding({
3096
2966
 
3097
2967
  // If we *do* have a handle and it looks closed, we likely failed to open anything; fall back.
3098
2968
  if (bridgeTab && typeof bridgeTab.closed === 'boolean' && bridgeTab.closed) {
3099
- console.warn(`⚠️ ${plat.connector} bridge tab handle exists but is closed - falling back`);
2969
+
3100
2970
  } else {
3101
2971
  // Assume the bridge tab is (or was) opened and will redirect once it reads storage.
3102
2972
  // Keep the modal open here and let the storage/poll completion logic resolve.
@@ -3106,7 +2976,7 @@ export default function UniversalOnboarding({
3106
2976
 
3107
2977
  // If we couldn't establish a bridge key (or the bridge appears closed), we can no longer reliably open a new tab (async).
3108
2978
  // Best-effort: try opening anyway, otherwise fall back to same-tab navigation.
3109
- console.warn(`⚠️ ${plat.connector} popup/tab was blocked - attempting fallback open; may require same-tab OAuth`);
2979
+
3110
2980
  let opened = null;
3111
2981
  try {
3112
2982
  opened = window.open(fallbackOpenUrl, '_blank');
@@ -3117,7 +2987,7 @@ export default function UniversalOnboarding({
3117
2987
  if (!opened || opened.closed || typeof opened.closed === 'undefined') {
3118
2988
  // Last resort: same-tab navigation so the user can still connect.
3119
2989
  // We will re-open UniversalOnboarding on return via `onairosButton.jsx` oauth restore logic.
3120
- console.warn(`⚠️ ${plat.connector} fallback tab also blocked - falling back to same-tab OAuth (modal will disappear during OAuth)`);
2990
+
3121
2991
  setConnectError(
3122
2992
  'Pop-up blocked. Falling back to in-page OAuth. The modal will return after you finish connecting.'
3123
2993
  );
@@ -3136,7 +3006,7 @@ export default function UniversalOnboarding({
3136
3006
  const height = 700;
3137
3007
  const left = window.screenX + (window.outerWidth - width) / 2;
3138
3008
  const top = window.screenY + (window.outerHeight - height) / 2;
3139
-
3009
+
3140
3010
  const popup = window.open(
3141
3011
  oauthUrl,
3142
3012
  'onairos_oauth_popup',
@@ -3145,7 +3015,7 @@ export default function UniversalOnboarding({
3145
3015
 
3146
3016
  if (popup) markOauthWindowLaunched();
3147
3017
  if (!popup || popup.closed || typeof popup.closed === 'undefined') {
3148
- console.warn(`⚠️ ${plat.connector} popup blocked, falling back to full-page redirect`);
3018
+
3149
3019
  setIsConnecting(false);
3150
3020
  setConnectingPlatform(null);
3151
3021
  markOauthWindowLaunched();
@@ -3162,19 +3032,19 @@ export default function UniversalOnboarding({
3162
3032
  event.origin.includes('onairos.uk') ||
3163
3033
  event.origin.includes('localhost') ||
3164
3034
  event.origin.includes('127.0.0.1');
3165
-
3035
+
3166
3036
  if (!isAllowed) {
3167
- console.log(`⚠️ Ignoring postMessage from unknown origin: ${event.origin}`);
3037
+
3168
3038
  return;
3169
3039
  }
3170
3040
 
3171
3041
  if (event.data && event.data.type === 'oauth-success' && (event.data.platform === plat.connector || event.data.platform === name)) {
3172
- console.log(`✅ ${plat.connector} OAuth success received via postMessage:`, event.data);
3042
+
3173
3043
  window.removeEventListener('message', messageHandler);
3174
3044
  clearInterval(pollInterval);
3175
3045
  setIsConnecting(false);
3176
3046
  setConnectingPlatform(null);
3177
-
3047
+
3178
3048
  // Mark connected ONLY after actual OAuth success.
3179
3049
  addConnectedPlatform(plat.name, 'postMessage');
3180
3050
 
@@ -3186,26 +3056,26 @@ export default function UniversalOnboarding({
3186
3056
  localStorage.removeItem('onairos_oauth_platform');
3187
3057
  localStorage.removeItem('onairos_return_url');
3188
3058
  } catch (e) {}
3189
-
3059
+
3190
3060
  // Close popup immediately
3191
3061
  try {
3192
3062
  if (popup && !popup.closed) {
3193
3063
  popup.close();
3194
- console.log('🚪 Closed popup via postMessage handler');
3064
+
3195
3065
  }
3196
3066
  } catch (e) {
3197
3067
  // Ignore errors closing popup
3198
3068
  }
3199
3069
  } else if (event.data && event.data.type === 'oauth-failure' && (event.data.platform === plat.connector || event.data.platform === name)) {
3200
- console.warn(`❌ ${plat.connector} OAuth failure received via postMessage:`, event.data);
3070
+
3201
3071
  window.removeEventListener('message', messageHandler);
3202
3072
  clearInterval(pollInterval);
3203
-
3073
+
3204
3074
  // Revert state
3205
3075
  setIsConnecting(false);
3206
3076
  setConnectingPlatform(null);
3207
3077
  setConnectedAccounts((s) => ({ ...s, [plat.name]: false }));
3208
-
3078
+
3209
3079
  // Clean up
3210
3080
  try {
3211
3081
  localStorage.removeItem(localStorageKey);
@@ -3236,7 +3106,7 @@ export default function UniversalOnboarding({
3236
3106
 
3237
3107
  const pollInterval = setInterval(() => {
3238
3108
  pollCount++;
3239
-
3109
+
3240
3110
  try {
3241
3111
  // Check if popup is closed (works for popups, not tabs)
3242
3112
  if (popup.closed && pollCount > 10) {
@@ -3244,7 +3114,7 @@ export default function UniversalOnboarding({
3244
3114
  window.removeEventListener('message', messageHandler);
3245
3115
  setIsConnecting(false);
3246
3116
  setConnectingPlatform(null);
3247
- console.log(`⚠️ ${plat.connector} popup was closed`);
3117
+
3248
3118
  return;
3249
3119
  }
3250
3120
 
@@ -3252,17 +3122,17 @@ export default function UniversalOnboarding({
3252
3122
  const success = localStorage.getItem(localStorageKey);
3253
3123
  const timestamp = localStorage.getItem(timestampKey);
3254
3124
  const errorSignal = localStorage.getItem(`onairos_${plat.connector}_error`);
3255
-
3125
+
3256
3126
  if (errorSignal) {
3257
- console.warn(`❌ ${plat.connector} error signal detected in localStorage`);
3127
+
3258
3128
  clearInterval(pollInterval);
3259
3129
  window.removeEventListener('message', messageHandler);
3260
-
3130
+
3261
3131
  // Revert state
3262
3132
  setIsConnecting(false);
3263
3133
  setConnectingPlatform(null);
3264
3134
  setConnectedAccounts((s) => ({ ...s, [plat.name]: false }));
3265
-
3135
+
3266
3136
  // Cleanup
3267
3137
  try {
3268
3138
  localStorage.removeItem(`onairos_${plat.connector}_error`);
@@ -3272,26 +3142,26 @@ export default function UniversalOnboarding({
3272
3142
  localStorage.removeItem('onairos_oauth_platform');
3273
3143
  localStorage.removeItem('onairos_return_url');
3274
3144
  } catch(e) {}
3275
-
3145
+
3276
3146
  // Close popup
3277
3147
  try {
3278
3148
  if (!popup.closed) popup.close();
3279
3149
  } catch(e) {}
3280
3150
  return;
3281
3151
  }
3282
-
3152
+
3283
3153
  if (success === 'true' && timestamp) {
3284
3154
  const timestampNum = parseInt(timestamp, 10);
3285
3155
  const now = Date.now();
3286
-
3156
+
3287
3157
  // Only process if timestamp is recent (within last 30 seconds)
3288
3158
  if (now - timestampNum < 30000) {
3289
- console.log(`✅ ${plat.connector} OAuth completed successfully`);
3159
+
3290
3160
  clearInterval(pollInterval);
3291
3161
  window.removeEventListener('message', messageHandler);
3292
3162
  setIsConnecting(false);
3293
3163
  setConnectingPlatform(null);
3294
-
3164
+
3295
3165
  // Mark connected ONLY after actual OAuth success.
3296
3166
  addConnectedPlatform(plat.name, 'localStorage poll');
3297
3167
 
@@ -3303,12 +3173,12 @@ export default function UniversalOnboarding({
3303
3173
  localStorage.removeItem('onairos_oauth_platform');
3304
3174
  localStorage.removeItem('onairos_return_url');
3305
3175
  } catch (e) {}
3306
-
3176
+
3307
3177
  // Close popup immediately
3308
3178
  try {
3309
3179
  if (!popup.closed) {
3310
3180
  popup.close();
3311
- console.log('🚪 Closed popup via localStorage polling');
3181
+
3312
3182
  }
3313
3183
  } catch (e) {
3314
3184
  // Ignore errors closing popup
@@ -3323,8 +3193,8 @@ export default function UniversalOnboarding({
3323
3193
  window.removeEventListener('message', messageHandler);
3324
3194
  setIsConnecting(false);
3325
3195
  setConnectingPlatform(null);
3326
- console.log(`⏳ [TIMEOUT] ${plat.connector} OAuth polling timed out after 5 minutes`);
3327
-
3196
+
3197
+
3328
3198
  // Try to close popup if still open
3329
3199
  try {
3330
3200
  if (!popup.closed) {
@@ -3335,7 +3205,7 @@ export default function UniversalOnboarding({
3335
3205
  }
3336
3206
  }
3337
3207
  } catch (error) {
3338
- console.error(`Error in ${plat.connector} OAuth polling:`, error);
3208
+ console.error('[Onairos] Request failed.');
3339
3209
  }
3340
3210
  }, 1000);
3341
3211
 
@@ -3349,18 +3219,7 @@ export default function UniversalOnboarding({
3349
3219
  }
3350
3220
  })();
3351
3221
  // iOS WebView sometimes prints Error objects as `{}`; log useful details explicitly.
3352
- console.error(`❌ Error connecting to ${name}:`, {
3353
- message,
3354
- name: e?.name,
3355
- stack: e?.stack,
3356
- props: (() => {
3357
- try {
3358
- return e ? Object.getOwnPropertyNames(e) : [];
3359
- } catch {
3360
- return [];
3361
- }
3362
- })(),
3363
- });
3222
+ console.error('[Onairos] Request failed.');
3364
3223
  try {
3365
3224
  setConnectError(message);
3366
3225
  } catch (_) {}
@@ -3372,13 +3231,14 @@ export default function UniversalOnboarding({
3372
3231
  }
3373
3232
 
3374
3233
  const handleSwitch = async (name) => {
3234
+ if (!allPlatforms.some(platform => platform.name === name)) return;
3375
3235
  setConnectError('');
3376
3236
  // Mobile: only disable *non-bookmarklet* AI links that have no supported connect flow on mobile.
3377
3237
  // ChatGPT, Claude, Gemini, and Grok have mobile-safe connect modals now, so they MUST remain toggleable.
3378
3238
  // Capacitor native has native connect flows for Claude; Grok is hidden entirely on Capacitor.
3379
3239
  const aiNoopOnMobile = isNativePlatform ? [] : [];
3380
3240
  if (isMobile && aiNoopOnMobile.includes(name)) {
3381
- console.log(`📱 ${name} disabled on mobile - no action`);
3241
+
3382
3242
  return;
3383
3243
  }
3384
3244
  if (isConnecting && connectingPlatform !== name) return;
@@ -3423,10 +3283,10 @@ export default function UniversalOnboarding({
3423
3283
  // Toggle OFF - disconnect from backend AND local state
3424
3284
  setConnectedAccounts((currentState) => {
3425
3285
  const updated = { ...currentState, [name]: false };
3426
- console.log(`🔴 Disconnected ${name}`);
3286
+
3427
3287
  return updated;
3428
3288
  });
3429
-
3289
+
3430
3290
  try {
3431
3291
  const baseUrl = (typeof window !== 'undefined' && window.onairosBaseUrl) || API_CONFIG.getBaseUrl();
3432
3292
  const userToken = localStorage.getItem('onairos_user_token');
@@ -3496,21 +3356,21 @@ export default function UniversalOnboarding({
3496
3356
  try { sessionStorage.setItem('onairos_force_fresh_next_dashboard', Date.now().toString()); } catch (_) {}
3497
3357
  return;
3498
3358
  }
3499
-
3359
+
3500
3360
  if (!userIdentifier) {
3501
- console.warn(`⚠️ Cannot revoke ${name} - no user identifier found`);
3361
+
3502
3362
  return;
3503
3363
  }
3504
-
3364
+
3505
3365
  // Prefer platform-specific revoke endpoints (critical for X/Twitter)
3506
- console.log(`🔴 Disconnecting via platform endpoint for ${name} (${connector})...`);
3366
+
3507
3367
  const disconnectResult = await disconnectPlatform(String(connector), userIdentifier);
3508
3368
  if (!disconnectResult?.success) {
3509
- console.warn(`⚠️ Disconnect failed for ${name} (${connector}):`, disconnectResult);
3369
+
3510
3370
  // ChatGPT is special: if the revoke endpoint fails (network/CORS/env mismatch),
3511
3371
  // we still allow the user to untoggle locally and force dashboards to refresh without it.
3512
3372
  if (String(connector).toLowerCase() === 'chatgpt') {
3513
- console.warn('🤖 ChatGPT disconnect failed; keeping local toggle OFF and marking for refresh.');
3373
+
3514
3374
  try {
3515
3375
  const u = JSON.parse(localStorage.getItem('onairosUser') || '{}');
3516
3376
  const next = Array.isArray(u.connectedAccounts)
@@ -3531,12 +3391,12 @@ export default function UniversalOnboarding({
3531
3391
  setConnectedAccounts((s) => ({ ...s, [name]: true }));
3532
3392
  return;
3533
3393
  }
3534
- console.log(`✅ Backend disconnect successful for ${name} (${connector})`);
3535
-
3394
+
3395
+
3536
3396
  // CRITICAL FIX: Invalidate cached dashboard after disconnect
3537
3397
  // The backend should do this automatically, but we force it here as a workaround
3538
3398
  // for the bug where revoke doesn't invalidate the dashboard cache
3539
- console.log(`🗑️ Invalidating cached dashboard for ${userIdentifier}...`);
3399
+
3540
3400
  try {
3541
3401
  await fetch(`${baseUrl}/invalidate-dashboard-cache`, {
3542
3402
  method: 'POST',
@@ -3549,9 +3409,9 @@ export default function UniversalOnboarding({
3549
3409
  reason: `Disconnected ${name}`
3550
3410
  })
3551
3411
  });
3552
- console.log(`✅ Dashboard cache invalidated for ${userIdentifier}`);
3412
+
3553
3413
  } catch (cacheError) {
3554
- console.warn(`⚠️ Failed to invalidate dashboard cache (non-critical):`, cacheError);
3414
+
3555
3415
  }
3556
3416
 
3557
3417
  // Refresh account status from backend and sync localStorage so DataRequest can't resurrect stale platforms
@@ -3597,14 +3457,14 @@ export default function UniversalOnboarding({
3597
3457
  notifyConnectedAccountsUpdate();
3598
3458
  } catch (_) {}
3599
3459
  } else {
3600
- console.log('ℹ️ /getAccountInfo/email non-OK; skipping connectedAccounts sync');
3460
+
3601
3461
  }
3602
3462
  }
3603
3463
  } catch (refreshErr) {
3604
- console.warn('⚠️ Failed to refresh account status after disconnect:', refreshErr);
3464
+
3605
3465
  }
3606
3466
  } catch (revokeError) {
3607
- console.warn(`⚠️ Backend disconnect failed for ${name}:`, revokeError);
3467
+
3608
3468
  // Revert UI to avoid mismatch
3609
3469
  setConnectedAccounts((s) => ({ ...s, [name]: true }));
3610
3470
  }
@@ -3613,7 +3473,7 @@ export default function UniversalOnboarding({
3613
3473
  try {
3614
3474
  sessionStorage.setItem('onairos_force_fresh_next_dashboard', Date.now().toString());
3615
3475
  } catch (_) {}
3616
-
3476
+
3617
3477
  return;
3618
3478
  }
3619
3479
  else {
@@ -3631,112 +3491,10 @@ export default function UniversalOnboarding({
3631
3491
  // ChatGPT/Gemini connect via modals (bookmarklet/instructions). This matches the internship-demo behavior.
3632
3492
  // Do not optimistically flip the toggle; we only mark connected after the modal detects completion.
3633
3493
 
3634
- // Capacitor native: ChatGPT uses a native WKWebView cookie+scrape flow.
3635
- // Try the native Capacitor plugin first; fall back to the bookmarklet connect modal if unavailable.
3636
- if (isNativePlatform && name === 'ChatGPT') {
3637
- const cap = typeof window !== 'undefined' ? window.Capacitor : undefined;
3638
- const pluginKeys = Object.keys(cap?.Plugins || {});
3639
- console.log('🔍 [ChatGPT] Capacitor plugins available:', pluginKeys);
3640
- // Try multiple ways to get the plugin (Capacitor 6-8 compatibility)
3641
- const plugin =
3642
- cap?.Plugins?.OnairosChatGPTNative ||
3643
- cap?.Plugins?.OnairosChatGPTNativePlugin ||
3644
- getCapacitorPlugin('OnairosChatGPTNative', 'OnairosChatGPTNativePlugin') ||
3645
- null;
3646
- console.log('🔍 [ChatGPT] plugin keys:', pluginKeys, 'found:', !!plugin, 'hasMethod:', typeof plugin?.connectChatGPTNative);
3647
- if (!plugin?.connectChatGPTNative) {
3648
- try { console.warn('⚠️ [ChatGPT] Native plugin not accessible. Keys:', pluginKeys); } catch (_) {}
3649
- setConnectError('');
3650
- setShowChatGPTModal(true);
3651
- return;
3652
- }
3653
-
3654
- setIsConnecting(true);
3655
- setConnectingPlatform(name);
3494
+ // Native chat imports discover titles, then wait for Smart Filter selection.
3495
+ if (isNativePlatform && (name === 'ChatGPT' || name === 'Claude')) {
3656
3496
  setConnectError('');
3657
- setNativeProgressText('Opening ChatGPT…');
3658
-
3659
- const userData = (() => {
3660
- try { return JSON.parse(localStorage.getItem('onairosUser') || '{}'); } catch { return {}; }
3661
- })();
3662
- const jwtToken =
3663
- (typeof localStorage !== 'undefined' && localStorage.getItem('onairos_user_token')) ||
3664
- userData.token ||
3665
- userData.jwt ||
3666
- '';
3667
-
3668
- const waitForDone = () =>
3669
- new Promise((resolve, reject) => {
3670
- let sub = null;
3671
- const cleanup = () => {
3672
- try { sub?.remove?.(); } catch (_) {}
3673
- };
3674
- try {
3675
- const r = plugin.addListener('onairosNativeConnectorEvent', (evt) => {
3676
- try {
3677
- const plat = String(evt?.platform || '').toLowerCase();
3678
- if (plat !== 'chatgpt') return;
3679
- const status = String(evt?.status || '');
3680
- // Update minimal UI text (Capacitor-only)
3681
- if (status === 'verifying_session') setNativeProgressText('Verifying session…');
3682
- else if (status === 'access_token_missing') setNativeProgressText('Still logging in…');
3683
- else if (status === 'authenticated') setNativeProgressText('Authenticated — starting scrape…');
3684
- else if (status === 'scraping_started') setNativeProgressText('Scraping your ChatGPT data…');
3685
- else if (status === 'success_conversations') setNativeProgressText('Saved conversations — fetching memories…');
3686
- else if (status === 'success_memories') setNativeProgressText('Saved memories — finishing…');
3687
- else if (status === 'done') setNativeProgressText('Done.');
3688
- else if (status === 'error') setNativeProgressText(evt?.message ? `Error: ${String(evt.message)}` : 'Error.');
3689
- else if (status) setNativeProgressText(status);
3690
-
3691
- // As soon as we have a successful backend write, reflect "connected" in the UI.
3692
- // This gives instant feedback even if we’re still finishing memories / cleanup.
3693
- if (status === 'success_conversations' || status === 'success_memories' || status === 'done') {
3694
- setConnectedAccounts((s) => ({ ...s, ChatGPT: true }));
3695
- }
3696
- if (status.startsWith('success') || status === 'done') {
3697
- cleanup();
3698
- resolve(evt);
3699
- }
3700
- if (status === 'error') {
3701
- cleanup();
3702
- reject(new Error(evt?.message || 'ChatGPT native scrape failed'));
3703
- }
3704
- } catch (_) {}
3705
- });
3706
- // Capacitor can return either a handle OR a Promise<handle> depending on runtime.
3707
- if (r && typeof r.then === 'function') {
3708
- r.then((s) => { sub = s; }).catch(() => resolve({ status: 'listener_unavailable' }));
3709
- } else {
3710
- sub = r;
3711
- }
3712
- } catch (_) {
3713
- // If listeners aren't supported, don't block the UI; treat connect call completion as best-effort.
3714
- resolve({ status: 'listener_unavailable' });
3715
- }
3716
- });
3717
-
3718
- try {
3719
- const donePromise = waitForDone();
3720
- await plugin.connectChatGPTNative({ jwtToken });
3721
- await donePromise;
3722
- setConnectedAccounts((s) => ({ ...s, ChatGPT: true }));
3723
-
3724
- // UX: show explicit "Connected" and close the native ChatGPT overlay,
3725
- // returning the user to UniversalOnboarding.
3726
- try { setNativeProgressText('Connected ✓'); } catch (_) {}
3727
- try { await plugin.closeChatGPTConnector?.(); } catch (_) {}
3728
- } catch (e) {
3729
- setConnectError(e?.message || String(e));
3730
- setConnectedAccounts((s) => ({ ...s, ChatGPT: false }));
3731
- setPendingTogglePlatform((prev) => (prev === 'ChatGPT' ? null : prev));
3732
- } finally {
3733
- setIsConnecting(false);
3734
- setConnectingPlatform(null);
3735
- // Keep the last progress text for a moment, then clear.
3736
- try {
3737
- setTimeout(() => setNativeProgressText(''), 2000);
3738
- } catch (_) {}
3739
- }
3497
+ setNativeChatImport({name,platform:name.toLowerCase()});
3740
3498
  return;
3741
3499
  }
3742
3500
 
@@ -3762,33 +3520,14 @@ export default function UniversalOnboarding({
3762
3520
  startHostedImport('claude', 'Claude');
3763
3521
  return;
3764
3522
  }
3765
- if (isNativePlatform && name === 'Spotify') {
3766
- await startNativeWebViewConnector({
3767
- displayName: 'Spotify',
3768
- platform: 'spotify',
3769
- pluginNames: ['OnairosSpotifyNative', 'OnairosSpotifyNativePlugin'],
3770
- methodName: 'connectSpotifyNative',
3771
- missingMessage:
3772
- 'Spotify uses the native WKWebView scraper in Capacitor. Install/register OnairosSpotifyNative instead of using /spotify/authorize.',
3773
- });
3774
- return;
3775
- }
3776
- if (isNativePlatform && name === 'Netflix') {
3777
- await startNativeWebViewConnector({
3778
- displayName: 'Netflix',
3779
- platform: 'netflix',
3780
- pluginNames: ['OnairosNetflixNative', 'OnairosNetflixNativePlugin'],
3781
- methodName: 'connectNetflixNative',
3782
- missingMessage:
3783
- 'Netflix uses the native WKWebView scraper in Capacitor. Install/register OnairosNetflixNative instead of using /netflix/authorize.',
3784
- });
3785
- return;
3523
+ if(isNativePlatform&&['Spotify','Netflix','Sephora','Instagram','InstagramData','Hinge'].includes(name)){
3524
+ setConnectError('');setNativeScraperImport({name,platform:['Instagram','InstagramData'].includes(name)?'instagram-data':name.toLowerCase()});return;
3786
3525
  }
3787
3526
  // Capacitor native: Claude uses native WKWebView cookie + scrape + backend sync (Flutter parity).
3788
3527
  if (isNativePlatform && name === 'Claude') {
3789
3528
  const plugin = getCapacitorPlugin('OnairosClaudeNative', 'OnairosClaudeNativePlugin') || null;
3790
3529
  if (!plugin?.connectClaudeNative) {
3791
- console.warn('⚠️ Claude native plugin not installed; falling back to OAuth');
3530
+
3792
3531
  // fall through to standard OAuth below
3793
3532
  } else {
3794
3533
 
@@ -3858,7 +3597,7 @@ export default function UniversalOnboarding({
3858
3597
  if (isNativePlatform && name === 'LinkedIn') {
3859
3598
  const plugin = getCapacitorPlugin('OnairosLinkedInNative', 'OnairosLinkedInNativePlugin') || null;
3860
3599
  if (!plugin?.connectLinkedInNative) {
3861
- console.warn('⚠️ LinkedIn native plugin not installed; falling back to OAuth');
3600
+
3862
3601
  // fall through to standard OAuth below
3863
3602
  } else {
3864
3603
 
@@ -3959,7 +3698,7 @@ export default function UniversalOnboarding({
3959
3698
  if (isNativePlatform) {
3960
3699
  const plugin = getCapacitorPlugin('OnairosInstagramNative', 'OnairosInstagramNativePlugin') || null;
3961
3700
  if (!plugin?.connectInstagramNative) {
3962
- console.warn('⚠️ Instagram native plugin not installed; falling back to data modal');
3701
+
3963
3702
  // fall through to setShowInstagramDataModal below
3964
3703
  } else {
3965
3704
 
@@ -4096,9 +3835,9 @@ export default function UniversalOnboarding({
4096
3835
 
4097
3836
  const triggerComplete = (data) => {
4098
3837
  if (onComplete) {
4099
- onComplete(data);
3838
+ return onComplete(data);
4100
3839
  } else {
4101
- console.warn('⚠️ onComplete prop is missing!');
3840
+
4102
3841
  }
4103
3842
  };
4104
3843
 
@@ -4138,6 +3877,33 @@ export default function UniversalOnboarding({
4138
3877
  `}
4139
3878
  </style>
4140
3879
 
3880
+ {nativeScraperImport&&<NativeScraperImport platform={nativeScraperImport.platform}
3881
+ onClose={()=>{setNativeScraperImport(null);setPendingTogglePlatform(null);}}
3882
+ onConnected={()=>{connectionMutationRef.current=true;setConnectedAccounts(previous=>({...previous,[nativeScraperImport.name]:true}));setNativeScraperImport(null);setPendingTogglePlatform(null);}}/>}
3883
+ {nativeChatImport&&<NativeChatImport platform={nativeChatImport.platform} rawOnly={!!rawMemoriesOnly}
3884
+ onClose={()=>{setNativeChatImport(null);setPendingTogglePlatform(null);setNativeProgressText('');}}
3885
+ onConnected={payload=>{
3886
+ const name=nativeChatImport.name;
3887
+ if(payload)onNativeRawImport?.(payload);
3888
+ connectionMutationRef.current=true;
3889
+ setConnectedAccounts(previous=>({...previous,[name]:true}));
3890
+ setNativeChatImport(null);setPendingTogglePlatform(null);setNativeProgressText('');
3891
+ }}/>}
3892
+ {isNativePlatform && !combineConsentWithOnboarding ? <NativeConnections
3893
+ platforms={platformsForUi} connected={connectedAccounts} selected={selected} onSelect={setSelected}
3894
+ onToggle={handleSwitch} pending={selectedIsPending || isConnecting} descriptions={descriptions}
3895
+ progress={nativeProgressText} error={connectError} rawOnly={rawMemoriesOnly} privacyPolicyUrl={privacyPolicyUrl}
3896
+ allowEmpty={allowContinueWithoutConnections}
3897
+ recommendedPlatforms={recommendedPlatforms}
3898
+ onContinue={() => {
3899
+ const connectedList = platformsForUi.filter(p => connectedAccounts[p.name]).map(p => p.name);
3900
+ if (!connectedList.length && !allowContinueWithoutConnections) return;
3901
+ const newlyConnected = connectedList.filter(p => !initialPlatformsRef.current.has(p));
3902
+ const removedPlatforms = Array.from(initialPlatformsRef.current).filter(p => !connectedList.includes(p));
3903
+ const hasNewPlatforms = newlyConnected.length > 0 || removedPlatforms.length > 0 || connectionMutationRef.current;
3904
+ return triggerComplete({connectedAccounts: connectedList, totalConnections: connectedList.length, newlyConnected, removedPlatforms, hasNewPlatforms, connectionMutated: hasNewPlatforms});
3905
+ }}
3906
+ /> : <>
4141
3907
  {/* persona as background (unchanged) */}
4142
3908
  <div aria-hidden style={{
4143
3909
  position: 'absolute',
@@ -4179,7 +3945,7 @@ export default function UniversalOnboarding({
4179
3945
  >
4180
3946
  {/* Nudge header/subheader up slightly on mobile without affecting layout below (transform doesn't affect flow). */}
4181
3947
  <div style={{ transform: combineConsentWithOnboarding ? 'translateY(-6px)' : (isMobile ? 'translateY(-16px)' : 'translateY(-10px)') }}>
4182
- <h1 className="text-2xl font-bold text-gray-900 mb-1 leading-tight" style={{ fontFamily: 'IBM Plex Sans, system-ui, sans-serif' }}>
3948
+ <h1 className="text-2xl font-bold text-gray-900 mb-1 leading-tight" style={{ fontFamily: '"Instrument Serif", "Times New Roman", serif', fontSize: 'clamp(37px, 7.7vw, 48px)', fontWeight: 400, letterSpacing: '-0.03em', lineHeight: 1.02 }}>
4183
3949
  Connect your apps
4184
3950
  </h1>
4185
3951
  {combineConsentWithOnboarding ? (
@@ -4266,10 +4032,10 @@ export default function UniversalOnboarding({
4266
4032
  const showConnectedStyling = on;
4267
4033
  const busy = false; // keep icon static visually per request
4268
4034
  const isSel = selected === p.name;
4269
-
4035
+
4270
4036
  // Debug: Log connection state for each platform
4271
4037
  if (on) {
4272
- console.log(`🔵 ${p.name} is connected:`, { on, showConnectedStyling, connectedAccounts });
4038
+
4273
4039
  }
4274
4040
  const shift = (currentPage === 1 ? idx : idx - 2) * 14;
4275
4041
  return (
@@ -4283,17 +4049,17 @@ export default function UniversalOnboarding({
4283
4049
  typeof window !== 'undefined' && window.Capacitor?.isNativePlatform?.() === true;
4284
4050
  const aiNoopOnMobile = isCapacitorNative ? [] : [];
4285
4051
  if (isMobile && aiNoopOnMobile.includes(p.connector)) {
4286
- console.log(`📱 ${p.name} disabled on mobile - no action`);
4052
+
4287
4053
  return;
4288
4054
  }
4289
4055
 
4290
4056
  setSelected(p.name);
4291
-
4057
+
4292
4058
  // Detect mobile browser (not Capacitor native)
4293
4059
  const isMobileBrowser = typeof window !== 'undefined' &&
4294
4060
  window.innerWidth <= 768 &&
4295
4061
  !isNativePlatform;
4296
-
4062
+
4297
4063
  // MOBILE BROWSER ONLY:
4298
4064
  // Keep old "Instagram disabled" behavior for non-Lunar apps, but Lunar explicitly needs Instagram.
4299
4065
  if (p.name === 'Instagram' && isMobileBrowser && !isLunarApp) {
@@ -4441,7 +4207,7 @@ export default function UniversalOnboarding({
4441
4207
  : 'We can continue with your verified email and prepare personalization in the background.'}
4442
4208
  </div>
4443
4209
  </div>
4444
-
4210
+
4445
4211
  {/* Capacitor-only: lightweight progress indicator for native ChatGPT scrape */}
4446
4212
  {isNativePlatform && selected === 'ChatGPT' && (isConnecting || nativeProgressText) && (
4447
4213
  <div className="mt-2 px-1 text-xs text-gray-600 flex items-center gap-2" style={{ fontFamily: 'Inter, system-ui, sans-serif' }}>
@@ -4527,7 +4293,7 @@ export default function UniversalOnboarding({
4527
4293
  const canContinue = combineConsentWithOnboarding
4528
4294
  ? hasConnections
4529
4295
  : (hasConnections || allowContinueWithoutConnections);
4530
-
4296
+
4531
4297
  return (
4532
4298
  <div
4533
4299
  className={`w-full rounded-full text-base font-medium flex items-center justify-center gap-2 transition-colors ${
@@ -4546,18 +4312,18 @@ export default function UniversalOnboarding({
4546
4312
  if (!canContinue) {
4547
4313
  return;
4548
4314
  }
4549
-
4315
+
4550
4316
  // Disable button immediately to prevent double-click
4551
4317
  e.currentTarget.style.pointerEvents = 'none';
4552
-
4318
+
4553
4319
  // Use setTimeout to ensure state is fully updated
4554
4320
  setTimeout(() => {
4555
-
4321
+
4556
4322
  const connectedList = Object.entries(connectedAccounts)
4557
4323
  .filter(([, v]) => !!v)
4558
4324
  .map(([k]) => canonicalizePlatformName(k))
4559
4325
  .filter(Boolean);
4560
-
4326
+
4561
4327
  // Detect platform changes (add/remove) for cache invalidation / dashboard regeneration
4562
4328
  const newlyConnected = connectedList.filter(p => !initialPlatformsRef.current.has(p));
4563
4329
  const removedPlatforms = Array.from(initialPlatformsRef.current).filter(
@@ -4574,7 +4340,7 @@ export default function UniversalOnboarding({
4574
4340
  removedPlatforms.length > 0 ||
4575
4341
  connectionMutationRef.current ||
4576
4342
  persistedMutation;
4577
-
4343
+
4578
4344
  triggerComplete({
4579
4345
  connectedAccounts: connectedList,
4580
4346
  totalConnections: connectedList.length,
@@ -4591,7 +4357,7 @@ export default function UniversalOnboarding({
4591
4357
  }
4592
4358
  : {})
4593
4359
  });
4594
-
4360
+
4595
4361
  // Re-enable button after a delay (in case user goes back)
4596
4362
  setTimeout(() => {
4597
4363
  if (e.currentTarget) {
@@ -4641,6 +4407,7 @@ export default function UniversalOnboarding({
4641
4407
  )}
4642
4408
  </div>
4643
4409
  </div>
4410
+ </>}
4644
4411
  {connectionToast ? (
4645
4412
  <div
4646
4413
  className="fixed left-1/2 top-5 z-[2147483647] -translate-x-1/2 rounded-full border border-emerald-300/40 bg-emerald-500/90 px-4 py-2 text-sm font-semibold text-white shadow-[0_16px_40px_rgba(16,185,129,0.35)] backdrop-blur-md"