@onairosofficial/onairos-capacitor 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/OnairosofficialOnairosCapacitor.podspec +1 -1
  2. package/README.md +1 -1
  3. package/dist/onairos.capacitor.esm.js +509 -1
  4. package/dist/onairos.capacitor.esm.turbopack.js +509 -1
  5. package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosChatGPTNativePlugin.swift +187 -945
  6. package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosRNScrapers.swift +1800 -0
  7. package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosSpotifyNativePlugin.swift +180 -629
  8. package/onairos.d.ts +24 -0
  9. package/package.json +5 -2
  10. package/src/assets/connectors/Linkedinicon.png +0 -0
  11. package/src/assets/connectors/Redditicon.png +0 -0
  12. package/src/assets/connectors/YouTubeicon2.png +0 -0
  13. package/src/assets/connectors/chatgpt.png +0 -0
  14. package/src/assets/connectors/claude.png +0 -0
  15. package/src/assets/connectors/instagram.png +0 -0
  16. package/src/assets/connectors/netflix.png +0 -0
  17. package/src/assets/connectors/pinterest.png +0 -0
  18. package/src/assets/connectors/sephora.png +0 -0
  19. package/src/assets/connectors/spotify.png +0 -0
  20. package/src/assets/connectors/tiktok.png +0 -0
  21. package/src/assets/permissions/onairos.png +0 -0
  22. package/src/assets/permissions/personalization.png +0 -0
  23. package/src/assets/permissions/public-profile-person.png +0 -0
  24. package/src/assets/permissions/raw-memories.png +0 -0
  25. package/src/capacitorConnectorCatalog.js +2 -6
  26. package/src/components/DataRequest.jsx +96 -532
  27. package/src/components/EmailAuth.jsx +4 -116
  28. package/src/components/PinSetup.jsx +39 -226
  29. package/src/components/SDKDesignPreview.jsx +33 -0
  30. package/src/components/SessionUserBar.jsx +2 -1
  31. package/src/components/TrainingScreen.jsx +18 -12
  32. package/src/components/UniversalOnboarding.jsx +191 -424
  33. package/src/components/WelcomeScreen.jsx +19 -12
  34. package/src/components/parity/NativeConnections.jsx +136 -0
  35. package/src/components/parity/NativeScreens.jsx +48 -0
  36. package/src/components/ui/PageLayout.jsx +7 -3
  37. package/src/nativeImport/ConnectorLoading.jsx +13 -0
  38. package/src/nativeImport/CustomImportSession.js +115 -0
  39. package/src/nativeImport/ImportIcon.jsx +29 -0
  40. package/src/nativeImport/ImportProgress.jsx +24 -0
  41. package/src/nativeImport/ImportStatus.jsx +9 -0
  42. package/src/nativeImport/NativeChatImport.jsx +28 -0
  43. package/src/nativeImport/NativeImportSession.js +123 -0
  44. package/src/nativeImport/NativeScraperImport.jsx +57 -0
  45. package/src/nativeImport/SmartFilter.jsx +28 -0
  46. package/src/nativeImport/customPayload.js +37 -0
  47. package/src/nativeImport/netflixExport.js +30 -0
  48. package/src/nativeImport/netflixHistory.js +28 -0
  49. package/src/nativeImport/netflixSession.js +59 -0
  50. package/src/nativeImport/rawHandoff.js +7 -0
  51. package/src/nativeImport/rn/config/api.js +5 -0
  52. package/src/nativeImport/rn/services/apiKeyService.js +2 -0
  53. package/src/nativeImport/rn/services/hingePayload.js +37 -0
  54. package/src/nativeImport/rn/services/nativeConversationImport.js +138 -0
  55. package/src/nativeImport/rn/services/nativeFileTransfer.js +127 -0
  56. package/src/nativeImport/rn/services/nativeRawRedaction.js +136 -0
  57. package/src/nativeImport/rn/services/netflixPayload.js +70 -0
  58. package/src/nativeImport/rn/services/rawMemoryPolicy.js +38 -0
  59. package/src/nativeImport/rn/services/sephoraPayload.js +166 -0
  60. package/src/nativeImport/rn/services/spotifyPayload.js +99 -0
  61. package/src/nativeImport/rn/source-manifest.json +45 -0
  62. package/src/nativeImport/rn/utils/importedFiles.js +74 -0
  63. package/src/nativeImport/rn/utils/nativeImportDates.js +45 -0
  64. package/src/nativeImport/rn/utils/nativeImportFileReceiver.js +51 -0
  65. package/src/nativeImport/rn/utils/nativeImportMetadata.js +74 -0
  66. package/src/nativeImport/rn/utils/nativeImportTopics.js +56 -0
  67. package/src/nativeImport/rn/utils/rawExportDelivery.js +12 -0
  68. package/src/nativeImport/rn/utils/webviewScripts/chatgptDiscovery.js +99 -0
  69. package/src/nativeImport/rn/utils/webviewScripts/claude.js +349 -0
  70. package/src/nativeImport/rn/utils/webviewScripts/gemini.js +356 -0
  71. package/src/nativeImport/rn/utils/webviewScripts/hinge.js +375 -0
  72. package/src/nativeImport/rn/utils/webviewScripts/instagram.js +152 -0
  73. package/src/nativeImport/rn/utils/webviewScripts/linkedin.js +825 -0
  74. package/src/nativeImport/rn/utils/webviewScripts/nativeChatGPTImport.js +202 -0
  75. package/src/nativeImport/rn/utils/webviewScripts/nativeChatGPTSession.js +63 -0
  76. package/src/nativeImport/rn/utils/webviewScripts/nativeImportFiles.js +132 -0
  77. package/src/nativeImport/rn/utils/webviewScripts/nativeImportProviders.js +80 -0
  78. package/src/nativeImport/rn/utils/webviewScripts/nativeLoginViewport.js +28 -0
  79. package/src/nativeImport/rn/utils/webviewScripts/netflix.js +257 -0
  80. package/src/nativeImport/rn/utils/webviewScripts/sephora.js +862 -0
  81. package/src/nativeImport/rn/utils/webviewScripts/sephoraSession.js +160 -0
  82. package/src/nativeImport/rn/utils/webviewScripts/spotify.js +1868 -0
  83. package/src/nativeImport/rn/utils/webviewScripts/telegram.js +630 -0
  84. package/src/nativeImport/rn/utils/webviewScripts/tiktok.js +2920 -0
  85. package/src/onairos.capacitor.jsx +14 -2
  86. package/src/onairos.core.jsx +3 -0
  87. package/src/onairosButton.jsx +23 -17
  88. package/src/styles/onairos-fonts.css +20 -0
  89. package/src/styles/onairos-native.css +709 -0
  90. package/src/styles/onairos-rn-parity.css +175 -0
  91. package/src/styles/sdkCssRegistry.js +83 -1
  92. package/src/styles/tailwind.capacitor.css +6 -0
  93. package/src/utils/capacitorPlugins.js +20 -12
  94. package/src/utils/nativeConnectorSession.js +18 -0
  95. package/src/utils/parityPolicy.js +41 -0
