@nlxai/touchpoint-ui 1.1.4 → 1.1.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/index.html +4 -114
- package/lib/components/FullscreenVoice.d.ts +2 -8
- package/lib/components/VoiceMini.d.ts +0 -1
- package/lib/index.js +5024 -5147
- package/lib/index.umd.js +43 -43
- package/lib/voice.d.ts +9 -11
- package/package.json +5 -3
package/index.html
CHANGED
|
@@ -17,23 +17,7 @@
|
|
|
17
17
|
</head>
|
|
18
18
|
|
|
19
19
|
<body>
|
|
20
|
-
<
|
|
21
|
-
<ul
|
|
22
|
-
onclick="event.preventDefault(); window.history.pushState({}, '', event.target.href); render(event.target.href.split('/').pop());"
|
|
23
|
-
>
|
|
24
|
-
<li>
|
|
25
|
-
<a href="/index.html">Home</a>
|
|
26
|
-
</li>
|
|
27
|
-
<li>
|
|
28
|
-
<a href="/form.html">Form</a>
|
|
29
|
-
</li>
|
|
30
|
-
</ul>
|
|
31
|
-
</nav>
|
|
32
|
-
<div id="app"></div>
|
|
33
|
-
<script type="module">
|
|
34
|
-
window.render = (url) => {
|
|
35
|
-
if (url == "index.html") {
|
|
36
|
-
app.innerHTML = `<main>
|
|
20
|
+
<main>
|
|
37
21
|
<h1>Loreum ipsum dolor sit amet</h1>
|
|
38
22
|
|
|
39
23
|
<p>
|
|
@@ -86,38 +70,6 @@
|
|
|
86
70
|
porttitor nec.
|
|
87
71
|
</p>
|
|
88
72
|
|
|
89
|
-
<h2>Embedded touchpoint</h2>
|
|
90
|
-
|
|
91
|
-
<h3>Text touchpoint defined in HTML</h3>
|
|
92
|
-
<nlx-touchpoint
|
|
93
|
-
configuration='{
|
|
94
|
-
"config": {
|
|
95
|
-
"applicationUrl":
|
|
96
|
-
"https://bots.dev.studio.nlx.ai/c/kQwAgKCx86vJ4r0PUSxYR/ON4zgwWnVofsz2NaiD38Z",
|
|
97
|
-
"headers": {
|
|
98
|
-
"nlx-api-key": "XDE2Th70VhBSlhz2YA"
|
|
99
|
-
},
|
|
100
|
-
"userId": "1234-5678",
|
|
101
|
-
"languageCode": "en-US"
|
|
102
|
-
},
|
|
103
|
-
"input": "text"
|
|
104
|
-
}'
|
|
105
|
-
></nlx-touchpoint>
|
|
106
|
-
|
|
107
|
-
<h3>Voice touchpoint defined in code</h3>
|
|
108
|
-
<button id="voiceTouchpointTrigger">Open Voice Touchpoint</button>
|
|
109
|
-
|
|
110
|
-
<div id="voiceTouchpoint" style="height: 300px"></div>
|
|
111
|
-
|
|
112
|
-
<h3>Voice mini defined in HTML (inline) late initialization</h3>
|
|
113
|
-
|
|
114
|
-
<p>
|
|
115
|
-
<nlx-touchpoint id="voiceMini"></nlx-touchpoint>
|
|
116
|
-
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sint, cum
|
|
117
|
-
repellendus distinctio eveniet id odit sit velit? Vel, autem, quaerat
|
|
118
|
-
quidem natus molestias ea vero cumque et, numquam ab aut!
|
|
119
|
-
</p>
|
|
120
|
-
|
|
121
73
|
<p>
|
|
122
74
|
Orci varius natoque penatibus et magnis dis parturient montes, nascetur
|
|
123
75
|
ridiculus mus. Nunc elementum non urna vel vulputate. Vestibulum vitae
|
|
@@ -135,33 +87,7 @@
|
|
|
135
87
|
volutpat tellus lectus sit amet enim. Duis laoreet lorem vitae lorem
|
|
136
88
|
aliquam bibendum.
|
|
137
89
|
</p>
|
|
138
|
-
</main
|
|
139
|
-
} else if (url == "form.html") {
|
|
140
|
-
app.innerHTML = `<form style="display: grid; grid-template-columns: 100px 300px; gap: 10px;">
|
|
141
|
-
<label for="input">Name:</label>
|
|
142
|
-
<input type="text" id="input" name="input" value="" />
|
|
143
|
-
<label for="input2">Email:</label>
|
|
144
|
-
<input type="email" id="input2" name="input2" value="" />
|
|
145
|
-
<label for="input3">Message:</label>
|
|
146
|
-
<textarea id="input3" name="input3"></textarea>
|
|
147
|
-
<label for="input4">Favourite fruit:</label>
|
|
148
|
-
<select id="input4" name="input4">
|
|
149
|
-
<option value="apple">Apple</option>
|
|
150
|
-
<option value="banana">Banana</option>
|
|
151
|
-
<option value="cherry">Cherry</option>
|
|
152
|
-
<option value="date">Date</option>
|
|
153
|
-
</select>
|
|
154
|
-
<button type="submit">Submit</button>
|
|
155
|
-
</form>`;
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
render(window.location.pathname.split("/").pop());
|
|
159
|
-
window.addEventListener("popstate", (event) => {
|
|
160
|
-
render(window.location.pathname.split("/").pop());
|
|
161
|
-
history.pushState(null, null, document.URL);
|
|
162
|
-
});
|
|
163
|
-
</script>
|
|
164
|
-
|
|
90
|
+
</main>
|
|
165
91
|
<script type="module">
|
|
166
92
|
import { create, html } from "/src/index.tsx";
|
|
167
93
|
|
|
@@ -217,46 +143,10 @@
|
|
|
217
143
|
userId: "1234-5678",
|
|
218
144
|
languageCode: "en-US",
|
|
219
145
|
},
|
|
220
|
-
input: "
|
|
221
|
-
|
|
146
|
+
input: "voice",
|
|
147
|
+
launchIcon: CustomLaunchButton,
|
|
222
148
|
initializeConversation: () => {},
|
|
223
149
|
});
|
|
224
|
-
|
|
225
|
-
voiceTouchpointTrigger.addEventListener("click", () => {
|
|
226
|
-
voiceTouchpointTrigger.parentElement.removeChild(
|
|
227
|
-
voiceTouchpointTrigger,
|
|
228
|
-
);
|
|
229
|
-
const embeddedVoiceTouchpoint =
|
|
230
|
-
document.createElement("nlx-touchpoint");
|
|
231
|
-
embeddedVoiceTouchpoint.touchpointConfiguration = {
|
|
232
|
-
config: {
|
|
233
|
-
applicationUrl:
|
|
234
|
-
"https://bots.dev.studio.nlx.ai/c/CBuQ3LpsClG5EQoSObVkK/IPzJitiaN8qtJFL3Wz1Jp",
|
|
235
|
-
headers: {
|
|
236
|
-
"nlx-api-key": "m3kVBd9QeCc5bXInhWIPG3ns",
|
|
237
|
-
},
|
|
238
|
-
userId: "1234-5678",
|
|
239
|
-
languageCode: "en-US",
|
|
240
|
-
},
|
|
241
|
-
input: "voice",
|
|
242
|
-
initializeConversation: () => {},
|
|
243
|
-
};
|
|
244
|
-
voiceTouchpoint.appendChild(embeddedVoiceTouchpoint);
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
voiceMini.touchpointConfiguration = {
|
|
248
|
-
config: {
|
|
249
|
-
applicationUrl:
|
|
250
|
-
"https://bots.dev.studio.nlx.ai/c/CBuQ3LpsClG5EQoSObVkK/IPzJitiaN8qtJFL3Wz1Jp",
|
|
251
|
-
headers: {
|
|
252
|
-
"nlx-api-key": "m3kVBd9QeCc5bXInhWIPG3ns",
|
|
253
|
-
},
|
|
254
|
-
userId: "1234-5678",
|
|
255
|
-
languageCode: "en-US",
|
|
256
|
-
},
|
|
257
|
-
input: "voiceMini",
|
|
258
|
-
initializeConversation: () => {},
|
|
259
|
-
};
|
|
260
150
|
</script>
|
|
261
151
|
</body>
|
|
262
152
|
</html>
|
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { Context, ConversationHandler } from '@nlxai/chat-core';
|
|
3
3
|
import { ColorMode, InitializeConversation, CustomModalityComponent } from '../types';
|
|
4
|
-
import {
|
|
4
|
+
import { ModalitiesWithContext } from '../voice';
|
|
5
5
|
interface Props {
|
|
6
6
|
colorMode: ColorMode;
|
|
7
7
|
handler: ConversationHandler;
|
|
8
8
|
speakersEnabled: boolean;
|
|
9
9
|
brandIcon?: string;
|
|
10
10
|
className?: string;
|
|
11
|
-
active: boolean;
|
|
12
|
-
setActive: Dispatch<SetStateAction<boolean>>;
|
|
13
11
|
context?: Context;
|
|
14
12
|
initializeConversation: InitializeConversation;
|
|
15
13
|
customModalities?: Record<string, CustomModalityComponent<unknown>>;
|
|
16
14
|
}
|
|
17
|
-
export declare const SoundCheckUi: FC<{
|
|
18
|
-
showDevices: boolean;
|
|
19
|
-
soundCheck: SoundCheck | null;
|
|
20
|
-
}>;
|
|
21
15
|
export declare const VoiceModalities: FC<{
|
|
22
16
|
Wrapper?: FC<{
|
|
23
17
|
children: ReactNode;
|