@telia-ace/widget-conversation 1.0.15 → 1.0.18

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.
Files changed (52) hide show
  1. package/LICENSE.txt +5 -5
  2. package/README.md +273 -256
  3. package/dist/agent.d.ts +17 -17
  4. package/dist/{ui → components}/conversation/conversation.d.ts +6 -6
  5. package/dist/{ui/conversation/conversation-component.d.ts → components/conversation/plugin.d.ts} +43 -37
  6. package/dist/components/conversation/ui/content.d.ts +2 -0
  7. package/dist/{ui/conversation/conversation-input.d.ts → components/conversation/ui/input.d.ts} +6 -6
  8. package/dist/{ui/conversation/conversation-loader.d.ts → components/conversation/ui/loader.d.ts} +8 -8
  9. package/dist/components/conversation/ui/message-list-items/button-list.d.ts +8 -0
  10. package/dist/{ui/conversation/message-types/custom-message-list-item.d.ts → components/conversation/ui/message-list-items/custom.d.ts} +9 -9
  11. package/dist/components/conversation/ui/message-list-items/html.d.ts +5 -0
  12. package/dist/components/conversation/ui/message-list-items/link-list.d.ts +8 -0
  13. package/dist/components/conversation/ui/message-list-items/separator.d.ts +2 -0
  14. package/dist/components/conversation/ui/message-list-items/text.d.ts +6 -0
  15. package/dist/{ui/conversation → components/conversation/ui}/message-types/agent.d.ts +11 -11
  16. package/dist/{ui/conversation → components/conversation/ui}/message-types/index.d.ts +4 -5
  17. package/dist/components/conversation/ui/message-types/message-list.d.ts +9 -0
  18. package/dist/{ui/conversation → components/conversation/ui}/message-types/system.d.ts +12 -12
  19. package/dist/{ui/conversation → components/conversation/ui}/message-types/timestamp.d.ts +8 -8
  20. package/dist/{ui/conversation → components/conversation/ui}/message-types/user.d.ts +8 -8
  21. package/dist/components/conversation/ui/message.d.ts +7 -0
  22. package/dist/components/conversation/ui/overlay-outlets.d.ts +13 -0
  23. package/dist/components/conversation/ui/styles.d.ts +27 -0
  24. package/dist/{ui/return-button/return-button-component.d.ts → components/return-button/plugin.d.ts} +18 -19
  25. package/dist/{ui → components}/return-button/return-button.d.ts +6 -6
  26. package/dist/conversation-controller.d.ts +88 -88
  27. package/dist/conversation-form-adapter.d.ts +7 -7
  28. package/dist/conversation-platform.d.ts +49 -50
  29. package/dist/conversation-provider.d.ts +22 -22
  30. package/dist/conversation.js +862 -118
  31. package/dist/conversation.js.map +1 -1
  32. package/dist/index.d.ts +10 -9
  33. package/dist/index.js +885 -9
  34. package/dist/index.js.map +1 -1
  35. package/dist/resolve-entity-value.d.ts +10 -10
  36. package/dist/return-button.js.map +1 -1
  37. package/dist/types.d.ts +96 -110
  38. package/dist/user.d.ts +7 -7
  39. package/dist/utils/custom-message.d.ts +3 -3
  40. package/dist/utils/index.d.ts +1 -1
  41. package/dist/utils/map-actions.d.ts +1 -0
  42. package/dist/utils/open-chat-widget.d.ts +4 -4
  43. package/package.json +8 -8
  44. package/dist/index2.js +0 -1678
  45. package/dist/index2.js.map +0 -1
  46. package/dist/ui/conversation/conversation-content.d.ts +0 -12
  47. package/dist/ui/conversation/conversation-message.d.ts +0 -7
  48. package/dist/ui/conversation/conversation-styles.d.ts +0 -11
  49. package/dist/ui/conversation/index.d.ts +0 -3
  50. package/dist/ui/conversation/message-types/custom.d.ts +0 -9
  51. package/dist/ui/index.d.ts +0 -2
  52. package/dist/ui/return-button/index.d.ts +0 -2
