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

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
@@ -21,6 +21,12 @@
21
21
  <div id="measurement-embedded-app-container"></div>
22
22
  <script type="module">
23
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;
24
30
  const measurementApp = new MeasurementEmbeddedApp();
25
31
  const container = document.getElementById('measurement-embedded-app-container');
26
32
  if (container) {
@@ -32,9 +38,7 @@
32
38
  if (studyIdResponse.status === '200' && tokenResponse.status === '200') {
33
39
  measurementApp.init({
34
40
  container,
35
- top: '100px',
36
41
  appPath: 'https://unpkg.com/@nuralogix.ai/web-measurement-embedded-app/dist',
37
- language: 'fr', // optional
38
42
  settings: {
39
43
  token: tokenResponse.token,
40
44
  refreshToken: tokenResponse.refreshToken,
@@ -44,12 +48,21 @@
44
48
  age: 40,
45
49
  height: 180,
46
50
  weight: 60,
47
- sex: faceAttributeValue.SEX_ASSIGNED_MALE_AT_BIRTH,
48
- smoking: faceAttributeValue.SMOKER_FALSE,
49
- bloodPressureMedication: faceAttributeValue.BLOOD_PRESSURE_MEDICATION_FALSE,
50
- diabetes: faceAttributeValue.DIABETES_NONE,
51
- unit: 'Metric',
51
+ sex: SEX_ASSIGNED_MALE_AT_BIRTH,
52
+ smoking: SMOKER_FALSE,
53
+ bloodPressureMedication: BLOOD_PRESSURE_MEDICATION_FALSE,
54
+ diabetes: DIABETES_NONE,
55
+ bypassProfile: false,
52
56
  },
57
+ config: { // optional
58
+ checkConstraints: true, // optional
59
+ cameraFacingMode: 'user', // optional
60
+ cameraAutoStart: true, // optional
61
+ measurementAutoStart: false, // optional
62
+ }
63
+ // top: '100px', // (optional)
64
+ // language: 'fr', // (optional)
65
+ // apiUrl: 'some-custom-api-url-value', // (optional)
53
66
  loadError: function(error) {
54
67
  console.error("load rror", error);
55
68
  }
@@ -64,9 +77,6 @@
64
77
  measurementApp.on.webhook = (webhook) => {
65
78
  console.log("Webhook received", webhook);
66
79
  };
67
- measurementApp.on.cancel = () => {
68
- console.log("Measurement cancelled");
69
- };
70
80
  } else {
71
81
  console.error('Failed to get Study ID and Token pair');
72
82
  }
@@ -84,4 +94,37 @@
84
94
  - If a supported language is set, the app loads with a supported language.
85
95
  - If the language prop is not set, the app checks the browser's language and if it is among
86
96
  the list of supported languages, it loads the language pack for the browser's language.
87
- Otherwise falls back to `en`.
97
+ Otherwise falls back to `en`.
98
+
99
+
100
+ **Methods:**
101
+
102
+ ```typescript
103
+ init(options: MeasurementEmbeddedAppOptions): void;
104
+ destroy(): void;
105
+ cancel(): void;
106
+ setTheme(theme: 'light' | 'dark'): void;
107
+ setLanguage(language: SupportedLanguage): void;
108
+ ```
109
+
110
+ **Events:**
111
+
112
+ ```typescript
113
+ /**
114
+ * when measurement results are received
115
+ * @param {results} Results - measurement results
116
+ */
117
+ results: ((results: Results) => void) | null;
118
+
119
+ /**
120
+ * when there is an error in the measurement embedded app
121
+ * @param {error} MeasurementEmbeddedAppError - measurement embedded app error
122
+ */
123
+ error: ((error: MeasurementEmbeddedAppError) => void) | null;
124
+
125
+ /**
126
+ * when an AppEvent is received
127
+ * @param {appEvent} AppEvent - app event
128
+ */
129
+ event: ((appEvent: AppEvent) => void) | null;
130
+ ```