@nlxai/touchpoint-ui 1.1.3 → 1.1.4

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
@@ -173,6 +173,78 @@ export type CustomLaunchButton = ComponentType<{
173
173
  * Input type for the experience
174
174
  */
175
175
  export type Input = "text" | "voice" | "voiceMini";
176
+ /**
177
+ * Configuration for bidirectional mode of voice+.
178
+ */
179
+ export type BidirectionalConfig = {
180
+ /**
181
+ * Attempt to gather and send page context automatically. This will work well on semantically coded pages without too many custom form controls.
182
+ * This enables a number of automatic features.
183
+ *
184
+ * Defaults to `false`.
185
+ */
186
+ automaticContext?: true;
187
+ /**
188
+ * Navigation handler for bidirectional mode.
189
+ *
190
+ * If automatic context gathering is enabled, the default implementation will navigate to those pages using standard `window.location` APIs.
191
+ * @param action - The navigation action to perform.
192
+ * @param destination - The name of the destination to navigate to if `action` is `"page_custom"`.
193
+ * @param destinations - A map of destination names to URLs for custom navigation. Only present if `automaticContext` is enabled.
194
+ */
195
+ navigation?: (action: "page_next" | "page_previous" | "page_custom", destination: string | undefined, destinations: Record<string, string>) => void;
196
+ /**
197
+ * A callback for filling out form fields in bidirectional mode.
198
+ *
199
+ * If automatic context gathering is enabled, the default implementation will fill out the form fields using standard DOM APIs.
200
+ * @param fields - An array of field objects with `id` and `value` properties.
201
+ * @param pageFields - A map of field IDs to DOM elements for custom form filling. Only present if `automaticContext` is enabled.
202
+ */
203
+ input?: (fields: Array<{
204
+ id: string;
205
+ value: string;
206
+ }>, pageFields: Record<string, Element>) => void;
207
+ /**
208
+ * A callback for custom actions in bidirectional mode.
209
+ * @param action - The custom name of your action.
210
+ * @param payload - The payload defined for the custom action.
211
+ * @returns
212
+ */
213
+ custom?: (action: string, payload: unknown) => void;
214
+ } | {
215
+ /**
216
+ * Attempt to gather and send page context automatically. This will work well on semantically coded pages without too many custom form controls.
217
+ * This enables a number of automatic features.
218
+ *
219
+ * Defaults to `false`.
220
+ */
221
+ automaticContext: false;
222
+ /**
223
+ * Navigation handler for bidirectional mode.
224
+ *
225
+ * If automatic context gathering is enabled, the default implementation will navigate to those pages using standard `window.location` APIs.
226
+ * @param action - The navigation action to perform.
227
+ * @param destination - The name of the destination to navigate to if `action` is `"page_custom"`.
228
+ */
229
+ navigation?: (action: "page_next" | "page_previous" | "page_custom", destination?: string) => void;
230
+ /**
231
+ * A callback for filling out form fields in bidirectional mode.
232
+ *
233
+ * If automatic context gathering is enabled, the default implementation will fill out the form fields using standard DOM APIs.
234
+ * @param fields - An array of field objects with `id` and `value` properties.
235
+ */
236
+ input?: (fields: Array<{
237
+ id: string;
238
+ value: string;
239
+ }>) => void;
240
+ /**
241
+ * A callback for custom actions in bidirectional mode.
242
+ * @param action - The custom name of your action.
243
+ * @param payload - The payload defined for the custom action.
244
+ * @returns
245
+ */
246
+ custom?: (action: string, payload: unknown) => void;
247
+ };
176
248
  /**
177
249
  * Main Touchpoint creation properties object
178
250
  */
@@ -226,11 +298,20 @@ export interface TouchpointConfiguration {
226
298
  */
227
299
  initializeConversation?: InitializeConversation;
228
300
  /**
229
- * Controls the ways in which the user can communicate with the application. Defaults to `"text"`
301
+ * Controls the ways in which the user can communicate with the application. Defaults to `"text"`
230
302
  */
231
303
  input?: Input;
232
304
  /**
233
305
  * Context sent with the initial request.
234
306
  */
235
307
  initialContext?: Context;
308
+ /**
309
+ * Enables bidirectional mode of voice+. Will automatically set the bidirectional flag in the config.
310
+ *
311
+ */
312
+ bidirectional?: BidirectionalConfig;
236
313
  }
314
+ /**
315
+ * @internal
316
+ */
317
+ export type NormalizedTouchpointConfiguration = TouchpointConfiguration & Required<Pick<TouchpointConfiguration, "initializeConversation" | "input">>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nlxai/touchpoint-ui",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Web UI for Touchpoint",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -24,7 +24,7 @@
24
24
  "tsc": "tsc"
25
25
  },
26
26
  "dependencies": {
27
- "@nlxai/chat-core": "^1.0.5-alpha.13",
27
+ "@nlxai/chat-core": "^1.1.4",
28
28
  "@react-hookz/web": "^25.0.1",
29
29
  "@react-input/mask": "^2.0.4",
30
30
  "clsx": "^2.1.1",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "d16046654dd9956faf8714a0f6bbf188450b62f3"
61
+ "gitHead": "0b366535d923939f3d748ceb4250d2e28812b607"
62
62
  }