obi-sdk 0.1.1 → 0.1.3
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/README.md +111 -70
- package/dist/modular/chunks/obi-widget-9c0306f4.js +6369 -0
- package/dist/modular/chunks/obi-widget-9c0306f4.js.map +1 -0
- package/dist/modular/chunks/session-37970ed1.js +22168 -0
- package/dist/modular/chunks/session-37970ed1.js.map +1 -0
- package/dist/modular/core.js +241 -0
- package/dist/modular/core.js.map +1 -0
- package/dist/modular/index.js +414 -0
- package/dist/modular/index.js.map +1 -0
- package/dist/modular/ui.js +252 -0
- package/dist/modular/ui.js.map +1 -0
- package/dist/obi-loader.iife.js +2 -0
- package/dist/obi-loader.iife.js.map +1 -0
- package/dist/obi-loader.js +86 -0
- package/dist/obi-loader.js.map +1 -0
- package/dist/obi-loader.umd.cjs +2 -0
- package/dist/obi-loader.umd.cjs.map +1 -0
- package/dist/obi-sdk.es.js +1183 -1142
- package/dist/obi-sdk.standalone.iife.js +663 -0
- package/dist/obi-sdk.standalone.iife.js.map +1 -0
- package/dist/obi-sdk.umd.js +88 -59
- package/package.json +5 -4
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { S as SDKState, g as ObiSDKConfigSchema, E as EventType, O as ObiWidget } from "./chunks/obi-widget-9c0306f4.js";
|
|
2
|
+
import { f } from "./chunks/obi-widget-9c0306f4.js";
|
|
3
|
+
import { m as mitt } from "./chunks/session-37970ed1.js";
|
|
4
|
+
import { O } from "./chunks/session-37970ed1.js";
|
|
5
|
+
class ObiSDK {
|
|
6
|
+
constructor(config = {}) {
|
|
7
|
+
this.state = SDKState.READY;
|
|
8
|
+
this.emitter = mitt();
|
|
9
|
+
this.voiceEnabled = false;
|
|
10
|
+
this.screenCaptureEnabled = false;
|
|
11
|
+
this.config = ObiSDKConfigSchema.parse(config);
|
|
12
|
+
if (this.config.debug) {
|
|
13
|
+
console.log("ObiSDK initialized with config:", this.config);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
async init() {
|
|
17
|
+
try {
|
|
18
|
+
if (this.config.enableVoice) {
|
|
19
|
+
await this.initVoice();
|
|
20
|
+
}
|
|
21
|
+
if (this.config.enableScreenCapture) {
|
|
22
|
+
await this.initScreenCapture();
|
|
23
|
+
}
|
|
24
|
+
this.setState(SDKState.READY);
|
|
25
|
+
this.emitter.emit(EventType.READY);
|
|
26
|
+
if (this.config.debug) {
|
|
27
|
+
console.log("ObiSDK ready");
|
|
28
|
+
}
|
|
29
|
+
} catch (error) {
|
|
30
|
+
const sdkError = {
|
|
31
|
+
code: "init_failed",
|
|
32
|
+
message: "Failed to initialize SDK",
|
|
33
|
+
details: error
|
|
34
|
+
};
|
|
35
|
+
this.handleError(sdkError);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async initVoice() {
|
|
39
|
+
if (!window.navigator.mediaDevices || !window.navigator.mediaDevices.getUserMedia) {
|
|
40
|
+
throw new Error("Voice recording not supported in this browser");
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
await window.navigator.mediaDevices.getUserMedia({ audio: true });
|
|
44
|
+
this.voiceEnabled = true;
|
|
45
|
+
if (this.config.debug) {
|
|
46
|
+
console.log("Voice capabilities initialized");
|
|
47
|
+
}
|
|
48
|
+
} catch (error) {
|
|
49
|
+
throw new Error(`Microphone access denied: ${error}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async initScreenCapture() {
|
|
53
|
+
if (!window.navigator.mediaDevices || !window.navigator.mediaDevices.getDisplayMedia) {
|
|
54
|
+
throw new Error("Screen capture not supported in this browser");
|
|
55
|
+
}
|
|
56
|
+
this.screenCaptureEnabled = true;
|
|
57
|
+
if (this.config.debug) {
|
|
58
|
+
console.log("Screen capture capabilities initialized");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Set the SDK state and emit state change event
|
|
63
|
+
*/
|
|
64
|
+
setState(newState) {
|
|
65
|
+
this.state = newState;
|
|
66
|
+
this.emitter.emit(EventType.STATE_CHANGE, newState);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Handle SDK errors
|
|
70
|
+
*/
|
|
71
|
+
handleError(error) {
|
|
72
|
+
this.setState(SDKState.ERROR);
|
|
73
|
+
this.emitter.emit(EventType.ERROR, error);
|
|
74
|
+
if (this.config.debug) {
|
|
75
|
+
console.error("ObiSDK error:", error);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Start voice recording
|
|
80
|
+
*/
|
|
81
|
+
async startVoiceRecording() {
|
|
82
|
+
if (!this.voiceEnabled) {
|
|
83
|
+
this.handleError({
|
|
84
|
+
code: "voice_disabled",
|
|
85
|
+
message: "Voice recording is not enabled or available"
|
|
86
|
+
});
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
this.setState(SDKState.AGENT_SPEAKING);
|
|
91
|
+
this.emitter.emit(EventType.VOICE_START);
|
|
92
|
+
if (this.config.debug) {
|
|
93
|
+
console.log("Voice recording started");
|
|
94
|
+
}
|
|
95
|
+
} catch (error) {
|
|
96
|
+
this.handleError({
|
|
97
|
+
code: "voice_start_failed",
|
|
98
|
+
message: "Failed to start voice recording",
|
|
99
|
+
details: error
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Stop voice recording
|
|
105
|
+
*/
|
|
106
|
+
async stopVoiceRecording() {
|
|
107
|
+
if (this.state === SDKState.READY) {
|
|
108
|
+
return { transcript: void 0 };
|
|
109
|
+
}
|
|
110
|
+
try {
|
|
111
|
+
const result = { transcript: "Sample transcript" };
|
|
112
|
+
this.setState(SDKState.READY);
|
|
113
|
+
this.emitter.emit(EventType.VOICE_STOP, result);
|
|
114
|
+
if (this.config.debug) {
|
|
115
|
+
console.log("Voice recording stopped:", result);
|
|
116
|
+
}
|
|
117
|
+
return result;
|
|
118
|
+
} catch (error) {
|
|
119
|
+
this.handleError({
|
|
120
|
+
code: "voice_stop_failed",
|
|
121
|
+
message: "Failed to stop voice recording",
|
|
122
|
+
details: error
|
|
123
|
+
});
|
|
124
|
+
return { transcript: void 0 };
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Start screen capture
|
|
129
|
+
*/
|
|
130
|
+
async startScreenCapture() {
|
|
131
|
+
if (!this.screenCaptureEnabled) {
|
|
132
|
+
this.handleError({
|
|
133
|
+
code: "screen_capture_disabled",
|
|
134
|
+
message: "Screen capture is not enabled or available"
|
|
135
|
+
});
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
this.setState(SDKState.AGENT_SPEAKING);
|
|
140
|
+
this.emitter.emit(EventType.SCREEN_CAPTURE_START);
|
|
141
|
+
if (this.config.debug) {
|
|
142
|
+
console.log("Screen capture started");
|
|
143
|
+
}
|
|
144
|
+
} catch (error) {
|
|
145
|
+
this.handleError({
|
|
146
|
+
code: "screen_capture_start_failed",
|
|
147
|
+
message: "Failed to start screen capture",
|
|
148
|
+
details: error
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Stop screen capture
|
|
154
|
+
*/
|
|
155
|
+
async stopScreenCapture() {
|
|
156
|
+
if (this.state === SDKState.READY) {
|
|
157
|
+
return { screenshot: void 0 };
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
const result = { screenshot: "data:image/png;base64,..." };
|
|
161
|
+
this.setState(SDKState.READY);
|
|
162
|
+
this.emitter.emit(EventType.SCREEN_CAPTURE_STOP, result);
|
|
163
|
+
if (this.config.debug) {
|
|
164
|
+
console.log("Screen capture stopped");
|
|
165
|
+
}
|
|
166
|
+
return result;
|
|
167
|
+
} catch (error) {
|
|
168
|
+
this.handleError({
|
|
169
|
+
code: "screen_capture_stop_failed",
|
|
170
|
+
message: "Failed to stop screen capture",
|
|
171
|
+
details: error
|
|
172
|
+
});
|
|
173
|
+
return { screenshot: void 0 };
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Subscribe to SDK events
|
|
178
|
+
*/
|
|
179
|
+
on(event, handler) {
|
|
180
|
+
this.emitter.on(event, handler);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Unsubscribe from SDK events
|
|
184
|
+
*/
|
|
185
|
+
off(event, handler) {
|
|
186
|
+
this.emitter.off(event, handler);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Get current SDK state
|
|
190
|
+
*/
|
|
191
|
+
getState() {
|
|
192
|
+
return this.state;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Cleanup and dispose SDK resources
|
|
196
|
+
*/
|
|
197
|
+
dispose() {
|
|
198
|
+
this.emitter.all.clear();
|
|
199
|
+
if (this.config.debug) {
|
|
200
|
+
console.log("ObiSDK disposed");
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const registerWidget = () => {
|
|
205
|
+
if (!customElements.get("obi-widget")) {
|
|
206
|
+
customElements.define("obi-widget", ObiWidget);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
class ObiAssistant {
|
|
210
|
+
/**
|
|
211
|
+
* Initialize the Obi Widget with the provided configuration
|
|
212
|
+
* This creates and mounts the widget to the page
|
|
213
|
+
*/
|
|
214
|
+
static init(config) {
|
|
215
|
+
registerWidget();
|
|
216
|
+
const widget = document.createElement("obi-widget");
|
|
217
|
+
if (config.apiKey) {
|
|
218
|
+
widget.apiKey = config.apiKey;
|
|
219
|
+
}
|
|
220
|
+
if (config.position) {
|
|
221
|
+
widget.position = config.position;
|
|
222
|
+
}
|
|
223
|
+
if (config.user) {
|
|
224
|
+
widget.user = config.user;
|
|
225
|
+
}
|
|
226
|
+
window.obiWidgetConfig = config;
|
|
227
|
+
document.body.appendChild(widget);
|
|
228
|
+
console.log("Obi Widget initialized and mounted");
|
|
229
|
+
return widget;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
export {
|
|
233
|
+
f as API_BASE_URL,
|
|
234
|
+
EventType,
|
|
235
|
+
ObiAssistant,
|
|
236
|
+
ObiSDK,
|
|
237
|
+
ObiSDKConfigSchema,
|
|
238
|
+
O as ObiSession,
|
|
239
|
+
SDKState
|
|
240
|
+
};
|
|
241
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sources":["../../src/core/sdk.ts","../../src/core/assistant.ts"],"sourcesContent":["import mitt from \"mitt\"\n\nimport { EventType, ObiError, ObiSDKConfig, ObiSDKConfigSchema, SDKState } from \"./types\"\n\ntype Events = {\n [EventType.READY]: void\n [EventType.ERROR]: ObiError\n [EventType.VOICE_START]: void\n [EventType.VOICE_STOP]: { transcript?: string }\n [EventType.SCREEN_CAPTURE_START]: void\n [EventType.SCREEN_CAPTURE_STOP]: { screenshot?: string }\n [EventType.STATE_CHANGE]: SDKState\n}\n\nexport class ObiSDK {\n private config: ObiSDKConfig\n private state: SDKState = SDKState.READY\n private emitter = mitt<Events>()\n private voiceEnabled = false\n private screenCaptureEnabled = false\n\n constructor(config: Partial<ObiSDKConfig> = {}) {\n this.config = ObiSDKConfigSchema.parse(config)\n\n if (this.config.debug) {\n console.log(\"ObiSDK initialized with config:\", this.config)\n }\n }\n\n async init(): Promise<void> {\n try {\n if (this.config.enableVoice) {\n await this.initVoice()\n }\n\n if (this.config.enableScreenCapture) {\n await this.initScreenCapture()\n }\n\n this.setState(SDKState.READY)\n this.emitter.emit(EventType.READY)\n\n if (this.config.debug) {\n console.log(\"ObiSDK ready\")\n }\n } catch (error) {\n const sdkError: ObiError = {\n code: \"init_failed\",\n message: \"Failed to initialize SDK\",\n details: error,\n }\n this.handleError(sdkError)\n }\n }\n\n private async initVoice(): Promise<void> {\n // Check if browser supports required voice APIs\n if (!window.navigator.mediaDevices || !window.navigator.mediaDevices.getUserMedia) {\n throw new Error(\"Voice recording not supported in this browser\")\n }\n\n try {\n // Request microphone permissions\n await window.navigator.mediaDevices.getUserMedia({ audio: true })\n this.voiceEnabled = true\n\n if (this.config.debug) {\n console.log(\"Voice capabilities initialized\")\n }\n } catch (error) {\n throw new Error(`Microphone access denied: ${error}`)\n }\n }\n\n private async initScreenCapture(): Promise<void> {\n // Check if browser supports required screen capture APIs\n if (!window.navigator.mediaDevices || !window.navigator.mediaDevices.getDisplayMedia) {\n throw new Error(\"Screen capture not supported in this browser\")\n }\n\n this.screenCaptureEnabled = true\n\n if (this.config.debug) {\n console.log(\"Screen capture capabilities initialized\")\n }\n }\n\n /**\n * Set the SDK state and emit state change event\n */\n private setState(newState: SDKState): void {\n this.state = newState\n this.emitter.emit(EventType.STATE_CHANGE, newState)\n }\n\n /**\n * Handle SDK errors\n */\n private handleError(error: ObiError): void {\n this.setState(SDKState.ERROR)\n this.emitter.emit(EventType.ERROR, error)\n\n if (this.config.debug) {\n console.error(\"ObiSDK error:\", error)\n }\n }\n\n /**\n * Start voice recording\n */\n async startVoiceRecording(): Promise<void> {\n if (!this.voiceEnabled) {\n this.handleError({\n code: \"voice_disabled\",\n message: \"Voice recording is not enabled or available\",\n })\n return\n }\n\n try {\n this.setState(SDKState.AGENT_SPEAKING)\n this.emitter.emit(EventType.VOICE_START)\n\n if (this.config.debug) {\n console.log(\"Voice recording started\")\n }\n } catch (error) {\n this.handleError({\n code: \"voice_start_failed\",\n message: \"Failed to start voice recording\",\n details: error,\n })\n }\n }\n\n /**\n * Stop voice recording\n */\n async stopVoiceRecording(): Promise<{ transcript?: string }> {\n if (this.state === SDKState.READY) {\n return { transcript: undefined }\n }\n\n try {\n const result = { transcript: \"Sample transcript\" } // Placeholder for real implementation\n\n this.setState(SDKState.READY)\n this.emitter.emit(EventType.VOICE_STOP, result)\n\n if (this.config.debug) {\n console.log(\"Voice recording stopped:\", result)\n }\n\n return result\n } catch (error) {\n this.handleError({\n code: \"voice_stop_failed\",\n message: \"Failed to stop voice recording\",\n details: error,\n })\n return { transcript: undefined }\n }\n }\n\n /**\n * Start screen capture\n */\n async startScreenCapture(): Promise<void> {\n if (!this.screenCaptureEnabled) {\n this.handleError({\n code: \"screen_capture_disabled\",\n message: \"Screen capture is not enabled or available\",\n })\n return\n }\n\n try {\n this.setState(SDKState.AGENT_SPEAKING)\n this.emitter.emit(EventType.SCREEN_CAPTURE_START)\n\n if (this.config.debug) {\n console.log(\"Screen capture started\")\n }\n } catch (error) {\n this.handleError({\n code: \"screen_capture_start_failed\",\n message: \"Failed to start screen capture\",\n details: error,\n })\n }\n }\n\n /**\n * Stop screen capture\n */\n async stopScreenCapture(): Promise<{ screenshot?: string }> {\n if (this.state === SDKState.READY) {\n return { screenshot: undefined }\n }\n\n try {\n const result = { screenshot: \"data:image/png;base64,...\" } // Placeholder for real implementation\n\n this.setState(SDKState.READY)\n this.emitter.emit(EventType.SCREEN_CAPTURE_STOP, result)\n\n if (this.config.debug) {\n console.log(\"Screen capture stopped\")\n }\n\n return result\n } catch (error) {\n this.handleError({\n code: \"screen_capture_stop_failed\",\n message: \"Failed to stop screen capture\",\n details: error,\n })\n return { screenshot: undefined }\n }\n }\n\n /**\n * Subscribe to SDK events\n */\n on<E extends EventType>(event: E, handler: (data: Events[E]) => void): void {\n this.emitter.on(event, handler as any)\n }\n\n /**\n * Unsubscribe from SDK events\n */\n off<E extends EventType>(event: E, handler: (data: Events[E]) => void): void {\n this.emitter.off(event, handler as any)\n }\n\n /**\n * Get current SDK state\n */\n getState(): SDKState {\n return this.state\n }\n\n /**\n * Cleanup and dispose SDK resources\n */\n dispose(): void {\n this.emitter.all.clear()\n\n if (this.config.debug) {\n console.log(\"ObiSDK disposed\")\n }\n }\n}\n","/**\n * ObiAssistant provides a simple way to initialize the Obi Widget\n * with a single method call.\n */\n\nimport { ObiWidget } from \"../ui/components/obi-widget\"\n\n// Define the configuration interface\nexport interface ObiAssistantConfig {\n apiKey: string\n position?: \"bottom-right\" | \"bottom-left\" | \"top-right\" | \"top-left\"\n user?: {\n id: string\n email?: string\n metadata?: Record<string, any>\n }\n}\n\n// Register the custom element if it hasn't been registered yet\nconst registerWidget = () => {\n if (!customElements.get(\"obi-widget\")) {\n customElements.define(\"obi-widget\", ObiWidget)\n }\n}\n\n/**\n * ObiAssistant class with static init method for easier initialization\n */\nexport class ObiAssistant {\n /**\n * Initialize the Obi Widget with the provided configuration\n * This creates and mounts the widget to the page\n */\n static init(config: ObiAssistantConfig): HTMLElement {\n // Make sure the widget is defined\n registerWidget()\n\n // Create widget instance\n const widget = document.createElement(\"obi-widget\") as ObiWidget\n\n // Set API key\n if (config.apiKey) {\n widget.apiKey = config.apiKey\n }\n\n // Set position if provided\n if (config.position) {\n widget.position = config.position\n }\n\n // Set user information if provided\n if (config.user) {\n widget.user = config.user\n }\n\n // Save config for access from anywhere\n window.obiWidgetConfig = config\n\n // Add the widget to the document body\n document.body.appendChild(widget)\n\n console.log(\"Obi Widget initialized and mounted\")\n\n return widget\n }\n}\n"],"names":[],"mappings":";;;;AAcO,MAAM,OAAO;AAAA,EAOlB,YAAY,SAAgC,IAAI;AALhD,SAAQ,QAAkB,SAAS;AACnC,SAAQ,UAAU;AAClB,SAAQ,eAAe;AACvB,SAAQ,uBAAuB;AAGxB,SAAA,SAAS,mBAAmB,MAAM,MAAM;AAEzC,QAAA,KAAK,OAAO,OAAO;AACb,cAAA,IAAI,mCAAmC,KAAK,MAAM;AAAA,IAC5D;AAAA,EACF;AAAA,EAEA,MAAM,OAAsB;AACtB,QAAA;AACE,UAAA,KAAK,OAAO,aAAa;AAC3B,cAAM,KAAK;MACb;AAEI,UAAA,KAAK,OAAO,qBAAqB;AACnC,cAAM,KAAK;MACb;AAEK,WAAA,SAAS,SAAS,KAAK;AACvB,WAAA,QAAQ,KAAK,UAAU,KAAK;AAE7B,UAAA,KAAK,OAAO,OAAO;AACrB,gBAAQ,IAAI,cAAc;AAAA,MAC5B;AAAA,aACO,OAAO;AACd,YAAM,WA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kBAAkB;AAGhB,aAAA,KAAK,YAAY,MAAM;AAEhC,YAAQ,IAAI,oCAAoC;AAEzC,WAAA;AAAA,EACT;AACF;"}
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { S as SDKState, E as EventType } from "./chunks/obi-widget-9c0306f4.js";
|
|
2
|
+
import { f, A, C, d, e, D, N, b, g, O, c } from "./chunks/obi-widget-9c0306f4.js";
|
|
3
|
+
import { O as O2 } from "./chunks/session-37970ed1.js";
|
|
4
|
+
import { ObiSDK } from "./core.js";
|
|
5
|
+
import { ObiAssistant } from "./core.js";
|
|
6
|
+
import { ObiControlPanel, ObiStatusWidget, defineCustomElements } from "./ui.js";
|
|
7
|
+
function getDefaultExportFromCjs(x2) {
|
|
8
|
+
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
9
|
+
}
|
|
10
|
+
var react = { exports: {} };
|
|
11
|
+
var react_production_min = {};
|
|
12
|
+
var l = Symbol.for("react.element"), n = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), r = Symbol.for("react.profiler"), t = Symbol.for("react.provider"), u = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), x = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), z = Symbol.iterator;
|
|
13
|
+
function A2(a) {
|
|
14
|
+
if (null === a || "object" !== typeof a)
|
|
15
|
+
return null;
|
|
16
|
+
a = z && a[z] || a["@@iterator"];
|
|
17
|
+
return "function" === typeof a ? a : null;
|
|
18
|
+
}
|
|
19
|
+
var B = { isMounted: function() {
|
|
20
|
+
return false;
|
|
21
|
+
}, enqueueForceUpdate: function() {
|
|
22
|
+
}, enqueueReplaceState: function() {
|
|
23
|
+
}, enqueueSetState: function() {
|
|
24
|
+
} }, C2 = Object.assign, D2 = {};
|
|
25
|
+
function E(a, b2, e2) {
|
|
26
|
+
this.props = a;
|
|
27
|
+
this.context = b2;
|
|
28
|
+
this.refs = D2;
|
|
29
|
+
this.updater = e2 || B;
|
|
30
|
+
}
|
|
31
|
+
E.prototype.isReactComponent = {};
|
|
32
|
+
E.prototype.setState = function(a, b2) {
|
|
33
|
+
if ("object" !== typeof a && "function" !== typeof a && null != a)
|
|
34
|
+
throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
|
|
35
|
+
this.updater.enqueueSetState(this, a, b2, "setState");
|
|
36
|
+
};
|
|
37
|
+
E.prototype.forceUpdate = function(a) {
|
|
38
|
+
this.updater.enqueueForceUpdate(this, a, "forceUpdate");
|
|
39
|
+
};
|
|
40
|
+
function F() {
|
|
41
|
+
}
|
|
42
|
+
F.prototype = E.prototype;
|
|
43
|
+
function G(a, b2, e2) {
|
|
44
|
+
this.props = a;
|
|
45
|
+
this.context = b2;
|
|
46
|
+
this.refs = D2;
|
|
47
|
+
this.updater = e2 || B;
|
|
48
|
+
}
|
|
49
|
+
var H = G.prototype = new F();
|
|
50
|
+
H.constructor = G;
|
|
51
|
+
C2(H, E.prototype);
|
|
52
|
+
H.isPureReactComponent = true;
|
|
53
|
+
var I = Array.isArray, J = Object.prototype.hasOwnProperty, K = { current: null }, L = { key: true, ref: true, __self: true, __source: true };
|
|
54
|
+
function M(a, b2, e2) {
|
|
55
|
+
var d2, c2 = {}, k = null, h = null;
|
|
56
|
+
if (null != b2)
|
|
57
|
+
for (d2 in void 0 !== b2.ref && (h = b2.ref), void 0 !== b2.key && (k = "" + b2.key), b2)
|
|
58
|
+
J.call(b2, d2) && !L.hasOwnProperty(d2) && (c2[d2] = b2[d2]);
|
|
59
|
+
var g2 = arguments.length - 2;
|
|
60
|
+
if (1 === g2)
|
|
61
|
+
c2.children = e2;
|
|
62
|
+
else if (1 < g2) {
|
|
63
|
+
for (var f2 = Array(g2), m = 0; m < g2; m++)
|
|
64
|
+
f2[m] = arguments[m + 2];
|
|
65
|
+
c2.children = f2;
|
|
66
|
+
}
|
|
67
|
+
if (a && a.defaultProps)
|
|
68
|
+
for (d2 in g2 = a.defaultProps, g2)
|
|
69
|
+
void 0 === c2[d2] && (c2[d2] = g2[d2]);
|
|
70
|
+
return { $$typeof: l, type: a, key: k, ref: h, props: c2, _owner: K.current };
|
|
71
|
+
}
|
|
72
|
+
function N2(a, b2) {
|
|
73
|
+
return { $$typeof: l, type: a.type, key: b2, ref: a.ref, props: a.props, _owner: a._owner };
|
|
74
|
+
}
|
|
75
|
+
function O3(a) {
|
|
76
|
+
return "object" === typeof a && null !== a && a.$$typeof === l;
|
|
77
|
+
}
|
|
78
|
+
function escape(a) {
|
|
79
|
+
var b2 = { "=": "=0", ":": "=2" };
|
|
80
|
+
return "$" + a.replace(/[=:]/g, function(a2) {
|
|
81
|
+
return b2[a2];
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
var P = /\/+/g;
|
|
85
|
+
function Q(a, b2) {
|
|
86
|
+
return "object" === typeof a && null !== a && null != a.key ? escape("" + a.key) : b2.toString(36);
|
|
87
|
+
}
|
|
88
|
+
function R(a, b2, e2, d2, c2) {
|
|
89
|
+
var k = typeof a;
|
|
90
|
+
if ("undefined" === k || "boolean" === k)
|
|
91
|
+
a = null;
|
|
92
|
+
var h = false;
|
|
93
|
+
if (null === a)
|
|
94
|
+
h = true;
|
|
95
|
+
else
|
|
96
|
+
switch (k) {
|
|
97
|
+
case "string":
|
|
98
|
+
case "number":
|
|
99
|
+
h = true;
|
|
100
|
+
break;
|
|
101
|
+
case "object":
|
|
102
|
+
switch (a.$$typeof) {
|
|
103
|
+
case l:
|
|
104
|
+
case n:
|
|
105
|
+
h = true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (h)
|
|
109
|
+
return h = a, c2 = c2(h), a = "" === d2 ? "." + Q(h, 0) : d2, I(c2) ? (e2 = "", null != a && (e2 = a.replace(P, "$&/") + "/"), R(c2, b2, e2, "", function(a2) {
|
|
110
|
+
return a2;
|
|
111
|
+
})) : null != c2 && (O3(c2) && (c2 = N2(c2, e2 + (!c2.key || h && h.key === c2.key ? "" : ("" + c2.key).replace(P, "$&/") + "/") + a)), b2.push(c2)), 1;
|
|
112
|
+
h = 0;
|
|
113
|
+
d2 = "" === d2 ? "." : d2 + ":";
|
|
114
|
+
if (I(a))
|
|
115
|
+
for (var g2 = 0; g2 < a.length; g2++) {
|
|
116
|
+
k = a[g2];
|
|
117
|
+
var f2 = d2 + Q(k, g2);
|
|
118
|
+
h += R(k, b2, e2, f2, c2);
|
|
119
|
+
}
|
|
120
|
+
else if (f2 = A2(a), "function" === typeof f2)
|
|
121
|
+
for (a = f2.call(a), g2 = 0; !(k = a.next()).done; )
|
|
122
|
+
k = k.value, f2 = d2 + Q(k, g2++), h += R(k, b2, e2, f2, c2);
|
|
123
|
+
else if ("object" === k)
|
|
124
|
+
throw b2 = String(a), Error("Objects are not valid as a React child (found: " + ("[object Object]" === b2 ? "object with keys {" + Object.keys(a).join(", ") + "}" : b2) + "). If you meant to render a collection of children, use an array instead.");
|
|
125
|
+
return h;
|
|
126
|
+
}
|
|
127
|
+
function S(a, b2, e2) {
|
|
128
|
+
if (null == a)
|
|
129
|
+
return a;
|
|
130
|
+
var d2 = [], c2 = 0;
|
|
131
|
+
R(a, d2, "", "", function(a2) {
|
|
132
|
+
return b2.call(e2, a2, c2++);
|
|
133
|
+
});
|
|
134
|
+
return d2;
|
|
135
|
+
}
|
|
136
|
+
function T(a) {
|
|
137
|
+
if (-1 === a._status) {
|
|
138
|
+
var b2 = a._result;
|
|
139
|
+
b2 = b2();
|
|
140
|
+
b2.then(function(b3) {
|
|
141
|
+
if (0 === a._status || -1 === a._status)
|
|
142
|
+
a._status = 1, a._result = b3;
|
|
143
|
+
}, function(b3) {
|
|
144
|
+
if (0 === a._status || -1 === a._status)
|
|
145
|
+
a._status = 2, a._result = b3;
|
|
146
|
+
});
|
|
147
|
+
-1 === a._status && (a._status = 0, a._result = b2);
|
|
148
|
+
}
|
|
149
|
+
if (1 === a._status)
|
|
150
|
+
return a._result.default;
|
|
151
|
+
throw a._result;
|
|
152
|
+
}
|
|
153
|
+
var U = { current: null }, V = { transition: null }, W = { ReactCurrentDispatcher: U, ReactCurrentBatchConfig: V, ReactCurrentOwner: K };
|
|
154
|
+
function X() {
|
|
155
|
+
throw Error("act(...) is not supported in production builds of React.");
|
|
156
|
+
}
|
|
157
|
+
react_production_min.Children = { map: S, forEach: function(a, b2, e2) {
|
|
158
|
+
S(a, function() {
|
|
159
|
+
b2.apply(this, arguments);
|
|
160
|
+
}, e2);
|
|
161
|
+
}, count: function(a) {
|
|
162
|
+
var b2 = 0;
|
|
163
|
+
S(a, function() {
|
|
164
|
+
b2++;
|
|
165
|
+
});
|
|
166
|
+
return b2;
|
|
167
|
+
}, toArray: function(a) {
|
|
168
|
+
return S(a, function(a2) {
|
|
169
|
+
return a2;
|
|
170
|
+
}) || [];
|
|
171
|
+
}, only: function(a) {
|
|
172
|
+
if (!O3(a))
|
|
173
|
+
throw Error("React.Children.only expected to receive a single React element child.");
|
|
174
|
+
return a;
|
|
175
|
+
} };
|
|
176
|
+
react_production_min.Component = E;
|
|
177
|
+
react_production_min.Fragment = p;
|
|
178
|
+
react_production_min.Profiler = r;
|
|
179
|
+
react_production_min.PureComponent = G;
|
|
180
|
+
react_production_min.StrictMode = q;
|
|
181
|
+
react_production_min.Suspense = w;
|
|
182
|
+
react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W;
|
|
183
|
+
react_production_min.act = X;
|
|
184
|
+
react_production_min.cloneElement = function(a, b2, e2) {
|
|
185
|
+
if (null === a || void 0 === a)
|
|
186
|
+
throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a + ".");
|
|
187
|
+
var d2 = C2({}, a.props), c2 = a.key, k = a.ref, h = a._owner;
|
|
188
|
+
if (null != b2) {
|
|
189
|
+
void 0 !== b2.ref && (k = b2.ref, h = K.current);
|
|
190
|
+
void 0 !== b2.key && (c2 = "" + b2.key);
|
|
191
|
+
if (a.type && a.type.defaultProps)
|
|
192
|
+
var g2 = a.type.defaultProps;
|
|
193
|
+
for (f2 in b2)
|
|
194
|
+
J.call(b2, f2) && !L.hasOwnProperty(f2) && (d2[f2] = void 0 === b2[f2] && void 0 !== g2 ? g2[f2] : b2[f2]);
|
|
195
|
+
}
|
|
196
|
+
var f2 = arguments.length - 2;
|
|
197
|
+
if (1 === f2)
|
|
198
|
+
d2.children = e2;
|
|
199
|
+
else if (1 < f2) {
|
|
200
|
+
g2 = Array(f2);
|
|
201
|
+
for (var m = 0; m < f2; m++)
|
|
202
|
+
g2[m] = arguments[m + 2];
|
|
203
|
+
d2.children = g2;
|
|
204
|
+
}
|
|
205
|
+
return { $$typeof: l, type: a.type, key: c2, ref: k, props: d2, _owner: h };
|
|
206
|
+
};
|
|
207
|
+
react_production_min.createContext = function(a) {
|
|
208
|
+
a = { $$typeof: u, _currentValue: a, _currentValue2: a, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null };
|
|
209
|
+
a.Provider = { $$typeof: t, _context: a };
|
|
210
|
+
return a.Consumer = a;
|
|
211
|
+
};
|
|
212
|
+
react_production_min.createElement = M;
|
|
213
|
+
react_production_min.createFactory = function(a) {
|
|
214
|
+
var b2 = M.bind(null, a);
|
|
215
|
+
b2.type = a;
|
|
216
|
+
return b2;
|
|
217
|
+
};
|
|
218
|
+
react_production_min.createRef = function() {
|
|
219
|
+
return { current: null };
|
|
220
|
+
};
|
|
221
|
+
react_production_min.forwardRef = function(a) {
|
|
222
|
+
return { $$typeof: v, render: a };
|
|
223
|
+
};
|
|
224
|
+
react_production_min.isValidElement = O3;
|
|
225
|
+
react_production_min.lazy = function(a) {
|
|
226
|
+
return { $$typeof: y, _payload: { _status: -1, _result: a }, _init: T };
|
|
227
|
+
};
|
|
228
|
+
react_production_min.memo = function(a, b2) {
|
|
229
|
+
return { $$typeof: x, type: a, compare: void 0 === b2 ? null : b2 };
|
|
230
|
+
};
|
|
231
|
+
react_production_min.startTransition = function(a) {
|
|
232
|
+
var b2 = V.transition;
|
|
233
|
+
V.transition = {};
|
|
234
|
+
try {
|
|
235
|
+
a();
|
|
236
|
+
} finally {
|
|
237
|
+
V.transition = b2;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
react_production_min.unstable_act = X;
|
|
241
|
+
react_production_min.useCallback = function(a, b2) {
|
|
242
|
+
return U.current.useCallback(a, b2);
|
|
243
|
+
};
|
|
244
|
+
react_production_min.useContext = function(a) {
|
|
245
|
+
return U.current.useContext(a);
|
|
246
|
+
};
|
|
247
|
+
react_production_min.useDebugValue = function() {
|
|
248
|
+
};
|
|
249
|
+
react_production_min.useDeferredValue = function(a) {
|
|
250
|
+
return U.current.useDeferredValue(a);
|
|
251
|
+
};
|
|
252
|
+
react_production_min.useEffect = function(a, b2) {
|
|
253
|
+
return U.current.useEffect(a, b2);
|
|
254
|
+
};
|
|
255
|
+
react_production_min.useId = function() {
|
|
256
|
+
return U.current.useId();
|
|
257
|
+
};
|
|
258
|
+
react_production_min.useImperativeHandle = function(a, b2, e2) {
|
|
259
|
+
return U.current.useImperativeHandle(a, b2, e2);
|
|
260
|
+
};
|
|
261
|
+
react_production_min.useInsertionEffect = function(a, b2) {
|
|
262
|
+
return U.current.useInsertionEffect(a, b2);
|
|
263
|
+
};
|
|
264
|
+
react_production_min.useLayoutEffect = function(a, b2) {
|
|
265
|
+
return U.current.useLayoutEffect(a, b2);
|
|
266
|
+
};
|
|
267
|
+
react_production_min.useMemo = function(a, b2) {
|
|
268
|
+
return U.current.useMemo(a, b2);
|
|
269
|
+
};
|
|
270
|
+
react_production_min.useReducer = function(a, b2, e2) {
|
|
271
|
+
return U.current.useReducer(a, b2, e2);
|
|
272
|
+
};
|
|
273
|
+
react_production_min.useRef = function(a) {
|
|
274
|
+
return U.current.useRef(a);
|
|
275
|
+
};
|
|
276
|
+
react_production_min.useState = function(a) {
|
|
277
|
+
return U.current.useState(a);
|
|
278
|
+
};
|
|
279
|
+
react_production_min.useSyncExternalStore = function(a, b2, e2) {
|
|
280
|
+
return U.current.useSyncExternalStore(a, b2, e2);
|
|
281
|
+
};
|
|
282
|
+
react_production_min.useTransition = function() {
|
|
283
|
+
return U.current.useTransition();
|
|
284
|
+
};
|
|
285
|
+
react_production_min.version = "18.3.1";
|
|
286
|
+
{
|
|
287
|
+
react.exports = react_production_min;
|
|
288
|
+
}
|
|
289
|
+
var reactExports = react.exports;
|
|
290
|
+
const React = /* @__PURE__ */ getDefaultExportFromCjs(reactExports);
|
|
291
|
+
function useObiSDK(config) {
|
|
292
|
+
const [sdk, setSDK] = reactExports.useState(null);
|
|
293
|
+
const [state, setState] = reactExports.useState(SDKState.READY);
|
|
294
|
+
const [error, setError] = reactExports.useState(null);
|
|
295
|
+
reactExports.useEffect(() => {
|
|
296
|
+
const newSDK = new ObiSDK(config);
|
|
297
|
+
setSDK(newSDK);
|
|
298
|
+
newSDK.init().catch((err) => {
|
|
299
|
+
console.error("Failed to initialize Obi SDK:", err);
|
|
300
|
+
});
|
|
301
|
+
newSDK.on(EventType.STATE_CHANGE, (newState) => {
|
|
302
|
+
setState(newState);
|
|
303
|
+
});
|
|
304
|
+
newSDK.on(EventType.ERROR, (err) => {
|
|
305
|
+
setError(err);
|
|
306
|
+
});
|
|
307
|
+
return () => {
|
|
308
|
+
newSDK.dispose();
|
|
309
|
+
};
|
|
310
|
+
}, []);
|
|
311
|
+
const startVoiceRecording = async () => {
|
|
312
|
+
if (sdk) {
|
|
313
|
+
return sdk.startVoiceRecording();
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
const stopVoiceRecording = async () => {
|
|
317
|
+
if (sdk) {
|
|
318
|
+
return sdk.stopVoiceRecording();
|
|
319
|
+
}
|
|
320
|
+
return { transcript: void 0 };
|
|
321
|
+
};
|
|
322
|
+
const startScreenCapture = async () => {
|
|
323
|
+
if (sdk) {
|
|
324
|
+
return sdk.startScreenCapture();
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
const stopScreenCapture = async () => {
|
|
328
|
+
if (sdk) {
|
|
329
|
+
return sdk.stopScreenCapture();
|
|
330
|
+
}
|
|
331
|
+
return { screenshot: void 0 };
|
|
332
|
+
};
|
|
333
|
+
return {
|
|
334
|
+
sdk,
|
|
335
|
+
state,
|
|
336
|
+
error,
|
|
337
|
+
startVoiceRecording,
|
|
338
|
+
stopVoiceRecording,
|
|
339
|
+
startScreenCapture,
|
|
340
|
+
stopScreenCapture,
|
|
341
|
+
isReady: state === SDKState.READY,
|
|
342
|
+
isActive: state !== SDKState.READY,
|
|
343
|
+
isError: state === SDKState.ERROR
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
function ObiStatusWidgetReact({ state = SDKState.READY, className }) {
|
|
347
|
+
return /* @__PURE__ */ React.createElement("obi-status-widget", { state, className });
|
|
348
|
+
}
|
|
349
|
+
function ObiControlPanelReact({
|
|
350
|
+
state = SDKState.READY,
|
|
351
|
+
voiceEnabled = true,
|
|
352
|
+
screenEnabled = true,
|
|
353
|
+
onVoiceStart,
|
|
354
|
+
onScreenStart,
|
|
355
|
+
onStop,
|
|
356
|
+
className
|
|
357
|
+
}) {
|
|
358
|
+
const handleVoiceStart = () => {
|
|
359
|
+
if (onVoiceStart)
|
|
360
|
+
onVoiceStart();
|
|
361
|
+
};
|
|
362
|
+
const handleScreenStart = () => {
|
|
363
|
+
if (onScreenStart)
|
|
364
|
+
onScreenStart();
|
|
365
|
+
};
|
|
366
|
+
const handleStop = () => {
|
|
367
|
+
if (onStop)
|
|
368
|
+
onStop();
|
|
369
|
+
};
|
|
370
|
+
return /* @__PURE__ */ React.createElement(
|
|
371
|
+
"obi-control-panel",
|
|
372
|
+
{
|
|
373
|
+
state,
|
|
374
|
+
voiceEnabled,
|
|
375
|
+
screenEnabled,
|
|
376
|
+
onvoicestart: handleVoiceStart,
|
|
377
|
+
onscreenstart: handleScreenStart,
|
|
378
|
+
onstop: handleStop,
|
|
379
|
+
className
|
|
380
|
+
}
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
const VERSION = "0.1.0";
|
|
384
|
+
const createSession = async (options = {}) => {
|
|
385
|
+
const { ObiSession } = await import("./chunks/session-37970ed1.js").then((n2) => n2.s);
|
|
386
|
+
return new ObiSession(options);
|
|
387
|
+
};
|
|
388
|
+
export {
|
|
389
|
+
f as API_BASE_URL,
|
|
390
|
+
A as AudioEqualizer,
|
|
391
|
+
C as Course,
|
|
392
|
+
d as CourseList,
|
|
393
|
+
e as CourseModal,
|
|
394
|
+
D as DotLoader,
|
|
395
|
+
EventType,
|
|
396
|
+
N as NavIcon,
|
|
397
|
+
b as NavigationBar,
|
|
398
|
+
ObiAssistant,
|
|
399
|
+
ObiControlPanel,
|
|
400
|
+
ObiControlPanelReact,
|
|
401
|
+
ObiSDK,
|
|
402
|
+
g as ObiSDKConfigSchema,
|
|
403
|
+
O2 as ObiSession,
|
|
404
|
+
ObiStatusWidget,
|
|
405
|
+
ObiStatusWidgetReact,
|
|
406
|
+
O as ObiWidget,
|
|
407
|
+
SDKState,
|
|
408
|
+
c as SearchingLoader,
|
|
409
|
+
VERSION,
|
|
410
|
+
createSession,
|
|
411
|
+
defineCustomElements,
|
|
412
|
+
useObiSDK
|
|
413
|
+
};
|
|
414
|
+
//# sourceMappingURL=index.js.map
|