@onairosofficial/onairos-capacitor 0.1.4 → 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 (88) 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/PinSetup.jsx +39 -226
  28. package/src/components/SDKDesignPreview.jsx +33 -0
  29. package/src/components/SessionUserBar.jsx +2 -1
  30. package/src/components/UniversalOnboarding.jsx +190 -423
  31. package/src/components/WelcomeScreen.jsx +7 -0
  32. package/src/components/parity/NativeConnections.jsx +136 -0
  33. package/src/components/parity/NativeScreens.jsx +48 -0
  34. package/src/components/ui/PageLayout.jsx +7 -3
  35. package/src/nativeImport/ConnectorLoading.jsx +13 -0
  36. package/src/nativeImport/CustomImportSession.js +115 -0
  37. package/src/nativeImport/ImportIcon.jsx +29 -0
  38. package/src/nativeImport/ImportProgress.jsx +24 -0
  39. package/src/nativeImport/ImportStatus.jsx +9 -0
  40. package/src/nativeImport/NativeChatImport.jsx +28 -0
  41. package/src/nativeImport/NativeImportSession.js +123 -0
  42. package/src/nativeImport/NativeScraperImport.jsx +57 -0
  43. package/src/nativeImport/SmartFilter.jsx +28 -0
  44. package/src/nativeImport/customPayload.js +37 -0
  45. package/src/nativeImport/netflixExport.js +30 -0
  46. package/src/nativeImport/netflixHistory.js +28 -0
  47. package/src/nativeImport/netflixSession.js +59 -0
  48. package/src/nativeImport/rawHandoff.js +7 -0
  49. package/src/nativeImport/rn/config/api.js +5 -0
  50. package/src/nativeImport/rn/services/apiKeyService.js +2 -0
  51. package/src/nativeImport/rn/services/hingePayload.js +37 -0
  52. package/src/nativeImport/rn/services/nativeConversationImport.js +138 -0
  53. package/src/nativeImport/rn/services/nativeFileTransfer.js +127 -0
  54. package/src/nativeImport/rn/services/nativeRawRedaction.js +136 -0
  55. package/src/nativeImport/rn/services/netflixPayload.js +70 -0
  56. package/src/nativeImport/rn/services/rawMemoryPolicy.js +38 -0
  57. package/src/nativeImport/rn/services/sephoraPayload.js +166 -0
  58. package/src/nativeImport/rn/services/spotifyPayload.js +99 -0
  59. package/src/nativeImport/rn/source-manifest.json +45 -0
  60. package/src/nativeImport/rn/utils/importedFiles.js +74 -0
  61. package/src/nativeImport/rn/utils/nativeImportDates.js +45 -0
  62. package/src/nativeImport/rn/utils/nativeImportFileReceiver.js +51 -0
  63. package/src/nativeImport/rn/utils/nativeImportMetadata.js +74 -0
  64. package/src/nativeImport/rn/utils/nativeImportTopics.js +56 -0
  65. package/src/nativeImport/rn/utils/rawExportDelivery.js +12 -0
  66. package/src/nativeImport/rn/utils/webviewScripts/chatgptDiscovery.js +99 -0
  67. package/src/nativeImport/rn/utils/webviewScripts/claude.js +349 -0
  68. package/src/nativeImport/rn/utils/webviewScripts/gemini.js +356 -0
  69. package/src/nativeImport/rn/utils/webviewScripts/hinge.js +375 -0
  70. package/src/nativeImport/rn/utils/webviewScripts/instagram.js +152 -0
  71. package/src/nativeImport/rn/utils/webviewScripts/linkedin.js +825 -0
  72. package/src/nativeImport/rn/utils/webviewScripts/nativeChatGPTImport.js +202 -0
  73. package/src/nativeImport/rn/utils/webviewScripts/nativeChatGPTSession.js +63 -0
  74. package/src/nativeImport/rn/utils/webviewScripts/nativeImportFiles.js +132 -0
  75. package/src/nativeImport/rn/utils/webviewScripts/nativeImportProviders.js +80 -0
  76. package/src/nativeImport/rn/utils/webviewScripts/nativeLoginViewport.js +28 -0
  77. package/src/nativeImport/rn/utils/webviewScripts/netflix.js +257 -0
  78. package/src/nativeImport/rn/utils/webviewScripts/sephora.js +862 -0
  79. package/src/nativeImport/rn/utils/webviewScripts/sephoraSession.js +160 -0
  80. package/src/nativeImport/rn/utils/webviewScripts/spotify.js +1868 -0
  81. package/src/nativeImport/rn/utils/webviewScripts/telegram.js +630 -0
  82. package/src/nativeImport/rn/utils/webviewScripts/tiktok.js +2920 -0
  83. package/src/onairos.core.jsx +3 -0
  84. package/src/onairosButton.jsx +23 -17
  85. package/src/styles/onairos-rn-parity.css +175 -0
  86. package/src/styles/tailwind.capacitor.css +4 -0
  87. package/src/utils/nativeConnectorSession.js +18 -0
  88. package/src/utils/parityPolicy.js +41 -0
