@onairosofficial/onairos-capacitor 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/LICENSE +194 -10
  2. package/README.md +182 -25
  3. package/dist/onairos.capacitor.esm.js +1 -0
  4. package/dist/onairos.capacitor.esm.turbopack.js +1 -0
  5. package/onairos.d.ts +656 -0
  6. package/package.json +186 -38
  7. package/src/OnairosReconnectButton.jsx +272 -0
  8. package/src/RSA.jsx +57 -0
  9. package/src/assets/NewLogo.png +0 -0
  10. package/src/assets/OnairosNewLogo.png +0 -0
  11. package/src/assets/chatgpt-icon.png +0 -0
  12. package/src/assets/fire-horse.png +0 -0
  13. package/src/assets/fire-horse.transparent.png +0 -0
  14. package/src/assets/latest-firehorse.png +0 -0
  15. package/src/assets/perplexity.png +0 -0
  16. package/src/assets/persona.png +0 -0
  17. package/src/assets/persona1.png +0 -0
  18. package/src/assets/persona2.png +0 -0
  19. package/src/assets/persona3.png +0 -0
  20. package/src/assets/persona4.png +0 -0
  21. package/src/assets/persona5.png +0 -0
  22. package/src/capacitorConnectorCatalog.js +38 -0
  23. package/src/capacitorOAuthConfig.js +52 -0
  24. package/src/chatgptHostedImport/index.js +303 -0
  25. package/src/components/AuthButtons.jsx +48 -0
  26. package/src/components/ConnectChatGPTModal.jsx +666 -0
  27. package/src/components/ConnectClaudeModal.jsx +610 -0
  28. package/src/components/ConnectGeminiModal.jsx +639 -0
  29. package/src/components/ConnectGrokModal.jsx +701 -0
  30. package/src/components/ConnectPerplexityModal.jsx +726 -0
  31. package/src/components/DataExplainerScreen.jsx +349 -0
  32. package/src/components/DataRequest.js +885 -0
  33. package/src/components/DataRequest.jsx +1055 -0
  34. package/src/components/EmailAuth.js +1871 -0
  35. package/src/components/EmailAuth.jsx +2062 -0
  36. package/src/components/ExtensionInstallPrompt.jsx +142 -0
  37. package/src/components/GoogleButton.js +133 -0
  38. package/src/components/LLMConnectorManager.jsx +201 -0
  39. package/src/components/LoadingPage.jsx +19 -0
  40. package/src/components/LoadingScreen.jsx +81 -0
  41. package/src/components/LunarBirthdate.jsx +96 -0
  42. package/src/components/LunarLoadingPage.jsx +251 -0
  43. package/src/components/Notification.jsx +21 -0
  44. package/src/components/OnairosAppButton.jsx +85 -0
  45. package/src/components/OnairosSSO.jsx +645 -0
  46. package/src/components/OnairosTrigger.jsx +61 -0
  47. package/src/components/PerplexityLogo.jsx +43 -0
  48. package/src/components/PinSetup.js +200 -0
  49. package/src/components/PinSetup.jsx +228 -0
  50. package/src/components/SDK_PIN_INTEGRATION_REQUIRED_CHANGES.md +526 -0
  51. package/src/components/SdkErrorBoundary.jsx +36 -0
  52. package/src/components/SecuritySetup.js +81 -0
  53. package/src/components/SessionUserBar.jsx +83 -0
  54. package/src/components/SignUp.js +123 -0
  55. package/src/components/TestTelegramButton.js +53 -0
  56. package/src/components/TrainingComponent.jsx +200 -0
  57. package/src/components/TrainingScreen.jsx +897 -0
  58. package/src/components/UniversalOnboarding.js +306 -0
  59. package/src/components/UniversalOnboarding.jsx +4837 -0
  60. package/src/components/ValentineLoadingPage.jsx +502 -0
  61. package/src/components/ValentineModeSelector.jsx +162 -0
  62. package/src/components/WelcomeScreen.jsx +435 -0
  63. package/src/components/WrappedLoadingPage.jsx +205 -0
  64. package/src/components/connectors/ChatGPTConnector.js +348 -0
  65. package/src/components/connectors/ChatGPTConnector.jsx +348 -0
  66. package/src/components/connectors/ClaudeConnector.js +44 -0
  67. package/src/components/connectors/ClaudeConnector.jsx +44 -0
  68. package/src/components/connectors/GeminiConnector.js +170 -0
  69. package/src/components/connectors/GeminiConnector.jsx +170 -0
  70. package/src/components/connectors/GmailConnector.js +148 -0
  71. package/src/components/connectors/GmailConnector.jsx +148 -0
  72. package/src/components/connectors/GrokConnector.js +16 -0
  73. package/src/components/connectors/GrokConnector.jsx +16 -0
  74. package/src/components/connectors/HingeConnector.js +419 -0
  75. package/src/components/connectors/HingeConnector.jsx +419 -0
  76. package/src/components/connectors/InstagramDataConnector.js +726 -0
  77. package/src/components/connectors/InstagramDataConnector.jsx +726 -0
  78. package/src/components/connectors/LinkedInConnector.js +4 -0
  79. package/src/components/connectors/LinkedInConnector.jsx +296 -0
  80. package/src/components/connectors/PerplexityConnector.jsx +16 -0
  81. package/src/components/connectors/PinterestConnector.js +208 -0
  82. package/src/components/connectors/PinterestConnector.jsx +208 -0
  83. package/src/components/connectors/README.md +292 -0
  84. package/src/components/connectors/RedditConnector.js +229 -0
  85. package/src/components/connectors/RedditConnector.jsx +229 -0
  86. package/src/components/connectors/SephoraConnector.js +482 -0
  87. package/src/components/connectors/SephoraConnector.jsx +482 -0
  88. package/src/components/connectors/TikTokConnector.jsx +430 -0
  89. package/src/components/connectors/YoutubeConnector.js +361 -0
  90. package/src/components/connectors/YoutubeConnector.jsx +361 -0
  91. package/src/components/connectors/index.js +50 -0
  92. package/src/components/icons.jsx +46 -0
  93. package/src/components/icons.tsx +21 -0
  94. package/src/components/ui/PageLayout.jsx +1255 -0
  95. package/src/components/ui/PrimaryButton.jsx +162 -0
  96. package/src/components/ui/button.jsx +49 -0
  97. package/src/components/ui/card.jsx +61 -0
  98. package/src/components/ui/checkbox.jsx +33 -0
  99. package/src/components/ui/label.jsx +29 -0
  100. package/src/components/utils/UpdateConnections.js +45 -0
  101. package/src/components/utils/oauthHelper.js +97 -0
  102. package/src/config/api-config.js +138 -0
  103. package/src/deepLink.jsx +38 -0
  104. package/src/getPin.js +26 -0
  105. package/src/icons/Avatar.png +0 -0
  106. package/src/icons/Sentiment.png +0 -0
  107. package/src/icons/Trait.png +0 -0
  108. package/src/iframe/DataRequestPage.jsx +285 -0
  109. package/src/iframe/OnairosButtonIntegration.md +148 -0
  110. package/src/iframe/components/Box.jsx +56 -0
  111. package/src/iframe/components/IndividualConnection.jsx +88 -0
  112. package/src/iframe/dataRequestHandler.js +714 -0
  113. package/src/iframe/data_request_iframe.html +27 -0
  114. package/src/iframe/data_request_page.js +47 -0
  115. package/src/iframe/icons/Avatar.png +1 -0
  116. package/src/iframe/icons/Avatar2.png +1 -0
  117. package/src/iframe/icons/Sentiment.png +1 -0
  118. package/src/iframe/icons/Trait.png +1 -0
  119. package/src/iframe/icons/onairos_logo.png +0 -0
  120. package/src/iframe/utils/api.js +57 -0
  121. package/src/index.js +274 -0
  122. package/src/laravel/OnairosVue.vue +410 -0
  123. package/src/laravel/blade-helpers.js +320 -0
  124. package/src/laravel/vite-plugin.js +179 -0
  125. package/src/mobile/MobileDataRequestPage.jsx +233 -0
  126. package/src/mobile/components/MobileBox.jsx +71 -0
  127. package/src/mobile/components/MobileIndividualConnection.jsx +51 -0
  128. package/src/mobile/shims/browser-apis.js +78 -0
  129. package/src/mobile/shims/lucide-shim.js +85 -0
  130. package/src/newUI/EMAIL_VERIFICATION_API_SCHEMA.md +268 -0
  131. package/src/newUI/PlatformConnectorsStep.tsx +435 -0
  132. package/src/newUI/PrimaryButton.tsx +213 -0
  133. package/src/newUI/SignInStep.tsx +194 -0
  134. package/src/newUI/VerificationStep.tsx +133 -0
  135. package/src/newUI/WelcomeScreen.tsx +311 -0
  136. package/src/newUI/services/connectedAccountsService.js +129 -0
  137. package/src/onairos.capacitor.jsx +16 -0
  138. package/src/onairos.core.jsx +133 -0
  139. package/src/onairos.jsx +14 -0
  140. package/src/onairos.native.jsx +15 -0
  141. package/src/onairosButton.jsx +9000 -0
  142. package/src/overlay/CheckBox.jsx +114 -0
  143. package/src/overlay/IndividualConnection copy.js +86 -0
  144. package/src/overlay/IndividualConnection.js +191 -0
  145. package/src/overlay/IndividualConnectionNew.jsx +157 -0
  146. package/src/overlay/box.js +84 -0
  147. package/src/overlay/overlay.js +437 -0
  148. package/src/styles/onairos-scoped-preflight.css +97 -0
  149. package/src/styles/sdkCssRegistry.js +20 -0
  150. package/src/styles/styleLoaderInsertShadow.js +69 -0
  151. package/src/styles/tailwind.capacitor.css +395 -0
  152. package/src/styles/tailwind.css +395 -0
  153. package/src/theme/colors.js +40 -0
  154. package/src/utils/apiKeyValidation.js +341 -0
  155. package/src/utils/apiResponseLogger.js +316 -0
  156. package/src/utils/authHeaders.js +275 -0
  157. package/src/utils/biometrics.js +26 -0
  158. package/src/utils/bookmarkletUtils.js +28 -0
  159. package/src/utils/capacitorDetection.js +278 -0
  160. package/src/utils/capacitorLLMHelper.js +352 -0
  161. package/src/utils/capacitorPlugins.js +366 -0
  162. package/src/utils/crossDomainSSO.js +587 -0
  163. package/src/utils/deepLinking.js +27 -0
  164. package/src/utils/devLogger.js +46 -0
  165. package/src/utils/extensionDetection.js +418 -0
  166. package/src/utils/extractMemory.js +277 -0
  167. package/src/utils/framerBrandingOverrides.js +40 -0
  168. package/src/utils/googleWebClientId.js +55 -0
  169. package/src/utils/overlayHandler.js +224 -0
  170. package/src/utils/platformDisconnect.js +309 -0
  171. package/src/utils/pollTrainingStatus.js +200 -0
  172. package/src/utils/rawMemoriesAccess.js +211 -0
  173. package/src/utils/resolveBackendAppId.js +47 -0
  174. package/src/utils/responseFormatter.js +140 -0
  175. package/src/utils/sdkDebugStorage.js +113 -0
  176. package/src/utils/sdkInitialization.js +645 -0
  177. package/src/utils/sessionManager.js +1258 -0
  178. package/src/utils/startBackgroundTraining.js +100 -0
  179. package/src/utils/userDataFormatter.js +222 -0
  180. package/index.d.ts +0 -1
  181. package/index.js +0 -1
