obi-sdk 0.13.2 → 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/modular/chunks/index-01b0e3f3.js +6 -0
- package/dist/modular/chunks/index-01b0e3f3.js.map +1 -0
- package/dist/modular/chunks/{obi-widget-d8354869.js → obi-widget-aa83cfb0.js} +74 -52
- package/dist/modular/chunks/obi-widget-aa83cfb0.js.map +1 -0
- package/dist/modular/index.js +1 -1
- package/dist/modular/ui.js +10 -10
- package/dist/obi-sdk.standalone.iife.js +34 -37
- package/dist/obi-sdk.standalone.iife.js.map +1 -1
- package/dist/react.es.js +288 -284
- package/dist/react.es.js.map +1 -1
- package/dist/react.umd.js +87 -90
- package/dist/react.umd.js.map +1 -1
- package/dist/ui/components/obi-widget/obi-widget.d.ts +0 -1
- package/package.json +4 -4
- package/dist/modular/chunks/index-a668ac46.js +0 -6
- package/dist/modular/chunks/index-a668ac46.js.map +0 -1
- package/dist/modular/chunks/obi-widget-d8354869.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-01b0e3f3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -747,6 +747,7 @@ class ObiSession {
|
|
|
747
747
|
}).with("share_screen", () => {
|
|
748
748
|
this.emitter.emit("screenShareRequested");
|
|
749
749
|
}).with("prompt_user", () => {
|
|
750
|
+
console.log("[obi] prompt user received");
|
|
750
751
|
this.emitter.emit("promptUser");
|
|
751
752
|
}).with("capture_page_html", () => {
|
|
752
753
|
this.emitter.emit("capturePageHTML");
|
|
@@ -779,6 +780,13 @@ class ObiSession {
|
|
|
779
780
|
});
|
|
780
781
|
});
|
|
781
782
|
});
|
|
783
|
+
this.room.localParticipant.registerRpcMethod("mic_check", async (data) => {
|
|
784
|
+
if (await this.checkMic()) {
|
|
785
|
+
return "ok";
|
|
786
|
+
} else {
|
|
787
|
+
return "error";
|
|
788
|
+
}
|
|
789
|
+
});
|
|
782
790
|
}
|
|
783
791
|
/**
|
|
784
792
|
* Connect to the LiveKit room.
|
|
@@ -854,6 +862,20 @@ class ObiSession {
|
|
|
854
862
|
getCurrentState() {
|
|
855
863
|
return this.currentState;
|
|
856
864
|
}
|
|
865
|
+
async checkMic() {
|
|
866
|
+
let permissionGranted = false;
|
|
867
|
+
try {
|
|
868
|
+
const permStatus = await navigator.permissions.query({ name: "microphone" });
|
|
869
|
+
permissionGranted = permStatus.state === "granted";
|
|
870
|
+
} catch (error) {
|
|
871
|
+
console.error("[obi] error checking microphone permission:", error);
|
|
872
|
+
}
|
|
873
|
+
if (permissionGranted) {
|
|
874
|
+
await this.shareMic();
|
|
875
|
+
}
|
|
876
|
+
this.emitter.emit("micCheck", permissionGranted);
|
|
877
|
+
return permissionGranted;
|
|
878
|
+
}
|
|
857
879
|
async requestMicrophone() {
|
|
858
880
|
try {
|
|
859
881
|
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
@@ -20959,7 +20981,6 @@ class ObiWidget extends i$1 {
|
|
|
20959
20981
|
};
|
|
20960
20982
|
this.databaseConfig = null;
|
|
20961
20983
|
this.configLoaded = false;
|
|
20962
|
-
this.configAllInCode = false;
|
|
20963
20984
|
this.primaryColor = "#9500FF";
|
|
20964
20985
|
this.sessionToken = null;
|
|
20965
20986
|
this.roomToken = null;
|
|
@@ -21153,7 +21174,7 @@ class ObiWidget extends i$1 {
|
|
|
21153
21174
|
this.activeSession = null;
|
|
21154
21175
|
}
|
|
21155
21176
|
this.showSessionStartModal = false;
|
|
21156
|
-
this.
|
|
21177
|
+
this.showVoiceGuidanceModal = true;
|
|
21157
21178
|
this.state = SDKState.LOADING;
|
|
21158
21179
|
setGlobalContext({ widgetState: this.state.toString() });
|
|
21159
21180
|
await this.connectObi(sessionToken);
|
|
@@ -21189,7 +21210,9 @@ class ObiWidget extends i$1 {
|
|
|
21189
21210
|
}
|
|
21190
21211
|
if (!this.selectedCourse.id) {
|
|
21191
21212
|
const error = "Session ID is missing.";
|
|
21192
|
-
console.error("[SessionStartModal] Validation failed:", error, {
|
|
21213
|
+
console.error("[SessionStartModal] Validation failed:", error, {
|
|
21214
|
+
session: this.selectedCourse
|
|
21215
|
+
});
|
|
21193
21216
|
captureException(error, {
|
|
21194
21217
|
componentName: "SessionStartModal",
|
|
21195
21218
|
handlerName: "handleSessionModalStart",
|
|
@@ -21411,17 +21434,7 @@ class ObiWidget extends i$1 {
|
|
|
21411
21434
|
if (window.obiWidgetConfig.urlBlacklist !== void 0) {
|
|
21412
21435
|
this.urlBlacklist = window.obiWidgetConfig.urlBlacklist;
|
|
21413
21436
|
}
|
|
21414
|
-
|
|
21415
|
-
const hasPrimaryColor = window.obiWidgetConfig.primaryColor !== void 0;
|
|
21416
|
-
const hasLinkOnlyAccess = window.obiWidgetConfig.linkOnlyAccess !== void 0;
|
|
21417
|
-
const hasUrlBlacklist = window.obiWidgetConfig.urlBlacklist !== void 0;
|
|
21418
|
-
this.configAllInCode = hasPosition && hasPrimaryColor && hasLinkOnlyAccess && hasUrlBlacklist;
|
|
21419
|
-
if (this.configAllInCode) {
|
|
21420
|
-
this.configLoaded = true;
|
|
21421
|
-
this.applyFinalConfiguration();
|
|
21422
|
-
} else if (!this.configLoaded) {
|
|
21423
|
-
this.fetchDatabaseConfig();
|
|
21424
|
-
}
|
|
21437
|
+
this.fetchDatabaseConfig();
|
|
21425
21438
|
if (window.obiWidgetConfig.showMenu === true) {
|
|
21426
21439
|
this.state = SDKState.LOADING;
|
|
21427
21440
|
this.showCourseModal = true;
|
|
@@ -21523,9 +21536,24 @@ class ObiWidget extends i$1 {
|
|
|
21523
21536
|
session.on("micShareRequested", () => {
|
|
21524
21537
|
this.micShareEnabled = true;
|
|
21525
21538
|
});
|
|
21539
|
+
session.on("micCheck", (permissionGranted) => {
|
|
21540
|
+
if (permissionGranted) {
|
|
21541
|
+
this.showVoiceGuidanceModal = false;
|
|
21542
|
+
this.showShareMicModal = true;
|
|
21543
|
+
} else {
|
|
21544
|
+
this.showShareMicModal = true;
|
|
21545
|
+
this.showVoiceGuidanceModal = false;
|
|
21546
|
+
}
|
|
21547
|
+
});
|
|
21526
21548
|
session.on("promptUser", () => {
|
|
21527
21549
|
this.voiceGuidanceEnabled = true;
|
|
21528
21550
|
});
|
|
21551
|
+
session.on("micCheck", (permissionGranted) => {
|
|
21552
|
+
if (permissionGranted) {
|
|
21553
|
+
this.showVoiceGuidanceModal = true;
|
|
21554
|
+
this.showShareMicModal = false;
|
|
21555
|
+
}
|
|
21556
|
+
});
|
|
21529
21557
|
}
|
|
21530
21558
|
/**
|
|
21531
21559
|
* Handle session creation failure
|
|
@@ -21834,63 +21862,60 @@ class ObiWidget extends i$1 {
|
|
|
21834
21862
|
></obi-navigation-bar>
|
|
21835
21863
|
` : E$1}
|
|
21836
21864
|
</div>
|
|
21837
|
-
|
|
21865
|
+
|
|
21838
21866
|
${this.showCourseModal ? x`<obi-course-modal
|
|
21839
21867
|
.onClose=${this.handleCloseModals.bind(this)}
|
|
21840
21868
|
.apiKey=${this.apiKey}
|
|
21841
21869
|
@course-select=${this.handleCourseSelectEvent}
|
|
21842
21870
|
></obi-course-modal>` : E$1}
|
|
21843
|
-
|
|
21844
21871
|
${this.showSessionStartModal && !!this.selectedCourse ? x`
|
|
21845
|
-
|
|
21846
|
-
|
|
21872
|
+
<obi-session-start-modal
|
|
21873
|
+
.session=${this.selectedCourse ? {
|
|
21847
21874
|
id: this.selectedCourse.id,
|
|
21848
21875
|
name: this.selectedCourse.name,
|
|
21849
21876
|
description: this.selectedCourse.description,
|
|
21850
21877
|
agentName: this.databaseConfig?.agentName
|
|
21851
21878
|
} : {}}
|
|
21852
|
-
|
|
21853
|
-
|
|
21854
|
-
|
|
21855
|
-
|
|
21856
|
-
|
|
21857
|
-
|
|
21858
|
-
|
|
21859
|
-
|
|
21860
|
-
|
|
21879
|
+
?open=${this.showSessionStartModal && !!this.selectedCourse}
|
|
21880
|
+
color=${this.primaryColor}
|
|
21881
|
+
@obi-start=${this.handleSessionModalStart}
|
|
21882
|
+
@obi-close=${this.handleSessionModalClose}
|
|
21883
|
+
@obi-error=${this.handleSessionModalError}
|
|
21884
|
+
>
|
|
21885
|
+
</obi-session-start-modal>
|
|
21886
|
+
` : E$1}
|
|
21861
21887
|
${this.showShareMicModal ? x`
|
|
21862
|
-
|
|
21863
|
-
|
|
21888
|
+
<obi-share-mic-modal
|
|
21889
|
+
.session=${this.selectedCourse ? {
|
|
21864
21890
|
id: this.selectedCourse.id,
|
|
21865
21891
|
name: this.selectedCourse.name,
|
|
21866
21892
|
description: this.selectedCourse.description,
|
|
21867
21893
|
agentName: this.databaseConfig?.agentName
|
|
21868
21894
|
} : {}}
|
|
21869
|
-
|
|
21870
|
-
|
|
21871
|
-
|
|
21872
|
-
|
|
21873
|
-
|
|
21874
|
-
|
|
21875
|
-
|
|
21876
|
-
|
|
21877
|
-
|
|
21895
|
+
?open=${this.showShareMicModal}
|
|
21896
|
+
?disabled=${!this.micShareEnabled}
|
|
21897
|
+
color=${this.primaryColor}
|
|
21898
|
+
@obi-continue=${this.handleShareMicModalContinue}
|
|
21899
|
+
@obi-close=${this.handleShareMicModalClose}
|
|
21900
|
+
>
|
|
21901
|
+
</obi-share-mic-modal>
|
|
21902
|
+
` : E$1}
|
|
21878
21903
|
${this.showVoiceGuidanceModal ? x`
|
|
21879
|
-
|
|
21880
|
-
|
|
21904
|
+
<obi-voice-guidance-modal
|
|
21905
|
+
.session=${this.selectedCourse ? {
|
|
21881
21906
|
id: this.selectedCourse.id,
|
|
21882
21907
|
name: this.selectedCourse.name,
|
|
21883
21908
|
description: this.selectedCourse.description,
|
|
21884
21909
|
agentName: this.databaseConfig?.agentName
|
|
21885
21910
|
} : {}}
|
|
21886
|
-
|
|
21887
|
-
|
|
21888
|
-
|
|
21889
|
-
|
|
21890
|
-
|
|
21891
|
-
|
|
21892
|
-
|
|
21893
|
-
|
|
21911
|
+
?open=${this.showVoiceGuidanceModal}
|
|
21912
|
+
?disabled=${!this.voiceGuidanceEnabled}
|
|
21913
|
+
color=${this.primaryColor}
|
|
21914
|
+
@obi-continue=${this.handleVoiceGuidanceModalContinue}
|
|
21915
|
+
@obi-close=${this.handleVoiceGuidanceModalClose}
|
|
21916
|
+
>
|
|
21917
|
+
</obi-voice-guidance-modal>
|
|
21918
|
+
` : E$1}
|
|
21894
21919
|
`;
|
|
21895
21920
|
}
|
|
21896
21921
|
}
|
|
@@ -22107,9 +22132,6 @@ __decorateClass([
|
|
|
22107
22132
|
__decorateClass([
|
|
22108
22133
|
r$1()
|
|
22109
22134
|
], ObiWidget.prototype, "configLoaded", 2);
|
|
22110
|
-
__decorateClass([
|
|
22111
|
-
r$1()
|
|
22112
|
-
], ObiWidget.prototype, "configAllInCode", 2);
|
|
22113
22135
|
__decorateClass([
|
|
22114
22136
|
r$1()
|
|
22115
22137
|
], ObiWidget.prototype, "primaryColor", 2);
|
|
@@ -22143,4 +22165,4 @@ export {
|
|
|
22143
22165
|
withSentryAsyncHandler as w,
|
|
22144
22166
|
x
|
|
22145
22167
|
};
|
|
22146
|
-
//# sourceMappingURL=obi-widget-
|
|
22168
|
+
//# sourceMappingURL=obi-widget-aa83cfb0.js.map
|