@telia-ace/knowledge-widget-bot-provider 0.0.1-alpha.28 → 0.0.1-alpha.29
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/lib/client/middleware.client.d.ts +0 -1
- package/lib/client/middleware.client.js +0 -1
- package/lib/interface/entry.interface.js +9 -15
- package/lib-esm/client/middleware.client.d.ts +0 -1
- package/lib-esm/client/middleware.client.js +0 -1
- package/lib-esm/interface/entry.interface.js +9 -15
- package/package.json +1 -1
|
@@ -5,7 +5,6 @@ export default class MiddlewareClient {
|
|
|
5
5
|
private processor;
|
|
6
6
|
private entryInterface;
|
|
7
7
|
private chatClient;
|
|
8
|
-
private container;
|
|
9
8
|
constructor(container: Container);
|
|
10
9
|
static initialize(container: any, widget: any): void;
|
|
11
10
|
handleEntries(entries: ServerEntry[], action?: string): Promise<void>;
|
|
@@ -46,7 +46,6 @@ var MiddlewareClient = /** @class */ (function () {
|
|
|
46
46
|
this.processor = new ProcessorInterface();
|
|
47
47
|
this.entryInterface = new EntryInterface(container);
|
|
48
48
|
this.chatClient = new ChatClient(container);
|
|
49
|
-
this.container = container;
|
|
50
49
|
}
|
|
51
50
|
MiddlewareClient.initialize = function (container, widget) {
|
|
52
51
|
MiddlewareHelper.setContainer(container);
|
|
@@ -49,8 +49,6 @@ import { ConversationMessageListItemType, } from '@humany/widget-conversation';
|
|
|
49
49
|
import { DataType } from '@humany/widget-types-grid';
|
|
50
50
|
import { ServerEntryTypeEnum } from '../contract/enum/server-entry-type.enum';
|
|
51
51
|
import { StoreHelper } from '../helper/store.helper';
|
|
52
|
-
import { toContactMethod } from './convert';
|
|
53
|
-
import mocked from './_mocked-contact-method.json';
|
|
54
52
|
// TODO: toContactMethod and mocked.json should be removed
|
|
55
53
|
var EntryInterface = /** @class */ (function () {
|
|
56
54
|
function EntryInterface(container) {
|
|
@@ -108,24 +106,25 @@ var EntryInterface = /** @class */ (function () {
|
|
|
108
106
|
};
|
|
109
107
|
EntryInterface.prototype.transformContactMethod = function (entry) {
|
|
110
108
|
return __awaiter(this, void 0, void 0, function () {
|
|
111
|
-
var dataClient,
|
|
109
|
+
var dataClient, contactMethods, contactMethod;
|
|
112
110
|
return __generator(this, function (_a) {
|
|
113
111
|
switch (_a.label) {
|
|
114
112
|
case 0: return [4 /*yield*/, this.container.getAsync('dataClient')];
|
|
115
113
|
case 1:
|
|
116
114
|
dataClient = _a.sent();
|
|
117
|
-
|
|
115
|
+
contactMethods = [];
|
|
118
116
|
return [4 /*yield*/, dataClient.fetch(DataType.ContactMethod, {
|
|
119
117
|
contactMethodId: entry.content.id,
|
|
120
118
|
})];
|
|
121
119
|
case 2:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
contactMethod = _a.sent();
|
|
121
|
+
if (contactMethod) {
|
|
122
|
+
contactMethod.expanded = true;
|
|
123
|
+
contactMethods.push(contactMethod);
|
|
124
|
+
}
|
|
126
125
|
return [2 /*return*/, {
|
|
127
126
|
type: 'ace-knowledge-contact-method',
|
|
128
|
-
contactMethods:
|
|
127
|
+
contactMethods: contactMethods,
|
|
129
128
|
}];
|
|
130
129
|
}
|
|
131
130
|
});
|
|
@@ -168,12 +167,7 @@ var EntryInterface = /** @class */ (function () {
|
|
|
168
167
|
}
|
|
169
168
|
finally { if (e_1) throw e_1.error; }
|
|
170
169
|
return [7 /*endfinally*/];
|
|
171
|
-
case 8:
|
|
172
|
-
// entryArray.forEach((o) => {
|
|
173
|
-
// let x = this.transform(o);
|
|
174
|
-
// if (!!x) returnArray.push(x);
|
|
175
|
-
// });
|
|
176
|
-
return [2 /*return*/, returnArray];
|
|
170
|
+
case 8: return [2 /*return*/, returnArray];
|
|
177
171
|
}
|
|
178
172
|
});
|
|
179
173
|
});
|
|
@@ -5,7 +5,6 @@ export default class MiddlewareClient {
|
|
|
5
5
|
private processor;
|
|
6
6
|
private entryInterface;
|
|
7
7
|
private chatClient;
|
|
8
|
-
private container;
|
|
9
8
|
constructor(container: Container);
|
|
10
9
|
static initialize(container: any, widget: any): void;
|
|
11
10
|
handleEntries(entries: ServerEntry[], action?: string): Promise<void>;
|
|
@@ -46,7 +46,6 @@ var MiddlewareClient = /** @class */ (function () {
|
|
|
46
46
|
this.processor = new ProcessorInterface();
|
|
47
47
|
this.entryInterface = new EntryInterface(container);
|
|
48
48
|
this.chatClient = new ChatClient(container);
|
|
49
|
-
this.container = container;
|
|
50
49
|
}
|
|
51
50
|
MiddlewareClient.initialize = function (container, widget) {
|
|
52
51
|
MiddlewareHelper.setContainer(container);
|
|
@@ -49,8 +49,6 @@ import { ConversationMessageListItemType, } from '@humany/widget-conversation';
|
|
|
49
49
|
import { DataType } from '@humany/widget-types-grid';
|
|
50
50
|
import { ServerEntryTypeEnum } from '../contract/enum/server-entry-type.enum';
|
|
51
51
|
import { StoreHelper } from '../helper/store.helper';
|
|
52
|
-
import { toContactMethod } from './convert';
|
|
53
|
-
import mocked from './_mocked-contact-method.json';
|
|
54
52
|
// TODO: toContactMethod and mocked.json should be removed
|
|
55
53
|
var EntryInterface = /** @class */ (function () {
|
|
56
54
|
function EntryInterface(container) {
|
|
@@ -108,24 +106,25 @@ var EntryInterface = /** @class */ (function () {
|
|
|
108
106
|
};
|
|
109
107
|
EntryInterface.prototype.transformContactMethod = function (entry) {
|
|
110
108
|
return __awaiter(this, void 0, void 0, function () {
|
|
111
|
-
var dataClient,
|
|
109
|
+
var dataClient, contactMethods, contactMethod;
|
|
112
110
|
return __generator(this, function (_a) {
|
|
113
111
|
switch (_a.label) {
|
|
114
112
|
case 0: return [4 /*yield*/, this.container.getAsync('dataClient')];
|
|
115
113
|
case 1:
|
|
116
114
|
dataClient = _a.sent();
|
|
117
|
-
|
|
115
|
+
contactMethods = [];
|
|
118
116
|
return [4 /*yield*/, dataClient.fetch(DataType.ContactMethod, {
|
|
119
117
|
contactMethodId: entry.content.id,
|
|
120
118
|
})];
|
|
121
119
|
case 2:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
contactMethod = _a.sent();
|
|
121
|
+
if (contactMethod) {
|
|
122
|
+
contactMethod.expanded = true;
|
|
123
|
+
contactMethods.push(contactMethod);
|
|
124
|
+
}
|
|
126
125
|
return [2 /*return*/, {
|
|
127
126
|
type: 'ace-knowledge-contact-method',
|
|
128
|
-
contactMethods:
|
|
127
|
+
contactMethods: contactMethods,
|
|
129
128
|
}];
|
|
130
129
|
}
|
|
131
130
|
});
|
|
@@ -168,12 +167,7 @@ var EntryInterface = /** @class */ (function () {
|
|
|
168
167
|
}
|
|
169
168
|
finally { if (e_1) throw e_1.error; }
|
|
170
169
|
return [7 /*endfinally*/];
|
|
171
|
-
case 8:
|
|
172
|
-
// entryArray.forEach((o) => {
|
|
173
|
-
// let x = this.transform(o);
|
|
174
|
-
// if (!!x) returnArray.push(x);
|
|
175
|
-
// });
|
|
176
|
-
return [2 /*return*/, returnArray];
|
|
170
|
+
case 8: return [2 /*return*/, returnArray];
|
|
177
171
|
}
|
|
178
172
|
});
|
|
179
173
|
});
|
package/package.json
CHANGED