@telia-ace/conversational-hub-bot-provider 0.0.7 → 0.0.8

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/package.json CHANGED
@@ -1,20 +1,27 @@
1
- {
2
- "name": "@telia-ace/conversational-hub-bot-provider",
3
- "version": "0.0.7",
4
- "main": "./index.js",
5
- "types": "./index.d.ts",
6
- "exports": {
7
- ".": {
8
- "import": "./index.mjs",
9
- "require": "./index.js"
10
- }
11
- },
12
- "dependencies": {
13
- "@telia-ace/widget-conversation": "*",
14
- "@webprovisions/platform": "^1.1.4",
15
- "@emotion/react": "11.11.1",
16
- "@telia-ace/knowledge-widget-core": "*",
17
- "@telia-ace/widget-utilities": "*",
18
- "@telia-ace/widget-services": "*"
19
- }
20
- }
1
+ {
2
+ "name": "@telia-ace/conversational-hub-bot-provider",
3
+ "version": "0.0.8",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./index.mjs",
9
+ "require": "./index.js"
10
+ }
11
+ },
12
+ "dependencies": {
13
+ "@telia-ace/widget-conversation": "*",
14
+ "@webprovisions/platform": "^1.1.4",
15
+ "@emotion/react": "11.11.1",
16
+ "@telia-ace/knowledge-widget-core": "*",
17
+ "@telia-ace/widget-utilities": "*",
18
+ "@telia-ace/widget-services": "*",
19
+ "@telia-ace/widget-core": "*",
20
+ "@emotion/styled": "11.11.0",
21
+ "@telia-ace/knowledge-data-client": "*",
22
+ "@telia-ace/knowledge-widget-adapters": "*",
23
+ "@telia-ace/knowledge-widget-ui": "*",
24
+ "@telia-ace/widget-forms": "*",
25
+ "react": "18.2.0"
26
+ }
27
+ }
package/plugin.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Container } from '@webprovisions/platform';
2
2
  /**
3
- * Plugin for communicating with Webconnector API in Conversational Hub.
3
+ * Plugin for communicating with Webconnector API 1.0 in Conversational Hub.
4
4
  */
5
5
  export declare const ConversationalHubPlugin: (container: Container) => Promise<void>;
6
6
  export default ConversationalHubPlugin;
package/store.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ import { Container } from '@webprovisions/platform';
2
+ import { GlobalState, LooseObject, ServerEntry } from './types';
3
+ type MetaData = {
4
+ agent: {
5
+ name: string;
6
+ avatar?: string;
7
+ };
8
+ };
9
+ type StorageTypes = 'localState' | 'globalState' | 'entries' | 'meta';
10
+ declare class Store {
11
+ private container;
12
+ private enabled;
13
+ private botProviderGlobalStateKey;
14
+ private botProviderLocalStateKey;
15
+ private botProviderEntriesKey;
16
+ private botProviderMetaStateKey;
17
+ constructor(container: Container);
18
+ private getKey;
19
+ read(type: 'localState'): Promise<LooseObject | undefined>;
20
+ read(type: 'meta'): Promise<MetaData | undefined>;
21
+ read(type: 'entries'): Promise<ServerEntry[] | undefined>;
22
+ read(type: 'globalState'): Promise<GlobalState | undefined>;
23
+ write(data: any, type: StorageTypes): Promise<void>;
24
+ }
25
+ export default Store;
package/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { ConversationMessageListItemType } from '@telia-ace/widget-conversation';
1
2
  export type AgentResponse = {
2
3
  language: string;
3
4
  type: string;
@@ -19,3 +20,82 @@ export type Action = {
19
20
  export type StorageData = {
20
21
  sessionId: string;
21
22
  };
23
+ export type TransferPayload = {
24
+ transfer_parameters: {
25
+ contactGuide: string;
26
+ };
27
+ };
28
+ export declare enum CustomMessageTypes {
29
+ ContactMethod = "ace-conversational-hub-contact-method"
30
+ }
31
+ export type LooseObject = {
32
+ [key: string]: any;
33
+ };
34
+ export interface ActionItem {
35
+ label: string;
36
+ actionKey: string;
37
+ data?: any;
38
+ description?: string;
39
+ }
40
+ export interface MessageGroup {
41
+ id: string;
42
+ isUser: boolean;
43
+ items: MessageGroupItem[];
44
+ writer?: any;
45
+ meta: {
46
+ [key: string]: any;
47
+ };
48
+ }
49
+ export interface MessageGroupItem {
50
+ id: string;
51
+ groupId: string;
52
+ isUser: boolean;
53
+ message: [ConversationMessageListItemType | CustomMessageTypes, any];
54
+ }
55
+ export interface ClientEnvelope {
56
+ command?: LooseObject;
57
+ action?: {
58
+ key: string;
59
+ content: any;
60
+ };
61
+ globalState?: LooseObject;
62
+ localState?: LooseObject;
63
+ clientId?: string;
64
+ funnel?: string;
65
+ }
66
+ export interface ServerEnvelope {
67
+ clientId?: string | undefined;
68
+ entries: ServerEntry[];
69
+ globalState?: GlobalState;
70
+ resolveCommand?: string;
71
+ clientEnvelope?: ClientEnvelope;
72
+ }
73
+ export interface GlobalState {
74
+ completedInteractionsCount: number;
75
+ lastQuestion?: string;
76
+ lastBotGuide: number;
77
+ lastGuideTitle?: string;
78
+ site: string;
79
+ invincibleParameters: object;
80
+ }
81
+ export interface ServerEntry {
82
+ id: string;
83
+ type: string;
84
+ content: any;
85
+ actions: {
86
+ [key: string]: any;
87
+ };
88
+ tags: string[];
89
+ relation?: string;
90
+ timestamp: string;
91
+ localState?: {
92
+ [key: string]: any;
93
+ };
94
+ }
95
+ export interface ListContent {
96
+ header?: string;
97
+ actions: ActionItem[];
98
+ contactMethodIds?: string[];
99
+ entryId: string;
100
+ groupId: string;
101
+ }
@@ -0,0 +1,11 @@
1
+ import { Container } from '@webprovisions/platform';
2
+ import React from 'react';
3
+ type Props = {
4
+ contactMethodId: string;
5
+ groupId: string;
6
+ guideId?: string;
7
+ className?: string;
8
+ container?: Container;
9
+ };
10
+ declare const ContactMethod: React.FC<Props>;
11
+ export default ContactMethod;
package/utils.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { ContactMethodType } from '@telia-ace/knowledge-widget-adapters';
2
+ import { Container } from '@webprovisions/platform';
3
+ import { ComponentNodeController } from '@telia-ace/widget-core';
4
+ import { MessageGroup, MessageGroupItem } from './types';
5
+ export declare const createGroup: ({ isUser, items, meta, }: {
6
+ isUser: boolean;
7
+ items?: Partial<MessageGroupItem>[] | undefined;
8
+ meta?: {
9
+ [key: string]: any;
10
+ } | undefined;
11
+ }) => MessageGroup;
12
+ export declare const getKnowledgeBotEndpoint: (container: Container, component: ComponentNodeController) => string;
13
+ export declare const updateForm: (contactMethod: ContactMethodType, { submit, errors, meta, }: {
14
+ submit: string;
15
+ errors?: {
16
+ [key: string]: string;
17
+ } | undefined;
18
+ meta?: {
19
+ [key: string]: string;
20
+ } | undefined;
21
+ }) => any;
22
+ export declare const setServiceClientParameter: (container: Container, key: string, value: string) => Promise<void>;