@nuralogix.ai/web-measurement-embedded-app 0.1.0-alpha.5 → 0.1.0-alpha.7

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.
@@ -1,24 +1,42 @@
1
1
  {
2
- "BTN_START_MEASUREMENT": "Démarrer la mesure",
2
+ "CAMERA_START_ERROR": "Impossible de démarrer la caméra. Veuillez vous assurer que la caméra est connectée et qu’elle n’est pas utilisée par une autre application.",
3
3
  "CANCEL": "Annuler",
4
- "ERR_FACE_NONE": "Veuillez garder votre visage centré dans le contour pendant toute la mesure",
4
+ "CENTER_YOUR_FACE": "Centrez votre visage",
5
5
  "ERROR_TAB_SWITCHED_OR_WINDOW_MINIMIZED": "La mesure a échoué car l’onglet a été changé ou la fenêtre du navigateur a été minimisée. Veuillez vous assurer que l’onglet reste ouvert et actif.",
6
- "KIOSK_HELP_CAMERA": "Veuillez faire face à l'appareil photo et positionner votre visage dans le cercle pendant toute la durée de la mesure.",
7
- "KIOSK_HELP_ACCESSORIES": "Veuillez retirer tous les accessoires de votre visage avant la mesure, par exemple des lunettes, un chapeau ou le maquillage.",
8
- "KIOSK_HELP_STAY": "Lorsque la mesure a commencé, gardez la même position pendant 30 secondes, jusqu'à la fin de l'opération.",
6
+ "ERR_FACE_NONE": "Veuillez garder votre visage centré dans le contour pendant toute la mesure",
7
+ "ERR_LOADING_CONFIGURATIONS": "Vous ne pouvez pas accéder à ce service en raison d'une erreur de chargement de la configuration. Veuillez contacter votre administrateur système pour obtenir de l'aide.",
8
+ "ERR_MSG_SNR": "Le mesure du flux sanguin n'est pas fiable.\nVeuillez rester immobile et ajuster l'éclairage afin que la lumière soit uniformément répartie sur votre visage",
9
+ "ERR_TAB_SWITCHED_OR_WINDOW_MINIMIZED": "La mesure a échoué car l’onglet a été changé ou la fenêtre du navigateur a été minimisée. Veuillez vous assurer que l’onglet reste ouvert et actif.",
10
+ "FACE_NOT_DETECTED": "Visage non détecté",
11
+ "HELP_ACCESSORIES": "Veuillez retirer tous les accessoires de votre visage avant la mesure, par exemple des lunettes, un chapeau ou le maquillage.",
12
+ "HELP_CAMERA": "Veuillez faire face à l'appareil photo et positionner votre visage dans le cercle pendant toute la durée de la mesure.",
13
+ "HELP_STAY": "Lorsque la mesure a commencé, gardez la même position pendant 30 secondes, jusqu'à la fin de l'opération.",
9
14
  "HELP_TITLE": "Aide",
15
+ "LOOK_DOWN": "Baissez les yeux",
16
+ "LOOK_UP": "Levez les yeux",
17
+ "MEASURE_INSTRUCTIONS_NO_FACE": "Veuillez centrer votre visage dans le cercle",
18
+ "MOVE_BACK": "Reculez",
19
+ "MOVE_CLOSER": "Rapprochez-vous",
10
20
  "NO_DEVICES_FOUND": "Aucun appareil détecté",
21
+ "PLEASE_HOLD_STILL": "Veuillez rester immobile",
22
+ "PLEASE_WAIT": "Veuillez patienter, la mesure va bientôt commencer…",
23
+ "READY_TO_MEASURE": "Prêt à mesurer",
24
+ "SELECT_CAMERA": "Sélectionner une caméra pour commencer",
25
+ "START_CAMERA": "Démarrer la caméra",
26
+ "START_MEASUREMENT": "Démarrer la mesure",
11
27
  "STOP_CAMERA": "Arrêter la caméra",
28
+ "TILT_YOUR_FACE_LEFT": "Inclinez votre visage vers la gauche",
29
+ "TILT_YOUR_FACE_RIGHT": "Inclinez votre visage vers la droite",
30
+ "TURN_LEFT": "Tournez la tête à gauche",
31
+ "TURN_RIGHT": "Tournez la tête à droite",
32
+ "WAITING_FOR_RESULTS": "Dans l’attente des résultats",
33
+ "WARNING_CONSTRAINT_DISTANCE": "Votre visage est trop éloigné. Essayez de vous rapprocher de la caméra",
34
+ "WARNING_CONSTRAINT_GAZE": "Veuillez regarder directement l'appareil photo",
35
+ "WARNING_FACE_NOT_DETECTED": "Visage non détecté. Centrez votre visage dans le cadre avant de commencer.",
12
36
  "WEB_BTN_SELECT_CAMERA": "Sélectionner une caméra pour commencer",
13
37
  "WEB_BTN_START_CAMERA": "Démarrer la caméra",
14
- "WEB_CAMERA_START_ERROR": "Impossible de démarrer la caméra. Veuillez vous assurer que la caméra est connectée et qu’elle n’est pas utilisée par une autre application.",
15
38
  "WEB_CAMERA_PERMISSION_REQUIRED_TITLE": "Autorisation requise pour utiliser la caméra",
16
- "WEB_PLEASE_WAIT": "Veuillez patienter, la mesure va bientôt commencer…",
39
+ "WEB_CAMERA_START_ERROR": "Impossible de démarrer la caméra. Veuillez vous assurer que la caméra est connectée et qu’elle n’est pas utilisée par une autre application.",
17
40
  "WEB_MEASURE_INSTRUCTIONS_NO_FACE": "Veuillez centrer votre visage dans le cercle",
18
- "WARNING_CONSTRAINT_GAZE": "Veuillez regarder directement l'appareil photo",
19
- "WARNING_CONSTRAINT_DISTANCE": "Votre visage est trop éloigné. Essayez de vous rapprocher de la caméra",
20
- "PLEASE_HOLD_STILL": "Veuillez rester immobile",
21
- "WAITING_FOR_RESULTS": "Dans l’attente des résultats",
22
- "ERR_LOADING_CONFIGURATIONS": "Vous ne pouvez pas accéder à ce service en raison d'une erreur de chargement de la configuration. Veuillez contacter votre administrateur système pour obtenir de l'aide.",
23
- "ERR_MSG_SNR": "Le mesure du flux sanguin n'est pas fiable.\nVeuillez rester immobile et ajuster l'éclairage afin que la lumière soit uniformément répartie sur votre visage"
24
- }
41
+ "WEB_PLEASE_WAIT": "Veuillez patienter, la mesure va bientôt commencer…"
42
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "CAMERA_START_ERROR": "Impossibile avviare la fotocamera, assicurati che sia correttamente collegata e che non la stia utilizzando nessun'altra applicazione.",
3
+ "CENTER_YOUR_FACE": "Centra il viso",
4
+ "FACE_NOT_DETECTED": "Volto non rilevato",
5
+ "HELP_ACCESSORIES": "Prima della misurazione togliere tutti gli accessori come occhiali e cappelli, compresi i prodotti di make up dal viso.",
6
+ "HELP_CAMERA": "Posizionarsi davanti alla fotocamera con il viso all'interno del cerchio per tutta la durata della misurazione.",
7
+ "HELP_STAY": "Iniziata la misurazione, rimanere in posizione per 30 secondi fino al completamento della misurazione.",
8
+ "HELP_TITLE": "Guida",
9
+ "LOOK_DOWN": "Guarda in basso",
10
+ "LOOK_UP": "Guarda in alto",
11
+ "MEASURE_INSTRUCTION1": "Sei pregato di rimanere immobile",
12
+ "MEASURE_INSTRUCTION2": "Pronto per iniziare la misurazione",
13
+ "MEASURE_INSTRUCTIONS_NO_FACE": "Centra il tuo volto nel cerchio",
14
+ "MOVE_BACK": "Fai un passo indietro",
15
+ "MOVE_CLOSER": "Avvicinati",
16
+ "PLEASE_WAIT": "Per favore, aspetta, la misurazione inizierà presto…",
17
+ "SELECT_CAMERA": "Selezionare una fotocamera per iniziare",
18
+ "START_CAMERA": "Avviare Fotocamera",
19
+ "START_MEASUREMENT": "Inizia la misurazione",
20
+ "TILT_YOUR_FACE_LEFT": "Inclina il viso a sinistra",
21
+ "TILT_YOUR_FACE_RIGHT": "Inclina il viso a destra",
22
+ "TURN_LEFT": "Gira a sinistra",
23
+ "TURN_RIGHT": "Gira a destra",
24
+ "WAITING_FOR_RESULTS": "In attesa dei risultati",
25
+ "WARNING_CONSTRAINT_DISTANCE": "Il tuo volto è troppo lontano\nPer favore avvicinati alla fotocamera",
26
+ "WARNING_CONSTRAINT_GAZE": "Per favore guarda direttamente in camera",
27
+ "WARNING_FACE_NOT_DETECTED": "Volto non rilevato. Centra il tuo volto nell'inquadratura prima di iniziare."
28
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "CAMERA_START_ERROR": "カメラを起動できません。カメラが接続されており、別のアプリケーションによって使用中でないことを確認してください。",
3
+ "CENTER_YOUR_FACE": "顔を中央に合わせてください",
4
+ "FACE_NOT_DETECTED": "顔が検出されません",
5
+ "HELP_ACCESSORIES": "メガネや帽子などのアクセサリを外し、お顔の化粧を落としてから測定してください。",
6
+ "HELP_CAMERA": "カメラに顔を向け、測定中は顔が円の中に収まるように位置を合わせてください。",
7
+ "HELP_STAY": "測定が開始したら、測定が完了するまで30秒間は動かないでください。",
8
+ "HELP_TITLE": "ヘルプ",
9
+ "LOOK_DOWN": "下を見てください",
10
+ "LOOK_UP": "上を見てください",
11
+ "MEASURE_INSTRUCTION1": "身体を動かさないでください",
12
+ "MEASURE_INSTRUCTION2": "測定準備完了",
13
+ "MEASURE_INSTRUCTIONS_NO_FACE": "顔の位置を円の中心に合わせてください",
14
+ "MOVE_BACK": "後ろに下がってください",
15
+ "MOVE_CLOSER": "もう少し近づいてください",
16
+ "PLEASE_WAIT": "お待ちください、測定がまもなく開始されます…",
17
+ "SELECT_CAMERA": "カメラを選択して開始",
18
+ "START_CAMERA": "カメラを起動",
19
+ "START_MEASUREMENT": "測定を開始する",
20
+ "TILT_YOUR_FACE_LEFT": "顔を左に傾けてください",
21
+ "TILT_YOUR_FACE_RIGHT": "顔を右に傾けてください",
22
+ "TURN_LEFT": "左を向いてください",
23
+ "TURN_RIGHT": "右を向いてください",
24
+ "WAITING_FOR_RESULTS": "結果が出るまで待機しています",
25
+ "WARNING_CONSTRAINT_DISTANCE": "顔が離れすぎています\nカメラにもっと近付いてみてください",
26
+ "WARNING_CONSTRAINT_GAZE": "カメラの方を真っ直ぐ見てください",
27
+ "WARNING_FACE_NOT_DETECTED": "顔が検出されません。開始前にフレーム内で顔を中央に配置してください。"
28
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "CAMERA_START_ERROR": "Não é possível iniciar a câmara, certifique-se de que a câmara está ligada e não está a ser utilizada por outra aplicação.",
3
+ "CENTER_YOUR_FACE": "Centre o seu rosto",
4
+ "FACE_NOT_DETECTED": "Rosto não detectado",
5
+ "HELP_ACCESSORIES": "Remova todos os acessórios, tais como óculos e chapéus, incluindo todos os produtos de maquilhagem do seu rosto, antes de medir.",
6
+ "HELP_CAMERA": "Olhe para a câmara e posicione o seu rosto dentro do círculo durante a medição.",
7
+ "HELP_STAY": "Assim que a medição começar, mantenha a sua posição durante 30 segundos até que a medição seja concluída.",
8
+ "HELP_TITLE": "Ajuda",
9
+ "LOOK_DOWN": "Olhe para baixo",
10
+ "LOOK_UP": "Olhe para cima",
11
+ "MEASURE_INSTRUCTION1": "Não se mexa",
12
+ "MEASURE_INSTRUCTION2": "Pronto para realizar a medição",
13
+ "MEASURE_INSTRUCTIONS_NO_FACE": "Centre a sua cara no círculo",
14
+ "MOVE_BACK": "Afaste-se",
15
+ "MOVE_CLOSER": "Aproxime-se",
16
+ "PLEASE_WAIT": "Por favor, espere, a medição começará em breve…",
17
+ "SELECT_CAMERA": "Selecionar câmara para começar",
18
+ "START_CAMERA": "Iniciar câmara",
19
+ "START_MEASUREMENT": "Iniciar medição",
20
+ "TILT_YOUR_FACE_LEFT": "Incline o rosto para a esquerda",
21
+ "TILT_YOUR_FACE_RIGHT": "Incline o rosto para a direita",
22
+ "TURN_LEFT": "Vire à esquerda",
23
+ "TURN_RIGHT": "Vire à direita",
24
+ "WAITING_FOR_RESULTS": "À espera de resultados",
25
+ "WARNING_CONSTRAINT_DISTANCE": "O seu rosto está demasiado longe\nTente aproximar-se da câmara",
26
+ "WARNING_CONSTRAINT_GAZE": "Olhe diretamente para a câmara",
27
+ "WARNING_FACE_NOT_DETECTED": "Rosto não detectado. Centre o seu rosto na moldura antes de começar."
28
+ }
package/dist/stylex.css CHANGED
@@ -1,4 +1,12 @@
1
1
  @layer priority1 {
2
+ .border-x7vd2ds {
3
+ border: 1px solid #dee2e6;
4
+ }
5
+
6
+ .border-x1gs6z28 {
7
+ border: none;
8
+ }
9
+
2
10
  .margin-x1rz42sk {
3
11
  margin: .5rem auto;
4
12
  }
@@ -18,9 +26,25 @@
18
26
  .padding-x7gbtqy {
19
27
  padding: .5rem;
20
28
  }
29
+
30
+ .padding-xc7ga6q {
31
+ padding: 12px;
32
+ }
33
+
34
+ .padding-x1qhigcl {
35
+ padding: 20px;
36
+ }
37
+
38
+ .padding-x1ff1495 {
39
+ padding: 8px 16px;
40
+ }
21
41
  }
