@rexai/pulse-react 1.0.1 → 2.0.0

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/dist/index.mjs CHANGED
@@ -382,6 +382,40 @@ var PulseClient = class {
382
382
  const response = await this.request("/analyze/beauty", formData);
383
383
  return response;
384
384
  }
385
+ /**
386
+ * Analyze audio for voice health biomarkers
387
+ * Returns stress, fatigue, respiratory rate, cognitive load, and wellness scores.
388
+ *
389
+ * @example
390
+ * ```typescript
391
+ * const voiceResult = await client.analyzeVoice({ audio: audioBlob });
392
+ * console.log(voiceResult.stress_score);
393
+ * console.log(voiceResult.respiratory_rate);
394
+ * ```
395
+ */
396
+ async analyzeVoice(options) {
397
+ const formData = new FormData();
398
+ formData.append("audio", options.audio, "voice_recording.webm");
399
+ const response = await this.request("/analyze-voice", formData);
400
+ return response;
401
+ }
402
+ /**
403
+ * Analyze video for eye health screening
404
+ * Returns cataract risk, red eye detection, lens clarity, pupil analysis, and more.
405
+ *
406
+ * @example
407
+ * ```typescript
408
+ * const eyeResult = await client.analyzeEye({ video: videoBlob });
409
+ * console.log(eyeResult.overall_score);
410
+ * console.log(eyeResult.cataract.risk_level);
411
+ * ```
412
+ */
413
+ async analyzeEye(options) {
414
+ const formData = new FormData();
415
+ formData.append("video", options.video, "eye_scan.webm");
416
+ const response = await this.request("/analyze/eye", formData);
417
+ return response;
418
+ }
385
419
  /**
386
420
  * Check API health status
387
421
  */
@@ -651,6 +685,15 @@ var PulseScanner = ({
651
685
 
652
686
  // src/components/VitalsCard.tsx
653
687
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
688
+ function nullToUndefined(value) {
689
+ return value === null ? void 0 : value;
690
+ }
691
+ function extractNumeric(result) {
692
+ if (result === null || result === void 0) return void 0;
693
+ if (typeof result === "number") return result;
694
+ const val = result.score ?? result.value ?? result.spo2 ?? result.rate ?? null;
695
+ return val === null ? void 0 : val;
696
+ }
654
697
  function getHeartRateStatus(hr) {
655
698
  if (hr < 55) return { label: "Low", color: "blue" };
656
699
  if (hr > 100) return { label: "Elevated", color: "orange" };
@@ -671,14 +714,14 @@ function getHrvStatus(hrv) {
671
714
  return { label: "Balanced", color: "blue" };
672
715
  }
673
716
  var VitalsCard = ({
674
- heartRate,
675
- spo2,
676
- stressIndex,
677
- hrvSdnn,
678
- hrvRmssd,
679
- respiratoryRate,
680
- bloodPressure,
681
- recoveryScore,
717
+ heartRate: heartRateProp,
718
+ spo2: spo2Prop,
719
+ stressIndex: stressIndexProp,
720
+ hrvSdnn: hrvSdnnProp,
721
+ hrvRmssd: hrvRmssdProp,
722
+ respiratoryRate: respiratoryRateProp,
723
+ bloodPressure: bloodPressureProp,
724
+ recoveryScore: recoveryScoreProp,
682
725
  loading = false,
683
726
  error = null,
684
727
  compact = false,
@@ -686,6 +729,14 @@ var VitalsCard = ({
686
729
  className = "",
687
730
  theme = "light"
688
731
  }) => {
732
+ const heartRate = nullToUndefined(heartRateProp);
733
+ const spo2 = nullToUndefined(spo2Prop);
734
+ const stressIndex = nullToUndefined(stressIndexProp);
735
+ const hrvSdnn = nullToUndefined(hrvSdnnProp);
736
+ const hrvRmssd = nullToUndefined(hrvRmssdProp);
737
+ const respiratoryRate = nullToUndefined(respiratoryRateProp);
738
+ const bloodPressure = nullToUndefined(bloodPressureProp);
739
+ const recoveryScore = nullToUndefined(recoveryScoreProp);
689
740
  if (loading) {
690
741
  return /* @__PURE__ */ jsxs2("div", { className: `vitals-card vitals-card--loading vitals-card--${theme} ${className}`, children: [
691
742
  /* @__PURE__ */ jsx2("div", { className: "vitals-card__spinner" }),
@@ -775,24 +826,28 @@ var VitalsCardFromResult = ({ result, ...props }) => {
775
826
  if (!result) {
776
827
  return /* @__PURE__ */ jsx2(VitalsCard, { ...props });
777
828
  }
829
+ const spo2Value = extractNumeric(result.spo2);
830
+ const stressValue = extractNumeric(result.stress_index);
831
+ const respiratoryValue = extractNumeric(result.respiratory_rate);
832
+ const recoveryValue = extractNumeric(result.recovery_score);
778
833
  return /* @__PURE__ */ jsx2(
779
834
  VitalsCard,
780
835
  {
781
836
  heartRate: result.heart_rate,
782
- spo2: result.spo2,
783
- stressIndex: result.stress_index,
837
+ spo2: spo2Value,
838
+ stressIndex: stressValue,
784
839
  hrvSdnn: result.hrv_sdnn,
785
840
  hrvRmssd: result.hrv_rmssd,
786
- respiratoryRate: result.respiratory_rate,
841
+ respiratoryRate: respiratoryValue,
787
842
  bloodPressure: result.blood_pressure,
788
- recoveryScore: result.recovery_score,
843
+ recoveryScore: recoveryValue,
789
844
  ...props
790
845
  }
791
846
  );
792
847
  };
793
848
 
794
849
  // src/index.ts
795
- var VERSION = "1.0.0";
850
+ var VERSION = "1.2.0";
796
851
  export {
797
852
  PulseClient,
798
853
  PulseScanner,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rexai/pulse-react",
3
- "version": "1.0.1",
4
- "description": "React SDK for rPPG health analysis - measure heart rate, HRV, SpO2 from any camera",
3
+ "version": "2.0.0",
4
+ "description": "React SDK for rPPG health analysis - measure heart rate, HRV, SpO2, voice biomarkers from any camera",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
@@ -55,7 +55,11 @@
55
55
  "react",
56
56
  "telehealth",
57
57
  "telemedicine",
58
- "rexai"
58
+ "rexai",
59
+ "voice-analysis",
60
+ "respiratory",
61
+ "stress-detection",
62
+ "wellness"
59
63
  ],
60
64
  "author": "RexAI",
61
65
  "license": "MIT",