obi-sdk 0.2.1 → 0.3.2

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.
Files changed (42) hide show
  1. package/dist/core/constants.d.ts +1 -0
  2. package/dist/core/index.d.ts +3 -0
  3. package/dist/core/init.d.ts +1 -0
  4. package/dist/core/types.d.ts +46 -0
  5. package/dist/empty-loader.d.ts +5 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/loader.d.ts +29 -0
  8. package/dist/modular/chunks/obi-widget-f072b7c6.js +11147 -0
  9. package/dist/modular/chunks/obi-widget-f072b7c6.js.map +1 -0
  10. package/dist/modular/chunks/{index-2d0b05af.js → types-8887aa66.js} +449 -4756
  11. package/dist/modular/chunks/types-8887aa66.js.map +1 -0
  12. package/dist/modular/core.js +4081 -4
  13. package/dist/modular/core.js.map +1 -1
  14. package/dist/modular/index.js +26 -5
  15. package/dist/modular/index.js.map +1 -1
  16. package/dist/modular/ui.js +11 -11
  17. package/dist/modular/ui.js.map +1 -1
  18. package/dist/obi-sdk.es.js +13633 -11080
  19. package/dist/obi-sdk.standalone.iife.js +53 -49
  20. package/dist/obi-sdk.standalone.iife.js.map +1 -1
  21. package/dist/obi-sdk.umd.js +106 -94
  22. package/dist/ui/components/audio-equalizer.d.ts +20 -0
  23. package/dist/ui/components/control-panel.d.ts +12 -0
  24. package/dist/ui/components/courses/course-modal.d.ts +18 -0
  25. package/dist/ui/components/courses/courses.d.ts +26 -0
  26. package/dist/ui/components/courses/index.d.ts +1 -0
  27. package/dist/ui/components/dot-loader.d.ts +20 -0
  28. package/dist/ui/components/icons.d.ts +6 -0
  29. package/dist/ui/components/index.d.ts +11 -0
  30. package/dist/ui/components/nav-icon.d.ts +10 -0
  31. package/dist/ui/components/navigation-bar.d.ts +19 -0
  32. package/dist/ui/components/obi-widget.d.ts +50 -0
  33. package/dist/ui/components/searching-loader.d.ts +5 -0
  34. package/dist/ui/components/status-widget.d.ts +8 -0
  35. package/dist/ui/index.d.ts +1 -0
  36. package/dist/utils/index.d.ts +1 -0
  37. package/dist/utils/storage.d.ts +45 -0
  38. package/package.json +21 -19
  39. package/dist/modular/chunks/index-2d0b05af.js.map +0 -1
  40. package/dist/modular/chunks/obi-widget-0970cbbe.js +0 -2221
  41. package/dist/modular/chunks/obi-widget-0970cbbe.js.map +0 -1
  42. package/dist/obi-loader.js +0 -8