@@ -0,0 +1,430 @@
1
+ import React, { Component } from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import { buildBookmarkletHref } from '../../utils/bookmarkletUtils';
4
+ import { API_CONFIG } from '../../config/api-config';
5
+
6
+ /**
7
+ * TikTok Connector - Social Video Data Extraction
8
+ * Platform identifier: mobile-tiktok
9
+ * Brand color: #010101 / #FE2C55
10
+ */
11
+ const TIKTOK_BOOKMARKLET_CODE = `javascript:(async function(){
12
+ try {
13
+ var host = (location.hostname || '').toLowerCase();
14
+ if (!(host === 'tiktok.com' || host === 'www.tiktok.com' || host.endsWith('.tiktok.com'))) {
15
+ alert('Please open TikTok (www.tiktok.com) and try again.');
16
+ return;
17
+ }
18
+
19
+ var ON_TOKEN = "__ONAIROS_TOKEN__";
20
+ var ON_EMAIL = "__ONAIROS_EMAIL__";
21
+
22
+ var consent = window.confirm(
23
+ 'Onairos TikTok Export\\n\\n' +
24
+ 'Allow Onairos to export your TikTok data?\\n\\n' +
25
+ '- Profile metadata\\n' +
26
+ '- Video metadata\\n' +
27
+ '- Engagement signals (likes/comments)\\n\\n' +
28
+ 'Your data is encrypted and only used to build your personal AI model.'
29
+ );
30
+ if (!consent) return;
31
+
32
+ function text(el) {
33
+ if (!el) return '';
34
+ return String(el.textContent || '').replace(/\\s+/g, ' ').trim();
35
+ }
36
+
37
+ function toNumber(value) {
38
+ if (value === null || value === undefined) return null;
39
+ var raw = String(value).trim().toLowerCase().replace(/,/g, '');
40
+ var mult = 1;
41
+ if (raw.endsWith('k')) { mult = 1000; raw = raw.slice(0, -1); }
42
+ if (raw.endsWith('m')) { mult = 1000000; raw = raw.slice(0, -1); }
43
+ if (raw.endsWith('b')) { mult = 1000000000; raw = raw.slice(0, -1); }
44
+ var n = parseFloat(raw.replace(/[^0-9.]/g, ''));
45
+ if (isNaN(n)) return null;
46
+ return Math.round(n * mult);
47
+ }
48
+
49
+ function extractProfile() {
50
+ var profile = {
51
+ username: null,
52
+ displayName: null,
53
+ bio: null,
54
+ followers: null,
55
+ following: null,
56
+ likesReceived: null,
57
+ profileUrl: location.href
58
+ };
59
+
60
+ var pathMatch = location.pathname.match(/@([^/?]+)/);
61
+ if (pathMatch) profile.username = pathMatch[1];
62
+
63
+ var ogTitle = document.querySelector('meta[property="og:title"]');
64
+ var ogDesc = document.querySelector('meta[property="og:description"]');
65
+ if (ogTitle && !profile.displayName) profile.displayName = ogTitle.content;
66
+ if (ogDesc && !profile.bio) profile.bio = ogDesc.content;
67
+
68
+ var statContainer = document.querySelector('[data-e2e="user-stats"]') || document.body;
69
+ var statText = text(statContainer);
70
+ var followersMatch = statText.match(/([0-9.,]+[kmb]?)\\s*followers?/i);
71
+ var followingMatch = statText.match(/([0-9.,]+[kmb]?)\\s*following/i);
72
+ var likesMatch = statText.match(/([0-9.,]+[kmb]?)\\s*likes?/i);
73
+ if (followersMatch) profile.followers = toNumber(followersMatch[1]);
74
+ if (followingMatch) profile.following = toNumber(followingMatch[1]);
75
+ if (likesMatch) profile.likesReceived = toNumber(likesMatch[1]);
76
+
77
+ return profile;
78
+ }
79
+
80
+ function extractVideos() {
81
+ var anchors = Array.prototype.slice.call(
82
+ document.querySelectorAll('a[href*="/video/"]')
83
+ );
84
+ var seen = {};
85
+ var videos = [];
86
+
87
+ anchors.forEach(function(a) {
88
+ if (videos.length >= 80) return;
89
+ var href = a.getAttribute('href') || '';
90
+ var fullUrl = href.indexOf('http') === 0 ? href : (location.origin + href);
91
+ if (!/\\/video\\/\\d+/.test(fullUrl)) return;
92
+ if (seen[fullUrl]) return;
93
+ seen[fullUrl] = true;
94
+
95
+ var videoIdMatch = fullUrl.match(/\\/video\\/(\\d+)/);
96
+ var videoId = videoIdMatch ? videoIdMatch[1] : ('video_' + videos.length);
97
+
98
+ var card = a.closest('[data-e2e*="user-post-item"], [class*="DivItemContainer"], [class*="video-feed-item"]') || a.parentElement;
99
+ var cardText = text(card);
100
+ var viewsMatch = cardText.match(/([0-9.,]+[kmb]?)\\s*(views?|plays?)/i);
101
+ var likesMatch = cardText.match(/([0-9.,]+[kmb]?)\\s*likes?/i);
102
+ var commentsMatch = cardText.match(/([0-9.,]+[kmb]?)\\s*comments?/i);
103
+
104
+ var captionEl = card ? card.querySelector('[data-e2e="video-desc"], [class*="DivContainer"] p, [class*="caption"]') : null;
105
+ var thumbEl = card ? card.querySelector('img') : null;
106
+
107
+ videos.push({
108
+ videoId: videoId,
109
+ url: fullUrl,
110
+ caption: text(captionEl) || null,
111
+ thumbnailUrl: thumbEl && thumbEl.src ? thumbEl.src : null,
112
+ viewCount: viewsMatch ? toNumber(viewsMatch[1]) : null,
113
+ likeCount: likesMatch ? toNumber(likesMatch[1]) : null,
114
+ commentCount: commentsMatch ? toNumber(commentsMatch[1]) : null
115
+ });
116
+ });
117
+
118
+ return videos;
119
+ }
120
+
121
+ function extractComments() {
122
+ var commentEls = document.querySelectorAll(
123
+ '[data-e2e="comment-level-1"], [class*="DivCommentItemContainer"], [class*="CommentListContainer"] p'
124
+ );
125
+ var comments = [];
126
+ var seen = {};
127
+ Array.prototype.forEach.call(commentEls, function(el, idx) {
128
+ if (comments.length >= 120) return;
129
+ var t = text(el);
130
+ if (!t || t.length < 2) return;
131
+ var key = t.toLowerCase().slice(0, 120);
132
+ if (seen[key]) return;
133
+ seen[key] = true;
134
+ comments.push({
135
+ commentId: 'comment_' + idx,
136
+ text: t.slice(0, 500),
137
+ extractedAt: new Date().toISOString()
138
+ });
139
+ });
140
+ return comments;
141
+ }
142
+
143
+ var videos = extractVideos();
144
+ var comments = extractComments();
145
+ var profile = extractProfile();
146
+
147
+ var likedVideos = videos.filter(function(v) {
148
+ return (v.likeCount || 0) > 0;
149
+ }).slice(0, 80);
150
+
151
+ var payload = {
152
+ platform: 'mobile-tiktok',
153
+ dataType: 'social_video',
154
+ data: {
155
+ profile: profile,
156
+ videos: videos,
157
+ likedVideos: likedVideos,
158
+ comments: comments
159
+ },
160
+ summary: {
161
+ videoCount: videos.length,
162
+ likedVideoCount: likedVideos.length,
163
+ commentCount: comments.length
164
+ },
165
+ mobileMetadata: {
166
+ platform: 'web',
167
+ source: 'bookmarklet',
168
+ extractedAt: new Date().toISOString(),
169
+ pageUrl: location.href,
170
+ userAgent: navigator.userAgent
171
+ }
172
+ };
173
+
174
+ if (!ON_TOKEN || ON_TOKEN === '__ONAIROS_TOKEN__') {
175
+ alert('Data extracted but no token found. Please open Onairos and reconnect TikTok.');
176
+ return;
177
+ }
178
+
179
+ var response = await fetch('__ONAIROS_BASE_URL__/platform-data/store', {
180
+ method: 'POST',
181
+ headers: {
182
+ 'Content-Type': 'application/json',
183
+ 'Authorization': 'Bearer ' + ON_TOKEN
184
+ },
185
+ body: JSON.stringify(payload)
186
+ });
187
+
188
+ if (!response.ok) {
189
+ throw new Error('HTTP ' + response.status);
190
+ }
191
+
192
+ var result = await response.json();
193
+ console.log('[Onairos TikTok] stored', result);
194
+ alert('Onairos TikTok: synced ' + videos.length + ' videos and ' + comments.length + ' comments.');
195
+ } catch (e) {
196
+ console.error('[Onairos TikTok] error', e);
197
+ alert('Onairos TikTok error: ' + (e && e.message ? e.message : e));
198
+ }
199
+ })();`;
200
+
201
+ class TikTokConnector extends Component {
202
+ constructor(props) {
203
+ super(props);
204
+ this.state = {
205
+ connected: false,
206
+ open: false,
207
+ copied: false,
208
+ isMobile: false
209
+ };
210
+ this.handleClose = this.handleClose.bind(this);
211
+ this.setConnected = this.setConnected.bind(this);
212
+ this.handleResize = this.handleResize.bind(this);
213
+ this.handleCopyCode = this.handleCopyCode.bind(this);
214
+ }
215
+
216
+ componentDidMount() {
217
+ this.handleResize();
218
+ window.addEventListener('resize', this.handleResize);
219
+ }
220
+
221
+ componentWillUnmount() {
222
+ window.removeEventListener('resize', this.handleResize);
223
+ }
224
+
225
+ handleResize() {
226
+ this.setState({ isMobile: window.innerWidth <= 768 });
227
+ }
228
+
229
+ getUserToken() {
230
+ try {
231
+ const directToken = localStorage.getItem('onairos_user_token');
232
+ if (directToken) return directToken;
233
+ const userData = JSON.parse(localStorage.getItem('onairosUser') || '{}');
234
+ if (userData.token) return userData.token;
235
+ return null;
236
+ } catch {
237
+ return null;
238
+ }
239
+ }
240
+
241
+ getUserEmail() {
242
+ try {
243
+ const userData = JSON.parse(localStorage.getItem('onairosUser') || '{}');
244
+ return userData.email || userData.userEmail || null;
245
+ } catch {
246
+ return null;
247
+ }
248
+ }
249
+
250
+ getBookmarkletWithToken() {
251
+ const token = this.getUserToken();
252
+ const email = this.getUserEmail();
253
+ let code = TIKTOK_BOOKMARKLET_CODE;
254
+ if (token) code = code.replace('__ONAIROS_TOKEN__', token);
255
+ if (email) code = code.replace('__ONAIROS_EMAIL__', email);
256
+ code = code.replace('__ONAIROS_BASE_URL__', API_CONFIG.getBaseUrl());
257
+ return buildBookmarkletHref(code);
258
+ }
259
+
260
+ handleCopyCode(code) {
261
+ navigator.clipboard.writeText(code);
262
+ this.setState({ copied: true });
263
+ setTimeout(() => this.setState({ copied: false }), 1800);
264
+ }
265
+
266
+ setConnected() {
267
+ this.setState({ connected: true });
268
+ if (this.props.onConnectionChange) {
269
+ this.props.onConnectionChange('TikTok', true);
270
+ }
271
+ this.handleClose();
272
+ }
273
+
274
+ handleClose() {
275
+ this.setState({ open: false });
276
+ if (this.props.onClose) this.props.onClose();
277
+ }
278
+
279
+ render() {
280
+ const { open = this.props.open || this.state.open } = this.props;
281
+ if (!open) return null;
282
+
283
+ const { isMobile, copied } = this.state;
284
+ const bookmarkletCode = this.getBookmarkletWithToken();
285
+
286
+ const modalContent = (
287
+ <>
288
+ <style>{`
289
+ .tt-modal { color: #fff; }
290
+ .tt-card {
291
+ background:
292
+ radial-gradient(circle at top, rgba(254,44,85,0.25), transparent 55%),
293
+ radial-gradient(circle at bottom, rgba(8,8,8,0.95), rgba(5,5,5,1));
294
+ border: 1px solid rgba(255,255,255,0.12);
295
+ }
296
+ .tt-pill {
297
+ background: linear-gradient(135deg, #25F4EE 0%, #FE2C55 100%);
298
+ border: 1px solid rgba(255,255,255,0.35);
299
+ }
300
+ .tt-step {
301
+ background: linear-gradient(135deg, #25F4EE 0%, #FE2C55 100%);
302
+ }
303
+ `}</style>
304
+ <div style={{ position: 'fixed', inset: 0, zIndex: 2147483647, pointerEvents: 'none' }}>
305
+ <div
306
+ className="fixed inset-0 bg-black/65 backdrop-blur-sm"
307
+ style={{ pointerEvents: 'auto' }}
308
+ onClick={this.handleClose}
309
+ />
310
+ <div className="fixed inset-0 flex items-center justify-center p-4 pointer-events-none">
311
+ <div className="tt-modal w-full max-w-md pointer-events-auto">
312
+ <div className="tt-card rounded-3xl overflow-hidden shadow-[0_30px_80px_rgba(254,44,85,0.35)]">
313
+ <div className="relative px-5 py-4 border-b border-white/10 bg-white/5">
314
+ <button
315
+ onClick={this.handleClose}
316
+ className="absolute right-4 top-4 p-1.5 hover:bg-white/20 rounded-full transition-colors"
317
+ aria-label="Close"
318
+ >
319
+ <svg className="w-4 h-4 text-slate-100" fill="none" stroke="currentColor" viewBox="0 0 24 24">
320
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
321
+ </svg>
322
+ </button>
323
+ <h2 className="text-xl font-semibold pr-8">Connect TikTok</h2>
324
+ <p className="text-sm mt-1 text-slate-200">
325
+ Export profile info, video metadata, likes, and comments.
326
+ </p>
327
+ </div>
328
+
329
+ <div className="px-5 py-4 space-y-4">
330
+ {isMobile ? (
331
+ <>
332
+ <div className="flex gap-3">
333
+ <div className="tt-step rounded-full w-7 h-7 flex items-center justify-center text-sm font-semibold">1</div>
334
+ <div className="flex-1">
335
+ <h3 className="text-sm font-semibold">Copy the bookmark code</h3>
336
+ <button
337
+ onClick={() => this.handleCopyCode(bookmarkletCode)}
338
+ className="mt-2 w-full rounded-xl border border-white/20 bg-white/10 px-3 py-2 text-sm font-medium hover:bg-white/20"
339
+ >
340
+ {copied ? 'Copied' : 'Copy code'}
341
+ </button>
342
+ </div>
343
+ </div>
344
+ <div className="flex gap-3">
345
+ <div className="tt-step rounded-full w-7 h-7 flex items-center justify-center text-sm font-semibold">2</div>
346
+ <div className="flex-1">
347
+ <h3 className="text-sm font-semibold">Create a bookmark</h3>
348
+ <p className="text-xs text-slate-300">Add a bookmark and paste the copied code as its URL.</p>
349
+ </div>
350
+ </div>
351
+ <div className="flex gap-3">
352
+ <div className="tt-step rounded-full w-7 h-7 flex items-center justify-center text-sm font-semibold">3</div>
353
+ <div className="flex-1">
354
+ <h3 className="text-sm font-semibold">Run it on TikTok</h3>
355
+ <button
356
+ onClick={() => window.open('https://www.tiktok.com/foryou', '_blank')}
357
+ className="tt-pill mt-2 rounded-full px-3 py-1.5 text-xs font-semibold text-black"
358
+ >
359
+ Open TikTok
360
+ </button>
361
+ </div>
362
+ </div>
363
+ </>
364
+ ) : (
365
+ <>
366
+ <div className="flex gap-3">
367
+ <div className="tt-step rounded-full w-7 h-7 flex items-center justify-center text-sm font-semibold">1</div>
368
+ <div className="flex-1">
369
+ <h3 className="text-sm font-semibold">Drag to bookmarks bar</h3>
370
+ <a
371
+ href={bookmarkletCode}
372
+ draggable="true"
373
+ onDragStart={(e) => {
374
+ e.dataTransfer.setData('text/plain', bookmarkletCode);
375
+ e.dataTransfer.effectAllowed = 'copy';
376
+ }}
377
+ onClick={(e) => {
378
+ e.preventDefault();
379
+ alert('Drag this button to your bookmarks bar.');
380
+ }}
381
+ className="tt-pill mt-2 inline-flex items-center gap-1.5 rounded-full px-4 py-2 text-sm font-semibold text-black cursor-move"
382
+ >
383
+ <span>♪</span>
384
+ <span>Onairos TikTok</span>
385
+ </a>
386
+ </div>
387
+ </div>
388
+ <div className="flex gap-3">
389
+ <div className="tt-step rounded-full w-7 h-7 flex items-center justify-center text-sm font-semibold">2</div>
390
+ <div className="flex-1">
391
+ <h3 className="text-sm font-semibold">Open TikTok while logged in</h3>
392
+ <button
393
+ onClick={() => window.open('https://www.tiktok.com/foryou', '_blank')}
394
+ className="tt-pill mt-2 rounded-full px-4 py-2 text-xs font-semibold text-black"
395
+ >
396
+ Open TikTok
397
+ </button>
398
+ </div>
399
+ </div>
400
+ <div className="flex gap-3">
401
+ <div className="tt-step rounded-full w-7 h-7 flex items-center justify-center text-sm font-semibold">3</div>
402
+ <div className="flex-1">
403
+ <h3 className="text-sm font-semibold">Click the bookmark</h3>
404
+ <p className="text-xs text-slate-300">It collects profile, videos, and engagement metadata, then syncs to Onairos.</p>
405
+ </div>
406
+ </div>
407
+ </>
408
+ )}
409
+ </div>
410
+
411
+ <div className="px-5 py-4 bg-white/5 border-t border-white/10">
412
+ <button
413
+ onClick={() => this.setConnected()}
414
+ className="tt-pill w-full rounded-full px-4 py-2.5 text-sm font-semibold text-black"
415
+ >
416
+ Got it! ✓
417
+ </button>
418
+ </div>
419
+ </div>
420
+ </div>
421
+ </div>
422
+ </div>
423
+ </>
424
+ );
425
+
426
+ return ReactDOM.createPortal(modalContent, document.body);
427
+ }
428
+ }
429
+
430
+ export default TikTokConnector;