@nuralogix.ai/web-measurement-embedded-app 0.1.0-alpha.15 → 0.1.0-alpha.17
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 +123 -85
- package/dist/app.css +20 -18
- package/dist/app.mjs +18 -87
- package/dist/assets/extraction/{extraction_wasm_0.1.0-alpha.28.json → extraction_wasm_0.1.0-alpha.32.json} +1 -1
- package/dist/assets/extraction_worker_0.1.0-alpha.32_js.json +1 -0
- package/dist/assets/facetracker_worker_0.1.0-alpha.32_js.json +1 -0
- package/dist/assets/models/detectorModel_bin.json +1 -0
- package/dist/assets/models/detectorModel_json.json +1 -0
- package/dist/assets/models/landmarkModel_bin.json +1 -0
- package/dist/assets/models/landmarkModel_json.json +1 -0
- package/dist/language/strings.br.json +6 -13
- package/dist/language/strings.cn.json +7 -14
- package/dist/language/strings.de.json +6 -13
- package/dist/language/strings.en.json +12 -29
- package/dist/language/strings.es.json +6 -13
- package/dist/language/strings.fr.json +6 -25
- package/dist/language/strings.it.json +7 -14
- package/dist/language/strings.ja.json +6 -13
- package/dist/language/strings.pt.json +6 -13
- package/dist/stylex.css +0 -8
- package/lib/index.mjs +1 -1
- package/package.json +2 -1
- package/dist/assets/extraction_worker_0.1.0-alpha.28_js.json +0 -1
- package/dist/assets/facetracker_worker_0.1.0-alpha.28_js.json +0 -1
- package/dist/assets/taskVision/model/face_landmarker.task +0 -0
- package/dist/assets/taskVision/wasm/vision_wasm_internal_js.json +0 -1
- package/dist/assets/taskVision/wasm/vision_wasm_internal_wasm.json +0 -1
- package/dist/assets/taskVision/wasm/vision_wasm_nosimd_internal_js.json +0 -1
- package/dist/assets/taskVision/wasm/vision_wasm_nosimd_internal_wasm.json +0 -1
package/README.md
CHANGED
|
@@ -1,101 +1,102 @@
|
|
|
1
1
|
### Web Measurement Embedded App
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Need deeper integration details? Check the full docs at [docs.deepaffex.ai/wmea](https://docs.deepaffex.ai/wmea/).
|
|
4
4
|
|
|
5
5
|
```html
|
|
6
6
|
<!DOCTYPE html>
|
|
7
7
|
<html lang="en">
|
|
8
|
-
<head>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
<head>
|
|
9
|
+
<meta charset="UTF-8" />
|
|
10
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
11
|
+
<title>Measurement Embedded App Demo</title>
|
|
12
12
|
<script type="importmap">
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
13
|
+
{
|
|
14
|
+
"imports": {
|
|
15
|
+
"@nuralogix.ai/web-measurement-embedded-app": "https://unpkg.com/@nuralogix.ai/web-measurement-embedded-app"
|
|
17
16
|
}
|
|
17
|
+
}
|
|
18
18
|
</script>
|
|
19
|
-
</head>
|
|
20
|
-
<body>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
measurementApp.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
<div id="measurement-embedded-app-container"></div>
|
|
22
|
+
<script type="module">
|
|
23
|
+
import MeasurementEmbeddedApp, { faceAttributeValue } from '@nuralogix.ai/web-measurement-embedded-app';
|
|
24
|
+
const {
|
|
25
|
+
SEX_ASSIGNED_MALE_AT_BIRTH,
|
|
26
|
+
SMOKER_FALSE,
|
|
27
|
+
BLOOD_PRESSURE_MEDICATION_FALSE,
|
|
28
|
+
DIABETES_NONE
|
|
29
|
+
} = faceAttributeValue;
|
|
30
|
+
const measurementApp = new MeasurementEmbeddedApp();
|
|
31
|
+
const container = document.getElementById('measurement-embedded-app-container');
|
|
32
|
+
if (container) {
|
|
33
|
+
const apiUrl = '/api';
|
|
34
|
+
const studyId = await fetch(`${apiUrl}/studyId`);
|
|
35
|
+
const studyIdResponse = await studyId.json();
|
|
36
|
+
const token = await fetch(`${apiUrl}/token`);
|
|
37
|
+
const tokenResponse = await token.json();
|
|
38
|
+
if (studyIdResponse.status === '200' && tokenResponse.status === '200') {
|
|
39
|
+
measurementApp.init({
|
|
40
|
+
container,
|
|
41
|
+
appPath: 'https://unpkg.com/@nuralogix.ai/web-measurement-embedded-app/dist',
|
|
42
|
+
settings: {
|
|
43
|
+
token: tokenResponse.token,
|
|
44
|
+
refreshToken: tokenResponse.refreshToken,
|
|
45
|
+
studyId: studyIdResponse.studyId,
|
|
46
|
+
},
|
|
47
|
+
profile: {
|
|
48
|
+
age: 40,
|
|
49
|
+
height: 180,
|
|
50
|
+
weight: 60,
|
|
51
|
+
sex: SEX_ASSIGNED_MALE_AT_BIRTH,
|
|
52
|
+
smoking: SMOKER_FALSE,
|
|
53
|
+
bloodPressureMedication: BLOOD_PRESSURE_MEDICATION_FALSE,
|
|
54
|
+
diabetes: DIABETES_NONE,
|
|
55
|
+
bypassProfile: false,
|
|
56
|
+
},
|
|
57
|
+
// Optional configuration overrides (defaults shown)
|
|
58
|
+
config: {
|
|
59
|
+
checkConstraints: true,
|
|
60
|
+
cameraFacingMode: 'user', // or 'environment' for back camera
|
|
61
|
+
cameraAutoStart: false,
|
|
62
|
+
measurementAutoStart: false,
|
|
63
|
+
}
|
|
64
|
+
// Optional top/language/api overrides
|
|
65
|
+
// top: '100px'
|
|
66
|
+
// language: 'fr'
|
|
67
|
+
apiUrl: 'api.na-east.deepaffex.ai', // optional for region specific data processing
|
|
68
|
+
loadError: function(error) {
|
|
69
|
+
console.error("load error", error);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
measurementApp.on.results = (results) => {
|
|
73
|
+
console.log("Results received", results);
|
|
74
|
+
measurementApp.destroy();
|
|
75
|
+
};
|
|
76
|
+
measurementApp.on.error = (error) => {
|
|
77
|
+
console.log("error received", error);
|
|
78
|
+
};
|
|
79
|
+
measurementApp.on.event = (appEvent) => {
|
|
80
|
+
console.log("App Event received", appEvent);
|
|
81
|
+
};
|
|
82
|
+
} else {
|
|
83
|
+
console.error('Failed to get Study ID and Token pair');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
</script>
|
|
87
|
+
</body>
|
|
86
88
|
</html>
|
|
87
89
|
```
|
|
88
90
|
|
|
89
|
-
**Notes:**
|
|
90
|
-
|
|
91
|
-
- If you are bundling `Web Measurement Embedded App` with your app, set `appPath` to `'.'`.
|
|
92
|
-
|
|
93
|
-
- `language` prop is optional. You can either set it to `en` or `fr`
|
|
94
|
-
- If a supported language is set, the app loads with a supported language.
|
|
95
|
-
- If the language prop is not set, the app checks the browser's language and if it is among
|
|
96
|
-
the list of supported languages, it loads the language pack for the browser's language.
|
|
97
|
-
Otherwise falls back to `en`.
|
|
91
|
+
**Notes:**
|
|
98
92
|
|
|
93
|
+
- Set `appPath` to `'.'` when you bundle the assets yourself.
|
|
94
|
+
- 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.
|
|
95
|
+
- Optional `top` offset lets you push the UI below your own header (default `'0'`).
|
|
96
|
+
- 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.
|
|
97
|
+
- Language support: `en`, `ja`, `cn`, `es`, `pt`, `it`, `fr`, `de`, `br`.
|
|
98
|
+
- Browser locales `zh` and `zh-Hans` automatically fall back to `cn`.
|
|
99
|
+
- `loadError` is called if assets fail to download or the app cannot initialize.
|
|
99
100
|
|
|
100
101
|
**Methods:**
|
|
101
102
|
|
|
@@ -129,3 +130,40 @@ error: ((error: MeasurementEmbeddedAppError) => void) | null;
|
|
|
129
130
|
*/
|
|
130
131
|
event: ((appEvent: AppEvent) => void) | null;
|
|
131
132
|
```
|
|
133
|
+
|
|
134
|
+
**App events dispatched through `measurementApp.on.event`:**
|
|
135
|
+
|
|
136
|
+
- `APP_LOADED` – the embedded app finished its startup sequence.
|
|
137
|
+
- `CAMERA_PERMISSION_GRANTED` – the user granted camera access.
|
|
138
|
+
- `CAMERA_STARTED` – a camera stream opened successfully.
|
|
139
|
+
- `MEASUREMENT_STARTED` – a measurement run begins.
|
|
140
|
+
- `MEASUREMENT_COMPLETED` – the measurement finished and results are stable.
|
|
141
|
+
- `INTERMEDIATE_RESULTS` – partial results are available during an active run.
|
|
142
|
+
- `RESULTS_RECEIVED` – the final measurement results are available.
|
|
143
|
+
- `MEASUREMENT_CANCELED` – the active measurement was canceled (user action or constraint).
|
|
144
|
+
- `CONSTRAINT_VIOLATION` – a constraint (e.g., face distance) failed.
|
|
145
|
+
- `PAGE_VISIBILITY_CHANGE` – the page changed visibility (e.g., tab switch or minimize).
|
|
146
|
+
- `PAGE_UNLOADED` – the page is unloading.
|
|
147
|
+
|
|
148
|
+
**Other runtime helpers:**
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
await measurementApp.cancel(true); // cancel current run
|
|
152
|
+
const logs = await measurementApp.getLogs();
|
|
153
|
+
measurementApp.setTheme('dark');
|
|
154
|
+
measurementApp.setLanguage('es');
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Error codes emitted through `measurementApp.on.error`:**
|
|
158
|
+
|
|
159
|
+
| Code | Meaning |
|
|
160
|
+
| -------------------------- | ----------------------------------------------------------------- |
|
|
161
|
+
| `CAMERA_PERMISSION_DENIED` | Camera access prompt was rejected. |
|
|
162
|
+
| `CAMERA_START_FAILED` | Camera hardware failed to start after permission. |
|
|
163
|
+
| `NO_DEVICES_FOUND` | No video input devices detected during enumeration. |
|
|
164
|
+
| `PAGE_NOT_VISIBLE` | Measurement was running while the tab or window became hidden. |
|
|
165
|
+
| `MEASUREMENT_LOW_SNR` | Signal-to-noise ratio dropped below the acceptable threshold. |
|
|
166
|
+
| `WORKER_ERROR` | SDK worker encountered a fatal processing error. |
|
|
167
|
+
| `PROFILE_INFO_NOT_SET` | Profile bypass stayed enabled, so demographics were not provided. |
|
|
168
|
+
| `COLLECTOR` | Frame collection reported an error |
|
|
169
|
+
| `WEBSOCKET_DISCONNECTED` | Realtime WebSocket connection closed or dropped. |
|
package/dist/app.css
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
2
|
+
|
|
1
3
|
@layer priority1 {
|
|
2
4
|
@keyframes nuraqng64z-B {
|
|
3
5
|
0% {
|
|
@@ -8,8 +10,8 @@
|
|
|
8
10
|
transform: rotate(360deg);
|
|
9
11
|
}
|
|
10
12
|
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
+
}
|
|
14
|
+
|
|
13
15
|
@layer priority2 {
|
|
14
16
|
.nura164fk60 {
|
|
15
17
|
background: initial;
|
|
@@ -82,8 +84,8 @@
|
|
|
82
84
|
.nura6rcfto {
|
|
83
85
|
padding: var(--padding);
|
|
84
86
|
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
+
}
|
|
88
|
+
|
|
87
89
|
@layer priority3 {
|
|
88
90
|
.nura196p5u9 {
|
|
89
91
|
border-bottom: 1px solid #0000;
|
|
@@ -220,8 +222,8 @@
|
|
|
220
222
|
.nura1uvtmcs:focus {
|
|
221
223
|
outline: none;
|
|
222
224
|
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
+
}
|
|
226
|
+
|
|
225
227
|
@layer priority4 {
|
|
226
228
|
.nura1lugfcp {
|
|
227
229
|
-webkit-appearance: none;
|
|
@@ -641,8 +643,8 @@
|
|
|
641
643
|
align-items: end;
|
|
642
644
|
}
|
|
643
645
|
}
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
+
}
|
|
647
|
+
|
|
646
648
|
@layer priority5 {
|
|
647
649
|
.nura1szun9y {
|
|
648
650
|
bottom: 1rem;
|
|
@@ -789,8 +791,8 @@
|
|
|
789
791
|
padding-bottom: 1rem;
|
|
790
792
|
}
|
|
791
793
|
}
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
+
}
|
|
795
|
+
|
|
794
796
|
@layer priority6 {
|
|
795
797
|
.nuratb5x6d:before {
|
|
796
798
|
border-color: var(--1il6zln);
|
|
@@ -827,8 +829,8 @@
|
|
|
827
829
|
.nuradb2nx::-moz-progress-bar {
|
|
828
830
|
transition: var(--1nt0dl9);
|
|
829
831
|
}
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
+
}
|
|
833
|
+
|
|
832
834
|
@layer priority7 {
|
|
833
835
|
.nura18j5lt8:after {
|
|
834
836
|
background-color: var(--15iyedw);
|
|
@@ -881,8 +883,8 @@
|
|
|
881
883
|
.nura7tg5rq:before {
|
|
882
884
|
transform-origin: 100%;
|
|
883
885
|
}
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
+
}
|
|
887
|
+
|
|
886
888
|
@layer priority8 {
|
|
887
889
|
.nura171sez1:before {
|
|
888
890
|
border-bottom-left-radius: var(--ucnkut);
|
|
@@ -927,8 +929,8 @@
|
|
|
927
929
|
.nuragu5zj8:before {
|
|
928
930
|
width: var(--nzppn4);
|
|
929
931
|
}
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
+
}
|
|
933
|
+
|
|
932
934
|
@layer priority1 {
|
|
933
935
|
:host, .nura1lutyi5 {
|
|
934
936
|
--nura137mxtf: blur(0);
|
|
@@ -1207,8 +1209,8 @@
|
|
|
1207
1209
|
--nurant3gmo: 72px;
|
|
1208
1210
|
}
|
|
1209
1211
|
}
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1212
1214
|
@layer priority1 {
|
|
1213
1215
|
:host, .nurazc319s {
|
|
1214
1216
|
--nura15kgmj: #4382fb;
|