@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,726 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import { getUserAuthHeaders, isUserAuthenticated } from '../../utils/authHeaders';
|
|
4
|
+
import { API_CONFIG } from '../../config/api-config';
|
|
5
|
+
import { buildBookmarkletHref } from '../../utils/bookmarkletUtils';
|
|
6
|
+
import { getCapacitorPlugin, isCapacitorNativePlatform } from '../../utils/capacitorPlugins.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Instagram Data Connector - Enhanced Social Media Data Extraction
|
|
10
|
+
* Uses bookmarklet pattern for web-based extraction (like ChatGPT/Gemini)
|
|
11
|
+
* Platform identifier: mobile-instagram
|
|
12
|
+
* Brand Color: #E1306C (Pink/Magenta)
|
|
13
|
+
*
|
|
14
|
+
* Extracts: Likes, Saves, Collections
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// Instagram bookmarklet: Extracts likes, saves, collections
|
|
18
|
+
const INSTAGRAM_BOOKMARKLET_CODE = `javascript:(async function(){
|
|
19
|
+
try {
|
|
20
|
+
var host = (location.hostname || '').toLowerCase();
|
|
21
|
+
if (!(host === 'instagram.com' || host.endsWith('.instagram.com') || host === 'www.instagram.com')) {
|
|
22
|
+
alert('Please open Instagram (www.instagram.com) and try again.');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var ON_TOKEN = "__ONAIROS_TOKEN__";
|
|
27
|
+
var ON_EMAIL = "__ONAIROS_EMAIL__";
|
|
28
|
+
|
|
29
|
+
var consent = window.confirm(
|
|
30
|
+
'Onairos Instagram Export\\n\\n' +
|
|
31
|
+
'Allow Onairos to export your Instagram engagement?\\n\\n' +
|
|
32
|
+
'- Your liked posts\\n' +
|
|
33
|
+
'- Your saved posts\\n' +
|
|
34
|
+
'- Your collections\\n\\n' +
|
|
35
|
+
'Your data is encrypted and only used to build your personal AI model.'
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
if (!consent) {
|
|
39
|
+
console.log('Onairos Instagram export cancelled by user.');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
console.log('Onairos Instagram export consent granted. Extracting data...');
|
|
44
|
+
|
|
45
|
+
/* Cookie check removed - sessionid is HttpOnly */
|
|
46
|
+
|
|
47
|
+
function extractLikes() {
|
|
48
|
+
var likes = [];
|
|
49
|
+
var likeElements = document.querySelectorAll('[data-testid*="like"], article, [role="article"]');
|
|
50
|
+
likeElements.forEach(function(el, idx) {
|
|
51
|
+
if (idx >= 50) return;
|
|
52
|
+
|
|
53
|
+
var imgEl = el.querySelector('img[src*="cdninstagram"]');
|
|
54
|
+
var captionEl = el.querySelector('[class*="caption"], span');
|
|
55
|
+
var usernameEl = el.querySelector('a[href*="/"]');
|
|
56
|
+
|
|
57
|
+
if (imgEl || captionEl) {
|
|
58
|
+
likes.push({
|
|
59
|
+
id: 'like_' + idx,
|
|
60
|
+
type: 'like',
|
|
61
|
+
mediaType: imgEl ? 'image' : 'text',
|
|
62
|
+
caption: captionEl ? captionEl.textContent.slice(0, 200) : null,
|
|
63
|
+
owner: usernameEl ? usernameEl.textContent.replace('@', '') : null,
|
|
64
|
+
url: imgEl ? imgEl.src : null
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return likes;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function extractSaves() {
|
|
72
|
+
var saves = [];
|
|
73
|
+
var saveElements = document.querySelectorAll('[data-testid*="saved"], [class*="saved"]');
|
|
74
|
+
saveElements.forEach(function(el, idx) {
|
|
75
|
+
if (idx >= 50) return;
|
|
76
|
+
|
|
77
|
+
var imgEl = el.querySelector('img');
|
|
78
|
+
var captionEl = el.querySelector('span');
|
|
79
|
+
|
|
80
|
+
saves.push({
|
|
81
|
+
id: 'save_' + idx,
|
|
82
|
+
type: 'save',
|
|
83
|
+
mediaType: imgEl ? 'image' : 'video',
|
|
84
|
+
caption: captionEl ? captionEl.textContent.slice(0, 200) : null,
|
|
85
|
+
url: imgEl ? imgEl.src : null
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
return saves;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function extractCollections() {
|
|
92
|
+
var collections = [];
|
|
93
|
+
var collectionElements = document.querySelectorAll('[data-testid*="collection"], [class*="collection"]');
|
|
94
|
+
collectionElements.forEach(function(el, idx) {
|
|
95
|
+
var nameEl = el.querySelector('span, h2, h3');
|
|
96
|
+
var countEl = el.querySelector('[class*="count"]');
|
|
97
|
+
var coverEl = el.querySelector('img');
|
|
98
|
+
|
|
99
|
+
collections.push({
|
|
100
|
+
id: 'collection_' + idx,
|
|
101
|
+
name: nameEl ? nameEl.textContent.trim() : 'Collection ' + (idx + 1),
|
|
102
|
+
mediaCount: countEl ? parseInt(countEl.textContent) || 0 : 0,
|
|
103
|
+
coverUrl: coverEl ? coverEl.src : null
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
return collections;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* Get user ID from page */
|
|
110
|
+
function getUserId() {
|
|
111
|
+
try {
|
|
112
|
+
var scripts = document.querySelectorAll('script');
|
|
113
|
+
for (var i = 0; i < scripts.length; i++) {
|
|
114
|
+
var text = scripts[i].textContent;
|
|
115
|
+
var match = text.match(/"userId":"(\\d+)"/);
|
|
116
|
+
if (match) return match[1];
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
} catch(e) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Extract all data */
|
|
125
|
+
var likes = extractLikes();
|
|
126
|
+
var saves = extractSaves();
|
|
127
|
+
var collections = extractCollections();
|
|
128
|
+
var userId = getUserId();
|
|
129
|
+
|
|
130
|
+
/* Build payload */
|
|
131
|
+
var payload = {
|
|
132
|
+
platform: 'mobile-instagram',
|
|
133
|
+
dataType: 'social',
|
|
134
|
+
data: {
|
|
135
|
+
likes: likes,
|
|
136
|
+
saves: saves,
|
|
137
|
+
collections: collections,
|
|
138
|
+
instagramUserId: userId
|
|
139
|
+
},
|
|
140
|
+
summary: {
|
|
141
|
+
likeCount: likes.length,
|
|
142
|
+
saveCount: saves.length,
|
|
143
|
+
collectionCount: collections.length,
|
|
144
|
+
totalEngagements: likes.length + saves.length
|
|
145
|
+
},
|
|
146
|
+
mobileMetadata: {
|
|
147
|
+
platform: 'web',
|
|
148
|
+
source: 'bookmarklet',
|
|
149
|
+
extractedAt: new Date().toISOString()
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/* Create Overlay UI */
|
|
154
|
+
var d = document.createElement('div');
|
|
155
|
+
d.style.cssText = 'position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.85);z-index:2147483647;display:flex;flex-direction:column;align-items:center;justify-content:center;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;';
|
|
156
|
+
d.innerHTML =
|
|
157
|
+
'<div style="background:#1e1e1e;padding:24px;border-radius:16px;width:90%;max-width:360px;text-align:center;box-shadow:0 20px 50px rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.1);">' +
|
|
158
|
+
'<h2 style="margin:0 0 8px;color:white;font-size:20px;font-weight:600;">Data Ready</h2>' +
|
|
159
|
+
'<p style="margin:0 0 20px;color:#a8a8a8;font-size:14px;">' +
|
|
160
|
+
likes.length + ' likes • ' + saves.length + ' saves' +
|
|
161
|
+
'</p>' +
|
|
162
|
+
'<div style="display:flex;flex-direction:column;gap:12px;">' +
|
|
163
|
+
'<button id="btn-sync" style="padding:14px;background:linear-gradient(45deg, #f09433, #bc1888);border:none;border-radius:12px;color:white;font-weight:600;font-size:16px;cursor:pointer;">' +
|
|
164
|
+
'Sync Now' +
|
|
165
|
+
'</button>' +
|
|
166
|
+
'<button id="btn-close" style="padding:10px;background:transparent;border:none;color:#666;font-size:14px;cursor:pointer;margin-top:8px;">' +
|
|
167
|
+
'Close' +
|
|
168
|
+
'</button>' +
|
|
169
|
+
'</div>' +
|
|
170
|
+
'<p id="status-msg" style="margin:16px 0 0;font-size:12px;color:#666;line-height:1.4;">' +
|
|
171
|
+
'Sync opens a popup to send data to Onairos.' +
|
|
172
|
+
'</p>' +
|
|
173
|
+
'</div>';
|
|
174
|
+
|
|
175
|
+
document.body.appendChild(d);
|
|
176
|
+
|
|
177
|
+
var btnSync = document.getElementById('btn-sync');
|
|
178
|
+
var btnClose = document.getElementById('btn-close');
|
|
179
|
+
var statusMsg = document.getElementById('status-msg');
|
|
180
|
+
|
|
181
|
+
btnSync.onclick = function() {
|
|
182
|
+
if (!ON_TOKEN || ON_TOKEN === '__ONAIROS_TOKEN__') {
|
|
183
|
+
statusMsg.innerText = 'No token found. Please log in to Onairos.';
|
|
184
|
+
statusMsg.style.color = '#ef4444';
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
btnSync.innerText = 'Opening Popup...';
|
|
189
|
+
|
|
190
|
+
/* Popup Logic */
|
|
191
|
+
var html = '<!DOCTYPE html><html><head><title>Syncing...</title></head>' +
|
|
192
|
+
'<body style="background:#111;color:#fff;display:flex;justify-content:center;align-items:center;height:100vh;font-family:sans-serif;">' +
|
|
193
|
+
'<div><h2>Syncing...</h2><div id="s">Connecting...</div></div>' +
|
|
194
|
+
'<script>' +
|
|
195
|
+
'var d=' + JSON.stringify(payload) + ';var t="' + ON_TOKEN + '";' +
|
|
196
|
+
'fetch("__ONAIROS_BASE_URL__/platform-data/store",{method:"POST",headers:{"Content-Type":"application/json","Authorization":"Bearer "+t},body:JSON.stringify(d)})' +
|
|
197
|
+
'.then(r=>{if(!r.ok)throw new Error(r.status);return r.json()})' +
|
|
198
|
+
'.then(()=>{document.getElementById("s").innerText="✅ Done!";setTimeout(()=>window.close(),1000)})' +
|
|
199
|
+
'.catch(e=>{document.getElementById("s").innerText="❌ "+e.message});' +
|
|
200
|
+
'<\/script></body></html>';
|
|
201
|
+
|
|
202
|
+
/* Try Blob URL first */
|
|
203
|
+
try {
|
|
204
|
+
var blob = new Blob([html], {type: 'text/html'});
|
|
205
|
+
var url = URL.createObjectURL(blob);
|
|
206
|
+
var win = window.open(url, '_blank', 'width=400,height=400');
|
|
207
|
+
if(!win) throw new Error('Popup blocked');
|
|
208
|
+
} catch(e) {
|
|
209
|
+
/* Fallback to Data URI if Blob fails */
|
|
210
|
+
console.log('Blob failed, trying Data URI');
|
|
211
|
+
window.open('data:text/html;charset=utf-8,' + encodeURIComponent(html), '_blank', 'width=400,height=400');
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
btnClose.onclick = function() {
|
|
216
|
+
d.remove();
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
} catch(e) {
|
|
220
|
+
console.error('[Onairos Instagram] Error:', e);
|
|
221
|
+
alert('❌ Onairos Instagram error: ' + (e && e.message ? e.message : e));
|
|
222
|
+
}
|
|
223
|
+
})();`;
|
|
224
|
+
|
|
225
|
+
class InstagramDataConnector extends Component {
|
|
226
|
+
constructor(props) {
|
|
227
|
+
super(props);
|
|
228
|
+
this.state = {
|
|
229
|
+
connected: false,
|
|
230
|
+
open: false,
|
|
231
|
+
isConnecting: false,
|
|
232
|
+
isMobile: false,
|
|
233
|
+
copied: false
|
|
234
|
+
};
|
|
235
|
+
this.handleClose = this.handleClose.bind(this);
|
|
236
|
+
this.handleOpen = this.handleOpen.bind(this);
|
|
237
|
+
this.connectInstagramNative = this.connectInstagramNative.bind(this);
|
|
238
|
+
this.setConnected = this.setConnected.bind(this);
|
|
239
|
+
this.setDisconnected = this.setDisconnected.bind(this);
|
|
240
|
+
this.handleResize = this.handleResize.bind(this);
|
|
241
|
+
this.handleCopyCode = this.handleCopyCode.bind(this);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
componentDidMount() {
|
|
245
|
+
this.handleResize();
|
|
246
|
+
window.addEventListener('resize', this.handleResize);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
componentWillUnmount() {
|
|
250
|
+
window.removeEventListener('resize', this.handleResize);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
handleResize() {
|
|
254
|
+
this.setState({ isMobile: window.innerWidth <= 768 });
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
handleCopyCode(code) {
|
|
258
|
+
navigator.clipboard.writeText(code);
|
|
259
|
+
this.setState({ copied: true });
|
|
260
|
+
setTimeout(() => this.setState({ copied: false }), 2000);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
async handleManualImport() {
|
|
264
|
+
const { manualData } = this.state;
|
|
265
|
+
if (!manualData) return;
|
|
266
|
+
|
|
267
|
+
this.setState({ isImporting: true, importStatus: null });
|
|
268
|
+
|
|
269
|
+
try {
|
|
270
|
+
const payload = JSON.parse(manualData);
|
|
271
|
+
const token = this.getUserToken();
|
|
272
|
+
|
|
273
|
+
if (!token) throw new Error('You must be logged in to import data.');
|
|
274
|
+
|
|
275
|
+
const baseUrl = API_CONFIG.getBaseUrl();
|
|
276
|
+
const response = await fetch(baseUrl + '/platform-data/store', {
|
|
277
|
+
method: 'POST',
|
|
278
|
+
headers: {
|
|
279
|
+
'Content-Type': 'application/json',
|
|
280
|
+
'Authorization': 'Bearer ' + token
|
|
281
|
+
},
|
|
282
|
+
body: JSON.stringify(payload)
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
if (!response.ok) throw new Error('HTTP ' + response.status);
|
|
286
|
+
|
|
287
|
+
this.setState({ importStatus: 'success', manualData: '' });
|
|
288
|
+
this.setConnected();
|
|
289
|
+
|
|
290
|
+
// Clear success message after 3s
|
|
291
|
+
setTimeout(() => this.setState({ importStatus: null }), 3000);
|
|
292
|
+
|
|
293
|
+
} catch (e) {
|
|
294
|
+
console.error('Import error:', e);
|
|
295
|
+
this.setState({ importStatus: 'error' });
|
|
296
|
+
alert('Import failed: ' + e.message);
|
|
297
|
+
} finally {
|
|
298
|
+
this.setState({ isImporting: false });
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
getUserToken() {
|
|
303
|
+
try {
|
|
304
|
+
const directToken = localStorage.getItem('onairos_user_token');
|
|
305
|
+
if (directToken) return directToken;
|
|
306
|
+
const userData = JSON.parse(localStorage.getItem('onairosUser') || '{}');
|
|
307
|
+
if (userData.token) return userData.token;
|
|
308
|
+
return null;
|
|
309
|
+
} catch {
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
getUserEmail() {
|
|
315
|
+
try {
|
|
316
|
+
const userData = JSON.parse(localStorage.getItem('onairosUser') || '{}');
|
|
317
|
+
return userData.email || userData.userEmail || null;
|
|
318
|
+
} catch {
|
|
319
|
+
return null;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
getBookmarkletWithToken() {
|
|
324
|
+
const token = this.getUserToken();
|
|
325
|
+
const email = this.getUserEmail();
|
|
326
|
+
let code = INSTAGRAM_BOOKMARKLET_CODE;
|
|
327
|
+
if (token) {
|
|
328
|
+
code = code.replace('__ONAIROS_TOKEN__', token);
|
|
329
|
+
}
|
|
330
|
+
if (email) {
|
|
331
|
+
code = code.replace('__ONAIROS_EMAIL__', email);
|
|
332
|
+
}
|
|
333
|
+
if (window.location.origin) {
|
|
334
|
+
code = code.replace('__ONAIROS_APP_URL__', window.location.origin);
|
|
335
|
+
}
|
|
336
|
+
code = code.replace('__ONAIROS_BASE_URL__', API_CONFIG.getBaseUrl());
|
|
337
|
+
return buildBookmarkletHref(code);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
setConnected() {
|
|
341
|
+
this.setState({ connected: true });
|
|
342
|
+
if (this.props.onConnectionChange) {
|
|
343
|
+
this.props.onConnectionChange('Instagram', true);
|
|
344
|
+
}
|
|
345
|
+
this.handleClose();
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
setDisconnected() {
|
|
349
|
+
this.setState({ connected: false });
|
|
350
|
+
if (this.props.onConnectionChange) {
|
|
351
|
+
this.props.onConnectionChange('Instagram', false);
|
|
352
|
+
}
|
|
353
|
+
this.handleClose();
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
handleOpen() {
|
|
357
|
+
this.setState({ open: true });
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
handleClose() {
|
|
361
|
+
this.setState({ open: false });
|
|
362
|
+
if (this.props.onClose) {
|
|
363
|
+
this.props.onClose();
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
async connectInstagramNative() {
|
|
368
|
+
const plugin = getCapacitorPlugin('OnairosInstagramNative', 'OnairosInstagramNativePlugin');
|
|
369
|
+
if (!isCapacitorNativePlatform() || !plugin?.connectInstagramNative) {
|
|
370
|
+
alert('Native Instagram connector is not available in this app build.');
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
this.setState({ isConnecting: true });
|
|
374
|
+
try {
|
|
375
|
+
const userData = JSON.parse(localStorage.getItem('onairosUser') || '{}');
|
|
376
|
+
const jwtToken =
|
|
377
|
+
localStorage.getItem('onairos_user_token') ||
|
|
378
|
+
userData.token ||
|
|
379
|
+
userData.jwt ||
|
|
380
|
+
'';
|
|
381
|
+
|
|
382
|
+
await plugin.connectInstagramNative({ jwtToken });
|
|
383
|
+
// Native overlay handles the rest; mark connected optimistically.
|
|
384
|
+
this.setConnected();
|
|
385
|
+
} catch (e) {
|
|
386
|
+
console.error('❌ [Instagram] Native connect error:', e);
|
|
387
|
+
alert(`Failed to connect Instagram natively. ${e?.message || e}`);
|
|
388
|
+
} finally {
|
|
389
|
+
this.setState({ isConnecting: false });
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
render() {
|
|
394
|
+
const { open = this.props.open || this.state.open } = this.props;
|
|
395
|
+
|
|
396
|
+
if (!open) return null;
|
|
397
|
+
|
|
398
|
+
// Capacitor native path: use in-app WKWebView connector (no bookmarklets).
|
|
399
|
+
if (isCapacitorNativePlatform() && getCapacitorPlugin('OnairosInstagramNative', 'OnairosInstagramNativePlugin')) {
|
|
400
|
+
const nativeModal = (
|
|
401
|
+
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[2147483647]">
|
|
402
|
+
<div className="bg-white rounded-lg shadow-xl max-w-md w-full mx-4 overflow-hidden">
|
|
403
|
+
<div className="p-6">
|
|
404
|
+
<h2 className="text-xl font-bold text-gray-900 mb-3">Connect Instagram</h2>
|
|
405
|
+
<p className="text-sm text-gray-700 mb-5">
|
|
406
|
+
This will open an in-app Instagram login to securely capture your session and export engagement data.
|
|
407
|
+
</p>
|
|
408
|
+
<div className="flex gap-3">
|
|
409
|
+
<button
|
|
410
|
+
onClick={this.handleClose}
|
|
411
|
+
className="flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50"
|
|
412
|
+
disabled={this.state.isConnecting}
|
|
413
|
+
>
|
|
414
|
+
Cancel
|
|
415
|
+
</button>
|
|
416
|
+
<button
|
|
417
|
+
onClick={this.connectInstagramNative}
|
|
418
|
+
className="flex-1 px-4 py-2 rounded-lg text-white bg-pink-600 hover:bg-pink-700 disabled:opacity-50"
|
|
419
|
+
disabled={this.state.isConnecting}
|
|
420
|
+
>
|
|
421
|
+
{this.state.isConnecting ? 'Opening…' : 'Connect Instagram'}
|
|
422
|
+
</button>
|
|
423
|
+
</div>
|
|
424
|
+
<p className="text-xs text-gray-500 mt-4">
|
|
425
|
+
Note: Instagram may challenge login in embedded browsers. If it fails, try again after completing any verification steps.
|
|
426
|
+
</p>
|
|
427
|
+
</div>
|
|
428
|
+
</div>
|
|
429
|
+
</div>
|
|
430
|
+
);
|
|
431
|
+
|
|
432
|
+
return ReactDOM.createPortal(nativeModal, document.body);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const bookmarkletCode = this.getBookmarkletWithToken();
|
|
436
|
+
const { isMobile, copied } = this.state;
|
|
437
|
+
|
|
438
|
+
const modalContent = (
|
|
439
|
+
<>
|
|
440
|
+
<style>{`
|
|
441
|
+
@keyframes instagramPulse {
|
|
442
|
+
0%, 100% { box-shadow: 0 0 0 0 rgba(225, 48, 108, 0.35); }
|
|
443
|
+
50% { box-shadow: 0 0 0 10px rgba(225, 48, 108, 0); }
|
|
444
|
+
}
|
|
445
|
+
.instagram-bookmarklet-button {
|
|
446
|
+
background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
|
|
447
|
+
border-radius: 9999px;
|
|
448
|
+
border: 1px solid rgba(255,255,255,0.2);
|
|
449
|
+
}
|
|
450
|
+
.instagram-bookmarklet-button:hover {
|
|
451
|
+
filter: brightness(1.1);
|
|
452
|
+
}
|
|
453
|
+
@keyframes fadeInScale {
|
|
454
|
+
0% { opacity: 0; transform: translateY(8px) scale(0.96); }
|
|
455
|
+
100% { opacity: 1; transform: translateY(0) scale(1); }
|
|
456
|
+
}
|
|
457
|
+
.instagram-modal-card {
|
|
458
|
+
animation: fadeInScale 200ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
459
|
+
background: #0f172a !important;
|
|
460
|
+
}
|
|
461
|
+
.instagram-step-circle {
|
|
462
|
+
background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
|
|
463
|
+
min-width: 28px;
|
|
464
|
+
width: 28px;
|
|
465
|
+
height: 28px;
|
|
466
|
+
}
|
|
467
|
+
/* Force all text in Instagram modal to be fully opaque white */
|
|
468
|
+
.instagram-modal-card,
|
|
469
|
+
.instagram-modal-card * {
|
|
470
|
+
color: #FFFFFF !important;
|
|
471
|
+
opacity: 1 !important;
|
|
472
|
+
-webkit-text-fill-color: #FFFFFF !important;
|
|
473
|
+
}
|
|
474
|
+
.instagram-modal-card h2,
|
|
475
|
+
.instagram-modal-card h3,
|
|
476
|
+
.instagram-modal-card p,
|
|
477
|
+
.instagram-modal-card span,
|
|
478
|
+
.instagram-modal-card strong,
|
|
479
|
+
.instagram-modal-card a {
|
|
480
|
+
color: #FFFFFF !important;
|
|
481
|
+
opacity: 1 !important;
|
|
482
|
+
-webkit-text-fill-color: #FFFFFF !important;
|
|
483
|
+
}
|
|
484
|
+
.instagram-modal-card svg {
|
|
485
|
+
color: currentColor !important;
|
|
486
|
+
opacity: 1 !important;
|
|
487
|
+
}
|
|
488
|
+
.instagram-modal-card .text-pink-300 {
|
|
489
|
+
color: #f9a8d4 !important;
|
|
490
|
+
-webkit-text-fill-color: #f9a8d4 !important;
|
|
491
|
+
}
|
|
492
|
+
@keyframes fadeIn {
|
|
493
|
+
from { opacity: 0; }
|
|
494
|
+
to { opacity: 1; }
|
|
495
|
+
}
|
|
496
|
+
`}</style>
|
|
497
|
+
|
|
498
|
+
{/* Wrapper to create new stacking context above everything */}
|
|
499
|
+
<div style={{
|
|
500
|
+
position: 'fixed',
|
|
501
|
+
inset: 0,
|
|
502
|
+
zIndex: 2147483647,
|
|
503
|
+
isolation: 'isolate',
|
|
504
|
+
pointerEvents: 'none'
|
|
505
|
+
}}>
|
|
506
|
+
{/* Backdrop - clickable to close */}
|
|
507
|
+
<div
|
|
508
|
+
className="fixed inset-0 bg-black/60 backdrop-blur-sm transition-opacity"
|
|
509
|
+
onClick={this.handleClose}
|
|
510
|
+
style={{
|
|
511
|
+
animation: 'fadeIn 150ms ease-out',
|
|
512
|
+
pointerEvents: 'auto'
|
|
513
|
+
}}
|
|
514
|
+
/>
|
|
515
|
+
|
|
516
|
+
{/* Modal Content */}
|
|
517
|
+
<div className="fixed inset-0 flex items-center justify-center p-4 pointer-events-none" style={{ zIndex: 1 }}>
|
|
518
|
+
<div
|
|
519
|
+
className="w-full max-w-md pointer-events-auto"
|
|
520
|
+
onClick={(e) => e.stopPropagation()}
|
|
521
|
+
>
|
|
522
|
+
<div className="instagram-modal-card rounded-3xl overflow-hidden shadow-[0_30px_80px_rgba(225,48,108,0.40)] border border-white/10 bg-[#0f172a]">
|
|
523
|
+
|
|
524
|
+
{/* Header */}
|
|
525
|
+
<div className="relative px-5 py-4 bg-gradient-to-r from-pink-500/20 to-purple-500/20">
|
|
526
|
+
<button
|
|
527
|
+
onClick={this.handleClose}
|
|
528
|
+
className="absolute right-4 top-4 p-1.5 hover:bg-white/20 rounded-full transition-colors"
|
|
529
|
+
aria-label="Close"
|
|
530
|
+
>
|
|
531
|
+
<svg className="w-4 h-4 text-slate-100" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
532
|
+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
|
|
533
|
+
</svg>
|
|
534
|
+
</button>
|
|
535
|
+
|
|
536
|
+
<h2 className="text-xl font-semibold pr-8" style={{ color: '#FFFFFF' }}>
|
|
537
|
+
Connect Instagram
|
|
538
|
+
</h2>
|
|
539
|
+
<p className="text-sm mt-0.5" style={{ color: '#FFFFFF' }}>
|
|
540
|
+
Export your likes, saves, and collections
|
|
541
|
+
</p>
|
|
542
|
+
|
|
543
|
+
{/* Privacy Notice */}
|
|
544
|
+
<div className="mt-3 flex items-start gap-2 bg-white/12 rounded-2xl px-3 py-2">
|
|
545
|
+
<svg className="w-4 h-4 text-pink-300 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
|
|
546
|
+
<path fillRule="evenodd" d="M2.166 4.999A11.954 11.954 0 0010 1.944 11.954 11.954 0 0017.834 5c.11.65.166 1.32.166 2.001 0 5.225-3.34 9.67-8 11.317C5.34 16.67 2 12.225 2 7c0-.682.057-1.35.166-2.001zm11.541 3.708a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clipRule="evenodd" />
|
|
547
|
+
</svg>
|
|
548
|
+
<p className="text-xs leading-relaxed" style={{ color: '#FFFFFF' }}>
|
|
549
|
+
<strong className="font-semibold">Your content, protected.</strong> We only access your engagement data, not your DMs.
|
|
550
|
+
</p>
|
|
551
|
+
</div>
|
|
552
|
+
</div>
|
|
553
|
+
|
|
554
|
+
{/* Steps Content */}
|
|
555
|
+
<div className="px-5 py-4 space-y-4">
|
|
556
|
+
|
|
557
|
+
{isMobile ? (
|
|
558
|
+
/* Mobile View */
|
|
559
|
+
<>
|
|
560
|
+
<div className="flex gap-3">
|
|
561
|
+
<div className="flex-shrink-0">
|
|
562
|
+
<div className="instagram-step-circle rounded-full flex items-center justify-center">
|
|
563
|
+
<span className="text-white font-bold text-sm">1</span>
|
|
564
|
+
</div>
|
|
565
|
+
</div>
|
|
566
|
+
<div className="flex-1 pt-0.5">
|
|
567
|
+
<h3 className="text-sm font-semibold mb-1" style={{ color: '#FFFFFF' }}>
|
|
568
|
+
Copy the bookmark code
|
|
569
|
+
</h3>
|
|
570
|
+
<button
|
|
571
|
+
onClick={() => this.handleCopyCode(bookmarkletCode)}
|
|
572
|
+
className="mt-1 w-full flex items-center justify-center gap-2 py-3 bg-white/10 rounded-xl text-sm font-medium hover:bg-white/20 active:scale-95 transition-all text-pink-300 border border-pink-500/30"
|
|
573
|
+
>
|
|
574
|
+
{copied ? 'Copied' : 'Copy code'}
|
|
575
|
+
</button>
|
|
576
|
+
</div>
|
|
577
|
+
</div>
|
|
578
|
+
|
|
579
|
+
<div className="flex gap-3">
|
|
580
|
+
<div className="flex-shrink-0">
|
|
581
|
+
<div className="instagram-step-circle rounded-full flex items-center justify-center">
|
|
582
|
+
<span className="text-white font-bold text-sm">2</span>
|
|
583
|
+
</div>
|
|
584
|
+
</div>
|
|
585
|
+
<div className="flex-1 pt-0.5">
|
|
586
|
+
<h3 className="text-sm font-semibold mb-1" style={{ color: '#FFFFFF' }}>
|
|
587
|
+
Add a bookmark
|
|
588
|
+
</h3>
|
|
589
|
+
<p className="text-xs text-slate-200 leading-relaxed mb-2">
|
|
590
|
+
Add a bookmark, then paste the code into the bookmark URL.
|
|
591
|
+
</p>
|
|
592
|
+
</div>
|
|
593
|
+
</div>
|
|
594
|
+
|
|
595
|
+
<div className="flex gap-3">
|
|
596
|
+
<div className="flex-shrink-0">
|
|
597
|
+
<div className="instagram-step-circle rounded-full flex items-center justify-center">
|
|
598
|
+
<span className="text-white font-bold text-sm">3</span>
|
|
599
|
+
</div>
|
|
600
|
+
</div>
|
|
601
|
+
<div className="flex-1 pt-0.5">
|
|
602
|
+
<h3 className="text-sm font-semibold mb-1" style={{ color: '#FFFFFF' }}>
|
|
603
|
+
Run it on Instagram
|
|
604
|
+
</h3>
|
|
605
|
+
<button
|
|
606
|
+
onClick={() => window.open('https://www.instagram.com/your_activity/interactions/likes/', '_blank')}
|
|
607
|
+
className="mt-2 text-xs bg-pink-600 hover:bg-pink-500 text-white px-3 py-1.5 rounded-lg inline-flex items-center gap-1"
|
|
608
|
+
>
|
|
609
|
+
Open Instagram Likes ↗
|
|
610
|
+
</button>
|
|
611
|
+
<p className="text-xs text-slate-300 mt-2">
|
|
612
|
+
In the address bar, search your bookmark name and tap it.
|
|
613
|
+
</p>
|
|
614
|
+
</div>
|
|
615
|
+
</div>
|
|
616
|
+
</>
|
|
617
|
+
) : (
|
|
618
|
+
/* Desktop View */
|
|
619
|
+
<>
|
|
620
|
+
{/* Step 1 */}
|
|
621
|
+
<div className="flex gap-3">
|
|
622
|
+
<div className="flex-shrink-0">
|
|
623
|
+
<div className="instagram-step-circle rounded-full flex items-center justify-center">
|
|
624
|
+
<span className="text-white font-bold text-sm">1</span>
|
|
625
|
+
</div>
|
|
626
|
+
</div>
|
|
627
|
+
<div className="flex-1 pt-0.5">
|
|
628
|
+
<h3 className="text-sm font-semibold mb-1" style={{ color: '#FFFFFF' }}>
|
|
629
|
+
Drag this button to your bookmarks bar
|
|
630
|
+
</h3>
|
|
631
|
+
<div className="relative inline-block mt-2">
|
|
632
|
+
<div className="absolute inset-0 rounded-full" style={{ animation: 'instagramPulse 2s ease-in-out infinite' }}></div>
|
|
633
|
+
<a
|
|
634
|
+
href={bookmarkletCode}
|
|
635
|
+
draggable="true"
|
|
636
|
+
onDragStart={(e) => {
|
|
637
|
+
e.dataTransfer.setData('text/plain', bookmarkletCode);
|
|
638
|
+
e.dataTransfer.effectAllowed = 'copy';
|
|
639
|
+
}}
|
|
640
|
+
onClick={(e) => {
|
|
641
|
+
e.preventDefault();
|
|
642
|
+
alert('Please drag this button to your bookmarks bar');
|
|
643
|
+
}}
|
|
644
|
+
className="instagram-bookmarklet-button relative inline-flex items-center gap-1.5 px-4 py-2 font-medium cursor-move select-none transition-all hover:scale-[1.03]"
|
|
645
|
+
style={{ color: '#FFFFFF' }}
|
|
646
|
+
>
|
|
647
|
+
<span className="text-base">📸</span>
|
|
648
|
+
<span className="text-sm">Onairos Instagram</span>
|
|
649
|
+
</a>
|
|
650
|
+
</div>
|
|
651
|
+
</div>
|
|
652
|
+
</div>
|
|
653
|
+
|
|
654
|
+
{/* Step 2 */}
|
|
655
|
+
<div className="flex gap-3">
|
|
656
|
+
<div className="flex-shrink-0">
|
|
657
|
+
<div className="instagram-step-circle rounded-full flex items-center justify-center">
|
|
658
|
+
<span className="text-white font-bold text-sm">2</span>
|
|
659
|
+
</div>
|
|
660
|
+
</div>
|
|
661
|
+
<div className="flex-1 pt-0.5">
|
|
662
|
+
<h3 className="text-sm font-semibold mb-1" style={{ color: '#FFFFFF' }}>
|
|
663
|
+
Open Instagram and log in
|
|
664
|
+
</h3>
|
|
665
|
+
<p className="text-xs mb-2" style={{ color: '#FFFFFF' }}>
|
|
666
|
+
Navigate to your Activity or Saved posts page
|
|
667
|
+
</p>
|
|
668
|
+
<button
|
|
669
|
+
onClick={() => window.open('https://www.instagram.com/your_activity/interactions/likes/', '_blank')}
|
|
670
|
+
className="inline-flex items-center gap-1.5 px-4 py-2 rounded-full text-white text-xs font-medium transition-colors shadow-[0_0_25px_rgba(225,48,108,0.35)]"
|
|
671
|
+
style={{ background: 'linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%)' }}
|
|
672
|
+
>
|
|
673
|
+
<svg className="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
674
|
+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
|
|
675
|
+
</svg>
|
|
676
|
+
Open Instagram Likes
|
|
677
|
+
</button>
|
|
678
|
+
</div>
|
|
679
|
+
</div>
|
|
680
|
+
|
|
681
|
+
{/* Step 3 */}
|
|
682
|
+
<div className="flex gap-3">
|
|
683
|
+
<div className="flex-shrink-0">
|
|
684
|
+
<div className="instagram-step-circle rounded-full flex items-center justify-center">
|
|
685
|
+
<span className="text-white font-bold text-sm">3</span>
|
|
686
|
+
</div>
|
|
687
|
+
</div>
|
|
688
|
+
<div className="flex-1 pt-0.5">
|
|
689
|
+
<h3 className="text-sm font-semibold mb-1" style={{ color: '#FFFFFF' }}>
|
|
690
|
+
Click the bookmark on Instagram
|
|
691
|
+
</h3>
|
|
692
|
+
<p className="text-xs" style={{ color: '#FFFFFF' }}>
|
|
693
|
+
Click <strong style={{ color: '#FFFFFF' }}>"Onairos Instagram"</strong> bookmark. We'll export your likes, saves, and collections.
|
|
694
|
+
</p>
|
|
695
|
+
</div>
|
|
696
|
+
</div>
|
|
697
|
+
</>
|
|
698
|
+
)}
|
|
699
|
+
|
|
700
|
+
</div>
|
|
701
|
+
|
|
702
|
+
{/* Footer */}
|
|
703
|
+
<div className="px-5 py-4 bg-white/5">
|
|
704
|
+
<button
|
|
705
|
+
onClick={() => this.setConnected()}
|
|
706
|
+
className="w-full px-4 py-2.5 rounded-full font-medium text-sm transition-all hover:scale-[1.01] active:scale-[0.99] shadow-[0_10px_30px_rgba(225,48,108,0.45)] border border-white/40"
|
|
707
|
+
style={{ background: 'linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%)', color: '#FFFFFF' }}
|
|
708
|
+
>
|
|
709
|
+
Got it! ✓
|
|
710
|
+
</button>
|
|
711
|
+
</div>
|
|
712
|
+
|
|
713
|
+
</div>
|
|
714
|
+
</div>
|
|
715
|
+
</div>
|
|
716
|
+
</div>
|
|
717
|
+
</>
|
|
718
|
+
);
|
|
719
|
+
|
|
720
|
+
// Render modal in a portal to ensure it's at document root
|
|
721
|
+
return ReactDOM.createPortal(modalContent, document.body);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
export default InstagramDataConnector;
|
|
726
|
+
|