@onairosofficial/onairos-capacitor 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CAPACITOR_QUICK_START.md +379 -0
- package/CONNECTORS.md +122 -0
- package/LICENSE +194 -10
- package/OnairosofficialOnairosCapacitor.podspec +13 -0
- package/Package.swift +26 -0
- package/README.md +176 -25
- package/dist/onairos.capacitor.esm.js +1 -0
- package/dist/onairos.capacitor.esm.turbopack.js +1 -0
- package/docs/CAPACITOR_INTEGRATION_GUIDE.md +159 -0
- package/docs/CAPACITOR_MOCK_APP_TESTING.md +213 -0
- package/docs/CAPACITOR_SDK_FIXES_SUMMARY.md +65 -0
- package/docs/CROSS_SDK_PARITY.md +239 -0
- package/docs/DATA_FREQUENCY.md +57 -0
- package/docs/DEVELOPER_SDK_CHANGES.md +532 -0
- package/docs/INCIDENT_ENABLETRAINING_PIN_WEB_8.1.9.md +82 -0
- package/docs/ONAIROS_BUTTON_PROPS.md +152 -0
- package/docs/PLATFORM_APIS.md +559 -0
- package/docs/RAW_MEMORIES_API.md +305 -0
- package/docs/RAW_MEMORIES_SDK_UPDATE.md +54 -0
- package/docs/SDK_PARITY_ROLLUP_2026_04_24_to_05_02.md +96 -0
- package/docs/oldFixes.md +216 -0
- package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosChatGPTNativePlugin.swift +993 -0
- package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosNetflixNativePlugin.swift +33 -0
- package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosSpotifyNativePlugin.swift +1082 -0
- package/onairos.d.ts +656 -0
- package/package.json +188 -37
- package/src/OnairosReconnectButton.jsx +272 -0
- package/src/RSA.jsx +57 -0
- package/src/assets/NewLogo.png +0 -0
- package/src/assets/OnairosNewLogo.png +0 -0
- package/src/assets/chatgpt-icon.png +0 -0
- package/src/assets/fire-horse.png +0 -0
- package/src/assets/fire-horse.transparent.png +0 -0
- package/src/assets/latest-firehorse.png +0 -0
- package/src/assets/perplexity.png +0 -0
- package/src/assets/persona.png +0 -0
- package/src/assets/persona1.png +0 -0
- package/src/assets/persona2.png +0 -0
- package/src/assets/persona3.png +0 -0
- package/src/assets/persona4.png +0 -0
- package/src/assets/persona5.png +0 -0
- package/src/capacitorConnectorCatalog.js +38 -0
- package/src/capacitorOAuthConfig.js +52 -0
- package/src/chatgptHostedImport/index.js +303 -0
- package/src/components/AuthButtons.jsx +48 -0
- package/src/components/ConnectChatGPTModal.jsx +666 -0
- package/src/components/ConnectClaudeModal.jsx +610 -0
- package/src/components/ConnectGeminiModal.jsx +639 -0
- package/src/components/ConnectGrokModal.jsx +701 -0
- package/src/components/ConnectPerplexityModal.jsx +726 -0
- package/src/components/DataExplainerScreen.jsx +349 -0
- package/src/components/DataRequest.js +885 -0
- package/src/components/DataRequest.jsx +1055 -0
- package/src/components/EmailAuth.js +1871 -0
- package/src/components/EmailAuth.jsx +2062 -0
- package/src/components/ExtensionInstallPrompt.jsx +142 -0
- package/src/components/GoogleButton.js +133 -0
- package/src/components/LLMConnectorManager.jsx +201 -0
- package/src/components/LoadingPage.jsx +19 -0
- package/src/components/LoadingScreen.jsx +81 -0
- package/src/components/LunarBirthdate.jsx +96 -0
- package/src/components/LunarLoadingPage.jsx +251 -0
- package/src/components/Notification.jsx +21 -0
- package/src/components/OnairosAppButton.jsx +85 -0
- package/src/components/OnairosSSO.jsx +645 -0
- package/src/components/OnairosTrigger.jsx +61 -0
- package/src/components/PerplexityLogo.jsx +43 -0
- package/src/components/PinSetup.js +200 -0
- package/src/components/PinSetup.jsx +228 -0
- package/src/components/SDK_PIN_INTEGRATION_REQUIRED_CHANGES.md +526 -0
- package/src/components/SdkErrorBoundary.jsx +36 -0
- package/src/components/SecuritySetup.js +81 -0
- package/src/components/SessionUserBar.jsx +83 -0
- package/src/components/SignUp.js +123 -0
- package/src/components/TestTelegramButton.js +53 -0
- package/src/components/TrainingComponent.jsx +200 -0
- package/src/components/TrainingScreen.jsx +897 -0
- package/src/components/UniversalOnboarding.js +306 -0
- package/src/components/UniversalOnboarding.jsx +4837 -0
- package/src/components/ValentineLoadingPage.jsx +502 -0
- package/src/components/ValentineModeSelector.jsx +162 -0
- package/src/components/WelcomeScreen.jsx +435 -0
- package/src/components/WrappedLoadingPage.jsx +205 -0
- package/src/components/connectors/ChatGPTConnector.js +348 -0
- package/src/components/connectors/ChatGPTConnector.jsx +348 -0
- package/src/components/connectors/ClaudeConnector.js +44 -0
- package/src/components/connectors/ClaudeConnector.jsx +44 -0
- package/src/components/connectors/GeminiConnector.js +170 -0
- package/src/components/connectors/GeminiConnector.jsx +170 -0
- package/src/components/connectors/GmailConnector.js +148 -0
- package/src/components/connectors/GmailConnector.jsx +148 -0
- package/src/components/connectors/GrokConnector.js +16 -0
- package/src/components/connectors/GrokConnector.jsx +16 -0
- package/src/components/connectors/HingeConnector.js +419 -0
- package/src/components/connectors/HingeConnector.jsx +419 -0
- package/src/components/connectors/InstagramDataConnector.js +726 -0
- package/src/components/connectors/InstagramDataConnector.jsx +726 -0
- package/src/components/connectors/LinkedInConnector.js +4 -0
- package/src/components/connectors/LinkedInConnector.jsx +296 -0
- package/src/components/connectors/PerplexityConnector.jsx +16 -0
- package/src/components/connectors/PinterestConnector.js +208 -0
- package/src/components/connectors/PinterestConnector.jsx +208 -0
- package/src/components/connectors/README.md +292 -0
- package/src/components/connectors/RedditConnector.js +229 -0
- package/src/components/connectors/RedditConnector.jsx +229 -0
- package/src/components/connectors/SephoraConnector.js +482 -0
- package/src/components/connectors/SephoraConnector.jsx +482 -0
- package/src/components/connectors/TikTokConnector.jsx +430 -0
- package/src/components/connectors/YoutubeConnector.js +361 -0
- package/src/components/connectors/YoutubeConnector.jsx +361 -0
- package/src/components/connectors/index.js +50 -0
- package/src/components/icons.jsx +46 -0
- package/src/components/icons.tsx +21 -0
- package/src/components/ui/PageLayout.jsx +1255 -0
- package/src/components/ui/PrimaryButton.jsx +162 -0
- package/src/components/ui/button.jsx +49 -0
- package/src/components/ui/card.jsx +61 -0
- package/src/components/ui/checkbox.jsx +33 -0
- package/src/components/ui/label.jsx +29 -0
- package/src/components/utils/UpdateConnections.js +45 -0
- package/src/components/utils/oauthHelper.js +97 -0
- package/src/config/api-config.js +138 -0
- package/src/deepLink.jsx +38 -0
- package/src/getPin.js +26 -0
- package/src/icons/Avatar.png +0 -0
- package/src/icons/Sentiment.png +0 -0
- package/src/icons/Trait.png +0 -0
- package/src/iframe/DataRequestPage.jsx +285 -0
- package/src/iframe/OnairosButtonIntegration.md +148 -0
- package/src/iframe/components/Box.jsx +56 -0
- package/src/iframe/components/IndividualConnection.jsx +88 -0
- package/src/iframe/dataRequestHandler.js +714 -0
- package/src/iframe/data_request_iframe.html +27 -0
- package/src/iframe/data_request_page.js +47 -0
- package/src/iframe/icons/Avatar.png +1 -0
- package/src/iframe/icons/Avatar2.png +1 -0
- package/src/iframe/icons/Sentiment.png +1 -0
- package/src/iframe/icons/Trait.png +1 -0
- package/src/iframe/icons/onairos_logo.png +0 -0
- package/src/iframe/utils/api.js +57 -0
- package/src/index.js +274 -0
- package/src/laravel/OnairosVue.vue +410 -0
- package/src/laravel/blade-helpers.js +320 -0
- package/src/laravel/vite-plugin.js +179 -0
- package/src/mobile/MobileDataRequestPage.jsx +233 -0
- package/src/mobile/components/MobileBox.jsx +71 -0
- package/src/mobile/components/MobileIndividualConnection.jsx +51 -0
- package/src/mobile/shims/browser-apis.js +78 -0
- package/src/mobile/shims/lucide-shim.js +85 -0
- package/src/nativeConnectors.js +5 -0
- package/src/newUI/EMAIL_VERIFICATION_API_SCHEMA.md +268 -0
- package/src/newUI/PlatformConnectorsStep.tsx +435 -0
- package/src/newUI/PrimaryButton.tsx +213 -0
- package/src/newUI/SignInStep.tsx +194 -0
- package/src/newUI/VerificationStep.tsx +133 -0
- package/src/newUI/WelcomeScreen.tsx +311 -0
- package/src/newUI/services/connectedAccountsService.js +129 -0
- package/src/onairos.capacitor.jsx +15 -0
- package/src/onairos.core.jsx +133 -0
- package/src/onairos.jsx +14 -0
- package/src/onairos.native.jsx +15 -0
- package/src/onairosButton.jsx +9000 -0
- package/src/overlay/CheckBox.jsx +114 -0
- package/src/overlay/IndividualConnection copy.js +86 -0
- package/src/overlay/IndividualConnection.js +191 -0
- package/src/overlay/IndividualConnectionNew.jsx +157 -0
- package/src/overlay/box.js +84 -0
- package/src/overlay/overlay.js +437 -0
- package/src/styles/onairos-scoped-preflight.css +97 -0
- package/src/styles/sdkCssRegistry.js +20 -0
- package/src/styles/styleLoaderInsertShadow.js +69 -0
- package/src/styles/tailwind.capacitor.css +395 -0
- package/src/styles/tailwind.css +395 -0
- package/src/theme/colors.js +40 -0
- package/src/utils/apiKeyValidation.js +341 -0
- package/src/utils/apiResponseLogger.js +316 -0
- package/src/utils/authHeaders.js +275 -0
- package/src/utils/biometrics.js +26 -0
- package/src/utils/bookmarkletUtils.js +28 -0
- package/src/utils/capacitorDetection.js +278 -0
- package/src/utils/capacitorLLMHelper.js +352 -0
- package/src/utils/capacitorPlugins.js +366 -0
- package/src/utils/crossDomainSSO.js +587 -0
- package/src/utils/deepLinking.js +27 -0
- package/src/utils/devLogger.js +46 -0
- package/src/utils/extensionDetection.js +418 -0
- package/src/utils/extractMemory.js +277 -0
- package/src/utils/framerBrandingOverrides.js +40 -0
- package/src/utils/googleWebClientId.js +55 -0
- package/src/utils/overlayHandler.js +224 -0
- package/src/utils/platformDisconnect.js +309 -0
- package/src/utils/pollTrainingStatus.js +200 -0
- package/src/utils/rawMemoriesAccess.js +211 -0
- package/src/utils/resolveBackendAppId.js +47 -0
- package/src/utils/responseFormatter.js +140 -0
- package/src/utils/sdkDebugStorage.js +113 -0
- package/src/utils/sdkInitialization.js +645 -0
- package/src/utils/sessionManager.js +1258 -0
- package/src/utils/startBackgroundTraining.js +100 -0
- package/src/utils/userDataFormatter.js +222 -0
- package/index.d.ts +0 -1
- package/index.js +0 -1
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'; // React must stay — webpack classic JSX transform emits React.createElement
|
|
2
|
+
import { getUserAuthHeaders } from '../../utils/authHeaders';
|
|
3
|
+
import { API_CONFIG } from '../../config/api-config.js';
|
|
4
|
+
|
|
5
|
+
const PHASES = {
|
|
6
|
+
URL_INPUT: 'url-input',
|
|
7
|
+
SYNCING: 'syncing',
|
|
8
|
+
DONE: 'done',
|
|
9
|
+
ERROR: 'error',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const PREFIX = 'https://www.linkedin.com/in/';
|
|
13
|
+
|
|
14
|
+
/** Default post scrape count sent to POST /linkedin/apify-sync (backend may override later). */
|
|
15
|
+
const DEFAULT_POST_LIMIT = 25;
|
|
16
|
+
|
|
17
|
+
export default function LinkedInConnector({ open, onClose, onConnectionChange }) {
|
|
18
|
+
const [phase, setPhase] = useState(PHASES.URL_INPUT);
|
|
19
|
+
const [handle, setHandle] = useState('');
|
|
20
|
+
const [errorMsg, setErrorMsg] = useState('');
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (open) {
|
|
24
|
+
setPhase(PHASES.URL_INPUT);
|
|
25
|
+
setHandle('');
|
|
26
|
+
setErrorMsg('');
|
|
27
|
+
}
|
|
28
|
+
}, [open]);
|
|
29
|
+
|
|
30
|
+
const handleClose = () => {
|
|
31
|
+
setPhase(PHASES.URL_INPUT);
|
|
32
|
+
setHandle('');
|
|
33
|
+
setErrorMsg('');
|
|
34
|
+
if (onClose) onClose();
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const handleSync = async () => {
|
|
38
|
+
// Accept full URL pasted in or just the handle
|
|
39
|
+
let h = handle.trim();
|
|
40
|
+
if (h.includes('linkedin.com/in/')) {
|
|
41
|
+
h = h.split('/in/')[1].replace(/\/$/, '').split('?')[0];
|
|
42
|
+
}
|
|
43
|
+
h = h.replace(/\/$/, '');
|
|
44
|
+
|
|
45
|
+
if (!h) {
|
|
46
|
+
setErrorMsg('Enter your LinkedIn handle — e.g. jane-doe');
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const profileUrl = `${PREFIX}${h}`;
|
|
51
|
+
setPhase(PHASES.SYNCING);
|
|
52
|
+
setErrorMsg('');
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
const baseUrl = API_CONFIG.getBaseUrl();
|
|
56
|
+
const resp = await fetch(`${baseUrl}/linkedin/apify-sync`, {
|
|
57
|
+
method: 'POST',
|
|
58
|
+
headers: { ...getUserAuthHeaders(), 'Content-Type': 'application/json' },
|
|
59
|
+
body: JSON.stringify({ profileUrl, postLimit: DEFAULT_POST_LIMIT }),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const data = await resp.json();
|
|
63
|
+
if (!resp.ok || !data.success) {
|
|
64
|
+
throw new Error(data.error || `Server error ${resp.status}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
setPhase(PHASES.DONE);
|
|
68
|
+
if (onConnectionChange) onConnectionChange('LinkedIn', true);
|
|
69
|
+
|
|
70
|
+
} catch (err) {
|
|
71
|
+
console.error('[LinkedIn] Apify sync error:', err);
|
|
72
|
+
setErrorMsg(err.message || 'Sync failed. Please try again.');
|
|
73
|
+
setPhase(PHASES.ERROR);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
if (!open) return null;
|
|
78
|
+
|
|
79
|
+
const cardBg = {
|
|
80
|
+
background: 'radial-gradient(circle at top, rgba(255,255,255,0.18) 0%, transparent 55%), radial-gradient(circle at bottom, rgba(15,23,42,0.9) 0%, rgba(15,23,42,1) 100%)',
|
|
81
|
+
backdropFilter: 'blur(24px)',
|
|
82
|
+
WebkitBackdropFilter: 'blur(24px)',
|
|
83
|
+
border: '1px solid rgba(255,255,255,0.10)',
|
|
84
|
+
borderRadius: 24,
|
|
85
|
+
boxShadow: '0 30px 80px rgba(15,23,42,0.70)',
|
|
86
|
+
overflow: 'hidden',
|
|
87
|
+
width: '100%',
|
|
88
|
+
maxWidth: 420,
|
|
89
|
+
color: '#fff',
|
|
90
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<>
|
|
95
|
+
<style>{`
|
|
96
|
+
@keyframes liSpin { to { transform: rotate(360deg); } }
|
|
97
|
+
.li-spinner { animation: liSpin 0.8s linear infinite; }
|
|
98
|
+
@keyframes liCheckDraw {
|
|
99
|
+
from { stroke-dashoffset: 60; }
|
|
100
|
+
to { stroke-dashoffset: 0; }
|
|
101
|
+
}
|
|
102
|
+
@keyframes liCircleDraw {
|
|
103
|
+
from { stroke-dashoffset: 166; }
|
|
104
|
+
to { stroke-dashoffset: 0; }
|
|
105
|
+
}
|
|
106
|
+
.li-check-circle { animation: liCircleDraw 0.4s ease forwards; }
|
|
107
|
+
.li-check-path { animation: liCheckDraw 0.35s ease 0.3s forwards; stroke-dashoffset: 60; }
|
|
108
|
+
.li-input-handle { -webkit-text-size-adjust: 100%; }
|
|
109
|
+
.li-input-handle:focus { outline: none; border-color: rgba(10,102,194,0.7) !important; box-shadow: 0 0 0 3px rgba(10,102,194,0.15); }
|
|
110
|
+
.li-btn-primary { transition: transform 0.15s, background 0.15s; -webkit-tap-highlight-color: transparent; }
|
|
111
|
+
.li-btn-primary:hover { transform: scale(1.02); background: rgb(10,102,194) !important; }
|
|
112
|
+
.li-btn-primary:active { transform: scale(0.98); }
|
|
113
|
+
.li-btn-secondary { -webkit-tap-highlight-color: transparent; }
|
|
114
|
+
.li-btn-secondary:hover { background: rgba(255,255,255,0.12) !important; }
|
|
115
|
+
.li-prefix {
|
|
116
|
+
display: flex; align-items: center;
|
|
117
|
+
background: rgba(255,255,255,0.04);
|
|
118
|
+
border: 1px solid rgba(255,255,255,0.14);
|
|
119
|
+
border-radius: 10px;
|
|
120
|
+
overflow: hidden;
|
|
121
|
+
}
|
|
122
|
+
.li-prefix-label {
|
|
123
|
+
padding: 0 10px;
|
|
124
|
+
color: #64748b;
|
|
125
|
+
font-size: 13px;
|
|
126
|
+
white-space: nowrap;
|
|
127
|
+
border-right: 1px solid rgba(255,255,255,0.10);
|
|
128
|
+
background: rgba(255,255,255,0.03);
|
|
129
|
+
height: 100%;
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
user-select: none;
|
|
133
|
+
}
|
|
134
|
+
.li-prefix input {
|
|
135
|
+
flex: 1;
|
|
136
|
+
background: transparent;
|
|
137
|
+
border: none;
|
|
138
|
+
padding: 13px 14px;
|
|
139
|
+
color: #f1f5f9;
|
|
140
|
+
font-size: 16px;
|
|
141
|
+
min-width: 0;
|
|
142
|
+
}
|
|
143
|
+
.li-prefix input:focus { outline: none; }
|
|
144
|
+
.li-prefix input::placeholder { color: #475569; }
|
|
145
|
+
`}</style>
|
|
146
|
+
|
|
147
|
+
<div style={{
|
|
148
|
+
position: 'fixed',
|
|
149
|
+
top: 0, left: 0, right: 0, bottom: 0,
|
|
150
|
+
display: 'flex',
|
|
151
|
+
alignItems: 'flex-start',
|
|
152
|
+
justifyContent: 'center',
|
|
153
|
+
zIndex: 2147483647,
|
|
154
|
+
paddingTop: 'max(env(safe-area-inset-top, 0px), 24px)',
|
|
155
|
+
paddingBottom: 'max(env(safe-area-inset-bottom, 0px), 16px)',
|
|
156
|
+
paddingLeft: 16,
|
|
157
|
+
paddingRight: 16,
|
|
158
|
+
overflowY: 'auto',
|
|
159
|
+
WebkitOverflowScrolling: 'touch',
|
|
160
|
+
}}>
|
|
161
|
+
<div style={cardBg}>
|
|
162
|
+
|
|
163
|
+
{/* Header */}
|
|
164
|
+
<div style={{ padding: '18px 20px 16px', borderBottom: '1px solid rgba(255,255,255,0.10)', background: 'rgba(255,255,255,0.06)', position: 'relative' }}>
|
|
165
|
+
<button
|
|
166
|
+
onClick={handleClose}
|
|
167
|
+
style={{ position: 'absolute', right: 14, top: 14, background: 'rgba(255,255,255,0.10)', border: 'none', borderRadius: '50%', width: 36, height: 36, cursor: 'pointer', color: '#94a3b8', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 16, WebkitTapHighlightColor: 'transparent' }}
|
|
168
|
+
>✕</button>
|
|
169
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
|
170
|
+
<div style={{ background: 'rgb(10,102,194)', width: 38, height: 38, borderRadius: 10, display: 'flex', alignItems: 'center', justifyContent: 'center', fontWeight: 800, fontSize: 15, flexShrink: 0, letterSpacing: -0.5 }}>in</div>
|
|
171
|
+
<div>
|
|
172
|
+
<div style={{ fontWeight: 700, fontSize: 17 }}>Connect LinkedIn</div>
|
|
173
|
+
<div style={{ fontSize: 12, color: '#64748b', marginTop: 2 }}>Sync your professional profile</div>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
{/* Body */}
|
|
179
|
+
<div style={{ padding: '22px 20px' }}>
|
|
180
|
+
|
|
181
|
+
{/* URL_INPUT / ERROR */}
|
|
182
|
+
{(phase === PHASES.URL_INPUT || phase === PHASES.ERROR) && (
|
|
183
|
+
<div>
|
|
184
|
+
<p style={{ color: '#94a3b8', fontSize: 13, marginBottom: 20, lineHeight: 1.65 }}>
|
|
185
|
+
Enter your LinkedIn handle to sync your profile, experience, and posts.
|
|
186
|
+
</p>
|
|
187
|
+
|
|
188
|
+
{phase === PHASES.ERROR && (
|
|
189
|
+
<div style={{ background: 'rgba(239,68,68,0.10)', border: '1px solid rgba(239,68,68,0.25)', borderRadius: 10, padding: '10px 14px', marginBottom: 16, color: 'rgb(252,165,165)', fontSize: 13 }}>
|
|
190
|
+
{errorMsg}
|
|
191
|
+
</div>
|
|
192
|
+
)}
|
|
193
|
+
|
|
194
|
+
<label style={{ display: 'block', fontSize: 11, fontWeight: 600, color: '#64748b', letterSpacing: '0.06em', textTransform: 'uppercase', marginBottom: 8 }}>
|
|
195
|
+
Profile handle
|
|
196
|
+
</label>
|
|
197
|
+
|
|
198
|
+
{/* Split prefix + handle input */}
|
|
199
|
+
<div className="li-prefix">
|
|
200
|
+
<span className="li-prefix-label">linkedin.com/in/</span>
|
|
201
|
+
<input
|
|
202
|
+
className="li-input-handle"
|
|
203
|
+
type="text"
|
|
204
|
+
inputMode="text"
|
|
205
|
+
autoCapitalize="none"
|
|
206
|
+
autoCorrect="off"
|
|
207
|
+
autoComplete="off"
|
|
208
|
+
spellCheck={false}
|
|
209
|
+
value={handle}
|
|
210
|
+
onChange={e => {
|
|
211
|
+
// If user pastes a full URL, strip the prefix automatically
|
|
212
|
+
let v = e.target.value;
|
|
213
|
+
if (v.includes('linkedin.com/in/')) {
|
|
214
|
+
v = v.split('/in/')[1].replace(/\/$/, '').split('?')[0];
|
|
215
|
+
}
|
|
216
|
+
setHandle(v);
|
|
217
|
+
setErrorMsg('');
|
|
218
|
+
}}
|
|
219
|
+
placeholder="your-name"
|
|
220
|
+
/>
|
|
221
|
+
</div>
|
|
222
|
+
|
|
223
|
+
{errorMsg && phase !== PHASES.ERROR && (
|
|
224
|
+
<p style={{ color: 'rgb(252,165,165)', fontSize: 12, marginTop: 8 }}>{errorMsg}</p>
|
|
225
|
+
)}
|
|
226
|
+
|
|
227
|
+
<button
|
|
228
|
+
className="li-btn-primary"
|
|
229
|
+
onClick={handleSync}
|
|
230
|
+
style={{ marginTop: 18, width: '100%', padding: '14px 0', background: 'rgb(8,85,165)', border: 'none', borderRadius: 12, color: '#fff', fontWeight: 600, fontSize: 15, cursor: 'pointer' }}
|
|
231
|
+
>
|
|
232
|
+
{phase === PHASES.ERROR ? 'Retry' : 'Sync Profile'}
|
|
233
|
+
</button>
|
|
234
|
+
<button
|
|
235
|
+
className="li-btn-secondary"
|
|
236
|
+
onClick={handleClose}
|
|
237
|
+
style={{ marginTop: 10, width: '100%', padding: '12px 0', background: 'transparent', border: '1px solid rgba(255,255,255,0.10)', borderRadius: 12, color: '#64748b', fontSize: 14, cursor: 'pointer' }}
|
|
238
|
+
>
|
|
239
|
+
Cancel
|
|
240
|
+
</button>
|
|
241
|
+
</div>
|
|
242
|
+
)}
|
|
243
|
+
|
|
244
|
+
{/* SYNCING */}
|
|
245
|
+
{phase === PHASES.SYNCING && (
|
|
246
|
+
<div style={{ textAlign: 'center', padding: '16px 0' }}>
|
|
247
|
+
<svg className="li-spinner" style={{ width: 40, height: 40, marginBottom: 18 }} viewBox="0 0 24 24" fill="none" stroke="rgb(10,102,194)" strokeWidth="2.5">
|
|
248
|
+
<circle cx="12" cy="12" r="10" strokeOpacity="0.15"/>
|
|
249
|
+
<path d="M12 2 a10 10 0 0 1 10 10" strokeLinecap="round"/>
|
|
250
|
+
</svg>
|
|
251
|
+
<div style={{ fontWeight: 600, fontSize: 15, marginBottom: 8 }}>Syncing your profile…</div>
|
|
252
|
+
<p style={{ color: '#64748b', fontSize: 13, lineHeight: 1.6 }}>Fetching your experience, skills, and recent posts.<br/>This may take up to 30 seconds.</p>
|
|
253
|
+
</div>
|
|
254
|
+
)}
|
|
255
|
+
|
|
256
|
+
{/* DONE */}
|
|
257
|
+
{phase === PHASES.DONE && (
|
|
258
|
+
<div style={{ textAlign: 'center', padding: '16px 0' }}>
|
|
259
|
+
{/* Animated SVG checkmark */}
|
|
260
|
+
<svg viewBox="0 0 52 52" style={{ width: 64, height: 64, marginBottom: 16, display: 'block', margin: '0 auto 16px' }} fill="none">
|
|
261
|
+
<circle
|
|
262
|
+
className="li-check-circle"
|
|
263
|
+
cx="26" cy="26" r="25"
|
|
264
|
+
stroke="rgb(34,197,94)"
|
|
265
|
+
strokeWidth="2"
|
|
266
|
+
strokeDasharray="166"
|
|
267
|
+
strokeLinecap="round"
|
|
268
|
+
/>
|
|
269
|
+
<path
|
|
270
|
+
className="li-check-path"
|
|
271
|
+
d="M14 27 l8 8 16-17"
|
|
272
|
+
stroke="rgb(34,197,94)"
|
|
273
|
+
strokeWidth="3"
|
|
274
|
+
strokeLinecap="round"
|
|
275
|
+
strokeLinejoin="round"
|
|
276
|
+
strokeDasharray="60"
|
|
277
|
+
/>
|
|
278
|
+
</svg>
|
|
279
|
+
<div style={{ fontWeight: 700, fontSize: 17, marginBottom: 8 }}>LinkedIn Connected</div>
|
|
280
|
+
<p style={{ color: '#64748b', fontSize: 13, marginBottom: 24, lineHeight: 1.6 }}>Your profile, experience, and posts have been synced.</p>
|
|
281
|
+
<button
|
|
282
|
+
className="li-btn-primary"
|
|
283
|
+
onClick={handleClose}
|
|
284
|
+
style={{ padding: '12px 40px', background: 'rgb(8,85,165)', border: 'none', borderRadius: 12, color: '#fff', fontWeight: 600, fontSize: 15, cursor: 'pointer' }}
|
|
285
|
+
>
|
|
286
|
+
Done
|
|
287
|
+
</button>
|
|
288
|
+
</div>
|
|
289
|
+
)}
|
|
290
|
+
|
|
291
|
+
</div>
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
</>
|
|
295
|
+
);
|
|
296
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ConnectPerplexityModal from '../ConnectPerplexityModal.jsx';
|
|
3
|
+
|
|
4
|
+
export default function PerplexityConnector({ open, onClose, onConnectionChange }) {
|
|
5
|
+
return (
|
|
6
|
+
<ConnectPerplexityModal
|
|
7
|
+
open={open}
|
|
8
|
+
onClose={onClose}
|
|
9
|
+
onConnected={() => {
|
|
10
|
+
if (typeof onConnectionChange === 'function') {
|
|
11
|
+
onConnectionChange('Perplexity', true);
|
|
12
|
+
}
|
|
13
|
+
}}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { getCapacitorBrowser, isCapacitorNativePlatform } from '../../utils/capacitorPlugins.js';
|
|
3
|
+
import { getUserAuthHeaders, isUserAuthenticated } from '../../utils/authHeaders';
|
|
4
|
+
import { API_CONFIG } from '../../config/api-config';
|
|
5
|
+
|
|
6
|
+
class PinterestConnector extends Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
this.state = {
|
|
10
|
+
connected: false,
|
|
11
|
+
open: false,
|
|
12
|
+
isConnecting: false,
|
|
13
|
+
};
|
|
14
|
+
this.handleClose = this.handleClose.bind(this);
|
|
15
|
+
this.handleOpen = this.handleOpen.bind(this);
|
|
16
|
+
this.pinterestConnect = this.pinterestConnect.bind(this);
|
|
17
|
+
this.setConnected = this.setConnected.bind(this);
|
|
18
|
+
this.setDisconnected = this.setDisconnected.bind(this);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
setConnected() {
|
|
22
|
+
this.setState({ connected: true });
|
|
23
|
+
if (this.props.onConnectionChange) {
|
|
24
|
+
this.props.onConnectionChange('Pinterest', true);
|
|
25
|
+
}
|
|
26
|
+
this.handleClose();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
setDisconnected() {
|
|
30
|
+
this.updateConnections('Remove', 'Pinterest').then(() => {
|
|
31
|
+
this.setState({ connected: false });
|
|
32
|
+
if (this.props.onConnectionChange) {
|
|
33
|
+
this.props.onConnectionChange('Pinterest', false);
|
|
34
|
+
}
|
|
35
|
+
this.handleClose();
|
|
36
|
+
}).catch((error) => {
|
|
37
|
+
console.error('Error removing Pinterest connection:', error);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async updateConnections(updateType, newConnection) {
|
|
42
|
+
// TIER 2: Require user JWT for connection updates
|
|
43
|
+
if (!isUserAuthenticated()) {
|
|
44
|
+
console.error('[Pinterest] User not authenticated - cannot update connections');
|
|
45
|
+
throw new Error('User not authenticated');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const response = await fetch(`${API_CONFIG.getBaseUrl()}/connections/update`, {
|
|
50
|
+
method: 'POST',
|
|
51
|
+
headers: getUserAuthHeaders(),
|
|
52
|
+
body: JSON.stringify({ updateType, newConnection }), // Username extracted from JWT
|
|
53
|
+
});
|
|
54
|
+
return await response.json();
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error('UpdateConnections error:', error);
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
handleOpen() {
|
|
62
|
+
this.setState({ open: true });
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
handleClose() {
|
|
66
|
+
this.setState({ open: false });
|
|
67
|
+
if (this.props.onClose) {
|
|
68
|
+
this.props.onClose();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async pinterestConnect() {
|
|
73
|
+
this.setState({ isConnecting: true });
|
|
74
|
+
|
|
75
|
+
// TIER 2: Require user JWT for OAuth connections
|
|
76
|
+
if (!isUserAuthenticated()) {
|
|
77
|
+
console.error('[Pinterest] User not authenticated - cannot connect');
|
|
78
|
+
this.setState({ isConnecting: false });
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
const response = await fetch(`${API_CONFIG.getBaseUrl()}/pinterest/authorize`, {
|
|
84
|
+
method: 'POST',
|
|
85
|
+
headers: getUserAuthHeaders(),
|
|
86
|
+
body: JSON.stringify({}), // Username extracted from JWT on backend
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const result = await response.json();
|
|
90
|
+
|
|
91
|
+
if (result.pinterestURL) {
|
|
92
|
+
const rawUrl = result.pinterestURL;
|
|
93
|
+
|
|
94
|
+
// iOS safety: reduce chances of universal-link handoff into the native Pinterest app.
|
|
95
|
+
// Only bridge if the host app explicitly provides an oauth-bridge URL via
|
|
96
|
+
// `window.onairosOAuthBridgeUrl`; otherwise return the raw URL so we never 404.
|
|
97
|
+
const maybeBridgeMobileOAuthUrl = (u) => {
|
|
98
|
+
try {
|
|
99
|
+
if (!u || typeof window === 'undefined' || typeof navigator === 'undefined') return u;
|
|
100
|
+
const ua = String(navigator.userAgent || '');
|
|
101
|
+
const isIOS = /iP(hone|ad|od)/i.test(ua);
|
|
102
|
+
if (!isIOS) return u;
|
|
103
|
+
const hostBridge = (typeof window.onairosOAuthBridgeUrl === 'string' && window.onairosOAuthBridgeUrl.trim()) || null;
|
|
104
|
+
if (!hostBridge) return u;
|
|
105
|
+
const k = `${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
106
|
+
const storageKey = `onairos_oauth_bridge:${k}`;
|
|
107
|
+
try { sessionStorage.setItem(storageKey, String(u)); } catch (e1) {
|
|
108
|
+
try { localStorage.setItem(storageKey, String(u)); } catch (e2) {}
|
|
109
|
+
}
|
|
110
|
+
const sep = hostBridge.includes('?') ? '&' : '?';
|
|
111
|
+
return `${hostBridge}${sep}k=${encodeURIComponent(k)}`;
|
|
112
|
+
} catch (_) {
|
|
113
|
+
return u;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// Prefer system browser on native (avoids WKWebView quirks).
|
|
118
|
+
if (isCapacitorNativePlatform()) {
|
|
119
|
+
try {
|
|
120
|
+
const CapBrowser = getCapacitorBrowser();
|
|
121
|
+
if (CapBrowser?.open) {
|
|
122
|
+
await CapBrowser.open({
|
|
123
|
+
url: maybeBridgeMobileOAuthUrl(rawUrl),
|
|
124
|
+
windowName: '_blank',
|
|
125
|
+
presentationStyle: 'fullscreen',
|
|
126
|
+
});
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
} catch (e) {
|
|
130
|
+
// fall back
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
window.location.href = maybeBridgeMobileOAuthUrl(rawUrl);
|
|
135
|
+
} else {
|
|
136
|
+
console.error('No Pinterest URL received');
|
|
137
|
+
this.setState({ isConnecting: false });
|
|
138
|
+
}
|
|
139
|
+
} catch (error) {
|
|
140
|
+
console.error('Pinterest connection error:', error);
|
|
141
|
+
this.setState({ isConnecting: false });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
render() {
|
|
146
|
+
const { open = this.props.open || this.state.open } = this.props;
|
|
147
|
+
|
|
148
|
+
if (!open) return null;
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[2147483647]">
|
|
152
|
+
<div className="bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-full md:max-h-[90vh] overflow-hidden">
|
|
153
|
+
<div className="p-6">
|
|
154
|
+
<h2 className="text-xl font-bold text-gray-900 mb-4">
|
|
155
|
+
Grant Onairos Access to your Pinterest Account?
|
|
156
|
+
</h2>
|
|
157
|
+
|
|
158
|
+
<div className="space-y-4 text-gray-700">
|
|
159
|
+
<p>
|
|
160
|
+
Grant Permission to your Pinterest Account, so we can build your Data Models.
|
|
161
|
+
</p>
|
|
162
|
+
|
|
163
|
+
<div>
|
|
164
|
+
<p className="font-medium mb-2">We will access your Pinterest:</p>
|
|
165
|
+
<ul className="list-disc ml-6 space-y-1">
|
|
166
|
+
<li>Basic Profile Information</li>
|
|
167
|
+
<li>Boards and Pins</li>
|
|
168
|
+
<li>Saved and Liked Pins</li>
|
|
169
|
+
<li>Following and Followers</li>
|
|
170
|
+
</ul>
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
<p>
|
|
174
|
+
We will delete all the data used once your Model is Created
|
|
175
|
+
</p>
|
|
176
|
+
|
|
177
|
+
<p className="text-sm">
|
|
178
|
+
<a href="https://onairos.uk/privacy-policy" className="text-blue-600 hover:underline">
|
|
179
|
+
Onairos Privacy Policy
|
|
180
|
+
</a>{' '}
|
|
181
|
+
- Your creative interests and preferences are securely processed.
|
|
182
|
+
</p>
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<div className="flex space-x-3 mt-6">
|
|
186
|
+
<button
|
|
187
|
+
onClick={this.handleClose}
|
|
188
|
+
disabled={this.state.isConnecting}
|
|
189
|
+
className="flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 disabled:opacity-50"
|
|
190
|
+
>
|
|
191
|
+
Disagree
|
|
192
|
+
</button>
|
|
193
|
+
<button
|
|
194
|
+
onClick={this.pinterestConnect}
|
|
195
|
+
disabled={this.state.isConnecting}
|
|
196
|
+
className="flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50"
|
|
197
|
+
>
|
|
198
|
+
{this.state.isConnecting ? 'Connecting...' : 'Agree'}
|
|
199
|
+
</button>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
</div>
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export default PinterestConnector;
|