@telia-ace/widget-conversation 1.0.38-next.0 → 1.0.38-next.2

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 CHANGED
@@ -97,11 +97,11 @@ You can post an entry into the conversation with actions. You can specify a titl
97
97
  This can be either in the form of a "ButtonList" or an "LinkList" as demostrated below.
98
98
 
99
99
  | Name | Type | Description |
100
- | --------- | -------- | -------------------------------------------- |
100
+ |-----------|----------|----------------------------------------------|
101
101
  | `header` | `string` | Header for the entry. |
102
102
  | `actions` | `array` | Array of of available actions for the entry. |
103
103
 
104
- ##### Example of a list of actions
104
+ ##### Example of list of actions
105
105
 
106
106
  ```ts
107
107
  // example of button list
@@ -143,6 +143,31 @@ agent.print([
143
143
  },
144
144
  ],
145
145
  ]);
146
+
147
+ // and an item list could contain an optional icon and description
148
+ agent.print([
149
+ [
150
+ 'item-list',
151
+ {
152
+ header: 'Download invoices',
153
+ actions: [
154
+ {
155
+ actionKey: 'invoice_190201',
156
+ label: 'Invoice 190201',
157
+ symbol: {
158
+ type: 'FontAwesome',
159
+ content: 'file',
160
+ },
161
+ },
162
+ {
163
+ actionKey: 'invoice_190301',
164
+ label: 'Invoice 190301',
165
+ description: 'Clicking here will download the invoice',
166
+ },
167
+ ],
168
+ },
169
+ ],
170
+ ]);
146
171
  ```
147
172
 
148
173
  ### Entry with a form
@@ -150,7 +175,7 @@ agent.print([
150
175
  You can also post a message with a form attached. This uses the `FormBuilder`-method. This is handled by the `conversation.form` event. It is only supported for `Agent` and will be displayed as a system message.
151
176
 
152
177
  | Name | Type | Description |
153
- | ------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
178
+ |---------|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
154
179
  | `title` | `string` | Title for the entry. |
155
180
  | `body` | `string` | Body content for the entry. Supports HTML. |
156
181
  | `form` | `(FormBuilder) => void` | A callback function for building the form. Refer to the [`@telia-ace/widget-forms`](https://www.npmjs.com/package/@telia-ace/widget-forms) package for more information about `FormBuilder`. |
@@ -190,7 +215,7 @@ agent.print({
190
215
  Use the `video-request` item type to create an entry representing an incoming video call. This entry can also have a form attached, which uses the `FormBuilder`-method and is handled by the `conversation.form` event. It is only supported for an `Agent` and will be displayed as a system message.
191
216
 
192
217
  | Name | Type | Description |
193
- | -------------- | -------- | ----------------------------------------------- |
218
+ |----------------|----------|-------------------------------------------------|
194
219
  | `header` | `string` | Header for the entry. |
195
220
  | `acceptLabel` | `string` | Label to be shown for the "accept call button" |
196
221
  | `declineLabel` | `string` | Label to be shown for the "decline call button" |
@@ -230,7 +255,7 @@ component.actions.watch('conversation.action', (input, next) => {
230
255
  ### Video Call Events
231
256
 
232
257
  | Action Key | Description |
233
- | --------------------------- | ---------------------------------------------------------------------------------------------- |
258
+ |-----------------------------|------------------------------------------------------------------------------------------------|
234
259
  | `show-overlay` | Dispatch this event when you want to render an overlay where you can render the video call |
235
260
  | `overlay-mounted` | Dispatched when the overlay is rendered, will provide an HTML element to render the video call |
236
261
  | `hide-overlay` | Hide overlay |
@@ -275,6 +300,19 @@ Dispatching this event will hide the conversation overlay.
275
300
  component.actions.dispatch('hide-overlay-conversation', {});
276
301
  ```
277
302
 
303
+ ### Available default messages types
304
+ The below message types are available out of the box.
305
+
306
+ | Message type key | Description | Value |
307
+ |------------------|------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
308
+ | `button-list` | List of action buttons. | `{ header?: string, actions: Array<{ actionKey: string, label: string, symbol?: { type: string, content: string } }> } ` |
309
+ | `link-list` | List of action links. | `{ header?: string, actions: Array<{ actionKey: string, label: string }> }` |
310
+ | `item-list` | List of detailed items with optional description and icon. | `{ header?: string, actions: Array<{ actionKey: string, label: string, description?: string, symbol?: { type: string, content: string } }> }` |
311
+ | `html` | Html content. | `{ body: string }` |
312
+ | `separator` | Separator for dividing different messages. | N/A |
313
+ | `text` | Plain text content. | `string` |
314
+ | `video-request` | Incoming video call prompt. | `{ header: string, accept: string, decline: string }` |
315
+
278
316
  ### The loading and typing indicators
279
317
 
280
318
  When you need to fetch data from external resource you should use the `loading()` function on the `ConversationProvider` to inform the user that something is about to happen. Even in cases when the response is available immediately it gives a better user experience to present a loading indicator for a short while.
@@ -316,7 +354,7 @@ The following actions are emitted from the conversational component:
316
354
  > For default actions it is necessary to call `next()` unless you want to completely stop the execution flow for the particular action. Not doing so will stop any succeeding handlers and may unintentionally break functionality.
317
355
 
318
356
  | Action | Name | Type | Description |
319
- | -------------------------- | ------------ | ---------- | --------------------------------------------------------- |
357
+ |----------------------------|--------------|------------|-----------------------------------------------------------|
320
358
  | `conversation.user-typing` | `textLength` | `number` | The current text length of the user's message. |
321
359
  | `conversation.user-submit` | `text` | `string` | The submitted text. |
322
360
  | `conversation.action` | `text` | `string` | Key of the submitted action. |
@@ -366,7 +404,7 @@ Once the component has been registered it will be available to be used as any ot
366
404
  You can add a secondary action button that's displayed next to the user input field. This button can run any event that you write. You need to add the `secondaryAction` property to the conversation component in the configuration. It accepts an object with the following properties:
367
405
 
368
406
  | Name | Type | Description |
369
- | -------- | -------- | ------------------------------------------------------------------- |
407
+ |----------|----------|---------------------------------------------------------------------|
370
408
  | `action` | `string` | An action that will be dispatched when the button is pressed |
371
409
  | `label` | `string` | Will be used as a "title" and aria-label on the HTML button element |
372
410
  | `icon` | `string` | An icon to be displayed, defaults to "browse" icon if left empty |
@@ -0,0 +1,8 @@
1
+ import { DispatchAction } from '@telia-ace/widget-ui';
2
+ import { FC } from 'react';
3
+ import { LinkListProperties } from '../../../../types';
4
+ type Props = {
5
+ dispatch: DispatchAction;
6
+ } & LinkListProperties;
7
+ export declare const ItemList: FC<Props>;
8
+ export {};