@telia-ace/widget-conversation-flamingo 1.1.12-rc.0 → 1.1.12-rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. package/conversation-8e924136.js +572 -0
  2. package/conversation-a518bd92.mjs +2634 -0
  3. package/conversation-component.d.ts +2 -0
  4. package/conversation-platform.d.ts +9 -49
  5. package/conversation-session.d.ts +11 -0
  6. package/conversation.d.ts +23 -0
  7. package/entry.d.ts +9 -0
  8. package/group.d.ts +7 -0
  9. package/index-231900d1.mjs +780 -0
  10. package/index-592f145b.js +3 -0
  11. package/index-b34ddf78.js +1 -0
  12. package/{index-1ea0fde8.mjs → index-b5ca9962.mjs} +320 -319
  13. package/index.d.ts +6 -10
  14. package/index.js +1 -1
  15. package/index.mjs +7 -9
  16. package/{components/conversation/ui/message-types → message-types}/message-type-html.d.ts +3 -2
  17. package/models/agent.d.ts +8 -0
  18. package/models/conversation-entry.d.ts +11 -0
  19. package/models/conversation-provider.d.ts +19 -0
  20. package/models/conversation-session-state.d.ts +13 -0
  21. package/models/user.d.ts +8 -0
  22. package/package.json +5 -6
  23. package/types.d.ts +9 -123
  24. package/agent.d.ts +0 -20
  25. package/components/conversation/conversation.d.ts +0 -19
  26. package/components/conversation/plugin.d.ts +0 -45
  27. package/components/conversation/ui/message-list.d.ts +0 -9
  28. package/components/conversation/ui/message-types/message-type-link-list.d.ts +0 -8
  29. package/components/conversation/ui/message-types/message-type-separator.d.ts +0 -7
  30. package/components/conversation/ui/message.d.ts +0 -8
  31. package/components/conversation/utils.d.ts +0 -1
  32. package/conversation-17a64990.mjs +0 -1865
  33. package/conversation-b2f9f789.js +0 -446
  34. package/conversation-controller.d.ts +0 -118
  35. package/conversation-history.d.ts +0 -26
  36. package/conversation-provider.d.ts +0 -32
  37. package/index-c51d4b6a.js +0 -1
  38. package/index-ecfa0fe7.js +0 -156
  39. package/index-ffd77508.mjs +0 -3923
  40. package/send-18482cae.mjs +0 -4
  41. package/send-eb8b9428.js +0 -1
  42. package/store.d.ts +0 -31
  43. package/user.d.ts +0 -9
  44. package/utils/custom-message.d.ts +0 -2
  45. package/utils/index.d.ts +0 -1
  46. package/utils/open-chat-widget.d.ts +0 -4
  47. package/utils/swap-provider.d.ts +0 -8
