@unisphere/genie-types 1.49.0 → 1.51.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/index.esm.js +51 -3
- package/package.json +3 -3
- package/src/lib/avatar-runtime/runtime-types.d.ts +11 -0
- package/src/lib/avatar-runtime/shared-types.d.ts +4 -0
- package/src/lib/chat-runtime/runtime-types.d.ts +4 -0
- package/src/lib/chat-runtime/shared-settings.d.ts +5 -0
- package/src/lib/chat-runtime/visuals-types.d.ts +35 -0
package/index.esm.js
CHANGED
|
@@ -1132,6 +1132,14 @@ const resolveActiveContextType = context => {
|
|
|
1132
1132
|
};
|
|
1133
1133
|
};
|
|
1134
1134
|
const CHAT_CONTEXT_TYPE_GLOBAL = 'global';
|
|
1135
|
+
const speechLanguagesSchema = {
|
|
1136
|
+
type: 'array',
|
|
1137
|
+
optional: true,
|
|
1138
|
+
items: {
|
|
1139
|
+
type: 'primitive',
|
|
1140
|
+
value: 'string'
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1135
1143
|
const chatContextSchema = {
|
|
1136
1144
|
type: 'orByType',
|
|
1137
1145
|
optional: true,
|
|
@@ -1413,6 +1421,8 @@ const chatRuntimeSettingsSchema = {
|
|
|
1413
1421
|
deprecationMessage: 'Use context instead: { type: "entry", id: "your-entry-id" }'
|
|
1414
1422
|
},
|
|
1415
1423
|
agentMode: agentModeSchema,
|
|
1424
|
+
userSpeechLanguages: speechLanguagesSchema,
|
|
1425
|
+
agentSpeechLanguages: speechLanguagesSchema,
|
|
1416
1426
|
// @deprecated - no longer supported
|
|
1417
1427
|
avatarContainerMode: avatarContainerModeSchema,
|
|
1418
1428
|
initialThread: {
|
|
@@ -1477,6 +1487,8 @@ const chatRuntimePlayerPluginSettingsSchema = {
|
|
|
1477
1487
|
integrations: integrationsSchema,
|
|
1478
1488
|
shareUrl: shareUrlSchema,
|
|
1479
1489
|
agentMode: agentModeSchema,
|
|
1490
|
+
userSpeechLanguages: speechLanguagesSchema,
|
|
1491
|
+
agentSpeechLanguages: speechLanguagesSchema,
|
|
1480
1492
|
avatarContainerMode: avatarContainerModeSchema
|
|
1481
1493
|
}
|
|
1482
1494
|
};
|
|
@@ -2028,6 +2040,38 @@ const floaterCTAVisualSettingsSchema = {
|
|
|
2028
2040
|
}
|
|
2029
2041
|
})
|
|
2030
2042
|
};
|
|
2043
|
+
const lobbyVisualSettingsSchema = {
|
|
2044
|
+
type: 'object',
|
|
2045
|
+
properties: {
|
|
2046
|
+
button: {
|
|
2047
|
+
type: 'orByType',
|
|
2048
|
+
optional: 'both',
|
|
2049
|
+
schemas: {
|
|
2050
|
+
content: {
|
|
2051
|
+
type: 'object',
|
|
2052
|
+
properties: {
|
|
2053
|
+
type: {
|
|
2054
|
+
type: 'literal',
|
|
2055
|
+
value: 'content'
|
|
2056
|
+
},
|
|
2057
|
+
title: {
|
|
2058
|
+
type: 'primitive',
|
|
2059
|
+
value: 'string'
|
|
2060
|
+
},
|
|
2061
|
+
icon: {
|
|
2062
|
+
type: 'enum',
|
|
2063
|
+
values: ['mic'],
|
|
2064
|
+
optional: true
|
|
2065
|
+
},
|
|
2066
|
+
onClick: {
|
|
2067
|
+
type: 'function'
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
};
|
|
2031
2075
|
const containedVisualSettingsSchema = {
|
|
2032
2076
|
type: 'object',
|
|
2033
2077
|
properties: Object.assign(Object.assign({}, chatCustomizationSchemaProperties), {
|
|
@@ -2695,7 +2739,9 @@ const avatarRuntimeSettingsSchema = {
|
|
|
2695
2739
|
getSourceUrl: getSourceUrlSchema,
|
|
2696
2740
|
kaltura: kalturaSchema,
|
|
2697
2741
|
features: featuresSchema,
|
|
2698
|
-
multipleAvatarBehavior: multipleAvatarBehaviorSchema
|
|
2742
|
+
multipleAvatarBehavior: multipleAvatarBehaviorSchema,
|
|
2743
|
+
userSpeechLanguages: speechLanguagesSchema,
|
|
2744
|
+
agentSpeechLanguages: speechLanguagesSchema
|
|
2699
2745
|
}
|
|
2700
2746
|
},
|
|
2701
2747
|
// serverConfig: 'studio'
|
|
@@ -2724,7 +2770,9 @@ const avatarRuntimeSettingsSchema = {
|
|
|
2724
2770
|
getSourceUrl: getSourceUrlSchema,
|
|
2725
2771
|
kaltura: kalturaSchema,
|
|
2726
2772
|
features: featuresSchema,
|
|
2727
|
-
multipleAvatarBehavior: multipleAvatarBehaviorSchema
|
|
2773
|
+
multipleAvatarBehavior: multipleAvatarBehaviorSchema,
|
|
2774
|
+
userSpeechLanguages: speechLanguagesSchema,
|
|
2775
|
+
agentSpeechLanguages: speechLanguagesSchema
|
|
2728
2776
|
}
|
|
2729
2777
|
}]
|
|
2730
2778
|
};
|
|
@@ -4176,4 +4224,4 @@ function isTextBlock(b) {
|
|
|
4176
4224
|
}
|
|
4177
4225
|
const hasSources = blocks => blocks.some(b => b.type === 'unisphere-tool' && b.runtimeName === 'sources-tool');
|
|
4178
4226
|
|
|
4179
|
-
export { AVATAR_DEFAULT_CAPABILITIES, AnswerModelEnum, AnswerTypeEnum, AvatarConnectionStatus, AvatarRuntimeName, CHAT_CONTEXT_TYPE, CHAT_CONTEXT_TYPE_GLOBAL, CHAT_DEFAULT_CAPABILITIES, ChatRuntimeName, ChatThreadRuntimeName, DeviceType, DisconnectReasons, INCLUDE_TIME_CAPABILITY, SUPPORTED_LAYOUT_TYPES, TIMEZONE_VARIABLE_NAME, agentModeSchema, avatarContainerModeSchema, avatarRuntimeChatVisualSettingsSchema, avatarRuntimeConnectSettingsSchema, avatarRuntimeContainedVisualSettingsSchema, avatarRuntimeFloaterVisualSettingsSchema, avatarRuntimeHeadFloaterVisualSettingsSchema, avatarRuntimeHeadlessVisualSettingsSchema, avatarRuntimeSettingsSchema, bannerVisualSettingsSchema, blockVisualContextSchema, buildClientRequestVars, chatContextSchema, chatCustomizationSchema, chatCustomizationSchemaProperties, chatRuntimePlayerPluginSettingsSchema, chatRuntimeSettingsSchema, chatThreadRuntimeContainedVisualSettingsSchema, chatThreadRuntimeSettingsSchema, containedVisualSettingsSchema, dynamicVariablesSchema, floaterCTAVisualSettingsSchema, floaterVisualSettingsSchema, getAvatarDefaultCapabilities, getBrowserTimezone, getChatDefaultCapabilities, getResolvedRuntimeName, getResolvedWidgetName, getSourceUrlSchema, hasSources, integrationsSchema, isAvatarConnectionProxyInternalType, isEventChannelsBlock, isEventSessionsBlock, isEventSpeakersBlock, isFlashcardBlock, isFlashcardElement, isFollowupsBlock, isFollowupsElement, isPDFSourceItem, isSourcesBlock, isSourcesElement, isTextBlock, isTextFlashcard, isVideoGalleryFlashcard, isVideoSourceItem, multipleAvatarBehaviorSchema, pageVisualSettingsSchema, popupVisualSettingsSchema, resolveActiveContextType, schemaVersionSchema, shareUrlSchema, widgetName };
|
|
4227
|
+
export { AVATAR_DEFAULT_CAPABILITIES, AnswerModelEnum, AnswerTypeEnum, AvatarConnectionStatus, AvatarRuntimeName, CHAT_CONTEXT_TYPE, CHAT_CONTEXT_TYPE_GLOBAL, CHAT_DEFAULT_CAPABILITIES, ChatRuntimeName, ChatThreadRuntimeName, DeviceType, DisconnectReasons, INCLUDE_TIME_CAPABILITY, SUPPORTED_LAYOUT_TYPES, TIMEZONE_VARIABLE_NAME, agentModeSchema, avatarContainerModeSchema, avatarRuntimeChatVisualSettingsSchema, avatarRuntimeConnectSettingsSchema, avatarRuntimeContainedVisualSettingsSchema, avatarRuntimeFloaterVisualSettingsSchema, avatarRuntimeHeadFloaterVisualSettingsSchema, avatarRuntimeHeadlessVisualSettingsSchema, avatarRuntimeSettingsSchema, bannerVisualSettingsSchema, blockVisualContextSchema, buildClientRequestVars, chatContextSchema, chatCustomizationSchema, chatCustomizationSchemaProperties, chatRuntimePlayerPluginSettingsSchema, chatRuntimeSettingsSchema, chatThreadRuntimeContainedVisualSettingsSchema, chatThreadRuntimeSettingsSchema, containedVisualSettingsSchema, dynamicVariablesSchema, floaterCTAVisualSettingsSchema, floaterVisualSettingsSchema, getAvatarDefaultCapabilities, getBrowserTimezone, getChatDefaultCapabilities, getResolvedRuntimeName, getResolvedWidgetName, getSourceUrlSchema, hasSources, integrationsSchema, isAvatarConnectionProxyInternalType, isEventChannelsBlock, isEventSessionsBlock, isEventSpeakersBlock, isFlashcardBlock, isFlashcardElement, isFollowupsBlock, isFollowupsElement, isPDFSourceItem, isSourcesBlock, isSourcesElement, isTextBlock, isTextFlashcard, isVideoGalleryFlashcard, isVideoSourceItem, lobbyVisualSettingsSchema, multipleAvatarBehaviorSchema, pageVisualSettingsSchema, popupVisualSettingsSchema, resolveActiveContextType, schemaVersionSchema, shareUrlSchema, speechLanguagesSchema, widgetName };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unisphere/genie-types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.51.0",
|
|
4
4
|
"author": "kaltura",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"repository": {
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
},
|
|
10
10
|
"types": "./src/index.d.ts",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@kaltura-sdk/rtc-core": "^1.
|
|
12
|
+
"@kaltura-sdk/rtc-core": "^1.28.0",
|
|
13
13
|
"@unisphere/core": "^1.103.0",
|
|
14
|
-
"@unisphere/runtime": "^1.
|
|
14
|
+
"@unisphere/runtime": "^1.103.0",
|
|
15
15
|
"@unisphere/runtime-js": "^1.98.0"
|
|
16
16
|
},
|
|
17
17
|
"module": "./index.esm.js",
|
|
@@ -102,6 +102,13 @@ export type AvatarRuntime = UnisphereRuntimeBaseType<AvatarRuntimeSettings> & {
|
|
|
102
102
|
muted: boolean;
|
|
103
103
|
isSpeaking: boolean;
|
|
104
104
|
}>;
|
|
105
|
+
/**
|
|
106
|
+
* Observable: the browser's autoplay policy blocked the avatar media (mainly Safari/iOS).
|
|
107
|
+
* The built-in visuals show a prompt; headless hosts should show their own and call resumePlayback().
|
|
108
|
+
*/
|
|
109
|
+
playbackBlocked: TinyDataStoreConsumer<boolean>;
|
|
110
|
+
/** Resume avatar media blocked by the autoplay policy. Must be called synchronously from a user gesture. */
|
|
111
|
+
resumePlayback(): Promise<boolean>;
|
|
105
112
|
/** Observable agent data */
|
|
106
113
|
agentData: TinyDataStoreConsumer<AgentData>;
|
|
107
114
|
/** Observable disconnect data, including reason and error if applicable */
|
|
@@ -205,6 +212,10 @@ export type AvatarRuntimeSettings = {
|
|
|
205
212
|
getSourceUrl?: GlobalChatSettings['getSourceUrl'];
|
|
206
213
|
/** What happens when several avatars share the page and one is already in a call. Defaults to `{ preventDisconnections: false }`. */
|
|
207
214
|
multipleAvatarBehavior?: MultipleAvatarBehavior;
|
|
215
|
+
/** Languages the user speaks (ISO 639-1, ordered, e.g. `['ar', 'en']`); sent to the server as speech-recognition hints. Omit to keep the server default. Applies to both `manual` and `studio` modes. */
|
|
216
|
+
userSpeechLanguages?: GlobalChatSettings['userSpeechLanguages'];
|
|
217
|
+
/** Languages the agent can speak (ISO 639-1, ordered); sent to the server for text-to-speech. Omit to keep the server default. Applies to both `manual` and `studio` modes. */
|
|
218
|
+
agentSpeechLanguages?: GlobalChatSettings['agentSpeechLanguages'];
|
|
208
219
|
} & (({
|
|
209
220
|
serverConfig?: 'manual';
|
|
210
221
|
} & Omit<AvatarServerConfig, 'ks'>) | {
|
|
@@ -515,6 +515,10 @@ export interface AvatarClientManagerType {
|
|
|
515
515
|
readonly audioVolumeLevel: TinyDataStoreConsumer<number>;
|
|
516
516
|
/** Observable available audio devices */
|
|
517
517
|
readonly devicesList: TinyDataStoreConsumer<UserDevicesList | null>;
|
|
518
|
+
/** Observable: avatar media is blocked by the browser's autoplay policy and needs a user gesture */
|
|
519
|
+
readonly playbackBlocked: TinyDataStoreConsumer<boolean>;
|
|
520
|
+
/** Resume media blocked by the autoplay policy. Must be called synchronously from a user gesture. */
|
|
521
|
+
resumePlayback(): Promise<boolean>;
|
|
518
522
|
joinSTV(videoContainerId: string, sessionId: string, stvUrl: string, onConnected: () => void): Promise<void>;
|
|
519
523
|
leaveSTV(): void;
|
|
520
524
|
/** Latest server-issued TURN credentials; read at connection time, never cache or log them. */
|
|
@@ -34,6 +34,10 @@ export interface BaseChatRuntimeSettings {
|
|
|
34
34
|
context?: ChatContext;
|
|
35
35
|
/** Enable agent mode for advanced AI features */
|
|
36
36
|
agentMode?: boolean;
|
|
37
|
+
/** Languages the user speaks (ISO 639-1, ordered, e.g. `['ar', 'en']`); the avatar uses them as speech-recognition hints */
|
|
38
|
+
userSpeechLanguages?: GlobalChatSettings['userSpeechLanguages'];
|
|
39
|
+
/** Languages the agent can speak (ISO 639-1, ordered) */
|
|
40
|
+
agentSpeechLanguages?: GlobalChatSettings['agentSpeechLanguages'];
|
|
37
41
|
/** @deprecated Use customization.avatar.stage instead */
|
|
38
42
|
avatarContainerMode?: 'dialog' | 'contained';
|
|
39
43
|
/** External service integrations (Kaltura player, avatar) */
|
|
@@ -148,6 +148,10 @@ export interface GlobalChatSettings {
|
|
|
148
148
|
capabilities?: GenieCapabilities;
|
|
149
149
|
/** Dynamic variables for genie brain */
|
|
150
150
|
dynamicVariables?: GenieDynamicVariables;
|
|
151
|
+
/** Languages the user speaks (ISO 639-1, ordered, e.g. `['ar', 'en']`); the avatar server uses them as speech-recognition hints. Omit to keep the server default. */
|
|
152
|
+
userSpeechLanguages?: string[];
|
|
153
|
+
/** Languages the agent can speak (ISO 639-1, ordered); the avatar server will use them for text-to-speech. Omit to keep the server default. */
|
|
154
|
+
agentSpeechLanguages?: string[];
|
|
151
155
|
/** Callback function to generate source URLs for an entry or category */
|
|
152
156
|
getSourceUrl?: (params: {
|
|
153
157
|
type: 'category';
|
|
@@ -179,6 +183,7 @@ export interface GlobalChatSettings {
|
|
|
179
183
|
kaltura?: KalturaIntegration;
|
|
180
184
|
};
|
|
181
185
|
}
|
|
186
|
+
export declare const speechLanguagesSchema: ValidatorSchema;
|
|
182
187
|
export declare const chatContextSchema: ValidatorSchema;
|
|
183
188
|
export declare const integrationsSchema: ValidatorSchema;
|
|
184
189
|
export declare const shareUrlSchema: ValidatorSchema;
|
|
@@ -145,6 +145,40 @@ export type FloaterCTAVisualSettings = ModeContextVisualSettings & ChatCustomiza
|
|
|
145
145
|
showIcon?: boolean;
|
|
146
146
|
header?: ChatHeaderSettings;
|
|
147
147
|
};
|
|
148
|
+
/** Lobby start button rendered by the runtime. */
|
|
149
|
+
export type LobbyButtonSettings = {
|
|
150
|
+
type: 'content';
|
|
151
|
+
/** Text shown on the start button */
|
|
152
|
+
title: string;
|
|
153
|
+
/** Icon shown on the start button; no icon when omitted */
|
|
154
|
+
icon?: 'mic';
|
|
155
|
+
/** Called when the start button is clicked */
|
|
156
|
+
onClick: () => void;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Visual settings for the lobby: the avatar preview with a start button.
|
|
160
|
+
* The title and description come from the app init config.
|
|
161
|
+
*
|
|
162
|
+
* `button` behavior:
|
|
163
|
+
* - omitted: the default start button, which launches the avatar
|
|
164
|
+
* - `null`: no start button
|
|
165
|
+
* - `{ type: 'content' }`: a runtime-rendered button; clicking it only calls `onClick`
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* const settings: LobbyVisualSettings = {
|
|
170
|
+
* button: {
|
|
171
|
+
* type: 'content',
|
|
172
|
+
* title: 'Start roleplay',
|
|
173
|
+
* icon: 'mic',
|
|
174
|
+
* onClick: () => openKnobsModal(),
|
|
175
|
+
* },
|
|
176
|
+
* };
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
export type LobbyVisualSettings = {
|
|
180
|
+
button?: null | LobbyButtonSettings;
|
|
181
|
+
};
|
|
148
182
|
export type FloaterVisualSettings = ModeContextVisualSettings & ChatCustomization & {
|
|
149
183
|
openingPosition?: 'left' | 'right';
|
|
150
184
|
header?: ChatHeaderSettings;
|
|
@@ -152,6 +186,7 @@ export type FloaterVisualSettings = ModeContextVisualSettings & ChatCustomizatio
|
|
|
152
186
|
};
|
|
153
187
|
export declare const floaterVisualSettingsSchema: ValidatorSchema;
|
|
154
188
|
export declare const floaterCTAVisualSettingsSchema: ValidatorSchema;
|
|
189
|
+
export declare const lobbyVisualSettingsSchema: ValidatorSchema;
|
|
155
190
|
export declare const containedVisualSettingsSchema: ValidatorSchema;
|
|
156
191
|
export declare const pageVisualSettingsSchema: ValidatorSchema;
|
|
157
192
|
export declare const bannerVisualSettingsSchema: ValidatorSchema;
|