@telia-ace/widget-conversation-flamingo 0.0.1
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/agent.d.ts +20 -0
- package/components/conversation/conversation.d.ts +20 -0
- package/components/conversation/plugin.d.ts +45 -0
- package/components/conversation/ui/message-list.d.ts +9 -0
- package/components/conversation/ui/message-types/message-type-html.d.ts +7 -0
- package/components/conversation/ui/message-types/message-type-link-list.d.ts +8 -0
- package/components/conversation/ui/message-types/message-type-separator.d.ts +7 -0
- package/components/conversation/ui/message.d.ts +8 -0
- package/components/conversation/utils.d.ts +1 -0
- package/conversation-525fb3e8.mjs +1884 -0
- package/conversation-controller.d.ts +121 -0
- package/conversation-fd0d3efa.js +446 -0
- package/conversation-history.d.ts +26 -0
- package/conversation-platform.d.ts +51 -0
- package/conversation-provider.d.ts +32 -0
- package/index-0fa1419c.js +160 -0
- package/index-17239ac6.mjs +336 -0
- package/index-17fa2121.js +1 -0
- package/index-b459e13f.mjs +3886 -0
- package/index.d.ts +9 -0
- package/index.js +1 -0
- package/index.mjs +11 -0
- package/package.json +8 -0
- package/send-1e9780e5.mjs +5 -0
- package/send-df47dcea.js +1 -0
- package/store.d.ts +31 -0
- package/types.d.ts +130 -0
- package/user.d.ts +9 -0
- package/utils/custom-message.d.ts +2 -0
- package/utils/index.d.ts +1 -0
- package/utils/open-chat-widget.d.ts +4 -0
- package/utils/swap-provider.d.ts +8 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
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 };
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-0fa1419c.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;
|
package/index.mjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { f as s, g as n, d as a, j as r, k as t, C, c as i, r as v } from "./index-b459e13f.mjs";
|
|
2
|
+
export {
|
|
3
|
+
s as ConversationComponent,
|
|
4
|
+
n as ConversationController,
|
|
5
|
+
a as ConversationEndedBehavior,
|
|
6
|
+
r as ConversationEntry,
|
|
7
|
+
t as ConversationMessageListItemType,
|
|
8
|
+
C as ConversationMessageType,
|
|
9
|
+
i as ConversationPlatform,
|
|
10
|
+
v as registerCustomMessageComponent
|
|
11
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const e = { name: "grid-view", svg: '<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M10 8H28C29.1046 8 30 8.89543 30 10V28C30 29.1046 29.1046 30 28 30H10C8.89543 30 8 29.1046 8 28V10C8 8.89543 8.89543 8 10 8ZM12 12V26H26V12H12Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M10 34H28C29.1046 34 30 34.8954 30 36V54C30 55.1046 29.1046 56 28 56H10C8.89543 56 8 55.1046 8 54V36C8 34.8954 8.89543 34 10 34ZM12 38V52H26V38H12Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M54 8H36C34.8954 8 34 8.89543 34 10V28C34 29.1046 34.8954 30 36 30H54C55.1046 30 56 29.1046 56 28V10C56 8.89543 55.1046 8 54 8ZM38 26V12H52V26H38Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M36 34H54C55.1046 34 56 34.8954 56 36V54C56 55.1046 55.1046 56 54 56H36C34.8954 56 34 55.1046 34 54V36C34 34.8954 34.8954 34 36 34ZM38 38V52H52V38H38Z"/></svg>' }, l = { name: "send", svg: '<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.41642 6.29292C5.99705 5.18016 3.38612 7.41823 4.12858 9.96847L10.5427 32L4.12858 54.0315C3.38612 56.5818 5.99704 58.8198 8.41642 57.7071L58.1942 34.8125C60.6019 33.7051 60.6019 30.2949 58.1942 29.1875L8.41642 6.29292ZM14.2569 29.9351L8.74174 10.9913L49.9295 29.9351H14.2569ZM14.2568 34.0651L8.74174 53.0087L49.9291 34.0651H14.2568Z"/></svg>' };
|
|
2
|
+
export {
|
|
3
|
+
e as g,
|
|
4
|
+
l as s
|
|
5
|
+
};
|
package/send-df47dcea.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e={name:"grid-view",svg:'<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M10 8H28C29.1046 8 30 8.89543 30 10V28C30 29.1046 29.1046 30 28 30H10C8.89543 30 8 29.1046 8 28V10C8 8.89543 8.89543 8 10 8ZM12 12V26H26V12H12Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M10 34H28C29.1046 34 30 34.8954 30 36V54C30 55.1046 29.1046 56 28 56H10C8.89543 56 8 55.1046 8 54V36C8 34.8954 8.89543 34 10 34ZM12 38V52H26V38H12Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M54 8H36C34.8954 8 34 8.89543 34 10V28C34 29.1046 34.8954 30 36 30H54C55.1046 30 56 29.1046 56 28V10C56 8.89543 55.1046 8 54 8ZM38 26V12H52V26H38Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M36 34H54C55.1046 34 56 34.8954 56 36V54C56 55.1046 55.1046 56 54 56H36C34.8954 56 34 55.1046 34 54V36C34 34.8954 34.8954 34 36 34ZM38 38V52H52V38H38Z"/></svg>'},l={name:"send",svg:'<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.41642 6.29292C5.99705 5.18016 3.38612 7.41823 4.12858 9.96847L10.5427 32L4.12858 54.0315C3.38612 56.5818 5.99704 58.8198 8.41642 57.7071L58.1942 34.8125C60.6019 33.7051 60.6019 30.2949 58.1942 29.1875L8.41642 6.29292ZM14.2569 29.9351L8.74174 10.9913L49.9295 29.9351H14.2569ZM14.2568 34.0651L8.74174 53.0087L49.9291 34.0651H14.2568Z"/></svg>'};exports.gridView=e;exports.send=l;
|
package/store.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Container } from '@webprovisions/platform';
|
|
2
|
+
import { AgentSettings } from './agent';
|
|
3
|
+
import { ConversationController } from './conversation-controller';
|
|
4
|
+
type StoredConversationAgent = {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
avatar?: string;
|
|
8
|
+
providerName: string;
|
|
9
|
+
};
|
|
10
|
+
type StoredConversationMessage = any;
|
|
11
|
+
type StoredConversation = {
|
|
12
|
+
agents: StoredConversationAgent[];
|
|
13
|
+
messages: StoredConversationMessage[];
|
|
14
|
+
};
|
|
15
|
+
export declare const createSessionStorageKey: (id: string) => string;
|
|
16
|
+
declare class Store {
|
|
17
|
+
private container;
|
|
18
|
+
private enabled;
|
|
19
|
+
private sessionStorageKey;
|
|
20
|
+
private locker;
|
|
21
|
+
private initialStoredAgents;
|
|
22
|
+
constructor(container: Container, conversation: ConversationController, enabled: boolean);
|
|
23
|
+
setInitialData(data: {
|
|
24
|
+
agents: AgentSettings[];
|
|
25
|
+
}): void;
|
|
26
|
+
isRehydrated(): Promise<boolean>;
|
|
27
|
+
getStoredAgent(agentId: string): StoredConversationAgent | undefined;
|
|
28
|
+
write(data: any, type: 'messages' | 'agents', action?: 'add' | 'update'): Promise<void>;
|
|
29
|
+
read(): Promise<StoredConversation>;
|
|
30
|
+
}
|
|
31
|
+
export default Store;
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
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;
|
|
49
|
+
};
|
|
50
|
+
export type ConversationMessageSender = {
|
|
51
|
+
name?: string;
|
|
52
|
+
avatar?: string | Symbol;
|
|
53
|
+
id?: string;
|
|
54
|
+
};
|
|
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"
|
|
67
|
+
}
|
|
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/user.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ConversationController, ConversationEntry } from './conversation-controller';
|
|
2
|
+
import { ConversationMessageSettings } from './types';
|
|
3
|
+
export declare class User {
|
|
4
|
+
private controller;
|
|
5
|
+
constructor(controller: ConversationController);
|
|
6
|
+
print: (settings: string | ConversationMessageSettings, options?: {
|
|
7
|
+
key?: string;
|
|
8
|
+
}) => ConversationEntry;
|
|
9
|
+
}
|
package/utils/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { navigateToConversation, openChatWidget, shouldPreventDefault } from './open-chat-widget';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Container } from '@webprovisions/platform';
|
|
2
|
+
export declare const shouldPreventDefault: (container: Container) => boolean;
|
|
3
|
+
export declare const openChatWidget: (container: Container, contactMethod: any, triggerDOMTarget?: HTMLElement) => boolean | Promise<boolean> | Promise<void>;
|
|
4
|
+
export declare const navigateToConversation: (container: Container, contactMethod: any, _routeName?: string) => any;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Container } from '@webprovisions/platform';
|
|
2
|
+
/**
|
|
3
|
+
* This will put the current provider(s) in a queue and
|
|
4
|
+
* swap current provider to another one based on the providerName.
|
|
5
|
+
* When ConversationProvider.complete() is called, the provider(s) in the
|
|
6
|
+
* queue will become active again
|
|
7
|
+
*/
|
|
8
|
+
export declare const swapProvider: (container: Container, conversationId: string, providerName: string) => Promise<void>;
|