@quan-erp/shared-frontend-core 1.0.11 → 1.1.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.js CHANGED
@@ -1584,13 +1584,22 @@ class Vibration {
1584
1584
 
1585
1585
  class WebMicrophone {
1586
1586
  stream = null;
1587
+ audioConstraints() {
1588
+ return {
1589
+ audio: {
1590
+ echoCancellation: true,
1591
+ noiseSuppression: true,
1592
+ autoGainControl: true,
1593
+ },
1594
+ };
1595
+ }
1587
1596
  async requestPermission() {
1588
1597
  try {
1589
1598
  const status = await browserOrignalNavigator.permissions.query({ name: "microphone" });
1590
1599
  if (status.state === "granted")
1591
1600
  return true;
1592
1601
  // Request permission
1593
- await browserOrignalNavigator.mediaDevices.getUserMedia({ audio: true });
1602
+ await browserOrignalNavigator.mediaDevices.getUserMedia(this.audioConstraints());
1594
1603
  return true;
1595
1604
  }
1596
1605
  catch (err) {
@@ -1599,7 +1608,7 @@ class WebMicrophone {
1599
1608
  }
1600
1609
  }
1601
1610
  async start() {
1602
- this.stream = await browserOrignalNavigator.mediaDevices.getUserMedia({ audio: true });
1611
+ this.stream = await browserOrignalNavigator.mediaDevices.getUserMedia(this.audioConstraints());
1603
1612
  }
1604
1613
  stop() {
1605
1614
  if (this.stream) {
@@ -1617,7 +1626,13 @@ class CapacitorMicrophone {
1617
1626
  stream = null;
1618
1627
  async start() {
1619
1628
  // This automatically triggers OS permission UI
1620
- this.stream = await browserOrignalNavigator.mediaDevices.getUserMedia({ audio: true });
1629
+ this.stream = await browserOrignalNavigator.mediaDevices.getUserMedia({
1630
+ audio: {
1631
+ echoCancellation: true,
1632
+ noiseSuppression: true,
1633
+ autoGainControl: true,
1634
+ },
1635
+ });
1621
1636
  }
1622
1637
  async requestPermission() {
1623
1638
  return true;
@@ -13,6 +13,7 @@ export interface IMicrophone {
13
13
  }
14
14
  declare class WebMicrophone implements IMicrophone {
15
15
  private stream;
16
+ private audioConstraints;
16
17
  requestPermission(): Promise<boolean>;
17
18
  start(): Promise<void>;
18
19
  stop(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quan-erp/shared-frontend-core",
3
- "version": "1.0.11",
3
+ "version": "1.1.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "publish:registry": "npm run build && npm publish --tag beta",
@@ -62,7 +62,7 @@
62
62
  "@capacitor/preferences": "^7.0.2",
63
63
  "@fingerprintjs/fingerprintjs": "^4.6.2",
64
64
  "@quan-erp-capacitor-pluigins/background-location": "1.0.0",
65
- "@quan-erp/shared-types": "1.0.11",
65
+ "@quan-erp/shared-types": "1.1.0",
66
66
  "@tanstack/react-query": "^5.90.10",
67
67
  "axios": "^1.13.2",
68
68
  "react": "19.2.6",