@shenai/react-native-sdk 3.1.1

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.
@@ -0,0 +1,667 @@
1
+ import { requireNativeComponent, UIManager, Platform, NativeModules } from "react-native";
2
+ const {
3
+ ShenaiSdkNativeModule
4
+ } = NativeModules;
5
+ const BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
6
+ const BASE64_LOOKUP = (() => {
7
+ const lookup = new Int16Array(128);
8
+ lookup.fill(-1);
9
+ for (let index = 0; index < BASE64_ALPHABET.length; index += 1) {
10
+ lookup[BASE64_ALPHABET.charCodeAt(index)] = index;
11
+ }
12
+ return lookup;
13
+ })();
14
+ const LINKING_ERROR = `The package '@shenai/react-native-sdk' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
15
+ ios: "- You have run 'pod install'\n",
16
+ default: ""
17
+ }) + "- You rebuilt the app after installing the package\n" + "- You are not using Expo Go\n";
18
+ const ComponentName = "ShenaiSdkView";
19
+ export const ShenaiSdkView = UIManager.getViewManagerConfig(ComponentName) != null ? requireNativeComponent(ComponentName) : () => {
20
+ throw new Error(LINKING_ERROR);
21
+ };
22
+ export let InitializationResult = /*#__PURE__*/function (InitializationResult) {
23
+ InitializationResult[InitializationResult["OK"] = 0] = "OK";
24
+ InitializationResult[InitializationResult["INVALID_API_KEY"] = 1] = "INVALID_API_KEY";
25
+ InitializationResult[InitializationResult["CONNECTION_ERROR"] = 2] = "CONNECTION_ERROR";
26
+ InitializationResult[InitializationResult["INTERNAL_ERROR"] = 3] = "INTERNAL_ERROR";
27
+ return InitializationResult;
28
+ }({});
29
+ export let OperatingMode = /*#__PURE__*/function (OperatingMode) {
30
+ OperatingMode[OperatingMode["POSITIONING"] = 0] = "POSITIONING";
31
+ OperatingMode[OperatingMode["MEASURE"] = 1] = "MEASURE";
32
+ OperatingMode[OperatingMode["SYSTEM_OVERLOADED"] = 2] = "SYSTEM_OVERLOADED";
33
+ return OperatingMode;
34
+ }({});
35
+ export let CalibrationState = /*#__PURE__*/function (CalibrationState) {
36
+ CalibrationState[CalibrationState["CALIBRATED"] = 0] = "CALIBRATED";
37
+ CalibrationState[CalibrationState["NOT_CALIBRATED"] = 1] = "NOT_CALIBRATED";
38
+ CalibrationState[CalibrationState["OUTDATED"] = 2] = "OUTDATED";
39
+ return CalibrationState;
40
+ }({});
41
+ export let PrecisionMode = /*#__PURE__*/function (PrecisionMode) {
42
+ PrecisionMode[PrecisionMode["STRICT"] = 0] = "STRICT";
43
+ PrecisionMode[PrecisionMode["RELAXED"] = 1] = "RELAXED";
44
+ return PrecisionMode;
45
+ }({});
46
+ export let MeasurementEnvironmentCondition = /*#__PURE__*/function (MeasurementEnvironmentCondition) {
47
+ MeasurementEnvironmentCondition[MeasurementEnvironmentCondition["FACE_POSITION"] = 0] = "FACE_POSITION";
48
+ MeasurementEnvironmentCondition[MeasurementEnvironmentCondition["FOREHEAD_VISIBLE"] = 1] = "FOREHEAD_VISIBLE";
49
+ MeasurementEnvironmentCondition[MeasurementEnvironmentCondition["GLASSES_NOT_DETECTED"] = 2] = "GLASSES_NOT_DETECTED";
50
+ MeasurementEnvironmentCondition[MeasurementEnvironmentCondition["SUFFICIENT_LIGHT_LEVEL"] = 3] = "SUFFICIENT_LIGHT_LEVEL";
51
+ MeasurementEnvironmentCondition[MeasurementEnvironmentCondition["EVEN_LIGHTING"] = 4] = "EVEN_LIGHTING";
52
+ MeasurementEnvironmentCondition[MeasurementEnvironmentCondition["NO_BACKLIGHT"] = 5] = "NO_BACKLIGHT";
53
+ MeasurementEnvironmentCondition[MeasurementEnvironmentCondition["FACE_STABLE"] = 6] = "FACE_STABLE";
54
+ MeasurementEnvironmentCondition[MeasurementEnvironmentCondition["DEVICE_STABLE"] = 7] = "DEVICE_STABLE";
55
+ return MeasurementEnvironmentCondition;
56
+ }({});
57
+ export let Screen = /*#__PURE__*/function (Screen) {
58
+ Screen[Screen["INITIALIZATION"] = 0] = "INITIALIZATION";
59
+ Screen[Screen["ONBOARDING"] = 1] = "ONBOARDING";
60
+ Screen[Screen["MEASUREMENT"] = 2] = "MEASUREMENT";
61
+ Screen[Screen["INSTRUCTIONS"] = 3] = "INSTRUCTIONS";
62
+ Screen[Screen["RESULTS"] = 4] = "RESULTS";
63
+ Screen[Screen["HEALTH_RISKS"] = 5] = "HEALTH_RISKS";
64
+ Screen[Screen["HEALTH_RISKS_EDIT"] = 6] = "HEALTH_RISKS_EDIT";
65
+ Screen[Screen["CALIBRATION_ONBOARDING"] = 7] = "CALIBRATION_ONBOARDING";
66
+ Screen[Screen["CALIBRATION_FINISH"] = 8] = "CALIBRATION_FINISH";
67
+ Screen[Screen["CALIBRATION_DATA_ENTRY"] = 9] = "CALIBRATION_DATA_ENTRY";
68
+ Screen[Screen["DISCLAIMER"] = 10] = "DISCLAIMER";
69
+ Screen[Screen["DASHBOARD"] = 11] = "DASHBOARD";
70
+ return Screen;
71
+ }({});
72
+ export let Metric = /*#__PURE__*/function (Metric) {
73
+ Metric[Metric["HEART_RATE"] = 0] = "HEART_RATE";
74
+ Metric[Metric["HRV_SDNN"] = 1] = "HRV_SDNN";
75
+ Metric[Metric["BREATHING_RATE"] = 2] = "BREATHING_RATE";
76
+ Metric[Metric["SYSTOLIC_BP"] = 3] = "SYSTOLIC_BP";
77
+ Metric[Metric["DIASTOLIC_BP"] = 4] = "DIASTOLIC_BP";
78
+ Metric[Metric["CARDIAC_STRESS"] = 5] = "CARDIAC_STRESS";
79
+ Metric[Metric["PNS_ACTIVITY"] = 6] = "PNS_ACTIVITY";
80
+ Metric[Metric["CARDIAC_WORKLOAD"] = 7] = "CARDIAC_WORKLOAD";
81
+ Metric[Metric["AGE"] = 8] = "AGE";
82
+ Metric[Metric["BMI"] = 9] = "BMI";
83
+ Metric[Metric["BLOOD_PRESSURE"] = 10] = "BLOOD_PRESSURE";
84
+ Metric[Metric["BLOOD_PRESSURE_SCALE"] = 11] = "BLOOD_PRESSURE_SCALE";
85
+ return Metric;
86
+ }({});
87
+ export let BmiCategory = /*#__PURE__*/function (BmiCategory) {
88
+ BmiCategory[BmiCategory["UNDERWEIGHT_SEVERE"] = 0] = "UNDERWEIGHT_SEVERE";
89
+ BmiCategory[BmiCategory["UNDERWEIGHT_MODERATE"] = 1] = "UNDERWEIGHT_MODERATE";
90
+ BmiCategory[BmiCategory["UNDERWEIGHT_MILD"] = 2] = "UNDERWEIGHT_MILD";
91
+ BmiCategory[BmiCategory["NORMAL"] = 3] = "NORMAL";
92
+ BmiCategory[BmiCategory["OVERWEIGHT"] = 4] = "OVERWEIGHT";
93
+ BmiCategory[BmiCategory["OBESE_CLASS_I"] = 5] = "OBESE_CLASS_I";
94
+ BmiCategory[BmiCategory["OBESE_CLASS_II"] = 6] = "OBESE_CLASS_II";
95
+ BmiCategory[BmiCategory["OBESE_CLASS_III"] = 7] = "OBESE_CLASS_III";
96
+ return BmiCategory;
97
+ }({});
98
+ export let HealthIndex = /*#__PURE__*/function (HealthIndex) {
99
+ HealthIndex[HealthIndex["WELLNESS_SCORE"] = 0] = "WELLNESS_SCORE";
100
+ HealthIndex[HealthIndex["VASCULAR_AGE"] = 1] = "VASCULAR_AGE";
101
+ HealthIndex[HealthIndex["CARDIOVASCULAR_DISEASE_RISK"] = 2] = "CARDIOVASCULAR_DISEASE_RISK";
102
+ HealthIndex[HealthIndex["HARD_AND_FATAL_EVENTS_RISKS"] = 3] = "HARD_AND_FATAL_EVENTS_RISKS";
103
+ HealthIndex[HealthIndex["CARDIO_VASCULAR_RISK_SCORE"] = 4] = "CARDIO_VASCULAR_RISK_SCORE";
104
+ HealthIndex[HealthIndex["WAIST_TO_HEIGHT_RATIO"] = 5] = "WAIST_TO_HEIGHT_RATIO";
105
+ HealthIndex[HealthIndex["BODY_FAT_PERCENTAGE"] = 6] = "BODY_FAT_PERCENTAGE";
106
+ HealthIndex[HealthIndex["BODY_ROUNDNESS_INDEX"] = 7] = "BODY_ROUNDNESS_INDEX";
107
+ HealthIndex[HealthIndex["A_BODY_SHAPE_INDEX"] = 8] = "A_BODY_SHAPE_INDEX";
108
+ HealthIndex[HealthIndex["CONICITY_INDEX"] = 9] = "CONICITY_INDEX";
109
+ HealthIndex[HealthIndex["BASAL_METABOLIC_RATE"] = 10] = "BASAL_METABOLIC_RATE";
110
+ HealthIndex[HealthIndex["TOTAL_DAILY_ENERGY_EXPENDITURE"] = 11] = "TOTAL_DAILY_ENERGY_EXPENDITURE";
111
+ HealthIndex[HealthIndex["HYPERTENSION_RISK"] = 12] = "HYPERTENSION_RISK";
112
+ HealthIndex[HealthIndex["DIABETES_RISK"] = 13] = "DIABETES_RISK";
113
+ HealthIndex[HealthIndex["NON_ALCOHOLIC_FATYY_LIVER_DISEASE_RISK"] = 14] = "NON_ALCOHOLIC_FATYY_LIVER_DISEASE_RISK";
114
+ return HealthIndex;
115
+ }({});
116
+ export let MeasurementPreset = /*#__PURE__*/function (MeasurementPreset) {
117
+ MeasurementPreset[MeasurementPreset["ONE_MINUTE_HR_HRV_BR"] = 0] = "ONE_MINUTE_HR_HRV_BR";
118
+ MeasurementPreset[MeasurementPreset["ONE_MINUTE_BETA_METRICS"] = 1] = "ONE_MINUTE_BETA_METRICS";
119
+ MeasurementPreset[MeasurementPreset["INFINITE_HR"] = 2] = "INFINITE_HR";
120
+ MeasurementPreset[MeasurementPreset["INFINITE_METRICS"] = 3] = "INFINITE_METRICS";
121
+ MeasurementPreset[MeasurementPreset["FOURTY_FIVE_SECONDS_UNVALIDATED"] = 4] = "FOURTY_FIVE_SECONDS_UNVALIDATED";
122
+ MeasurementPreset[MeasurementPreset["THIRTY_SECONDS_UNVALIDATED"] = 5] = "THIRTY_SECONDS_UNVALIDATED";
123
+ MeasurementPreset[MeasurementPreset["CUSTOM"] = 6] = "CUSTOM";
124
+ MeasurementPreset[MeasurementPreset["ONE_MINUTE_ALL_METRICS"] = 7] = "ONE_MINUTE_ALL_METRICS";
125
+ MeasurementPreset[MeasurementPreset["FOURTY_FIVE_SECONDS_ALL_METRICS"] = 8] = "FOURTY_FIVE_SECONDS_ALL_METRICS";
126
+ MeasurementPreset[MeasurementPreset["THIRTY_SECONDS_ALL_METRICS"] = 9] = "THIRTY_SECONDS_ALL_METRICS";
127
+ MeasurementPreset[MeasurementPreset["QUICK_HR_MODE"] = 10] = "QUICK_HR_MODE";
128
+ return MeasurementPreset;
129
+ }({});
130
+ export let CameraMode = /*#__PURE__*/function (CameraMode) {
131
+ CameraMode[CameraMode["OFF"] = 0] = "OFF";
132
+ CameraMode[CameraMode["FACING_USER"] = 1] = "FACING_USER";
133
+ CameraMode[CameraMode["FACING_ENVIRONMENT"] = 2] = "FACING_ENVIRONMENT";
134
+ CameraMode[CameraMode["CUSTOM_FRAMES"] = 3] = "CUSTOM_FRAMES";
135
+ return CameraMode;
136
+ }({});
137
+ export let CameraError = /*#__PURE__*/function (CameraError) {
138
+ CameraError[CameraError["UNKNOWN"] = 0] = "UNKNOWN";
139
+ CameraError[CameraError["UNSUPPORTED_MODE"] = 1] = "UNSUPPORTED_MODE";
140
+ CameraError[CameraError["NO_CAMERA_DEVICE"] = 2] = "NO_CAMERA_DEVICE";
141
+ CameraError[CameraError["PERMISSION_NOT_GRANTED"] = 3] = "PERMISSION_NOT_GRANTED";
142
+ CameraError[CameraError["INVALID_DEVICE_ID"] = 4] = "INVALID_DEVICE_ID";
143
+ CameraError[CameraError["DEVICE_UNAVAILABLE"] = 5] = "DEVICE_UNAVAILABLE";
144
+ return CameraError;
145
+ }({});
146
+ export let OnboardingMode = /*#__PURE__*/function (OnboardingMode) {
147
+ OnboardingMode[OnboardingMode["HIDDEN"] = 0] = "HIDDEN";
148
+ OnboardingMode[OnboardingMode["SHOW_ONCE"] = 1] = "SHOW_ONCE";
149
+ OnboardingMode[OnboardingMode["SHOW_ALWAYS"] = 2] = "SHOW_ALWAYS";
150
+ return OnboardingMode;
151
+ }({});
152
+ export let UiVersion = /*#__PURE__*/function (UiVersion) {
153
+ UiVersion[UiVersion["V1"] = 0] = "V1";
154
+ UiVersion[UiVersion["V2"] = 1] = "V2";
155
+ UiVersion[UiVersion["V3"] = 2] = "V3";
156
+ return UiVersion;
157
+ }({});
158
+ export let InitializationMode = /*#__PURE__*/function (InitializationMode) {
159
+ InitializationMode[InitializationMode["MEASUREMENT"] = 0] = "MEASUREMENT";
160
+ InitializationMode[InitializationMode["CALIBRATION"] = 1] = "CALIBRATION";
161
+ InitializationMode[InitializationMode["CALIBRATED_MEASUREMENT"] = 2] = "CALIBRATED_MEASUREMENT";
162
+ InitializationMode[InitializationMode["FAST_CALIBRATION"] = 3] = "FAST_CALIBRATION";
163
+ return InitializationMode;
164
+ }({});
165
+ function ensureNativeModuleAvailable() {
166
+ if (!ShenaiSdkNativeModule) {
167
+ throw new Error(LINKING_ERROR);
168
+ }
169
+ }
170
+ export async function initialize(apiKey, userId, settings) {
171
+ ensureNativeModuleAvailable();
172
+ return ShenaiSdkNativeModule.initialize(apiKey, userId ?? "", settings ?? {});
173
+ }
174
+ export async function isInitialized() {
175
+ ensureNativeModuleAvailable();
176
+ return ShenaiSdkNativeModule.isInitialized();
177
+ }
178
+ export async function deinitialize() {
179
+ ensureNativeModuleAvailable();
180
+ await ShenaiSdkNativeModule.deinitialize();
181
+ }
182
+ export async function setOperatingMode(operatingMode) {
183
+ ensureNativeModuleAvailable();
184
+ await ShenaiSdkNativeModule.setOperatingMode(operatingMode);
185
+ }
186
+ export async function getOperatingMode() {
187
+ ensureNativeModuleAvailable();
188
+ return ShenaiSdkNativeModule.getOperatingMode();
189
+ }
190
+ export async function startMeasurement() {
191
+ ensureNativeModuleAvailable();
192
+ await ShenaiSdkNativeModule.startMeasurement();
193
+ }
194
+ export async function stopMeasurement() {
195
+ ensureNativeModuleAvailable();
196
+ await ShenaiSdkNativeModule.stopMeasurement();
197
+ }
198
+ export async function resetMeasurementSession() {
199
+ ensureNativeModuleAvailable();
200
+ await ShenaiSdkNativeModule.resetMeasurementSession();
201
+ }
202
+ export async function isReadyToStartMeasurement() {
203
+ ensureNativeModuleAvailable();
204
+ return ShenaiSdkNativeModule.isReadyToStartMeasurement();
205
+ }
206
+ export async function areRequiredModelsDownloaded() {
207
+ ensureNativeModuleAvailable();
208
+ return ShenaiSdkNativeModule.areRequiredModelsDownloaded();
209
+ }
210
+ export async function getCalibrationState() {
211
+ ensureNativeModuleAvailable();
212
+ return ShenaiSdkNativeModule.getCalibrationState();
213
+ }
214
+ export async function setPrecisionMode(precisionMode) {
215
+ ensureNativeModuleAvailable();
216
+ await ShenaiSdkNativeModule.setPrecisionMode(precisionMode);
217
+ }
218
+ export async function getPrecisionMode() {
219
+ ensureNativeModuleAvailable();
220
+ return ShenaiSdkNativeModule.getPrecisionMode();
221
+ }
222
+ export async function setApplyPrecisionModeToBloodPressure(apply) {
223
+ ensureNativeModuleAvailable();
224
+ await ShenaiSdkNativeModule.setApplyPrecisionModeToBloodPressure(apply);
225
+ }
226
+ export async function getApplyPrecisionModeToBloodPressure() {
227
+ ensureNativeModuleAvailable();
228
+ return ShenaiSdkNativeModule.getApplyPrecisionModeToBloodPressure();
229
+ }
230
+ export async function setBlockingMeasurementConditions(conditions) {
231
+ ensureNativeModuleAvailable();
232
+ await ShenaiSdkNativeModule.setBlockingMeasurementConditions(conditions);
233
+ }
234
+ export async function getBlockingMeasurementConditions() {
235
+ ensureNativeModuleAvailable();
236
+ return ShenaiSdkNativeModule.getBlockingMeasurementConditions();
237
+ }
238
+ export async function setWarningMeasurementConditions(conditions) {
239
+ ensureNativeModuleAvailable();
240
+ await ShenaiSdkNativeModule.setWarningMeasurementConditions(conditions);
241
+ }
242
+ export async function getWarningMeasurementConditions() {
243
+ ensureNativeModuleAvailable();
244
+ return ShenaiSdkNativeModule.getWarningMeasurementConditions();
245
+ }
246
+ export async function getCurrentViolatedMeasurementEnvironmentCondition() {
247
+ ensureNativeModuleAvailable();
248
+ return ShenaiSdkNativeModule.getCurrentViolatedMeasurementEnvironmentCondition();
249
+ }
250
+ export async function setMeasurementPreset(measurementPreset) {
251
+ ensureNativeModuleAvailable();
252
+ await ShenaiSdkNativeModule.setMeasurementPreset(measurementPreset);
253
+ }
254
+ export async function getMeasurementPreset() {
255
+ ensureNativeModuleAvailable();
256
+ return ShenaiSdkNativeModule.getMeasurementPreset();
257
+ }
258
+ export async function setCustomMeasurementConfig(config) {
259
+ ensureNativeModuleAvailable();
260
+ await ShenaiSdkNativeModule.setCustomMeasurementConfig(config);
261
+ }
262
+ export async function setCustomColorTheme(theme) {
263
+ ensureNativeModuleAvailable();
264
+ await ShenaiSdkNativeModule.setCustomColorTheme(theme);
265
+ }
266
+ export async function setCameraMode(cameraMode) {
267
+ ensureNativeModuleAvailable();
268
+ await ShenaiSdkNativeModule.setCameraMode(cameraMode);
269
+ }
270
+ export async function getCameraMode() {
271
+ ensureNativeModuleAvailable();
272
+ return ShenaiSdkNativeModule.getCameraMode();
273
+ }
274
+ export async function getLastCameraError() {
275
+ ensureNativeModuleAvailable();
276
+ return ShenaiSdkNativeModule.getLastCameraError();
277
+ }
278
+ export async function setScreen(screen) {
279
+ ensureNativeModuleAvailable();
280
+ await ShenaiSdkNativeModule.setScreen(screen);
281
+ }
282
+ export async function getScreen() {
283
+ ensureNativeModuleAvailable();
284
+ return ShenaiSdkNativeModule.getScreen();
285
+ }
286
+
287
+ //* ---- SDK interface elements ---- *//
288
+
289
+ export async function setShowUserInterface(showUserInterface) {
290
+ ensureNativeModuleAvailable();
291
+ await ShenaiSdkNativeModule.setShowUserInterface(showUserInterface);
292
+ }
293
+ export async function getShowUserInterface() {
294
+ ensureNativeModuleAvailable();
295
+ return ShenaiSdkNativeModule.getShowUserInterface();
296
+ }
297
+ export async function setShowFacePositioningOverlay(showFacePositioningOverlay) {
298
+ ensureNativeModuleAvailable();
299
+ await ShenaiSdkNativeModule.setShowFacePositioningOverlay(showFacePositioningOverlay);
300
+ }
301
+ export async function getShowFacePositioningOverlay() {
302
+ ensureNativeModuleAvailable();
303
+ return ShenaiSdkNativeModule.getShowFacePositioningOverlay();
304
+ }
305
+ export async function setShowVisualWarnings(showVisualWarnings) {
306
+ ensureNativeModuleAvailable();
307
+ await ShenaiSdkNativeModule.setShowVisualWarnings(showVisualWarnings);
308
+ }
309
+ export async function getShowVisualWarnings() {
310
+ ensureNativeModuleAvailable();
311
+ return ShenaiSdkNativeModule.getShowVisualWarnings();
312
+ }
313
+ export async function setEnableCameraSwap(enableCameraSwap) {
314
+ ensureNativeModuleAvailable();
315
+ await ShenaiSdkNativeModule.setEnableCameraSwap(enableCameraSwap);
316
+ }
317
+ export async function getEnableCameraSwap() {
318
+ ensureNativeModuleAvailable();
319
+ return ShenaiSdkNativeModule.getEnableCameraSwap();
320
+ }
321
+ export async function setShowFaceMask(showFaceMask) {
322
+ ensureNativeModuleAvailable();
323
+ await ShenaiSdkNativeModule.setShowFaceMask(showFaceMask);
324
+ }
325
+ export async function getShowFaceMask() {
326
+ ensureNativeModuleAvailable();
327
+ return ShenaiSdkNativeModule.getShowFaceMask();
328
+ }
329
+ export async function setShowBloodFlow(showBloodFlow) {
330
+ ensureNativeModuleAvailable();
331
+ await ShenaiSdkNativeModule.setShowBloodFlow(showBloodFlow);
332
+ }
333
+ export async function getShowBloodFlow() {
334
+ ensureNativeModuleAvailable();
335
+ return ShenaiSdkNativeModule.getShowBloodFlow();
336
+ }
337
+ export async function setIncludeTimestampInPdf(include) {
338
+ ensureNativeModuleAvailable();
339
+ await ShenaiSdkNativeModule.setIncludeTimestampInPdf(include);
340
+ }
341
+ export async function getIncludeTimestampInPdf() {
342
+ ensureNativeModuleAvailable();
343
+ return ShenaiSdkNativeModule.getIncludeTimestampInPdf();
344
+ }
345
+ export async function setPdfEmailSubject(subject) {
346
+ ensureNativeModuleAvailable();
347
+ await ShenaiSdkNativeModule.setPdfEmailSubject(subject);
348
+ }
349
+ export async function setPdfEmailBody(body) {
350
+ ensureNativeModuleAvailable();
351
+ await ShenaiSdkNativeModule.setPdfEmailBody(body);
352
+ }
353
+ export async function setShowStartStopButton(show) {
354
+ ensureNativeModuleAvailable();
355
+ await ShenaiSdkNativeModule.setShowStartStopButton(show);
356
+ }
357
+ export async function getShowStartStopButton() {
358
+ ensureNativeModuleAvailable();
359
+ return ShenaiSdkNativeModule.getShowStartStopButton();
360
+ }
361
+ export async function setEnableMeasurementsDashboard(enable) {
362
+ ensureNativeModuleAvailable();
363
+ await ShenaiSdkNativeModule.setEnableMeasurementsDashboard(enable);
364
+ }
365
+ export async function getEnableMeasurementsDashboard() {
366
+ ensureNativeModuleAvailable();
367
+ return ShenaiSdkNativeModule.getEnableMeasurementsDashboard();
368
+ }
369
+ export async function setShowInfoButton(show) {
370
+ ensureNativeModuleAvailable();
371
+ await ShenaiSdkNativeModule.setShowInfoButton(show);
372
+ }
373
+ export async function getShowInfoButton() {
374
+ ensureNativeModuleAvailable();
375
+ return ShenaiSdkNativeModule.getShowInfoButton();
376
+ }
377
+ export async function getShowDisclaimer() {
378
+ ensureNativeModuleAvailable();
379
+ return ShenaiSdkNativeModule.getShowDisclaimer();
380
+ }
381
+ export async function setEnableStartAfterSuccess(enableStartAfterSuccess) {
382
+ ensureNativeModuleAvailable();
383
+ await ShenaiSdkNativeModule.setEnableStartAfterSuccess(enableStartAfterSuccess);
384
+ }
385
+ export async function getEnableStartAfterSuccess() {
386
+ ensureNativeModuleAvailable();
387
+ return ShenaiSdkNativeModule.getEnableStartAfterSuccess();
388
+ }
389
+
390
+ //* ---- SDK face positioning ---- *//
391
+
392
+ export let FaceState = /*#__PURE__*/function (FaceState) {
393
+ FaceState[FaceState["OK"] = 0] = "OK";
394
+ FaceState[FaceState["TOO_FAR"] = 1] = "TOO_FAR";
395
+ FaceState[FaceState["TOO_CLOSE"] = 2] = "TOO_CLOSE";
396
+ FaceState[FaceState["NOT_CENTERED"] = 3] = "NOT_CENTERED";
397
+ FaceState[FaceState["NOT_VISIBLE"] = 4] = "NOT_VISIBLE";
398
+ FaceState[FaceState["UNKNOWN"] = 5] = "UNKNOWN";
399
+ return FaceState;
400
+ }({});
401
+ export async function getFaceState() {
402
+ ensureNativeModuleAvailable();
403
+ return ShenaiSdkNativeModule.getFaceState();
404
+ }
405
+ export async function getNormalizedFaceBbox() {
406
+ ensureNativeModuleAvailable();
407
+ return ShenaiSdkNativeModule.getNormalizedFaceBbox();
408
+ }
409
+
410
+ //* ---- SDK measurement state ---- *//
411
+
412
+ export let MeasurementState = /*#__PURE__*/function (MeasurementState) {
413
+ MeasurementState[MeasurementState["NOT_STARTED"] = 0] = "NOT_STARTED";
414
+ MeasurementState[MeasurementState["WAITING_FOR_FACE"] = 1] = "WAITING_FOR_FACE";
415
+ MeasurementState[MeasurementState["RUNNING_SIGNAL_SHORT"] = 2] = "RUNNING_SIGNAL_SHORT";
416
+ MeasurementState[MeasurementState["RUNNING_SIGNAL_GOOD"] = 3] = "RUNNING_SIGNAL_GOOD";
417
+ MeasurementState[MeasurementState["RUNNING_SIGNAL_BAD"] = 4] = "RUNNING_SIGNAL_BAD";
418
+ MeasurementState[MeasurementState["RUNNING_SIGNAL_BAD_DEVICE_UNSTABLE"] = 5] = "RUNNING_SIGNAL_BAD_DEVICE_UNSTABLE";
419
+ MeasurementState[MeasurementState["FINALIZING"] = 6] = "FINALIZING";
420
+ MeasurementState[MeasurementState["FINISHED"] = 7] = "FINISHED";
421
+ MeasurementState[MeasurementState["FAILED"] = 8] = "FAILED";
422
+ return MeasurementState;
423
+ }({});
424
+ export async function getMeasurementState() {
425
+ ensureNativeModuleAvailable();
426
+ return ShenaiSdkNativeModule.getMeasurementState();
427
+ }
428
+ export async function getMeasurementProgressPercentage() {
429
+ ensureNativeModuleAvailable();
430
+ return ShenaiSdkNativeModule.getMeasurementProgressPercentage();
431
+ }
432
+
433
+ //* ---- Event ---- *//
434
+
435
+ export let Event = /*#__PURE__*/function (Event) {
436
+ Event[Event["START_BUTTON_CLICKED"] = 0] = "START_BUTTON_CLICKED";
437
+ Event[Event["STOP_BUTTON_CLICKED"] = 1] = "STOP_BUTTON_CLICKED";
438
+ Event[Event["MEASUREMENT_FINISHED"] = 2] = "MEASUREMENT_FINISHED";
439
+ Event[Event["USER_FLOW_FINISHED"] = 3] = "USER_FLOW_FINISHED";
440
+ Event[Event["SCREEN_CHANGED"] = 4] = "SCREEN_CHANGED";
441
+ return Event;
442
+ }({});
443
+
444
+ /* ---- SDK measurement results ---- */
445
+
446
+ export async function getHeartRate10s() {
447
+ ensureNativeModuleAvailable();
448
+ return ShenaiSdkNativeModule.getHeartRate10s();
449
+ }
450
+ export async function getHeartRate4s() {
451
+ ensureNativeModuleAvailable();
452
+ return ShenaiSdkNativeModule.getHeartRate4s();
453
+ }
454
+ export async function getRealtimeMetrics(periodSec) {
455
+ ensureNativeModuleAvailable();
456
+ return ShenaiSdkNativeModule.getRealtimeMetrics(periodSec);
457
+ }
458
+ export async function getMeasurementResults() {
459
+ ensureNativeModuleAvailable();
460
+ return ShenaiSdkNativeModule.getMeasurementResults();
461
+ }
462
+ export async function getMeasurementResultsHistory() {
463
+ ensureNativeModuleAvailable();
464
+ return ShenaiSdkNativeModule.getMeasurementResultsHistory();
465
+ }
466
+ export async function getResultAsFhirObservation() {
467
+ ensureNativeModuleAvailable();
468
+ return ShenaiSdkNativeModule.getResultAsFhirObservation();
469
+ }
470
+ export async function sendResultFhirObservation(url) {
471
+ ensureNativeModuleAvailable();
472
+ const response = await ShenaiSdkNativeModule.sendResultFhirObservation(url);
473
+ return response ?? null;
474
+ }
475
+
476
+ //* ---- SDK signals ---- *//
477
+
478
+ export async function getHeartRateHistory10s(maxTimeSec) {
479
+ ensureNativeModuleAvailable();
480
+ return ShenaiSdkNativeModule.getHeartRateHistory10s(maxTimeSec);
481
+ }
482
+ export async function getHeartRateHistory4s(maxTimeSec) {
483
+ ensureNativeModuleAvailable();
484
+ return ShenaiSdkNativeModule.getHeartRateHistory4s(maxTimeSec);
485
+ }
486
+ export async function getRealtimeHeartbeats(periodSec) {
487
+ ensureNativeModuleAvailable();
488
+ return ShenaiSdkNativeModule.getRealtimeHeartbeats(periodSec);
489
+ }
490
+ export async function getFullPpgSignal() {
491
+ ensureNativeModuleAvailable();
492
+ return ShenaiSdkNativeModule.getFullPpgSignal();
493
+ }
494
+
495
+ //* ---- SDK recording ---- *//
496
+
497
+ export async function setRecordingEnabled(enabled) {
498
+ ensureNativeModuleAvailable();
499
+ await ShenaiSdkNativeModule.setRecordingEnabled(enabled);
500
+ }
501
+ export async function getRecordingEnabled() {
502
+ ensureNativeModuleAvailable();
503
+ return ShenaiSdkNativeModule.getRecordingEnabled();
504
+ }
505
+
506
+ //* ---- SDK quality control ---- *//
507
+
508
+ export async function getTotalBadSignalSeconds() {
509
+ ensureNativeModuleAvailable();
510
+ return ShenaiSdkNativeModule.getTotalBadSignalSeconds();
511
+ }
512
+ export async function getCurrentSignalQualityMetric() {
513
+ ensureNativeModuleAvailable();
514
+ return ShenaiSdkNativeModule.getCurrentSignalQualityMetric();
515
+ }
516
+
517
+ //* ---- SDK visualizations ---- *//
518
+
519
+ export async function getSignalQualityMapPng() {
520
+ ensureNativeModuleAvailable();
521
+ return ShenaiSdkNativeModule.getSignalQualityMapPng();
522
+ }
523
+ export async function getFaceTexturePng() {
524
+ ensureNativeModuleAvailable();
525
+ return ShenaiSdkNativeModule.getFaceTexturePng();
526
+ }
527
+ export async function setLanguage(language) {
528
+ ensureNativeModuleAvailable();
529
+ await ShenaiSdkNativeModule.setLanguage(language);
530
+ }
531
+
532
+ //* ---- Health Risks ---- *//
533
+
534
+ export let Gender = /*#__PURE__*/function (Gender) {
535
+ Gender[Gender["MALE"] = 0] = "MALE";
536
+ Gender[Gender["FEMALE"] = 1] = "FEMALE";
537
+ Gender[Gender["OTHER"] = 2] = "OTHER";
538
+ return Gender;
539
+ }({});
540
+ export let PhysicalActivity = /*#__PURE__*/function (PhysicalActivity) {
541
+ PhysicalActivity[PhysicalActivity["SEDENTARY"] = 0] = "SEDENTARY";
542
+ PhysicalActivity[PhysicalActivity["LIGHTLY_ACTIVE"] = 1] = "LIGHTLY_ACTIVE";
543
+ PhysicalActivity[PhysicalActivity["MODERATELY"] = 2] = "MODERATELY";
544
+ PhysicalActivity[PhysicalActivity["VERY_ACTIVE"] = 3] = "VERY_ACTIVE";
545
+ PhysicalActivity[PhysicalActivity["EXTRA_ACTIVE"] = 4] = "EXTRA_ACTIVE";
546
+ return PhysicalActivity;
547
+ }({});
548
+ export let Race = /*#__PURE__*/function (Race) {
549
+ Race[Race["WHITE"] = 0] = "WHITE";
550
+ Race[Race["AFRICAN_AMERICAN"] = 1] = "AFRICAN_AMERICAN";
551
+ Race[Race["OTHER"] = 2] = "OTHER";
552
+ return Race;
553
+ }({});
554
+ export let HypertensionTreatment = /*#__PURE__*/function (HypertensionTreatment) {
555
+ HypertensionTreatment[HypertensionTreatment["NOT_NEEDED"] = 0] = "NOT_NEEDED";
556
+ HypertensionTreatment[HypertensionTreatment["NO"] = 1] = "NO";
557
+ HypertensionTreatment[HypertensionTreatment["YES"] = 2] = "YES";
558
+ return HypertensionTreatment;
559
+ }({});
560
+ export let ParentalHistory = /*#__PURE__*/function (ParentalHistory) {
561
+ ParentalHistory[ParentalHistory["NONE"] = 0] = "NONE";
562
+ ParentalHistory[ParentalHistory["ONE"] = 1] = "ONE";
563
+ ParentalHistory[ParentalHistory["BOTH"] = 2] = "BOTH";
564
+ return ParentalHistory;
565
+ }({});
566
+ export let FamilyHistory = /*#__PURE__*/function (FamilyHistory) {
567
+ FamilyHistory[FamilyHistory["NONE"] = 0] = "NONE";
568
+ FamilyHistory[FamilyHistory["NONE_FIRST_DEGREE"] = 1] = "NONE_FIRST_DEGREE";
569
+ FamilyHistory[FamilyHistory["FIRST_DEGREE"] = 2] = "FIRST_DEGREE";
570
+ return FamilyHistory;
571
+ }({});
572
+ export let NAFLDRisk = /*#__PURE__*/function (NAFLDRisk) {
573
+ NAFLDRisk[NAFLDRisk["LOW"] = 0] = "LOW";
574
+ NAFLDRisk[NAFLDRisk["MODERATE"] = 1] = "MODERATE";
575
+ NAFLDRisk[NAFLDRisk["HIGH"] = 2] = "HIGH";
576
+ return NAFLDRisk;
577
+ }({});
578
+ export async function getHealthRisksFactors() {
579
+ ensureNativeModuleAvailable();
580
+ return ShenaiSdkNativeModule.getHealthRisksFactors();
581
+ }
582
+ export async function clearHealthRisksFactors() {
583
+ ensureNativeModuleAvailable();
584
+ await ShenaiSdkNativeModule.clearHealthRisksFactors();
585
+ }
586
+ export async function getHealthRisks() {
587
+ ensureNativeModuleAvailable();
588
+ return ShenaiSdkNativeModule.getHealthRisks();
589
+ }
590
+ export async function computeHealthRisks(factors) {
591
+ ensureNativeModuleAvailable();
592
+ return ShenaiSdkNativeModule.computeHealthRisks(factors);
593
+ }
594
+ export async function getMaximalRisks(factors) {
595
+ ensureNativeModuleAvailable();
596
+ return ShenaiSdkNativeModule.getMaximalRisks(factors);
597
+ }
598
+ export async function getMinimalRisks(factors) {
599
+ ensureNativeModuleAvailable();
600
+ return ShenaiSdkNativeModule.getMinimalRisks(factors);
601
+ }
602
+ export async function getReferenceRisks(factors) {
603
+ ensureNativeModuleAvailable();
604
+ return ShenaiSdkNativeModule.getReferenceRisks(factors);
605
+ }
606
+ export async function openMeasurementResultsPdfInBrowser() {
607
+ ensureNativeModuleAvailable();
608
+ await ShenaiSdkNativeModule.openMeasurementResultsPdfInBrowser();
609
+ }
610
+ export async function sendMeasurementResultsPdfToEmail(email) {
611
+ ensureNativeModuleAvailable();
612
+ await ShenaiSdkNativeModule.sendMeasurementResultsPdfToEmail(email);
613
+ }
614
+ export async function requestMeasurementResultsPdfUrl() {
615
+ ensureNativeModuleAvailable();
616
+ await ShenaiSdkNativeModule.requestMeasurementResultsPdfUrl();
617
+ }
618
+ export async function getMeasurementResultsPdfUrl() {
619
+ ensureNativeModuleAvailable();
620
+ return ShenaiSdkNativeModule.getMeasurementResultsPdfUrl();
621
+ }
622
+ export async function requestMeasurementResultsPdfBytes() {
623
+ ensureNativeModuleAvailable();
624
+ await ShenaiSdkNativeModule.requestMeasurementResultsPdfBytes();
625
+ }
626
+ function decodeBase64ToUint8Array(base64) {
627
+ const padding = base64.endsWith("==") ? 2 : base64.endsWith("=") ? 1 : 0;
628
+ const outputLength = Math.floor(base64.length * 3 / 4) - padding;
629
+ const bytes = new Uint8Array(outputLength);
630
+ let buffer = 0;
631
+ let bitsCollected = 0;
632
+ let outputIndex = 0;
633
+ for (let index = 0; index < base64.length; index += 1) {
634
+ const charCode = base64.charCodeAt(index);
635
+ if (charCode === 61) {
636
+ break;
637
+ }
638
+ if (charCode >= BASE64_LOOKUP.length) {
639
+ continue;
640
+ }
641
+ const value = BASE64_LOOKUP[charCode];
642
+ if (value === undefined || value < 0) {
643
+ continue;
644
+ }
645
+ buffer = buffer << 6 | value;
646
+ bitsCollected += 6;
647
+ if (bitsCollected < 8) {
648
+ continue;
649
+ }
650
+ bitsCollected -= 8;
651
+ bytes[outputIndex] = buffer >> bitsCollected & 0xff;
652
+ outputIndex += 1;
653
+ }
654
+ return bytes;
655
+ }
656
+ export async function getMeasurementResultsPdfBytes() {
657
+ ensureNativeModuleAvailable();
658
+ const response = await ShenaiSdkNativeModule.getMeasurementResultsPdfBytes();
659
+ if (typeof response === "string" && response.length > 0) {
660
+ return Array.from(decodeBase64ToUint8Array(response));
661
+ }
662
+ if (Array.isArray(response)) {
663
+ return response;
664
+ }
665
+ return null;
666
+ }
667
+ export * from "./hooks";