package/index.d.ts CHANGED
@@ -1,10 +1,6 @@
1
- import { ConversationEndedBehavior, ConversationPlatform, UnregisterControllerDelegate } from './conversation-platform';
2
- export { ConversationComponent } from './components/conversation/plugin';
3
- export { ConversationController, ConversationEntry, ConversationMessageType, } from './conversation-controller';
4
- export type { ConversationMessage } from './conversation-controller';
5
- export { ConversationMessageListItemType } from './types';
6
- export type { ConversationMessageContent, ConversationMessageSender, ConverstationMessageItem, } from './types';
7
- export { registerCustomMessageComponent } from './utils/custom-message';
8
- export { ConversationPlatform, ConversationEndedBehavior };
9
- export type { UnregisterControllerDelegate };
10
- export type { Agent } from './agent';
1
+ export { ConversationComponent } from './conversation-component';
2
+ export { ConversationPlatform } from './conversation-platform';
3
+ export { ConversationProvider } from './models/conversation-provider';
4
+ export { User } from './models/user';
5
+ export { Agent } from './models/agent';
6
+ export { ConversationEntry } from './models/conversation-entry';
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-ecfa0fe7.js");exports.ConversationComponent=e.ConversationComponent;exports.ConversationController=e.ConversationController;exports.ConversationEndedBehavior=e.ConversationEndedBehavior;exports.ConversationEntry=e.ConversationEntry;exports.ConversationMessageListItemType=e.ConversationMessageListItemType;exports.ConversationMessageType=e.ConversationMessageType;exports.ConversationPlatform=e.ConversationPlatform;exports.registerCustomMessageComponent=e.registerCustomMessageComponent;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-592f145b.js");exports.Agent=o.Agent;exports.ConversationComponent=o.ConversationComponent;exports.ConversationEntry=o.ConversationEntry;exports.ConversationPlatform=o.ConversationPlatform;exports.ConversationProvider=o.ConversationProvider;exports.User=o.User;
package/index.mjs CHANGED
@@ -1,11 +1,9 @@
1
- import { f as s, g as n, d as a, j as t, k as r, C, c as i, l as v } from "./index-ffd77508.mjs";
1
+ import { A as n, a as r, d as s, b as e, c as t, U as i } from "./index-231900d1.mjs";
2
2
  export {
3
- s as ConversationComponent,
4
- n as ConversationController,
5
- a as ConversationEndedBehavior,
6
- t as ConversationEntry,
7
- r as ConversationMessageListItemType,
8
- C as ConversationMessageType,
9
- i as ConversationPlatform,
10
- v as registerCustomMessageComponent
3
+ n as Agent,
4
+ r as ConversationComponent,
5
+ s as ConversationEntry,
6
+ e as ConversationPlatform,
7
+ t as ConversationProvider,
8
+ i as User
11
9
  };
@@ -1,7 +1,8 @@
1
1
  import { LitElement } from 'lit';
2
- import { ConversationMessageListItemType, ConverstationMessageItem } from '../../../../types';
3
2
  export declare class MessageTypeHtml extends LitElement {
4
3
  static styles: import("lit").CSSResult[];
5
- message: ConverstationMessageItem<ConversationMessageListItemType.HTML>['1'];
4
+ message: {
5
+ content: string;
6
+ };
6
7
  render(): import("lit-html").TemplateResult<1>;
7
8
  }
