@kaltura-apps/genie-chat-react 1.4.1 → 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 +91 -2
- package/package.json +3 -3
- package/src/lib/genie-chat-component.d.ts +47 -0
- package/src/lib/genie-chat-provider.d.ts +55 -0
package/README.md
CHANGED
|
@@ -1,175 +1 @@
|
|
|
1
|
-
# Unisphere
|
|
2
|
-
|
|
3
|
-
## Running The avatar
|
|
4
|
-
|
|
5
|
-
The following will enable the avatar in the chat in local machine and nvq2:
|
|
6
|
-
1. you can run the avatar in dev mode by using the query param `debugGenieAvatar=dev` (for qa you should use the value qa)
|
|
7
|
-
2. you can also use the cmd+k - `>` and then select **Enable Avatar Mode**
|
|
8
|
-
|
|
9
|
-
## Showing the debug panel for avatars
|
|
10
|
-
|
|
11
|
-
It is automatically shown in avatar-dev application.
|
|
12
|
-
|
|
13
|
-
When in NVQ2, you can show the debug panel by using the query param `debugAvatarChat=true`.
|
|
14
|
-
|
|
15
|
-
## Open avatar automatically when showing the chat
|
|
16
|
-
|
|
17
|
-
When in NVQ2, you can open the avatar automatically when showing the chat by using the query param `debugGenieAutoAvatar=true`.
|
|
18
|
-
|
|
19
|
-
## Develop Avatar Locally
|
|
20
|
-
|
|
21
|
-
> Copy the .env file from `/unisphere/applications/avatar-dev/.env-(dev|qa)-template` to `/unisphere/applications/avatar-dev/.env` and update settings
|
|
22
|
-
|
|
23
|
-
1. run `npm run dev:avatar`
|
|
24
|
-
2. open the browser in http://localhost:4002/
|
|
25
|
-
|
|
26
|
-
You will now use the nvq2 avatar in local development.
|
|
27
|
-
|
|
28
|
-
If you would like to use the Avatar runtime, override port 8400
|
|
29
|
-
|
|
30
|
-
## Develop Chat Locally
|
|
31
|
-
|
|
32
|
-
> Copy the .env file from `/unisphere/applications/chat-dev/.env-template` to `/unisphere/applications/chat-dev/.env` and update settings
|
|
33
|
-
|
|
34
|
-
1. run `npm run dev:chat`
|
|
35
|
-
2. open the browser in http://localhost:4002/
|
|
36
|
-
|
|
37
|
-
You will now use the nvq2 chat in local development.
|
|
38
|
-
|
|
39
|
-
If you would like to use the Chat runtime, override port 8300
|
|
40
|
-
If you would like to use the Avatar runtime, override port 8400
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## Overview
|
|
45
|
-
|
|
46
|
-
This repository is a **Unisphere workspace** for an experience named **{{project-name|human-readable}}**.
|
|
47
|
-
|
|
48
|
-
It contains everything you need to:
|
|
49
|
-
- Create and publish npm / JFrog packages
|
|
50
|
-
- Bundle and version runtime artifacts
|
|
51
|
-
- Build and deploy applications
|
|
52
|
-
- Develop locally and promote changes to production
|
|
53
|
-
|
|
54
|
-
The Unisphere workspace acts as the single entry point for the entire lifecycle — from local development, through CI/CD, and all the way to production deployment.
|
|
55
|
-
|
|
56
|
-
To better understand the ideas behind Unisphere and how it works, read more at:
|
|
57
|
-
https://unisphere.kaltura.com/
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## Prerequisites
|
|
62
|
-
|
|
63
|
-
At the moment, **deploying Unisphere experiences is available only to Kaltura employees**.
|
|
64
|
-
|
|
65
|
-
Before doing anything else, make sure your machine is properly configured to access:
|
|
66
|
-
- Kaltura GitHub repositories
|
|
67
|
-
- Kaltura JFrog Artifactory registries
|
|
68
|
-
|
|
69
|
-
Follow the setup guide here:
|
|
70
|
-
https://unisphere.kaltura.com/docs/create/kaltura-employees/setup-machine
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## Add the Experience to Kaltura Github Organization
|
|
75
|
-
|
|
76
|
-
Before you can deploy or activate this experience, it must be registered in Github under Kaltura Organization.
|
|
77
|
-
|
|
78
|
-
This step connects your Unisphere workspace to the relevant Kaltura infrastructure and enables CI/CD, deployment, and activation flows.
|
|
79
|
-
|
|
80
|
-
Follow the guide here:
|
|
81
|
-
https://unisphere.kaltura.com/docs/create/devops/create-github-repository
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## Create Artifacts
|
|
86
|
-
|
|
87
|
-
Unisphere allows you to create and manage different types of artifacts, including:
|
|
88
|
-
- Packages
|
|
89
|
-
- Runtimes
|
|
90
|
-
- Applications
|
|
91
|
-
|
|
92
|
-
Each artifact type has its own role in the ecosystem, but they all live and evolve together inside this workspace.
|
|
93
|
-
|
|
94
|
-
Read more about creating artifacts here:
|
|
95
|
-
https://unisphere.kaltura.com/docs/create/overview
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
## Deploy
|
|
100
|
-
|
|
101
|
-
To deploy **packages, applications, and runtimes**, follow the deployment guide:
|
|
102
|
-
https://unisphere.kaltura.com/docs/create/devops/deploy
|
|
103
|
-
|
|
104
|
-
For **applications and runtimes**, deployment is only part of the process.
|
|
105
|
-
After deployment, they must also be activated to become available in production.
|
|
106
|
-
|
|
107
|
-
Activation guide:
|
|
108
|
-
https://unisphere.kaltura.com/docs/create/devops/activate
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
## Local Development
|
|
113
|
-
|
|
114
|
-
Unisphere provides a structured local development flow that mirrors production as closely as possible, while still keeping things fast and developer-friendly.
|
|
115
|
-
|
|
116
|
-
This includes:
|
|
117
|
-
- Local builds
|
|
118
|
-
- Watching and rebuilding artifacts
|
|
119
|
-
- Running applications in isolation or as part of a larger workspace
|
|
120
|
-
|
|
121
|
-
Read more about local development here:
|
|
122
|
-
https://unisphere.kaltura.com/docs/create/local-development
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
## Available Commands
|
|
127
|
-
|
|
128
|
-
This workspace exposes a small set of opinionated commands to help you explore, validate, and manage the experience.
|
|
129
|
-
|
|
130
|
-
### Start
|
|
131
|
-
Lists all available commands for each artifact in the experience, including how to build and serve runtimes, and how to spawn applications.
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
npm run start
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
### Info
|
|
139
|
-
Displays information about the current workspace, including detected artifacts, configuration, and environment details.
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
npm run info
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### Check
|
|
146
|
-
Validates the workspace setup and verifies that all required artifacts and configurations are in place.
|
|
147
|
-
|
|
148
|
-
```bash
|
|
149
|
-
npm run check
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### Reset
|
|
153
|
-
Resets the workspace to a clean state. Useful when experimenting or when local state becomes inconsistent.
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
npm run reset
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
---
|
|
161
|
-
|
|
162
|
-
## Next Steps
|
|
163
|
-
|
|
164
|
-
If this is your first time working with Unisphere, a great next step is to **create a runtime with a playground**.
|
|
165
|
-
|
|
166
|
-
Follow the Hello World walkthrough here:
|
|
167
|
-
[https://unisphere.kaltura.com/docs/create/overview](https://unisphere.kaltura.com/docs/create/overview)
|
|
168
|
-
|
|
169
|
-
The walkthrough will guide you through:
|
|
170
|
-
|
|
171
|
-
* Creating your first runtime
|
|
172
|
-
* Running it locally with a playground
|
|
173
|
-
* Understanding how runtimes, packages, and applications connect together
|
|
174
|
-
|
|
175
|
-
This will give you a strong foundation for building and evolving the experience over time.
|
|
1
|
+
# Unisphere Genie - Package Genie Chat React
|
package/index.esm.js
CHANGED
|
@@ -7,6 +7,38 @@ const GenieChatSandbox = createUnisphereSandbox({
|
|
|
7
7
|
widgetName: 'unisphere.widget.genie',
|
|
8
8
|
runtimeName: 'chat'
|
|
9
9
|
});
|
|
10
|
+
/**
|
|
11
|
+
* Provider component that initializes the Genie chat workspace and runtime.
|
|
12
|
+
*
|
|
13
|
+
* This component sets up the Unisphere sandbox, loads the chat runtime,
|
|
14
|
+
* and provides context for child components. Wrap your application with
|
|
15
|
+
* this provider to use Genie chat features.
|
|
16
|
+
*
|
|
17
|
+
* @param props - Component props
|
|
18
|
+
* @returns JSX element
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* Basic usage:
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <GenieChatProvider runtimeSettings={{ /* chat settings *\/ }}>
|
|
24
|
+
* <GenieChatVisual />
|
|
25
|
+
* </GenieChatProvider>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* With optional configuration:
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <GenieChatProvider
|
|
32
|
+
* env="irp2"
|
|
33
|
+
* lang="es"
|
|
34
|
+
* theme="dark"
|
|
35
|
+
* runtimeSettings={{ /* chat settings *\/ }}
|
|
36
|
+
* onStatusChange={(status) => console.log(status)}
|
|
37
|
+
* >
|
|
38
|
+
* <GenieChatVisual />
|
|
39
|
+
* </GenieChatProvider>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
10
42
|
const GenieChatProvider = ({
|
|
11
43
|
children,
|
|
12
44
|
runtimeSettings,
|
|
@@ -29,8 +61,21 @@ const GenieChatProvider = ({
|
|
|
29
61
|
children: children
|
|
30
62
|
});
|
|
31
63
|
};
|
|
32
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Visual component that renders the Genie chat interface.
|
|
66
|
+
*
|
|
67
|
+
* This component must be used within a GenieChatProvider. It renders
|
|
68
|
+
* the actual chat UI with all interactive elements.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```tsx
|
|
72
|
+
* <GenieChatProvider runtimeSettings={{ /* settings *\/ }}>
|
|
73
|
+
* <GenieChatVisual />
|
|
74
|
+
* </GenieChatProvider>
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
33
77
|
const GenieChatVisual = GenieChatSandbox.Visual;
|
|
78
|
+
const GenieChatSandboxContext = GenieChatSandbox.Context;
|
|
34
79
|
|
|
35
80
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
36
81
|
|
|
@@ -1093,6 +1138,50 @@ $({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign },
|
|
|
1093
1138
|
assign: assign
|
|
1094
1139
|
});
|
|
1095
1140
|
|
|
1141
|
+
/**
|
|
1142
|
+
* Standalone Genie chat component with page visual display.
|
|
1143
|
+
*
|
|
1144
|
+
* This component provides a complete chat interface in page mode,
|
|
1145
|
+
* rendering the chat visual with customizable settings and appearance.
|
|
1146
|
+
* Use this for embedding chat directly in your application pages.
|
|
1147
|
+
*
|
|
1148
|
+
* @example
|
|
1149
|
+
* Basic usage:
|
|
1150
|
+
* ```tsx
|
|
1151
|
+
* <GenieChat />
|
|
1152
|
+
* ```
|
|
1153
|
+
*
|
|
1154
|
+
* @example
|
|
1155
|
+
* With custom settings and styling:
|
|
1156
|
+
* ```tsx
|
|
1157
|
+
* <GenieChat
|
|
1158
|
+
* settings={{
|
|
1159
|
+
* customization: {
|
|
1160
|
+
* scroll: 'container',
|
|
1161
|
+
* theme: { translucent: true }
|
|
1162
|
+
* }
|
|
1163
|
+
* }}
|
|
1164
|
+
* style={{ maxWidth: '800px', margin: '0 auto' }}
|
|
1165
|
+
* />
|
|
1166
|
+
* ```
|
|
1167
|
+
*
|
|
1168
|
+
* @example
|
|
1169
|
+
* With custom loading and error components:
|
|
1170
|
+
* ```tsx
|
|
1171
|
+
* <GenieChat
|
|
1172
|
+
* loadingComponent={<CustomSpinner />}
|
|
1173
|
+
* errorComponent={<CustomError />}
|
|
1174
|
+
* style={{ height: '600px' }}
|
|
1175
|
+
* />
|
|
1176
|
+
* ```
|
|
1177
|
+
*
|
|
1178
|
+
* @param settings - Page visual settings for customizing chat behavior
|
|
1179
|
+
* @param initialSettings - Initial visual settings loaded before runtime
|
|
1180
|
+
* @param loadingComponent - Custom component to show while chat is loading
|
|
1181
|
+
* @param errorComponent - Custom component to show when chat errors occur
|
|
1182
|
+
* @param style - Custom CSS styles to apply to the chat container
|
|
1183
|
+
* @returns JSX element rendering the Genie chat interface
|
|
1184
|
+
*/
|
|
1096
1185
|
const GenieChat = ({
|
|
1097
1186
|
style,
|
|
1098
1187
|
settings,
|
|
@@ -1115,4 +1204,4 @@ const GenieChat = ({
|
|
|
1115
1204
|
});
|
|
1116
1205
|
};
|
|
1117
1206
|
|
|
1118
|
-
export { GenieChat, GenieChatProvider, GenieChatVisual };
|
|
1207
|
+
export { GenieChat, GenieChatProvider, GenieChatSandboxContext, GenieChatVisual };
|
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,8 +9,8 @@
|
|
|
9
9
|
},
|
|
10
10
|
"types": "./src/index.d.ts",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@unisphere/genie-types": "^1.
|
|
13
|
-
"@unisphere/runtime-react": "^1.
|
|
12
|
+
"@unisphere/genie-types": "^1.22.0-tools.1",
|
|
13
|
+
"@unisphere/runtime-react": "^1.89.0",
|
|
14
14
|
"react": "^19.0.0"
|
|
15
15
|
},
|
|
16
16
|
"module": "./index.esm.js",
|
|
@@ -1,6 +1,53 @@
|
|
|
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;
|
|
@@ -1,12 +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'>;
|
|
15
|
+
/** Callback when sandbox status changes */
|
|
8
16
|
onStatusChange?: (status: 'idle' | 'loading' | 'ready' | 'error') => void;
|
|
17
|
+
/** Child components to render */
|
|
9
18
|
children: React.ReactNode;
|
|
10
19
|
};
|
|
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
|
+
*/
|
|
11
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
|
+
*/
|
|
12
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>;
|