@nlxai/touchpoint-ui 1.1.8-alpha.1 → 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/index.html +37 -5
- package/lib/App.d.ts +2 -0
- package/lib/bidirectional/automaticContext.d.ts +11 -4
- package/lib/bidirectional/commandHandler.d.ts +2 -5
- package/lib/components/FullscreenVoice.d.ts +1 -2
- package/lib/components/Header.d.ts +1 -1
- package/lib/components/Messages.d.ts +1 -1
- package/lib/components/Theme.d.ts +1 -1
- package/lib/components/VoiceMini.d.ts +1 -1
- package/lib/components/defaultModalities/DefaultCard.d.ts +1 -1
- package/lib/components/defaultModalities/DefaultCarousel.d.ts +1 -1
- package/lib/components/defaultModalities/DefaultDateInput.d.ts +1 -1
- package/lib/index.d.ts +2 -20
- package/lib/index.js +15607 -15563
- package/lib/index.umd.js +100 -100
- package/lib/interface.d.ts +478 -0
- package/lib/preview.d.ts +1 -1
- package/lib/types.d.ts +2 -320
- package/package.json +7 -7
- package/tsdoc.json +6 -0
package/index.html
CHANGED
|
@@ -90,6 +90,7 @@
|
|
|
90
90
|
</main>
|
|
91
91
|
<script type="module">
|
|
92
92
|
import { create, html } from "/src/index.tsx";
|
|
93
|
+
import * as z from "zod/v4";
|
|
93
94
|
|
|
94
95
|
const CustomLaunchButton = ({ className, onClick }) => {
|
|
95
96
|
return html`
|
|
@@ -134,19 +135,50 @@
|
|
|
134
135
|
};
|
|
135
136
|
|
|
136
137
|
const touchpoint = await create({
|
|
138
|
+
// https://dev.platform.nlx.ai/applications/fe041de0-bc87-4120-a6db-443ab1107ad3 in the dev workspace
|
|
137
139
|
config: {
|
|
138
140
|
applicationUrl:
|
|
139
|
-
"https://bots.dev.studio.nlx.ai/c/
|
|
141
|
+
"https://bots.dev.studio.nlx.ai/c/XeHWunu1RQOVcVzKIQoo5/cKdh8IsqmA0syks0R9oBh",
|
|
140
142
|
headers: {
|
|
141
|
-
"nlx-api-key": "
|
|
143
|
+
"nlx-api-key": "8afGyqKJoObPj4g-UFNUc65s",
|
|
142
144
|
},
|
|
143
|
-
userId: "
|
|
145
|
+
userId: "sdk-test-user",
|
|
144
146
|
languageCode: "en-US",
|
|
145
147
|
},
|
|
146
|
-
input: "
|
|
148
|
+
input: "voiceMini",
|
|
147
149
|
launchIcon: CustomLaunchButton,
|
|
148
|
-
|
|
150
|
+
bidirectional: {
|
|
151
|
+
custom(action, payload) {
|
|
152
|
+
console.log("Custom bidirectional action:", action, payload);
|
|
153
|
+
},
|
|
154
|
+
customizeAutomaticContext(arg) {
|
|
155
|
+
console.log("Customizing automatic context with arg:", arg);
|
|
156
|
+
arg.context.uri = "foo";
|
|
157
|
+
return arg;
|
|
158
|
+
},
|
|
159
|
+
},
|
|
149
160
|
});
|
|
161
|
+
|
|
162
|
+
touchpoint.setCustomBidirectionalCommands([
|
|
163
|
+
{
|
|
164
|
+
action: "burger",
|
|
165
|
+
description: "Order a hamburger",
|
|
166
|
+
schema: z.object({
|
|
167
|
+
type: z
|
|
168
|
+
.enum(["cheeseburger", "veggieburger", "hamburger"])
|
|
169
|
+
.describe("Which variety of burger to order"),
|
|
170
|
+
count: z
|
|
171
|
+
.number()
|
|
172
|
+
.min(1)
|
|
173
|
+
.max(200)
|
|
174
|
+
.default(1)
|
|
175
|
+
.describe("How many burgers to order"),
|
|
176
|
+
}),
|
|
177
|
+
handler: (burgerType) => {
|
|
178
|
+
console.log("Custom command executed with args:", burgerType);
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
]);
|
|
150
182
|
</script>
|
|
151
183
|
</body>
|
|
152
184
|
</html>
|
package/lib/App.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConversationHandler } from '@nlxai/core';
|
|
2
|
+
import { BidirectionalCustomCommand } from './interface';
|
|
2
3
|
import { NormalizedTouchpointConfiguration } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* Main Touchpoint creation properties object
|
|
@@ -13,6 +14,7 @@ export interface AppRef {
|
|
|
13
14
|
setExpanded: (val: boolean) => void;
|
|
14
15
|
getExpanded: () => boolean;
|
|
15
16
|
getConversationHandler: () => ConversationHandler;
|
|
17
|
+
setCustomBidirectionalCommands: (commands: BidirectionalCustomCommand[]) => void;
|
|
16
18
|
}
|
|
17
19
|
declare const App: import('react').ForwardRefExoticComponent<Props & import('react').RefAttributes<AppRef>>;
|
|
18
20
|
export default App;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { ConversationHandler } from '@nlxai/core';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { BidirectionalContext, BidirectionalCustomCommand, PageState } from '../interface';
|
|
3
|
+
export declare const gatherAutomaticContext: (handler: ConversationHandler, customCommands: BidirectionalCustomCommand[], override: (arg: {
|
|
4
|
+
context: BidirectionalContext;
|
|
5
|
+
state: PageState;
|
|
6
|
+
}) => {
|
|
7
|
+
context: BidirectionalContext;
|
|
8
|
+
state: PageState;
|
|
9
|
+
}, setPageState: (state: PageState) => void) => {
|
|
10
|
+
teardown: () => void;
|
|
11
|
+
onCustomCommandsChange: (commands: BidirectionalCustomCommand[]) => void;
|
|
12
|
+
};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { ConversationHandler } from '@nlxai/core';
|
|
2
|
-
import { BidirectionalConfig } from '../
|
|
2
|
+
import { PageState, BidirectionalConfig } from '../interface';
|
|
3
3
|
export declare const commandHandler: (handler: ConversationHandler, bidirectional: BidirectionalConfig, pageState: {
|
|
4
|
-
current:
|
|
5
|
-
formElements: Record<string, Element>;
|
|
6
|
-
links: Record<string, string>;
|
|
7
|
-
};
|
|
4
|
+
current: PageState;
|
|
8
5
|
}) => () => void;
|
|
@@ -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<{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { Response, ConversationHandler, ApplicationMessage } from '@nlxai/core';
|
|
3
|
-
import { CustomModalityComponent, ColorMode } from '../
|
|
3
|
+
import { CustomModalityComponent, ColorMode } from '../interface';
|
|
4
4
|
export interface MessagesProps {
|
|
5
5
|
isWaiting: boolean;
|
|
6
6
|
handler: ConversationHandler;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context, ConversationHandler } from '@nlxai/core';
|
|
2
2
|
import { FC } from 'react';
|
|
3
|
-
import { CustomModalityComponent } from '../
|
|
3
|
+
import { CustomModalityComponent } from '../interface';
|
|
4
4
|
export declare const VoiceMini: FC<{
|
|
5
5
|
customModalities: Record<string, CustomModalityComponent<unknown>>;
|
|
6
6
|
handler: ConversationHandler;
|
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 } from './
|
|
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,24 +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 {
|
|
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
|
-
}
|
|
32
|
+
export type { WindowSize, ColorMode, ChoiceMessage, CustomModalityComponent, Theme, InitializeConversation, CustomLaunchButton, Input, InputField, PageState, BidirectionalContext, BidirectionalConfig, TouchpointConfiguration, BidirectionalCustomCommand, TouchpointInstance, } from './interface';
|
|
51
33
|
/**
|
|
52
34
|
* Creates a new Touchpoint UI instance and appends it to the document body
|
|
53
35
|
* @param props - Configuration props for Touchpoint
|