22
42
 
23
43
  @layer priority2 {
44
+ .borderRadius-x12oqio5 {
45
+ border-radius: 4px;
46
+ }
47
+
24
48
  .gap-x13z6uf9 {
25
49
  gap: .5rem;
26
50
  }
@@ -29,6 +53,10 @@
29
53
  margin-inline: auto;
30
54
  }
31
55
 
56
+ .overflow-xysyzu8 {
57
+ overflow: auto;
58
+ }
59
+
32
60
  .overflow-xb3r6kr {
33
61
  overflow: hidden;
34
62
  }
@@ -39,6 +67,14 @@
39
67
  align-items: center;
40
68
  }
41
69
 
70
+ .backgroundColor-x1lh7yn1 {
71
+ background-color: #007bff;
72
+ }
73
+
74
+ .backgroundColor-xmiktxe {
75
+ background-color: #f8f9fa;
76
+ }
77
+
42
78
  .backgroundColor-x12peec7 {
43
79
  background-color: #fff;
44
80
  }
@@ -47,10 +83,26 @@
47
83
  box-sizing: border-box;
48
84
  }
49
85
 
86
+ .color-x36lisw {
87
+ color: #6c757d;
88
+ }
89
+
90
+ .color-x10bj97 {
91
+ color: #dc3545;
92
+ }
93
+
94
+ .color-x1awj2ng {
95
+ color: #fff;
96
+ }
97
+
50
98
  .containerType-xpqogu8 {
51
99
  container-type: size;
52
100
  }
