@nlxai/touchpoint-ui 1.0.5-alpha.8 → 1.1.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/lib/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Config, BotMessage, ConversationHandler } from '@nlxai/chat-core';
2
- import { FC } from 'react';
1
+ import { Config, BotMessage, ConversationHandler, Context } from '@nlxai/chat-core';
2
+ import { ComponentType } from 'react';
3
3
  /**
4
4
  * Window size configuration
5
5
  */
@@ -29,7 +29,7 @@ export interface ChoiceMessage {
29
29
  * Custom Modalities allow rendering of rich components from nodes.
30
30
  * See: https://docs.studio.nlx.ai/build/resources/modalities
31
31
  */
32
- export type CustomModalityComponent<Data> = FC<{
32
+ export type CustomModalityComponent<Data> = ComponentType<{
33
33
  /**
34
34
  * The payload of the Custom Modality. The schema is defined in Dialog Studio settings.
35
35
  */
@@ -153,8 +153,13 @@ export interface Theme {
153
153
  /**
154
154
  * Custom conversation init method. Defaults to sending the welcome intent
155
155
  * @param handler - the conversation handler.
156
+ * @param context - context set via TouchpointConfiguration.initialContext
156
157
  */
157
- export type InitializeConversation = (handler: ConversationHandler) => void;
158
+ export type InitializeConversation = (handler: ConversationHandler, context?: Context) => void;
159
+ /**
160
+ * Input type for the experience
161
+ */
162
+ export type Input = "text" | "voice" | "voiceMini";
158
163
  /**
159
164
  * Main Touchpoint creation properties object
160
165
  */
@@ -200,14 +205,19 @@ export interface TouchpointConfiguration {
200
205
  /**
201
206
  * Optional custom modality components to render in Touchpoint
202
207
  */
203
- customModalities?: Record<string, CustomModalityComponent<any>>;
208
+ customModalities?: Record<string, CustomModalityComponent<unknown>>;
204
209
  /**
205
210
  * Custom conversation init method. Defaults to sending the welcome intent
206
211
  * @param handler - the conversation handler.
212
+ * @param context - the context object
207
213
  */
208
214
  initializeConversation?: InitializeConversation;
209
215
  /**
210
216
  * Controls the ways in which the user can communicate with the application. Defaults to `"text"`
211
217
  */
212
- input?: "text" | "voice" | "voiceMini";
218
+ input?: Input;
219
+ /**
220
+ * Context sent with the initial request.
221
+ */
222
+ initialContext?: Context;
213
223
  }
package/lib/voice.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ConversationHandler } from '@nlxai/chat-core';
2
- type VoiceRoomState = "inactive" | "pending" | "active" | "error";
1
+ import { Context, ConversationHandler, ModalityPayloads } from '@nlxai/chat-core';
2
+ type VoiceRoomState = "inactive" | "pending" | "active" | "error" | "terminated";
3
3
  export interface SoundCheck {
4
4
  micAllowed: boolean;
5
5
  micNames: string[];
@@ -10,12 +10,19 @@ interface VoiceHookReturn {
10
10
  isUserSpeaking: boolean;
11
11
  isApplicationSpeaking: boolean;
12
12
  soundCheck: null | SoundCheck;
13
+ roomData: null | ModalitiesWithContext;
13
14
  }
14
15
  interface UseVoiceParams {
15
16
  active: boolean;
16
17
  micEnabled: boolean;
17
18
  speakersEnabled: boolean;
18
19
  handler: ConversationHandler;
20
+ context?: Context;
19
21
  }
20
- export declare const useVoice: ({ active, micEnabled, speakersEnabled, handler, }: UseVoiceParams) => VoiceHookReturn;
22
+ export interface ModalitiesWithContext {
23
+ modalities: ModalityPayloads;
24
+ from?: string;
25
+ timestamp: number;
26
+ }
27
+ export declare const useVoice: ({ active, micEnabled, speakersEnabled, handler, context, }: UseVoiceParams) => VoiceHookReturn;
21
28
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nlxai/touchpoint-ui",
3
- "version": "1.0.5-alpha.8",
3
+ "version": "1.1.0",
4
4
  "description": "Web UI for Touchpoint",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -24,7 +24,7 @@
24
24
  "tsc": "tsc"
25
25
  },
26
26
  "dependencies": {
27
- "@nlxai/chat-core": "^1.0.5-alpha.8",
27
+ "@nlxai/chat-core": "^1.0.5-alpha.13",
28
28
  "@react-hookz/web": "^25.0.1",
29
29
  "@react-input/mask": "^2.0.4",
30
30
  "clsx": "^2.1.1",
@@ -47,6 +47,7 @@
47
47
  "@typescript-eslint/parser": "^7.8.0",
48
48
  "@vitejs/plugin-react": "^4.2.1",
49
49
  "autoprefixer": "^10.4.19",
50
+ "dom-accessibility-api": "^0.7.0",
50
51
  "eslint-config-nlx": "*",
51
52
  "postcss": "^8.4.38",
52
53
  "tailwindcss": "^3.4.3",
@@ -57,5 +58,5 @@
57
58
  "publishConfig": {
58
59
  "access": "public"
59
60
  },
60
- "gitHead": "18cbbadac7360430f812049e5833853223c679f6"
61
+ "gitHead": "adab97fb26a1baa44bb0fddd84f5ef6029709e24"
61
62
  }
@@ -11,7 +11,7 @@ module.exports = {
11
11
  overlay: "48px",
12
12
  },
13
13
  maxWidth: {
14
- content: "608px",
14
+ content: "640px",
15
15
  },
16
16
  borderRadius: {
17
17
  inner: "var(--inner-border-radius)",