@nuralogix.ai/web-measurement-embedded-app 0.1.0-beta.8 → 1.0.0

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.
package/README.md CHANGED
@@ -47,9 +47,9 @@ Need deeper integration details? Check the full docs at [docs.deepaffex.ai/wmea]
47
47
  const token = await fetch(`${apiUrl}/token`);
48
48
  const tokenResponse = await token.json();
49
49
  if (studyIdResponse.status === '200' && tokenResponse.status === '200') {
50
- measurementApp.on.results = (results) => {
50
+ measurementApp.on.results = async (results) => {
51
51
  console.log('Results received', results);
52
- measurementApp.destroy();
52
+ const isDestroyed = await measurementApp.destroy();
53
53
  };
54
54
  measurementApp.on.error = (error) => {
55
55
  console.log('error received', error);
@@ -66,11 +66,16 @@ Need deeper integration details? Check the full docs at [docs.deepaffex.ai/wmea]
66
66
  token: tokenResponse.token,
67
67
  refreshToken: tokenResponse.refreshToken,
68
68
  studyId: studyIdResponse.studyId,
69
+ // Optional measurement options
70
+ // measurementOptions: {
71
+ // partnerId: 'your-partner-id',
72
+ // userProfileId: 'your-user-profile-id',
73
+ // },
69
74
  },
70
75
  profile: {
71
76
  age: 40,
72
- height: 180,
73
- weight: 60,
77
+ heightCm: 180,
78
+ weightKg: 60,
74
79
  sex: SEX_ASSIGNED_MALE_AT_BIRTH,
75
80
  smoking: SMOKER_FALSE,
76
81
  bloodPressureMedication: BLOOD_PRESSURE_MEDICATION_FALSE,
@@ -84,6 +89,8 @@ Need deeper integration details? Check the full docs at [docs.deepaffex.ai/wmea]
84
89
  cameraAutoStart: false,
85
90
  measurementAutoStart: false,
86
91
  cancelWhenLowSNR: true,
92
+ debugMode: false,
93
+ downloadPayloads: false,
87
94
  },
88
95
  // Optional language/api overrides
89
96
  // language: 'fr'
@@ -106,6 +113,13 @@ Need deeper integration details? Check the full docs at [docs.deepaffex.ai/wmea]
106
113
  - Set `appPath` to `'.'` when you bundle the assets yourself.
107
114
  - Profile handling: when `bypassProfile` remains `true` (default) we skip demographic submission and emit an `ERROR` event with `PROFILE_INFO_NOT_SET`; set it to `false` once you supply real profile data.
108
115
  - Style the container you pass to `init` (e.g., position, top, width).
116
+ - Settings options:
117
+ - `token` (required) – authentication token from DeepAffex API.
118
+ - `refreshToken` (required) – refresh token for token renewal.
119
+ - `studyId` (required) – study identifier for the measurement.
120
+ - `measurementOptions` (optional) – additional options passed to the SDK when starting a measurement:
121
+ - `partnerId` – partner identifier for tracking.
122
+ - `userProfileId` – user profile identifier for tracking. Must be a valid UUID.
109
123
  - Optional `apiUrl` enables region-specific processing; omitted values follow the backend token's region automatically. When set explicitly, frontend calls your URL (processing where that endpoint runs) while results continue to store in the token's region—verify the combination suits your deployment.
110
124
  - Config options:
111
125
  - `checkConstraints` (default: `true`) – enables constraint validation pre-measurement
@@ -113,6 +127,8 @@ Need deeper integration details? Check the full docs at [docs.deepaffex.ai/wmea]
113
127
  - `cameraAutoStart` (default: `false`) – automatically starts the camera once permission is granted.
114
128
  - `measurementAutoStart` (default: `false`) – automatically starts the measurement once constraints are satisfied.
115
129
  - `cancelWhenLowSNR` (default: `true`) – cancels the measurement if signal-to-noise ratio falls below threshold.
130
+ - `debugMode` (default: `false`) – enables verbose logging to the console for debugging purposes.
131
+ - `downloadPayloads` (default: `false`) – when enabled, saves payload and metadata binary files for each chunk sent to DeepAffex Cloud so you can send them to NuraLogix for debugging. A 30-second measurement emits 6 chunks (every 5 seconds), generating 2 files per chunk. Ensure your browser allows multiple file downloads and does not block popups.
116
132
  - Language support: `en`, `ja`, `zh`, `es`, `pt`, `pt-BR`, `it`, `fr`, `de`.
117
133
  - Unsupported browser locales fall back to base language (e.g., `zh-TW` → `zh`), then to English.
118
134
 
@@ -154,14 +170,15 @@ event: ((appEvent: AppEvent) => void) | null;
154
170
  - `APP_LOADED` – the embedded app finished its startup sequence.
155
171
  - `MEASUREMENT_PREPARED` - Measurement has been prepared
156
172
  - `ASSETS_DOWNLOADED` - Assets have been downloaded
173
+ - `FACE_TRACKER_LOADED` - Face tracker is loaded. Payload: `{ version }` with SDK version info (`webSDK`, `extractionLib`, `faceTracker`).
157
174
  - `CAMERA_PERMISSION_GRANTED` – the user granted camera access.
158
175
  - `CAMERA_STARTED` – a camera stream opened successfully.
159
- - `MEASUREMENT_STARTED` – a measurement run begins.
176
+ - `MEASUREMENT_STARTED` – a measurement run begins. Payload: `{ measurementId, measurementOptions }` with the measurement ID and measurement options (empty object `{}` if none provided).
160
177
  - `MEASUREMENT_COMPLETED` – the measurement finished and results are stable.
161
- - `INTERMEDIATE_RESULTS` – partial results are available during an active run.
178
+ - `INTERMEDIATE_RESULTS` – partial results are available during an active run. Payload: `{ points }` with intermediate values.
162
179
  - `RESULTS_RECEIVED` – the final measurement results are available.
163
180
  - `MEASUREMENT_CANCELED` – the user canceled the active measurement.
164
- - `CONSTRAINT_VIOLATION` – a constraint (e.g., face distance) failed.
181
+ - `CONSTRAINT_VIOLATION` – a constraint (e.g., face distance) failed. Payload: `{ code }` with one of: `TOO_CLOSE`, `TOO_FAR`, `TURN_LEFT`, `TURN_RIGHT`, `LOOK_UP`, `LOOK_DOWN`, `TILT_LEFT`, `TILT_RIGHT`, `NOT_CENTERED`, `HOLD_STILL`.
165
182
  - `PAGE_VISIBILITY_CHANGE` – the page changed visibility (e.g., tab switch or minimize).
166
183
  - `PAGE_UNLOADED` – the page is unloading.
167
184
 
@@ -176,15 +193,20 @@ measurementApp.setLanguage('es');
176
193
 
177
194
  **Error codes emitted through `measurementApp.on.error`:**
178
195
 
179
- | Code | Meaning |
180
- | ---------------------------- | ----------------------------------------------------------------- |
181
- | `CAMERA_PERMISSION_DENIED` | Camera access prompt was rejected. |
182
- | `CAMERA_START_FAILED` | Camera hardware failed to start after permission. |
183
- | `NO_DEVICES_FOUND` | No video input devices detected during enumeration. |
184
- | `PAGE_NOT_VISIBLE` | Measurement was running while the tab or window became hidden. |
185
- | `MEASUREMENT_LOW_SNR` | Signal-to-noise ratio dropped below the acceptable threshold. |
186
- | `WORKER_ERROR` | SDK worker encountered a fatal processing error. |
187
- | `PROFILE_INFO_NOT_SET` | Profile bypass stayed enabled, so demographics were not provided. |
188
- | `COLLECTOR` | Frame collection reported an error |
189
- | `WEBSOCKET_DISCONNECTED` | Realtime WebSocket connection closed or dropped. |
190
- | `MEASUREMENT_PREPARE_FAILED` | Measurement preparation failed - invalid or missing credentials |
196
+ | Code | Meaning |
197
+ | ----------------------------- | --------------------------------------------------------------------- |
198
+ | `CAMERA_PERMISSION_DENIED` | Camera access prompt was rejected. |
199
+ | `CAMERA_START_FAILED` | Camera hardware failed to start after permission. |
200
+ | `NO_DEVICES_FOUND` | No video input devices detected during enumeration. |
201
+ | `PAGE_NOT_VISIBLE` | Measurement was running while the tab or window became hidden. |
202
+ | `MEASUREMENT_LOW_SNR` | Signal-to-noise ratio dropped below the acceptable threshold. |
203
+ | `WORKER_ERROR` | SDK worker encountered a fatal processing error. |
204
+ | `PROFILE_INFO_NOT_SET` | Profile bypass stayed enabled, so demographics were not provided. |
205
+ | `INVALID_PROFILE` | Profile is invalid |
206
+ | `COLLECTOR` | Frame collection reported an error |
207
+ | `FACE_NONE` | Face not detected during measurement (after threshold frames). |
208
+ | `WEBSOCKET_DISCONNECTED` | Realtime WebSocket connection closed or dropped. |
209
+ | `MEASUREMENT_PREPARE_FAILED` | Measurement preparation failed - invalid or missing credentials |
210
+ | `INVALID_MEASUREMENT_OPTIONS` | Invalid measurement options (e.g., userProfileId is not a valid UUID) |
211
+ | `ASSET_DOWNLOAD_FAILED` | Failed to download assets and initialize the SDK |
212
+