53
101
 
102
+ .cursor-x1ypdohk {
103
+ cursor: pointer;
104
+ }
105
+
54
106
  .display-x78zum5 {
55
107
  display: flex;
56
108
  }
@@ -63,12 +115,28 @@
63
115
  flex-grow: 1;
64
116
  }
65
117
 
118
+ .fontFamily-x6n8kwa {
119
+ font-family: system-ui, -apple-system, sans-serif;
120
+ }
121
+
122
+ .fontSize-xfifm61 {
123
+ font-size: 12px;
124
+ }
125
+
126
+ .fontSize-xif65rj {
127
+ font-size: 14px;
128
+ }
129
+
66
130
  .justifyContent-xl56j7k {
67
131
  justify-content: center;
68
132
  }
69
133
 
70
- .justifyContent-x1qughib {
71
- justify-content: space-between;
134
+ .justifyContent-x1nhvcw1 {
135
+ justify-content: flex-start;
136
+ }
137
+
138
+ .position-x10l6tqk {
139
+ position: absolute;
72
140
  }
73
141
 
74
142
  .position-x1n2onr6 {
@@ -79,6 +147,14 @@
79
147
  text-align: center;
80
148
  }
81
149
 
150
+ .textAlign-xdpxx8g {
151
+ text-align: left;
152
+ }
153
+
154
+ .transform-xuuh30 {
155
+ transform: translateX(-50%);
156
+ }
157
+
82
158
  .visibility-xlshs6z {
83
159
  visibility: hidden;
84
160
  }
@@ -89,14 +165,46 @@
89
165
  height: 100%;
90
166
  }
