@kaltura-apps/genie-chat-react 1.3.3 → 1.5.0-tools.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -175
- package/index.esm.js +695 -1226
- package/package.json +3 -4
- package/src/lib/genie-chat-component.d.ts +49 -0
- package/src/lib/genie-chat-provider.d.ts +59 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaltura-apps/genie-chat-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0-tools.0",
|
|
4
4
|
"author": "kaltura",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"repository": {
|
|
@@ -9,9 +9,8 @@
|
|
|
9
9
|
},
|
|
10
10
|
"types": "./src/index.d.ts",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@unisphere/genie-types": "^1.
|
|
13
|
-
"@unisphere/runtime": "^1.
|
|
14
|
-
"@unisphere/runtime-react": "^1.83.4",
|
|
12
|
+
"@unisphere/genie-types": "^1.22.0-tools.1",
|
|
13
|
+
"@unisphere/runtime-react": "^1.89.0",
|
|
15
14
|
"react": "^19.0.0"
|
|
16
15
|
},
|
|
17
16
|
"module": "./index.esm.js",
|
|
@@ -1,9 +1,58 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PageVisualSettings } from '@unisphere/genie-types';
|
|
3
|
+
/**
|
|
4
|
+
* Visual settings for GenieChat component, excluding internal schema version.
|
|
5
|
+
*/
|
|
3
6
|
type GenieChatSettings = Omit<PageVisualSettings, 'schemaVersion'>;
|
|
7
|
+
/**
|
|
8
|
+
* Standalone Genie chat component with page visual display.
|
|
9
|
+
*
|
|
10
|
+
* This component provides a complete chat interface in page mode,
|
|
11
|
+
* rendering the chat visual with customizable settings and appearance.
|
|
12
|
+
* Use this for embedding chat directly in your application pages.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* Basic usage:
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <GenieChat />
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* With custom settings and styling:
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <GenieChat
|
|
24
|
+
* settings={{
|
|
25
|
+
* customization: {
|
|
26
|
+
* scroll: 'container',
|
|
27
|
+
* theme: { translucent: true }
|
|
28
|
+
* }
|
|
29
|
+
* }}
|
|
30
|
+
* style={{ maxWidth: '800px', margin: '0 auto' }}
|
|
31
|
+
* />
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* With custom loading and error components:
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <GenieChat
|
|
38
|
+
* loadingComponent={<CustomSpinner />}
|
|
39
|
+
* errorComponent={<CustomError />}
|
|
40
|
+
* style={{ height: '600px' }}
|
|
41
|
+
* />
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @param settings - Page visual settings for customizing chat behavior
|
|
45
|
+
* @param initialSettings - Initial visual settings loaded before runtime
|
|
46
|
+
* @param loadingComponent - Custom component to show while chat is loading
|
|
47
|
+
* @param errorComponent - Custom component to show when chat errors occur
|
|
48
|
+
* @param style - Custom CSS styles to apply to the chat container
|
|
49
|
+
* @returns JSX element rendering the Genie chat interface
|
|
50
|
+
*/
|
|
4
51
|
export declare const GenieChat: React.FC<{
|
|
5
52
|
settings?: GenieChatSettings;
|
|
6
53
|
initialSettings?: GenieChatSettings;
|
|
54
|
+
loadingComponent?: React.ReactNode;
|
|
55
|
+
errorComponent?: React.ReactNode;
|
|
7
56
|
style?: React.CSSProperties;
|
|
8
57
|
}>;
|
|
9
58
|
export {};
|
|
@@ -1,10 +1,67 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ChatRuntimeSettings } from '@unisphere/genie-types';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the GenieChatProvider component.
|
|
5
|
+
*/
|
|
3
6
|
export type GenieChatProviderProps = {
|
|
7
|
+
/** Environment to connect to (e.g., 'nvp1', 'irp2'). Defaults to 'nvp1' */
|
|
4
8
|
env?: string;
|
|
9
|
+
/** Language code (e.g., 'en', 'es'). Defaults to 'en' */
|
|
5
10
|
lang?: string;
|
|
11
|
+
/** Theme mode ('light', 'dark') or custom theme object. Defaults to 'light' */
|
|
6
12
|
theme?: 'light' | 'dark' | object;
|
|
13
|
+
/** Runtime configuration settings for the chat. Required. */
|
|
7
14
|
runtimeSettings?: Omit<ChatRuntimeSettings, 'schemaVersion'>;
|
|
8
|
-
|
|
15
|
+
/** Callback when sandbox status changes */
|
|
16
|
+
onStatusChange?: (status: 'idle' | 'loading' | 'ready' | 'error') => void;
|
|
17
|
+
/** Child components to render */
|
|
18
|
+
children: React.ReactNode;
|
|
9
19
|
};
|
|
10
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Provider component that initializes the Genie chat workspace and runtime.
|
|
22
|
+
*
|
|
23
|
+
* This component sets up the Unisphere sandbox, loads the chat runtime,
|
|
24
|
+
* and provides context for child components. Wrap your application with
|
|
25
|
+
* this provider to use Genie chat features.
|
|
26
|
+
*
|
|
27
|
+
* @param props - Component props
|
|
28
|
+
* @returns JSX element
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* Basic usage:
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <GenieChatProvider runtimeSettings={{ /* chat settings *\/ }}>
|
|
34
|
+
* <GenieChatVisual />
|
|
35
|
+
* </GenieChatProvider>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* With optional configuration:
|
|
40
|
+
* ```tsx
|
|
41
|
+
* <GenieChatProvider
|
|
42
|
+
* env="irp2"
|
|
43
|
+
* lang="es"
|
|
44
|
+
* theme="dark"
|
|
45
|
+
* runtimeSettings={{ /* chat settings *\/ }}
|
|
46
|
+
* onStatusChange={(status) => console.log(status)}
|
|
47
|
+
* >
|
|
48
|
+
* <GenieChatVisual />
|
|
49
|
+
* </GenieChatProvider>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare const GenieChatProvider: React.FC<GenieChatProviderProps>;
|
|
53
|
+
/**
|
|
54
|
+
* Visual component that renders the Genie chat interface.
|
|
55
|
+
*
|
|
56
|
+
* This component must be used within a GenieChatProvider. It renders
|
|
57
|
+
* the actual chat UI with all interactive elements.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <GenieChatProvider runtimeSettings={{ /* settings *\/ }}>
|
|
62
|
+
* <GenieChatVisual />
|
|
63
|
+
* </GenieChatProvider>
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare const GenieChatVisual: React.FC<import("@unisphere/runtime-react").UnisphereSandboxVisualProps>;
|
|
67
|
+
export declare const GenieChatSandboxContext: React.Context<import("@unisphere/runtime-react").SandboxContextValue | null>;
|