@telia-ace/knowledge-widget-bot-provider 0.0.1-alpha.16 → 0.0.1-alpha.17

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/plugin.js CHANGED
@@ -95,17 +95,20 @@ var ConversationPlugin = function (container) { return __awaiter(void 0, void 0,
95
95
  }
96
96
  });
97
97
  }); };
98
- execute = function (conversationComp) { return __awaiter(void 0, void 0, void 0, function () {
99
- var endpoint;
100
- var _a, _b, _c, _d;
101
- return __generator(this, function (_e) {
102
- endpoint = '';
103
- console.log('getting endpoint', conversationComp, (_b = (_a = conversationComp === null || conversationComp === void 0 ? void 0 : conversationComp.attributes) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.knowledgeBotEndpoint);
104
- // setTimeout(() => {
105
- if ((_d = (_c = conversationComp === null || conversationComp === void 0 ? void 0 : conversationComp.attributes) === null || _c === void 0 ? void 0 : _c.properties) === null || _d === void 0 ? void 0 : _d.knowledgeBotEndpoint) {
106
- endpoint = conversationComp.attributes.properties.knowledgeBotEndpoint;
107
- }
98
+ execute = function (endpoint) { return __awaiter(void 0, void 0, void 0, function () {
99
+ return __generator(this, function (_a) {
100
+ // let endpoint = '';
101
+ // console.log(
102
+ // 'getting endpoint',
103
+ // conversationComp,
104
+ // conversationComp?.attributes?.properties?.knowledgeBotEndpoint
105
+ // );
106
+ // // setTimeout(() => {
107
+ // if (conversationComp?.attributes?.properties?.knowledgeBotEndpoint) {
108
+ // endpoint = conversationComp.attributes.properties.knowledgeBotEndpoint;
109
+ // }
108
110
  // });
111
+ console.log('executing with endpoint', endpoint);
109
112
  platform.registerProvider('chat.bot', function (conversation, component) {
110
113
  var clientId = v4();
111
114
  registerCustomMessageComponent(container, 'ace-knowledge-contact-method', import('./contract/custom-component/contact-method'));
@@ -173,7 +176,7 @@ var ConversationPlugin = function (container) { return __awaiter(void 0, void 0,
173
176
  getConversationComponent().then(function (conversationComp) {
174
177
  if (conversationComp && (conversationComp === null || conversationComp === void 0 ? void 0 : conversationComp.attributes.properties.knowledgeBotEndpoint)) {
175
178
  console.log('execute on first');
176
- execute(conversationComp);
179
+ execute(conversationComp === null || conversationComp === void 0 ? void 0 : conversationComp.attributes.properties.knowledgeBotEndpoint);
177
180
  }
178
181
  else {
179
182
  events.subscribe('components:node-mounted', function (event, data) {
@@ -182,7 +185,7 @@ var ConversationPlugin = function (container) { return __awaiter(void 0, void 0,
182
185
  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)) {
183
186
  // const component = getConversationComponent();
184
187
  console.log('execute on event');
185
- execute(conversationComp);
188
+ execute(data.node.attributes.properties.knowledgeBotEndpoint);
186
189
  }
187
190
  });
188
191
  compPlatform.events.subscribe('components:properties-changed', function (event, data) {
@@ -190,7 +193,7 @@ var ConversationPlugin = function (container) { return __awaiter(void 0, void 0,
190
193
  console.log('component properties changed', data);
191
194
  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)) {
192
195
  console.log('conversation component property change', data);
193
- execute(conversationComp);
196
+ execute(data.node.attributes.properties.knowledgeBotEndpoint);
194
197
  }
195
198
  });
196
199
  }
package/lib-esm/plugin.js CHANGED
@@ -95,17 +95,20 @@ var ConversationPlugin = function (container) { return __awaiter(void 0, void 0,
95
95
  }
96
96
  });
97
97
  }); };
98
- execute = function (conversationComp) { return __awaiter(void 0, void 0, void 0, function () {
99
- var endpoint;
100
- var _a, _b, _c, _d;
101
- return __generator(this, function (_e) {
102
- endpoint = '';
103
- console.log('getting endpoint', conversationComp, (_b = (_a = conversationComp === null || conversationComp === void 0 ? void 0 : conversationComp.attributes) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.knowledgeBotEndpoint);
104
- // setTimeout(() => {
105
- if ((_d = (_c = conversationComp === null || conversationComp === void 0 ? void 0 : conversationComp.attributes) === null || _c === void 0 ? void 0 : _c.properties) === null || _d === void 0 ? void 0 : _d.knowledgeBotEndpoint) {
106
- endpoint = conversationComp.attributes.properties.knowledgeBotEndpoint;
107
- }
98
+ execute = function (endpoint) { return __awaiter(void 0, void 0, void 0, function () {
99
+ return __generator(this, function (_a) {
100
+ // let endpoint = '';
101
+ // console.log(
102
+ // 'getting endpoint',
103
+ // conversationComp,
104
+ // conversationComp?.attributes?.properties?.knowledgeBotEndpoint
105
+ // );
106
+ // // setTimeout(() => {
107
+ // if (conversationComp?.attributes?.properties?.knowledgeBotEndpoint) {
108
+ // endpoint = conversationComp.attributes.properties.knowledgeBotEndpoint;
109
+ // }
108
110
  // });
111
+ console.log('executing with endpoint', endpoint);
109
112
  platform.registerProvider('chat.bot', function (conversation, component) {
110
113
  var clientId = v4();
111
114
  registerCustomMessageComponent(container, 'ace-knowledge-contact-method', import('./contract/custom-component/contact-method'));
@@ -173,7 +176,7 @@ var ConversationPlugin = function (container) { return __awaiter(void 0, void 0,
173
176
  getConversationComponent().then(function (conversationComp) {
174
177
  if (conversationComp && (conversationComp === null || conversationComp === void 0 ? void 0 : conversationComp.attributes.properties.knowledgeBotEndpoint)) {
175
178
  console.log('execute on first');
176
- execute(conversationComp);
179
+ execute(conversationComp === null || conversationComp === void 0 ? void 0 : conversationComp.attributes.properties.knowledgeBotEndpoint);
177
180
  }
178
181
  else {
179
182
  events.subscribe('components:node-mounted', function (event, data) {
@@ -182,7 +185,7 @@ var ConversationPlugin = function (container) { return __awaiter(void 0, void 0,
182
185
  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)) {
183
186
  // const component = getConversationComponent();
184
187
  console.log('execute on event');
185
- execute(conversationComp);
188
+ execute(data.node.attributes.properties.knowledgeBotEndpoint);
186
189
  }
187
190
  });
188
191
  compPlatform.events.subscribe('components:properties-changed', function (event, data) {
@@ -190,7 +193,7 @@ var ConversationPlugin = function (container) { return __awaiter(void 0, void 0,
190
193
  console.log('component properties changed', data);
191
194
  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)) {
192
195
  console.log('conversation component property change', data);
193
- execute(conversationComp);
196
+ execute(data.node.attributes.properties.knowledgeBotEndpoint);
194
197
  }
195
198
  });
196
199
  }
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.16",
3
+ "version": "0.0.1-alpha.17",
4
4
  "description": "Bot Provider Plugin ACE Knowledge Widgets.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Telia Company AB",