@@ -0,0 +1,8 @@
1
+ import { ConversationEntry } from './conversation-entry';
2
+ export declare class Agent {
3
+ name: string;
4
+ private print$;
5
+ constructor(name: string);
6
+ print(text: string): ConversationEntry;
7
+ subscribe(): import("rxjs").Observable<ConversationEntry>;
8
+ }
@@ -0,0 +1,11 @@
1
+ import { Subject } from 'rxjs';
2
+ import { ConversationMessage, ConversationMessageGroup, ConversationMessageSender, ConversationMessageType } from '../types';
3
+ export declare class ConversationEntry {
4
+ type: ConversationMessageType;
5
+ sender: ConversationMessageSender;
6
+ messages: ConversationMessageGroup[];
7
+ timestamp: number;
8
+ didUpdate: Subject<ConversationEntry>;
9
+ constructor(type: ConversationMessageType, sender: ConversationMessageSender, messages: ConversationMessageGroup[]);
10
+ update(content: ConversationMessage[]): void;
11
+ }
@@ -0,0 +1,19 @@
1
+ import { ConversationMessageType } from '../types';
2
+ import { ConversationEntry } from './conversation-entry';
3
+ import { Agent } from './agent';
4
+ import { User } from './user';
5
+ type UserSubmitEvent = {
6
+ text: string;
7
+ };
8
+ export declare class ConversationProvider {
9
+ name: string;
10
+ private print$;
11
+ constructor(name: string);
12
+ onUserSubmit(action: UserSubmitEvent): void;
13
+ print(type: ConversationMessageType, text: string): ConversationEntry;
14
+ printEntry(entry: ConversationEntry): ConversationEntry;
15
+ createAgent(name: string): Agent;
16
+ createUser(name: string): User;
17
+ actions(): import("rxjs").Observable<ConversationEntry>;
18
+ }
19
+ export {};
@@ -0,0 +1,13 @@
1
+ import { BehaviorSubject } from 'rxjs';
2
+ import { ConversationEntry } from './conversation-entry';
3
+ import { ConversationProvider } from './conversation-provider';
4
+ import Conversation from '../conversation';
5
+ export declare class ConversationSessionState {
6
+ id: string;
7
+ entries$: BehaviorSubject<ConversationEntry[]>;
8
+ private provider?;
9
+ constructor(id: string, component: Conversation);
10
+ private write;
11
+ entries(): import("rxjs").Observable<ConversationEntry[]>;
12
+ setProvider(provider: ConversationProvider): void;
13
+ }
@@ -0,0 +1,8 @@
1
+ import { ConversationEntry } from './conversation-entry';
2
+ export declare class User {
3
+ name: string;
4
+ private print$;
5
+ constructor(name: string);
6
+ print(text: string): ConversationEntry;
7
+ subscribe(): import("rxjs").Observable<ConversationEntry>;
8
+ }
package/package.json CHANGED
@@ -1,19 +1,18 @@
1
1
  {
2
2
  "name": "@telia-ace/widget-conversation-flamingo",
3
- "version": "1.1.12-rc.0",
3
+ "version": "1.1.12-rc.2",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
7
7
  "dependencies": {
8
- "@telia-ace/widget-utilities": "^1.0.16",
9
8
  "lit": "^3.0.2",
10
9
  "@lit-labs/motion": "^1.0.4",
11
10
  "@teliads/icons": "^8.4.0",
12
11
  "@teliads/components": "^22.1.1",
13
- "@telia-ace/widget-runtime-flamingo": "1.1.12-rc.0",
14
- "@webprovisions/platform": "^1.1.3",
15
- "@telia-ace/widget-core": "^1.0.27",
16
- "@telia-ace/widget-services": "^1.0.27"
12
+ "@telia-ace/widget-core-flamingo": "1.1.12-rc.2",
13
+ "uuid": "^9.0.1",
14
+ "lit-html": "^3.0.2",
15
+ "rxjs": "^7.8.1"
17
16
  },
18
17
  "main": "./index.js",
19
18
  "module": "./index.mjs",
package/types.d.ts CHANGED
@@ -1,130 +1,16 @@
1
- export type ConversationMessageSettings = {
2
- key?: string;
3
- timestamp?: number;
4
- title?: string;
5
- body?: string;
6
- actions?: {
7
- [actionKey: string]: any;
8
- };
9
- form?: (builder: any) => void;
10
- type?: string;
11
- items?: ConversationMessageList[];
12
- [key: string]: any;
13
- };
14
- export type NormalizedMessageSettings = {
15
- content: ConversationMessageContent;
16
- key: string;
17
- timestamp: number | null;
18
- };
19
- export type ConversationMessageList = {
20
- header?: string;
21
- itemKey: string;
22
- type?: ConversationMessageListType;
23
- items: ConversationMessageListItem[];
24
- };
25
- export type ConversationMessageListItem = {
26
- icon?: string;
27
- type?: ConversationMessageListItemType;
28
- actions?: {
29
- [actionKey: string]: any;
30
- };
31
- form?: any;
32
- body?: string;
33
- key: string;
34
- [key: string]: any;
35
- };
36
- export type ConversationMessageContent = {
37
- title?: string;
38
- body?: string;
39
- actions?: {
40
- [actionKey: string]: any;
41
- };
42
- items?: ConverstationMessageItem<any>[];
43
- form?: any;
44
- [key: string]: any;
45
- };
46
- export type ConverstationMessageItem<T, R = ItemPayload> = R extends [T, any] ? R : never;
47
- export type ConversationMessageUpdateSettings = ConversationMessageContent & {
48
- timestamp?: number;
1
+ export type ConversationMessageGroup = {
2
+ items: ConversationMessage[];
49
3
  };
4
+ export type ConversationMessage = [string, {
5
+ content: string;
6
+ }];
50
7
  export type ConversationMessageSender = {
51
8
  name?: string;
52
9
  avatar?: string | symbol;
53
10
  id?: string;
54
11
  };
55
- export declare enum ConversationMessageListType {
56
- Ordinary = "ordinary",
57
- Seperator = "seperator"
58
- }
59
- export declare enum ConversationMessageListItemType {
60
- LinkList = "link-list",
61
- Separator = "separator",
62
- ButtonList = "button-list",
63
- ItemList = "item-list",
64
- Text = "text",
65
- HTML = "html",
66
- VideoRequest = "video-request"
12
+ export declare enum ConversationMessageType {
13
+ User = "user",
14
+ Agent = "agent",
15
+ System = "system"
67
16
  }
68
- export type LinkListProperties = {
69
- header?: string;
70
- actions: {
71
- [key: string]: string;
72
- } | {
73
- label: string;
74
- actionKey: string;
75
- data: any;
76
- }[];
77
- };
78
- type LinkListItem = [
79
- ConversationMessageListItemType.LinkList,
80
- LinkListProperties
81
- ];
82
- type TextItem = [ConversationMessageListItemType.Text, string];
83
- type SeparatorItem = [ConversationMessageListItemType.Separator, undefined];
84
- export type ButtonListProperties = {
85
- header?: string;
86
- actions: {
87
- [key: string]: string;
88
- } | {
89
- label: string;
90
- actionKey: string;
91
- data: any;
92
- }[];
93
- };
94
- type ButtonListItem = [
95
- ConversationMessageListItemType.ButtonList,
96
- ButtonListProperties
97
- ];
98
- export type ItemListProperties = {
99
- header?: string;
100
- actions: {
101
- [key: string]: string;
102
- } | {
103
- label: string;
104
- actionKey: string;
105
- data: any;
106
- }[];
107
- };
108
- type ItemListItem = [
109
- ConversationMessageListItemType.ItemList,
110
- ItemListProperties
111
- ];
112
- export type VideoRequestProperties = {
113
- header?: string;
114
- acceptLabel: string;
115
- declineLabel: string;
116
- };
117
- type VideoRequestItem = [
118
- ConversationMessageListItemType.VideoRequest,
119
- VideoRequestProperties
120
- ];
121
- export type HtmlProperties = {
122
- body: string;
123
- };
124
- type HtmlItem = [ConversationMessageListItemType.HTML, HtmlProperties];
125
- type ItemPayload = LinkListItem | TextItem | SeparatorItem | ButtonListItem | HtmlItem | VideoRequestItem | ItemListItem;
126
- export type Symbol = {
127
- type: 'Uri' | 'Svg' | 'FontAwesome' | 'Text' | string;
128
- content: string;
129
- };
130
- export {};
package/agent.d.ts DELETED
@@ -1,20 +0,0 @@
1
- import { ConversationEntry } from './conversation-controller';
2
- import { ConversationProvider } from './conversation-provider';
3
- import { ConversationMessageSettings, ConverstationMessageItem } from './types';
4
- export type AgentSettings = {
5
- id?: string;
6
- name?: string;
7
- avatar?: string | symbol;
8
- };
9
- export declare class Agent {
10
- private provider;
11
- id: string;
12
- name?: string;
13
- avatar?: string | symbol;
14
- constructor(provider: ConversationProvider, settings: AgentSettings);
15
- print: (settings: string | ConversationMessageSettings | ConverstationMessageItem<any> | ConverstationMessageItem<any>[], options?: {
16
- key?: string;
17
- }) => ConversationEntry | undefined;
18
- typing: () => (() => void) | undefined;
19
- update(settings: AgentSettings): void;
20
- }
@@ -1,19 +0,0 @@
1
- import { LitElement, PropertyValueMap } from 'lit';
2
- import { Ref } from 'lit/directives/ref.js';
3
- /** Message types */
4
- declare const WidgetElement: (new (...args: any[]) => import("libs/runtime/src/mixins/widget-component.mixin").WidgetComponentInterface) & typeof LitElement;
5
- export declare class ConversationComponent extends WidgetElement {
6
- static styles: import("lit").CSSResultGroup[];
7
- _onSendMessage(e: Event): Promise<void>;
8
- _inputHandler(e: any): void;
9
- _actionHandler(e: CustomEvent<{
10
- actionKey: string;
11
- payload: Record<string, any> | string;
12
- }>): void;
13
- message: string;
14
- conversationContentRef: Ref<HTMLDivElement>;
15
- chatScrollHeight: number;
16
- updated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
17
- render(): import("lit-html").TemplateResult<1>;
18
- }
19
- export default ConversationComponent;
@@ -1,45 +0,0 @@
1
- import { Container } from '@webprovisions/platform';
2
- import { ConversationMessageContent, ConversationMessageSender } from '../../types';
3
- import { ConversationMessage, ConversationMessageType } from '../../conversation-controller';
4
- export type BundledConversationMessage = {
5
- timestamp: number;
6
- content: [BundledMessageContent];
7
- sender: ConversationMessageSender;
8
- type: ConversationMessageType;
9
- };
10
- type BundledMessageContent = {
11
- key: string;
12
- } & ConversationMessageContent;
13
- export type ConversationContent = {
14
- loading: boolean;
15
- typingActors: ConversationMessageSender[];
16
- messages: ConversationMessage[];
17
- };
18
- export type ConversationComponentProperties = {
19
- providers: string[];
20
- messages: BundledConversationMessage[];
21
- overlay?: {
22
- conversation: boolean;
23
- secondary: boolean;
24
- };
25
- overlayConversationHeader?: string;
26
- overlayConversationCloseLabel?: string;
27
- loading: boolean;
28
- inputPlaceholder: string;
29
- inputDisabled: boolean;
30
- inputHidden: boolean;
31
- inputMultiline: boolean;
32
- rehydrate?: boolean;
33
- userLabel: string;
34
- avatarSize: string;
35
- typingActors: any[];
36
- conversationControllerId?: string;
37
- sendButtonLabel: string;
38
- secondaryAction?: {
39
- icon?: string;
40
- action: string;
41
- label: string;
42
- };
43
- };
44
- export declare const ConversationComponent: (container: Container) => Promise<void>;
45
- export default ConversationComponent;
@@ -1,9 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import { ConverstationMessageItem } from '../../../types';
3
- export declare class MessageList extends LitElement {
4
- static styles: import("lit").CSSResult;
5
- items: ConverstationMessageItem<any>[];
6
- private _isCustomComponent;
7
- private _createCustomComponent;
8
- render(): import("lit-html").TemplateResult<1>;
9
- }
@@ -1,8 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import { ConversationMessageListItemType, ConverstationMessageItem } from '../../../../types';
3
- export declare class MessageTypeLinkList extends LitElement {
4
- static styles: import("lit").CSSResult[];
5
- message: ConverstationMessageItem<ConversationMessageListItemType.LinkList>['1'];
6
- _onItemClick(item: any): void;
7
- render(): import("lit-html").TemplateResult<1>;
8
- }
@@ -1,7 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import { ConversationMessageListItemType, ConverstationMessageItem } from '../../../../types';
3
- export declare class MessageTypeSeparator extends LitElement {
4
- static styles: import("lit").CSSResult[];
5
- message: ConverstationMessageItem<ConversationMessageListItemType.Separator>['1'];
6
- render(): import("lit-html").TemplateResult<1>;
7
- }
@@ -1,8 +0,0 @@
1
- import { LitElement, nothing } from 'lit';
2
- import { BundledConversationMessage } from '../plugin';
3
- export declare class Message extends LitElement {
4
- static styles: import("lit").CSSResult;
5
- message: BundledConversationMessage;
6
- _renderTimestamp(name: string, timestamp: number | null): import("lit-html").TemplateResult<1> | typeof nothing;
7
- render(): "" | import("lit-html").TemplateResult<1> | typeof nothing;
8
- }
@@ -1 +0,0 @@
1
- export declare const scrollToBottomOfConversation: (elem: HTMLElement) => void;