@telia-ace/widget-conversation-flamingo 1.1.120-rc.0 → 1.1.120-rc.10

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.
@@ -0,0 +1,12 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class Lightbox extends LitElement {
3
+ static styles: import('lit').CSSResult[];
4
+ imageUrl: string;
5
+ altText?: string;
6
+ firstUpdated(): void;
7
+ disconnectedCallback(): void;
8
+ private escapeListener;
9
+ private closeLightbox;
10
+ private handleKeyDown;
11
+ render(): import('lit-html').TemplateResult<1>;
12
+ }
@@ -0,0 +1,8 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class MessageTypeHtml extends LitElement {
3
+ static readonly styles: import('lit').CSSResult[];
4
+ message: {
5
+ content: string;
6
+ };
7
+ render(): import('lit-html').TemplateResult<1>;
8
+ }
@@ -0,0 +1,25 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class MessageTypeMarkdown extends LitElement {
3
+ static readonly styles: import('lit').CSSResult[];
4
+ message: {
5
+ content: string;
6
+ };
7
+ showLightbox: boolean;
8
+ imageUrl: string;
9
+ altText: string;
10
+ private readonly scrollRef;
11
+ private readonly contentRef;
12
+ private autoScroll;
13
+ private buffer;
14
+ private pointer;
15
+ private readonly imageRegexp;
16
+ private handleAutoscroll;
17
+ private handleLightboxClose;
18
+ private handleLightboxOpen;
19
+ private includesImage;
20
+ private getLastChunk;
21
+ firstUpdated(): void;
22
+ updated(): void;
23
+ private applyCodeStyles;
24
+ render(): import('lit-html').TemplateResult<1>;
25
+ }
@@ -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, type?: string, alias?: string): ConversationEntry;
7
+ subscribe(): import('rxjs').Observable<ConversationEntry>;
8
+ }
@@ -0,0 +1,17 @@
1
+ import { Subject } from 'rxjs';
2
+ import { ConversationEntryAction, ConversationMessage, ConversationMessageGroup, ConversationMessageSender, ConversationMessageType } from '../types';
3
+ export declare class ConversationEntry {
4
+ type: ConversationMessageType;
5
+ sender: ConversationMessageSender;
6
+ messages: ConversationMessageGroup[];
7
+ timestamp: number;
8
+ status: 'delivered' | 'failed' | 'pending';
9
+ didUpdate: Subject<ConversationEntry>;
10
+ actions$: Subject<ConversationEntryAction>;
11
+ remove$: Subject<void>;
12
+ id: string;
13
+ constructor(type: ConversationMessageType, sender: ConversationMessageSender, messages: ConversationMessageGroup[]);
14
+ update(content: ConversationMessage[]): void;
15
+ setStatus(status: ConversationEntry['status']): void;
16
+ remove(): void;
17
+ }
@@ -0,0 +1,40 @@
1
+ import { BehaviorSubject, Subject } from 'rxjs';
2
+ import { ConversationMessageType } from '../types';
3
+ import { ConversationEntry } from './conversation-entry';
4
+ import { Agent } from './agent';
5
+ import { User } from './user';
6
+ import { System } from './system';
7
+ import { default as Conversation } from '../conversation';
8
+ type UserSubmitEvent = {
9
+ text: string;
10
+ };
11
+ export declare class ConversationProvider {
12
+ name: string;
13
+ component: Conversation;
14
+ private print$;
15
+ private typingState$;
16
+ private complete$;
17
+ protected system: System;
18
+ rehydrate$: Subject<void>;
19
+ saveToCurrentSession$: Subject<any>;
20
+ showChatOverlay$: BehaviorSubject<boolean>;
21
+ constructor(name: string, component: Conversation);
22
+ connect(_conversationOptions?: Record<string, any>): void;
23
+ disconnected(): void;
24
+ onUserSubmit(action: UserSubmitEvent): void;
25
+ print(type: ConversationMessageType, text: string): ConversationEntry;
26
+ printEntry(entry: ConversationEntry): ConversationEntry;
27
+ createAgent(name: string): Agent;
28
+ createUser(name: string): User;
29
+ createSystem(): System;
30
+ setTypingState(isTyping: boolean): void;
31
+ setToastMessage(message: string | null): void;
32
+ isTyping(): import('rxjs').Observable<boolean>;
33
+ actions(): import('rxjs').Observable<ConversationEntry>;
34
+ playNotification(): void;
35
+ onComplete: () => import('rxjs').Observable<void>;
36
+ complete(): void;
37
+ save(data: any): void;
38
+ rehydrate(_data: Record<string, any>): Promise<void>;
39
+ }
40
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ConversationEntry } from './conversation-entry';
2
+ export declare class System {
3
+ private print$;
4
+ private name;
5
+ constructor();
6
+ print(text: string): ConversationEntry;
7
+ subscribe(): import('rxjs').Observable<ConversationEntry>;
8
+ }
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/widget-conversation-flamingo",
3
- "version": "1.1.120-rc.0",
3
+ "version": "1.1.120-rc.10",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -9,10 +9,11 @@
9
9
  "@lit-labs/motion": "^1.0.8",
