onairos 3.1.11 → 3.1.14

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 (205) hide show
  1. package/README.md +397 -344
  2. package/dist/10.js +2 -0
  3. package/dist/10.js.map +1 -0
  4. package/dist/123.js +2 -0
  5. package/dist/123.js.map +1 -0
  6. package/dist/241.js +2 -0
  7. package/dist/241.js.map +1 -0
  8. package/dist/31.js +2 -0
  9. package/dist/31.js.map +1 -0
  10. package/dist/336.js +2 -0
  11. package/dist/336.js.map +1 -0
  12. package/dist/433.js +1 -1
  13. package/dist/502.js +2 -0
  14. package/dist/502.js.map +1 -0
  15. package/dist/540.js +2 -0
  16. package/dist/540.js.map +1 -0
  17. package/dist/845.js +1 -1
  18. package/dist/911.js +2 -0
  19. package/dist/911.js.map +1 -0
  20. package/dist/961.js +2 -0
  21. package/dist/961.js.map +1 -0
  22. package/dist/991.js +2 -0
  23. package/dist/991.js.map +1 -0
  24. package/dist/999.js +2 -0
  25. package/dist/999.js.map +1 -0
  26. package/dist/assets/persona1.png +0 -0
  27. package/dist/assets/persona2.png +0 -0
  28. package/dist/assets/persona3.png +0 -0
  29. package/dist/assets/persona4.png +0 -0
  30. package/dist/assets/persona5.png +0 -0
  31. package/dist/iframe.bundle.js +1 -1
  32. package/dist/iframe.bundle.js.map +1 -1
  33. package/dist/onairos-laravel.js +1 -1
  34. package/dist/onairos.bundle.js +1 -1
  35. package/dist/onairos.bundle.js.map +1 -1
  36. package/dist/onairos.esm.js +1 -1
  37. package/dist/onairos.esm.js.map +1 -1
  38. package/dist/persona1.png +0 -0
  39. package/dist/persona2.png +0 -0
  40. package/dist/persona3.png +0 -0
  41. package/dist/persona4.png +0 -0
  42. package/dist/persona5.png +0 -0
  43. package/dist/static/18d123f2a2f45a6d54de.png +0 -0
  44. package/dist/static/548f78d0c209f970bf58.png +0 -0
  45. package/dist/static/5657b9c33db4d92bb34b.png +0 -0
  46. package/dist/static/8a89b8f511e03bbdce8d.png +0 -0
  47. package/dist/static/8c5b220bf6f482881a90.png +1 -1
  48. package/dist/static/c2057ecc310a9286b4ed.png +0 -0
  49. package/package.json +3 -2
  50. package/src/assets/persona1.png +0 -0
  51. package/src/assets/persona2.png +0 -0
  52. package/src/assets/persona3.png +0 -0
  53. package/src/assets/persona4.png +0 -0
  54. package/src/assets/persona5.png +0 -0
  55. package/({status +0 -0
  56. package/.babelrc +0 -15
  57. package/.gitattributes +0 -2
  58. package/BACKEND_INTEGRATION_SUMMARY.md +0 -159
  59. package/CHANGELOG.md +0 -139
  60. package/CONNECTOR_GAPS_FILLED.md +0 -183
  61. package/GITBOOK_OVERVIEW.md +0 -123
  62. package/LARAVEL_INTEGRATION_GUIDE.md +0 -643
  63. package/LARAVEL_TECHNICAL_EXPLANATION.md +0 -465
  64. package/MOBILE_BROWSER_COMPATIBILITY.md +0 -278
  65. package/MOBILE_TRAINING_ROUTES_SUMMARY.md +0 -268
  66. package/NEW_FEATURES_SUMMARY.md +0 -270
  67. package/OAUTH_CONNECTOR_FIX.md +0 -210
  68. package/POPUP_IMPLEMENTATION_README.md +0 -252
  69. package/SDK-README.md +0 -345
  70. package/SDK_MIGRATION_SUMMARY.md +0 -140
  71. package/SDK_QUICK_REFERENCE.md +0 -408
  72. package/TAILWIND_V4_UPGRADE.md +0 -217
  73. package/WEB_OAUTH_CONNECTORS_OVERVIEW.md +0 -381
  74. package/console.error(error)) +0 -0
  75. package/example-usage-updated.js +0 -273
  76. package/example-usage.js +0 -58
  77. package/laravel.txt +0 -186
  78. package/llm.txt +0 -328
  79. package/onairos.d.ts +0 -41
  80. package/postcss.config.js +0 -5
  81. package/public/data_request_popup.html +0 -321
  82. package/public/oauth-callback.html +0 -181
  83. package/rollup.config.js +0 -49
  84. package/sdk-integration/INTEGRATION_SUMMARY.md +0 -596
  85. package/sdk-integration/MIGRATION_COMPLETE.md +0 -377
  86. package/sdk-integration/README.md +0 -128
  87. package/sdk-integration/config/oauth-config.js +0 -480
  88. package/sdk-integration/config/sdk-config.js +0 -562
  89. package/sdk-integration/docs/API_REFERENCE.md +0 -849
  90. package/sdk-integration/docs/AUTHENTICATION_GUIDE.md +0 -772
  91. package/sdk-integration/docs/INTEGRATION_EXAMPLES.md +0 -1989
  92. package/sdk-integration/jest.config.js +0 -78
  93. package/sdk-integration/middleware/rateLimiting.js +0 -607
  94. package/sdk-integration/middleware/unifiedApiKeyAuth.js +0 -514
  95. package/sdk-integration/middleware/youtubeAuth.js +0 -241
  96. package/sdk-integration/routes/linkedin-enhanced.js +0 -678
  97. package/sdk-integration/routes/validation.js +0 -749
  98. package/sdk-integration/routes/youtube-enhanced.js +0 -1746
  99. package/sdk-integration/tests/routes/linkedin-enhanced.test.js +0 -793
  100. package/sdk-integration/tests/routes/validation.test.js +0 -638
  101. package/sdk-integration/tests/routes/youtube-enhanced.test.js +0 -729
  102. package/sdk-integration/tests/setup.js +0 -180
  103. package/sdk-integration/types/auth-types.js +0 -576
  104. package/sdk-integration/utils/connectionHealth.js +0 -525
  105. package/sdk-integration/utils/databaseUtils.js +0 -594
  106. package/sdk-integration/utils/tokenManager.js +0 -464
  107. package/src/RSA.jsx +0 -57
  108. package/src/components/AuthButtons.jsx +0 -48
  109. package/src/components/DataRequest.js +0 -416
  110. package/src/components/EmailAuth.js +0 -235
  111. package/src/components/GoogleButton.js +0 -100
  112. package/src/components/LoadingPage.jsx +0 -19
  113. package/src/components/Notification.jsx +0 -21
  114. package/src/components/OnairosAppButton.jsx +0 -84
  115. package/src/components/PinSetup.js +0 -111
  116. package/src/components/SecuritySetup.js +0 -81
  117. package/src/components/SignUp.js +0 -122
  118. package/src/components/TestTelegramButton.js +0 -53
  119. package/src/components/TrainingComponent.jsx +0 -192
  120. package/src/components/UniversalOnboarding.js +0 -205
  121. package/src/components/UniversalOnboarding.jsx +0 -498
  122. package/src/components/connectors/GmailConnector.js +0 -177
  123. package/src/components/connectors/InstagramConnector.js +0 -171
  124. package/src/components/connectors/LinkedInConnector.js +0 -168
  125. package/src/components/connectors/PinterestConnector.js +0 -168
  126. package/src/components/connectors/README.md +0 -292
  127. package/src/components/connectors/RedditConnector.js +0 -168
  128. package/src/components/connectors/YoutubeConnector.js +0 -172
  129. package/src/components/connectors/index.js +0 -21
  130. package/src/components/ui/PageLayout.jsx +0 -219
  131. package/src/components/ui/PrimaryButton.jsx +0 -153
  132. package/src/components/ui/button.jsx +0 -49
  133. package/src/components/ui/card.jsx +0 -61
  134. package/src/components/ui/checkbox.jsx +0 -33
  135. package/src/components/ui/label.jsx +0 -29
  136. package/src/components/utils/UpdateConnections.js +0 -43
  137. package/src/components/utils/oauthHelper.js +0 -97
  138. package/src/deepLink.jsx +0 -38
  139. package/src/getPin.js +0 -24
  140. package/src/icons/Avatar.png +0 -0
  141. package/src/icons/Sentiment.png +0 -0
  142. package/src/icons/Trait.png +0 -0
  143. package/src/iframe/DataRequestPage.jsx +0 -285
  144. package/src/iframe/OnairosButtonIntegration.md +0 -148
  145. package/src/iframe/components/Box.jsx +0 -56
  146. package/src/iframe/components/IndividualConnection.jsx +0 -88
  147. package/src/iframe/dataRequestHandler.js +0 -637
  148. package/src/iframe/data_request_iframe.html +0 -27
  149. package/src/iframe/data_request_page.js +0 -47
  150. package/src/iframe/icons/Avatar.png +0 -1
  151. package/src/iframe/icons/Avatar2.png +0 -1
  152. package/src/iframe/icons/Sentiment.png +0 -1
  153. package/src/iframe/icons/Trait.png +0 -1
  154. package/src/iframe/icons/onairos_logo.png +0 -0
  155. package/src/iframe/utils/api.js +0 -55
  156. package/src/index.js +0 -14
  157. package/src/laravel/OnairosVue.vue +0 -398
  158. package/src/laravel/blade-helpers.js +0 -315
  159. package/src/laravel/vite-plugin.js +0 -179
  160. package/src/mobile/MobileDataRequestPage.jsx +0 -231
  161. package/src/mobile/components/MobileBox.jsx +0 -71
  162. package/src/mobile/components/MobileIndividualConnection.jsx +0 -51
  163. package/src/mobile/shims/browser-apis.js +0 -78
  164. package/src/mobile/shims/lucide-shim.js +0 -85
  165. package/src/newUI/PrimaryButton.tsx +0 -213
  166. package/src/newUI/WelcomeScreen.tsx +0 -311
  167. package/src/onairos.jsx +0 -39
  168. package/src/onairos.native.jsx +0 -15
  169. package/src/onairosButton.jsx +0 -342
  170. package/src/overlay/CheckBox.jsx +0 -114
  171. package/src/overlay/IndividualConnection copy.js +0 -86
  172. package/src/overlay/IndividualConnection.js +0 -191
  173. package/src/overlay/IndividualConnectionNew.jsx +0 -157
  174. package/src/overlay/box.js +0 -84
  175. package/src/overlay/overlay.js +0 -436
  176. package/src/styles/tailwind.css +0 -65
  177. package/src/theme/colors.js +0 -40
  178. package/src/utils/biometrics.js +0 -26
  179. package/src/utils/deepLinking.js +0 -27
  180. package/src/utils/extractMemory.js +0 -277
  181. package/src/utils/overlayHandler.js +0 -224
  182. package/src/utils/responseFormatter.js +0 -140
  183. package/test-clean-build.html +0 -48
  184. package/test-enhanced-data-request.html +0 -271
  185. package/test-enhanced-live-mode.html +0 -391
  186. package/test-entry-points.html +0 -64
  187. package/test-final-ui.html +0 -184
  188. package/test-fixed-flow.html +0 -215
  189. package/test-new-ui-design.html +0 -434
  190. package/test-oauth-debugging.html +0 -184
  191. package/test-popup-implementation.html +0 -167
  192. package/test-sdk.js +0 -373
  193. package/test-simple-button.html +0 -41
  194. package/test-simplified-flow.html +0 -234
  195. package/test-tailwind-v4.html +0 -141
  196. package/test-toggle-debug.html +0 -114
  197. package/test-universal-onboarding.html +0 -251
  198. package/test.html +0 -194
  199. package/tests/laravel/examples/blade-example.test.js +0 -283
  200. package/tests/laravel/laravel-integration.test.js +0 -647
  201. package/tests/laravel/setup.js +0 -93
  202. package/tests/laravel/vitest.config.js +0 -21
  203. package/webpack.config.js +0 -222
  204. package/webpack.native.config.js +0 -100
  205. package/{ +0 -0
package/README.md CHANGED
@@ -1,344 +1,397 @@
1
- ## Onairos Developer Documentation v2.0.0
2
-
3
- ### 🚀 What's New in v2.0.0
4
-
5
- - **Popup-based Data Requests**: No more cutoff issues with improved popup window implementation
6
- - **AutoFetch by Default**: Automatic API calls after user approval - no manual handling required
7
- - **Simplified Integration**: Much cleaner and easier to use
8
- - **Enhanced UX**: Better positioning, loading states, and error handling
9
- - **Laravel Vite Support**: First-class integration with Laravel Vite applications
10
-
11
- ### 1. Create a Developer Account
12
-
13
- Create a Developer account to access Onairos services. Register your domain to ensure secure API access.
14
-
15
- https://Onairos.uk/dev-board
16
-
17
- ### 2. Installation
18
-
19
- #### Standard Installation
20
- ```bash
21
- npm install onairos
22
- ```
23
-
24
- #### Laravel Vite Installation
25
- ```bash
26
- npm install onairos
27
- # For Vue.js integration
28
- npm install --save-dev @vitejs/plugin-vue
29
- # For React integration
30
- npm install --save-dev @vitejs/plugin-react
31
- ```
32
-
33
- ### 3. Basic Usage
34
-
35
- #### React/Standard Integration
36
-
37
- Import and use the OnairosButton component:
38
-
39
- ```jsx
40
- import { OnairosButton } from 'onairos';
41
-
42
- function MyApp() {
43
- return (
44
- <OnairosButton
45
- requestData={['email', 'profile', 'social']}
46
- webpageName="My Application"
47
- autoFetch={true} // Default - automatically makes API calls
48
- onComplete={(result) => {
49
- console.log('Data approved:', result.approved);
50
- console.log('API Response:', result.apiResponse); // Available when autoFetch is true
51
-
52
- if (result.apiResponse) {
53
- // Use the API response data directly
54
- console.log('User data:', result.apiResponse);
55
- }
56
- }}
57
- />
58
- );
59
- }
60
- ```
61
-
62
- #### Laravel Blade Integration
63
-
64
- For Laravel applications using Blade templates:
65
-
66
- ```js
67
- // vite.config.js
68
- import { defineConfig } from 'vite';
69
- import laravel from 'laravel-vite-plugin';
70
- import { onairosLaravelPlugin } from 'onairos/vite-plugin';
71
-
72
- export default defineConfig({
73
- plugins: [
74
- laravel({
75
- input: ['resources/css/app.css', 'resources/js/app.js'],
76
- refresh: true,
77
- }),
78
- onairosLaravelPlugin({
79
- bladeSupport: true
80
- })
81
- ],
82
- });
83
- ```
84
-
85
- ```js
86
- // resources/js/app.js
87
- import { initializeOnairosForBlade } from 'onairos/blade';
88
-
89
- document.addEventListener('DOMContentLoaded', () => {
90
- initializeOnairosForBlade({
91
- testMode: import.meta.env.DEV,
92
- autoDetectMobile: true
93
- });
94
- });
95
- ```
96
-
97
- ```blade
98
- {{-- resources/views/dashboard.blade.php --}}
99
- <div id="onairos-button"></div>
100
-
101
- <script>
102
- createOnairosButton('onairos-button', {
103
- requestData: ['email', 'profile'],
104
- webpageName: 'My Laravel App',
105
- onComplete: function(result) {
106
- console.log('Connection successful!', result);
107
- }
108
- });
109
- </script>
110
- ```
111
-
112
- #### Laravel Vue Integration
113
-
114
- For Laravel applications using Vue.js:
115
-
116
- ```js
117
- // vite.config.js
118
- import { defineConfig } from 'vite';
119
- import laravel from 'laravel-vite-plugin';
120
- import vue from '@vitejs/plugin-vue';
121
- import { onairosVuePlugin } from 'onairos/vite-plugin';
122
-
123
- export default defineConfig({
124
- plugins: [
125
- laravel({
126
- input: ['resources/css/app.css', 'resources/js/app.js'],
127
- refresh: true,
128
- }),
129
- vue(),
130
- onairosVuePlugin()
131
- ],
132
- });
133
- ```
134
-
135
- ```js
136
- // resources/js/app.js
137
- import { createApp } from 'vue';
138
- import OnairosVue from 'onairos/src/laravel/OnairosVue.vue';
139
-
140
- const app = createApp({});
141
- app.component('onairos-button', OnairosVue);
142
- app.mount('#app');
143
- ```
144
-
145
- ```blade
146
- {{-- In your Blade template --}}
147
- <div id="app">
148
- <onairos-button
149
- :request-data="['email', 'profile']"
150
- webpage-name="Laravel Vue App"
151
- @complete="handleComplete"
152
- ></onairos-button>
153
- </div>
154
- ```
155
-
156
- ### 4. Configuration Options
157
-
158
- #### OnairosButton Props
159
-
160
- - **`requestData`** (Array): Specific data types to request
161
- - Available types: `'email'`, `'profile'`, `'social'`, `'activity'`, `'preferences'`
162
- - **`webpageName`** (String): Your application name displayed to users
163
- - **`autoFetch`** (Boolean, default: `true`): Enable automatic API calls after approval
164
- - **`onComplete`** (Function): Callback when data request completes
165
- - **`proofMode`** (Boolean, default: `false`): Enable proof mode for verification
166
- - **`testMode`** (Boolean, default: `false`): Enable test mode for development
167
-
168
- #### Laravel-Specific Props
169
-
170
- - **`buttonType`** (String): `'pill'`, `'icon'`, or `'rounded'`
171
- - **`size`** (String): `'small'`, `'medium'`, or `'large'`
172
- - **`textColor`** (String): Button text color
173
- - **`disabled`** (Boolean): Disable the button
174
-
175
- ### 5. Laravel Integration Guide
176
-
177
- For complete Laravel integration examples and advanced configuration, see our [Laravel Integration Guide](./LARAVEL_INTEGRATION_GUIDE.md).
178
-
179
- The guide covers:
180
- - ✅ **Blade Templates**: Direct integration with PHP templates
181
- - **Vue.js Components**: Reactive Vue components
182
- - **React Components**: React integration patterns
183
- - ✅ **Vite Plugins**: Custom Vite plugins for Laravel
184
- - ✅ **Mobile Optimization**: Automatic mobile detection
185
- - ✅ **Production Deployment**: Build and deployment strategies
186
-
187
- ### 6. Migration from v1.x
188
-
189
- **Before (v1.x - Complex)**:
190
- ```jsx
191
- // Old complex setup with manual event listeners
192
- useEffect(() => {
193
- const handleMessage = (event) => {
194
- if (event.data?.source === 'content-script' && event.data?.type === 'API_URL_RESPONSE') {
195
- const { APIurl, accessToken } = event.data;
196
- // Manual API call handling
197
- fetch(APIurl, {
198
- method: 'POST',
199
- headers: { 'Authorization': `Bearer ${accessToken}` },
200
- body: JSON.stringify(InputData),
201
- });
202
- }
203
- };
204
- window.addEventListener('message', handleMessage);
205
- return () => window.removeEventListener('message', handleMessage);
206
- }, []);
207
-
208
- <Onairos requestData={complexRequestObject} webpageName={webpageName} />
209
- ```
210
-
211
- **After (v2.0 - Simple)**:
212
- ```jsx
213
- // New simplified approach
214
- <OnairosButton
215
- requestData={['email', 'profile']}
216
- webpageName="My App"
217
- onComplete={(result) => {
218
- // API call already made automatically
219
- console.log('User data:', result.apiResponse);
220
- }}
221
- />
222
- ```
223
-
224
- ### 7. Data Types Available
225
-
226
- - **`email`**: Email address for account identification
227
- - **`profile`**: Basic profile information and preferences
228
- - **`social`**: Connected social media accounts
229
- - **`activity`**: Usage patterns and interactions
230
- - **`preferences`**: User settings and customization choices
231
-
232
- ### 8. Error Handling
233
-
234
- The component includes comprehensive error handling:
235
-
236
- ```jsx
237
- <OnairosButton
238
- requestData={['email']}
239
- webpageName="My App"
240
- onComplete={(result) => {
241
- if (result.apiError) {
242
- console.error('API Error:', result.apiError);
243
- // Handle error appropriately
244
- } else if (result.apiResponse) {
245
- console.log('Success:', result.apiResponse);
246
- // Process data
247
- }
248
- }}
249
- />
250
- ```
251
-
252
- ### 9. Browser Compatibility
253
-
254
- - Chrome 80+
255
- - ✅ Firefox 75+
256
- - ✅ Safari 13+
257
- - Edge 80+
258
-
259
- ### 10. Troubleshooting
260
-
261
- **Popup Blocked**: Ensure popups are allowed for your domain in browser settings.
262
-
263
- **API Calls Failing**: Verify your domain is registered in the developer console.
264
-
265
- **Data Not Loading**: Check browser console for errors and ensure proper integration.
266
-
267
- ### 11. Support
268
-
269
- For issues or questions:
270
- - Check the [troubleshooting guide](./POPUP_IMPLEMENTATION_README.md)
271
- - Review browser console for errors
272
- - Contact support with detailed error information
273
-
274
- ---
275
-
276
- ## Legacy Documentation (v1.x)
277
-
278
- *The following sections document the previous complex implementation for reference:*
279
-
280
- ### Legacy Request Object Format
281
-
282
- Previously required complex request objects:
283
- ```json
284
- "RequestObject":{
285
- "Small": {
286
- "type":"Personality",
287
- "descriptions":"Insight into your Interests",
288
- "reward":"10% Discount"
289
- },
290
- "Medium":{
291
- "type":"Personality",
292
- "descriptions":"Insight into your Interests",
293
- "reward":"2 USDC"
294
- },
295
- "Large":{
296
- "type":"Personality",
297
- "descriptions":"Insight into your Interests",
298
- "reward":"2 USDC"
299
- }
300
- }
301
- ```
302
-
303
- ### Legacy API Usage
304
-
305
- Previously required manual event handling:
306
- ```jsx
307
- export default async function UseAPIURL(event){
308
- if (event.data && event.data.source === 'content-script' && event.data.type === 'API_URL_RESPONSE') {
309
- const { APIurl, accessToken } = event.data;
310
- await fetch(APIurl, {
311
- method: 'POST',
312
- headers: {
313
- 'Content-Type': 'application/json',
314
- 'Authorization': `Bearer ${accessToken}`
315
- },
316
- body: JSON.stringify(InputData),
317
- }).then(async (data)=>{
318
- // process Onairos Data
319
- })
320
- .catch(error => console.error(error));
321
- }
322
- }
323
- ```
324
-
325
- *This manual approach is no longer needed with v2.0's autoFetch functionality.*
326
-
327
- ### Legacy Output Format
328
-
329
- API still responds with the same format:
330
- ```json
331
- {
332
- "output": [
333
- [[0.9998]],
334
- [[0.9999]],
335
- [[0.9922]],
336
- [[0.0013]]
337
- ]
338
- }
339
- ```
340
-
341
- ### Integration Notes
342
-
343
- When integrating the onairos package into your application, ensure your Webpack configuration handles dynamic imports correctly and serves the necessary chunk files from `node_modules/onairos/dist`.
344
-
1
+ ## Onairos Developer Documentation v2.0.0
2
+
3
+ ### 🚀 What's New in v2.0.0
4
+
5
+ - **Popup-based Data Requests**: No more cutoff issues with improved popup window implementation
6
+ - **AutoFetch by Default**: Automatic API calls after user approval - no manual handling required
7
+ - **Simplified Integration**: Much cleaner and easier to use
8
+ - **Enhanced UX**: Better positioning, loading states, and error handling
9
+ - **Laravel Vite Support**: First-class integration with Laravel Vite applications
10
+
11
+ ### 1. Create a Developer Account
12
+
13
+ Create a Developer account to access Onairos services. Register your domain to ensure secure API access.
14
+
15
+ https://Onairos.uk/dev-board
16
+
17
+ ### 2. Installation
18
+
19
+ #### Standard Installation
20
+
21
+ ```bash
22
+ npm install onairos
23
+ ```
24
+
25
+ #### Laravel Vite Installation
26
+
27
+ ```bash
28
+ npm install onairos
29
+ # For Vue.js integration
30
+ npm install --save-dev @vitejs/plugin-vue
31
+ # For React integration
32
+ npm install --save-dev @vitejs/plugin-react
33
+ ```
34
+
35
+ ### 3. Basic Usage
36
+
37
+ #### React/Standard Integration
38
+
39
+ Import and use the OnairosButton component:
40
+
41
+ ```jsx
42
+ import { OnairosButton } from "onairos";
43
+
44
+ function MyApp() {
45
+ return (
46
+ <OnairosButton
47
+ requestData={["email", "profile", "social"]}
48
+ webpageName="My Application"
49
+ autoFetch={true} // Default - automatically makes API calls
50
+ onComplete={(result) => {
51
+ console.log("Data approved:", result.approved);
52
+ console.log("API Response:", result.apiResponse); // Available when autoFetch is true
53
+
54
+ if (result.apiResponse) {
55
+ // Use the API response data directly
56
+ console.log("User data:", result.apiResponse);
57
+ }
58
+ }}
59
+ />
60
+ );
61
+ }
62
+ ```
63
+
64
+ #### Laravel Blade Integration
65
+
66
+ For Laravel applications using Blade templates:
67
+
68
+ ```js
69
+ // vite.config.js
70
+ import { defineConfig } from "vite";
71
+ import laravel from "laravel-vite-plugin";
72
+ import { onairosLaravelPlugin } from "onairos/vite-plugin";
73
+
74
+ export default defineConfig({
75
+ plugins: [
76
+ laravel({
77
+ input: ["resources/css/app.css", "resources/js/app.js"],
78
+ refresh: true,
79
+ }),
80
+ onairosLaravelPlugin({
81
+ bladeSupport: true,
82
+ }),
83
+ ],
84
+ });
85
+ ```
86
+
87
+ ```js
88
+ // resources/js/app.js
89
+ import { initializeOnairosForBlade } from "onairos/blade";
90
+
91
+ document.addEventListener("DOMContentLoaded", () => {
92
+ initializeOnairosForBlade({
93
+ testMode: import.meta.env.DEV,
94
+ autoDetectMobile: true,
95
+ });
96
+ });
97
+ ```
98
+
99
+ ```blade
100
+ {{-- resources/views/dashboard.blade.php --}}
101
+ <div id="onairos-button"></div>
102
+
103
+ <script>
104
+ createOnairosButton('onairos-button', {
105
+ requestData: ['email', 'profile'],
106
+ webpageName: 'My Laravel App',
107
+ onComplete: function(result) {
108
+ console.log('Connection successful!', result);
109
+ }
110
+ });
111
+ </script>
112
+ ```
113
+
114
+ #### Laravel Vue Integration
115
+
116
+ For Laravel applications using Vue.js:
117
+
118
+ ```js
119
+ // vite.config.js
120
+ import { defineConfig } from "vite";
121
+ import laravel from "laravel-vite-plugin";
122
+ import vue from "@vitejs/plugin-vue";
123
+ import { onairosVuePlugin } from "onairos/vite-plugin";
124
+
125
+ export default defineConfig({
126
+ plugins: [
127
+ laravel({
128
+ input: ["resources/css/app.css", "resources/js/app.js"],
129
+ refresh: true,
130
+ }),
131
+ vue(),
132
+ onairosVuePlugin(),
133
+ ],
134
+ });
135
+ ```
136
+
137
+ ```js
138
+ // resources/js/app.js
139
+ import { createApp } from "vue";
140
+ import OnairosVue from "onairos/src/laravel/OnairosVue.vue";
141
+
142
+ const app = createApp({});
143
+ app.component("onairos-button", OnairosVue);
144
+ app.mount("#app");
145
+ ```
146
+
147
+ #### Vite Optimization Configuration
148
+
149
+ For Vite applications, add the following configuration to ensure proper asset handling:
150
+
151
+ ```ts
152
+ // vite.config.ts
153
+ import { defineConfig } from "vite";
154
+
155
+ export default defineConfig({
156
+ optimizeDeps: {
157
+ exclude: ["onairos"],
158
+ },
159
+ });
160
+ ```
161
+
162
+ #### Custom Persona Images
163
+
164
+ The library includes default persona images that change based on connected platforms. In Vite dev environments, these may show as gradient fallbacks due to asset processing. To use custom images:
165
+
166
+ ```jsx
167
+ import { OnairosButton } from "onairos";
168
+
169
+ function MyApp() {
170
+ return (
171
+ <OnairosButton
172
+ requestData={["email", "profile", "social"]}
173
+ webpageName="My Application"
174
+ personaImages={{
175
+ 1: "/path/to/persona1.png",
176
+ 2: "/path/to/persona2.png",
177
+ 3: "/path/to/persona3.png",
178
+ 4: "/path/to/persona4.png",
179
+ 5: "/path/to/persona5.png",
180
+ }}
181
+ onComplete={(result) => {
182
+ console.log("Data approved:", result.approved);
183
+ }}
184
+ />
185
+ );
186
+ }
187
+ ```
188
+
189
+ ```blade
190
+ {{-- In your Blade template --}}
191
+ <div id="app">
192
+ <onairos-button
193
+ :request-data="['email', 'profile']"
194
+ webpage-name="Laravel Vue App"
195
+ @complete="handleComplete"
196
+ ></onairos-button>
197
+ </div>
198
+ ```
199
+
200
+ ### 4. Configuration Options
201
+
202
+ #### OnairosButton Props
203
+
204
+ - **`requestData`** (Array): Specific data types to request
205
+ - Available types: `'email'`, `'profile'`, `'social'`, `'activity'`, `'preferences'`
206
+ - **`webpageName`** (String): Your application name displayed to users
207
+ - **`autoFetch`** (Boolean, default: `true`): Enable automatic API calls after approval
208
+ - **`onComplete`** (Function): Callback when data request completes
209
+ - **`proofMode`** (Boolean, default: `false`): Enable proof mode for verification
210
+ - **`testMode`** (Boolean, default: `false`): Enable test mode for development
211
+
212
+ #### Laravel-Specific Props
213
+
214
+ - **`buttonType`** (String): `'pill'`, `'icon'`, or `'rounded'`
215
+ - **`size`** (String): `'small'`, `'medium'`, or `'large'`
216
+ - **`textColor`** (String): Button text color
217
+ - **`disabled`** (Boolean): Disable the button
218
+
219
+ ### 5. Laravel Integration Guide
220
+
221
+ For complete Laravel integration examples and advanced configuration, see our [Laravel Integration Guide](./LARAVEL_INTEGRATION_GUIDE.md).
222
+
223
+ The guide covers:
224
+
225
+ - ✅ **Blade Templates**: Direct integration with PHP templates
226
+ - **Vue.js Components**: Reactive Vue components
227
+ - **React Components**: React integration patterns
228
+ - **Vite Plugins**: Custom Vite plugins for Laravel
229
+ - **Mobile Optimization**: Automatic mobile detection
230
+ - **Production Deployment**: Build and deployment strategies
231
+
232
+ ### 6. Migration from v1.x
233
+
234
+ **Before (v1.x - Complex)**:
235
+
236
+ ```jsx
237
+ // Old complex setup with manual event listeners
238
+ useEffect(() => {
239
+ const handleMessage = (event) => {
240
+ if (
241
+ event.data?.source === "content-script" &&
242
+ event.data?.type === "API_URL_RESPONSE"
243
+ ) {
244
+ const { APIurl, accessToken } = event.data;
245
+ // Manual API call handling
246
+ fetch(APIurl, {
247
+ method: "POST",
248
+ headers: { Authorization: `Bearer ${accessToken}` },
249
+ body: JSON.stringify(InputData),
250
+ });
251
+ }
252
+ };
253
+ window.addEventListener("message", handleMessage);
254
+ return () => window.removeEventListener("message", handleMessage);
255
+ }, []);
256
+
257
+ <Onairos requestData={complexRequestObject} webpageName={webpageName} />;
258
+ ```
259
+
260
+ **After (v2.0 - Simple)**:
261
+
262
+ ```jsx
263
+ // New simplified approach
264
+ <OnairosButton
265
+ requestData={["email", "profile"]}
266
+ webpageName="My App"
267
+ onComplete={(result) => {
268
+ // API call already made automatically
269
+ console.log("User data:", result.apiResponse);
270
+ }}
271
+ />
272
+ ```
273
+
274
+ ### 7. Data Types Available
275
+
276
+ - **`email`**: Email address for account identification
277
+ - **`profile`**: Basic profile information and preferences
278
+ - **`social`**: Connected social media accounts
279
+ - **`activity`**: Usage patterns and interactions
280
+ - **`preferences`**: User settings and customization choices
281
+
282
+ ### 8. Error Handling
283
+
284
+ The component includes comprehensive error handling:
285
+
286
+ ```jsx
287
+ <OnairosButton
288
+ requestData={["email"]}
289
+ webpageName="My App"
290
+ onComplete={(result) => {
291
+ if (result.apiError) {
292
+ console.error("API Error:", result.apiError);
293
+ // Handle error appropriately
294
+ } else if (result.apiResponse) {
295
+ console.log("Success:", result.apiResponse);
296
+ // Process data
297
+ }
298
+ }}
299
+ />
300
+ ```
301
+
302
+ ### 9. Browser Compatibility
303
+
304
+ - ✅ Chrome 80+
305
+ - Firefox 75+
306
+ - ✅ Safari 13+
307
+ - Edge 80+
308
+
309
+ ### 10. Troubleshooting
310
+
311
+ **Popup Blocked**: Ensure popups are allowed for your domain in browser settings.
312
+
313
+ **API Calls Failing**: Verify your domain is registered in the developer console.
314
+
315
+ **Data Not Loading**: Check browser console for errors and ensure proper integration.
316
+
317
+ ### 11. Support
318
+
319
+ For issues or questions:
320
+
321
+ - Check the [troubleshooting guide](./POPUP_IMPLEMENTATION_README.md)
322
+ - Review browser console for errors
323
+ - Contact support with detailed error information
324
+
325
+ ---
326
+
327
+ ## Legacy Documentation (v1.x)
328
+
329
+ _The following sections document the previous complex implementation for reference:_
330
+
331
+ ### Legacy Request Object Format
332
+
333
+ Previously required complex request objects:
334
+
335
+ ```json
336
+ "RequestObject":{
337
+ "Small": {
338
+ "type":"Personality",
339
+ "descriptions":"Insight into your Interests",
340
+ "reward":"10% Discount"
341
+ },
342
+ "Medium":{
343
+ "type":"Personality",
344
+ "descriptions":"Insight into your Interests",
345
+ "reward":"2 USDC"
346
+ },
347
+ "Large":{
348
+ "type":"Personality",
349
+ "descriptions":"Insight into your Interests",
350
+ "reward":"2 USDC"
351
+ }
352
+ }
353
+ ```
354
+
355
+ ### Legacy API Usage
356
+
357
+ Previously required manual event handling:
358
+
359
+ ```jsx
360
+ export default async function UseAPIURL(event) {
361
+ if (
362
+ event.data &&
363
+ event.data.source === "content-script" &&
364
+ event.data.type === "API_URL_RESPONSE"
365
+ ) {
366
+ const { APIurl, accessToken } = event.data;
367
+ await fetch(APIurl, {
368
+ method: "POST",
369
+ headers: {
370
+ "Content-Type": "application/json",
371
+ Authorization: `Bearer ${accessToken}`,
372
+ },
373
+ body: JSON.stringify(InputData),
374
+ })
375
+ .then(async (data) => {
376
+ // process Onairos Data
377
+ })
378
+ .catch((error) => console.error(error));
379
+ }
380
+ }
381
+ ```
382
+
383
+ _This manual approach is no longer needed with v2.0's autoFetch functionality._
384
+
385
+ ### Legacy Output Format
386
+
387
+ API still responds with the same format:
388
+
389
+ ```json
390
+ {
391
+ "output": [[[0.9998]], [[0.9999]], [[0.9922]], [[0.0013]]]
392
+ }
393
+ ```
394
+
395
+ ### Integration Notes
396
+
397
+ When integrating the onairos package into your application, ensure your Webpack configuration handles dynamic imports correctly and serves the necessary chunk files from `node_modules/onairos/dist`.