@@ -0,0 +1,20 @@
1
+ import { LitElement } from "lit";
2
+ interface VolumeData {
3
+ speaker: "USER" | "ASSISTANT";
4
+ volume: number;
5
+ spectrum: number[];
6
+ }
7
+ export declare class AudioEqualizer extends LitElement {
8
+ volume: VolumeData;
9
+ private canvasRef;
10
+ private barCount;
11
+ private animationFrame;
12
+ static styles: import("lit").CSSResult;
13
+ connectedCallback(): void;
14
+ disconnectedCallback(): void;
15
+ private startAnimation;
16
+ private stopAnimation;
17
+ private drawEqualizer;
18
+ render(): import("lit").TemplateResult<1>;
19
+ }
20
+ export {};
@@ -0,0 +1,12 @@
1
+ import { SDKState } from "@obi/obi-session";
2
+ import { LitElement } from "lit";
3
+ export declare class ObiControlPanel extends LitElement {
4
+ state: SDKState;
5
+ voiceEnabled: boolean;
6
+ screenEnabled: boolean;
7
+ static styles: import("lit").CSSResult;
8
+ render(): import("lit").TemplateResult<1>;
9
+ private handleVoiceClick;
10
+ private handleScreenClick;
11
+ private handleStopClick;
12
+ }
@@ -0,0 +1,18 @@
1
+ import { LitElement } from "lit";
2
+ import { CourseData } from "./courses";
3
+ import "./courses";
4
+ export declare class CourseModal extends LitElement {
5
+ static styles: import("lit").CSSResult;
6
+ courses: CourseData[];
7
+ loading: boolean;
8
+ error: string;
9
+ apiKey: string;
10
+ onCourseSelect?: (id: string) => void;
11
+ onClose?: () => void;
12
+ private apiBaseUrl;
13
+ private handleCourseSelect;
14
+ private handleClose;
15
+ private fetchCourses;
16
+ connectedCallback(): void;
17
+ render(): import("lit").TemplateResult<1>;
18
+ }
@@ -0,0 +1,26 @@
1
+ import { LitElement } from "lit";
2
+ export type CourseData = {
3
+ id: string;
4
+ name: string;
5
+ description: string;
6
+ imageSrc: string;
7
+ };
8
+ export declare class Course extends LitElement {
9
+ static styles: import("lit").CSSResult;
10
+ id: string;
11
+ name: string;
12
+ description: string;
13
+ imageSrc: string;
14
+ onSelect?: (id: string) => void;
15
+ private handleClick;
16
+ render(): import("lit").TemplateResult<1>;
17
+ }
18
+ export declare class CourseList extends LitElement {
19
+ static styles: import("lit").CSSResult;
20
+ courses: CourseData[];
21
+ loading: boolean;
22
+ error: string;
23
+ onCourseSelect?: (id: string) => void;
24
+ private handleCourseSelect;
25
+ render(): import("lit").TemplateResult<1>;
26
+ }
@@ -0,0 +1 @@
1
+ export * from "./course-modal";
@@ -0,0 +1,20 @@
1
+ import { LitElement } from "lit";
2
+ export declare class DotLoader extends LitElement {
3
+ private activeDots;
4
+ private numDots;
5
+ private containerWidth;
6
+ private dotSize;
7
+ private bounceHeight;
8
+ private animationDuration;
9
+ private pauseDuration;
10
+ private overlapFactor;
11
+ private color;
12
+ private timeoutIds;
13
+ static styles: import("lit").CSSResult;
14
+ connectedCallback(): void;
15
+ disconnectedCallback(): void;
16
+ private startAnimation;
17
+ private stopAnimation;
18
+ private animateSequence;
19
+ render(): import("lit").TemplateResult<1>;
20
+ }
@@ -0,0 +1,6 @@
1
+ export declare const pauseIcon: import("lit").TemplateResult<1>;
2
+ export declare const playIcon: import("lit").TemplateResult<1>;
3
+ export declare const powerIcon: import("lit").TemplateResult<1>;
4
+ export declare const closeIcon: import("lit").TemplateResult<1>;
5
+ export declare const bookOpenIcon: import("lit").TemplateResult<1>;
6
+ export declare const obiIcon: import("lit").TemplateResult<1>;
@@ -0,0 +1,11 @@
1
+ export * from "./status-widget";
2
+ export * from "./control-panel";
3
+ export * from "./obi-widget";
4
+ export * from "./audio-equalizer";
5
+ export * from "./dot-loader";
6
+ export * from "./nav-icon";
7
+ export * from "./navigation-bar";
8
+ export * from "./searching-loader";
9
+ export * from "./courses/courses";
10
+ export * from "./courses/course-modal";
11
+ export declare function defineCustomElements(): void;
@@ -0,0 +1,10 @@
1
+ import { LitElement } from "lit";
2
+ export declare class NavIcon extends LitElement {
3
+ static styles: import("lit").CSSResult;
4
+ id: string;
5
+ isActive: boolean;
6
+ isSpecial: boolean;
7
+ onClick?: (id: string, isActive: boolean) => void;
8
+ private handleClick;
9
+ render(): import("lit").TemplateResult<1>;
10
+ }
@@ -0,0 +1,19 @@
1
+ import { SDKState } from "@obi/obi-session";
2
+ import { LitElement } from "lit";
3
+ import "./nav-icon";
4
+ export declare class NavigationBar extends LitElement {
5
+ static styles: import("lit").CSSResult;
6
+ isActive: boolean;
7
+ isScreenActive: boolean;
8
+ position: {
9
+ top: number;
10
+ left: number;
11
+ };
12
+ currentState: SDKState;
13
+ direction: "up" | "down";
14
+ onItemSelect?: (id: string, isActive: boolean) => void;
15
+ constructor();
16
+ connectedCallback(): void;
17
+ private handleIconClick;
18
+ render(): import("lit").TemplateResult<1>;
19
+ }
@@ -0,0 +1,50 @@
1
+ import { LitElement, nothing } from "lit";
2
+ import "./navigation-bar";
3
+ import "./courses";
4
+ import "./audio-equalizer";
5
+ import "./dot-loader";
6
+ import "./searching-loader";
7
+ export declare class ObiWidget extends LitElement {
8
+ private apiKey;
9
+ private isActive;
10
+ private position;
11
+ private user;
12
+ private state;
13
+ private storedActiveState;
14
+ private showCourseModal;
15
+ private isHovering;
16
+ private navVisible;
17
+ private activeSession;
18
+ private volume;
19
+ private sessionToken;
20
+ private roomToken;
21
+ private roomUrl;
22
+ private boundSaveSessionData;
23
+ private closeNavTimeoutRef;
24
+ constructor();
25
+ private updateFromConfig;
26
+ static styles: import("lit").CSSResult;
27
+ private connectObi;
28
+ private handleSessionStart;
29
+ /**
30
+ * Check if there's an existing session stored in localStorage
31
+ * and attempt to reconnect if a valid session is found
32
+ */
33
+ private checkExistingSession;
34
+ /**
35
+ * Clear session-related data from localStorage
36
+ */
37
+ private clearSessionStorage;
38
+ connectedCallback(): void;
39
+ private saveSessionData;
40
+ disconnectedCallback(): void;
41
+ private handleMouseEnter;
42
+ private handleMouseLeave;
43
+ /**
44
+ * Terminate the session completely and clear storage
45
+ * This is used when a user explicitly wants to end a session
46
+ */
47
+ private terminateSession;
48
+ private handleItemSelect;
49
+ render(): import("lit").TemplateResult<1> | typeof nothing;
50
+ }
@@ -0,0 +1,5 @@
1
+ import { LitElement } from "lit";
2
+ export declare class SearchingLoader extends LitElement {
3
+ static styles: import("lit").CSSResult;
4
+ render(): import("lit").TemplateResult<1>;
5
+ }
@@ -0,0 +1,8 @@
1
+ import { SDKState } from "@obi/obi-session";
2
+ import { LitElement } from "lit";
3
+ export declare class ObiStatusWidget extends LitElement {
4
+ state: SDKState;
5
+ static styles: import("lit").CSSResult;
6
+ render(): import("lit").TemplateResult<1>;
7
+ private getStatusText;
8
+ }
@@ -0,0 +1 @@
1
+ export * from "./components";
@@ -0,0 +1 @@
1
+ export * from "./storage";
@@ -0,0 +1,45 @@
1
+ /**
2
+ * StorageManager provides namespaced access to browser localStorage
3
+ * to prevent key conflicts with other applications.
4
+ */
5
+ import { SDKState } from "../core";
6
+ export interface SessionData {
7
+ sessionToken: string;
8
+ roomToken: string;
9
+ roomUrl: string;
10
+ obiState: SDKState;
11
+ sessionExpiry: string;
12
+ }
13
+ export declare class StorageManager {
14
+ private namespace;
15
+ /**
16
+ * Create a new StorageManager with a specific namespace
17
+ * @param namespace The namespace to prefix all keys with
18
+ */
19
+ constructor(namespace: string);
20
+ /**
21
+ * Get a value from localStorage with the namespace prefix
22
+ * @param key The key to retrieve
23
+ * @returns The stored value or null if not found
24
+ */
25
+ getItem(key: string): string | null;
26
+ /**
27
+ * Set a value in localStorage with the namespace prefix
28
+ * @param key The key to set
29
+ * @param value The value to store
30
+ */
31
+ setItem(key: string, value: string): void;
32
+ /**
33
+ * Remove a value from localStorage with the namespace prefix
34
+ * @param key The key to remove
35
+ */
36
+ removeItem(key: string): void;
37
+ /**
38
+ * Clear all keys that belong to this namespace
39
+ */
40
+ clear(): void;
41
+ }
42
+ export declare const STORAGE_KEYS: {
43
+ SESSION_DATA: string;
44
+ };
45
+ export declare const storage: StorageManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obi-sdk",
3
- "version": "0.2.1",
3
+ "version": "0.3.2",
4
4
  "description": "JavaScript SDK for Obi",
