@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.
- package/README.md +52 -8
- package/docs/README.md +45 -5
- package/index.html +46 -54
- package/lib/ProviderStack.d.ts +31 -0
- package/lib/components/FullscreenVoice.d.ts +19 -4
- package/lib/components/Messages.d.ts +5 -0
- package/lib/components/Notice.d.ts +4 -0
- package/lib/components/SafeMarkdown.d.ts +4 -0
- package/lib/components/Theme.d.ts +4 -8
- package/lib/components/VoiceMini.d.ts +3 -1
- package/lib/components/ui/IconButton.d.ts +6 -0
- package/lib/feedback.d.ts +9 -12
- package/lib/index.js +33653 -28274
- package/lib/index.umd.js +131 -114
- package/lib/interface.d.ts +53 -4
- package/lib/utils/useAppRoot.d.ts +3 -0
- package/lib/utils/useCopy.d.ts +4 -0
- package/lib/voice.d.ts +62 -19
- package/package.json +8 -5
- /package/lib/{hooks.d.ts → utils/useTailwindMediaQuery.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -194,6 +194,14 @@ optional input: "text" | "external" | "voice" | "voiceMini";
|
|
|
194
194
|
|
|
195
195
|
Controls the ways in which the user can communicate with the application. Defaults to `"text"`
|
|
196
196
|
|
|
197
|
+
##### showVoiceTranscript?
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
optional showVoiceTranscript: boolean;
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Sets whether the transcript is shown in `voice` and `voiceMini` inputs.
|
|
204
|
+
|
|
197
205
|
##### initialContext?
|
|
198
206
|
|
|
199
207
|
```ts
|
|
@@ -210,6 +218,14 @@ optional bidirectional: BidirectionalConfig;
|
|
|
210
218
|
|
|
211
219
|
Enables bidirectional mode of voice+. Will automatically set the bidirectional flag in the config.
|
|
212
220
|
|
|
221
|
+
##### copy?
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
optional copy: Partial<Copy>;
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Copy
|
|
228
|
+
|
|
213
229
|
---
|
|
214
230
|
|
|
215
231
|
### TouchpointInstance
|
|
@@ -321,15 +337,15 @@ A list containing the custom commands to set.
|
|
|
321
337
|
|
|
322
338
|
The full theme expressed as CSS custom properties.
|
|
323
339
|
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.
|
|
324
|
-
Note also that not all colors need to be provided manually. For instance if only `
|
|
325
|
-
Therefore, for a fully custom but minimal theme, you only need to provide `accent`, `
|
|
340
|
+
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.
|
|
341
|
+
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.
|
|
326
342
|
|
|
327
343
|
#### Example
|
|
328
344
|
|
|
329
345
|
```typescript
|
|
330
346
|
const theme: Partial<Theme> = {
|
|
331
|
-
|
|
332
|
-
|
|
347
|
+
primary: "light-dark(rgb(0, 2, 9), rgb(255, 255, 255))",
|
|
348
|
+
secondary: "light-dark(rgb(255, 255, 255), rgb(0, 2, 9))",
|
|
333
349
|
accent: "light-dark(rgb(28, 99, 218), rgb(174, 202, 255))",
|
|
334
350
|
background: "light-dark(rgba(220, 220, 220, 0.9), rgba(0, 2, 9, 0.9))",
|
|
335
351
|
};
|
|
@@ -345,6 +361,22 @@ fontFamily: string;
|
|
|
345
361
|
|
|
346
362
|
Font family
|
|
347
363
|
|
|
364
|
+
##### primary
|
|
365
|
+
|
|
366
|
+
```ts
|
|
367
|
+
primary: string;
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Primary color
|
|
371
|
+
|
|
372
|
+
##### primary90
|
|
373
|
+
|
|
374
|
+
```ts
|
|
375
|
+
primary90: string;
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
Primary color with 90% opacity
|
|
379
|
+
|
|
348
380
|
##### primary80
|
|
349
381
|
|
|
350
382
|
```ts
|
|
@@ -401,6 +433,22 @@ primary1: string;
|
|
|
401
433
|
|
|
402
434
|
Primary color with 1% opacity
|
|
403
435
|
|
|
436
|
+
##### secondary
|
|
437
|
+
|
|
438
|
+
```ts
|
|
439
|
+
secondary: string;
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
Secondary color
|
|
443
|
+
|
|
444
|
+
##### secondary90
|
|
445
|
+
|
|
446
|
+
```ts
|
|
447
|
+
secondary90: string;
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
Secondary color with 90% opacity
|
|
451
|
+
|
|
404
452
|
##### secondary80
|
|
405
453
|
|
|
406
454
|
```ts
|
|
@@ -1368,10 +1416,6 @@ A handler that will be called with an argument matching the schema when the comm
|
|
|
1368
1416
|
|
|
1369
1417
|
`void`
|
|
1370
1418
|
|
|
1371
|
-
## Other
|
|
1372
|
-
|
|
1373
|
-
- [Icons](@nlxai/namespaces/Icons.md)
|
|
1374
|
-
|
|
1375
1419
|
## Utilities
|
|
1376
1420
|
|
|
1377
1421
|
### version
|
package/docs/README.md
CHANGED
|
@@ -160,7 +160,7 @@ the context object
|
|
|
160
160
|
##### input?
|
|
161
161
|
|
|
162
162
|
```ts
|
|
163
|
-
optional input: "text" | "voice" | "voiceMini";
|
|
163
|
+
optional input: "text" | "external" | "voice" | "voiceMini";
|
|
164
164
|
```
|
|
165
165
|
|
|
166
166
|
Controls the ways in which the user can communicate with the application. Defaults to `"text"`
|
|
@@ -181,6 +181,14 @@ optional bidirectional: BidirectionalConfig;
|
|
|
181
181
|
|
|
182
182
|
Enables bidirectional mode of voice+. Will automatically set the bidirectional flag in the config.
|
|
183
183
|
|
|
184
|
+
##### copy?
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
optional copy: Partial<Copy>;
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Copy
|
|
191
|
+
|
|
184
192
|
---
|
|
185
193
|
|
|
186
194
|
### TouchpointInstance
|
|
@@ -292,15 +300,15 @@ A list containing the custom commands to set.
|
|
|
292
300
|
|
|
293
301
|
The full theme expressed as CSS custom properties.
|
|
294
302
|
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.
|
|
295
|
-
Note also that not all colors need to be provided manually. For instance if only `
|
|
296
|
-
Therefore, for a fully custom but minimal theme, you only need to provide `accent`, `
|
|
303
|
+
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.
|
|
304
|
+
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.
|
|
297
305
|
|
|
298
306
|
#### Example
|
|
299
307
|
|
|
300
308
|
```typescript
|
|
301
309
|
const theme: Partial<Theme> = {
|
|
302
|
-
|
|
303
|
-
|
|
310
|
+
primary: "light-dark(rgb(0, 2, 9), rgb(255, 255, 255))",
|
|
311
|
+
secondary: "light-dark(rgb(255, 255, 255), rgb(0, 2, 9))",
|
|
304
312
|
accent: "light-dark(rgb(28, 99, 218), rgb(174, 202, 255))",
|
|
305
313
|
background: "light-dark(rgba(220, 220, 220, 0.9), rgba(0, 2, 9, 0.9))",
|
|
306
314
|
};
|
|
@@ -316,6 +324,22 @@ fontFamily: string;
|
|
|
316
324
|
|
|
317
325
|
Font family
|
|
318
326
|
|
|
327
|
+
##### primary
|
|
328
|
+
|
|
329
|
+
```ts
|
|
330
|
+
primary: string;
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Primary color
|
|
334
|
+
|
|
335
|
+
##### primary90
|
|
336
|
+
|
|
337
|
+
```ts
|
|
338
|
+
primary90: string;
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Primary color with 90% opacity
|
|
342
|
+
|
|
319
343
|
##### primary80
|
|
320
344
|
|
|
321
345
|
```ts
|
|
@@ -372,6 +396,22 @@ primary1: string;
|
|
|
372
396
|
|
|
373
397
|
Primary color with 1% opacity
|
|
374
398
|
|
|
399
|
+
##### secondary
|
|
400
|
+
|
|
401
|
+
```ts
|
|
402
|
+
secondary: string;
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
Secondary color
|
|
406
|
+
|
|
407
|
+
##### secondary90
|
|
408
|
+
|
|
409
|
+
```ts
|
|
410
|
+
secondary90: string;
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
Secondary color with 90% opacity
|
|
414
|
+
|
|
375
415
|
##### secondary80
|
|
376
416
|
|
|
377
417
|
```ts
|
package/index.html
CHANGED
|
@@ -1,63 +1,55 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<title>Touchpoint</title>
|
|
6
|
-
<link
|
|
7
|
-
href="https://db.onlinewebfonts.com/c/0970e3fd1aa7e6ff6937c76a583f3a30?family=BW+Haas+Text+Mono+C+55+Rom+Regular"
|
|
8
|
-
rel="stylesheet"
|
|
9
|
-
/>
|
|
10
|
-
</head>
|
|
11
3
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
<head>
|
|
5
|
+
<style>
|
|
6
|
+
html,
|
|
7
|
+
body,
|
|
8
|
+
nlx-touchpoint {
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
margin: 0;
|
|
12
|
+
padding: 0;
|
|
13
|
+
}
|
|
14
|
+
</style>
|
|
15
|
+
<meta charset="UTF-8" />
|
|
16
|
+
<title>Touchpoint</title>
|
|
17
|
+
</head>
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
<body>
|
|
20
|
+
<nlx-touchpoint></nlx-touchpoint>
|
|
21
|
+
<script type="module">
|
|
22
|
+
import {create, html} from "./src/index.tsx";
|
|
29
23
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
const touchpointConfig = {
|
|
25
|
+
config: {
|
|
26
|
+
applicationUrl:
|
|
27
|
+
"https://bots.dev.studio.nlx.ai/c/Nji0Tkk8UOqaFc3Z3mDW9/5p7ZdO_XgcnCKnuxbhNAS",
|
|
28
|
+
|
|
29
|
+
headers: {
|
|
30
|
+
"nlx-api-key": "crLjtXvXIOPtc1AgnPHoEE1y",
|
|
35
31
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
languageCode: "en-US",
|
|
33
|
+
conversationId: "12345",
|
|
34
|
+
},
|
|
35
|
+
windowSize: "full",
|
|
36
|
+
input: "text",
|
|
37
|
+
bidirectional: {},
|
|
38
|
+
// colorMode: "light dark",
|
|
39
|
+
// userMessageBubble: true,
|
|
40
|
+
// agentMessageBubble: true,
|
|
41
|
+
// chatMode: true,
|
|
42
|
+
// theme: {
|
|
43
|
+
// accent: "rgba(255, 253, 114, 1)",
|
|
44
|
+
// primary80:
|
|
45
|
+
// "light-dark(rgba(12, 12, 200, 0.8), rgba(255, 255, 255, 0.85))",
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
// fontFamily: "'BW Haas Text Mono C 55 Rom Regular', monospace",
|
|
48
|
+
// },
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
document.querySelector("nlx-touchpoint").touchpointConfiguration = touchpointConfig;
|
|
52
|
+
</script>
|
|
53
|
+
</body>
|
|
51
54
|
|
|
52
|
-
touchpoint.setCustomBidirectionalCommands([
|
|
53
|
-
{
|
|
54
|
-
action: "externalInput",
|
|
55
|
-
// description: "Handle external input",
|
|
56
|
-
handler: (args) => {
|
|
57
|
-
alert(`External input received: ${args}`);
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
]);
|
|
61
|
-
</script>
|
|
62
|
-
</body>
|
|
63
55
|
</html>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { Copy, ColorMode, Theme } from './interface';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare const ProviderStack: FC<{
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
colorMode: ColorMode;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
theme?: Partial<Theme>;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
languageCode: string;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
copy?: Partial<Copy>;
|
|
31
|
+
}>;
|
|
@@ -1,21 +1,36 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { Context, ConversationHandler } from '@nlxai/core';
|
|
1
|
+
import { FC, Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { Context, ConversationHandler, Response } from '@nlxai/core';
|
|
3
3
|
import { ColorMode, CustomModalityComponent } from '../interface';
|
|
4
|
-
import {
|
|
4
|
+
import { VoiceHandler, VoiceState } from '../voice';
|
|
5
5
|
interface Props {
|
|
6
6
|
colorMode: ColorMode;
|
|
7
7
|
handler: ConversationHandler;
|
|
8
|
+
responses: Response[];
|
|
8
9
|
speakersEnabled: boolean;
|
|
10
|
+
showTranscript: boolean;
|
|
9
11
|
brandIcon?: string;
|
|
10
12
|
className?: string;
|
|
11
13
|
context?: Context;
|
|
12
14
|
modalityComponents: Record<string, CustomModalityComponent<unknown>>;
|
|
13
15
|
}
|
|
16
|
+
export type WidgetVoiceState = null | "loading" | {
|
|
17
|
+
type: "error";
|
|
18
|
+
error: string;
|
|
19
|
+
} | {
|
|
20
|
+
type: "success";
|
|
21
|
+
handler: VoiceHandler;
|
|
22
|
+
state?: VoiceState;
|
|
23
|
+
};
|
|
24
|
+
export declare const useWidgetVoiceState: () => [
|
|
25
|
+
WidgetVoiceState,
|
|
26
|
+
Dispatch<SetStateAction<WidgetVoiceState>>
|
|
27
|
+
];
|
|
14
28
|
export declare const VoiceModalities: FC<{
|
|
15
29
|
className?: string;
|
|
16
|
-
|
|
30
|
+
responses: Response[];
|
|
17
31
|
modalityComponents: Record<string, CustomModalityComponent<unknown>>;
|
|
18
32
|
renderedAsOverlay: boolean;
|
|
33
|
+
showTranscript: boolean;
|
|
19
34
|
handler: ConversationHandler;
|
|
20
35
|
}>;
|
|
21
36
|
export declare const FullscreenVoice: FC<Props>;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
5
|
-
className?: string;
|
|
6
|
-
theme?: Partial<Theme>;
|
|
7
|
-
children?: ReactNode;
|
|
8
|
-
}>;
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { Theme } from '../interface';
|
|
3
|
+
export declare const toCustomProperties: (theme: Theme) => CSSProperties;
|
|
4
|
+
export declare const intelligentMerge: (theme: Partial<Theme>) => Theme;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Context, ConversationHandler } from '@nlxai/core';
|
|
1
|
+
import { Context, ConversationHandler, Response } from '@nlxai/core';
|
|
2
2
|
import { FC } from 'react';
|
|
3
3
|
import { CustomModalityComponent } from '../interface';
|
|
4
4
|
export declare const VoiceMini: FC<{
|
|
5
5
|
modalityComponents: Record<string, CustomModalityComponent<unknown>>;
|
|
6
|
+
showTranscript: boolean;
|
|
7
|
+
responses: Response[];
|
|
6
8
|
handler: ConversationHandler;
|
|
7
9
|
brandIcon?: string;
|
|
8
10
|
renderCollapse: boolean;
|
|
@@ -42,6 +42,12 @@ export declare const UnsemanticIconButton: FC<{
|
|
|
42
42
|
type: IconButtonType;
|
|
43
43
|
Icon: FC<IconProps>;
|
|
44
44
|
}>;
|
|
45
|
+
export declare const HeadlessIconButton: FC<{
|
|
46
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
47
|
+
label: string;
|
|
48
|
+
className?: string;
|
|
49
|
+
children: React.ReactNode;
|
|
50
|
+
}>;
|
|
45
51
|
/**
|
|
46
52
|
* A button showing only an icon (textual label is provided for accessibility)
|
|
47
53
|
* @example
|
package/lib/feedback.d.ts
CHANGED
|
@@ -11,27 +11,24 @@ export interface State {
|
|
|
11
11
|
}
|
|
12
12
|
type CommentState = {
|
|
13
13
|
state: "idle";
|
|
14
|
-
} | {
|
|
14
|
+
} | ({
|
|
15
15
|
state: "editing";
|
|
16
|
-
|
|
17
|
-
text: string;
|
|
18
|
-
} | {
|
|
16
|
+
} & ActiveCommentState) | ({
|
|
19
17
|
state: "submitting";
|
|
20
|
-
|
|
21
|
-
text: string;
|
|
22
|
-
} | {
|
|
18
|
+
} & ActiveCommentState) | ({
|
|
23
19
|
state: "submitted";
|
|
24
|
-
|
|
25
|
-
text: string;
|
|
26
|
-
} | {
|
|
20
|
+
} & ActiveCommentState) | ({
|
|
27
21
|
state: "error";
|
|
22
|
+
} & ActiveCommentState);
|
|
23
|
+
interface ActiveCommentState {
|
|
28
24
|
activeFeedbackUrl: string;
|
|
29
25
|
text: string;
|
|
30
|
-
|
|
26
|
+
prompt: string;
|
|
27
|
+
}
|
|
31
28
|
export declare const getFeedbackInfo: (state: State, feedbackUrl: string) => FeedbackInfo;
|
|
32
29
|
export interface Actions {
|
|
33
30
|
clickRating: (feedbackUrl: string, value: number) => void;
|
|
34
|
-
clickCommentButton: (feedbackUrl: string) => void;
|
|
31
|
+
clickCommentButton: (feedbackUrl: string, prompt: string) => void;
|
|
35
32
|
clickCommentEdit: () => void;
|
|
36
33
|
editCommentText: (text: string) => void;
|
|
37
34
|
submitComment: () => Promise<void>;
|