@telia-ace/widget-conversation-flamingo 1.0.0

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 (57) hide show
  1. package/LICENSE.txt +6 -0
  2. package/README.md +490 -0
  3. package/dist/agent.d.ts +21 -0
  4. package/dist/agent.d.ts.map +1 -0
  5. package/dist/components/conversation/conversation.d.ts +29 -0
  6. package/dist/components/conversation/conversation.d.ts.map +1 -0
  7. package/dist/components/conversation/plugin.d.ts +46 -0
  8. package/dist/components/conversation/plugin.d.ts.map +1 -0
  9. package/dist/components/conversation/ui/message-list.d.ts +10 -0
  10. package/dist/components/conversation/ui/message-list.d.ts.map +1 -0
  11. package/dist/components/conversation/ui/message-types/message-type-html.d.ts +8 -0
  12. package/dist/components/conversation/ui/message-types/message-type-html.d.ts.map +1 -0
  13. package/dist/components/conversation/ui/message-types/message-type-link-list.d.ts +9 -0
  14. package/dist/components/conversation/ui/message-types/message-type-link-list.d.ts.map +1 -0
  15. package/dist/components/conversation/ui/message-types/message-type-separator.d.ts +8 -0
  16. package/dist/components/conversation/ui/message-types/message-type-separator.d.ts.map +1 -0
  17. package/dist/components/conversation/ui/message.d.ts +9 -0
  18. package/dist/components/conversation/ui/message.d.ts.map +1 -0
  19. package/dist/components/conversation/utils.d.ts +2 -0
  20. package/dist/components/conversation/utils.d.ts.map +1 -0
  21. package/dist/conversation-31b48ff2.js +2312 -0
  22. package/dist/conversation-31b48ff2.js.map +1 -0
  23. package/dist/conversation-controller.d.ts +122 -0
  24. package/dist/conversation-controller.d.ts.map +1 -0
  25. package/dist/conversation-form-adapter.d.ts +7 -0
  26. package/dist/conversation-form-adapter.d.ts.map +1 -0
  27. package/dist/conversation-history.d.ts +27 -0
  28. package/dist/conversation-history.d.ts.map +1 -0
  29. package/dist/conversation-platform.d.ts +55 -0
  30. package/dist/conversation-platform.d.ts.map +1 -0
  31. package/dist/conversation-provider.d.ts +33 -0
  32. package/dist/conversation-provider.d.ts.map +1 -0
  33. package/dist/index-d8edc7b3.js +4615 -0
  34. package/dist/index-d8edc7b3.js.map +1 -0
  35. package/dist/index.d.ts +10 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +12 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/resolve-entity-value.d.ts +11 -0
  40. package/dist/resolve-entity-value.d.ts.map +1 -0
  41. package/dist/store.d.ts +32 -0
  42. package/dist/store.d.ts.map +1 -0
  43. package/dist/types.d.ts +131 -0
  44. package/dist/types.d.ts.map +1 -0
  45. package/dist/user.d.ts +10 -0
  46. package/dist/user.d.ts.map +1 -0
  47. package/dist/utils/custom-message.d.ts +3 -0
  48. package/dist/utils/custom-message.d.ts.map +1 -0
  49. package/dist/utils/index.d.ts +2 -0
  50. package/dist/utils/index.d.ts.map +1 -0
  51. package/dist/utils/map-actions.d.ts +2 -0
  52. package/dist/utils/map-actions.d.ts.map +1 -0
  53. package/dist/utils/open-chat-widget.d.ts +5 -0
  54. package/dist/utils/open-chat-widget.d.ts.map +1 -0
  55. package/dist/utils/swap-provider.d.ts +9 -0
  56. package/dist/utils/swap-provider.d.ts.map +1 -0
  57. package/package.json +50 -0
