@telia-ace/knowledge-widget-bot-provider 0.0.1-alpha.40 → 0.0.1-alpha.41
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/chat.client.js +1 -1
- package/lib/interface/entry.interface.d.ts +1 -1
- package/lib/interface/entry.interface.js +34 -34
- package/lib/interface/middleware/processor.interface.js +1 -1
- package/lib-esm/client/chat.client.js +1 -1
- package/lib-esm/interface/entry.interface.d.ts +1 -1
- package/lib-esm/interface/entry.interface.js +34 -34
- package/lib-esm/interface/middleware/processor.interface.js +1 -1
- package/package.json +5 -5
|
@@ -68,7 +68,7 @@ var ChatClient = /** @class */ (function () {
|
|
|
68
68
|
switch (_d.label) {
|
|
69
69
|
case 0:
|
|
70
70
|
try {
|
|
71
|
-
for (_a = __values(messages.filter(function (o) { return o && o != null; })), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
71
|
+
for (_a = __values(messages.filter(function (o) { return o && o != null && !!o.message; })), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
72
72
|
message = _b.value;
|
|
73
73
|
if (message.isUser)
|
|
74
74
|
this.postUserMessage(message);
|
|
@@ -6,7 +6,7 @@ export default class EntryInterface {
|
|
|
6
6
|
private helpActionKey;
|
|
7
7
|
private nextActionKey;
|
|
8
8
|
constructor(container: Container);
|
|
9
|
-
transform(entry: ServerEntry): Promise<Message | undefined>;
|
|
9
|
+
transform(entry: ServerEntry, feedbackEntry?: ServerEntry): Promise<Message | undefined>;
|
|
10
10
|
transformContactMethod(entry: ServerEntry): Promise<any>;
|
|
11
11
|
transformArray(entryArray: ServerEntry[]): Promise<Message[]>;
|
|
12
12
|
getUserMessage(action: string): string | undefined;
|
|
@@ -57,7 +57,7 @@ var EntryInterface = /** @class */ (function () {
|
|
|
57
57
|
this.nextActionKey = 'next';
|
|
58
58
|
}
|
|
59
59
|
// transform the entry based on its type
|
|
60
|
-
EntryInterface.prototype.transform = function (entry) {
|
|
60
|
+
EntryInterface.prototype.transform = function (entry, feedbackEntry) {
|
|
61
61
|
return __awaiter(this, void 0, void 0, function () {
|
|
62
62
|
var entryType, _a;
|
|
63
63
|
var _b;
|
|
@@ -69,38 +69,31 @@ var EntryInterface = /** @class */ (function () {
|
|
|
69
69
|
switch (_a) {
|
|
70
70
|
case ServerEntryTypeEnum.List: return [3 /*break*/, 1];
|
|
71
71
|
case ServerEntryTypeEnum.Text: return [3 /*break*/, 2];
|
|
72
|
-
case ServerEntryTypeEnum.
|
|
73
|
-
case ServerEntryTypeEnum.Contact: return [3 /*break*/, 4];
|
|
72
|
+
case ServerEntryTypeEnum.Contact: return [3 /*break*/, 3];
|
|
74
73
|
}
|
|
75
|
-
return [3 /*break*/,
|
|
74
|
+
return [3 /*break*/, 5];
|
|
76
75
|
case 1: return [2 /*return*/, {
|
|
77
76
|
id: entry.id,
|
|
78
|
-
message: this.listTransform(entry),
|
|
77
|
+
message: this.listTransform(entry, feedbackEntry),
|
|
79
78
|
entry: entry,
|
|
80
79
|
isUser: false,
|
|
81
80
|
}];
|
|
82
81
|
case 2: return [2 /*return*/, {
|
|
83
82
|
id: entry.id,
|
|
84
|
-
message: this.textTransform(entry),
|
|
83
|
+
message: this.textTransform(entry, feedbackEntry),
|
|
85
84
|
entry: entry,
|
|
86
85
|
isUser: false,
|
|
87
86
|
}];
|
|
88
|
-
case 3:
|
|
89
|
-
id: entry.id,
|
|
90
|
-
message: this.listTransform(entry),
|
|
91
|
-
entry: entry,
|
|
92
|
-
isUser: false,
|
|
93
|
-
}];
|
|
94
|
-
case 4:
|
|
87
|
+
case 3:
|
|
95
88
|
_b = {
|
|
96
89
|
id: entry.id
|
|
97
90
|
};
|
|
98
91
|
return [4 /*yield*/, this.transformContactMethod(entry)];
|
|
99
|
-
case
|
|
92
|
+
case 4: return [2 /*return*/, (_b.message = _c.sent(),
|
|
100
93
|
_b.entry = entry,
|
|
101
94
|
_b.isUser = false,
|
|
102
95
|
_b)];
|
|
103
|
-
case
|
|
96
|
+
case 5: return [2 /*return*/];
|
|
104
97
|
}
|
|
105
98
|
});
|
|
106
99
|
});
|
|
@@ -128,37 +121,40 @@ var EntryInterface = /** @class */ (function () {
|
|
|
128
121
|
// transform an array of entries
|
|
129
122
|
EntryInterface.prototype.transformArray = function (entryArray) {
|
|
130
123
|
return __awaiter(this, void 0, void 0, function () {
|
|
131
|
-
var returnArray,
|
|
132
|
-
var e_1,
|
|
133
|
-
return __generator(this, function (
|
|
134
|
-
switch (
|
|
124
|
+
var feedbackEntry, returnArray, _a, _b, o, x, e_1_1;
|
|
125
|
+
var e_1, _c;
|
|
126
|
+
return __generator(this, function (_d) {
|
|
127
|
+
switch (_d.label) {
|
|
135
128
|
case 0:
|
|
129
|
+
feedbackEntry = entryArray.find(function (o) {
|
|
130
|
+
return o.tags.find(function (t) { return t == 'gentle' || t == 'feedback'; });
|
|
131
|
+
});
|
|
136
132
|
returnArray = [];
|
|
137
|
-
|
|
133
|
+
_d.label = 1;
|
|
138
134
|
case 1:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
135
|
+
_d.trys.push([1, 6, 7, 8]);
|
|
136
|
+
_a = __values(entryArray.filter(function (t) { return t !== feedbackEntry; })), _b = _a.next();
|
|
137
|
+
_d.label = 2;
|
|
142
138
|
case 2:
|
|
143
|
-
if (!!
|
|
144
|
-
o =
|
|
145
|
-
return [4 /*yield*/, this.transform(o)];
|
|
139
|
+
if (!!_b.done) return [3 /*break*/, 5];
|
|
140
|
+
o = _b.value;
|
|
141
|
+
return [4 /*yield*/, this.transform(o, feedbackEntry)];
|
|
146
142
|
case 3:
|
|
147
|
-
x =
|
|
143
|
+
x = _d.sent();
|
|
148
144
|
if (!!x)
|
|
149
145
|
returnArray.push(x);
|
|
150
|
-
|
|
146
|
+
_d.label = 4;
|
|
151
147
|
case 4:
|
|
152
|
-
|
|
148
|
+
_b = _a.next();
|
|
153
149
|
return [3 /*break*/, 2];
|
|
154
150
|
case 5: return [3 /*break*/, 8];
|
|
155
151
|
case 6:
|
|
156
|
-
e_1_1 =
|
|
152
|
+
e_1_1 = _d.sent();
|
|
157
153
|
e_1 = { error: e_1_1 };
|
|
158
154
|
return [3 /*break*/, 8];
|
|
159
155
|
case 7:
|
|
160
156
|
try {
|
|
161
|
-
if (
|
|
157
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
162
158
|
}
|
|
163
159
|
finally { if (e_1) throw e_1.error; }
|
|
164
160
|
return [7 /*endfinally*/];
|
|
@@ -172,13 +168,17 @@ var EntryInterface = /** @class */ (function () {
|
|
|
172
168
|
var entry = StoreHelper.getEntry(action);
|
|
173
169
|
return this.getTitleFromEntry(entry, action);
|
|
174
170
|
};
|
|
175
|
-
EntryInterface.prototype.listTransform = function (entry) {
|
|
171
|
+
EntryInterface.prototype.listTransform = function (entry, feedbackEntry) {
|
|
176
172
|
if (entry.type === 'Contact') {
|
|
177
173
|
return;
|
|
178
174
|
}
|
|
179
175
|
if (!entry.content)
|
|
180
176
|
return;
|
|
181
177
|
var object = this.getListActions(entry.content.items, this.getContentText(entry), entry.actions, entry.localState);
|
|
178
|
+
if (!!feedbackEntry) {
|
|
179
|
+
var feedbackObject = this.getListActions(feedbackEntry.content.items, this.getContentText(feedbackEntry), feedbackEntry.actions, feedbackEntry.localState);
|
|
180
|
+
return object.concat(feedbackObject);
|
|
181
|
+
}
|
|
182
182
|
return object;
|
|
183
183
|
};
|
|
184
184
|
EntryInterface.prototype.getContentText = function (entry) {
|
|
@@ -187,9 +187,9 @@ var EntryInterface = /** @class */ (function () {
|
|
|
187
187
|
if (entry.content.header)
|
|
188
188
|
return { title: entry.content.header };
|
|
189
189
|
};
|
|
190
|
-
EntryInterface.prototype.textTransform = function (entry) {
|
|
190
|
+
EntryInterface.prototype.textTransform = function (entry, feedbackEntry) {
|
|
191
191
|
if (!!entry.content.items)
|
|
192
|
-
return this.listTransform(entry);
|
|
192
|
+
return this.listTransform(entry, feedbackEntry);
|
|
193
193
|
return [
|
|
194
194
|
ConversationMessageListItemType.HTML,
|
|
195
195
|
{ body: entry.content.html.replace('\n', '') },
|
|
@@ -85,7 +85,7 @@ var ProcessorInterface = /** @class */ (function () {
|
|
|
85
85
|
return target.localState;
|
|
86
86
|
};
|
|
87
87
|
entries.forEach(function (entry) {
|
|
88
|
-
if (entry.relation) {
|
|
88
|
+
if (entry.relation && !entry.tags.find(function (o) { return o == 'gentle' || o == 'feedback'; })) {
|
|
89
89
|
var existingEntry = entries.find(function (o) { return o.id == entry.relation; });
|
|
90
90
|
if (existingEntry) {
|
|
91
91
|
var existingIndex = output.indexOf(existingEntry);
|
|
@@ -68,7 +68,7 @@ var ChatClient = /** @class */ (function () {
|
|
|
68
68
|
switch (_d.label) {
|
|
69
69
|
case 0:
|
|
70
70
|
try {
|
|
71
|
-
for (_a = __values(messages.filter(function (o) { return o && o != null; })), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
71
|
+
for (_a = __values(messages.filter(function (o) { return o && o != null && !!o.message; })), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
72
72
|
message = _b.value;
|
|
73
73
|
if (message.isUser)
|
|
74
74
|
this.postUserMessage(message);
|
|
@@ -6,7 +6,7 @@ export default class EntryInterface {
|
|
|
6
6
|
private helpActionKey;
|
|
7
7
|
private nextActionKey;
|
|
8
8
|
constructor(container: Container);
|
|
9
|
-
transform(entry: ServerEntry): Promise<Message | undefined>;
|
|
9
|
+
transform(entry: ServerEntry, feedbackEntry?: ServerEntry): Promise<Message | undefined>;
|
|
10
10
|
transformContactMethod(entry: ServerEntry): Promise<any>;
|
|
11
11
|
transformArray(entryArray: ServerEntry[]): Promise<Message[]>;
|
|
12
12
|
getUserMessage(action: string): string | undefined;
|
|
@@ -57,7 +57,7 @@ var EntryInterface = /** @class */ (function () {
|
|
|
57
57
|
this.nextActionKey = 'next';
|
|
58
58
|
}
|
|
59
59
|
// transform the entry based on its type
|
|
60
|
-
EntryInterface.prototype.transform = function (entry) {
|
|
60
|
+
EntryInterface.prototype.transform = function (entry, feedbackEntry) {
|
|
61
61
|
return __awaiter(this, void 0, void 0, function () {
|
|
62
62
|
var entryType, _a;
|
|
63
63
|
var _b;
|
|
@@ -69,38 +69,31 @@ var EntryInterface = /** @class */ (function () {
|
|
|
69
69
|
switch (_a) {
|
|
70
70
|
case ServerEntryTypeEnum.List: return [3 /*break*/, 1];
|
|
71
71
|
case ServerEntryTypeEnum.Text: return [3 /*break*/, 2];
|
|
72
|
-
case ServerEntryTypeEnum.
|
|
73
|
-
case ServerEntryTypeEnum.Contact: return [3 /*break*/, 4];
|
|
72
|
+
case ServerEntryTypeEnum.Contact: return [3 /*break*/, 3];
|
|
74
73
|
}
|
|
75
|
-
return [3 /*break*/,
|
|
74
|
+
return [3 /*break*/, 5];
|
|
76
75
|
case 1: return [2 /*return*/, {
|
|
77
76
|
id: entry.id,
|
|
78
|
-
message: this.listTransform(entry),
|
|
77
|
+
message: this.listTransform(entry, feedbackEntry),
|
|
79
78
|
entry: entry,
|
|
80
79
|
isUser: false,
|
|
81
80
|
}];
|
|
82
81
|
case 2: return [2 /*return*/, {
|
|
83
82
|
id: entry.id,
|
|
84
|
-
message: this.textTransform(entry),
|
|
83
|
+
message: this.textTransform(entry, feedbackEntry),
|
|
85
84
|
entry: entry,
|
|
86
85
|
isUser: false,
|
|
87
86
|
}];
|
|
88
|
-
case 3:
|
|
89
|
-
id: entry.id,
|
|
90
|
-
message: this.listTransform(entry),
|
|
91
|
-
entry: entry,
|
|
92
|
-
isUser: false,
|
|
93
|
-
}];
|
|
94
|
-
case 4:
|
|
87
|
+
case 3:
|
|
95
88
|
_b = {
|
|
96
89
|
id: entry.id
|
|
97
90
|
};
|
|
98
91
|
return [4 /*yield*/, this.transformContactMethod(entry)];
|
|
99
|
-
case
|
|
92
|
+
case 4: return [2 /*return*/, (_b.message = _c.sent(),
|
|
100
93
|
_b.entry = entry,
|
|
101
94
|
_b.isUser = false,
|
|
102
95
|
_b)];
|
|
103
|
-
case
|
|
96
|
+
case 5: return [2 /*return*/];
|
|
104
97
|
}
|
|
105
98
|
});
|
|
106
99
|
});
|
|
@@ -128,37 +121,40 @@ var EntryInterface = /** @class */ (function () {
|
|
|
128
121
|
// transform an array of entries
|
|
129
122
|
EntryInterface.prototype.transformArray = function (entryArray) {
|
|
130
123
|
return __awaiter(this, void 0, void 0, function () {
|
|
131
|
-
var returnArray,
|
|
132
|
-
var e_1,
|
|
133
|
-
return __generator(this, function (
|
|
134
|
-
switch (
|
|
124
|
+
var feedbackEntry, returnArray, _a, _b, o, x, e_1_1;
|
|
125
|
+
var e_1, _c;
|
|
126
|
+
return __generator(this, function (_d) {
|
|
127
|
+
switch (_d.label) {
|
|
135
128
|
case 0:
|
|
129
|
+
feedbackEntry = entryArray.find(function (o) {
|
|
130
|
+
return o.tags.find(function (t) { return t == 'gentle' || t == 'feedback'; });
|
|
131
|
+
});
|
|
136
132
|
returnArray = [];
|
|
137
|
-
|
|
133
|
+
_d.label = 1;
|
|
138
134
|
case 1:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
135
|
+
_d.trys.push([1, 6, 7, 8]);
|
|
136
|
+
_a = __values(entryArray.filter(function (t) { return t !== feedbackEntry; })), _b = _a.next();
|
|
137
|
+
_d.label = 2;
|
|
142
138
|
case 2:
|
|
143
|
-
if (!!
|
|
144
|
-
o =
|
|
145
|
-
return [4 /*yield*/, this.transform(o)];
|
|
139
|
+
if (!!_b.done) return [3 /*break*/, 5];
|
|
140
|
+
o = _b.value;
|
|
141
|
+
return [4 /*yield*/, this.transform(o, feedbackEntry)];
|
|
146
142
|
case 3:
|
|
147
|
-
x =
|
|
143
|
+
x = _d.sent();
|
|
148
144
|
if (!!x)
|
|
149
145
|
returnArray.push(x);
|
|
150
|
-
|
|
146
|
+
_d.label = 4;
|
|
151
147
|
case 4:
|
|
152
|
-
|
|
148
|
+
_b = _a.next();
|
|
153
149
|
return [3 /*break*/, 2];
|
|
154
150
|
case 5: return [3 /*break*/, 8];
|
|
155
151
|
case 6:
|
|
156
|
-
e_1_1 =
|
|
152
|
+
e_1_1 = _d.sent();
|
|
157
153
|
e_1 = { error: e_1_1 };
|
|
158
154
|
return [3 /*break*/, 8];
|
|
159
155
|
case 7:
|
|
160
156
|
try {
|
|
161
|
-
if (
|
|
157
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
162
158
|
}
|
|
163
159
|
finally { if (e_1) throw e_1.error; }
|
|
164
160
|
return [7 /*endfinally*/];
|
|
@@ -172,13 +168,17 @@ var EntryInterface = /** @class */ (function () {
|
|
|
172
168
|
var entry = StoreHelper.getEntry(action);
|
|
173
169
|
return this.getTitleFromEntry(entry, action);
|
|
174
170
|
};
|
|
175
|
-
EntryInterface.prototype.listTransform = function (entry) {
|
|
171
|
+
EntryInterface.prototype.listTransform = function (entry, feedbackEntry) {
|
|
176
172
|
if (entry.type === 'Contact') {
|
|
177
173
|
return;
|
|
178
174
|
}
|
|
179
175
|
if (!entry.content)
|
|
180
176
|
return;
|
|
181
177
|
var object = this.getListActions(entry.content.items, this.getContentText(entry), entry.actions, entry.localState);
|
|
178
|
+
if (!!feedbackEntry) {
|
|
179
|
+
var feedbackObject = this.getListActions(feedbackEntry.content.items, this.getContentText(feedbackEntry), feedbackEntry.actions, feedbackEntry.localState);
|
|
180
|
+
return object.concat(feedbackObject);
|
|
181
|
+
}
|
|
182
182
|
return object;
|
|
183
183
|
};
|
|
184
184
|
EntryInterface.prototype.getContentText = function (entry) {
|
|
@@ -187,9 +187,9 @@ var EntryInterface = /** @class */ (function () {
|
|
|
187
187
|
if (entry.content.header)
|
|
188
188
|
return { title: entry.content.header };
|
|
189
189
|
};
|
|
190
|
-
EntryInterface.prototype.textTransform = function (entry) {
|
|
190
|
+
EntryInterface.prototype.textTransform = function (entry, feedbackEntry) {
|
|
191
191
|
if (!!entry.content.items)
|
|
192
|
-
return this.listTransform(entry);
|
|
192
|
+
return this.listTransform(entry, feedbackEntry);
|
|
193
193
|
return [
|
|
194
194
|
ConversationMessageListItemType.HTML,
|
|
195
195
|
{ body: entry.content.html.replace('\n', '') },
|
|
@@ -85,7 +85,7 @@ var ProcessorInterface = /** @class */ (function () {
|
|
|
85
85
|
return target.localState;
|
|
86
86
|
};
|
|
87
87
|
entries.forEach(function (entry) {
|
|
88
|
-
if (entry.relation) {
|
|
88
|
+
if (entry.relation && !entry.tags.find(function (o) { return o == 'gentle' || o == 'feedback'; })) {
|
|
89
89
|
var existingEntry = entries.find(function (o) { return o.id == entry.relation; });
|
|
90
90
|
if (existingEntry) {
|
|
91
91
|
var existingIndex = output.indexOf(existingEntry);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/knowledge-widget-bot-provider",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.41",
|
|
4
4
|
"description": "Bot Provider Plugin ACE Knowledge Widgets.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"typings": "lib/index.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@telia-ace/knowledge-widget-adapters": "^1.0.
|
|
29
|
-
"@telia-ace/knowledge-widget-types-grid": "^1.0.
|
|
28
|
+
"@telia-ace/knowledge-widget-adapters": "^1.0.10",
|
|
29
|
+
"@telia-ace/knowledge-widget-types-grid": "^1.0.10",
|
|
30
30
|
"@telia-ace/knowledge-widget-ui": "^1.0.7",
|
|
31
|
-
"@telia-ace/widget-conversation": "^1.0.
|
|
31
|
+
"@telia-ace/widget-conversation": "^1.0.9",
|
|
32
32
|
"@telia-ace/widget-forms": "^1.0.6",
|
|
33
33
|
"@telia-ace/widget-services": "^1.0.4",
|
|
34
34
|
"@webprovisions/bootstrapping": "^1.0.12",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/uuid": "^8.3.4"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "733b97495cbc823d594ae31e687aeb05a660f195"
|
|
45
45
|
}
|