@nlxai/touchpoint-ui 1.1.8-alpha.2 → 1.1.8-alpha.3
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/components/FullscreenVoice.d.ts +1 -2
- package/lib/index.d.ts +2 -73
- package/lib/index.js +15579 -15583
- package/lib/index.umd.js +100 -100
- package/lib/interface.d.ts +70 -0
- package/package.json +6 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { Context, ConversationHandler } from '@nlxai/core';
|
|
3
|
-
import { ColorMode,
|
|
3
|
+
import { ColorMode, CustomModalityComponent } from '../interface';
|
|
4
4
|
import { ModalitiesWithContext } from '../voice';
|
|
5
5
|
interface Props {
|
|
6
6
|
colorMode: ColorMode;
|
|
@@ -9,7 +9,6 @@ interface Props {
|
|
|
9
9
|
brandIcon?: string;
|
|
10
10
|
className?: string;
|
|
11
11
|
context?: Context;
|
|
12
|
-
initializeConversation: InitializeConversation;
|
|
13
12
|
customModalities?: Record<string, CustomModalityComponent<unknown>>;
|
|
14
13
|
}
|
|
15
14
|
export declare const VoiceModalities: FC<{
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ConversationHandler } from '@nlxai/core';
|
|
2
1
|
import { TextButton } from './components/ui/TextButton';
|
|
3
2
|
import { IconButton } from './components/ui/IconButton';
|
|
4
3
|
import { Ripple } from './components/Ripple';
|
|
@@ -6,7 +5,7 @@ import { BaseText, SmallText } from './components/ui/Typography';
|
|
|
6
5
|
import { CustomCard, CustomCardRow, CustomCardImageRow } from './components/ui/CustomCard';
|
|
7
6
|
import { Carousel } from './components/ui/Carousel';
|
|
8
7
|
import { DateInput } from './components/ui/DateInput';
|
|
9
|
-
import { TouchpointConfiguration,
|
|
8
|
+
import { TouchpointConfiguration, TouchpointInstance } from './interface';
|
|
10
9
|
import * as Icons from "./components/ui/Icons";
|
|
11
10
|
export { analyzePageForms, type InteractiveElementInfo, type PageForms, type AccessibilityInformation, } from './bidirectional/analyzePageForms';
|
|
12
11
|
/**
|
|
@@ -30,77 +29,7 @@ export { type CustomCardProps, type CustomCardRowProps, } from './components/ui/
|
|
|
30
29
|
export { type DateInputProps } from './components/ui/DateInput';
|
|
31
30
|
export { type IconButtonProps, type IconButtonType, } from './components/ui/IconButton';
|
|
32
31
|
export { type TextButtonProps } from './components/ui/TextButton';
|
|
33
|
-
export type { WindowSize, ColorMode, ChoiceMessage, CustomModalityComponent, Theme, InitializeConversation, CustomLaunchButton, Input, InputField, PageState, BidirectionalContext, BidirectionalConfig, TouchpointConfiguration, BidirectionalCustomCommand, } from './interface';
|
|
34
|
-
/**
|
|
35
|
-
* Instance of a Touchpoint UI component
|
|
36
|
-
*/
|
|
37
|
-
export interface TouchpointInstance {
|
|
38
|
-
/**
|
|
39
|
-
* Controls whether the Touchpoint UI is expanded or collapsed
|
|
40
|
-
*/
|
|
41
|
-
expanded: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* The conversation handler instance for interacting with the application
|
|
44
|
-
*/
|
|
45
|
-
conversationHandler: ConversationHandler;
|
|
46
|
-
/**
|
|
47
|
-
* Method to remove the Touchpoint UI from the DOM
|
|
48
|
-
*/
|
|
49
|
-
teardown: () => void;
|
|
50
|
-
/**
|
|
51
|
-
* Sets currently available custom bidirectional commands.
|
|
52
|
-
* This allows you to define custom commands that can be used in the voice bot.
|
|
53
|
-
* The commands will be available in the voice bot and can be used to trigger actions.
|
|
54
|
-
*
|
|
55
|
-
* Example:
|
|
56
|
-
* ```javascript
|
|
57
|
-
* client.setCustomBidirectionalCommands([
|
|
58
|
-
* {
|
|
59
|
-
* action: "Meal",
|
|
60
|
-
* description: "add a meal to your flight",
|
|
61
|
-
* schema: {
|
|
62
|
-
* enum: ["standard", "vegetarian", "vegan", "gluten-free"],
|
|
63
|
-
* },
|
|
64
|
-
* handler: (value) => {
|
|
65
|
-
* console.log("Meal option:", value);
|
|
66
|
-
* },
|
|
67
|
-
* },
|
|
68
|
-
* ]);
|
|
69
|
-
* ```
|
|
70
|
-
*
|
|
71
|
-
* This will allow the voice bot to use the command `Meal` with the value `standard`, `vegetarian`, `vegan`, or `gluten-free`.
|
|
72
|
-
*
|
|
73
|
-
* When using more complex arguments, a library such as [Zod](https://zod.dev) can be useful:
|
|
74
|
-
*
|
|
75
|
-
* ```javascript
|
|
76
|
-
* import * as z from "zod/v4";
|
|
77
|
-
*
|
|
78
|
-
* const schema = z.object({
|
|
79
|
-
* "name": z.string().describe("The customer's name, such as John Doe"),
|
|
80
|
-
* "email": z.string().email().describe("The customer's email address"),
|
|
81
|
-
* });
|
|
82
|
-
*
|
|
83
|
-
* client.setCustomBidirectionalCommands([
|
|
84
|
-
* {
|
|
85
|
-
* action: "Meal",
|
|
86
|
-
* description: "add a meal to your flight",
|
|
87
|
-
* schema: z.toJSONSchema(schema, {io: "input"}),
|
|
88
|
-
* handler: (value) => {
|
|
89
|
-
* const result = z.safeParse(schema, value);
|
|
90
|
-
* if (result.success) {
|
|
91
|
-
* // result.data is now type safe and TypeScript can reason about it
|
|
92
|
-
* console.log("Meal option:", result.data);
|
|
93
|
-
* } else {
|
|
94
|
-
* console.error("Failed to parse Meal option:", result.error);
|
|
95
|
-
* }
|
|
96
|
-
* },
|
|
97
|
-
* },
|
|
98
|
-
* ]);
|
|
99
|
-
* ```
|
|
100
|
-
* @param commands - A list containing the custom commands to set.
|
|
101
|
-
*/
|
|
102
|
-
setCustomBidirectionalCommands: (commands: BidirectionalCustomCommand[]) => void;
|
|
103
|
-
}
|
|
32
|
+
export type { WindowSize, ColorMode, ChoiceMessage, CustomModalityComponent, Theme, InitializeConversation, CustomLaunchButton, Input, InputField, PageState, BidirectionalContext, BidirectionalConfig, TouchpointConfiguration, BidirectionalCustomCommand, TouchpointInstance, } from './interface';
|
|
104
33
|
/**
|
|
105
34
|
* Creates a new Touchpoint UI instance and appends it to the document body
|
|
106
35
|
* @param props - Configuration props for Touchpoint
|