@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.
Files changed (202) hide show
  1. package/CAPACITOR_QUICK_START.md +379 -0
  2. package/CONNECTORS.md +122 -0
  3. package/LICENSE +194 -10
  4. package/OnairosofficialOnairosCapacitor.podspec +13 -0
  5. package/Package.swift +26 -0
  6. package/README.md +176 -25
  7. package/dist/onairos.capacitor.esm.js +1 -0
  8. package/dist/onairos.capacitor.esm.turbopack.js +1 -0
  9. package/docs/CAPACITOR_INTEGRATION_GUIDE.md +159 -0
  10. package/docs/CAPACITOR_MOCK_APP_TESTING.md +213 -0
  11. package/docs/CAPACITOR_SDK_FIXES_SUMMARY.md +65 -0
  12. package/docs/CROSS_SDK_PARITY.md +239 -0
  13. package/docs/DATA_FREQUENCY.md +57 -0
  14. package/docs/DEVELOPER_SDK_CHANGES.md +532 -0
  15. package/docs/INCIDENT_ENABLETRAINING_PIN_WEB_8.1.9.md +82 -0
  16. package/docs/ONAIROS_BUTTON_PROPS.md +152 -0
  17. package/docs/PLATFORM_APIS.md +559 -0
  18. package/docs/RAW_MEMORIES_API.md +305 -0
  19. package/docs/RAW_MEMORIES_SDK_UPDATE.md +54 -0
  20. package/docs/SDK_PARITY_ROLLUP_2026_04_24_to_05_02.md +96 -0
  21. package/docs/oldFixes.md +216 -0
  22. package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosChatGPTNativePlugin.swift +993 -0
  23. package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosNetflixNativePlugin.swift +33 -0
  24. package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosSpotifyNativePlugin.swift +1082 -0
  25. package/onairos.d.ts +656 -0
  26. package/package.json +188 -37
  27. package/src/OnairosReconnectButton.jsx +272 -0
  28. package/src/RSA.jsx +57 -0
  29. package/src/assets/NewLogo.png +0 -0
  30. package/src/assets/OnairosNewLogo.png +0 -0
  31. package/src/assets/chatgpt-icon.png +0 -0
  32. package/src/assets/fire-horse.png +0 -0
  33. package/src/assets/fire-horse.transparent.png +0 -0
  34. package/src/assets/latest-firehorse.png +0 -0
  35. package/src/assets/perplexity.png +0 -0
  36. package/src/assets/persona.png +0 -0
  37. package/src/assets/persona1.png +0 -0
  38. package/src/assets/persona2.png +0 -0
  39. package/src/assets/persona3.png +0 -0
  40. package/src/assets/persona4.png +0 -0
  41. package/src/assets/persona5.png +0 -0
  42. package/src/capacitorConnectorCatalog.js +38 -0
  43. package/src/capacitorOAuthConfig.js +52 -0
  44. package/src/chatgptHostedImport/index.js +303 -0
  45. package/src/components/AuthButtons.jsx +48 -0
  46. package/src/components/ConnectChatGPTModal.jsx +666 -0
  47. package/src/components/ConnectClaudeModal.jsx +610 -0
  48. package/src/components/ConnectGeminiModal.jsx +639 -0
  49. package/src/components/ConnectGrokModal.jsx +701 -0
  50. package/src/components/ConnectPerplexityModal.jsx +726 -0
  51. package/src/components/DataExplainerScreen.jsx +349 -0
  52. package/src/components/DataRequest.js +885 -0
  53. package/src/components/DataRequest.jsx +1055 -0
  54. package/src/components/EmailAuth.js +1871 -0
  55. package/src/components/EmailAuth.jsx +2062 -0
  56. package/src/components/ExtensionInstallPrompt.jsx +142 -0
  57. package/src/components/GoogleButton.js +133 -0
  58. package/src/components/LLMConnectorManager.jsx +201 -0
  59. package/src/components/LoadingPage.jsx +19 -0
  60. package/src/components/LoadingScreen.jsx +81 -0
  61. package/src/components/LunarBirthdate.jsx +96 -0
  62. package/src/components/LunarLoadingPage.jsx +251 -0
  63. package/src/components/Notification.jsx +21 -0
  64. package/src/components/OnairosAppButton.jsx +85 -0
  65. package/src/components/OnairosSSO.jsx +645 -0
  66. package/src/components/OnairosTrigger.jsx +61 -0
  67. package/src/components/PerplexityLogo.jsx +43 -0
  68. package/src/components/PinSetup.js +200 -0
  69. package/src/components/PinSetup.jsx +228 -0
  70. package/src/components/SDK_PIN_INTEGRATION_REQUIRED_CHANGES.md +526 -0
  71. package/src/components/SdkErrorBoundary.jsx +36 -0
  72. package/src/components/SecuritySetup.js +81 -0
  73. package/src/components/SessionUserBar.jsx +83 -0
  74. package/src/components/SignUp.js +123 -0
  75. package/src/components/TestTelegramButton.js +53 -0
  76. package/src/components/TrainingComponent.jsx +200 -0
  77. package/src/components/TrainingScreen.jsx +897 -0
  78. package/src/components/UniversalOnboarding.js +306 -0
  79. package/src/components/UniversalOnboarding.jsx +4837 -0
  80. package/src/components/ValentineLoadingPage.jsx +502 -0
  81. package/src/components/ValentineModeSelector.jsx +162 -0
  82. package/src/components/WelcomeScreen.jsx +435 -0
  83. package/src/components/WrappedLoadingPage.jsx +205 -0
  84. package/src/components/connectors/ChatGPTConnector.js +348 -0
  85. package/src/components/connectors/ChatGPTConnector.jsx +348 -0
  86. package/src/components/connectors/ClaudeConnector.js +44 -0
  87. package/src/components/connectors/ClaudeConnector.jsx +44 -0
  88. package/src/components/connectors/GeminiConnector.js +170 -0
  89. package/src/components/connectors/GeminiConnector.jsx +170 -0
  90. package/src/components/connectors/GmailConnector.js +148 -0
  91. package/src/components/connectors/GmailConnector.jsx +148 -0
  92. package/src/components/connectors/GrokConnector.js +16 -0
  93. package/src/components/connectors/GrokConnector.jsx +16 -0
  94. package/src/components/connectors/HingeConnector.js +419 -0
  95. package/src/components/connectors/HingeConnector.jsx +419 -0
  96. package/src/components/connectors/InstagramDataConnector.js +726 -0
  97. package/src/components/connectors/InstagramDataConnector.jsx +726 -0
  98. package/src/components/connectors/LinkedInConnector.js +4 -0
  99. package/src/components/connectors/LinkedInConnector.jsx +296 -0
  100. package/src/components/connectors/PerplexityConnector.jsx +16 -0
  101. package/src/components/connectors/PinterestConnector.js +208 -0
  102. package/src/components/connectors/PinterestConnector.jsx +208 -0
  103. package/src/components/connectors/README.md +292 -0
  104. package/src/components/connectors/RedditConnector.js +229 -0
  105. package/src/components/connectors/RedditConnector.jsx +229 -0
  106. package/src/components/connectors/SephoraConnector.js +482 -0
  107. package/src/components/connectors/SephoraConnector.jsx +482 -0
  108. package/src/components/connectors/TikTokConnector.jsx +430 -0
  109. package/src/components/connectors/YoutubeConnector.js +361 -0
  110. package/src/components/connectors/YoutubeConnector.jsx +361 -0
  111. package/src/components/connectors/index.js +50 -0
  112. package/src/components/icons.jsx +46 -0
  113. package/src/components/icons.tsx +21 -0
  114. package/src/components/ui/PageLayout.jsx +1255 -0
  115. package/src/components/ui/PrimaryButton.jsx +162 -0
  116. package/src/components/ui/button.jsx +49 -0
  117. package/src/components/ui/card.jsx +61 -0
  118. package/src/components/ui/checkbox.jsx +33 -0
  119. package/src/components/ui/label.jsx +29 -0
  120. package/src/components/utils/UpdateConnections.js +45 -0
  121. package/src/components/utils/oauthHelper.js +97 -0
  122. package/src/config/api-config.js +138 -0
  123. package/src/deepLink.jsx +38 -0
  124. package/src/getPin.js +26 -0
  125. package/src/icons/Avatar.png +0 -0
  126. package/src/icons/Sentiment.png +0 -0
  127. package/src/icons/Trait.png +0 -0
  128. package/src/iframe/DataRequestPage.jsx +285 -0
  129. package/src/iframe/OnairosButtonIntegration.md +148 -0
  130. package/src/iframe/components/Box.jsx +56 -0
  131. package/src/iframe/components/IndividualConnection.jsx +88 -0
  132. package/src/iframe/dataRequestHandler.js +714 -0
  133. package/src/iframe/data_request_iframe.html +27 -0
  134. package/src/iframe/data_request_page.js +47 -0
  135. package/src/iframe/icons/Avatar.png +1 -0
  136. package/src/iframe/icons/Avatar2.png +1 -0
  137. package/src/iframe/icons/Sentiment.png +1 -0
  138. package/src/iframe/icons/Trait.png +1 -0
  139. package/src/iframe/icons/onairos_logo.png +0 -0
  140. package/src/iframe/utils/api.js +57 -0
  141. package/src/index.js +274 -0
  142. package/src/laravel/OnairosVue.vue +410 -0
  143. package/src/laravel/blade-helpers.js +320 -0
  144. package/src/laravel/vite-plugin.js +179 -0
  145. package/src/mobile/MobileDataRequestPage.jsx +233 -0
  146. package/src/mobile/components/MobileBox.jsx +71 -0
  147. package/src/mobile/components/MobileIndividualConnection.jsx +51 -0
  148. package/src/mobile/shims/browser-apis.js +78 -0
  149. package/src/mobile/shims/lucide-shim.js +85 -0
  150. package/src/nativeConnectors.js +5 -0
  151. package/src/newUI/EMAIL_VERIFICATION_API_SCHEMA.md +268 -0
  152. package/src/newUI/PlatformConnectorsStep.tsx +435 -0
  153. package/src/newUI/PrimaryButton.tsx +213 -0
  154. package/src/newUI/SignInStep.tsx +194 -0
  155. package/src/newUI/VerificationStep.tsx +133 -0
  156. package/src/newUI/WelcomeScreen.tsx +311 -0
  157. package/src/newUI/services/connectedAccountsService.js +129 -0
  158. package/src/onairos.capacitor.jsx +15 -0
  159. package/src/onairos.core.jsx +133 -0
  160. package/src/onairos.jsx +14 -0
  161. package/src/onairos.native.jsx +15 -0
  162. package/src/onairosButton.jsx +9000 -0
  163. package/src/overlay/CheckBox.jsx +114 -0
  164. package/src/overlay/IndividualConnection copy.js +86 -0
  165. package/src/overlay/IndividualConnection.js +191 -0
  166. package/src/overlay/IndividualConnectionNew.jsx +157 -0
  167. package/src/overlay/box.js +84 -0
  168. package/src/overlay/overlay.js +437 -0
  169. package/src/styles/onairos-scoped-preflight.css +97 -0
  170. package/src/styles/sdkCssRegistry.js +20 -0
  171. package/src/styles/styleLoaderInsertShadow.js +69 -0
  172. package/src/styles/tailwind.capacitor.css +395 -0
  173. package/src/styles/tailwind.css +395 -0
  174. package/src/theme/colors.js +40 -0
  175. package/src/utils/apiKeyValidation.js +341 -0
  176. package/src/utils/apiResponseLogger.js +316 -0
  177. package/src/utils/authHeaders.js +275 -0
  178. package/src/utils/biometrics.js +26 -0
  179. package/src/utils/bookmarkletUtils.js +28 -0
  180. package/src/utils/capacitorDetection.js +278 -0
  181. package/src/utils/capacitorLLMHelper.js +352 -0
  182. package/src/utils/capacitorPlugins.js +366 -0
  183. package/src/utils/crossDomainSSO.js +587 -0
  184. package/src/utils/deepLinking.js +27 -0
  185. package/src/utils/devLogger.js +46 -0
  186. package/src/utils/extensionDetection.js +418 -0
  187. package/src/utils/extractMemory.js +277 -0
  188. package/src/utils/framerBrandingOverrides.js +40 -0
  189. package/src/utils/googleWebClientId.js +55 -0
  190. package/src/utils/overlayHandler.js +224 -0
  191. package/src/utils/platformDisconnect.js +309 -0
  192. package/src/utils/pollTrainingStatus.js +200 -0
  193. package/src/utils/rawMemoriesAccess.js +211 -0
  194. package/src/utils/resolveBackendAppId.js +47 -0
  195. package/src/utils/responseFormatter.js +140 -0
  196. package/src/utils/sdkDebugStorage.js +113 -0
  197. package/src/utils/sdkInitialization.js +645 -0
  198. package/src/utils/sessionManager.js +1258 -0
  199. package/src/utils/startBackgroundTraining.js +100 -0
  200. package/src/utils/userDataFormatter.js +222 -0
  201. package/index.d.ts +0 -1
  202. package/index.js +0 -1