@@ -0,0 +1,160 @@
1
+ // Synced from RN utils/webviewScripts/sephoraSession.ts by scripts/sync-rn-connectors.cjs.
2
+ const SEPHORA_SESSION_SCRIPT = String.raw`
3
+ (function () {
4
+ if (!/(^|\.)sephora\.com$/i.test(location.hostname)) return;
5
+ if (window.__onairosSephoraSession) {
6
+ window.__onairosSephoraSession.emit(true);
7
+ return;
8
+ }
9
+ var capture = window.__onairosCapture = {headers: {}, data: {}};
10
+ var lastState = '';
11
+
12
+ function profileFrom(value) {
13
+ if (!value || typeof value !== 'object') return null;
14
+ var profile = value.userProfile || value.profile || value.user || value;
15
+ if (profile.data && !profile.profileId) profile = profile.data;
16
+ return profile;
17
+ }
18
+ function isSignedInProfile(value) {
19
+ var p = profileFrom(value);
20
+ return !!(p && p.profileId && p.isAnonymous !== true && p.isGuest !== true &&
21
+ p.isSignedIn !== false && p.isLoggedIn !== false &&
22
+ (p.isSignedIn === true || p.isLoggedIn === true || p.email || p.firstName || p.lastName));
23
+ }
24
+ function currentProfile() {
25
+ var candidates = [capture.data.profile, window.__PRELOADED_STATE__ && window.__PRELOADED_STATE__.user];
26
+ try {
27
+ var store = window.Sephora && window.Sephora.store;
28
+ if (store && store.getState) {
29
+ var user = profileFrom(store.getState().user);
30
+ if (user && (user.isSignedIn === false || user.isLoggedIn === false || user.isAnonymous === true || user.isGuest === true)) return null;
31
+ candidates.unshift(user);
32
+ }
33
+ } catch (_) {}
34
+ for (var i = 0; i < candidates.length; i++) {
35
+ if (isSignedInProfile(candidates[i])) return profileFrom(candidates[i]);
36
+ }
37
+ return null;
38
+ }
39
+ function visible(el) {
40
+ if (!el || !el.getClientRects().length) return false;
41
+ for (var node = el; node && node.nodeType === 1; node = node.parentElement) {
42
+ var style = getComputedStyle(node);
43
+ if (style.display === 'none' || style.visibility === 'hidden' || Number(style.opacity) === 0) return false;
44
+ }
45
+ return true;
46
+ }
47
+ function hasLoginForm() {
48
+ // OTP, email-first and passwordless screens must block export too.
49
+ var fields = document.querySelectorAll('input');
50
+ var digitCount = 0;
51
+ for (var i = 0; i < fields.length; i++) {
52
+ var field = fields[i];
53
+ if (!visible(field)) continue;
54
+ var descriptor = [field.type, field.name, field.id, field.autocomplete,
55
+ field.getAttribute('aria-label'), field.placeholder].join(' ');
56
+ if (/password|one-time-code|\botp\b|verification.?code|security.?code/i.test(descriptor)) return true;
57
+ if (field.maxLength === 1) digitCount++;
58
+ }
59
+ if (digitCount >= 4) return true;
60
+ var dialogs = document.querySelectorAll('[role="dialog"], form');
61
+ for (var j = 0; j < dialogs.length; j++) {
62
+ if (visible(dialogs[j]) && /enter.{0,30}code|verify.{0,30}(email|identity|account)|sign in to sephora/i.test(dialogs[j].textContent || '')) return true;
63
+ }
64
+ return /\/(login|signin|sign-in|verification|verify)(\/|$)|landing-page-authentication/i.test(location.pathname);
65
+ }
66
+ function read() {
67
+ var hasToken = false;
68
+ try {
69
+ hasToken = ['seph-access-token', 'sephoraAccessToken', 'accessToken'].some(function (key) {
70
+ return !!localStorage.getItem(key);
71
+ });
72
+ } catch (_) {}
73
+ var blocked = hasLoginForm();
74
+ var profile = currentProfile();
75
+ return {authenticated: !blocked && !!profile, hasLoginForm: blocked, hasToken: hasToken, hasProfile: !!profile};
76
+ }
77
+ function emit(force) {
78
+ var state = read();
79
+ var key = JSON.stringify(state);
80
+ if (force || key !== lastState) {
81
+ lastState = key;
82
+ if (window.ReactNativeWebView) window.ReactNativeWebView.postMessage(JSON.stringify(Object.assign({type: 'SEPHORA_AUTH_STATE'}, state)));
83
+ }
84
+ }
85
+ function category(rawUrl) {
86
+ try {
87
+ var url = new URL(rawUrl, location.href);
88
+ // Relative requests are common. Never intercept other origins' credentials.
89
+ if (url.origin !== location.origin) return null;
90
+ var path = url.pathname.toLowerCase();
91
+ if (/shopping-cart|\/basket/.test(path)) return 'basket';
92
+ if (/\/lists\/skus|\/loves/.test(path)) return 'loves';
93
+ if (/\/purchases|\/orders|purchasehistory/.test(path)) return 'purchases';
94
+ if (/\/profiles\//.test(path) && /\/full|\/current/.test(path)) return 'profile';
95
+ } catch (_) {}
96
+ return null;
97
+ }
98
+ function captureHeaders(headers) {
99
+ try {
100
+ var normalized = new Headers(headers || {});
101
+ ['x-api-key', 'authorization', 'seph-access-token', 'x-seph-access-token'].forEach(function (name) {
102
+ var value = normalized.get(name);
103
+ if (value) capture.headers[name] = value;
104
+ });
105
+ } catch (_) {}
106
+ }
107
+ function record(kind, data) {
108
+ if (!data || typeof data !== 'object' || data.error || data.errors || data.success === false) return;
109
+ // A new account must not inherit previously captured shopping activity.
110
+ if (kind === 'profile') {
111
+ var previous = profileFrom(capture.data.profile);
112
+ var next = profileFrom(data);
113
+ if (previous && next && previous.profileId !== next.profileId) capture.data = {};
114
+ }
115
+ capture.data[kind] = data;
116
+ emit(false);
117
+ }
118
+ var originalFetch = window.fetch;
119
+ if (originalFetch) window.fetch = function (input, init) {
120
+ var kind = category(typeof input === 'string' ? input : input && input.url);
121
+ if (kind) {captureHeaders(input && input.headers); captureHeaders(init && init.headers);}
122
+ var response = originalFetch.apply(this, arguments);
123
+ if (kind) response.then(function (result) {
124
+ if (result.ok) result.clone().json().then(function (data) {record(kind, data);}).catch(function () {});
125
+ }, function () {});
126
+ return response;
127
+ };
128
+ if (window.XMLHttpRequest) {
129
+ var proto = window.XMLHttpRequest.prototype;
130
+ var open = proto.open, send = proto.send, setHeader = proto.setRequestHeader;
131
+ proto.open = function (method, url) {
132
+ this.__onairosSephoraKind = category(url);
133
+ this.__onairosSephoraHeaders = {};
134
+ return open.apply(this, arguments);
135
+ };
136
+ proto.setRequestHeader = function (name, value) {
137
+ if (this.__onairosSephoraKind) this.__onairosSephoraHeaders[name] = value;
138
+ return setHeader.apply(this, arguments);
139
+ };
140
+ proto.send = function () {
141
+ var xhr = this, kind = xhr.__onairosSephoraKind;
142
+ if (kind) {
143
+ captureHeaders(xhr.__onairosSephoraHeaders);
144
+ xhr.addEventListener('load', function () {
145
+ if (xhr.status < 200 || xhr.status >= 300) return;
146
+ try {record(kind, xhr.responseType === 'json' ? xhr.response : JSON.parse(xhr.responseText));} catch (_) {}
147
+ }, {once: true});
148
+ }
149
+ return send.apply(this, arguments);
150
+ };
151
+ }
152
+ window.__onairosSephoraSession = {read: read, emit: emit, profile: currentProfile};
153
+ window.__onairosSephoraAuthWatcher = setInterval(function () {emit(false);}, 1000);
154
+ emit(true);
155
+ })();
156
+ true;
157
+ `;
158
+ export {
159
+ SEPHORA_SESSION_SCRIPT
160
+ };