package/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
- Copyright © 2021, Telia Company AB. All rights reserved.
2
-
3
- THIS PACKAGE AND CONTAINING SOFTWARE IS PART OF
4
- THE HUMANY SERVICE. BY USING THIS SOFTWARE YOU
5
- AGREE TO THE FOLLOWING TERMS AND CONDITIONS:
1
+ Copyright © 2021, Telia Company AB. All rights reserved.
2
+
3
+ THIS PACKAGE AND CONTAINING SOFTWARE IS PART OF
4
+ THE HUMANY SERVICE. BY USING THIS SOFTWARE YOU
5
+ AGREE TO THE FOLLOWING TERMS AND CONDITIONS:
6
6
  http://www.humany.com/legal
package/README.md CHANGED
@@ -1,256 +1,273 @@
1
- # Widget Conversation API
2
-
3
- The Widget Conversation API provides support for reading and writing to a conversational component inside a widget.
4
-
5
- ## Explore the API
6
-
7
- You can try out and watch the Conversation API in action by clicking the button below.
8
- Keep in mind that this is for demonstration purposes only and may not be best practice.
9
- We do not recommend binding functions to the `Window` object.
10
-
11
- [![Edit elegant-jones-rnyrd](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/elegant-jones-rnyrd?fontsize=14&hidenavigation=1&theme=dark)
12
-
13
- ## Accessing the API
14
-
15
- Inside a plugin, access the global instance of `ConversationPlatform` by passing in the current `Container` to the `getInstance()` method. It will return a `Promise` that is resolved to the `ConversationPlatform` instance. On the instance, register a provider and pass in a name and handler by calling the `registerProvider()` function as shown below.
16
-
17
- The handler function will be called once a conversational component for the specified provider is activated in the widget. Use the provider to interact with the conversation.
18
-
19
- ##### Example
20
-
21
- ```ts
22
- import { ConversationPlatform } from '@telia-ace/widget-conversation';
23
-
24
- const MyPlugin = async (container) => {
25
- const platform = await ConversationPlatform.getInstance(container);
26
-
27
- platform.registerProvider('my-chat', (conversation, component) => {
28
- // start interacting with the conversation here
29
- });
30
- };
31
- ```
32
-
33
- ## Writing to the conversation
34
-
35
- When writing content to the conversation you will first need to create an `Agent` object and then use its `print()` function. Specify the type of entry to print and pass in the content.
36
-
37
- ### `print(content: object)`
38
-
39
- Returns a `ConversationEntry` message that can be used to update and/or remove the content from the conversation at a later stage.
40
-
41
- ##### Example
42
-
43
- ```ts
44
- const agent = conversation.createAgent();
45
- const entry = agent.print('Lorem ipsum');
46
-
47
- entry.update({
48
- // ...
49
- });
50
-
51
- entry.remove();
52
- ```
53
-
54
- ### Messages
55
-
56
- #### Simple text message
57
-
58
- Used to render plain text without HTML-formatting.
59
-
60
- ##### Example
61
-
62
- ```ts
63
- // print user message
64
- conversation.user.print('Lorem ipsum');
65
-
66
- // print agent message
67
- const agent = conversation.createAgent();
68
- agent.print('Lorem ipsum');
69
- ```
70
-
71
- #### Message with list of actions
72
-
73
- Example of how to render a list with actions. Is only supported on `Agent` and as system message.
74
-
75
- | Name | Type | Description |
76
- | --------- | -------- | ------------------------------------------------------------- |
77
- | `title` | `string` | Title for the entry. |
78
- | `body` | `string` | Body content for the entry. Supports HTML. |
79
- | `actions` | `object` | Key-value-pairs representing available actions for the entry. |
80
-
81
- ##### Example
82
-
83
- ```ts
84
- agent.print({
85
- title: 'Download invoices',
86
- body: 'Click an invoice below to download a copy.',
87
- actions: {
88
- invoice_190201: 'Invoice 190201',
89
- invoice_190301: 'Invoice 190301',
90
- invoice_190401: 'Invoice 190401',
91
- },
92
- });
93
- ```
94
-
95
- #### Message with a form
96
-
97
- Example of how to render a form that can be handled by the `conversation.form` event. Is only supported on `Agent` and as system message.
98
-
99
- | Name | Type | Description |
100
- | ------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
101
- | `title` | `string` | Title for the entry. |
102
- | `body` | `string` | Body content for the entry. Supports HTML. |
103
- | `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`. |
104
- | `key` | `string` | The key used to refer to the form when validating and submitting the form. |
105
-
106
- ##### Example
107
-
108
- ```ts
109
- agent.print({
110
- title: 'Log in',
111
- body: 'Enter your ID to login',
112
- key: 'my-login-form',
113
- form: (builder) => {
114
- builder
115
- .createComponent({
116
- component: 'Text',
117
- type: 'number',
118
- name: 'id',
119
- title: 'ID',
120
- required: true,
121
- })
122
- .createComponent({
123
- title: 'Log in',
124
- actionKey: 'submit',
125
- name: 'submit',
126
- component: 'Submit',
127
- type: 'submit',
128
- evaluate: true,
129
- value: 'Log in',
130
- });
131
- },
132
- });
133
- ```
134
-
135
- ### Specify a sender name and/or avatar
136
-
137
- To create an agent with a name and avatar use the `createAgent` method on the conversation.
138
-
139
- ##### Example
140
-
141
- ```ts
142
- const agent = conversation.createAgent({
143
- name: 'Mr. Agent',
144
- avatar: 'https://www.site.com/avatar.jpg',
145
- });
146
-
147
- agent.print({
148
- title: 'I found the following invoices associated to your account:',
149
- actions: {
150
- action1: 'Action 1',
151
- action2: 'Action 2',
152
- action3: 'Action 3',
153
- },
154
- });
155
- ```
156
-
157
- ### Writing system messages
158
-
159
- In order to print a system message to the conversation you invoke the `print` method on the `conversation`. The `print` method accepts the same arguments as on the `Agent`.
160
-
161
- #### Example
162
-
163
- ```ts
164
- conversation.print('Lorem ipsum');
165
- ```
166
-
167
- ### Loading/typing indicator
168
-
169
- In many cases you will likely fetch data from an external resource before the content is written to the conversation. In this case 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.
170
-
171
- In cases where you want to notify the user that the agent is currently typing, you should use the `typing` function on `Agent`.
172
-
173
- #### Example
174
-
175
- ##### Loading
176
-
177
- ```ts
178
- const done = conversation.loading();
179
- // ...
180
- done(); // remove loader
181
- ```
182
-
183
- ##### Typing indicator
184
-
185
- ```ts
186
- const done = agent.typing();
187
- // ...
188
- done(); // remove loader
189
- ```
190
-
191
- ## Reading from the conversation
192
-
193
- The second parameter to your provider handler is a `ComponentNode` instance representing the conversational component. On it you can read the component's properties and react to action emitted by the component.
194
-
195
- ### Actions
196
-
197
- The following actions are emitted from the conversational component.
198
-
199
- **Important**: For default actions it is important 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.
200
-
201
- #### `conversation.user-typing`
202
-
203
- Is emitted when the user´s typing indicator is changed.
204
-
205
- | Name | Type | Description |
206
- | ------------ | -------- | ---------------------------------------------- |
207
- | `textLength` | `number` | The current text length of the user's message. |
208
-
209
- #### `conversation.user-submit`
210
-
211
- Is emitted when the user submits a message.
212
-
213
- | Name | Type | Description |
214
- | ------ | -------- | ------------------- |
215
- | `text` | `string` | The submitted text. |
216
-
217
- #### `conversation.action`
218
-
219
- Is emitted when the user clicks on an action.
220
-
221
- | Name | Type | Description |
222
- | ------ | -------- | ---------------------------- |
223
- | `text` | `string` | Key of the submitted action. |
224
-
225
- #### `conversation.form`
226
-
227
- Is emitted when the data of a form is changed.
228
-
229
- | Name | Type | Description |
230
- | ----------- | ---------- | --------------------------------------------------------- |
231
- | `data` | `FormData` | The form data. |
232
- | `formKey` | `string` | The unique key for the form. |
233
- | `actionKey` | `string` | The key of the form component responsible for the change. |
234
-
235
- In order to subscribe to any of these actions you have access to the `ComponentNodeController`. Below is an example how to subscribe to the `conversation.form` action.
236
-
237
- ```ts
238
- component.actions.watch('conversation.form', (input, next) => {
239
- return next(input);
240
- });
241
- ```
242
-
243
- ### Submitting forms
244
-
245
- In order to listen for form events you should subscribe to the `conversation.form` event. By passing a `key` to the form, you are able to target the form in this listener.
246
-
247
- ```ts
248
- component.actions.watch('conversation.form', (input, next) => {
249
- if (input.formKey === 'my-login-form' && input.actionKey === 'submit') {
250
- const username = input.data.username;
251
- const password = input.data.password;
252
- }
253
-
254
- return next(input);
255
- });
256
- ```
1
+ # Widget Conversation API
2
+
3
+ The Widget Conversation API provides support for reading and writing to a conversational component inside a widget.
4
+
5
+ ## Sandbox
6
+
7
+ For demonstration purposes, we've set up a sandbox for the Widget Conversational API so that you can see it in action. Keep in mind that this is for demonstration purposes only and may not reflect best practice.
8
+
9
+ > We do not recommend binding functions to the `window` object.
10
+
11
+ [![Edit elegant-jones-rnyrd](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/elegant-jones-rnyrd?fontsize=14&hidenavigation=1&theme=dark)
12
+
13
+ ## Accessing the API
14
+
15
+ In order to access the API you need to have a widget with a conversational component.
16
+
17
+ ### Creating the plugin
18
+
19
+ You need to register the conversational provider in the `providers`-property in the component. To access the global instance of `ConversationPlatform`, you pass in the current `Container` to the `getInstance()` method. It will return a `Promise` that is resolved to the `ConversationPlatform` instance. In the instance, register a provider and pass in name and handler by calling the `registerProvider()` function as shown below.
20
+
21
+ The handler function will be called once a conversational component for the specified provider is activated in the widget. Use the provider to interact with the conversation.
22
+
23
+ ```ts
24
+ import { ConversationPlatform } from '@telia-ace/widget-conversation';
25
+
26
+ const MyPlugin = async (container) => {
27
+ const platform = await ConversationPlatform.getInstance(container);
28
+
29
+ platform.registerProvider('my-chat', (conversation, component) => {
30
+ // start interacting with the conversation here
31
+ });
32
+ };
33
+ ```
34
+
35
+ You also need to register the provider inside the widget configuration:
36
+
37
+ ```JSON
38
+ "my-conversation-component": {
39
+ "type": "conversation",
40
+ "properties": {
41
+ "providers": ["my-chat"],
42
+ // ...
43
+ },
44
+ "context": {}
45
+ },
46
+ ```
47
+
48
+ ### Creating an agent in the conversation
49
+
50
+ When using `createAgent` you can specify both a name and an avatar. These will then be displayed in the conversation alongside that agent's entries.
51
+
52
+ ```ts
53
+ const agent = conversation.createAgent({
54
+ name: 'Agent Smith',
55
+ avatar: 'https://www.site.com/avatar.jpg',
56
+ });
57
+ ```
58
+
59
+ ## Writing to the conversation
60
+
61
+ ### Posting, updating and removing content
62
+
63
+ When managing content in the conversation you'll first need to create an `Agent`-object and then use its `print()` function. There are serveral types of entries in order to accommedate different types of content.
64
+
65
+ The `print(content: object)` function let's you return a `ConversationEntry` message that can be used to update and/or remove the content from the conversation.
66
+
67
+ ##### Example of simple text message
68
+
69
+ ```ts
70
+ // print user message
71
+ conversation.user.print('Lorem ipsum');
72
+
73
+ // print agent message
74
+ const agent = conversation.createAgent();
75
+ agent.print('Lorem ipsum');
76
+ ```
77
+
78
+ ##### Example of updating or removing content
79
+
80
+ ```ts
81
+ const agent = conversation.createAgent();
82
+ const entry = agent.print('Hello world!');
83
+
84
+ entry.update({
85
+ // ...
86
+ });
87
+
88
+ entry.remove();
89
+ ```
90
+
91
+ ### Entry with list of actions
92
+
93
+ You can post an entry into the conversation with actions. You can specify a title, body and available actions. This is only supported for the `Agent` and will be displayed as a system message.
94
+
95
+ | Name | Type | Description |
96
+ | --------- | -------- | ------------------------------------------------------------- |
97
+ | `title` | `string` | Title for the entry. |
98
+ | `body` | `string` | Body content for the entry. Supports HTML. |
99
+ | `actions` | `object` | Key-value-pairs representing available actions for the entry. |
100
+
101
+ ##### Example of a list of actions
102
+
103
+ ```ts
104
+ agent.print({
105
+ title: 'Download invoices',
106
+ body: 'Click an invoice below to download a copy.',
107
+ actions: {
108
+ invoice_190201: 'Invoice 190201',
109
+ invoice_190301: 'Invoice 190301',
110
+ invoice_190401: 'Invoice 190401',
111
+ },
112
+ });
113
+ ```
114
+
115
+ ### Entry with a form
116
+
117
+ 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.
118
+
119
+ | Name | Type | Description |
120
+ | ------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
121
+ | `title` | `string` | Title for the entry. |
122
+ | `body` | `string` | Body content for the entry. Supports HTML. |
123
+ | `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`. |
124
+ | `key` | `string` | The key used to refer to the form when validating and submitting the form. |
125
+
126
+ ##### Example of an entry with a form
127
+
128
+ ```ts
129
+ agent.print({
130
+ title: 'Log in',
131
+ body: 'Enter your ID to login',
132
+ key: 'my-login-form',
133
+ form: (builder) => {
134
+ builder
135
+ .createComponent({
136
+ component: 'Text',
137
+ type: 'number',
138
+ name: 'id',
139
+ title: 'ID',
140
+ required: true,
141
+ })
142
+ .createComponent({
143
+ title: 'Log in',
144
+ actionKey: 'submit',
145
+ name: 'submit',
146
+ component: 'Submit',
147
+ type: 'submit',
148
+ evaluate: true,
149
+ value: 'Log in',
150
+ });
151
+ },
152
+ });
153
+ ```
154
+
155
+ ### The loading and typing indicators
156
+
157
+ 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.
158
+
159
+ When you need to make the user aware that your agent is currently typing, you should use the `typing` function on `Agent`.
160
+
161
+ #### Example of `loading`
162
+
163
+ ```ts
164
+ const done = conversation.loading();
165
+ // ...
166
+ done(); // remove loader
167
+ ```
168
+
169
+ #### Example of `typing`
170
+
171
+ ```ts
172
+ const done = agent.typing();
173
+ // ...
174
+ done(); // remove loader
175
+ ```
176
+
177
+ ## Writing system messages
178
+
179
+ System message in the conversation are sent by using the `print` method on the `conversation`. The `print` method accepts the same arguments as on the `Agent`.
180
+
181
+ #### Example
182
+
183
+ ```ts
184
+ conversation.print('Hello world!');
185
+ ```
186
+
187
+ ## Reading from the conversation
188
+
189
+ The second parameter to your provider handler is a `ComponentNode` instance representing the conversational component. From it you can read the component's properties and react to action emitted by the component.
190
+
191
+ The following actions are emitted from the conversational component:
192
+
193
+ > 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.
194
+
195
+ | Action | Name | Type | Description |
196
+ | -------------------------- | ------------ | ---------- | --------------------------------------------------------- |
197
+ | `conversation.user-typing` | `textLength` | `number` | The current text length of the user's message. |
198
+ | `conversation.user-submit` | `text` | `string` | The submitted text. |
199
+ | `conversation.action` | `text` | `string` | Key of the submitted action. |
200
+ | `conversation.form` | `data` | `FormData` | The form data. |
201
+ | `conversation.form` | `formKey` | `string` | The unique key for the form. |
202
+ | `conversation.form` | `actionKey` | `string` | The key of the form component responsible for the change. |
203
+
204
+ If you want to subscribe to any of the `conversation.form`-actions you have access to the `ComponentNodeController`. Example below:
205
+
206
+ ```ts
207
+ component.actions.watch('conversation.form', (input, next) => {
208
+ return next(input);
209
+ });
210
+ ```
211
+
212
+ ### Submitting forms
213
+
214
+ If you want to listen for form events you should subscribe to the `conversation.form` event. By passing a `key` to the form, you are able to target the form in this listener.
215
+
216
+ ```ts
217
+ component.actions.watch('conversation.form', (input, next) => {
218
+ if (input.formKey === 'my-login-form' && input.actionKey === 'submit') {
219
+ const username = input.data.username;
220
+ const password = input.data.password;
221
+ }
222
+
223
+ return next(input);
224
+ });
225
+ ```
226
+
227
+ ### Adding custom list items
228
+
229
+ You can add custom list items to the conversation. To do so you have to register your own custom React component, which will be mapped to a key also provided by you.
230
+
231
+ #### Example of custom list items
232
+
233
+ ```ts
234
+ import { registerCustomMessageComponent } from '@telia-ace/widget-conversation';
235
+
236
+ registerCustomMessageComponent(container, 'my-custom-list-item', import('./my-custom-list-item'));
237
+ ```
238
+
239
+ Once the component has been registered it will be available to be used as any other item in the `print` method on the Conversation API.
240
+
241
+ ## Custom secondary action
242
+
243
+ 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:
244
+
245
+ | Name | Type | Description |
246
+ | -------- | -------- | ------------------------------------------------------------------- |
247
+ | `action` | `string` | An action that will be dispatched when the button is pressed |
248
+ | `label` | `string` | Will be used as a "title" and aria-label on the HTML button element |
249
+ | `icon` | `string` | An icon to be displayed, defaults to "browse" icon if left empty |
250
+
251
+ ```json
252
+ "conversation": {
253
+ "type": "conversation",
254
+ "properties": {
255
+ "secondaryAction": {
256
+ "action": "my-secondary-action",
257
+ "label": "Label for the secondary action",
258
+ "icon": "my-icon"
259
+ }
260
+ // ...other properties
261
+ }
262
+ }
263
+ ```
264
+
265
+ When you have added this property to the component, you can create an event for it in your code:
266
+
267
+ ```ts
268
+ component.actions.watch('conversation.action', (input, next) => {
269
+ if (input === 'my-secondary-action') {
270
+ // handle action
271
+ }
272
+ });
273
+ ```
package/dist/agent.d.ts CHANGED
@@ -1,17 +1,17 @@
1
- import { Symbol } from '@telia-ace/widget-ui';
2
- import { ConversationEntry } from './conversation-controller';
3
- import { ConversationProvider } from './conversation-provider';
4
- import { ConversationMessageSettings, ConverstationMessageItem } from './types';
5
- export declare type AgentSettings = {
6
- name?: string;
7
- avatar?: string | Symbol;
8
- };
9
- export declare class Agent {
10
- private provider;
11
- name?: string;
12
- avatar?: string | Symbol;
13
- constructor(provider: ConversationProvider, settings: AgentSettings);
14
- print: (settings: string | ConversationMessageSettings | ConverstationMessageItem<any> | ConverstationMessageItem<any>[]) => ConversationEntry | undefined;
15
- typing: () => (() => void) | undefined;
16
- update(settings: AgentSettings): void;
17
- }
1
+ import { Symbol } from '@telia-ace/widget-ui';
2
+ import { ConversationEntry } from './conversation-controller';
3
+ import { ConversationProvider } from './conversation-provider';
4
+ import { ConversationMessageSettings, ConverstationMessageItem } from './types';
5
+ export declare type AgentSettings = {
6
+ name?: string;
7
+ avatar?: string | Symbol;
8
+ };
9
+ export declare class Agent {
10
+ private provider;
11
+ name?: string;
12
+ avatar?: string | Symbol;
13
+ constructor(provider: ConversationProvider, settings: AgentSettings);
14
+ print: (settings: string | ConversationMessageSettings | ConverstationMessageItem<any> | ConverstationMessageItem<any>[]) => ConversationEntry | undefined;
15
+ typing: () => (() => void) | undefined;
16
+ update(settings: AgentSettings): void;
17
+ }
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- declare type Props = {
3
- className: string;
4
- };
5
- declare const Conversation: React.FC<Props>;
6
- export default Conversation;
1
+ import React from 'react';
2
+ declare type Props = {
3
+ className: string;
4
+ };
5
+ declare const Conversation: React.FC<Props>;
6
+ export default Conversation;