@telia-ace/knowledge-widget-bot-provider 0.0.1-alpha.22 → 0.0.1-alpha.23
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.
|
@@ -23,6 +23,7 @@ var ContactMethod = function (props) {
|
|
|
23
23
|
type = DataType.ContactMethod;
|
|
24
24
|
methodList = props.contactMethods;
|
|
25
25
|
}
|
|
26
|
+
// TODO: ContactMethodItem should not be passed a list as contact method?
|
|
26
27
|
if (!methodList.length) {
|
|
27
28
|
return React.createElement(StyledContactMethodItem, { type: type, contactMethod: methodList });
|
|
28
29
|
}
|
package/lib/plugin.js
CHANGED
|
@@ -34,162 +34,99 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
34
34
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
38
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
39
|
-
if (!m) return o;
|
|
40
|
-
var i = m.call(o), r, ar = [], e;
|
|
41
|
-
try {
|
|
42
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
43
|
-
}
|
|
44
|
-
catch (error) { e = { error: error }; }
|
|
45
|
-
finally {
|
|
46
|
-
try {
|
|
47
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
48
|
-
}
|
|
49
|
-
finally { if (e) throw e.error; }
|
|
50
|
-
}
|
|
51
|
-
return ar;
|
|
52
|
-
};
|
|
53
37
|
import { ContactMethodPlatform } from '@humany/widget-adapters';
|
|
54
38
|
import { ConversationPlatform, registerCustomMessageComponent } from '@humany/widget-conversation';
|
|
55
|
-
import { ComponentPlatform } from '@humany/widget-core';
|
|
56
39
|
import { DataClient } from '@humany/widget-types-grid';
|
|
57
40
|
import { v4 } from 'uuid';
|
|
58
41
|
import ChatClient from './client/chat.client';
|
|
59
42
|
import { ContactMethodClient } from './client/contact-method.client';
|
|
60
43
|
import { HttpClient } from './client/http.client';
|
|
61
44
|
import MiddlewareClient from './client/middleware.client';
|
|
45
|
+
var getKnowledgeBotEndpoint = function (container, component /*: ComponentNodeController */
|
|
46
|
+
// ComponentNodeController type differs from component passed into registerProvider
|
|
47
|
+
) {
|
|
48
|
+
var knowledgeBotEndpoint = component.properties().knowledgeBotEndpoint;
|
|
49
|
+
if (knowledgeBotEndpoint) {
|
|
50
|
+
return knowledgeBotEndpoint + "/conversations";
|
|
51
|
+
}
|
|
52
|
+
var data = container.get('$settings').data;
|
|
53
|
+
if (!data || !data.projection)
|
|
54
|
+
throw new Error('Missing Knowledge Bot endpoint');
|
|
55
|
+
return data.projection + "/conversations";
|
|
56
|
+
};
|
|
62
57
|
var KnowledgeBotProviderPlugin = function (container) { return __awaiter(void 0, void 0, void 0, function () {
|
|
63
|
-
var
|
|
58
|
+
var dataClient, platform, contactMethodPlatform;
|
|
64
59
|
return __generator(this, function (_a) {
|
|
65
60
|
switch (_a.label) {
|
|
66
|
-
case 0:
|
|
67
|
-
providerRegistered = false;
|
|
68
|
-
return [4 /*yield*/, ComponentPlatform.getInstance(container)];
|
|
61
|
+
case 0: return [4 /*yield*/, DataClient.getInstance(container)];
|
|
69
62
|
case 1:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
63
|
+
dataClient = _a.sent();
|
|
64
|
+
return [4 /*yield*/, ConversationPlatform.getInstance(container)];
|
|
65
|
+
case 2:
|
|
66
|
+
platform = _a.sent();
|
|
67
|
+
return [4 /*yield*/, ContactMethodPlatform.getInstance(container)];
|
|
68
|
+
case 3:
|
|
69
|
+
contactMethodPlatform = _a.sent();
|
|
70
|
+
registerCustomMessageComponent(container, 'ace-knowledge-contact-method', import('./contract/custom-component/contact-method'));
|
|
71
|
+
platform.registerProvider('chat.bot', function (conversation, component) {
|
|
72
|
+
var endpoint = getKnowledgeBotEndpoint(container, component);
|
|
73
|
+
var clientId = v4();
|
|
74
|
+
var agent = conversation.createAgent({
|
|
75
|
+
// TODO: needs to be fixed asap
|
|
76
|
+
name: 'John Doe',
|
|
77
|
+
avatar: 'https://www.site.com/avatar.jpg',
|
|
85
78
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return next(input);
|
|
133
|
-
});
|
|
134
|
-
component.actions.watch('conversation.user-submit', function (input, next) {
|
|
135
|
-
var httpClient = new HttpClient(endpoint, clientId);
|
|
136
|
-
httpClient.handlePhrase(input.text);
|
|
137
|
-
return next(input);
|
|
138
|
-
});
|
|
139
|
-
component.actions.watch('conversation.form', function (input, next) {
|
|
140
|
-
return next(input);
|
|
141
|
-
});
|
|
142
|
-
component.actions.watch('conversation.action', function (input, next) {
|
|
143
|
-
var chatClient = new ChatClient();
|
|
144
|
-
var cmClient = new ContactMethodClient();
|
|
145
|
-
if (input === 'contact' || input.split('/').length > 1) {
|
|
146
|
-
cmClient.handleContactMethod(input);
|
|
147
|
-
return next(input);
|
|
148
|
-
}
|
|
149
|
-
var middlewareClient = new MiddlewareClient();
|
|
150
|
-
var httpClient = new HttpClient(endpoint, clientId);
|
|
151
|
-
// this is an update check, as it requires
|
|
152
|
-
// a lot different logic and no user message
|
|
153
|
-
if (middlewareClient.checkForUpdate(input)) {
|
|
154
|
-
httpClient.handleUpdate(input);
|
|
155
|
-
return next(input);
|
|
156
|
-
}
|
|
157
|
-
chatClient.printUserMessageAndStoreIt(input);
|
|
158
|
-
httpClient.handleInput(input);
|
|
159
|
-
return next(input);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
return [2 /*return*/];
|
|
79
|
+
// passes the user and the agent to the Chat Helper
|
|
80
|
+
ChatClient.initialize(conversation.user, agent);
|
|
81
|
+
// passes the conversation provider to the Contact Method Client
|
|
82
|
+
ContactMethodClient.initialize(dataClient, contactMethodPlatform, agent);
|
|
83
|
+
// passes the container and the widget to the Middleware Store
|
|
84
|
+
MiddlewareClient.initialize(container, container.get('$widget'));
|
|
85
|
+
// executes to decide on what to do on first load
|
|
86
|
+
var httpClient = new HttpClient(endpoint, clientId);
|
|
87
|
+
httpClient.firstHit();
|
|
88
|
+
component.actions.create('evaluate', function (input) {
|
|
89
|
+
var cmClient = new ContactMethodClient();
|
|
90
|
+
cmClient.handleNewForm(input.form, input.form.id);
|
|
91
|
+
});
|
|
92
|
+
component.actions.create('validate', function (input) {
|
|
93
|
+
var cmClient = new ContactMethodClient();
|
|
94
|
+
cmClient.validate(input.form);
|
|
95
|
+
});
|
|
96
|
+
component.actions.create('submit', function (input) {
|
|
97
|
+
var cmClient = new ContactMethodClient();
|
|
98
|
+
cmClient.validate(input.form);
|
|
99
|
+
});
|
|
100
|
+
component.actions.watch('conversation.user-typing', function (input, next) {
|
|
101
|
+
return next(input);
|
|
102
|
+
});
|
|
103
|
+
component.actions.watch('conversation.user-submit', function (input, next) {
|
|
104
|
+
var httpClient = new HttpClient(endpoint, clientId);
|
|
105
|
+
httpClient.handlePhrase(input.text);
|
|
106
|
+
return next(input);
|
|
107
|
+
});
|
|
108
|
+
component.actions.watch('conversation.form', function (input, next) {
|
|
109
|
+
return next(input);
|
|
110
|
+
});
|
|
111
|
+
component.actions.watch('conversation.action', function (input, next) {
|
|
112
|
+
var chatClient = new ChatClient();
|
|
113
|
+
var cmClient = new ContactMethodClient();
|
|
114
|
+
if (input === 'contact' || input.split('/').length > 1) {
|
|
115
|
+
cmClient.handleContactMethod(input);
|
|
116
|
+
return next(input);
|
|
117
|
+
}
|
|
118
|
+
var middlewareClient = new MiddlewareClient();
|
|
119
|
+
var httpClient = new HttpClient(endpoint, clientId);
|
|
120
|
+
// this is an update check, as it requires
|
|
121
|
+
// a lot different logic and no user message
|
|
122
|
+
if (middlewareClient.checkForUpdate(input)) {
|
|
123
|
+
httpClient.handleUpdate(input);
|
|
124
|
+
return next(input);
|
|
163
125
|
}
|
|
126
|
+
chatClient.printUserMessageAndStoreIt(input);
|
|
127
|
+
httpClient.handleInput(input);
|
|
128
|
+
return next(input);
|
|
164
129
|
});
|
|
165
|
-
}); };
|
|
166
|
-
getConversationComponent().then(function (conversationComp) {
|
|
167
|
-
if (conversationComp && (conversationComp === null || conversationComp === void 0 ? void 0 : conversationComp.attributes.properties.knowledgeBotEndpoint)) {
|
|
168
|
-
execute(conversationComp === null || conversationComp === void 0 ? void 0 : conversationComp.attributes.properties.knowledgeBotEndpoint);
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
// const { events } = container.get('$widget') as Widget;
|
|
172
|
-
// events.subscribe('components:node-mounted', (event, data) => {
|
|
173
|
-
// if (providerRegistered) {
|
|
174
|
-
// return;
|
|
175
|
-
// }
|
|
176
|
-
// if (
|
|
177
|
-
// data.node?.type === 'conversation' &&
|
|
178
|
-
// data.node?.attributes.properties.knowledgeBotEndpoint
|
|
179
|
-
// ) {
|
|
180
|
-
// execute(data.node.attributes.properties.knowledgeBotEndpoint);
|
|
181
|
-
// }
|
|
182
|
-
// });
|
|
183
|
-
componentPlatform.events.subscribe('components:properties-changed', function (event, data) {
|
|
184
|
-
var _a, _b;
|
|
185
|
-
if (providerRegistered) {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
if (((_a = data.node) === null || _a === void 0 ? void 0 : _a.type) === 'conversation' && ((_b = data.node) === null || _b === void 0 ? void 0 : _b.attributes.properties.knowledgeBotEndpoint)) {
|
|
189
|
-
execute(data.node.attributes.properties.knowledgeBotEndpoint);
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
130
|
});
|
|
194
131
|
return [2 /*return*/];
|
|
195
132
|
}
|
|
@@ -23,6 +23,7 @@ var ContactMethod = function (props) {
|
|
|
23
23
|
type = DataType.ContactMethod;
|
|
24
24
|
methodList = props.contactMethods;
|
|
25
25
|
}
|
|
26
|
+
// TODO: ContactMethodItem should not be passed a list as contact method?
|
|
26
27
|
if (!methodList.length) {
|
|
27
28
|
return React.createElement(StyledContactMethodItem, { type: type, contactMethod: methodList });
|
|
28
29
|
}
|
package/lib-esm/plugin.js
CHANGED
|
@@ -34,162 +34,99 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
34
34
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
38
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
39
|
-
if (!m) return o;
|
|
40
|
-
var i = m.call(o), r, ar = [], e;
|
|
41
|
-
try {
|
|
42
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
43
|
-
}
|
|
44
|
-
catch (error) { e = { error: error }; }
|
|
45
|
-
finally {
|
|
46
|
-
try {
|
|
47
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
48
|
-
}
|
|
49
|
-
finally { if (e) throw e.error; }
|
|
50
|
-
}
|
|
51
|
-
return ar;
|
|
52
|
-
};
|
|
53
37
|
import { ContactMethodPlatform } from '@humany/widget-adapters';
|
|
54
38
|
import { ConversationPlatform, registerCustomMessageComponent } from '@humany/widget-conversation';
|
|
55
|
-
import { ComponentPlatform } from '@humany/widget-core';
|
|
56
39
|
import { DataClient } from '@humany/widget-types-grid';
|
|
57
40
|
import { v4 } from 'uuid';
|
|
58
41
|
import ChatClient from './client/chat.client';
|
|
59
42
|
import { ContactMethodClient } from './client/contact-method.client';
|
|
60
43
|
import { HttpClient } from './client/http.client';
|
|
61
44
|
import MiddlewareClient from './client/middleware.client';
|
|
45
|
+
var getKnowledgeBotEndpoint = function (container, component /*: ComponentNodeController */
|
|
46
|
+
// ComponentNodeController type differs from component passed into registerProvider
|
|
47
|
+
) {
|
|
48
|
+
var knowledgeBotEndpoint = component.properties().knowledgeBotEndpoint;
|
|
49
|
+
if (knowledgeBotEndpoint) {
|
|
50
|
+
return knowledgeBotEndpoint + "/conversations";
|
|
51
|
+
}
|
|
52
|
+
var data = container.get('$settings').data;
|
|
53
|
+
if (!data || !data.projection)
|
|
54
|
+
throw new Error('Missing Knowledge Bot endpoint');
|
|
55
|
+
return data.projection + "/conversations";
|
|
56
|
+
};
|
|
62
57
|
var KnowledgeBotProviderPlugin = function (container) { return __awaiter(void 0, void 0, void 0, function () {
|
|
63
|
-
var
|
|
58
|
+
var dataClient, platform, contactMethodPlatform;
|
|
64
59
|
return __generator(this, function (_a) {
|
|
65
60
|
switch (_a.label) {
|
|
66
|
-
case 0:
|
|
67
|
-
providerRegistered = false;
|
|
68
|
-
return [4 /*yield*/, ComponentPlatform.getInstance(container)];
|
|
61
|
+
case 0: return [4 /*yield*/, DataClient.getInstance(container)];
|
|
69
62
|
case 1:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
63
|
+
dataClient = _a.sent();
|
|
64
|
+
return [4 /*yield*/, ConversationPlatform.getInstance(container)];
|
|
65
|
+
case 2:
|
|
66
|
+
platform = _a.sent();
|
|
67
|
+
return [4 /*yield*/, ContactMethodPlatform.getInstance(container)];
|
|
68
|
+
case 3:
|
|
69
|
+
contactMethodPlatform = _a.sent();
|
|
70
|
+
registerCustomMessageComponent(container, 'ace-knowledge-contact-method', import('./contract/custom-component/contact-method'));
|
|
71
|
+
platform.registerProvider('chat.bot', function (conversation, component) {
|
|
72
|
+
var endpoint = getKnowledgeBotEndpoint(container, component);
|
|
73
|
+
var clientId = v4();
|
|
74
|
+
var agent = conversation.createAgent({
|
|
75
|
+
// TODO: needs to be fixed asap
|
|
76
|
+
name: 'John Doe',
|
|
77
|
+
avatar: 'https://www.site.com/avatar.jpg',
|
|
85
78
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return next(input);
|
|
133
|
-
});
|
|
134
|
-
component.actions.watch('conversation.user-submit', function (input, next) {
|
|
135
|
-
var httpClient = new HttpClient(endpoint, clientId);
|
|
136
|
-
httpClient.handlePhrase(input.text);
|
|
137
|
-
return next(input);
|
|
138
|
-
});
|
|
139
|
-
component.actions.watch('conversation.form', function (input, next) {
|
|
140
|
-
return next(input);
|
|
141
|
-
});
|
|
142
|
-
component.actions.watch('conversation.action', function (input, next) {
|
|
143
|
-
var chatClient = new ChatClient();
|
|
144
|
-
var cmClient = new ContactMethodClient();
|
|
145
|
-
if (input === 'contact' || input.split('/').length > 1) {
|
|
146
|
-
cmClient.handleContactMethod(input);
|
|
147
|
-
return next(input);
|
|
148
|
-
}
|
|
149
|
-
var middlewareClient = new MiddlewareClient();
|
|
150
|
-
var httpClient = new HttpClient(endpoint, clientId);
|
|
151
|
-
// this is an update check, as it requires
|
|
152
|
-
// a lot different logic and no user message
|
|
153
|
-
if (middlewareClient.checkForUpdate(input)) {
|
|
154
|
-
httpClient.handleUpdate(input);
|
|
155
|
-
return next(input);
|
|
156
|
-
}
|
|
157
|
-
chatClient.printUserMessageAndStoreIt(input);
|
|
158
|
-
httpClient.handleInput(input);
|
|
159
|
-
return next(input);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
return [2 /*return*/];
|
|
79
|
+
// passes the user and the agent to the Chat Helper
|
|
80
|
+
ChatClient.initialize(conversation.user, agent);
|
|
81
|
+
// passes the conversation provider to the Contact Method Client
|
|
82
|
+
ContactMethodClient.initialize(dataClient, contactMethodPlatform, agent);
|
|
83
|
+
// passes the container and the widget to the Middleware Store
|
|
84
|
+
MiddlewareClient.initialize(container, container.get('$widget'));
|
|
85
|
+
// executes to decide on what to do on first load
|
|
86
|
+
var httpClient = new HttpClient(endpoint, clientId);
|
|
87
|
+
httpClient.firstHit();
|
|
88
|
+
component.actions.create('evaluate', function (input) {
|
|
89
|
+
var cmClient = new ContactMethodClient();
|
|
90
|
+
cmClient.handleNewForm(input.form, input.form.id);
|
|
91
|
+
});
|
|
92
|
+
component.actions.create('validate', function (input) {
|
|
93
|
+
var cmClient = new ContactMethodClient();
|
|
94
|
+
cmClient.validate(input.form);
|
|
95
|
+
});
|
|
96
|
+
component.actions.create('submit', function (input) {
|
|
97
|
+
var cmClient = new ContactMethodClient();
|
|
98
|
+
cmClient.validate(input.form);
|
|
99
|
+
});
|
|
100
|
+
component.actions.watch('conversation.user-typing', function (input, next) {
|
|
101
|
+
return next(input);
|
|
102
|
+
});
|
|
103
|
+
component.actions.watch('conversation.user-submit', function (input, next) {
|
|
104
|
+
var httpClient = new HttpClient(endpoint, clientId);
|
|
105
|
+
httpClient.handlePhrase(input.text);
|
|
106
|
+
return next(input);
|
|
107
|
+
});
|
|
108
|
+
component.actions.watch('conversation.form', function (input, next) {
|
|
109
|
+
return next(input);
|
|
110
|
+
});
|
|
111
|
+
component.actions.watch('conversation.action', function (input, next) {
|
|
112
|
+
var chatClient = new ChatClient();
|
|
113
|
+
var cmClient = new ContactMethodClient();
|
|
114
|
+
if (input === 'contact' || input.split('/').length > 1) {
|
|
115
|
+
cmClient.handleContactMethod(input);
|
|
116
|
+
return next(input);
|
|
117
|
+
}
|
|
118
|
+
var middlewareClient = new MiddlewareClient();
|
|
119
|
+
var httpClient = new HttpClient(endpoint, clientId);
|
|
120
|
+
// this is an update check, as it requires
|
|
121
|
+
// a lot different logic and no user message
|
|
122
|
+
if (middlewareClient.checkForUpdate(input)) {
|
|
123
|
+
httpClient.handleUpdate(input);
|
|
124
|
+
return next(input);
|
|
163
125
|
}
|
|
126
|
+
chatClient.printUserMessageAndStoreIt(input);
|
|
127
|
+
httpClient.handleInput(input);
|
|
128
|
+
return next(input);
|
|
164
129
|
});
|
|
165
|
-
}); };
|
|
166
|
-
getConversationComponent().then(function (conversationComp) {
|
|
167
|
-
if (conversationComp && (conversationComp === null || conversationComp === void 0 ? void 0 : conversationComp.attributes.properties.knowledgeBotEndpoint)) {
|
|
168
|
-
execute(conversationComp === null || conversationComp === void 0 ? void 0 : conversationComp.attributes.properties.knowledgeBotEndpoint);
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
// const { events } = container.get('$widget') as Widget;
|
|
172
|
-
// events.subscribe('components:node-mounted', (event, data) => {
|
|
173
|
-
// if (providerRegistered) {
|
|
174
|
-
// return;
|
|
175
|
-
// }
|
|
176
|
-
// if (
|
|
177
|
-
// data.node?.type === 'conversation' &&
|
|
178
|
-
// data.node?.attributes.properties.knowledgeBotEndpoint
|
|
179
|
-
// ) {
|
|
180
|
-
// execute(data.node.attributes.properties.knowledgeBotEndpoint);
|
|
181
|
-
// }
|
|
182
|
-
// });
|
|
183
|
-
componentPlatform.events.subscribe('components:properties-changed', function (event, data) {
|
|
184
|
-
var _a, _b;
|
|
185
|
-
if (providerRegistered) {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
if (((_a = data.node) === null || _a === void 0 ? void 0 : _a.type) === 'conversation' && ((_b = data.node) === null || _b === void 0 ? void 0 : _b.attributes.properties.knowledgeBotEndpoint)) {
|
|
189
|
-
execute(data.node.attributes.properties.knowledgeBotEndpoint);
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
130
|
});
|
|
194
131
|
return [2 /*return*/];
|
|
195
132
|
}
|
package/package.json
CHANGED