@nlxai/touchpoint-ui 1.2.4-alpha.9 → 1.2.5

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.
@@ -283,6 +283,10 @@ export interface TouchpointConfiguration {
283
283
  * Controls the ways in which the user can communicate with the application. Defaults to `"text"`
284
284
  */
285
285
  input?: Input;
286
+ /**
287
+ * Sets whether the transcript is shown in `voice` and `voiceMini` inputs.
288
+ */
289
+ showVoiceTranscript?: boolean;
286
290
  /**
287
291
  * Context sent with the initial request.
288
292
  */
@@ -292,17 +296,21 @@ export interface TouchpointConfiguration {
292
296
  *
293
297
  */
294
298
  bidirectional?: BidirectionalConfig;
299
+ /**
300
+ * Copy
301
+ */
302
+ copy?: Partial<Copy>;
295
303
  }
296
304
  /**
297
305
  * The full theme expressed as CSS custom properties.
298
306
  * This means that for instance colors can be made to switch automatically based on the system color mode by using the `light-dark()` CSS function.
299
- * Note also that not all colors need to be provided manually. For instance if only `primary80` is provided, the rest of the primary colors will be computed automatically based on it.
300
- * Therefore, for a fully custom but minimal theme, you only need to provide `accent`, `primary80`, `secondary80`, `background`, `overlay`, and potentially the warning and error colors.
307
+ * Note also that not all colors need to be provided manually. For instance if only `primary` is provided, the rest of the primary colors will be computed automatically based on it.
308
+ * Therefore, for a fully custom but minimal theme, you only need to provide `accent`, `primary`, `secondary`, `background`, `overlay`, and potentially the warning and error colors.
301
309
  * @example
302
310
  * ```typescript
303
311
  * const theme : Partial<Theme> = {
304
- * primary80: "light-dark(rgba(0, 2, 9, 0.8), rgba(255, 255, 255, 0.8))",
305
- * secondary80: "light-dark(rgba(255, 255, 255, 0.8), rgba(0, 2, 9, 0.8))",
312
+ * primary: "light-dark(rgb(0, 2, 9), rgb(255, 255, 255))",
313
+ * secondary: "light-dark(rgb(255, 255, 255), rgb(0, 2, 9))",
306
314
  * accent: "light-dark(rgb(28, 99, 218), rgb(174, 202, 255))",
307
315
  * background: "light-dark(rgba(220, 220, 220, 0.9), rgba(0, 2, 9, 0.9))",
308
316
  * }
@@ -314,6 +322,14 @@ export interface Theme {
314
322
  * Font family
315
323
  */
316
324
  fontFamily: string;
325
+ /**
326
+ * Primary color
327
+ */
328
+ primary: string;
329
+ /**
330
+ * Primary color with 90% opacity
331
+ */
332
+ primary90: string;
317
333
  /**
318
334
  * Primary color with 80% opacity
319
335
  */
@@ -342,6 +358,14 @@ export interface Theme {
342
358
  * Primary color with 1% opacity
343
359
  */
344
360
  primary1: string;
361
+ /**
362
+ * Secondary color
363
+ */
364
+ secondary: string;
365
+ /**
366
+ * Secondary color with 90% opacity
367
+ */
368
+ secondary90: string;
345
369
  /**
346
370
  * Secondary color with 80% opacity
347
371
  */
@@ -514,3 +538,28 @@ export interface TouchpointInstance {
514
538
  */
515
539
  setCustomBidirectionalCommands: (commands: BidirectionalCustomCommand[]) => void;
516
540
  }
541
+ /**
542
+ * Copy configuration
543
+ */
544
+ export interface Copy {
545
+ /**
546
+ * Escalation attempt notice
547
+ */
548
+ escalationAttemptNotice: string;
549
+ /**
550
+ * Escalation notice
551
+ */
552
+ escalationNotice: string;
553
+ /**
554
+ * Restart conversation button label
555
+ */
556
+ restartConversationButtonLabel: string;
557
+ /**
558
+ * Restart conversation button label
559
+ */
560
+ escalationButtonLabel: string;
561
+ /**
562
+ * Send message button label
563
+ */
564
+ sendMessageButtonLabel: string;
565
+ }
@@ -0,0 +1,3 @@
1
+ import { RefObject } from 'react';
2
+ export declare const AppRootProvider: import('react').Provider<RefObject<HTMLElement> | null>;
3
+ export declare const useAppRoot: () => RefObject<HTMLElement> | null;
@@ -0,0 +1,4 @@
1
+ import { Copy } from '../interface';
2
+ export declare const defaultCopy: (languageCode: string) => Copy;
3
+ export declare const CopyProvider: import('react').Provider<Copy>;
4
+ export declare const useCopy: () => Copy;
package/lib/voice.d.ts CHANGED
@@ -1,27 +1,70 @@
1
- import { Context, ConversationHandler, ModalityPayloads } from '@nlxai/core';
2
- export interface SoundCheck {
3
- micAllowed: boolean;
4
- micNames: string[];
5
- speakerNames: string[];
6
- }
7
- export interface ModalitiesWithContext {
8
- modalities: ModalityPayloads;
1
+ import { Context, ModalityPayloads, ConversationHandler, ApplicationMessage } from '@nlxai/core';
2
+ type DebugEvent = any;
3
+ /**
4
+ * Contains modality data paired with timing information.
5
+ */
6
+ export interface RoomDataEventsWithContext {
7
+ /** The modality data. */
8
+ data: RoomDataEvent;
9
+ /** The participant identity the data is from, if available. */
9
10
  from?: string;
11
+ /** The timestamp when the data was received. */
10
12
  timestamp: number;
11
13
  }
12
- type VoiceRoomState = "noAudioPermissions" | "pending" | "active" | "error" | "terminated";
13
- interface VoiceHookReturn {
14
- roomState: VoiceRoomState;
14
+ type RoomDataEvent = {
15
+ type: "agent_interim_response";
16
+ message: string;
17
+ } | {
18
+ type: "agent_response";
19
+ message: string;
20
+ debugEvents?: DebugEvent[];
21
+ } | {
22
+ type: "agent_final_response";
23
+ messages: ApplicationMessage[];
24
+ debugEvents?: DebugEvent[];
25
+ modalities?: ModalityPayloads;
26
+ };
27
+ /**
28
+ * How to handle voice connections.
29
+ */
30
+ export interface VoiceHandler {
31
+ /** Enable or disable the microphone. */
32
+ setMicrophone: (micEnabled: boolean) => Promise<void>;
33
+ /** Enable or disable the speakers. */
34
+ setSpeakers: (speakersEnabled: boolean) => Promise<void>;
35
+ /** Retry connecting to the voice service. */
36
+ retry: () => Promise<void>;
37
+ /** Disconnect from the voice service. Must be called at the end of the session. */
38
+ disconnect: () => Promise<void>;
39
+ }
40
+ /**
41
+ * The state of the voice connection.
42
+ */
43
+ export interface VoiceState {
44
+ /** Whether the voice connection has been terminated from the remote end. */
45
+ isTerminated: boolean;
46
+ /** Is the user speaking at the moment. */
15
47
  isUserSpeaking: boolean;
48
+ /** Is the application/agent speaking at the moment. */
16
49
  isApplicationSpeaking: boolean;
17
- modalities: ModalitiesWithContext[];
18
- retry: () => Promise<void>;
50
+ /** Are the speakers enabled */
51
+ isSpeakersEnabled: boolean;
52
+ /** Is the mic enabled */
53
+ isMicEnabled: boolean;
54
+ /** Interim message */
55
+ interimMessage?: string;
19
56
  }
20
- interface VoiceHookParams {
21
- micEnabled: boolean;
22
- speakersEnabled: boolean;
23
- handler: ConversationHandler;
24
- context?: Context;
57
+ /** Thrown when we detect missing audio permissions */
58
+ export declare class MissingAudioPermissionsError extends Error {
59
+ /** */
60
+ constructor();
25
61
  }
26
- export declare const useVoice: ({ handler, context, speakersEnabled, micEnabled, }: VoiceHookParams) => VoiceHookReturn;
62
+ /**
63
+ * How to handle voice connections.
64
+ * @param handler - The conversation handler.
65
+ * @param context - The context for the voice connection.
66
+ * @param onRoomStateChanged - Callback for when the room state changes.
67
+ * @returns The voice handler.
68
+ */
69
+ export declare const initiateVoice: (handler: ConversationHandler, context: Context, onRoomStateChanged?: (state: VoiceState) => void) => Promise<VoiceHandler>;
27
70
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nlxai/touchpoint-ui",
3
- "version": "1.2.4-alpha.9",
3
+ "version": "1.2.5",
4
4
  "description": "Web UI for Touchpoint",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -14,7 +14,7 @@
14
14
  "design-system": "vite --mode design-system",
15
15
  "build": "tsc && vite build",
16
16
  "docs": "rm -rf docs/ && typedoc && concat-md --decrease-title-levels --dir-name-as-title docs/ > docs/index.md",
17
- "lint:check": "eslint src/ --ext .ts,.tsx,.js,.jsx --max-warnings 0",
17
+ "lint:check": "eslint src/ --ext .ts,.tsx,.js,.jsx --max-warnings 0 && markdown-link-check README.md",
18
18
  "prepublish": "npm run build",
19
19
  "lint": "eslint src/ --ext .ts,.tsx,.js,.jsx --fix",
20
20
  "format": "git ls-files | grep -E '\\.(js|jsx|ts|tsx|css|html)$' | xargs prettier --write",
@@ -22,17 +22,19 @@
22
22
  "publish-docs": "npm run docs && mv docs/index.md ../website/src/content/touchpoint-ui-api-reference.md",
23
23
  "test": "typedoc --emit none && vitest run",
24
24
  "tsc": "tsc",
25
- "update-readme:docs": "rm -rf docs/ && typedoc",
25
+ "update-readme:docs": "rm -rf docs/ && typedoc --excludeExternals --externalPattern src/components/ui/Icons.tsx",
26
26
  "update-readme:merge": "../../scripts/transclude-markdown.js",
27
27
  "update-readme": "npm run update-readme:docs && npm run update-readme:merge"
28
28
  },
29
29
  "dependencies": {
30
- "@nlxai/core": "^1.2.4-alpha.9",
30
+ "@base-ui/react": "^1.1.0",
31
+ "@nlxai/core": "^1.2.4",
31
32
  "@react-hookz/web": "^25.0.1",
32
33
  "@react-input/mask": "^2.0.4",
33
34
  "@rive-app/webgl2": "^2.31.5",
34
35
  "@types/json-schema": "^7.0.15",
35
36
  "clsx": "^2.1.1",
37
+ "dompurify": "^3.3.1",
36
38
  "htm": "^3.1.1",
37
39
  "livekit-client": "^2.15.14",
38
40
  "marked": "^15.0.4",
@@ -44,6 +46,7 @@
44
46
  "react-textarea-autosize": "^8.5.6"
45
47
  },
46
48
  "devDependencies": {
49
+ "@boillodmanuel/markdown-link-check": "^4.7.0",
47
50
  "@rollup/plugin-replace": "^6.0.2",
48
51
  "@tailwindcss/vite": "^4.1.16",
49
52
  "@testing-library/react": "^16.3.1",
@@ -70,5 +73,5 @@
70
73
  "publishConfig": {
71
74
  "access": "public"
72
75
  },
73
- "gitHead": "a749667b96b11c1d187e9f0447abb2ebc755094c"
76
+ "gitHead": "597906e46de64f0183bb8942ac18455be0d4a90d"
74
77
  }