5
5
  "type": "module",
6
6
  "main": "dist/obi-sdk.umd.js",
@@ -10,19 +10,6 @@
10
10
  "dist",
11
11
  "index.d.ts"
12
12
  ],
13
- "scripts": {
14
- "dev": "DEV_MODE=true vite",
15
- "build": "tsc && vite build",
16
- "build:loader": "vite build --config vite.loader.config.js",
17
- "build:standalone": "vite build --config vite.standalone.config.js",
18
- "build:modular": "vite build --config vite.modular.config.js",
19
- "build:all": "npm run build && npm run build:loader && npm run build:standalone && npm run build:modular",
20
- "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
21
- "format": "prettier --write \"src/**/*.{ts,tsx}\"",
22
- "preview": "vite preview",
23
- "types": "tsc --emitDeclarationOnly",
24
- "prepublishOnly": "npm run build:all"
25
- },
26
13
  "keywords": [
27
14
  "obi",
28
15
  "sdk",
@@ -37,11 +24,11 @@
37
24
  "license": "SEE LICENSE IN LICENSE.txt",
38
25
  "homepage": "https://www.iamobi.ai",
39
26
  "dependencies": {
40
- "eventemitter3": "^4.0.7",
27
+ "html2canvas-pro": "^1.5.11",
41
28
  "lit": "^3.0.0",
42
- "livekit-client": "^2.11.4",
43
- "ts-pattern": "^5.0.6",
44
- "zod": "^3.22.0"
29
+ "ts-pattern": "^5.7.0",
30
+ "zod": "^3.22.0",
31
+ "@obi/obi-session": "0.2.0"
45
32
  },
46
33
  "peerDependencies": {
47
34
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
@@ -49,6 +36,8 @@
49
36
  },
50
37
  "devDependencies": {
51
38
  "@eslint/js": "^8.56.0",
39
+ "@types/html2canvas": "^1.0.0",
40
+ "@types/node": "^22.15.18",
52
41
  "@types/react": "^18.0.0",
53
42
  "@types/react-dom": "^18.0.0",
54
43
  "@typescript-eslint/eslint-plugin": "^6.0.0",
@@ -60,8 +49,21 @@
60
49
  "prettier": "^3.0.0",
61
50
  "react": "^18.2.0",
62
51
  "react-dom": "^18.2.0",
52
+ "rimraf": "^6.0.1",
63
53
  "terser": "^5.39.0",
64
- "typescript": "^5.0.2",
54
+ "typescript": "^5.8.3",
65
55
  "vite": "^4.5.0"
56
+ },
57
+ "scripts": {
58
+ "dev": "vite",
59
+ "build": "vite build",
60
+ "build:standalone": "vite build --config vite.standalone.config.js",
61
+ "build:modular": "vite build --config vite.modular.config.js",
62
+ "build:publish": "pnpm build && pnpm build:standalone && pnpm build:modular",
63
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
64
+ "format": "prettier --write \"src/**/*.{ts,tsx}\"",
65
+ "preview": "vite preview",
66
+ "types": "tsc --emitDeclarationOnly",
67
+ "clean": "rimraf dist"
66
68
  }
67
69
  }