@@ -0,0 +1,122 @@
1
+ import { Container, EventListener, EventManager } from '@webprovisions/platform';
2
+ import { AgentSettings } from './agent';
3
+ import { ConversationProvider } from './conversation-provider';
4
+ import { ConversationMessageContent, ConversationMessageSender, ConversationMessageSettings, ConversationMessageUpdateSettings, ConverstationMessageItem, NormalizedMessageSettings } from './types';
5
+ import { User } from './user';
6
+ export type ValidateHandler = (formValues: {
7
+ [key: string]: any;
8
+ }) => Promise<any>;
9
+ export type SubmitHandler = (formValues: {
10
+ [key: string]: any;
11
+ }) => Promise<any>;
12
+ export type ConversationOptions = {
13
+ silent: boolean;
14
+ };
15
+ export type Print = (content: string | ConversationMessageContent) => ConversationEntry;
16
+ export type FormHandlers = {
17
+ [key: string]: FormHandler;
18
+ };
19
+ export type FormHandler = {
20
+ validate?: ValidateHandler;
21
+ submit: SubmitHandler;
22
+ };
23
+ export type CancelLoaderDelegate = () => void;
24
+ export declare class ConversationEntry {
25
+ private writer;
26
+ constructor(writer: EntryWriter);
27
+ update(content: string | ConversationMessageUpdateSettings | ConverstationMessageItem<any> | ConverstationMessageItem<any>[]): void;
28
+ remove(): void;
29
+ private getNormalizedSettings;
30
+ }
31
+ export declare enum ConversationMessageType {
32
+ User = "user",
33
+ Agent = "agent",
34
+ System = "system"
35
+ }
36
+ export type ConversationMessage = {
37
+ key: string;
38
+ timestamp: number | null;
39
+ content: ConversationMessageContent | null;
40
+ sender: ConversationMessageSender | null;
41
+ type: ConversationMessageType;
42
+ };
43
+ export type EntryWriter = (content: ConversationMessageUpdateSettings | null) => void;
44
+ export declare const getNormalizedMessageSettings: (settings: string | ConversationMessageSettings | ConverstationMessageItem<any> | ConverstationMessageItem<any>[], options?: {
45
+ key?: string;
46
+ }) => NormalizedMessageSettings;
47
+ /**
48
+ * Manages the stream of messages inside a `ConversationComponent` and provides external read-write
49
+ * access to it as well as exposing emitted actions.
50
+ */
51
+ export declare class ConversationController {
52
+ container: Container;
53
+ id: string;
54
+ formHandlers: FormHandlers;
55
+ /**
56
+ * Represents the current end user.
57
+ */
58
+ user: User;
59
+ events: EventManager;
60
+ providers: string[];
61
+ active: boolean;
62
+ queuedProviders: string[];
63
+ registeredProviders: ConversationProvider[];
64
+ private loaders;
65
+ private componentMounted;
66
+ private store;
67
+ messages: ConversationMessage[];
68
+ private typingActors;
69
+ private conversationHistory;
70
+ constructor(container: Container, id: string, options: {
71
+ rehydrate: boolean;
72
+ });
73
+ setInitialStorage(data: {
74
+ agents: AgentSettings[];
75
+ }): void;
76
+ setProviders(providers: string[]): void;
77
+ createProvider(name: string): ConversationProvider;
78
+ providerIndex(name: string): number;
79
+ getAgentById(id?: string): {
80
+ id: string;
81
+ name: string;
82
+ avatar?: string | undefined;
83
+ providerName: string;
84
+ } | undefined;
85
+ dispose(): void;
86
+ onDispose(fn: EventListener): import("@webprovisions/platform").EventSubscriptionCancellation;
87
+ onStarted(fn: EventListener): import("@webprovisions/platform").EventSubscriptionCancellation;
88
+ onMessageCreated(fn: EventListener): import("@webprovisions/platform").EventSubscriptionCancellation;
89
+ isRehydrated(): Promise<boolean>;
90
+ disposeProvider(target: ConversationProvider): void;
91
+ onProvidersChange(fn: EventListener): import("@webprovisions/platform").EventSubscriptionCancellation;
92
+ setComponentMountedState(mounted: boolean): void;
93
+ setProviderOptions(providerName: string, options: ConversationOptions): void;
94
+ changeProvider(providerName: string): void;
95
+ queueProviders(providers: string[]): void;
96
+ onCompleteProvider(): void;
97
+ getComponentMountedState(): boolean;
98
+ onUnreadMessage(fn: EventListener): import("@webprovisions/platform").EventSubscriptionCancellation;
99
+ createEntry(key: string, content: ConversationMessageContent, type: ConversationMessageType, sender?: ConversationMessageSender, timestamp?: number | null): ConversationEntry;
100
+ print: (settings: string | ConversationMessageSettings) => ConversationEntry;
101
+ update(): void;
102
+ getMessageStream(): {
103
+ messages: ConversationMessage[];
104
+ loading: boolean;
105
+ typingActors: ConversationMessageSender[];
106
+ };
107
+ setTypingState(sender: ConversationMessageSender, _type?: ConversationMessageType): () => void;
108
+ /**
109
+ * Displays a loader in the conversation.
110
+ */
111
+ loader(): CancelLoaderDelegate;
112
+ submitForm(key: string, handler: SubmitHandler): void;
113
+ validateForm(key: string, handler: ValidateHandler): void;
114
+ getHistory(): {
115
+ message?: string | undefined;
116
+ options?: string[] | undefined;
117
+ alias: string;
118
+ source: string;
119
+ timestamp: number | null;
120
+ }[];
121
+ }
122
+ //# sourceMappingURL=conversation-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-controller.d.ts","sourceRoot":"","sources":["../src/conversation-controller.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,aAAa,EACb,YAAY,EAEb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,oBAAoB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declare class ConversationFormAdapter {
3
+ constructor(_platform: ConversationPlatform);
4
+ submit: (_invoke: any, _cancel: any) => (_contactMethod: any) => Promise<any>;
5
+ updateContactMethod: (_contactMethod: any, _errors?: any) => void;
6
+ }
7
+ //# sourceMappingURL=conversation-form-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-form-adapter.d.ts","sourceRoot":"","sources":["../src/conversation-form-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,qBAAa,uBAAuB;gBACtB,SAAS,EAAE,oBAAoB;IAE3C,MAAM,YAEO,GAAG,WACH,GAAG,sBAES,GAAG,KAAG,QAAQ,GAAG,CAAC,CAAO;IAyClD,mBAAmB,mBAAoB,GAAG,YAAY,GAAG,UAAQ;CAwClE"}
@@ -0,0 +1,27 @@
1
+ import { ConversationController, ConversationMessageType } from './conversation-controller';
2
+ import { ConversationMessageContent, ConversationMessageSender } from './types';
3
+ type ConversationLogMessage = {
4
+ message?: string;
5
+ options?: string[];
6
+ alias: string;
7
+ source: string;
8
+ timestamp: number | null;
9
+ };
10
+ export declare class ConversationHistory {
11
+ private controller;
12
+ private cache;
13
+ private subscriptions;
14
+ constructor(controller: ConversationController);
15
+ getConversationLogs(): ConversationLogMessage[];
16
+ parseEntry(content: ConversationMessageContent, type: ConversationMessageType, sender?: ConversationMessageSender, timestamp?: any | null): ConversationLogMessage;
17
+ private createMessageSource;
18
+ private createAlias;
19
+ private handleContactMethod;
20
+ private getDetails;
21
+ private createMessageContent;
22
+ private createMessageOptions;
23
+ private appendText;
24
+ dispose(): void;
25
+ }
26
+ export {};
27
+ //# sourceMappingURL=conversation-history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-history.d.ts","sourceRoot":"","sources":["../src/conversation-history.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EAExB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEhF,KAAK,sBAAsB,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,qBAAa,mBAAmB;IAKlB,OAAO,CAAC,UAAU;IAJ9B,OAAO,CAAC,KAAK,CAA+B;IAE5C,OAAO,CAAC,aAAa,CAAuC;gBAExC,UAAU,EAAE,sBAAsB;IAWtD,mBAAmB,IAAI,sBAAsB,EAAE;IAoB/C,UAAU,CACR,OAAO,EAAE,0BAA0B,EACnC,IAAI,EAAE,uBAAuB,EAC7B,MAAM,CAAC,EAAE,yBAAyB,EAClC,SAAS,CAAC,EAAE,GAAG,GAAG,IAAI;IA2DxB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,UAAU;IAkDlB,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,oBAAoB;IAuB5B,OAAO,CAAC,UAAU;IASlB,OAAO;CAKR"}
@@ -0,0 +1,55 @@
1
+ import { ComponentNodeController, ComponentPlatform } from '@telia-ace/widget-core';
2
+ import { RouteData } from '@telia-ace/widget-routing';
3
+ import { Container, EventManager, EventSubscriptionCancellation } from '@webprovisions/platform';
4
+ import { ConversationController } from './conversation-controller';
5
+ import { ConversationProvider } from './conversation-provider';
6
+ export type ConversationHandler = (conversation: ConversationProvider, component: ComponentNodeController) => void | (() => void);
7
+ export type UnregisterControllerDelegate = () => void;
8
+ export type ConversationProviderRegistration = {
9
+ name: string;
10
+ handler: ConversationHandler;
11
+ };
12
+ export declare enum ConversationEndedBehavior {
13
+ Deactivate = "deactivate",
14
+ Navigate = "navigate",
15
+ None = "none"
16
+ }
17
+ export type SessionInfo = {
18
+ id?: string;
19
+ route?: RouteData;
20
+ conversationEndedBehavior?: ConversationEndedBehavior;
21
+ };
22
+ export declare class ConversationPlatform {
23
+ private container;
24
+ private components;
25
+ events: EventManager;
26
+ controllers: {
27
+ conversation: ConversationController;
28
+ component: ComponentNodeController;
29
+ }[];
30
+ private providers;
31
+ private disposeProviders;
32
+ private subscriptions;
33
+ private storageWriter;
34
+ private router;
35
+ private buttonQuery;
36
+ private sessionInfo;
37
+ constructor(container: Container, components: ComponentPlatform);
38
+ initialize(): void;
39
+ addSubscription(sub: EventSubscriptionCancellation): void;
40
+ static getInstance(container: Container, key?: string): Promise<ConversationPlatform>;
41
+ navigateToConversationIfActive(id: string): Promise<void>;
42
+ setConversationEndedBehavior(behavior: ConversationEndedBehavior): Promise<void>;
43
+ createController(id: string, options: {
44
+ rehydrate: boolean;
45
+ }): Promise<ConversationController>;
46
+ registerProvider(name: string, handler: ConversationHandler): void;
47
+ registerController(conversation: ConversationController, component: ComponentNodeController): boolean;
48
+ private writeToComponents;
49
+ private invokeHandler;
50
+ getComponentRoute(): Promise<RouteData | undefined>;
51
+ dispose(): void;
52
+ static handleContactMethodClick(event: any, container: Container, contactMethod: any, _callback?: Function): Promise<void>;
53
+ static handleContactMethodSubmit(container: Container, contactMethod: any): Promise<any>;
54
+ }
55
+ //# sourceMappingURL=conversation-platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-platform.d.ts","sourceRoot":"","sources":["../src/conversation-platform.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EAElB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAkB,MAAM,2BAA2B,CAAC;AAStE,OAAO,EACL,SAAS,EACT,YAAY,EACZ,6BAA6B,EAE9B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,oB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E,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAezD,4BAA4B,CAAC,QAAQ,EAAE,yBAAyB;IAoB1D,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE;IAkBlE,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,IAAI;IAgBlE,kBAAkB,CAChB,YAAY,EAAE,sBAAsB,EACpC,SAAS,EAAE,uBAAuB,GACjC,OAAO;IA+EV,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,aAAa;IAgBrB,iBAAiB;IAQjB,OAAO;WAaa,wBAAwB,CAC1C,KAAK,EAAE,GAAG,EACV,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,GAAG,EAClB,SAAS,CAAC,EAAE,QAAQ;WAgBF,yBAAyB,CAC3C,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,GAAG;CAcrB"}
@@ -0,0 +1,33 @@
1
+ import { Container, EventListener, EventSubscriptionCancellation } from '@webprovisions/platform';
2
+ import { Agent, AgentSettings } from './agent';
3
+ import { CancelLoaderDelegate, ConversationController, ConversationEntry, ConversationMessageType, ConversationOptions } from './conversation-controller';
4
+ import { ConversationMessageContent, ConversationMessageSender, ConversationMessageSettings } from './types';
5
+ export declare class ConversationProvider {
6
+ name: string;
7
+ controller: ConversationController | null;
8
+ private subscriptions;
9
+ options: ConversationOptions;
10
+ user: any;
11
+ private constructor();
12
+ static create(name: string, container: Container, controller: ConversationController): ConversationProvider;
13
+ createAgent(settings?: AgentSettings): Agent | undefined;
14
+ print(settings: string | ConversationMessageSettings): ConversationEntry | undefined;
15
+ setTypingState(sender: ConversationMessageSender, type?: ConversationMessageType): (() => void) | undefined;
16
+ loading(): CancelLoaderDelegate;
17
+ createEntry(key: string, content: ConversationMessageContent, type: ConversationMessageType, sender?: ConversationMessageSender, timestamp?: number | null): ConversationEntry | undefined;
18
+ dispose(): void;
19
+ isRehydrated(): Promise<boolean>;
20
+ getHistory(): {
21
+ message?: string | undefined;
22
+ options?: string[] | undefined;
23
+ alias: string;
24
+ source: string;
25
+ timestamp: number | null;
26
+ }[];
27
+ complete(): void;
28
+ setOptions(options?: ConversationOptions): void;
29
+ onUnreadMessage(fn: EventListener): EventSubscriptionCancellation | void;
30
+ onMounted(fn: EventListener): EventSubscriptionCancellation | void;
31
+ }
32
+ export default ConversationProvider;
33
+ //# sourceMappingURL=conversation-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-provider.d.ts","sourceRoot":"","sources":["../src/conversation-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,aAAa,EAEb,6BAA6B,EAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AAEjB,qBAAa,oBAAoB;IAMtB,IAAI,EAAE,MAAM;IAEZ,UAAU,EAAE,sBAAsB,GAAG,IAAI;IAPlD,OAAO,CAAC,aAAa,CAAuC;IACrD,OAAO,EAAE,mBAAmB,CAAC;IAC7B,IAAI,EAAE,GAAG,CAAC;IAEjB,OAAO;IAWP,MAAM,CAAC,MAAM,CACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,sBAAsB;IAKpC,WAAW,CAAC,QAAQ,GAAE,aAAkB,GAAG,KAAK,GAAG,SAAS;IAgB5D,KAAK,CACH,QAAQ,EAAE,MAAM,GAAG,2BAA2B,GAC7C,iBAAiB,GAAG,SAAS;IAIhC,cAAc,CACZ,MAAM,EAAE,yBAAyB,EACjC,IAAI,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