@@ -0,0 +1,257 @@
1
+ // Synced from RN utils/webviewScripts/netflix.ts by scripts/sync-rn-connectors.cjs.
2
+ const NETFLIX_CONSENT_POPUP_SCRIPT = `
3
+ (function() {
4
+ try {
5
+ const existing = document.getElementById('onairos-consent-overlay');
6
+ if (existing) existing.remove();
7
+
8
+ const overlay = document.createElement('div');
9
+ overlay.id = 'onairos-consent-overlay';
10
+ overlay.style.cssText = \`
11
+ position: fixed;
12
+ top: 0;
13
+ left: 0;
14
+ width: 100%;
15
+ height: 100%;
16
+ background: rgba(0, 0, 0, 0.85);
17
+ z-index: 999999;
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
22
+ \`;
23
+
24
+ const popup = document.createElement('div');
25
+ popup.style.cssText = \`
26
+ background: #141414;
27
+ border-radius: 16px;
28
+ padding: 32px;
29
+ max-width: 400px;
30
+ width: 90%;
31
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
32
+ border: 1px solid #333;
33
+ \`;
34
+
35
+ popup.innerHTML = \`
36
+ <div style="text-align: center;">
37
+ <div style="font-size: 48px; margin-bottom: 16px;">\u{1F3AC}</div>
38
+ <h2 style="margin: 0 0 12px 0; font-size: 24px; color: #FFFFFF;">
39
+ Export Netflix Data?
40
+ </h2>
41
+ <p style="margin: 0 0 24px 0; color: #999; font-size: 16px; line-height: 1.5;">
42
+ Allow Onairos to export your Netflix viewing activity (watch history, My List, ratings) for analysis?
43
+ </p>
44
+ <div style="display: flex; gap: 12px; justify-content: center;">
45
+ <button id="onairos-deny" style="
46
+ flex: 1;
47
+ padding: 14px 24px;
48
+ border: 2px solid #444;
49
+ background: transparent;
50
+ color: #999;
51
+ border-radius: 8px;
52
+ font-size: 16px;
53
+ font-weight: 600;
54
+ cursor: pointer;
55
+ ">Deny</button>
56
+ <button id="onairos-allow" style="
57
+ flex: 1;
58
+ padding: 14px 24px;
59
+ border: none;
60
+ background: linear-gradient(135deg, #E50914 0%, #B20710 100%);
61
+ color: white;
62
+ border-radius: 8px;
63
+ font-size: 16px;
64
+ font-weight: 600;
65
+ cursor: pointer;
66
+ ">Allow</button>
67
+ </div>
68
+ </div>
69
+ \`;
70
+
71
+ overlay.appendChild(popup);
72
+ document.body.appendChild(overlay);
73
+
74
+ document.getElementById('onairos-deny').onclick = () => {
75
+ overlay.remove();
76
+ window.ReactNativeWebView.postMessage(JSON.stringify({
77
+ type: 'NETFLIX_CONSENT',
78
+ status: 'denied'
79
+ }));
80
+ };
81
+
82
+ document.getElementById('onairos-allow').onclick = () => {
83
+ document.getElementById('onairos-allow').innerHTML = '\u23F3 Starting...';
84
+ document.getElementById('onairos-allow').disabled = true;
85
+
86
+ window.ReactNativeWebView.postMessage(JSON.stringify({
87
+ type: 'NETFLIX_CONSENT',
88
+ status: 'allowed'
89
+ }));
90
+
91
+ setTimeout(() => overlay.remove(), 500);
92
+ };
93
+ } catch (error) {
94
+ window.ReactNativeWebView.postMessage(JSON.stringify({
95
+ type: 'NETFLIX_CONSENT',
96
+ status: 'error',
97
+ message: error.message
98
+ }));
99
+ }
100
+ })();
101
+ true;
102
+ `;
103
+ const NETFLIX_EXPORT_SCRIPT = `
104
+ (async function() {
105
+ try {
106
+ var postMsg = function(obj) {
107
+ window.ReactNativeWebView.postMessage(JSON.stringify(obj));
108
+ };
109
+
110
+ var progress = function(stage, pct, msg) {
111
+ postMsg({ type: 'NETFLIX_EXPORT_PROGRESS', stage: stage, progress: pct, message: msg });
112
+ };
113
+
114
+ function debugMsg(msg) {
115
+ postMsg({ type: 'NETFLIX_EXPORT_PROGRESS', stage: 'debug', progress: 0, message: '[DEBUG] ' + msg });
116
+ }
117
+
118
+ function delay(ms) { return new Promise(function(r) { setTimeout(r, ms); }); }
119
+
120
+ if (!document.body) {
121
+ postMsg({ type: 'NETFLIX_EXPORT_ERROR', message: 'Page not ready' });
122
+ return;
123
+ }
124
+
125
+ // ============================================================
126
+ // STEP 1: Extract profile name from reactContext if available
127
+ // ============================================================
128
+ progress('auth', 5, 'Getting profile info...');
129
+
130
+ var PROFILE_NAME = 'unknown';
131
+ try {
132
+ if (window.netflix && window.netflix.reactContext) {
133
+ var ctx = window.netflix.reactContext;
134
+ debugMsg('reactContext keys: ' + Object.keys(ctx.models || {}).join(','));
135
+ var userInfo = ctx.models.memberContext && ctx.models.memberContext.data && ctx.models.memberContext.data.userInfo;
136
+ if (userInfo) {
137
+ PROFILE_NAME = userInfo.accountOwnerName || userInfo.name || userInfo.profileName || 'unknown';
138
+ debugMsg('Profile: ' + PROFILE_NAME + ', country: ' + (userInfo.countryOfSignup || 'unknown'));
139
+ }
140
+ }
141
+ } catch(e) { debugMsg('reactContext failed: ' + e.message); }
142
+
143
+ // ============================================================
144
+ // STEP 2: Fetch viewing history by scraping /viewingactivity pages
145
+ // ============================================================
146
+ progress('history', 10, 'Fetching viewing history...');
147
+
148
+ var allItems = [];
149
+ var page = 0;
150
+ var maxPages = 2;
151
+ var consecutiveEmpty = 0;
152
+
153
+ while (page < maxPages && consecutiveEmpty < 2) {
154
+ try {
155
+ var resp = await fetch('/viewingactivity?pg=' + page, { credentials: 'include' });
156
+ if (!resp.ok) {
157
+ debugMsg('viewingactivity page ' + page + ' status: ' + resp.status);
158
+ break;
159
+ }
160
+
161
+ var html = await resp.text();
162
+ var doc = new DOMParser().parseFromString(html, 'text/html');
163
+ var rows = doc.querySelectorAll('.retableRow');
164
+
165
+ if (rows.length === 0) {
166
+ consecutiveEmpty++;
167
+ debugMsg('Page ' + page + ': 0 rows (empty ' + consecutiveEmpty + ')');
168
+ page++;
169
+ continue;
170
+ }
171
+
172
+ consecutiveEmpty = 0;
173
+
174
+ for (var ri = 0; ri < rows.length; ri++) {
175
+ var dateEl = rows[ri].querySelector('.col.date');
176
+ var titleEl = rows[ri].querySelector('.col.title a');
177
+
178
+ if (titleEl) {
179
+ var href = titleEl.getAttribute('href') || '';
180
+ var idMatch = href.match(/\\/title\\/(\\d+)/);
181
+ allItems.push({
182
+ videoId: idMatch ? idMatch[1] : '',
183
+ title: titleEl.textContent.trim(),
184
+ date: dateEl ? dateEl.textContent.trim() : '',
185
+ type: titleEl.textContent.includes(':') ? 'series' : 'movie'
186
+ });
187
+ }
188
+ }
189
+
190
+ debugMsg('Page ' + page + ': ' + rows.length + ' rows, total: ' + allItems.length);
191
+
192
+ var pct = 10 + Math.round((page / Math.max(page + 2, 10)) * 75);
193
+ progress('history', Math.min(pct, 85), 'Fetching viewing history (' + allItems.length + ' items)...');
194
+
195
+ page++;
196
+ await delay(300);
197
+ } catch(e) {
198
+ debugMsg('Page ' + page + ' failed: ' + e.message);
199
+ break;
200
+ }
201
+ }
202
+
203
+ debugMsg('Total viewing history: ' + allItems.length + ' items across ' + page + ' pages');
204
+ if (allItems.length > 0) {
205
+ debugMsg('Sample: ' + allItems[0].title + ' (' + allItems[0].date + ')');
206
+ }
207
+
208
+ // ============================================================
209
+ // STEP 3: Send results
210
+ // ============================================================
211
+ progress('complete', 95, 'Done! Got ' + allItems.length + ' items');
212
+
213
+ postMsg({
214
+ type: 'NETFLIX_EXPORT_COMPLETE',
215
+ status: 'success',
216
+ data: {
217
+ viewingHistory: allItems,
218
+ profile: { profileName: PROFILE_NAME },
219
+ summary: {
220
+ totalItems: allItems.length,
221
+ totalPages: page,
222
+ profileName: PROFILE_NAME
223
+ }
224
+ },
225
+ success: true
226
+ });
227
+
228
+ } catch (error) {
229
+ console.error('[NETFLIX] Init error:', error.message);
230
+ window.ReactNativeWebView.postMessage(JSON.stringify({
231
+ type: 'NETFLIX_EXPORT_ERROR',
232
+ status: 'error',
233
+ message: 'Script init error: ' + error.message,
234
+ success: false
235
+ }));
236
+ }
237
+ })();
238
+ true;
239
+ `;
240
+ const NETFLIX_SUCCESS_SCRIPT = `
241
+ (function() {
242
+ console.log('\u2705 Netflix export successful!');
243
+ })();
244
+ true;
245
+ `;
246
+ const NETFLIX_ERROR_SCRIPT = `
247
+ (function() {
248
+ console.log('\u274C Netflix export failed!');
249
+ })();
250
+ true;
251
+ `;
252
+ export {
253
+ NETFLIX_CONSENT_POPUP_SCRIPT,
254
+ NETFLIX_ERROR_SCRIPT,
255
+ NETFLIX_EXPORT_SCRIPT,
256
+ NETFLIX_SUCCESS_SCRIPT
257
+ };