@onairosofficial/onairos-capacitor 0.1.1 → 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.
@@ -0,0 +1,57 @@
1
+ # Data Frequency (Scheduling) - Developer Notes
2
+
3
+ This document explains how the new data-sharing frequency selection is sent from the DataRequest page and how to consume it on your backend.
4
+
5
+ ## UI Options
6
+
7
+ - `once` → One-time only
8
+ - `weekly` → Once per week
9
+ - `daily` → Once per day
10
+
11
+ ## SDK Behavior
12
+
13
+ When the user submits the DataRequest:
14
+
15
+ - The selected frequency is included in the SDK result returned to your `onComplete(...)` callback as `dataFrequency`.
16
+ - In production mode, the value is also sent in the request body to the `getAPIurlMobile` endpoint at `Info.dataFrequency`.
17
+
18
+ Example `onComplete` result snippet:
19
+
20
+ ```json
21
+ {
22
+ "appName": "Your App",
23
+ "approvedData": ["basic", "personality"],
24
+ "testMode": false,
25
+ "dataFrequency": "weekly",
26
+ "apiUrl": "https://api2.onairos.uk/getAPIurlMobile",
27
+ "token": "eyJhbGciOiJIUzI1NiIs...",
28
+ "success": true
29
+ }
30
+ ```
31
+
32
+ ## Backend Integration
33
+
34
+ The SDK sends:
35
+
36
+ ```json
37
+ POST https://api2.onairos.uk/getAPIurlMobile
38
+ {
39
+ "Info": {
40
+ "storage": "local",
41
+ "appId": "<APP_NAME>",
42
+ "account": "<USER_EMAIL>",
43
+ "confirmations": [ ... ],
44
+ "EncryptedUserPin": "pending_pin_integration",
45
+ "proofMode": false,
46
+ "Domain": "<host-domain>",
47
+ "web3Type": "standard",
48
+ "dataFrequency": "weekly"
49
+ }
50
+ }
51
+ ```
52
+
53
+ ## Notes
54
+
55
+ - Cron jobs for backend handling?
56
+ - The frequency selection does not grant additional permissions; it’s purely a scheduling preference.
57
+ - Users can update this preference later; your backend should allow reconfiguration.
@@ -0,0 +1,532 @@
1
+ # Onairos SDK API Changes - Developer Guide
2
+
3
+ **Version:** 2026-04-24
4
+ **Status:** Live
5
+
6
+ **Training status URL:** Prefer **`GET https://api2.onairos.uk/training/status`** (Bearer token). Legacy alias **`/mobile-training/status`** is identical. With `environment: 'development'`, the SDK uses **`https://dev-api.onairos.uk`** as the API base; the backend’s `training.statusUrl` in the authorize response is authoritative—always poll that URL if present.
7
+
8
+ ---
9
+
10
+ ## Summary of Changes
11
+
12
+ This document outlines the API response changes and new background training feature for developers integrating with Onairos.
13
+
14
+ ---
15
+
16
+ ## 1. API Response Format Changes
17
+
18
+ ### Authorization Response (getAPIurl / getAPIurlMobile)
19
+
20
+ **OLD Format:**
21
+ ```json
22
+ {
23
+ "apiUrl": "https://api2.onairos.uk/combinedInference",
24
+ "token": "eyJ...",
25
+ "userData": {
26
+ "email": "user@example.com",
27
+ "username": "johndoe",
28
+ "connectedPlatforms": ["linkedin", "youtube"],
29
+ "isReturningUser": true
30
+ }
31
+ }
32
+ ```
33
+
34
+ **NEW Format:**
35
+ ```json
36
+ {
37
+ "apiUrl": "https://api2.onairos.uk/combinedInference",
38
+ "token": "eyJ...",
39
+ "authorizedData": {
40
+ "traits": true,
41
+ "personality": true,
42
+ "rawMemories": false
43
+ },
44
+ "rawMemoriesPolicy": {
45
+ "offered": false,
46
+ "code": "APP_NOT_APPROVED_FOR_RAW_MEMORIES"
47
+ },
48
+ "traitIntent": { },
49
+ "training": {
50
+ "ready": true,
51
+ "statusUrl": "https://api2.onairos.uk/training/status",
52
+ "pollIntervalMs": 5000
53
+ }
54
+ }
55
+ ```
56
+
57
+ ### Key Changes:
58
+
59
+ | Old Field | New Field | Notes |
60
+ |-----------|-----------|-------|
61
+ | `userData.email` | **REMOVED** | Security: No PII exposed |
62
+ | `userData.username` | **REMOVED** | Security: No PII exposed |
63
+ | `userData.connectedPlatforms` | **REMOVED** | Available in traits response |
64
+ | `userData.isReturningUser` | **REMOVED** | Use `training.ready` instead |
65
+ | *(new)* | `authorizedData` | What data types user authorized (`rawMemories` is authoritative for LLM/raw export) |
66
+ | *(new)* | `rawMemoriesPolicy` | UX hint (`offered`, `code`) — SDK hides raw UI when `offered: false` |
67
+ | *(new)* | `traitIntent` | Training/inference intent from handoff (no separate resolve call) |
68
+ | `authorizedData.llmData` | **legacy** | Read only when `rawMemories` is absent during backend transition |
69
+ | *(new)* | `training.ready` | `true` = fetch now, `false` = poll first |
70
+ | *(new)* | `training.statusUrl` | Endpoint to check training progress |
71
+ | *(new)* | `training.pollIntervalMs` | Recommended polling interval |
72
+
73
+ ---
74
+
75
+ ## 2. Traits/Data Response Changes
76
+
77
+ ### Data Response (combinedInference, traitsOnly, etc.)
78
+
79
+ **NEW Format:**
80
+ ```json
81
+ {
82
+ "InferenceResult": { "output": [[0.8, 0.2]] },
83
+ "traits": {
84
+ "positive_traits": { "Curious": 92, "Analytical": 88 },
85
+ "traits_to_improve": { "Patience": 45 },
86
+ "user_summary": "You're a thoughtful technologist...",
87
+ "top_traits_explanation": "Your engagement patterns show...",
88
+ "archetype": "Strategic Thinker",
89
+ "nudges": [
90
+ { "text": "Try journaling a decision you're mulling over" }
91
+ ]
92
+ },
93
+ "userProfile": {
94
+ "user_summary": "You're a thoughtful technologist...",
95
+ "top_traits_explanation": "Your engagement patterns show...",
96
+ "archetype": "Strategic Thinker",
97
+ "nudges": [...]
98
+ },
99
+ "connectedPlatforms": ["linkedin", "youtube"]
100
+ }
101
+ ```
102
+
103
+ ### Key Additions:
104
+
105
+ | Field | Description |
106
+ |-------|-------------|
107
+ | `traits.user_summary` | 2-3 paragraph personality summary |
108
+ | `traits.top_traits_explanation` | Why these traits were identified |
109
+ | `traits.archetype` | 2-3 word personality archetype |
110
+ | `traits.nudges` | Personalized action suggestions |
111
+ | `userProfile` | Convenient access to profile fields |
112
+
113
+ ---
114
+
115
+ ## 3. Background Training Mode
116
+
117
+ ### Overview
118
+
119
+ When a user authorizes your app, their traits may need to be generated (training). You have two options:
120
+
121
+ 1. **Wait Mode** (default): User sees loading screen while training completes
122
+ 2. **Background Mode**: SDK returns immediately, you poll for completion
123
+
124
+ ### Web npm SDK (`backgroundLoadData`)
125
+
126
+ On **`OnairosButton`**, set **`backgroundLoadData={true}`** with **`autoFetch={true}`** so that after connections/PIN/consent the SDK **skips the built-in training loading screen**, navigates to the data-request step, and completes with **`onComplete({ apiUrl, token, training, authorizedData, ... })`** while traits may still be generating. The SDK starts training in the background (socket **`start-training`**) so status polling is meaningful. Your app should:
127
+
128
+ 1. Read **`training.ready`**. If `true`, **`POST apiUrl`** with `Authorization: Bearer <token>`.
129
+ 2. If `false`, call **`pollTrainingStatus`** from **`onairos`** (or your own loop) on **`training.statusUrl`** until ready, then **`POST apiUrl`**.
130
+
131
+ See **`docs/CROSS_SDK_PARITY.md`** and **`docs/ONAIROS_BUTTON_PROPS.md`** for the full matrix with **`autoFetch`**.
132
+
133
+ ### When to Use Background Mode
134
+
135
+ - User experience is time-sensitive
136
+ - You want to show your app UI immediately
137
+ - You'll fetch traits later (e.g., on next screen)
138
+
139
+ ---
140
+
141
+ ## 4. Implementation Guide
142
+
143
+ ### Step 1: Check if Traits Are Ready
144
+
145
+ After authorization, check `training.ready`:
146
+
147
+ ```javascript
148
+ const authResult = await onairosSDK.authorize();
149
+
150
+ if (authResult.training.ready) {
151
+ // Traits exist - fetch immediately
152
+ const userData = await fetchTraits(authResult.apiUrl, authResult.token);
153
+ displayUserData(userData);
154
+ } else {
155
+ // Training in progress - poll for completion
156
+ showLoadingState();
157
+ const userData = await pollForTraits(authResult);
158
+ displayUserData(userData);
159
+ }
160
+ ```
161
+
162
+ ### Step 2: Fetch Traits (When Ready)
163
+
164
+ ```javascript
165
+ async function fetchTraits(apiUrl, token) {
166
+ const response = await fetch(apiUrl, {
167
+ method: 'POST',
168
+ headers: {
169
+ 'Authorization': `Bearer ${token}`,
170
+ 'Content-Type': 'application/json'
171
+ }
172
+ });
173
+
174
+ if (!response.ok) {
175
+ throw new Error(`Failed to fetch traits: ${response.status}`);
176
+ }
177
+
178
+ return await response.json();
179
+ }
180
+ ```
181
+
182
+ ### Step 3: Poll for Training Completion (When Not Ready)
183
+
184
+ Use each response’s **`polling.recommendedIntervalMs`** when present; otherwise fall back to **`training.pollIntervalMs`** from the authorize payload. On **HTTP 429**, honor **`Retry-After`** (header or seconds) and any **`recommendedIntervalMs`** / **`retryAfter`** in the JSON body before retrying.
185
+
186
+ ```javascript
187
+ async function pollForTraits(authResult) {
188
+ const { apiUrl, token, training } = authResult;
189
+ const { statusUrl, pollIntervalMs } = training;
190
+
191
+ const maxWaitMs = 300000; // 5 minutes max
192
+ const startTime = Date.now();
193
+
194
+ while (Date.now() - startTime < maxWaitMs) {
195
+ const res = await fetch(statusUrl, {
196
+ headers: { 'Authorization': `Bearer ${token}` }
197
+ });
198
+
199
+ if (res.status === 429) {
200
+ const errBody = await res.json().catch(() => ({}));
201
+ const retryAfterHeader = res.headers.get('Retry-After');
202
+ const waitSec = retryAfterHeader ? parseInt(retryAfterHeader, 10) : (errBody.retryAfter ?? 5);
203
+ await sleep(Math.max((waitSec || 5) * 1000, errBody.recommendedIntervalMs || 0));
204
+ continue;
205
+ }
206
+
207
+ const status = await res.json();
208
+
209
+ // Update UI with progress (optional)
210
+ if (status.progress) {
211
+ updateProgressBar(status.progress.progressPercent);
212
+ updateETA(`${status.progress.remainingSeconds}s remaining`);
213
+ updateMessage(status.progress.message);
214
+ }
215
+
216
+ // Check if training complete
217
+ if (!status.trainingStatus.isCurrentlyTraining) {
218
+ // Training done! Fetch traits
219
+ return await fetchTraits(apiUrl, token);
220
+ }
221
+
222
+ const waitMs = status.polling?.recommendedIntervalMs ?? pollIntervalMs ?? 5000;
223
+ await sleep(waitMs);
224
+ }
225
+
226
+ throw new Error('Training timeout - please try again');
227
+ }
228
+
229
+ function sleep(ms) {
230
+ return new Promise(resolve => setTimeout(resolve, ms));
231
+ }
232
+ ```
233
+
234
+ ---
235
+
236
+ ## 5. Training Status Response
237
+
238
+ ### Endpoint
239
+
240
+ ```
241
+ GET https://api2.onairos.uk/training/status
242
+ Authorization: Bearer <token>
243
+ ```
244
+
245
+ Legacy path (same behavior): `GET https://api2.onairos.uk/mobile-training/status`
246
+
247
+ ### Response (During Training)
248
+
249
+ ```json
250
+ {
251
+ "success": true,
252
+ "trainingStatus": {
253
+ "isCurrentlyTraining": true,
254
+ "canTrainAgain": false,
255
+ "lastTrainingDate": "2026-03-09T05:30:00Z",
256
+ "minutesSinceLastTraining": 2
257
+ },
258
+ "progress": {
259
+ "progressPercent": 45,
260
+ "elapsedSeconds": 54,
261
+ "estimatedTotalSeconds": 120,
262
+ "remainingSeconds": 66,
263
+ "stage": "processing",
264
+ "message": "Analyzing your data..."
265
+ },
266
+ "polling": {
267
+ "recommendedIntervalMs": 3000,
268
+ "maxPollTimeMs": 300000
269
+ }
270
+ }
271
+ ```
272
+
273
+ ### Response (Training Complete)
274
+
275
+ ```json
276
+ {
277
+ "success": true,
278
+ "trainingStatus": {
279
+ "isCurrentlyTraining": false,
280
+ "canTrainAgain": true,
281
+ "lastTrainingDate": "2026-03-09T05:32:00Z"
282
+ },
283
+ "progress": null,
284
+ "polling": {
285
+ "recommendedIntervalMs": 10000,
286
+ "maxPollTimeMs": 300000
287
+ }
288
+ }
289
+ ```
290
+
291
+ ### Field Reference
292
+
293
+ | Field | Type | Description |
294
+ |-------|------|-------------|
295
+ | `trainingStatus.isCurrentlyTraining` | boolean | `true` = still training, keep polling |
296
+ | `trainingStatus.canTrainAgain` | boolean | Whether user can retrain |
297
+ | `progress.progressPercent` | number | 0-100, completion percentage |
298
+ | `progress.remainingSeconds` | number | Estimated seconds until complete |
299
+ | `progress.message` | string | Human-readable status message |
300
+ | `polling.recommendedIntervalMs` | number | How often to poll (ms) |
301
+
302
+ ---
303
+
304
+ ## 6. Rate Limits
305
+
306
+ | Endpoint | Limit | Response if Exceeded |
307
+ |----------|-------|---------------------|
308
+ | `/training/status` (legacy: `/mobile-training/status`) | 30 requests/minute | `429 Too Many Requests` |
309
+
310
+ If you receive a `429` response:
311
+ ```json
312
+ {
313
+ "success": false,
314
+ "error": "Too many requests. Please slow down polling.",
315
+ "retryAfter": 60,
316
+ "recommendedIntervalMs": 5000
317
+ }
318
+ ```
319
+
320
+ Check the `Retry-After` header and wait before retrying.
321
+
322
+ ---
323
+
324
+ ## 7. Complete Example
325
+
326
+ ### React/JavaScript
327
+
328
+ ```javascript
329
+ import { useState, useEffect } from 'react';
330
+
331
+ function OnairosIntegration() {
332
+ const [userData, setUserData] = useState(null);
333
+ const [loading, setLoading] = useState(false);
334
+ const [progress, setProgress] = useState(null);
335
+ const [error, setError] = useState(null);
336
+
337
+ async function handleAuthorization(authResult) {
338
+ setLoading(true);
339
+ setError(null);
340
+
341
+ try {
342
+ if (authResult.training.ready) {
343
+ // Traits ready - fetch immediately
344
+ const data = await fetchTraits(authResult.apiUrl, authResult.token);
345
+ setUserData(data);
346
+ } else {
347
+ // Training in progress - poll
348
+ const data = await pollForTraits(authResult);
349
+ setUserData(data);
350
+ }
351
+ } catch (err) {
352
+ setError(err.message);
353
+ } finally {
354
+ setLoading(false);
355
+ setProgress(null);
356
+ }
357
+ }
358
+
359
+ async function fetchTraits(apiUrl, token) {
360
+ const response = await fetch(apiUrl, {
361
+ method: 'POST',
362
+ headers: { 'Authorization': `Bearer ${token}` }
363
+ });
364
+ return response.json();
365
+ }
366
+
367
+ async function pollForTraits(authResult) {
368
+ const { apiUrl, token, training } = authResult;
369
+ const maxWait = 300000;
370
+ const start = Date.now();
371
+
372
+ while (Date.now() - start < maxWait) {
373
+ const status = await fetch(training.statusUrl, {
374
+ headers: { 'Authorization': `Bearer ${token}` }
375
+ }).then(r => r.json());
376
+
377
+ // Update progress UI
378
+ if (status.progress) {
379
+ setProgress({
380
+ percent: status.progress.progressPercent,
381
+ message: status.progress.message,
382
+ eta: status.progress.remainingSeconds
383
+ });
384
+ }
385
+
386
+ // Check if done
387
+ if (!status.trainingStatus.isCurrentlyTraining) {
388
+ return await fetchTraits(apiUrl, token);
389
+ }
390
+
391
+ // Wait
392
+ await new Promise(r => setTimeout(r, status.polling.recommendedIntervalMs));
393
+ }
394
+
395
+ throw new Error('Training timeout');
396
+ }
397
+
398
+ return (
399
+ <div>
400
+ {loading && progress && (
401
+ <div className="progress">
402
+ <div className="progress-bar" style={{ width: `${progress.percent}%` }} />
403
+ <p>{progress.message}</p>
404
+ <p>ETA: {progress.eta} seconds</p>
405
+ </div>
406
+ )}
407
+
408
+ {userData && (
409
+ <div className="user-profile">
410
+ <h2>{userData.userProfile.archetype}</h2>
411
+ <p>{userData.userProfile.user_summary}</p>
412
+
413
+ <h3>Your Traits</h3>
414
+ {Object.entries(userData.traits.positive_traits).map(([trait, score]) => (
415
+ <div key={trait}>
416
+ <span>{trait}</span>
417
+ <span>{score}%</span>
418
+ </div>
419
+ ))}
420
+ </div>
421
+ )}
422
+
423
+ {error && <p className="error">{error}</p>}
424
+ </div>
425
+ );
426
+ }
427
+ ```
428
+
429
+ ### Python
430
+
431
+ ```python
432
+ import time
433
+ import requests
434
+
435
+ def get_user_traits(auth_result):
436
+ """
437
+ Get user traits, polling if training is in progress.
438
+ """
439
+ api_url = auth_result['apiUrl']
440
+ token = auth_result['token']
441
+ training = auth_result['training']
442
+
443
+ headers = {'Authorization': f'Bearer {token}'}
444
+
445
+ # If traits ready, fetch immediately
446
+ if training['ready']:
447
+ response = requests.post(api_url, headers=headers)
448
+ return response.json()
449
+
450
+ # Otherwise, poll for training completion
451
+ status_url = training['statusUrl']
452
+ poll_interval = training['pollIntervalMs'] / 1000 # Convert to seconds
453
+ max_wait = 300 # 5 minutes
454
+ start_time = time.time()
455
+
456
+ while time.time() - start_time < max_wait:
457
+ # Check status
458
+ status = requests.get(status_url, headers=headers).json()
459
+
460
+ # Show progress
461
+ if status.get('progress'):
462
+ print(f"Progress: {status['progress']['progressPercent']}%")
463
+ print(f"ETA: {status['progress']['remainingSeconds']}s")
464
+
465
+ # Check if done
466
+ if not status['trainingStatus']['isCurrentlyTraining']:
467
+ response = requests.post(api_url, headers=headers)
468
+ return response.json()
469
+
470
+ # Wait before next poll
471
+ time.sleep(status['polling']['recommendedIntervalMs'] / 1000)
472
+
473
+ raise TimeoutError('Training timeout')
474
+
475
+
476
+ # Usage
477
+ auth_result = onairos_sdk.authorize()
478
+ user_data = get_user_traits(auth_result)
479
+
480
+ print(f"Archetype: {user_data['userProfile']['archetype']}")
481
+ print(f"Summary: {user_data['userProfile']['user_summary']}")
482
+ ```
483
+
484
+ ---
485
+
486
+ ## 8. Migration Checklist
487
+
488
+ If you were using the old API format:
489
+
490
+ - [ ] Remove references to `userData.email` (no longer available)
491
+ - [ ] Remove references to `userData.username` (no longer available)
492
+ - [ ] Update to use `training.ready` instead of `userData.isReturningUser`
493
+ - [ ] Implement polling logic for `training.ready === false`
494
+ - [ ] Update trait parsing to use new `userProfile` structure
495
+ - [ ] Handle rate limiting (429 responses)
496
+
497
+ ---
498
+
499
+ ## 9. FAQ
500
+
501
+ ### Q: Why was email/username removed?
502
+
503
+ **A:** For security and privacy. The user consented to share their traits with your app, not their email address. Use the internal user ID if you need to track users.
504
+
505
+ ### Q: How long does training take?
506
+
507
+ **A:** Typically 60-120 seconds for first-time users. The `progress.estimatedTotalSeconds` field provides a real-time estimate.
508
+
509
+ ### Q: What if training fails?
510
+
511
+ **A:** Check `trainingStatus.canTrainAgain`. If true, the user can re-authorize to retry training.
512
+
513
+ ### Q: Can I skip polling and just wait?
514
+
515
+ **A:** Yes, if your SDK is in "wait mode" (backgroundMode: false), the SDK handles this internally and returns traits directly.
516
+
517
+ ### Q: What's in the `userProfile` object?
518
+
519
+ **A:**
520
+ - `user_summary`: 2-3 paragraph personality description
521
+ - `top_traits_explanation`: Why these traits were identified
522
+ - `archetype`: 2-3 word personality label (e.g., "Strategic Thinker")
523
+ - `nudges`: Personalized suggestions/tips
524
+
525
+ ---
526
+
527
+ ## 10. Support
528
+
529
+ For questions or issues:
530
+ - Email: support@onairos.uk
531
+ - Documentation: https://docs.onairos.uk
532
+ - Status: https://status.onairos.uk
@@ -0,0 +1,82 @@
1
+ # Incident: `ReferenceError: enableTraining is not defined` (web, PIN confirm)
2
+
3
+ **Status:** Fixed in **8.1.10** (removes stale identifier usage; see `CHANGELOG.md`).
4
+ **Build guard:** `scripts/verify-removed-props.cjs` runs after `verify-package-entries` in `npm run build` to block reintroducing `enableTraining` under `src/`.
5
+
6
+ ---
7
+
8
+ ## Symptom
9
+
10
+ In the browser (web bundle `onairos.bundle.js`), after the user taps **Confirm** on the **PIN** screen, the console shows:
11
+
12
+ ```text
13
+ Uncaught (in promise) ReferenceError: enableTraining is not defined
14
+ ```
15
+
16
+ This is a **host-app–independent** SDK error: the identifier is not a missing prop from the integrator; it was **not declared anywhere** in the v8 `OnairosButton` prop list.
17
+
18
+ ---
19
+
20
+ ## Root cause
21
+
22
+ 1. **v8.0.0** removed the public prop `enableTraining` in favor of `trainingScreenMode` (and related props). See `docs/ONAIROS_BUTTON_PROPS.md` and the breaking-change notes in `CHANGELOG.md`.
23
+
24
+ 2. A **later** change added new branches in `src/onairosButton.jsx` that still **referenced** `enableTraining` as if it were a variable in scope. After the prop was removed, that name is a **free identifier** → **ReferenceError** the first time that branch runs.
25
+
26
+ So the failure is not “8.1.9 regressed the API” in isolation; it is **stale code** that referenced a **removed** API, combined with a **rare code path** (see below).
27
+
28
+ ---
29
+
30
+ ## Git history (who, when, purpose)
31
+
32
+ ### Commit that removed the API (intentional breaking change)
33
+
34
+ | Field | Detail |
35
+ |--------|--------|
36
+ | **Hash** | `42a2693` |
37
+ | **Date** | 2026-04-30 20:12 +0400 |
38
+ | **Author / committer** | joyalkenus |
39
+ | **Purpose** | v8.0.0: consolidate training props — remove `enableTraining`; introduce `trainingScreenMode` (`mock` \| `fast` \| `real` \| `none`). |
40
+
41
+ ### Commit that reintroduced the identifier in new logic (accidental)
42
+
43
+ | Field | Detail |
44
+ |--------|--------|
45
+ | **Hash** | `625d270` |
46
+ | **Land date (committer)** | 2026-05-02 (merge/rebase timing; author date on patch may be earlier) |
47
+ | **Author** | joyalkenus |
48
+ | **Committer** | Anushka Jogalekar |
49
+ | **Purpose** | `fix(web): minimal backgroundLoadData handoff flow` — PIN/onboarding handoff, silent training when `trainingScreenMode === 'none'`, `backgroundLoadData` behaviour, etc. |
50
+
51
+ **Important:** `42a2693` is an **ancestor** of `625d270` on `main`. So the handoff work landed **after** `enableTraining` was removed from props; the new branches should have used `trainingScreenMode` / `resolvedTrainingMode` only. The review did not catch the leftover symbol.
52
+
53
+ ---
54
+
55
+ ## Why QA saw this on **8.1.9** / PIN only, not “every” v8 test before
56
+
57
+ Several factors stack; **mobile vs desktop browser is not the primary explanation** (same JS, same bundle logic).
58
+
59
+ 1. **Path-specific:** The bad references lived in flows that run only after **PIN completion** (and similar onboarding-return logic), for **non–special-app** integrations (`webpageName` does not match wrapped / Valentine / Lunar / Ascend shortcuts). Other flows never executed those branches → **no error**.
60
+
61
+ 2. **Same bug may exist across patch versions:** If **8.1.8** and **8.1.9** were built from the same `main` lineage after `625d270`, the **source bug can be identical**. Seeing it only on **8.1.9** often reflects **which scenario was exercised** (fresh signup → PIN → confirm) rather than a unique regression in the patch number.
62
+
63
+ 3. **Session / user state:** Returning users with **`pinCreated` already true** often **never hit** the PIN confirm handler the same way as a **first-time PIN** flow.
64
+
65
+ 4. **Special-app detection:** `getAppFlags()` depends on **`webpageName`** substrings (e.g. wrapped / lunar / valentine / ascend). Those paths **skip** the broken branch earlier → **no ReferenceError** even on PIN.
66
+
67
+ 5. **Coverage gap:** “Tested all of v8” without a **full** pass of **normal web app → create PIN → confirm** can miss this entirely.
68
+
69
+ ---
70
+
71
+ ## Resolution
72
+
73
+ - **Code:** Remove all references to `enableTraining` in `onairosButton.jsx`; express behaviour with `trainingScreenMode` / resolved mode and existing platform-change flags (**8.1.10**).
74
+ - **Prevention:** `scripts/verify-removed-props.cjs` fails the build if `enableTraining` appears under `src/`.
75
+
76
+ ---
77
+
78
+ ## References
79
+
80
+ - `CHANGELOG.md` — **[8.1.10]**
81
+ - `docs/ONAIROS_BUTTON_PROPS.md` — v8 migration off `enableTraining`
82
+ - `scripts/verify-removed-props.cjs` — regression guard