91
167
 
168
+ .left-x1nrll8i {
169
+ left: 50%;
170
+ }
171
+
172
+ .marginBottom-x1yztbdb {
173
+ margin-bottom: 16px;
174
+ }
175
+
176
+ .marginBottom-x1hq5gj4 {
177
+ margin-bottom: 24px;
178
+ }
179
+
180
+ .marginBottom-x1e56ztr {
181
+ margin-bottom: 8px;
182
+ }
183
+
92
184
  .marginTop-x1mjqqkp {
93
185
  margin-top: .5rem;
94
186
  }
95
187
 
188
+ .marginTop-xqui205 {
189
+ margin-top: 24px;
190
+ }
191
+
96
192
  .marginTop-x1hpjnmm {
97
193
  margin-top: 3rem;
98
194
  }
99
195
 
196
+ .maxWidth-x1j9u4d2 {
197
+ max-width: 400px;
198
+ }
199
+
200
+ .maxWidth-xrlsmeg {
201
+ max-width: 600px;
202
+ }
203
+
204
+ .minHeight-xg6iff7 {
205
+ min-height: 100vh;
206
+ }
207
+
100
208
  .minHeight-xe8gcm {
101
209
  min-height: 3rem;
102
210
  }
package/lib/index.d.ts CHANGED
@@ -826,14 +826,20 @@ declare const DFX_POINTS: {
826
826
  };
827
827
  type DfxPointId = keyof typeof DFX_POINTS;
828
828
  interface Demographics {
829
+ /** age: 13-120 years */
829
830
  age: number;
831
+ /** height: 120-220 cm */
830
832
  height: number;
833
+ /** weight: 30-300 kg */
831
834
  weight: number;
835
+ /** sex: 0 (not provided), 2 (male), 3 (female) */
832
836
  sex: number;
837
+ /** smoking: 1 (non-smoker), 0 (smoker) */
833
838
  smoking: number;
839
+ /** bloodPressureMedication: 0 (not on medication), 1 (on medication) */
834
840
  bloodPressureMedication: number;
841
+ /** diabetes: 4 (none), 5 (type 1), 6 (type 2) */
835
842
  diabetes: number;
836
- unit: 'Metric' | 'Imperial';
837
843
  }
838
844
  interface ResultsError {
839
845
  code: RealtimeResultErrors | 'OK';
@@ -843,6 +849,18 @@ interface ResultsError {
843
849
  };
844
850
  };
845
851
  }
852
+ /**
853
+ * "metadata" |
854
+ * "physical" |
855
+ * "generalRisks" |
856
+ * "vitals" |
857
+ * "physiological" |
858
+ * "metabolicRisks" |
859
+ * "bloodBiomarkers" |
860
+ * "overall" |
861
+ * "mental" |
862
+ * "surveys"
863
+ */
846
864
  type PointGroupType = typeof pointGroup[keyof typeof pointGroup];
847
865
  type BandColors = ('YELLOW' | 'LIGHT_GREEN' | 'GREEN' | 'LIGHT_RED' | 'RED')[];