10
10
  "@teliads/icons": "^8.4.0",
11
11
  "@teliads/components": "^22.1.1",
12
- "@telia-ace/widget-core-flamingo": "1.1.119",
12
+ "@telia-ace/widget-core-flamingo": "1.1.120-rc.10",
13
13
  "lit-html": "^3.0.2",
14
14
  "rxjs": "^7.8.2",
15
- "marked": "^15.0.2"
15
+ "marked": "^15.0.12",
16
+ "dompurify": "^3.2.6"
16
17
  },
17
18
  "main": "./index.js",
18
19
  "module": "./index.mjs",
@@ -0,0 +1,21 @@
1
+ import { StorageService } from '../../core/src/index.ts';
2
+ import { Observable } from 'rxjs';
3
+ import { default as Conversation } from './conversation';
4
+ import { ChatSession } from './chat-session';
5
+ export declare class SessionService {
6
+ private component;
7
+ private currentSession$;
8
+ private sessions;
9
+ private storage;
10
+ constructor(component: Conversation);
11
+ loadFromStorage(): void;
12
+ startSession(): void;
13
+ setStorageService(storage: StorageService): void;
14
+ currentSession(): Observable<ChatSession | null>;
15
+ private _getStoredSessions;
16
+ private _setSession;
17
+ private _saveSession;
18
+ private save;
19
+ private _createNewSession;
20
+ private _getInitialProviderKey;
21
+ }
@@ -0,0 +1,21 @@
1
+ import { BehaviorSubject, Observable } from 'rxjs';
2
+ import { StorageService } from '../../core/src/index.ts';
3
+ import { Conversation } from './conversation';
4
+ import { ConversationEntry } from './models/conversation-entry';
5
+ import { ChatSession } from './chat-session';
6
+ export declare class StateMachine {
7
+ private state$;
8
+ private component;
9
+ private sessionService;
10
+ private entries$;
11
+ private session$;
12
+ private isTyping$;
13
+ constructor(state$: BehaviorSubject<'waiting' | 'init' | 'rehydrating' | 'connected'>, component: Conversation);
14
+ setStorage(storage: StorageService): void;
15
+ session: () => Observable<ChatSession | null>;
16
+ isTyping: () => Observable<boolean>;
17
+ entries: () => Observable<ConversationEntry[]>;
18
+ private initialize;
19
+ private rehydrate;
20
+ private connected;
21
+ }
package/types.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ export type ConversationMessageGroup = {
2
+ items: ConversationMessage[];
3
+ };
4
+ export type ConversationMessage = [
5
+ string,
6
+ {
7
+ content: string;
8
+ },
9
+ {
10
+ [key: string]: string;
11
+ }?
12
+ ];
13
+ export type ConversationMessageSender = {
14
+ name?: string;
15
+ avatar?: string | symbol;
16
+ id?: string;
17
+ };
18
+ export declare enum ConversationMessageType {
19
+ User = "user",
20
+ Agent = "agent",
21
+ System = "system"
22
+ }
23
+ export type ConversationEntryAction = {
24
+ key: string;
25
+ data: Record<string, any>;
26
+ };
package/typing.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class Typing extends LitElement {
3
+ static styles: import('lit').CSSResult[];
4
+ render(): import('lit-html').TemplateResult<1>;
5
+ }