onairos 4.0.21 → 4.0.22

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 (49) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +397 -397
  3. package/dist/10.js +1 -1
  4. package/dist/123.js +1 -1
  5. package/dist/129.js +1 -1
  6. package/dist/18.js +1 -1
  7. package/dist/185.js +1 -1
  8. package/dist/22.js +1 -1
  9. package/dist/225.js +1 -1
  10. package/dist/241.js +1 -1
  11. package/dist/31.js +1 -1
  12. package/dist/336.js +1 -1
  13. package/dist/342.js +1 -1
  14. package/dist/342.js.map +1 -1
  15. package/dist/360.js +1 -1
  16. package/dist/421.js +1 -1
  17. package/dist/433.js +1 -1
  18. package/dist/502.js +1 -1
  19. package/dist/540.js +1 -1
  20. package/dist/540.js.map +1 -1
  21. package/dist/575.js +1 -1
  22. package/dist/592.js +1 -1
  23. package/dist/659.js +1 -1
  24. package/dist/672.js +1 -1
  25. package/dist/672.js.map +1 -1
  26. package/dist/845.js +1 -1
  27. package/dist/911.js +1 -1
  28. package/dist/947.js +1 -1
  29. package/dist/961.js +1 -1
  30. package/dist/961.js.map +1 -1
  31. package/dist/991.js +1 -1
  32. package/dist/999.js +1 -1
  33. package/dist/data_request_iframe.html +11 -11
  34. package/dist/data_request_popup.html +320 -320
  35. package/dist/iframe.bundle.js +1 -1
  36. package/dist/oauth-callback.html +137 -206
  37. package/dist/onairos-laravel.js +1 -1
  38. package/dist/onairos-laravel.js.map +1 -1
  39. package/dist/onairos.bundle.js +1 -1
  40. package/dist/onairos.bundle.js.map +1 -1
  41. package/dist/onairos.esm.js +1 -1
  42. package/dist/onairos.esm.js.map +1 -1
  43. package/dist/src_onairosButton_jsx.js +1 -1
  44. package/dist/static/8c5b220bf6f482881a90.png +1 -1
  45. package/dist/vendors-node_modules_lottie-react_build_index_umd_js-node_modules_lucide-react_dist_esm_icons-20f774.js +1 -1
  46. package/dist/vendors-node_modules_react-dom_index_js.js +1 -1
  47. package/dist/vendors-node_modules_react_index_js.js +1 -1
  48. package/llm.txt +333 -333
  49. package/package.json +171 -167
package/README.md CHANGED
@@ -1,397 +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
-
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`.
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`.