848
866
  interface IMeta {
@@ -900,27 +918,39 @@ declare const measurementEmbeddedAppEvents: {
900
918
  readonly RESULTS: "results";
901
919
  readonly ERROR: "error";
902
920
  readonly WEBHOOK: "webhook";
903
- readonly CANCEL: "cancel";
904
921
  };
905
922
  interface AppSettings {
906
923
  token: string;
907
924
  refreshToken: string;
908
925
  studyId: string;
909
926
  }
910
- type SupportedLanguage = 'en' | 'fr';
927
+ type SupportedLanguage = 'en' | 'ja' | 'cn' | 'es' | 'pt' | 'it' | 'fr' | 'de' | 'br';
928
+ interface Config {
929
+ checkConstraints?: boolean;
930
+ cameraFacingMode?: 'user' | 'environment';
931
+ cameraAutoStart?: boolean;
932
+ measurementAutoStart?: boolean;
933
+ }
934
+ interface Profile extends Demographics {
935
+ bypassProfile: boolean;
936
+ }
911
937
  interface MeasurementEmbeddedAppOptions {
912
938
  container: HTMLDivElement;
913
939
  top?: string;
914
940
  appPath: string;
915
941
  settings: AppSettings;
916
- profile?: Demographics;
942
+ profile: Profile;
917
943
  language?: SupportedLanguage;
944
+ config?: Config;
945
+ apiUrl?: string;
918
946
  loadError?: (error: string) => void;
919
947
  }
920
948
  interface MeasurementEmbedded {
921
949
  init(options: MeasurementEmbeddedAppOptions): void;
922
950
  destroy(): void;
951
+ cancel(): void;
923
952
  setTheme(theme: 'light' | 'dark'): void;
953
+ setLanguage(language: SupportedLanguage): void;
924
954
  on: {
925
955
  /**
926
956
  * when measurement results are received
@@ -937,14 +967,11 @@ interface MeasurementEmbedded {
937
967
  * @param {webhook} WebhookEvent - webhook event
938
968
  */
939
969
  webhook: ((webhook: WebhookEvent) => void) | null;
940
- /**
941
- * when measurement is cancelled
942
- */
943
- cancel: (() => void) | null;
944
970
  };
945
971
  }
946
972
  interface MeasurementEmbeddedAppError {
947
- error: keyof typeof measurementError;
973
+ code: ErrorCodes;
974
+ message: string;
948
975
  }
949
976
  declare const webhookEventSeverity: {
950
977
  readonly INFO: "INFO";
@@ -953,14 +980,87 @@ declare const webhookEventSeverity: {
953
980
  };
954
981
  declare const webhookEvent: {
955
982
  readonly CAMERA_STARTED: "CAMERA_STARTED";
983
+ readonly APP_LOADED: "APP_LOADED";
984
+ readonly MEASUREMENT_STARTED: "MEASUREMENT_STARTED";
985
+ readonly MEASUREMENT_COMPLETED: "MEASUREMENT_COMPLETED";
986
+ readonly CAMERA_PERMISSION_DENIED: "CAMERA_PERMISSION_DENIED";
987
+ readonly CAMERA_PERMISSION_GRANTED: "CAMERA_PERMISSION_GRANTED";
988
+ readonly INTERMEDIATE_RESULTS: "INTERMEDIATE_RESULTS";
989
+ readonly RESULTS_RECEIVED: "RESULTS_RECEIVED";
990
+ readonly MEASUREMENT_CANCELED: "MEASUREMENT_CANCELED";
991
+ readonly CONSTRAINT_VIOLATION: "CONSTRAINT_VIOLATION";
992
+ readonly PAGE_UNLOADED: "PAGE_UNLOADED";
993
+ readonly WEBSOCKET_DISCONNECTED: "WEBSOCKET_DISCONNECTED";
994
+ readonly PAGE_VISIBILITY_CHANGE: "PAGE_VISIBILITY_CHANGE";
995
+ };
996
+ declare const webhookEvents: {
997
+ readonly CAMERA_STARTED: {
998
+ readonly event: "CAMERA_STARTED";
999
+ readonly level: "INFO";
1000
+ };
1001
+ readonly APP_LOADED: {
1002
+ readonly event: "APP_LOADED";
1003
+ readonly level: "INFO";
1004
+ };
1005
+ readonly MEASUREMENT_STARTED: {
1006
+ readonly event: "MEASUREMENT_STARTED";
1007
+ readonly level: "INFO";
1008
+ };
1009
+ readonly MEASUREMENT_COMPLETED: {
1010
+ readonly event: "MEASUREMENT_COMPLETED";
1011
+ readonly level: "INFO";
1012
+ };
1013
+ readonly CAMERA_PERMISSION_DENIED: {
1014
+ readonly event: "CAMERA_PERMISSION_DENIED";
1015
+ readonly level: "ERROR";
1016
+ };
1017
+ readonly CAMERA_PERMISSION_GRANTED: {
1018
+ readonly event: "CAMERA_PERMISSION_GRANTED";
1019
+ readonly level: "INFO";
1020
+ };
1021
+ readonly INTERMEDIATE_RESULTS: {
1022
+ readonly event: "INTERMEDIATE_RESULTS";
1023
+ readonly level: "INFO";
1024
+ };
1025
+ readonly RESULTS_RECEIVED: {
1026
+ readonly event: "RESULTS_RECEIVED";
1027
+ readonly level: "INFO";
1028
+ };
1029
+ readonly MEASUREMENT_CANCELED: {
1030
+ readonly event: "MEASUREMENT_CANCELED";
1031
+ readonly level: "WARN";
1032
+ };
1033
+ readonly CONSTRAINT_VIOLATION: {
1034
+ readonly event: "CONSTRAINT_VIOLATION";
1035
+ readonly level: "ERROR";
1036
+ };
1037
+ readonly PAGE_UNLOADED: {
1038
+ readonly event: "PAGE_UNLOADED";
1039
+ readonly level: "INFO";
1040
+ };
1041
+ readonly WEBSOCKET_DISCONNECTED: {
1042
+ readonly event: "WEBSOCKET_DISCONNECTED";
1043
+ readonly level: "WARN";
1044
+ };
1045
+ readonly PAGE_VISIBILITY_CHANGE: {
1046
+ readonly event: "PAGE_VISIBILITY_CHANGE";
1047
+ readonly level: "INFO";
1048
+ };
956
1049
  };
957
1050
  interface WebhookEvent {
958
1051
  event: keyof typeof webhookEvent;
959
1052
  level: keyof typeof webhookEventSeverity;
960
1053
  }
961
- declare const measurementError: {
962
- readonly WORKER_ERROR: "WORKER_ERROR";
963
- };
1054
+ declare enum ErrorCodes {
1055
+ CAMERA_PERMISSION_DENIED = "CAMERA_PERMISSION_DENIED",
1056
+ WORKER_ERROR = "WORKER_ERROR",
1057
+ PROFILE_INFO_NOT_SET = "PROFILE_INFO_NOT_SET",
1058
+ NO_DEVICES_FOUND = "NO_DEVICES_FOUND",
1059
+ PAGE_NOT_VISIBLE = "PAGE_NOT_VISIBLE",
1060
+ CAMERA_START_FAILED = "CAMERA_START_FAILED",
1061
+ MEASUREMENT_LOW_SNR = "MEASUREMENT_LOW_SNR"
1062
+ }
1063
+ type MeasurementErrorCodes = ErrorCodes.WORKER_ERROR | ErrorCodes.PROFILE_INFO_NOT_SET;
964
1064
 
965
1065
  declare class MeasurementEmbeddedApp implements MeasurementEmbedded {
966
1066
  #private;
@@ -980,17 +1080,14 @@ declare class MeasurementEmbeddedApp implements MeasurementEmbedded {
980
1080
  * @param {webhook} WebhookEvent - webhook event
981
1081
  */
982
1082
  webhook: ((webhook: WebhookEvent) => void) | null;
983
- /**
984
- * when measurement is cancelled
985
- */
986
- cancel: (() => void) | null;
987
1083
  };
988
1084
  constructor();
989
1085
  init(options: MeasurementEmbeddedAppOptions): void;
990
1086
  destroy(): void;
991
1087
  setTheme(theme: 'light' | 'dark'): void;
992
1088
  setLanguage(language: SupportedLanguage): void;
1089
+ cancel(): void;
993
1090
  }
994
1091
 
995
- export { MeasurementEmbeddedApp as default, faceAttributeValue, measurementEmbeddedAppEvents };
996
- export type { AppSettings, Demographics, DfxPointId, MeasurementEmbeddedAppOptions, Results };
1092
+ export { ErrorCodes, MeasurementEmbeddedApp as default, faceAttributeValue, measurementEmbeddedAppEvents, webhookEvents };
1093
+ export type { AppSettings, DfxPointId, MeasurementEmbeddedAppError, MeasurementEmbeddedAppOptions, MeasurementErrorCodes, Point, Profile, Results };
package/lib/index.mjs CHANGED
@@ -1 +1 @@
1
- const h={RESULTS:"results",ERROR:"error",WEBHOOK:"webhook",CANCEL:"cancel"},S={DESTROY:"destroy",SET_THEME:"setTheme",SET_LANGUAGE:"setLanguage"};var L=o=>{throw TypeError(o)},O=(o,e,n)=>e.has(o)||L("Cannot "+n),t=(o,e,n)=>(O(o,e,"read from private field"),n?n.call(o):e.get(o)),p=(o,e,n)=>e.has(o)?L("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,n),M=(o,e,n,d)=>(O(o,e,"write to private field"),e.set(o,n),n),i,l,c,s;const w=class a{constructor(e){p(this,s),M(this,s,new Int32Array(e))}lock(){for(;;){if(Atomics.compareExchange(t(this,s),t(a,c),t(a,l),t(a,i))==t(a,l))return;Atomics.wait(t(this,s),t(a,c),t(a,i))}}unlock(){if(Atomics.compareExchange(t(this,s),t(a,c),t(a,i),t(a,l))!=t(a,i))throw new Error("Tried to unlock while not holding the mutex");Atomics.notify(t(this,s),t(a,c))}AsyncLock(e){const n=this;async function d(){for(;;){if(Atomics.compareExchange(t(n,s),t(a,c),t(a,l),t(a,i))==t(a,l)){e(),n.unlock();return}await Atomics.waitAsync(t(n,s),t(a,c),t(a,i)).value}}d()}};i=new WeakMap,l=new WeakMap,c=new WeakMap,s=new WeakMap,p(w,i,1),p(w,l,0),p(w,c,0);const I={SEX_NOT_PROVIDED:1,SEX_ASSIGNED_MALE_AT_BIRTH:2,SEX_ASSIGNED_FEMALE_AT_BIRTH:3,DIABETES_NONE:4,DIABETES_TYPE1:5,DIABETES_TYPE2:6,SMOKER_TRUE:0,SMOKER_FALSE:1,BLOOD_PRESSURE_MEDICATION_TRUE:1,BLOOD_PRESSURE_MEDICATION_FALSE:0},N=document.documentElement.style.overflow;class ${#e=document.createElement("div");#t=document.createElement("div");on={results:null,error:null,webhook:null,cancel:null};constructor(){this.#e.style.height="100%"}init(e){const{container:n,appPath:d,settings:T,profile:_,loadError:u,top:f=0,language:R}=e;this.#t=n,Object.assign(n.style,{position:"fixed",top:f,left:"0",width:"100vw",height:`calc(100vh - ${f})`}),document.body.appendChild(n);const m=n.attachShadow({mode:"open"});document.documentElement.style.overflow="hidden";const y="app",A=document.createElement("link");A.rel="stylesheet",A.href=`${d}/stylex.css`,m.appendChild(A);const v=document.createElement("link");v.rel="stylesheet",v.href=`${d}/${y}.css`,m.appendChild(v);const C=r=>{this.on.results&&this.on.results({...r.detail})},k=r=>{this.on.error&&this.on.error({...r.detail})},g=r=>{this.on.webhook&&this.on.webhook({...r.detail})},D=()=>{this.on.cancel&&this.on.cancel()};this.#e.addEventListener(h.RESULTS,C),this.#e.addEventListener(h.ERROR,k),this.#e.addEventListener(h.WEBHOOK,g),this.#e.addEventListener(h.CANCEL,D),m.appendChild(this.#e);const E=document.createElement("script");E.type="module",E.src=`${d}/${y}.mjs`,E.onload=()=>{import(E.src).then(r=>{r.app.init(this.#e,d,T,_,R)}).catch(()=>{u&&u("Failed to initialize Measurement Embedded React app")})},E.onerror=()=>{u&&u("Failed to load the measurement embedded app script")},m.appendChild(E)}destroy(){const e=new CustomEvent("measurement-embedded-app-action",{detail:{action:S.DESTROY,data:{}}});this.#e.dispatchEvent(e),document.documentElement.style.overflow=N,this.#t&&document.body.contains(this.#t)&&document.body.removeChild(this.#t)}setTheme(e){const n=new CustomEvent("measurement-embedded-app-action",{detail:{action:S.SET_THEME,data:{theme:e}}});this.#e.dispatchEvent(n)}setLanguage(e){const n=new CustomEvent("measurement-embedded-app-action",{detail:{action:S.SET_LANGUAGE,data:{language:e}}});this.#e.dispatchEvent(n)}}export{$ as default,I as faceAttributeValue,h as measurementEmbeddedAppEvents};
1
+ const c={RESULTS:"results",ERROR:"error",WEBHOOK:"webhook"},a={INFO:"INFO",WARN:"WARN",ERROR:"ERROR"},A={CAMERA_STARTED:"CAMERA_STARTED",APP_LOADED:"APP_LOADED",MEASUREMENT_STARTED:"MEASUREMENT_STARTED",MEASUREMENT_COMPLETED:"MEASUREMENT_COMPLETED",CAMERA_PERMISSION_DENIED:"CAMERA_PERMISSION_DENIED",CAMERA_PERMISSION_GRANTED:"CAMERA_PERMISSION_GRANTED",INTERMEDIATE_RESULTS:"INTERMEDIATE_RESULTS",RESULTS_RECEIVED:"RESULTS_RECEIVED",MEASUREMENT_CANCELED:"MEASUREMENT_CANCELED",CONSTRAINT_VIOLATION:"CONSTRAINT_VIOLATION",PAGE_UNLOADED:"PAGE_UNLOADED",WEBSOCKET_DISCONNECTED:"WEBSOCKET_DISCONNECTED",PAGE_VISIBILITY_CHANGE:"PAGE_VISIBILITY_CHANGE"},y={CAMERA_STARTED:{event:A.CAMERA_STARTED,level:a.INFO},APP_LOADED:{event:A.APP_LOADED,level:a.INFO},MEASUREMENT_STARTED:{event:A.MEASUREMENT_STARTED,level:a.INFO},MEASUREMENT_COMPLETED:{event:A.MEASUREMENT_COMPLETED,level:a.INFO},CAMERA_PERMISSION_DENIED:{event:A.CAMERA_PERMISSION_DENIED,level:a.ERROR},CAMERA_PERMISSION_GRANTED:{event:A.CAMERA_PERMISSION_GRANTED,level:a.INFO},INTERMEDIATE_RESULTS:{event:A.INTERMEDIATE_RESULTS,level:a.INFO},RESULTS_RECEIVED:{event:A.RESULTS_RECEIVED,level:a.INFO},MEASUREMENT_CANCELED:{event:A.MEASUREMENT_CANCELED,level:a.WARN},CONSTRAINT_VIOLATION:{event:A.CONSTRAINT_VIOLATION,level:a.ERROR},PAGE_UNLOADED:{event:A.PAGE_UNLOADED,level:a.INFO},WEBSOCKET_DISCONNECTED:{event:A.WEBSOCKET_DISCONNECTED,level:a.WARN},PAGE_VISIBILITY_CHANGE:{event:A.PAGE_VISIBILITY_CHANGE,level:a.INFO}},r={DESTROY:"destroy",CANCEL:"cancel",SET_THEME:"setTheme",SET_LANGUAGE:"setLanguage"};var v=(E=>(E.CAMERA_PERMISSION_DENIED="CAMERA_PERMISSION_DENIED",E.WORKER_ERROR="WORKER_ERROR",E.PROFILE_INFO_NOT_SET="PROFILE_INFO_NOT_SET",E.NO_DEVICES_FOUND="NO_DEVICES_FOUND",E.PAGE_NOT_VISIBLE="PAGE_NOT_VISIBLE",E.CAMERA_START_FAILED="CAMERA_START_FAILED",E.MEASUREMENT_LOW_SNR="MEASUREMENT_LOW_SNR",E))(v||{}),m=E=>{throw TypeError(E)},L=(E,e,n)=>e.has(E)||m("Cannot "+n),t=(E,e,n)=>(L(E,e,"read from private field"),n?n.call(E):e.get(E)),I=(E,e,n)=>e.has(E)?m("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(E):e.set(E,n),F=(E,e,n,l)=>(L(E,e,"write to private field"),e.set(E,n),n),R,T,i,s;const h=class o{constructor(e){I(this,s),F(this,s,new Int32Array(e))}lock(){for(;;){if(Atomics.compareExchange(t(this,s),t(o,i),t(o,T),t(o,R))==t(o,T))return;Atomics.wait(t(this,s),t(o,i),t(o,R))}}unlock(){if(Atomics.compareExchange(t(this,s),t(o,i),t(o,R),t(o,T))!=t(o,R))throw new Error("Tried to unlock while not holding the mutex");Atomics.notify(t(this,s),t(o,i))}AsyncLock(e){const n=this;async function l(){for(;;){if(Atomics.compareExchange(t(n,s),t(o,i),t(o,T),t(o,R))==t(o,T)){e(),n.unlock();return}await Atomics.waitAsync(t(n,s),t(o,i),t(o,R)).value}}l()}};R=new WeakMap,T=new WeakMap,i=new WeakMap,s=new WeakMap,I(h,R,1),I(h,T,0),I(h,i,0);const k={SEX_NOT_PROVIDED:1,SEX_ASSIGNED_MALE_AT_BIRTH:2,SEX_ASSIGNED_FEMALE_AT_BIRTH:3,DIABETES_NONE:4,DIABETES_TYPE1:5,DIABETES_TYPE2:6,SMOKER_TRUE:0,SMOKER_FALSE:1,BLOOD_PRESSURE_MEDICATION_TRUE:1,BLOOD_PRESSURE_MEDICATION_FALSE:0},B=document.documentElement.style.overflow;class W{#e=document.createElement("div");#E=document.createElement("div");on={results:null,error:null,webhook:null};constructor(){this.#e.style.height="100%"}init(e){const{container:n,appPath:l,settings:M,profile:C,config:P,loadError:d,top:p=0,language:U,apiUrl:w="api.deepaffex.ai"}=e;this.#E=n,Object.assign(n.style,{position:"fixed",top:p,left:"0",width:"100vw",height:`calc(100vh - ${p})`}),document.body.appendChild(n);const N=n.attachShadow({mode:"open"});document.documentElement.style.overflow="hidden";const u="app",O=document.createElement("link");O.rel="stylesheet",O.href=`${l}/stylex.css`,N.appendChild(O);const D=document.createElement("link");D.rel="stylesheet",D.href=`${l}/${u}.css`,N.appendChild(D);const f=S=>{this.on.results&&this.on.results({...S.detail})},G=S=>{this.on.error&&this.on.error({...S.detail})},V=S=>{this.on.webhook&&this.on.webhook({...S.detail})};this.#e.addEventListener(c.RESULTS,f),this.#e.addEventListener(c.ERROR,G),this.#e.addEventListener(c.WEBHOOK,V),N.appendChild(this.#e);const _=document.createElement("script");_.type="module",_.src=`${l}/${u}.mjs`,_.onload=()=>{import(_.src).then(S=>{S.app.init(this.#e,l,M,C,w,P,U)}).catch(()=>{d&&d("Failed to initialize Measurement Embedded React app")})},_.onerror=()=>{d&&d("Failed to load the measurement embedded app script")},N.appendChild(_)}destroy(){const e=new CustomEvent("measurement-embedded-app-action",{detail:{action:r.DESTROY,data:{}}});this.#e.dispatchEvent(e),document.documentElement.style.overflow=B,this.#E&&document.body.contains(this.#E)&&document.body.removeChild(this.#E)}setTheme(e){const n=new CustomEvent("measurement-embedded-app-action",{detail:{action:r.SET_THEME,data:{theme:e}}});this.#e.dispatchEvent(n)}setLanguage(e){const n=new CustomEvent("measurement-embedded-app-action",{detail:{action:r.SET_LANGUAGE,data:{language:e}}});this.#e.dispatchEvent(n)}cancel(){const e=new CustomEvent("measurement-embedded-app-action",{detail:{action:r.CANCEL,data:{}}});this.#e.dispatchEvent(e)}}export{v as ErrorCodes,W as default,k as faceAttributeValue,c as measurementEmbeddedAppEvents,y as webhookEvents};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuralogix.ai/web-measurement-embedded-app",
3
- "version": "0.1.0-alpha.5",
3
+ "version": "0.1.0-alpha.7",
4
4
  "description": "Web Measurement Embedded App",
5
5
  "contributors": [
6
6
  "Hamed Hassanzadeh Amin",