@nlxai/touchpoint-ui 1.1.8-alpha.0 → 1.1.8-alpha.2

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,323 +1,5 @@
1
- import { Config, ApplicationMessage, ConversationHandler, Context } from '@nlxai/core';
2
- import { ComponentType } from 'react';
3
- /**
4
- * Window size configuration
5
- */
6
- export type WindowSize = "half" | "full";
7
- /**
8
- * Color mode configuration (light/dark modes)
9
- */
10
- export type ColorMode = "light" | "dark";
11
- /**
12
- * Choice message with metadata
13
- */
14
- export interface ChoiceMessage {
15
- /**
16
- * Message contents
17
- */
18
- message: ApplicationMessage;
19
- /**
20
- * Index in the response transcript history
21
- */
22
- responseIndex: number;
23
- /**
24
- * Message index in the current response
25
- */
26
- messageIndex: number;
27
- }
28
- /**
29
- * Custom Modalities allow rendering of rich components from nodes.
30
- * See: https://docs.studio.nlx.ai/build/resources/modalities
31
- */
32
- export type CustomModalityComponent<Data> = ComponentType<{
33
- /**
34
- * The payload of the Custom Modality. The schema is defined in Dialog Studio settings.
35
- */
36
- data: Data;
37
- /**
38
- * Conversation handler instance
39
- */
40
- conversationHandler: ConversationHandler;
41
- /**
42
- * Whether the component is enabled
43
- * We should probably use context and handle disabling interactive components automatically for the user
44
- * @internal
45
- */
46
- enabled: boolean;
47
- /**
48
- * Class name to propagate to the container
49
- */
50
- className?: string;
51
- }>;
52
- /**
53
- * The full theme expressed as CSS custom properties
54
- */
55
- export interface Theme {
56
- /**
57
- * Font family
58
- */
59
- fontFamily: string;
60
- /**
61
- * Primary color with 80% opacity
62
- */
63
- primary80: string;
64
- /**
65
- * Primary color with 60% opacity
66
- */
67
- primary60: string;
68
- /**
69
- * Primary color with 40% opacity
70
- */
71
- primary40: string;
72
- /**
73
- * Primary color with 20% opacity
74
- */
75
- primary20: string;
76
- /**
77
- * Primary color with 10% opacity
78
- */
79
- primary10: string;
80
- /**
81
- * Primary color with 5% opacity
82
- */
83
- primary5: string;
84
- /**
85
- * Primary color with 1% opacity
86
- */
87
- primary1: string;
88
- /**
89
- * Secondary color with 80% opacity
90
- */
91
- secondary80: string;
92
- /**
93
- * Secondary color with 60% opacity
94
- */
95
- secondary60: string;
96
- /**
97
- * Secondary color with 40% opacity
98
- */
99
- secondary40: string;
100
- /**
101
- * Secondary color with 20% opacity
102
- */
103
- secondary20: string;
104
- /**
105
- * Secondary color with 10% opacity
106
- */
107
- secondary10: string;
108
- /**
109
- * Secondary color with 5% opacity
110
- */
111
- secondary5: string;
112
- /**
113
- * Secondary color with 1% opacity
114
- */
115
- secondary1: string;
116
- /**
117
- * Accent color used e.g. for prominent buttons, the loader animation as well as selected card outlines
118
- */
119
- accent: string;
120
- /**
121
- * Accent color with 20% opacity
122
- */
123
- accent20: string;
124
- /**
125
- * The background color of the main Touchpoint interface
126
- */
127
- background: string;
128
- /**
129
- * The color of the overlay covering the visible portion of the website when the Touchpoint interface does not cover the full screen
130
- */
131
- overlay: string;
132
- /**
133
- * Primary warning color
134
- */
135
- warningPrimary: string;
136
- /**
137
- * Secondary warning color
138
- */
139
- warningSecondary: string;
140
- /**
141
- * Primary error color
142
- */
143
- errorPrimary: string;
144
- /**
145
- * Secondary error color
146
- */
147
- errorSecondary: string;
148
- /**
149
- * Inner border radius: used for most buttons
150
- */
151
- innerBorderRadius: string;
152
- /**
153
- * Outer border radius: generally used for elements that contain buttons that have inner border radius. Also used by the launch button.
154
- */
155
- outerBorderRadius: string;
156
- }
157
- /**
158
- * Custom conversation init method. Defaults to sending the welcome intent
159
- * @param handler - the conversation handler.
160
- * @param context - context set via TouchpointConfiguration.initialContext
161
- */
162
- export type InitializeConversation = (handler: ConversationHandler, context?: Context) => void;
163
- /**
164
- * Fully custom launch icon
165
- */
166
- export type CustomLaunchButton = ComponentType<{
167
- /**
168
- * Class name injected into the component mainly to take care of positioning and z-index. Can be combined with more presentational and sizing-related class names.
169
- */
170
- className?: string;
171
- /**
172
- * Click handler that expands Touchpoint, without the caller having to implement this based on Touchpoint instance methods.
173
- */
174
- onClick?: () => void;
175
- }>;
176
- /**
177
- * Input type for the experience
178
- */
179
- export type Input = "text" | "voice" | "voiceMini";
180
- /**
181
- * Configuration for bidirectional mode of voice+.
182
- */
183
- export type BidirectionalConfig = {
184
- /**
185
- * Attempt to gather and send page context automatically. This will work well on semantically coded pages without too many custom form controls.
186
- * This enables a number of automatic features.
187
- *
188
- * Defaults to `true`.
189
- */
190
- automaticContext?: true;
191
- /**
192
- * Navigation handler for bidirectional mode.
193
- *
194
- * If automatic context gathering is enabled, the default implementation will navigate to those pages using standard `window.location` APIs.
195
- * @param action - The navigation action to perform.
196
- * @param destination - The name of the destination to navigate to if `action` is `"page_custom"`.
197
- * @param destinations - A map of destination names to URLs for custom navigation. Only present if `automaticContext` is enabled.
198
- */
199
- navigation?: (action: "page_next" | "page_previous" | "page_custom" | "page_unknown", destination: string | undefined, destinations: Record<string, string>) => void;
200
- /**
201
- * A callback for filling out form fields in bidirectional mode.
202
- *
203
- * If automatic context gathering is enabled, the default implementation will fill out the form fields using standard DOM APIs.
204
- * @param fields - An array of field objects with `id` and `value` properties.
205
- * @param pageFields - A map of field IDs to DOM elements for custom form filling. Only present if `automaticContext` is enabled.
206
- */
207
- input?: (fields: Array<{
208
- id: string;
209
- value: string;
210
- }>, pageFields: Record<string, Element>) => void;
211
- /**
212
- * A callback for custom actions in bidirectional mode.
213
- * @param action - The custom name of your action.
214
- * @param payload - The payload defined for the custom action.
215
- * @returns
216
- */
217
- custom?: (action: string, payload: unknown) => void;
218
- } | {
219
- /**
220
- * Attempt to gather and send page context automatically. This will work well on semantically coded pages without too many custom form controls.
221
- * This enables a number of automatic features.
222
- *
223
- * Defaults to `true`.
224
- */
225
- automaticContext: false;
226
- /**
227
- * Navigation handler for bidirectional mode.
228
- *
229
- * If automatic context gathering is enabled, the default implementation will navigate to those pages using standard `window.location` APIs.
230
- * @param action - The navigation action to perform.
231
- * @param destination - The name of the destination to navigate to if `action` is `"page_custom"`.
232
- */
233
- navigation?: (action: "page_next" | "page_previous" | "page_custom" | "page_unknown", destination?: string) => void;
234
- /**
235
- * A callback for filling out form fields in bidirectional mode.
236
- *
237
- * If automatic context gathering is enabled, the default implementation will fill out the form fields using standard DOM APIs.
238
- * @param fields - An array of field objects with `id` and `value` properties.
239
- */
240
- input?: (fields: Array<{
241
- id: string;
242
- value: string;
243
- }>) => void;
244
- /**
245
- * A callback for custom actions in bidirectional mode.
246
- * @param action - The custom name of your action.
247
- * @param payload - The payload defined for the custom action.
248
- * @returns
249
- */
250
- custom?: (action: string, payload: unknown) => void;
251
- };
252
- /**
253
- * Main Touchpoint creation properties object
254
- */
255
- export interface TouchpointConfiguration {
256
- /**
257
- * Connection information for the \@nlxai/core conversation handler
258
- */
259
- config: Config;
260
- /**
261
- * Optional window size for the chat window, defaults to `half`
262
- */
263
- windowSize?: WindowSize;
264
- /**
265
- * Optional color mode for the chat window, defaults to `dark`
266
- */
267
- colorMode?: ColorMode;
268
- /**
269
- * URL of icon used to display the brand in the chat header
270
- */
271
- brandIcon?: string;
272
- /**
273
- * URL of icon used on the launch icon in the bottom right when the experience is collapsed.
274
- *
275
- * When set to `false`, no launch button is shown at all. When not set or set to `true`, the default launch icon is rendered.
276
- */
277
- launchIcon?: string | boolean | CustomLaunchButton;
278
- /**
279
- * Specifies whether the user message has bubbles or not
280
- */
281
- userMessageBubble?: boolean;
282
- /**
283
- * Specifies whether the agent message has bubbles or not
284
- */
285
- agentMessageBubble?: boolean;
286
- /**
287
- * Enables chat mode, a classic chat experience with inline loaders and the chat history visible at all times.
288
- */
289
- chatMode?: boolean;
290
- /**
291
- * Optional theme object to override default theme values
292
- */
293
- theme?: Partial<Theme>;
294
- /**
295
- * Optional custom modality components to render in Touchpoint
296
- */
297
- customModalities?: Record<string, CustomModalityComponent<unknown>>;
298
- /**
299
- * Custom conversation init method. Defaults to sending the welcome intent
300
- * @param handler - the conversation handler.
301
- * @param context - the context object
302
- */
303
- initializeConversation?: InitializeConversation;
304
- /**
305
- * Controls the ways in which the user can communicate with the application. Defaults to `"text"`
306
- */
307
- input?: Input;
308
- /**
309
- * Context sent with the initial request.
310
- */
311
- initialContext?: Context;
312
- /**
313
- * Enables bidirectional mode of voice+. Will automatically set the bidirectional flag in the config.
314
- *
315
- */
316
- bidirectional?: BidirectionalConfig;
317
- }
318
- /**
319
- * @internal
320
- */
1
+ import { Config } from '@nlxai/core';
2
+ import { TouchpointConfiguration } from './interface';
321
3
  export type NormalizedTouchpointConfiguration = TouchpointConfiguration & Required<Pick<TouchpointConfiguration, "initializeConversation" | "input">> & {
322
4
  config: Required<Pick<Config, "conversationId" | "userId" | "bidirectional">>;
323
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nlxai/touchpoint-ui",
3
- "version": "1.1.8-alpha.0",
3
+ "version": "1.1.8-alpha.2",
4
4
  "description": "Web UI for Touchpoint",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -27,6 +27,7 @@
27
27
  "@nlxai/core": "^1.1.8-alpha.0",
28
28
  "@react-hookz/web": "^25.0.1",
29
29
  "@react-input/mask": "^2.0.4",
30
+ "@types/json-schema": "^7.0.15",
30
31
  "clsx": "^2.1.1",
31
32
  "hast": "^0.0.2",
32
33
  "htm": "^3.1.1",
@@ -60,5 +61,5 @@
60
61
  "publishConfig": {
61
62
  "access": "public"
62
63
  },
63
- "gitHead": "8f4341c889c73a3b681dcdf25420ecec285c1ef6"
64
+ "gitHead": "a9cf00e44e050d087a2ffa657dc5e73d0bcf6816"
64
65
  }
package/tsdoc.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
3
+ "extends": ["typedoc/tsdoc.json"],
4
+ "noStandardTags": false,
5
+ "tagDefinitions": []
6
+ }