@kaltura-sdk/avatars 1.17.1 → 1.19.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 CHANGED
@@ -34,7 +34,7 @@ manager.stop(); // full teardown, unsubscribes everything
34
34
  - **Pause/resume**: `pause()`, `resume()`, `pauseAfterSpeaking()`, `isPaused`
35
35
  - **Chat & content**: `askViaText()`, `chatLog`, `content`, `setLocalContent()`, `clearContent()`, `agentData`
36
36
  - **Screen share**: `startScreenShare()`, `stopScreenShare()`, `screenShareInfo`
37
- - **Tap-to-talk**: `tapToTalkStart()`, `tapToTalkEnd()`, `toggleTapToTalkMode()`, `tapToTalkInfo`
37
+ - **Tap-to-talk**: `tapToTalkStart(options?)` (`options.enrichAudio` asks the server to analyze the recording), `tapToTalkEnd()`, `toggleTapToTalkMode()`, `tapToTalkInfo`
38
38
  - **Captions**: `captions` (state + `toggle`/`setReplacements`/`setFilter`)
39
39
  - **Kaltura context**: `kalturaContext`, `toggleKalturaContext()`, `updateDynamicVariables()`
40
40
  - **Client tools**: `registerClientTools()`, `unregisterClientTools()`, `registeredClientTools`, `clientToolCallLog`
