@onlive.ai/common-121 0.2.70 → 0.2.163
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 +0 -1
- package/components/asset/asset-modal-portal.cjs +550 -0
- package/components/asset/asset-modal-portal.d.cts +22 -0
- package/components/asset/asset-modal-portal.d.ts +22 -0
- package/components/asset/asset-modal-portal.js +550 -0
- package/components/asset/asset.cjs +3536 -0
- package/components/asset/asset.d.cts +37 -0
- package/components/asset/asset.d.ts +37 -0
- package/components/asset/asset.js +3536 -0
- package/components/asset/asset.loaders.cjs +2 -0
- package/components/asset/asset.loaders.d.cts +17 -0
- package/components/asset/asset.loaders.d.ts +17 -0
- package/components/asset/asset.loaders.js +2 -0
- package/components/asset/asset.renderer.cjs +2292 -0
- package/components/asset/asset.renderer.d.cts +29 -0
- package/components/asset/asset.renderer.d.ts +29 -0
- package/components/asset/asset.renderer.js +2292 -0
- package/components/asset/asset.styles.cjs +683 -0
- package/components/asset/asset.styles.d.cts +6 -0
- package/components/asset/asset.styles.d.ts +6 -0
- package/components/asset/asset.styles.js +683 -0
- package/components/asset/asset.types.cjs +2 -0
- package/components/asset/asset.types.d.cts +103 -0
- package/components/asset/asset.types.d.ts +103 -0
- package/components/asset/asset.types.js +1 -0
- package/components/asset/index.cjs +3536 -0
- package/components/asset/index.d.cts +8 -0
- package/components/asset/index.d.ts +8 -0
- package/components/asset/index.js +3536 -0
- package/components/player/player.cjs +2044 -0
- package/components/player/player.d.cts +25 -0
- package/components/player/player.d.ts +25 -0
- package/components/player/player.js +2044 -0
- package/components/player/player.styles.cjs +16 -0
- package/components/player/player.styles.d.cts +6 -0
- package/components/player/player.styles.d.ts +6 -0
- package/components/player/player.styles.js +16 -0
- package/components/side-bar/index.cjs +3185 -0
- package/components/side-bar/index.d.cts +11 -0
- package/components/side-bar/index.d.ts +11 -0
- package/components/side-bar/index.js +3185 -0
- package/components/side-bar/side-bar.cjs +3185 -0
- package/components/side-bar/side-bar.d.cts +83 -0
- package/components/side-bar/side-bar.d.ts +83 -0
- package/components/side-bar/side-bar.js +3185 -0
- package/components/side-bar/side-bar.styles.cjs +801 -0
- package/components/side-bar/side-bar.styles.d.cts +6 -0
- package/components/side-bar/side-bar.styles.d.ts +6 -0
- package/components/side-bar/side-bar.styles.js +801 -0
- package/components/side-bar/side-bar.types.cjs +2 -0
- package/components/side-bar/side-bar.types.d.cts +105 -0
- package/components/side-bar/side-bar.types.d.ts +105 -0
- package/components/side-bar/side-bar.types.js +2 -0
- package/components/upload/index.cjs +83 -0
- package/components/upload/index.d.cts +4 -0
- package/components/upload/index.d.ts +4 -0
- package/components/upload/index.js +83 -0
- package/components/upload/upload.cjs +83 -0
- package/components/upload/upload.d.cts +28 -0
- package/components/upload/upload.d.ts +28 -0
- package/components/upload/upload.js +83 -0
- package/components/upload/upload.styles.cjs +65 -0
- package/components/upload/upload.styles.d.cts +6 -0
- package/components/upload/upload.styles.d.ts +6 -0
- package/components/upload/upload.styles.js +65 -0
- package/components/upload/upload.types.cjs +2 -0
- package/components/upload/upload.types.d.cts +16 -0
- package/components/upload/upload.types.d.ts +16 -0
- package/components/upload/upload.types.js +1 -0
- package/index.cjs +4677 -0
- package/index.d.cts +338 -0
- package/index.d.ts +338 -0
- package/index.js +4677 -0
- package/package.json +32 -11
- package/react/components/asset/Asset.cjs +2 -0
- package/react/components/asset/Asset.d.cts +33 -0
- package/react/components/asset/Asset.d.ts +33 -0
- package/react/components/asset/Asset.jsx +2 -0
- package/react/components/side-bar/SideBar.cjs +2 -0
- package/react/components/side-bar/SideBar.d.cts +37 -0
- package/react/components/side-bar/SideBar.d.ts +37 -0
- package/react/components/side-bar/SideBar.jsx +2 -0
- package/react/components/upload/Upload.cjs +2 -0
- package/react/components/upload/Upload.d.cts +23 -0
- package/react/components/upload/Upload.d.ts +23 -0
- package/react/components/upload/Upload.jsx +2 -0
- package/services/audio.service.cjs +2 -2
- package/services/audio.service.d.cts +1 -0
- package/services/audio.service.d.ts +1 -0
- package/services/audio.service.js +2 -2
- package/services/conversation/conversation.service.cjs +2 -0
- package/services/conversation/conversation.service.d.cts +533 -0
- package/services/conversation/conversation.service.d.ts +533 -0
- package/services/conversation/conversation.service.js +2 -0
- package/services/conversation/conversation.types.cjs +2 -0
- package/services/conversation/conversation.types.d.cts +519 -0
- package/services/conversation/conversation.types.d.ts +519 -0
- package/services/conversation/conversation.types.js +2 -0
- package/services/conversation/index.cjs +2 -0
- package/services/conversation/index.d.cts +7 -0
- package/services/conversation/index.d.ts +7 -0
- package/services/conversation/index.js +2 -0
- package/services/faqs/faqs.service.cjs +2 -0
- package/services/faqs/faqs.service.d.cts +16 -0
- package/services/faqs/faqs.service.d.ts +16 -0
- package/services/faqs/faqs.service.js +2 -0
- package/services/faqs/faqs.types.cjs +2 -0
- package/services/faqs/faqs.types.d.cts +60 -0
- package/services/faqs/faqs.types.d.ts +60 -0
- package/services/faqs/faqs.types.js +1 -0
- package/services/faqs/index.cjs +2 -0
- package/services/faqs/index.d.cts +3 -0
- package/services/faqs/index.d.ts +3 -0
- package/services/faqs/index.js +2 -0
- package/services/file/file.service.cjs +2 -0
- package/services/file/file.service.d.cts +66 -0
- package/services/file/file.service.d.ts +66 -0
- package/services/file/file.service.js +2 -0
- package/services/file/file.types.cjs +2 -0
- package/services/file/file.types.d.cts +72 -0
- package/services/file/file.types.d.ts +72 -0
- package/services/file/file.types.js +1 -0
- package/services/file/index.cjs +2 -0
- package/services/file/index.d.cts +3 -0
- package/services/file/index.d.ts +3 -0
- package/services/file/index.js +2 -0
- package/services/firebase/firebase-api.cjs +2 -2
- package/services/firebase/firebase-api.d.cts +25 -9
- package/services/firebase/firebase-api.d.ts +25 -9
- package/services/firebase/firebase-api.js +2 -2
- package/services/multimedia/config.example.cjs +2 -0
- package/services/multimedia/config.example.d.cts +13 -0
- package/services/multimedia/config.example.d.ts +13 -0
- package/services/multimedia/config.example.js +2 -0
- package/services/multimedia/index.cjs +2 -0
- package/services/multimedia/index.d.cts +3 -0
- package/services/multimedia/index.d.ts +3 -0
- package/services/multimedia/index.js +2 -0
- package/services/multimedia/multimedia.service.cjs +2 -0
- package/services/multimedia/multimedia.service.d.cts +28 -0
- package/services/multimedia/multimedia.service.d.ts +28 -0
- package/services/multimedia/multimedia.service.js +2 -0
- package/services/multimedia/multimedia.types.cjs +2 -0
- package/services/multimedia/multimedia.types.d.cts +65 -0
- package/services/multimedia/multimedia.types.d.ts +65 -0
- package/services/multimedia/multimedia.types.js +1 -0
- package/services/product/index.cjs +2 -0
- package/services/product/index.d.cts +3 -0
- package/services/product/index.d.ts +3 -0
- package/services/product/index.js +2 -0
- package/services/product/product.service.cjs +2 -0
- package/services/product/product.service.d.cts +19 -0
- package/services/product/product.service.d.ts +19 -0
- package/services/product/product.service.js +2 -0
- package/services/product/product.types.cjs +2 -0
- package/services/product/product.types.d.cts +78 -0
- package/services/product/product.types.d.ts +78 -0
- package/services/product/product.types.js +1 -0
- package/services/request.provider.cjs +1 -1
- package/services/request.provider.d.cts +1 -0
- package/services/request.provider.d.ts +1 -0
- package/services/request.provider.js +1 -1
- package/services/session.service.cjs +2 -0
- package/services/session.service.d.cts +70 -0
- package/services/session.service.d.ts +70 -0
- package/services/session.service.js +2 -0
- package/services/upload/index.cjs +2 -0
- package/services/upload/index.d.cts +2 -0
- package/services/upload/index.d.ts +2 -0
- package/services/upload/index.js +2 -0
- package/services/upload/upload.service.cjs +2 -0
- package/services/upload/upload.service.d.cts +81 -0
- package/services/upload/upload.service.d.ts +81 -0
- package/services/upload/upload.service.js +2 -0
- package/themes/dark.cjs +4 -1
- package/themes/dark.d.cts +1 -0
- package/themes/dark.d.ts +1 -0
- package/themes/dark.js +4 -1
- package/themes/light.cjs +1 -1
- package/themes/light.d.cts +1 -0
- package/themes/light.d.ts +1 -0
- package/themes/light.js +1 -1
- package/types/globals.cjs +2 -0
- package/types/globals.d.cts +39 -0
- package/types/globals.d.ts +39 -0
- package/types/globals.js +1 -0
- package/types/tracking-options.cjs +2 -2
- package/types/tracking-options.d.cts +8 -6
- package/types/tracking-options.d.ts +8 -6
- package/types/tracking-options.js +1 -1
- package/utils/adopt-styles.cjs +2 -2
- package/utils/adopt-styles.d.cts +1 -0
- package/utils/adopt-styles.d.ts +1 -0
- package/utils/adopt-styles.js +2 -2
- package/utils/browser-preferences.cjs +2 -2
- package/utils/browser-preferences.d.cts +1 -0
- package/utils/browser-preferences.d.ts +1 -0
- package/utils/browser-preferences.js +2 -2
- package/utils/classify-media.cjs +1 -1
- package/utils/classify-media.d.cts +1 -0
- package/utils/classify-media.d.ts +1 -0
- package/utils/classify-media.js +1 -1
- package/utils/decorators.cjs +1 -1
- package/utils/decorators.d.cts +1 -0
- package/utils/decorators.d.ts +1 -0
- package/utils/decorators.js +1 -1
- package/utils/detected-lang.cjs +2 -2
- package/utils/detected-lang.d.cts +1 -0
- package/utils/detected-lang.d.ts +1 -0
- package/utils/detected-lang.js +2 -2
- package/utils/fullscreen.cjs +2 -2
- package/utils/fullscreen.d.cts +6 -5
- package/utils/fullscreen.d.ts +6 -5
- package/utils/fullscreen.js +2 -2
- package/utils/insert-script.cjs +1 -1
- package/utils/insert-script.d.cts +1 -0
- package/utils/insert-script.d.ts +1 -0
- package/utils/insert-script.js +1 -1
- package/utils/is-map-compatible.cjs +1 -1
- package/utils/is-map-compatible.d.cts +1 -0
- package/utils/is-map-compatible.d.ts +1 -0
- package/utils/is-map-compatible.js +1 -1
- package/utils/markdown.cjs +2 -2
- package/utils/markdown.d.cts +1 -0
- package/utils/markdown.d.ts +1 -0
- package/utils/markdown.js +2 -2
- package/utils/merge.cjs +2 -2
- package/utils/merge.d.cts +2 -1
- package/utils/merge.d.ts +2 -1
- package/utils/merge.js +2 -2
- package/utils/multiband-track-volume.cjs +2 -2
- package/utils/multiband-track-volume.d.cts +1 -0
- package/utils/multiband-track-volume.d.ts +1 -0
- package/utils/multiband-track-volume.js +2 -2
- package/utils/onlive-url-params.cjs +1 -1
- package/utils/onlive-url-params.d.cts +1 -0
- package/utils/onlive-url-params.d.ts +1 -0
- package/utils/onlive-url-params.js +1 -1
- package/utils/pretty-distance.cjs +2 -2
- package/utils/pretty-distance.d.cts +2 -1
- package/utils/pretty-distance.d.ts +2 -1
- package/utils/pretty-distance.js +2 -2
- package/utils/pretty-time.cjs +2 -0
- package/utils/pretty-time.d.cts +16 -0
- package/utils/pretty-time.d.ts +16 -0
- package/utils/pretty-time.js +2 -0
- package/utils/random-string.cjs +1 -1
- package/utils/random-string.d.cts +1 -0
- package/utils/random-string.d.ts +1 -0
- package/utils/random-string.js +1 -1
- package/utils/resource-type.cjs +1 -1
- package/utils/resource-type.d.cts +1 -0
- package/utils/resource-type.d.ts +1 -0
- package/utils/resource-type.js +1 -1
- package/utils/round-number.cjs +2 -0
- package/utils/round-number.d.cts +30 -0
- package/utils/round-number.d.ts +30 -0
- package/utils/round-number.js +2 -0
- package/utils/safe-html.cjs +2 -2
- package/utils/safe-html.d.cts +4 -3
- package/utils/safe-html.d.ts +4 -3
- package/utils/safe-html.js +2 -2
- package/utils/sanitize.cjs +2 -2
- package/utils/sanitize.d.cts +1 -0
- package/utils/sanitize.d.ts +1 -0
- package/utils/sanitize.js +2 -2
- package/utils/spread.cjs +2 -2
- package/utils/spread.d.cts +1 -0
- package/utils/spread.d.ts +1 -0
- package/utils/spread.js +2 -2
- package/utils/watch.cjs +1 -1
- package/utils/watch.d.cts +1 -0
- package/utils/watch.d.ts +1 -0
- package/utils/watch.js +1 -1
- package/services/firebase/firebase.service.cjs +0 -2
- package/services/firebase/firebase.service.d.cts +0 -40
- package/services/firebase/firebase.service.d.ts +0 -40
- package/services/firebase/firebase.service.js +0 -2
- package/services/livekit.service.cjs +0 -2
- package/services/livekit.service.d.cts +0 -219
- package/services/livekit.service.d.ts +0 -219
- package/services/livekit.service.js +0 -2
- package/types/window-context.cjs +0 -2
- package/types/window-context.d.cts +0 -8
- package/types/window-context.d.ts +0 -8
- package/types/window-context.js +0 -1
package/package.json
CHANGED
|
@@ -1,34 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlive.ai/common-121",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.163",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
7
7
|
"**/*.cjs",
|
|
8
|
+
"**/*.jsx",
|
|
8
9
|
"**/*.d.ts",
|
|
9
10
|
"**/*.d.cts",
|
|
10
11
|
"!./*.iife.js",
|
|
11
12
|
"!./themes/custom/**",
|
|
12
13
|
"!./node_modules/**"
|
|
13
14
|
],
|
|
15
|
+
"main": "./index.cjs",
|
|
16
|
+
"module": "./index.js",
|
|
17
|
+
"types": "./index.d.ts",
|
|
14
18
|
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./index.d.ts",
|
|
21
|
+
"import": "./index.js",
|
|
22
|
+
"require": "./index.cjs"
|
|
23
|
+
},
|
|
15
24
|
"./utils/*": "./utils/*",
|
|
16
25
|
"./types/*": "./types/*",
|
|
17
26
|
"./services/*": "./services/*",
|
|
18
|
-
"./themes/*": "./themes/*"
|
|
27
|
+
"./themes/*": "./themes/*",
|
|
28
|
+
"./components/*": "./components/*",
|
|
29
|
+
"./react/*": "./react/*"
|
|
19
30
|
},
|
|
20
31
|
"dependencies": {
|
|
21
32
|
"@formatjs/intl-localematcher": "^0.5.10",
|
|
22
|
-
"@
|
|
23
|
-
"@
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
33
|
+
"@lit/react": "^1.0.8",
|
|
34
|
+
"@livekit/components-core": "^0.12.12",
|
|
35
|
+
"@onlive.ai/tracker": "^1.0.18",
|
|
36
|
+
"@onlive.ai/ui": "^1.9.3",
|
|
37
|
+
"dompurify": "^3.3.1",
|
|
38
|
+
"firebase": "^11.10.0",
|
|
39
|
+
"lit": "^3.3.1",
|
|
40
|
+
"livekit-client": "^2.16.1",
|
|
41
|
+
"marked": "^15.0.12",
|
|
29
42
|
"rxjs": "^7.8.2",
|
|
30
|
-
"tsup": "^8.5.
|
|
31
|
-
"typescript": "~5.7.3"
|
|
43
|
+
"tsup": "^8.5.1",
|
|
44
|
+
"typescript": "~5.7.3",
|
|
45
|
+
"video.js": "^8.23.4"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/react": "^19.2.7",
|
|
49
|
+
"react": "^19.2.3"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"react": "^19.1.1"
|
|
32
53
|
},
|
|
33
54
|
"scripts": {
|
|
34
55
|
"build:package": "tsup",
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
"use strict";var E=Object.create;var a=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var N=(t,e)=>{for(var s in e)a(t,s,{get:e[s],enumerable:!0})},m=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of l(e))!C.call(t,o)&&o!==s&&a(t,o,{get:()=>e[o],enumerable:!(n=i(e,o))||n.enumerable});return t};var d=(t,e,s)=>(s=t!=null?E(A(t)):{},m(e||!t||!t.__esModule?a(s,"default",{value:t,enumerable:!0}):s,t)),f=t=>m(a({},"__esModule",{value:!0}),t);var I={};N(I,{Asset:()=>v,default:()=>u});module.exports=f(I);var r=require("@lit/react"),c=d(require("react"),1),p=require("../../../components/asset/asset.js"),v=(0,r.createComponent)({tagName:"osb-asset",elementClass:p.OSBAsset,react:c.default,events:{onAssetClick:"asset-click",onAssetDownload:"asset-download",onAssetLoad:"asset-load",onAssetError:"asset-error",onContentClick:"content-click"}}),u=v;0&&(module.exports={Asset});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
import * as _lit_react from '@lit/react';
|
|
3
|
+
import { EventName } from '@lit/react';
|
|
4
|
+
import { OSBAsset } from '../../../components/asset/asset.js';
|
|
5
|
+
import { IAsset } from '../../../components/asset/asset.types.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* React wrapper for the OSBAsset web component
|
|
9
|
+
*
|
|
10
|
+
* This component provides a React-friendly interface for the Onlive Asset component.
|
|
11
|
+
* It supports rendering different types of assets (image, video, presentation, product, faq)
|
|
12
|
+
* with download and modal functionality.
|
|
13
|
+
*/
|
|
14
|
+
declare const Asset: _lit_react.ReactWebComponent<OSBAsset, {
|
|
15
|
+
onAssetClick: EventName<CustomEvent<{
|
|
16
|
+
asset: IAsset;
|
|
17
|
+
}>>;
|
|
18
|
+
onAssetDownload: EventName<CustomEvent<{
|
|
19
|
+
asset: IAsset;
|
|
20
|
+
}>>;
|
|
21
|
+
onAssetLoad: EventName<CustomEvent<{
|
|
22
|
+
asset: IAsset;
|
|
23
|
+
}>>;
|
|
24
|
+
onAssetError: EventName<CustomEvent<{
|
|
25
|
+
error: string;
|
|
26
|
+
asset: IAsset;
|
|
27
|
+
}>>;
|
|
28
|
+
onContentClick: EventName<CustomEvent<{
|
|
29
|
+
content: any;
|
|
30
|
+
}>>;
|
|
31
|
+
}>;
|
|
32
|
+
|
|
33
|
+
export { Asset, Asset as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
import * as _lit_react from '@lit/react';
|
|
3
|
+
import { EventName } from '@lit/react';
|
|
4
|
+
import { OSBAsset } from '../../../components/asset/asset.js';
|
|
5
|
+
import { IAsset } from '../../../components/asset/asset.types.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* React wrapper for the OSBAsset web component
|
|
9
|
+
*
|
|
10
|
+
* This component provides a React-friendly interface for the Onlive Asset component.
|
|
11
|
+
* It supports rendering different types of assets (image, video, presentation, product, faq)
|
|
12
|
+
* with download and modal functionality.
|
|
13
|
+
*/
|
|
14
|
+
declare const Asset: _lit_react.ReactWebComponent<OSBAsset, {
|
|
15
|
+
onAssetClick: EventName<CustomEvent<{
|
|
16
|
+
asset: IAsset;
|
|
17
|
+
}>>;
|
|
18
|
+
onAssetDownload: EventName<CustomEvent<{
|
|
19
|
+
asset: IAsset;
|
|
20
|
+
}>>;
|
|
21
|
+
onAssetLoad: EventName<CustomEvent<{
|
|
22
|
+
asset: IAsset;
|
|
23
|
+
}>>;
|
|
24
|
+
onAssetError: EventName<CustomEvent<{
|
|
25
|
+
error: string;
|
|
26
|
+
asset: IAsset;
|
|
27
|
+
}>>;
|
|
28
|
+
onContentClick: EventName<CustomEvent<{
|
|
29
|
+
content: any;
|
|
30
|
+
}>>;
|
|
31
|
+
}>;
|
|
32
|
+
|
|
33
|
+
export { Asset, Asset as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
import{createComponent as t}from"@lit/react";import e from"react";import{OSBAsset as s}from"../../../components/asset/asset.js";var o=t({tagName:"osb-asset",elementClass:s,react:e,events:{onAssetClick:"asset-click",onAssetDownload:"asset-download",onAssetLoad:"asset-load",onAssetError:"asset-error",onContentClick:"content-click"}}),r=o;export{o as Asset,r as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
"use strict";var d=Object.create;var n=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var u=(e,t)=>{for(var a in t)n(e,a,{get:t[a],enumerable:!0})},m=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of E(t))!p.call(e,o)&&o!==a&&n(e,o,{get:()=>t[o],enumerable:!(r=v(t,o))||r.enumerable});return e};var y=(e,t,a)=>(a=e!=null?d(l(e)):{},m(t||!e||!e.__esModule?n(a,"default",{value:e,enumerable:!0}):a,e)),C=e=>m(n({},"__esModule",{value:!0}),e);var f={};u(f,{SideBar:()=>c,default:()=>N});module.exports=C(f);var s=require("@lit/react"),i=y(require("react"),1),g=require("../../../components/side-bar/side-bar.js"),c=(0,s.createComponent)({tagName:"osb-side-bar",elementClass:g.OSBSideBar,react:i.default,events:{onSearch:"search",onLoadMore:"load-more",onItemAdd:"item-add",onCategoryChange:"category-change",onItemSelect:"item-select",onFileUpload:"file-uploaded"}}),N=c;0&&(module.exports={SideBar});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
import * as _lit_react from '@lit/react';
|
|
3
|
+
import { EventName } from '@lit/react';
|
|
4
|
+
import { OSBSideBar } from '../../../components/side-bar/side-bar.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* React wrapper for the OSBSideBar web component
|
|
8
|
+
*
|
|
9
|
+
* This component provides a React-friendly interface for the Onlive SideBar component.
|
|
10
|
+
* It supports rendering different types of content with customizable display options.
|
|
11
|
+
*/
|
|
12
|
+
declare const SideBar: _lit_react.ReactWebComponent<OSBSideBar, {
|
|
13
|
+
onSearch: EventName<CustomEvent<{
|
|
14
|
+
query: string;
|
|
15
|
+
category: string;
|
|
16
|
+
}>>;
|
|
17
|
+
onLoadMore: EventName<CustomEvent<{
|
|
18
|
+
category: string;
|
|
19
|
+
}>>;
|
|
20
|
+
onItemAdd: EventName<CustomEvent<{
|
|
21
|
+
category: string;
|
|
22
|
+
}>>;
|
|
23
|
+
onCategoryChange: EventName<CustomEvent<{
|
|
24
|
+
category: string;
|
|
25
|
+
}>>;
|
|
26
|
+
onItemSelect: EventName<CustomEvent<{
|
|
27
|
+
item: any;
|
|
28
|
+
}>>;
|
|
29
|
+
onFileUpload: EventName<CustomEvent<{
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
url: string;
|
|
33
|
+
type: string;
|
|
34
|
+
}>>;
|
|
35
|
+
}>;
|
|
36
|
+
|
|
37
|
+
export { SideBar, SideBar as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
import * as _lit_react from '@lit/react';
|
|
3
|
+
import { EventName } from '@lit/react';
|
|
4
|
+
import { OSBSideBar } from '../../../components/side-bar/side-bar.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* React wrapper for the OSBSideBar web component
|
|
8
|
+
*
|
|
9
|
+
* This component provides a React-friendly interface for the Onlive SideBar component.
|
|
10
|
+
* It supports rendering different types of content with customizable display options.
|
|
11
|
+
*/
|
|
12
|
+
declare const SideBar: _lit_react.ReactWebComponent<OSBSideBar, {
|
|
13
|
+
onSearch: EventName<CustomEvent<{
|
|
14
|
+
query: string;
|
|
15
|
+
category: string;
|
|
16
|
+
}>>;
|
|
17
|
+
onLoadMore: EventName<CustomEvent<{
|
|
18
|
+
category: string;
|
|
19
|
+
}>>;
|
|
20
|
+
onItemAdd: EventName<CustomEvent<{
|
|
21
|
+
category: string;
|
|
22
|
+
}>>;
|
|
23
|
+
onCategoryChange: EventName<CustomEvent<{
|
|
24
|
+
category: string;
|
|
25
|
+
}>>;
|
|
26
|
+
onItemSelect: EventName<CustomEvent<{
|
|
27
|
+
item: any;
|
|
28
|
+
}>>;
|
|
29
|
+
onFileUpload: EventName<CustomEvent<{
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
url: string;
|
|
33
|
+
type: string;
|
|
34
|
+
}>>;
|
|
35
|
+
}>;
|
|
36
|
+
|
|
37
|
+
export { SideBar, SideBar as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
import{createComponent as e}from"@lit/react";import t from"react";import{OSBSideBar as a}from"../../../components/side-bar/side-bar.js";var o=e({tagName:"osb-side-bar",elementClass:a,react:t,events:{onSearch:"search",onLoadMore:"load-more",onItemAdd:"item-add",onCategoryChange:"category-change",onItemSelect:"item-select",onFileUpload:"file-uploaded"}}),s=o;export{o as SideBar,s as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
"use strict";var i=Object.create;var p=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var u=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var y=(e,o)=>{for(var t in o)p(e,t,{get:o[t],enumerable:!0})},l=(e,o,t,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of f(o))!v.call(e,r)&&r!==t&&p(e,r,{get:()=>o[r],enumerable:!(a=c(o,r))||a.enumerable});return e};var E=(e,o,t)=>(t=e!=null?i(u(e)):{},l(o||!e||!e.__esModule?p(t,"default",{value:e,enumerable:!0}):t,e)),U=e=>l(p({},"__esModule",{value:!0}),e);var N={};y(N,{Upload:()=>d,default:()=>C});module.exports=U(N);var m=require("@lit/react"),s=E(require("react"),1),n=require("../../../components/upload/upload.js"),d=(0,m.createComponent)({tagName:"osb-upload",elementClass:n.OSBUpload,react:s.default,events:{onFileSelected:"osb-file-selected",onUploadError:"osb-upload-error"}}),C=d;0&&(module.exports={Upload});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
import * as _lit_react from '@lit/react';
|
|
3
|
+
import { EventName } from '@lit/react';
|
|
4
|
+
import { OSBUpload } from '../../../components/upload/upload.js';
|
|
5
|
+
import { UploadType } from '../../../components/upload/upload.types.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* React wrapper for the OSBUpload web component
|
|
9
|
+
*
|
|
10
|
+
* This component provides a React-friendly interface for the Onlive Upload component.
|
|
11
|
+
* It supports file selection with customizable trigger button and dropdown menu for different file types.
|
|
12
|
+
*/
|
|
13
|
+
declare const Upload: _lit_react.ReactWebComponent<OSBUpload, {
|
|
14
|
+
onFileSelected: EventName<CustomEvent<{
|
|
15
|
+
file: File;
|
|
16
|
+
type: UploadType;
|
|
17
|
+
}>>;
|
|
18
|
+
onUploadError: EventName<CustomEvent<{
|
|
19
|
+
error: string;
|
|
20
|
+
}>>;
|
|
21
|
+
}>;
|
|
22
|
+
|
|
23
|
+
export { Upload, Upload as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
import * as _lit_react from '@lit/react';
|
|
3
|
+
import { EventName } from '@lit/react';
|
|
4
|
+
import { OSBUpload } from '../../../components/upload/upload.js';
|
|
5
|
+
import { UploadType } from '../../../components/upload/upload.types.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* React wrapper for the OSBUpload web component
|
|
9
|
+
*
|
|
10
|
+
* This component provides a React-friendly interface for the Onlive Upload component.
|
|
11
|
+
* It supports file selection with customizable trigger button and dropdown menu for different file types.
|
|
12
|
+
*/
|
|
13
|
+
declare const Upload: _lit_react.ReactWebComponent<OSBUpload, {
|
|
14
|
+
onFileSelected: EventName<CustomEvent<{
|
|
15
|
+
file: File;
|
|
16
|
+
type: UploadType;
|
|
17
|
+
}>>;
|
|
18
|
+
onUploadError: EventName<CustomEvent<{
|
|
19
|
+
error: string;
|
|
20
|
+
}>>;
|
|
21
|
+
}>;
|
|
22
|
+
|
|
23
|
+
export { Upload, Upload as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
import{createComponent as e}from"@lit/react";import o from"react";import{OSBUpload as t}from"../../../components/upload/upload.js";var r=e({tagName:"osb-upload",elementClass:t,react:o,events:{onFileSelected:"osb-file-selected",onUploadError:"osb-upload-error"}}),m=r;export{r as Upload,m as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @onlive.ai/common-121 v0.2.
|
|
2
|
-
"use strict";var
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
"use strict";var s=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var d=(t,n)=>{for(var o in n)s(t,o,{get:n[o],enumerable:!0})},l=(t,n,o,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of a(n))!c.call(t,e)&&e!==o&&s(t,e,{get:()=>n[e],enumerable:!(i=r(n,e))||i.enumerable});return t};var p=t=>l(s({},"__esModule",{value:!0}),t);var g={};d(g,{AudioService:()=>u});module.exports=p(g);var u=class t{constructor(){this.sounds=new Map;this.currentSound=null;this.loadSound("ringing","https://a.slack-edge.com/bv1-13/flitterbug-77334dc.mp3"),this.loadSound("incoming","https://cdn.onlive.site/widget-assets/call_phone_ring_tone.mp3")}static getInstance(){return t.instance||(t.instance=new t),t.instance}loadSound(n,o){let i=new Audio(o);i.preload="auto",this.sounds.set(n,i)}playSound(n,o=!1){this.stopCurrentSound();let i=this.sounds.get(n);i&&(i.loop=o,i.currentTime=0,i.play().catch(e=>console.warn("Error playing sound:",e)),this.currentSound=i)}stopCurrentSound(){this.currentSound&&(this.currentSound.pause(),this.currentSound.currentTime=0,this.currentSound=null)}playRinging(n=!0){this.playSound("ringing",n)}playIncoming(n=!0){this.playSound("incoming",n)}};0&&(module.exports={AudioService});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @onlive.ai/common-121 v0.2.
|
|
2
|
-
var
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
var e=class i{constructor(){this.sounds=new Map;this.currentSound=null;this.loadSound("ringing","https://a.slack-edge.com/bv1-13/flitterbug-77334dc.mp3"),this.loadSound("incoming","https://cdn.onlive.site/widget-assets/call_phone_ring_tone.mp3")}static getInstance(){return i.instance||(i.instance=new i),i.instance}loadSound(t,o){let n=new Audio(o);n.preload="auto",this.sounds.set(t,n)}playSound(t,o=!1){this.stopCurrentSound();let n=this.sounds.get(t);n&&(n.loop=o,n.currentTime=0,n.play().catch(s=>console.warn("Error playing sound:",s)),this.currentSound=n)}stopCurrentSound(){this.currentSound&&(this.currentSound.pause(),this.currentSound.currentTime=0,this.currentSound=null)}playRinging(t=!0){this.playSound("ringing",t)}playIncoming(t=!0){this.playSound("incoming",t)}};export{e as AudioService};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
"use strict";var b=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var k=(o,e)=>{for(var t in e)b(o,t,{get:e[t],enumerable:!0})},M=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of w(e))!x.call(o,n)&&n!==t&&b(o,n,{get:()=>e[n],enumerable:!(i=S(e,n))||i.enumerable});return o};var z=o=>M(b({},"__esModule",{value:!0}),o);var q={};k(q,{ConversationService:()=>f,Room:()=>y});module.exports=z(q);var m=require("@onlive.ai/tracker"),p=require("livekit-client");var v=require("firebase/app"),s=require("firebase/database"),u=class{constructor(e){this.onChildChanged=(e,t)=>(0,s.onChildChanged)(this.ref(e),i=>t(i.key||"",i.val(),i));this.onChildRemoved=(e,t)=>(0,s.onChildRemoved)(this.ref(e),i=>t(i.key||"",i.val(),i));this.onChildChangedQuery=(e,t)=>(0,s.onChildChanged)(e,i=>t(i.key||"",i.val(),i));this.onChildRemovedQuery=(e,t)=>(0,s.onChildRemoved)(e,i=>t(i.key||"",i.val(),i));let t=(0,v.initializeApp)(e.config);this.db=(0,s.getDatabase)(t)}ref(e){return(0,s.ref)(this.db,e)}async getOnce(e){let t=await(0,s.get)(this.ref(e));return t.exists()?t.val():null}async getOnceQuery(e){let t=await(0,s.get)(e),i=[];return t.exists()&&t.forEach(n=>{i.push({key:n.key||"",value:n.val()})}),i}onValue(e,t){return(0,s.onValue)(this.ref(e),i=>t(i.key??"",i.val(),i),i=>console.error("onValue error",i))}onValueQuery(e,t){return(0,s.onValue)(e,i=>t(i.key??"",i.val(),i),i=>console.error("onValueQuery error",i))}onChildAdded(e,t){return(0,s.onChildAdded)(this.ref(e),i=>t(i.key||"",i.val(),i),i=>console.error("onChildAdded error",i))}onChildAddedQuery(e,t){return(0,s.onChildAdded)(e,i=>t(i.key||"",i.val(),i),i=>console.error("onChildAddedQuery error",i))}write(e,t){return(0,s.set)(this.ref(e),t)}update(e,t){return(0,s.update)(this.ref(e),t)}remove(e){return(0,s.remove)(this.ref(e))}async push(e,t){let i=(0,s.push)(this.ref(e));return await(0,s.set)(i,t),i.key}onDisconnectUpdate(e,t){return(0,s.onDisconnect)(this.ref(e)).update(t)}cancelOnDisconnect(e){return(0,s.onDisconnect)(this.ref(e)).cancel()}transaction(e,t){return(0,s.runTransaction)(this.ref(e),i=>t(i))}query(e,t={}){let i=this.ref(e);return t.orderBy==="child"&&t.childKey&&(i=(0,s.query)(i,(0,s.orderByChild)(t.childKey))),t.orderBy==="key"&&(i=(0,s.query)(i,(0,s.orderByKey)())),t.orderBy==="value"&&(i=(0,s.query)(i,(0,s.orderByValue)())),t.startAt!=null&&(i=(0,s.query)(i,(0,s.startAt)(t.startAt))),t.endAt!=null&&(i=(0,s.query)(i,(0,s.endAt)(t.endAt))),t.equalTo!=null&&(i=(0,s.query)(i,(0,s.equalTo)(t.equalTo))),t.limitFirst!=null&&(i=(0,s.query)(i,(0,s.limitToFirst)(t.limitFirst))),t.limitLast!=null&&(i=(0,s.query)(i,(0,s.limitToLast)(t.limitLast))),i}};var l=async(o,e)=>{let t=await fetch(o,e);if(!t.ok){let i=await t.json().catch(()=>({}));throw new Error(JSON.stringify({status:t.status,statusText:t.statusText,...i}))}return t&&t.json()};var T=o=>{let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="";for(let i=0;i<o;i++)t+=e.charAt(Math.floor(Math.random()*e.length));return t};var c=require("@onlive.ai/tracker"),d="chatbot",h=class o{static hasSession(){return!!c.Session.getCookie(d)}static getSession(e={role:"guest",regenerate:!1}){e.regenerate&&(c.Session.id=c.Generator.uuid(),c.Session.deleteCookie(d));let t=c.Session.getCookie(d);return t&&o.isValidSession(t,e.role)?t:o.createSession(e.role)}static createSession(e){let t={externalId:e==="agent"?String(o.getUserId()||c.Session.id):c.Session.id,secret:T(16),createdAt:new Date().toISOString()};return c.Session.setCookie(d,t,3600*24*365),t}static isValidSession(e,t){if(t==="guest")return!0;let i=o.getUserId();return!!(i&&String(i)===e.externalId)}static getUserId(){return c.Session.getCookie("user-id",{objectKey:"userId",storageKey:"user",storageType:"localStorage",ttl:3600*24*365,preserveData:!0})}static updateSessionWithRegistrationData(e){let t=c.Session.getCookie(d);if(t||(t=o.createSession("guest")),t){let i={...t,registrationData:e};c.Session.setCookie(d,i,3600*24*365)}}static hasRegistrationData(){return!!c.Session.getCookie(d)?.registrationData}static async getAgentInfo(e){return fetch(`${e}/api/v1/auth/user-info`,{credentials:"include"}).then(t=>t.json())}static getRegistrationData(){return c.Session.getCookie(d)?.registrationData}};var C="lk.chat",I="lk.transcription",A="lk.events",R="typing-indicator";var y=class extends p.Room{},f=class{constructor(e){this.listeners=new Set;this.typingListeners=new Set;this.transcriptionMap=new Map;this.abortControllers={register:new AbortController,createRoom:new AbortController,closeRoom:new AbortController,evaluateRoom:new AbortController,persistMessage:new AbortController,sendMessageReport:new AbortController,deleteMessageReport:new AbortController,updateMessageReactions:new AbortController,getRooms:new AbortController};this.authToken=null;this.firebaseUnsubscribers={};this.seenRequestIds=new Set;this.lastSnapshotById=new Map;this.handleIncomingMessage=async(e,t)=>{let i=e?.info?.id,n=e.info?.attributes?.["lk.segment_id"];n&&(this.transcriptionMap.has(n)?i=this.transcriptionMap.get(n)||"":this.transcriptionMap.set(n,i));let r=t?.identity?this.room.getParticipantByIdentity(t.identity):void 0,a="";for await(let g of e)a+=g,this.emitMessage({id:i,timestamp:Date.now(),message:a,assets:JSON.parse(e.info?.attributes?.assets||"[]"),from:r});this.messagePersistence==="client"&&this.persistMessage({roomId:this.room.id,content:a,externalId:i,identity:r?.identity,kind:r?.kind})};this.emitMessage=e=>{for(let t of this.listeners)t([e])};this.handleDataReceived=(e,t,i,n)=>{if(n===R)try{let r=JSON.parse(new TextDecoder().decode(e));if(r.type==="typing"&&r.participantId!==this.room.localParticipant.identity){let a={type:"typing",isTyping:r.isTyping,timestamp:r.timestamp,participantId:r.participantId};this.emitTypingIndicator(a)}}catch(r){console.warn("Failed to parse typing indicator:",r)}};this.emitTypingIndicator=e=>{for(let t of this.typingListeners)t(e)};this.apiUrl=e.apiUrl,this.authUrl=e.authUrl,this.organizationId=e.organizationId,this.channelTopic=e.channelTopic||C,this.transcriptionTopic=e.transcriptionTopic||I,this.eventsTopic=e.eventsTopic||A,this.messagePersistence=e.messagePersistence||"disabled",this.room=this.createRoomInstance(),e.firebaseConfig&&this.initializeFirebase(e.firebaseConfig)}createRoomInstance(){return new y({adaptiveStream:!0,dynacast:!0})}ensureRoom(){return this.room||(this.room=this.createRoomInstance()),this.room}initializeFirebase(e){this.firebaseApi=new u({config:e}),this.presencePath=`orgs/${this.organizationId}/presence`,this.callsPath=`orgs/${this.organizationId}/calls`}initializeRoomHandlers(){try{this.room.unregisterTextStreamHandler(this.channelTopic),this.room.unregisterTextStreamHandler(this.transcriptionTopic)}catch{}this.room.off(p.RoomEvent.DataReceived,this.handleDataReceived),this.room.registerTextStreamHandler(this.channelTopic,this.handleIncomingMessage),this.room.registerTextStreamHandler(this.transcriptionTopic,this.handleIncomingMessage),this.room.on(p.RoomEvent.DataReceived,this.handleDataReceived)}async registerUser(e,t,i,n){let r=await l(`${this.apiUrl}/users/register`,{method:"POST",body:JSON.stringify({externalId:e,secret:t,...i,metadata:n}),headers:{"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"},signal:this.abortControllers.register.signal});return this.authToken=r.token,r}async registerAgent(e,t){let i=m.Session.getCookie("livekit-agent-token");if(i){if(this.decodeJwtPayload(i)?.username===t.name)return this.authToken=i,i;m.Session.deleteCookie("livekit-agent-token")}let n=await l(`${this.authUrl}/admins/register`,{method:"POST",body:JSON.stringify({externalId:e,name:t.name,email:t.email,avatar:t.avatar}),headers:{"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"},credentials:"include",signal:this.abortControllers.register.signal});return m.Session.setCookie("livekit-agent-token",n.token,1440*60),this.authToken=n.token,n.token}decodeJwtPayload(e){try{let t=e.split(".");if(t.length!==3)return null;let i=t[1],n=atob(i.replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(n)}catch{return null}}async createRoom(e,t={}){this.room=this.ensureRoom();let i=await l(`${this.apiUrl}/rooms`,{method:"POST",body:JSON.stringify(e),headers:{Authorization:`Bearer ${this.authToken}`,"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"},signal:this.abortControllers.createRoom.signal});return this.setRoomMetadata(i),this.setupParticipantAttributesHandler(),this.room.connect(i.wsURL,i.token).then(()=>{this.room.localParticipant.setAttributes(t)}),this.initializeRoomHandlers(),this.room}async joinRoom(e,t,i,n){let r=await l(`${this.apiUrl}/rooms/${e}/join`,{method:"POST",body:JSON.stringify({timezone:t,language:i,...n??{}}),headers:{Authorization:`Bearer ${this.authToken}`,"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"},signal:this.abortControllers.createRoom.signal});return this.setRoomMetadata(r),this.setupParticipantAttributesHandler(),await this.room.connect(r.wsURL,r.token),this.initializeRoomHandlers(),this.room}setRoomMetadata(e){this.room.id=e.id,this.room.groupId=e.groupId,this.room.createdAt=e.createdAt,this.room.connectedAt=new Date().toISOString()}setupParticipantAttributesHandler(){this.room.on(p.RoomEvent.ParticipantAttributesChanged,e=>{e.identity===this.room.localParticipant.identity&&h.updateSessionWithRegistrationData(e.attributes)})}async evaluateRoom(e){let t=e.roomId||this.room?.id;if(!t)throw new Error("Room ID is required for evaluation");return l(`${this.apiUrl}/rooms/${t}/evaluate`,{method:"POST",body:JSON.stringify({rating:e.rating,comment:e.comment}),headers:{Authorization:`Bearer ${this.authToken}`,"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"},signal:this.abortControllers.evaluateRoom.signal})}async closeRoom(){if(this.room)return l(`${this.apiUrl}/rooms/${this.room.id}/close`,{method:"POST",headers:{Authorization:`Bearer ${this.authToken}`,"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"},signal:this.abortControllers.closeRoom.signal})}async disconnect(){this.room&&(this.room.removeAllListeners(),await this.room.disconnect(),this.room=null)}async disconnectAndCloseRoom(){await this.closeRoom(),await this.disconnect()}async readRoom(e){return l(`${this.apiUrl}/rooms/${e}/read`,{method:"POST",headers:{Authorization:`Bearer ${this.authToken}`,"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"},signal:this.abortControllers.persistMessage.signal})}async getRooms(e){let t=new URLSearchParams;return e.page&&t.append("page",e.page.toString()),e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.orderBy&&t.append("orderBy",e.orderBy),e.orderDir&&t.append("orderDir",e.orderDir),e.ids?.length&&t.append("ids",e.ids.join(",")),e.with?.length&&t.append("with",e.with.join(",")),e.count?.length&&t.append("count",e.count.join(",")),e.latestOnly&&t.append("latestOnly",e.latestOnly.toString()),e.includeUnread&&t.append("includeUnread",e.includeUnread.toString()),e.roomStatus&&t.append("roomStatus",e.roomStatus),e.archived&&t.append("archived",e.archived.toString()),e.participantIds?.length&&t.append("participantIds",e.participantIds.join(",")),e.participantExternalIds?.length&&t.append("participantExternalIds",e.participantExternalIds.join(",")),e.groupId&&t.append("groupId",e.groupId),e.hasMessages!==void 0&&t.append("hasMessages",e.hasMessages.toString()),l(`${this.authUrl}/rooms?${t}`,{method:"GET",headers:{"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"},credentials:"include",signal:this.abortControllers.getRooms.signal})}async sendMessage(e,t){let i=await this.room.localParticipant.sendText(e,{topic:this.channelTopic,attributes:t});this.emitMessage({id:i.id,timestamp:Date.now(),message:e,assets:JSON.parse(t?.assets||"[]"),from:this.room.localParticipant}),this.messagePersistence==="client"&&this.persistMessage({roomId:this.room.id,content:e,externalId:i.id,identity:this.room.localParticipant?.identity,kind:this.room.localParticipant?.kind})}async persistMessage(e){return l(`${this.apiUrl}/messages/create`,{method:"POST",body:JSON.stringify(e),headers:{Authorization:`Bearer ${this.authToken}`,"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"},signal:this.abortControllers.persistMessage.signal})}async getMessages(e){let t=new URLSearchParams;return e.limit&&t.append("limit",e.limit.toString()),e.with&&t.append("with",e.with.join(",")),(await l(`${this.apiUrl}/messages/search${t.size?`?${t.toString()}`:""}`,{method:"POST",body:JSON.stringify(e),headers:{Authorization:`Bearer ${this.authToken}`,"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"},signal:this.abortControllers.createRoom.signal})).items}async sendMessageReport(e){try{return l(`${this.apiUrl}/messages/${e.messageId}/report`,{method:"POST",headers:{Authorization:`Bearer ${this.authToken}`,"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"},signal:this.abortControllers.sendMessageReport.signal})}catch(t){console.error("Error sending message report:",t)}}async deleteMessageReport(e){try{return l(`${this.apiUrl}/messages/${e.messageId}/report`,{method:"DELETE",headers:{Authorization:`Bearer ${this.authToken}`,"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"},signal:this.abortControllers.deleteMessageReport.signal})}catch(t){console.error("Error deleting message report:",t)}}async updateMessageReactions(e){try{return l(`${this.apiUrl}/messages/${e.messageId}/reactions`,{method:"PATCH",body:JSON.stringify({add:e.add||[],remove:e.remove||[]}),headers:{Authorization:`Bearer ${this.authToken}`,"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"},signal:this.abortControllers.updateMessageReactions.signal})}catch(t){console.error("Error updating message reactions:",t)}}subscribeMessages(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}async sendTypingIndicator(e){try{let t=new TextEncoder().encode(JSON.stringify({type:"typing",isTyping:e,timestamp:Date.now(),participantId:this.room.localParticipant.identity}));await this.room.localParticipant.publishData(t,{reliable:!1,topic:R})}catch(t){console.warn("Failed to send typing indicator:",t)}}subscribeTypingIndicators(e){return this.typingListeners.add(e),()=>{this.typingListeners.delete(e)}}unsubscribeTypingIndicators(e){this.typingListeners.delete(e)}async sendContextualEvent(e){try{let t=JSON.stringify(e);await this.room.localParticipant.sendText(t,{topic:this.eventsTopic})}catch(t){console.warn("Failed to send event:",t)}}async requestNewRoom(e){return l(`${this.apiUrl}/rooms/request-new`,{method:"POST",body:JSON.stringify(e),headers:{Authorization:`Bearer ${this.authToken}`,"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"}})}async confirmRoomRequest(e){return l(`${this.apiUrl}/rooms/confirm-call`,{method:"POST",body:JSON.stringify({roomId:e}),headers:{Authorization:`Bearer ${this.authToken}`,"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"}})}async cancelRoomRequest(e){return l(`${this.apiUrl}/rooms/cancel-call`,{method:"POST",body:JSON.stringify({roomId:e}),headers:{Authorization:`Bearer ${this.authToken}`,"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"}})}async finishCall(){return l(`${this.apiUrl}/rooms/finish-call`,{method:"POST",body:JSON.stringify({roomId:this.room.id}),headers:{Authorization:`Bearer ${this.authToken}`,"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"}})}isFirebaseEnabled(){return!!(this.firebaseApi&&this.presencePath&&this.callsPath)}getFirebase(){if(!this.firebaseApi||!this.presencePath||!this.callsPath)throw new Error("Firebase is not initialized. Provide firebaseConfig in constructor.");return{api:this.firebaseApi,presencePath:this.presencePath,callsPath:this.callsPath}}buildAgentPresencePath(e){return`${this.presencePath}/${e}`}onPresenceChange(e){let{api:t,presencePath:i}=this.getFirebase();return t.onChildChanged(i,(n,r)=>e(n,r))}onPresenceAgentChange(e,t){let{api:i}=this.getFirebase();return i.onValue(this.buildAgentPresencePath(e),(n,r)=>t(n,r))}async createCallRequest(e){let{api:t,callsPath:i}=this.getFirebase(),r=(await l(`${this.apiUrl}/rooms/call-request`,{method:"POST",headers:{Authorization:`Bearer ${this.authToken}`,"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"},body:JSON.stringify(e)})).id;return t.onDisconnectUpdate(`${i}/${r}`,{status:"disconnected"}),r}onNewCallRequest(e){let{api:t,callsPath:i}=this.getFirebase();return t.onChildAdded(i,(n,r)=>e(n,{...r,id:n}))}onCallRequestChange(e){let{api:t,callsPath:i}=this.getFirebase();return t.onChildChanged(i,(n,r)=>e(n,{...r,id:n}))}onCallRequestRemoved(e){let{api:t,callsPath:i}=this.getFirebase();return t.onChildRemoved(i,n=>e(n))}async acceptCallRequest(e){let{api:t,callsPath:i}=this.getFirebase();return await t.cancelOnDisconnect(`${i}/${e}`),t.update(`${i}/${e}`,{status:"accepted"})}async cancelCallRequest(e){let{api:t,callsPath:i}=this.getFirebase();await t.cancelOnDisconnect(`${i}/${e}`),await l(`${this.apiUrl}/rooms/call-request/cancel`,{method:"POST",headers:{Authorization:`Bearer ${this.authToken}`,"X-Onlive-Organization-Id":this.organizationId,"Content-Type":"application/json"},body:JSON.stringify({callId:e})})}async cancelOnDisconnect(e){let{api:t,callsPath:i}=this.getFirebase();await t.cancelOnDisconnect(`${i}/${e}`)}subscribePendingRequests(e,t={}){let{api:i,callsPath:n}=this.getFirebase();t.resetSeen&&this.seenRequestIds.clear(),this.firebaseUnsubscribers["pending-requests"]?.();let r=i.query(n,{orderBy:"child",childKey:"status",equalTo:"pending"}),a=i.onChildAddedQuery(r,(g,P)=>{if(!g||this.seenRequestIds.has(g))return;let O={...P,id:g};this.seenRequestIds.add(g),e(g,O)});return this.firebaseUnsubscribers["pending-requests"]=a,()=>{a?.(),delete this.firebaseUnsubscribers["pending-requests"]}}subscribeRequestChanges(e){let{api:t,callsPath:i}=this.getFirebase();this.firebaseUnsubscribers["request-changes"]?.();let n=t.onChildChanged(i,(r,a)=>{if(!r)return;let g=JSON.stringify(a);this.lastSnapshotById.get(r)!==g&&(this.lastSnapshotById.set(r,g),e(r,{...a,id:r}))});return this.firebaseUnsubscribers["request-changes"]=n,()=>{n?.(),delete this.firebaseUnsubscribers["request-changes"]}}async tryAcceptRequest(e){let{api:t,callsPath:i}=this.getFirebase(),n=`${i}/${e}`;return await t.transaction(n,a=>a&&(a.status==="pending"?{...a,status:"accepted"}:a)),(await t.getOnce(n))?.status==="accepted"}onRoomSync(e,t){let{api:i}=this.getFirebase(),n=`orgs/${this.organizationId}/rooms/${e}/sync`;return i.onValue(n,(r,a)=>{t(a)})}async clearRoomSync(e,t){let{api:i}=this.getFirebase(),n=`orgs/${this.organizationId}/rooms/${e}/sync`;await i.write(n,{needsSync:!1,reason:t||null,timestamp:Date.now()})}onNewRoomRequest(e,t){let{api:i}=this.getFirebase(),n=`orgs/${this.organizationId}/rooms/${e}/call`;return i.onValue(n,(r,a)=>{t(a)})}unsubscribeAllFirebase(){Object.values(this.firebaseUnsubscribers).forEach(e=>e?.()),this.firebaseUnsubscribers={}}async destroy(){this.unsubscribeAllFirebase(),this.listeners.clear(),this.typingListeners.clear(),this.transcriptionMap.clear(),this.seenRequestIds.clear(),this.lastSnapshotById.clear(),Object.values(this.abortControllers).forEach(e=>e.abort()),await this.disconnect()}};0&&(module.exports={ConversationService,Room});
|