@@ -0,0 +1,482 @@
1
+ import React, { Component } from 'react';
2
+ import { getUserAuthHeaders, isUserAuthenticated } from '../../utils/authHeaders';
3
+ import { API_CONFIG } from '../../config/api-config';
4
+ import { buildBookmarkletHref } from '../../utils/bookmarkletUtils';
5
+
6
+ /**
7
+ * Sephora Connector - E-commerce Data Extraction
8
+ * Uses bookmarklet pattern for web-based extraction
9
+ * Platform identifier: mobile-sephora
10
+ * Brand Color: #000000 (Black)
11
+ */
12
+
13
+ // Sephora bookmarklet: Extracts basket, orders, loves, ratings
14
+ const SEPHORA_BOOKMARKLET_CODE = `javascript:(async function(){
15
+ try {
16
+ var host = (location.hostname || '').toLowerCase();
17
+ if (!(host === 'sephora.com' || host.endsWith('.sephora.com') || host === 'www.sephora.com')) {
18
+ alert('Please open Sephora (www.sephora.com) and try again.');
19
+ return;
20
+ }
21
+
22
+ var ON_TOKEN = "__ONAIROS_TOKEN__";
23
+ var ON_EMAIL = "__ONAIROS_EMAIL__";
24
+
25
+ var consent = window.confirm(
26
+ 'Onairos Sephora Export\\n\\n' +
27
+ 'Allow Onairos to export your Sephora data?\\n\\n' +
28
+ '- Your basket items\\n' +
29
+ '- Your order history\\n' +
30
+ '- Your loved products\\n' +
31
+ '- Your product ratings\\n\\n' +
32
+ 'Your data is encrypted and only used to build your personal AI model.'
33
+ );
34
+
35
+ if (!consent) {
36
+ console.log('Onairos Sephora export cancelled by user.');
37
+ return;
38
+ }
39
+
40
+ console.log('Onairos Sephora export consent granted. Extracting data...');
41
+
42
+ function getCookie(name) {
43
+ var match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
44
+ return match ? match[2] : null;
45
+ }
46
+
47
+ function extractBasket() {
48
+ var items = [];
49
+ var basketElements = document.querySelectorAll('[data-at*="basket"], [class*="basket-item"], [class*="cart-item"]');
50
+ basketElements.forEach(function(el, idx) {
51
+ var nameEl = el.querySelector('[class*="product-name"], [class*="name"], h3, h4');
52
+ var priceEl = el.querySelector('[class*="price"]');
53
+ var brandEl = el.querySelector('[class*="brand"]');
54
+ var qtyEl = el.querySelector('[class*="quantity"], input[type="number"]');
55
+
56
+ items.push({
57
+ id: 'basket_' + idx,
58
+ name: nameEl ? nameEl.textContent.trim() : 'Product ' + (idx + 1),
59
+ brand: brandEl ? brandEl.textContent.trim() : null,
60
+ price: priceEl ? parseFloat(priceEl.textContent.replace(/[^0-9.]/g, '')) || null : null,
61
+ quantity: qtyEl ? parseInt(qtyEl.value || qtyEl.textContent) || 1 : 1
62
+ });
63
+ });
64
+ return items;
65
+ }
66
+
67
+ function extractLoves() {
68
+ var loves = [];
69
+ var loveElements = document.querySelectorAll('[data-at*="love"], [class*="loved"], [class*="wishlist-item"]');
70
+ loveElements.forEach(function(el, idx) {
71
+ var nameEl = el.querySelector('[class*="product-name"], [class*="name"], h3, h4');
72
+ var brandEl = el.querySelector('[class*="brand"]');
73
+ var priceEl = el.querySelector('[class*="price"]');
74
+
75
+ loves.push({
76
+ id: 'love_' + idx,
77
+ name: nameEl ? nameEl.textContent.trim() : 'Loved Product ' + (idx + 1),
78
+ brand: brandEl ? brandEl.textContent.trim() : null,
79
+ price: priceEl ? parseFloat(priceEl.textContent.replace(/[^0-9.]/g, '')) || null : null,
80
+ type: 'love'
81
+ });
82
+ });
83
+ return loves;
84
+ }
85
+
86
+ function extractOrders() {
87
+ var orders = [];
88
+ var orderElements = document.querySelectorAll('[data-at*="order"], [class*="order-item"], [class*="order-card"]');
89
+ orderElements.forEach(function(el, idx) {
90
+ var orderIdEl = el.querySelector('[class*="order-number"], [class*="order-id"]');
91
+ var dateEl = el.querySelector('[class*="date"], time');
92
+ var totalEl = el.querySelector('[class*="total"], [class*="price"]');
93
+ var statusEl = el.querySelector('[class*="status"]');
94
+
95
+ orders.push({
96
+ orderId: orderIdEl ? orderIdEl.textContent.trim() : 'order_' + idx,
97
+ date: dateEl ? dateEl.textContent.trim() : new Date().toISOString(),
98
+ total: totalEl ? parseFloat(totalEl.textContent.replace(/[^0-9.]/g, '')) || null : null,
99
+ status: statusEl ? statusEl.textContent.trim().toLowerCase() : 'unknown',
100
+ items: []
101
+ });
102
+ });
103
+ return orders;
104
+ }
105
+
106
+ function extractRatings() {
107
+ var ratings = [];
108
+ var ratingElements = document.querySelectorAll('[data-at*="review"], [class*="review-item"], [class*="my-review"]');
109
+ ratingElements.forEach(function(el, idx) {
110
+ var nameEl = el.querySelector('[class*="product-name"], [class*="name"]');
111
+ var scoreEl = el.querySelector('[class*="rating"], [class*="stars"]');
112
+ var reviewEl = el.querySelector('[class*="review-text"], [class*="comment"]');
113
+
114
+ var score = 0;
115
+ if (scoreEl) {
116
+ var filledStars = scoreEl.querySelectorAll('[class*="filled"], [class*="active"]');
117
+ score = filledStars.length || parseInt(scoreEl.getAttribute('data-rating')) || 3;
118
+ }
119
+
120
+ ratings.push({
121
+ productId: 'product_' + idx,
122
+ productName: nameEl ? nameEl.textContent.trim() : null,
123
+ rating: score,
124
+ review: reviewEl ? reviewEl.textContent.trim() : null,
125
+ type: score >= 4 ? 'positive' : score <= 2 ? 'negative' : 'neutral'
126
+ });
127
+ });
128
+ return ratings;
129
+ }
130
+
131
+ var basket = extractBasket();
132
+ var loves = extractLoves();
133
+ var orders = extractOrders();
134
+ var ratings = extractRatings();
135
+
136
+ var basketTotal = basket.reduce(function(sum, item) {
137
+ return sum + ((item.price || 0) * (item.quantity || 1));
138
+ }, 0);
139
+
140
+ var payload = {
141
+ platform: 'mobile-sephora',
142
+ dataType: 'ecommerce',
143
+ data: {
144
+ basket: {
145
+ items: basket,
146
+ total: basketTotal,
147
+ itemCount: basket.length
148
+ },
149
+ orders: orders,
150
+ loves: loves,
151
+ ratings: ratings
152
+ },
153
+ summary: {
154
+ basketItemCount: basket.length,
155
+ basketTotal: basketTotal,
156
+ orderCount: orders.length,
157
+ lovedProductCount: loves.length,
158
+ ratingCount: ratings.length,
159
+ positiveRatings: ratings.filter(function(r) { return r.type === 'positive'; }).length,
160
+ negativeRatings: ratings.filter(function(r) { return r.type === 'negative'; }).length
161
+ },
162
+ mobileMetadata: {
163
+ platform: 'web',
164
+ source: 'bookmarklet',
165
+ extractedAt: new Date().toISOString()
166
+ }
167
+ };
168
+
169
+ console.log('[Onairos Sephora] ✅ Extracted:', payload);
170
+
171
+ if (!ON_TOKEN || ON_TOKEN === '__ONAIROS_TOKEN__') {
172
+ console.warn('[Onairos Sephora] No token embedded. Open Onairos and re-drag the bookmarklet.');
173
+ alert('Onairos Sephora: Data extracted, but no token to store.\\n\\nOpen Onairos -> Connect Sephora -> drag bookmarklet again.');
174
+ return;
175
+ }
176
+
177
+ var baseUrl = '__ONAIROS_BASE_URL__';
178
+ var response = await fetch(baseUrl + '/platform-data/store', {
179
+ method: 'POST',
180
+ headers: {
181
+ 'Content-Type': 'application/json',
182
+ 'Authorization': 'Bearer ' + ON_TOKEN
183
+ },
184
+ body: JSON.stringify(payload)
185
+ });
186
+
187
+ if (!response.ok) {
188
+ throw new Error('HTTP ' + response.status);
189
+ }
190
+
191
+ var result = await response.json();
192
+ console.log('[Onairos Sephora] ✅ Stored:', result);
193
+
194
+ var summary = 'Basket: ' + basket.length + ' items\\n' +
195
+ 'Loved: ' + loves.length + ' products\\n' +
196
+ 'Orders: ' + orders.length + '\\n' +
197
+ 'Reviews: ' + ratings.length;
198
+ alert('Onairos Sephora: Successfully exported!\\n\\n' + summary);
199
+
200
+ } catch(e) {
201
+ console.error('[Onairos Sephora] Error:', e);
202
+ alert('Onairos Sephora error: ' + (e && e.message ? e.message : e));
203
+ }
204
+ })();`;
205
+
206
+ class SephoraConnector extends Component {
207
+ constructor(props) {
208
+ super(props);
209
+ this.state = {
210
+ connected: false,
211
+ open: false,
212
+ isConnecting: false,
213
+ };
214
+ this.handleClose = this.handleClose.bind(this);
215
+ this.handleOpen = this.handleOpen.bind(this);
216
+ this.setConnected = this.setConnected.bind(this);
217
+ this.setDisconnected = this.setDisconnected.bind(this);
218
+ }
219
+
220
+ getUserToken() {
221
+ try {
222
+ const directToken = localStorage.getItem('onairos_user_token');
223
+ if (directToken) return directToken;
224
+ const userData = JSON.parse(localStorage.getItem('onairosUser') || '{}');
225
+ if (userData.token) return userData.token;
226
+ return null;
227
+ } catch {
228
+ return null;
229
+ }
230
+ }
231
+
232
+ getUserEmail() {
233
+ try {
234
+ const userData = JSON.parse(localStorage.getItem('onairosUser') || '{}');
235
+ return userData.email || userData.userEmail || null;
236
+ } catch {
237
+ return null;
238
+ }
239
+ }
240
+
241
+ getBookmarkletWithToken() {
242
+ const token = this.getUserToken();
243
+ const email = this.getUserEmail();
244
+ let code = SEPHORA_BOOKMARKLET_CODE;
245
+ if (token) {
246
+ code = code.replace('__ONAIROS_TOKEN__', token);
247
+ }
248
+ if (email) {
249
+ code = code.replace('__ONAIROS_EMAIL__', email);
250
+ }
251
+ code = code.replace('__ONAIROS_BASE_URL__', API_CONFIG.getBaseUrl());
252
+ return buildBookmarkletHref(code);
253
+ }
254
+
255
+ setConnected() {
256
+ this.setState({ connected: true });
257
+ if (this.props.onConnectionChange) {
258
+ this.props.onConnectionChange('Sephora', true);
259
+ }
260
+ this.handleClose();
261
+ }
262
+
263
+ setDisconnected() {
264
+ this.setState({ connected: false });
265
+ if (this.props.onConnectionChange) {
266
+ this.props.onConnectionChange('Sephora', false);
267
+ }
268
+ this.handleClose();
269
+ }
270
+
271
+ handleOpen() {
272
+ this.setState({ open: true });
273
+ }
274
+
275
+ handleClose() {
276
+ this.setState({ open: false });
277
+ if (this.props.onClose) {
278
+ this.props.onClose();
279
+ }
280
+ }
281
+
282
+ render() {
283
+ const { open = this.props.open || this.state.open } = this.props;
284
+
285
+ if (!open) return null;
286
+
287
+ const bookmarkletCode = this.getBookmarkletWithToken();
288
+
289
+ return (
290
+ <>
291
+ <style>{`
292
+ @keyframes sephoraPulse {
293
+ 0%, 100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.35); }
294
+ 50% { box-shadow: 0 0 0 10px rgba(0, 0, 0, 0); }
295
+ }
296
+ .sephora-bookmarklet-button {
297
+ background: linear-gradient(135deg, #000000 0%, #333333 100%);
298
+ border-radius: 9999px;
299
+ border: 1px solid rgba(255,255,255,0.2);
300
+ }
301
+ .sephora-bookmarklet-button:hover {
302
+ background: linear-gradient(135deg, #1a1a1a 0%, #4a4a4a 100%);
303
+ }
304
+ @keyframes fadeIn {
305
+ from { opacity: 0; }
306
+ to { opacity: 1; }
307
+ }
308
+ @keyframes fadeInScale {
309
+ 0% { opacity: 0; transform: translateY(8px) scale(0.96); }
310
+ 100% { opacity: 1; transform: translateY(0) scale(1); }
311
+ }
312
+ .sephora-modal-card {
313
+ animation: fadeInScale 200ms cubic-bezier(0.16, 1, 0.3, 1);
314
+ }
315
+ .sephora-step-circle {
316
+ background: linear-gradient(135deg, #000000 0%, #333333 100%);
317
+ min-width: 28px;
318
+ width: 28px;
319
+ height: 28px;
320
+ }
321
+ `}</style>
322
+
323
+ {/* Wrapper to create new stacking context above everything */}
324
+ <div style={{
325
+ position: 'fixed',
326
+ inset: 0,
327
+ zIndex: 2147483647,
328
+ isolation: 'isolate',
329
+ pointerEvents: 'none'
330
+ }}>
331
+ {/* Backdrop - clickable to close */}
332
+ <div
333
+ className="fixed inset-0 bg-black/60 backdrop-blur-sm transition-opacity"
334
+ onClick={this.handleClose}
335
+ style={{
336
+ animation: 'fadeIn 150ms ease-out',
337
+ pointerEvents: 'auto'
338
+ }}
339
+ />
340
+
341
+ <div className="fixed inset-0 flex items-center justify-center p-4 pointer-events-none" style={{ zIndex: 1 }}>
342
+ <div className="w-full max-w-md pointer-events-auto !text-white">
343
+ <div className="sephora-modal-card rounded-3xl overflow-hidden shadow-[0_30px_80px_rgba(0,0,0,0.50)] border border-white/10 bg-[radial-gradient(circle_at_top,_rgba(255,255,255,0.15),_transparent_55%),radial-gradient(circle_at_bottom,_rgba(15,23,42,0.95),_rgba(15,23,42,1))] backdrop-blur-3xl">
344
+
345
+ {/* Header */}
346
+ <div className="relative px-5 py-4 border-b border-white/10 bg-black/30">
347
+ <button
348
+ onClick={this.handleClose}
349
+ className="absolute right-4 top-4 p-1.5 hover:bg-white/20 rounded-full transition-colors"
350
+ aria-label="Close"
351
+ >
352
+ <svg className="w-4 h-4 text-slate-100" fill="none" stroke="currentColor" viewBox="0 0 24 24">
353
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
354
+ </svg>
355
+ </button>
356
+
357
+ <h2 className="text-xl font-semibold pr-8" style={{ color: '#FFFFFF' }}>
358
+ Connect Sephora
359
+ </h2>
360
+ <p className="text-sm mt-0.5" style={{ color: '#E2E8F0' }}>
361
+ Export your shopping data and preferences
362
+ </p>
363
+
364
+ {/* Privacy Notice */}
365
+ <div className="mt-3 flex items-start gap-2 bg-white/12 rounded-2xl px-3 py-2">
366
+ <svg className="w-4 h-4 text-pink-300 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
367
+ <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" />
368
+ </svg>
369
+ <p className="text-xs leading-relaxed" style={{ color: '#FFFFFF' }}>
370
+ <strong className="font-semibold">Beauty data, secured.</strong> Your shopping preferences help personalize your AI.
371
+ </p>
372
+ </div>
373
+ </div>
374
+
375
+ {/* Steps Content */}
376
+ <div className="px-5 py-4 space-y-4">
377
+
378
+ {/* Step 1 */}
379
+ <div className="flex gap-3">
380
+ <div className="flex-shrink-0">
381
+ <div className="sephora-step-circle rounded-full flex items-center justify-center">
382
+ <span className="text-white font-bold text-sm">1</span>
383
+ </div>
384
+ </div>
385
+ <div className="flex-1 pt-0.5">
386
+ <h3 className="text-sm font-semibold mb-1" style={{ color: '#FFFFFF' }}>
387
+ Drag this button to your bookmarks bar
388
+ </h3>
389
+ <div className="relative inline-block mt-2">
390
+ <div className="absolute inset-0 rounded-full" style={{ animation: 'sephoraPulse 2s ease-in-out infinite' }}></div>
391
+ <a
392
+ href={bookmarkletCode}
393
+ draggable="true"
394
+ onDragStart={(e) => {
395
+ e.dataTransfer.setData('text/plain', bookmarkletCode);
396
+ e.dataTransfer.effectAllowed = 'copy';
397
+ }}
398
+ onClick={(e) => {
399
+ e.preventDefault();
400
+ alert('Please drag this button to your bookmarks bar');
401
+ }}
402
+ className="sephora-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]"
403
+ style={{ color: '#FFFFFF' }}
404
+ >
405
+ <span className="text-base">🛍️</span>
406
+ <span className="text-sm">Onairos Sephora</span>
407
+ </a>
408
+ </div>
409
+ </div>
410
+ </div>
411
+
412
+ <div className="border-t border-white/10 ml-10"></div>
413
+
414
+ {/* Step 2 */}
415
+ <div className="flex gap-3">
416
+ <div className="flex-shrink-0">
417
+ <div className="sephora-step-circle rounded-full flex items-center justify-center">
418
+ <span className="text-white font-bold text-sm">2</span>
419
+ </div>
420
+ </div>
421
+ <div className="flex-1 pt-0.5">
422
+ <h3 className="text-sm font-semibold mb-1" style={{ color: '#FFFFFF' }}>
423
+ Open Sephora and log in
424
+ </h3>
425
+ <p className="text-xs mb-2" style={{ color: '#E2E8F0' }}>
426
+ Make sure you're logged into your Sephora account
427
+ </p>
428
+ <button
429
+ onClick={() => window.open('https://www.sephora.com', '_blank')}
430
+ className="inline-flex items-center gap-1.5 px-4 py-2 rounded-full bg-white/90 hover:bg-white text-black text-xs font-medium transition-colors shadow-[0_0_25px_rgba(0,0,0,0.35)]"
431
+ >
432
+ <svg className="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
433
+ <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" />
434
+ </svg>
435
+ Open Sephora
436
+ </button>
437
+ </div>
438
+ </div>
439
+
440
+ <div className="border-t border-white/10 ml-10"></div>
441
+
442
+ {/* Step 3 */}
443
+ <div className="flex gap-3">
444
+ <div className="flex-shrink-0">
445
+ <div className="sephora-step-circle rounded-full flex items-center justify-center">
446
+ <span className="text-white font-bold text-sm">3</span>
447
+ </div>
448
+ </div>
449
+ <div className="flex-1 pt-0.5">
450
+ <h3 className="text-sm font-semibold mb-1" style={{ color: '#FFFFFF' }}>
451
+ Click the bookmark on Sephora
452
+ </h3>
453
+ <p className="text-xs" style={{ color: '#E2E8F0' }}>
454
+ Click <strong style={{ color: '#FFFFFF' }}>"Onairos Sephora"</strong> bookmark. We'll export your cart, loves, and purchase history.
455
+ </p>
456
+ </div>
457
+ </div>
458
+
459
+ </div>
460
+
461
+ {/* Footer */}
462
+ <div className="px-5 py-4 bg-white/5 border-t border-white/10">
463
+ <button
464
+ onClick={() => this.setConnected()}
465
+ 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(0,0,0,0.45)] border border-white/40"
466
+ style={{ background: 'linear-gradient(135deg, #000000 0%, #333333 100%)', color: '#FFFFFF' }}
467
+ >
468
+ Got it! ✓
469
+ </button>
470
+ </div>
471
+
472
+ </div>
473
+ </div>
474
+ </div>
475
+ </div>
476
+ </>
477
+ );
478
+ }
479
+ }
480
+
481
+ export default SephoraConnector;
482
+