@nuralogix.ai/web-measurement-embedded-app 0.1.0-alpha.1 → 0.1.0-alpha.11

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
@@ -1,5 +1,7 @@
1
1
  ### Web Measurement Embedded App
2
2
 
3
+
4
+
3
5
  ```html
4
6
  <!DOCTYPE html>
5
7
  <html lang="en">
@@ -10,7 +12,7 @@
10
12
  <script type="importmap">
11
13
  {
12
14
  "imports": {
13
- "@nuralogix.ai/web-measurement-embedded-app": "https://unpkg.com/@nuralogix.ai/web-measurement-embedded-app",
15
+ "@nuralogix.ai/web-measurement-embedded-app": "https://unpkg.com/@nuralogix.ai/web-measurement-embedded-app"
14
16
  }
15
17
  }
16
18
  </script>
@@ -19,6 +21,12 @@
19
21
  <div id="measurement-embedded-app-container"></div>
20
22
  <script type="module">
21
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;
22
30
  const measurementApp = new MeasurementEmbeddedApp();
23
31
  const container = document.getElementById('measurement-embedded-app-container');
24
32
  if (container) {
@@ -30,8 +38,7 @@
30
38
  if (studyIdResponse.status === '200' && tokenResponse.status === '200') {
31
39
  measurementApp.init({
32
40
  container,
33
- top: '100px',
34
- appPath: '.',
41
+ appPath: 'https://unpkg.com/@nuralogix.ai/web-measurement-embedded-app/dist',
35
42
  settings: {
36
43
  token: tokenResponse.token,
37
44
  refreshToken: tokenResponse.refreshToken,
@@ -41,12 +48,21 @@
41
48
  age: 40,
42
49
  height: 180,
43
50
  weight: 60,
44
- sex: faceAttributeValue.SEX_ASSIGNED_MALE_AT_BIRTH,
45
- smoking: faceAttributeValue.SMOKER_FALSE,
46
- bloodPressureMedication: faceAttributeValue.BLOOD_PRESSURE_MEDICATION_FALSE,
47
- diabetes: faceAttributeValue.DIABETES_NONE,
48
- 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,
49
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)
50
66
  loadError: function(error) {
51
67
  console.error("load rror", error);
52
68
  }
@@ -61,9 +77,6 @@
61
77
  measurementApp.on.webhook = (webhook) => {
62
78
  console.log("Webhook received", webhook);
63
79
  };
64
- measurementApp.on.cancel = () => {
65
- console.log("Measurement cancelled");
66
- };
67
80
  } else {
68
81
  console.error('Failed to get Study ID and Token pair');
69
82
  }
@@ -71,4 +84,48 @@
71
84
  </script>
72
85
  </body>
73
86
  </html>
74
- ```
87
+ ```
88
+
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`.
98
+
99
+
100
+ **Methods:**
101
+
102
+ ```typescript
103
+ init(options: MeasurementEmbeddedAppOptions): void;
104
+ destroy(): void;
105
+ cancel(reset: boolean): Promise<boolean>;
106
+ setTheme(theme: 'light' | 'dark'): void;
107
+ setLanguage(language: SupportedLanguage): void;
108
+ getLogs(): Promise<Log[]>;
109
+ ```
110
+
111
+ **Events:**
112
+
113
+ ```typescript
114
+ /**
115
+ * when measurement results are received
116
+ * @param {results} Results - measurement results
117
+ */
118
+ results: ((results: Results) => void) | null;
119
+
120
+ /**
121
+ * when there is an error in the measurement embedded app
122
+ * @param {error} MeasurementEmbeddedAppError - measurement embedded app error
123
+ */
124
+ error: ((error: MeasurementEmbeddedAppError) => void) | null;
125
+
126
+ /**
127
+ * when an AppEvent is received
128
+ * @param {appEvent} AppEvent - app event
129
+ */
130
+ event: ((appEvent: AppEvent) => void) | null;
131
+ ```
package/dist/app.css CHANGED
@@ -109,6 +109,10 @@
109
109
  border-radius: 4px;
110
110
  }
111
111
 
112
+ .nura16rqkct {
113
+ border-radius: 50%;
114
+ }
115
+
112
116
  .nura1kptayx {
113
117
  border-radius: var(--borderRadius);
114
118
  }
@@ -149,6 +153,14 @@
149
153
  text-decoration: underline;
150
154
  }
151
155
 
156
+ .nuray9syeq {
157
+ transition: all .2s ease-in-out;
158
+ }
159
+
160
+ .nura1hzlkrz {
161
+ transition: all .3s cubic-bezier(.4, 0, .2, 1);
162
+ }
163
+
152
164
  .nurahx8npm {
153
165
  transition: background-color .2s, border-color .2s;
154
166
  }
@@ -543,6 +555,10 @@
543
555
  transform: translate(-50%, -50%);
544
556
  }
545
557
 
558
+ .nura1cb1t30 {
559
+ transform: translateY(-50%);
560
+ }
561
+
546
562
  .nurann1q72 {
547
563
  transform: translateY(0);
548
564
  }
@@ -612,6 +628,10 @@
612
628
  transform: none;
613
629
  }
614
630
 
631
+ .nurasegxbs:hover {
632
+ transform: scale(1.02);
633
+ }
634
+
615
635
  .nura1lcra6a:hover {
616
636
  transform: scale(1.1);
617
637
  }
@@ -744,6 +764,10 @@
744
764
  width: 100%;
745
765
  }
746
766
 
767
+ .nura154i66o {
768
+ width: 3.5rem;
769
+ }
770
+
747
771
  .nura100vrsf {
748
772
  width: 40px;
749
773
  }
@@ -830,7 +854,7 @@
830
854
  color: var(--bfcyyw);
831
855
  }
832
856
 
833
- .nura1cpjm7i:before, .nura1s928wv:after {
857
+ .nura1s928wv:after, .nura1cpjm7i:before {
834
858
  content: "";
835
859
  }
836
860
 
@@ -850,7 +874,7 @@
850
874
  opacity: 1;
851
875
  }
852
876
 
853
- .nura1hmns74:before, .nura1j6awrg:after {
877
+ .nura1j6awrg:after, .nura1hmns74:before {
854
878
  position: absolute;
855
879
  }
856
880