package/index.esm.js CHANGED
@@ -18914,6 +18914,7 @@ const parseStageDirective = text => {
18914
18914
 
18915
18915
  const MIN_STEPS = 2;
18916
18916
  const MAX_STEPS = 12;
18917
+ const MIN_SUB_STEPS = 2;
18917
18918
  const MAX_TOOLTIP_LENGTH = 200;
18918
18919
  // Tooltips are optional decoration: bad entries are dropped, never a reason to reject the bar.
18919
18920
  const parseTooltips = (value, totalSteps) => {
@@ -18921,6 +18922,19 @@ const parseTooltips = (value, totalSteps) => {
18921
18922
  const tooltips = value.slice(0, totalSteps).map(entry => typeof entry === 'string' ? entry.trim().slice(0, MAX_TOOLTIP_LENGTH) : '');
18922
18923
  return tooltips.some(Boolean) ? tooltips : null;
18923
18924
  };
18925
+ // Sub-steps are optional decoration like tooltips: invalid values drop them, never the bar.
18926
+ // The last step has no line to split, so it never carries them.
18927
+ const parseSubSteps = (subSteps, currentSubStep, currentStep, totalSteps) => {
18928
+ if (!Number.isInteger(subSteps) || subSteps < MIN_SUB_STEPS || currentStep >= totalSteps) {
18929
+ return null;
18930
+ }
18931
+ const total = subSteps;
18932
+ const current = Number.isInteger(currentSubStep) ? Math.min(total, Math.max(1, currentSubStep)) : 1;
18933
+ return {
18934
+ subSteps: total,
18935
+ currentSubStep: current
18936
+ };
18937
+ };
18924
18938
  const parseVisible = value => {
18925
18939
  if (typeof value === 'boolean') return value;
18926
18940
  if (typeof value !== 'string') return null;
@@ -18945,7 +18959,9 @@ const parseProgressBar = text => {
18945
18959
  currentStep,
18946
18960
  type,
18947
18961
  variant,
18948
- tooltips
18962
+ tooltips,
18963
+ subSteps,
18964
+ currentSubStep
18949
18965
  } = parsed;
18950
18966
  const isVisible = parseVisible(visible);
18951
18967
  if (isVisible === null) return null;
@@ -18957,7 +18973,8 @@ const parseProgressBar = text => {
18957
18973
  return null;
18958
18974
  }
18959
18975
  const stepTooltips = parseTooltips(tooltips, totalSteps);
18960
- return Object.assign(Object.assign({
18976
+ const parts = parseSubSteps(subSteps, currentSubStep, currentStep, totalSteps);
18977
+ return Object.assign(Object.assign(Object.assign({
18961
18978
  visible: isVisible,
18962
18979
  totalSteps: totalSteps,
18963
18980
  currentStep: currentStep,
@@ -18966,7 +18983,7 @@ const parseProgressBar = text => {
18966
18983
  variant
18967
18984
  } : {}), stepTooltips ? {
18968
18985
  tooltips: stepTooltips
18969
- } : {});
18986
+ } : {}), parts !== null && parts !== void 0 ? parts : {});
18970
18987
  };
18971
18988
 
18972
18989
  var $$b = _export;
@@ -19089,11 +19106,14 @@ const buildProgressBarVariable = progressBar => {
19089
19106
  status: 'hidden'
19090
19107
  });
19091
19108
  }
19092
- return JSON.stringify({
19109
+ return JSON.stringify(Object.assign({
19093
19110
  status: 'shown',
19094
19111
  currentStep: progressBar.currentStep,
19095
19112
  totalSteps: progressBar.totalSteps
19096
- });
19113
+ }, progressBar.subSteps ? {
19114
+ subSteps: progressBar.subSteps,
19115
+ currentSubStep: progressBar.currentSubStep
19116
+ } : {}));
19097
19117
  };
19098
19118
 
19099
19119
  const sendJoinRoom = ({
@@ -23083,13 +23103,24 @@ const isTapToTalkEnabled = ({
23083
23103
  };
23084
23104
 
23085
23105
  const sendTapToTalkStart = ({
23086
- context
23106
+ context,
23107
+ event
23087
23108
  }) => {
23109
+ var _a;
23110
+ assertEvent(event, AvatarConnectionMachineEventTypes.RequestTapToTalkStart);
23088
23111
  const client = websocketClientManager.getClient(context.externalInfo.serverUrl);
23089
23112
  if (!client) {
23090
23113
  throw new Error('WebSocket client not found');
23091
23114
  }
23092
- client.emit('tapToTalkStart');
23115
+ const enrichAudio = (_a = event.options) === null || _a === void 0 ? void 0 : _a.enrichAudio;
23116
+ // No payload without options keeps the event identical for servers that predate the flag
23117
+ if (enrichAudio === undefined) {
23118
+ client.emit('tapToTalkStart');
23119
+ return;
23120
+ }
23121
+ client.emit('tapToTalkStart', {
23122
+ enrichAudio
23123
+ });
23093
23124
  };
23094
23125
 
23095
23126
  const sendTapToTalkEnd = ({
@@ -24218,7 +24249,7 @@ class AvatarClientManager extends ActorManager {
24218
24249
  pauseAvatar: () => this.pause(),
24219
24250
  resumeAvatar: () => this.resume(),
24220
24251
  pauseAvatarAfterSpeaking: () => this.pauseAfterSpeaking(),
24221
- tapToTalkStart: () => this.tapToTalkStart(),
24252
+ tapToTalkStart: options => this.tapToTalkStart(options),
24222
24253
  tapToTalkEnd: () => this.tapToTalkEnd(),
24223
24254
  clearContent: () => this.clearContent(),
24224
24255
  toggleCaptions: () => this.toggleCaptions(),
@@ -24437,10 +24468,11 @@ class AvatarClientManager extends ActorManager {
24437
24468
  get tapToTalkInfo() {
24438
24469
  return this._tapToTalkInfo.consumer;
24439
24470
  }
24440
- tapToTalkStart() {
24471
+ tapToTalkStart(options) {
24441
24472
  var _a;
24442
24473
  (_a = this._actor) === null || _a === void 0 ? void 0 : _a.send({
24443
- type: AvatarConnectionMachineEventTypes.RequestTapToTalkStart
24474
+ type: AvatarConnectionMachineEventTypes.RequestTapToTalkStart,
24475
+ options
24444
24476
  });
24445
24477
  }
24446
24478
  tapToTalkEnd() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaltura-sdk/avatars",
3
- "version": "1.17.1",
3
+ "version": "1.19.0",
4
4
  "author": "kaltura",
5
5
  "license": "AGPL-3.0",
6
6
  "repository": {
@@ -13,7 +13,7 @@
13
13
  "@kaltura-sdk/rtc-core": "^1.26.2",
14
14
  "@local/genie-shared-utils": "^1.0.0",
15
15
  "@unisphere/core": "^1.99.0",
16
- "@unisphere/genie-types": "^1.42.1",
16
+ "@unisphere/genie-types": "^1.44.0",
17
17
  "@unisphere/notifications-core": "^1.25.0",
18
18
  "@unisphere/runtime": "^1.98.0",
19
19
  "@unisphere/runtime-js": "^1.98.0",
@@ -1,6 +1,6 @@
1
1
  import { UnisphereLoggerType } from '@unisphere/core';
2
2
  import { KalturaAnalyticsServiceType, PubSubServiceType } from '@unisphere/runtime';
3
- import { AgentData, AgentKalturaContextData, AgentProgressBar, AgentScreenShareInfo, AgentTapToTalkInfo, AvatarClientManagerType, AvatarConnectionProxInternalType, AvatarConnectionProxyType, AvatarConnectionStatus, AvatarContentData, AvatarRuntimeSettings, CaptionConfig, Captions, ChatEntry, ClientToolCallLogEntry, DisconnectReasons } from '@unisphere/genie-types';
3
+ import { AgentData, AgentKalturaContextData, AgentProgressBar, AgentScreenShareInfo, AgentTapToTalkInfo, AvatarClientManagerType, AvatarConnectionProxInternalType, AvatarConnectionProxyType, AvatarConnectionStatus, AvatarContentData, AvatarRuntimeSettings, CaptionConfig, Captions, ChatEntry, ClientToolCallLogEntry, DisconnectReasons, TapToTalkStartOptions } from '@unisphere/genie-types';
4
4
  import { type AvatarClientToolsInput, type AvatarConnectionActor } from './machines/avatar-connection';
5
5
  import { AvatarClientManagerActions } from './types';
6
6
  import { DeviceType } from '@kaltura-sdk/rtc-core';
@@ -128,7 +128,7 @@ export declare class AvatarClientManager extends ActorManager<AvatarConnectionAc
128
128
  startScreenShare(): void;
129
129
  stopScreenShare(): void;
130
130
  get tapToTalkInfo(): import("@unisphere/core").TinyDataStoreConsumer<AgentTapToTalkInfo | null>;
131
- tapToTalkStart(): void;
131
+ tapToTalkStart(options?: TapToTalkStartOptions): void;
132
132
  tapToTalkEnd(): void;
133
133
  toggleTapToTalkMode(enabled: boolean): void;
134
134
  get captions(): Captions;
@@ -1,4 +1,2 @@
1
- import { AvatarConnectionMachineContext } from '../../types';
2
- export declare const sendTapToTalkStart: ({ context, }: {
3
- context: AvatarConnectionMachineContext;
4
- }) => void;
1
+ import { AvatarConnectionMachineAction } from '../../types';
2
+ export declare const sendTapToTalkStart: AvatarConnectionMachineAction;
@@ -2,7 +2,7 @@ import { DoneActorEvent, ErrorActorEvent } from 'xstate';
2
2
  import { ChatEntry, UnisphereChatBlock } from '@unisphere/genie-types';
3
3
  import { askPermissionsSchema, clientConfigurationSchema, conversationEndedSchema, conversationTimeWarningSchema, joinCompleteSchema, noAgentSchema, onServerConnectedSchema, showAgentSchema, showStartSpeechSchema, stvFinishedTalkingSchema, stvNewSessionSchema, stvStartedTalkingSchema } from './schemas';
4
4
  import z from 'zod';
5
- import { AgentProgressBar, CaptionState, ClientToolCallLogEntry, DisconnectReasons } from '@unisphere/genie-types';
5
+ import { AgentProgressBar, CaptionState, ClientToolCallLogEntry, DisconnectReasons, TapToTalkStartOptions } from '@unisphere/genie-types';
6
6
  export declare enum AvatarConnectionMachineEventTypes {
7
7
  Disconnect = "Disconnect",
8
8
  WebsocketReconnected = "WebsocketReconnected",
@@ -212,6 +212,7 @@ export type SetDynamicVariablesEvent = {
212
212
  };
213
213
  export type RequestTapToTalkStartEvent = {
214
214
  type: AvatarConnectionMachineEventTypes.RequestTapToTalkStart;
215
+ options?: TapToTalkStartOptions;
215
216
  };
216
217
  export type RequestTapToTalkEndEvent = {
217
218
  type: AvatarConnectionMachineEventTypes.RequestTapToTalkEnd;