obi-sdk 0.13.3 → 0.14.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/react.es.js CHANGED
@@ -16659,7 +16659,7 @@ class Bw {
16659
16659
  }).with("share_screen", () => {
16660
16660
  this.emitter.emit("screenShareRequested");
16661
16661
  }).with("prompt_user", () => {
16662
- this.emitter.emit("promptUser");
16662
+ console.log("[obi] prompt user received"), this.emitter.emit("promptUser");
16663
16663
  }).with("capture_page_html", () => {
16664
16664
  this.emitter.emit("capturePageHTML");
16665
16665
  }).with("fill", () => {
@@ -16685,7 +16685,7 @@ class Bw {
16685
16685
  t("error");
16686
16686
  }
16687
16687
  });
16688
- }))));
16688
+ }))), this.room.localParticipant.registerRpcMethod("mic_check", async (e) => await this.checkMic() ? "ok" : "error"));
16689
16689
  }
16690
16690
  /**
16691
16691
  * Connect to the LiveKit room.
@@ -16726,6 +16726,15 @@ class Bw {
16726
16726
  getCurrentState() {
16727
16727
  return this.currentState;
16728
16728
  }
16729
+ async checkMic() {
16730
+ let e = !1;
16731
+ try {
16732
+ e = (await navigator.permissions.query({ name: "microphone" })).state === "granted";
16733
+ } catch (t) {
16734
+ console.error("[obi] error checking microphone permission:", t);
16735
+ }
16736
+ return e && await this.shareMic(), this.emitter.emit("micCheck", e), e;
16737
+ }
16729
16738
  async requestMicrophone() {
16730
16739
  try {
16731
16740
  const e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
@@ -31920,7 +31929,7 @@ let he = class extends Z {
31920
31929
  componentName: "ObiWidget",
31921
31930
  handlerName: "handleSessionStart",
31922
31931
  sessionToken: e
31923
- }), this.activeSession.disconnect(), this.activeSession = null), this.showSessionStartModal = !1, this.showShareMicModal = !0, this.state = M.LOADING, er({ widgetState: this.state.toString() }), await this.connectObi(e);
31932
+ }), this.activeSession.disconnect(), this.activeSession = null), this.showSessionStartModal = !1, this.showVoiceGuidanceModal = !0, this.state = M.LOADING, er({ widgetState: this.state.toString() }), await this.connectObi(e);
31924
31933
  },
31925
31934
  "handleSessionStart",
31926
31935
  "ObiWidget"
@@ -32148,8 +32157,12 @@ let he = class extends Z {
32148
32157
  console.error("Session error:", n), this.state = M.ERROR, this.activeSession = null, t && t();
32149
32158
  }), e.on("micShareRequested", () => {
32150
32159
  this.micShareEnabled = !0;
32160
+ }), e.on("micCheck", (n) => {
32161
+ n ? (this.showVoiceGuidanceModal = !1, this.showShareMicModal = !0) : (this.showShareMicModal = !0, this.showVoiceGuidanceModal = !1);
32151
32162
  }), e.on("promptUser", () => {
32152
32163
  this.voiceGuidanceEnabled = !0;
32164
+ }), e.on("micCheck", (n) => {
32165
+ n && (this.showVoiceGuidanceModal = !0, this.showShareMicModal = !1);
32153
32166
  });
32154
32167
  }
32155
32168
  /**