@botonic/plugin-hubtype-analytics 0.23.0 → 0.23.1-alpha.0

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.
@@ -6,7 +6,7 @@ class HtEventAgentRating extends ht_event_1.HtEvent {
6
6
  constructor(event, requestData) {
7
7
  super(event, requestData);
8
8
  this.event_data.rating = event.event_data.rating;
9
- this.event_data.commnent = event.event_data.commnent;
9
+ this.event_data.comment = event.event_data.comment;
10
10
  this.event_data.case_id = event.event_data.case_id;
11
11
  }
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ht-event-agent-rating.js","sourceRoot":"","sources":["../../../src/event-models/ht-event-agent-rating.ts"],"names":[],"mappings":";;;AAMA,yCAAoC;AAEpC,MAAa,kBAAmB,SAAQ,kBAAO;IAG7C,YAAY,KAAuB,EAAE,WAAwB;QAC3D,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;QACzB,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAA;QAChD,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAA;QACpD,IAAI,CAAC,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,CAAA;IACpD,CAAC;CACF;AATD,gDASC"}
1
+ {"version":3,"file":"ht-event-agent-rating.js","sourceRoot":"","sources":["../../../src/event-models/ht-event-agent-rating.ts"],"names":[],"mappings":";;;AAMA,yCAAoC;AAEpC,MAAa,kBAAmB,SAAQ,kBAAO;IAG7C,YAAY,KAAuB,EAAE,WAAwB;QAC3D,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;QACzB,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAA;QAChD,IAAI,CAAC,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,CAAA;QAClD,IAAI,CAAC,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,CAAA;IACpD,CAAC;CACF;AATD,gDASC"}
@@ -0,0 +1,6 @@
1
+ import { BaseEventData, EventBotAiKnowladgeBase, EventDataBotAiKnowladgeBase, RequestData } from '../types';
2
+ import { HtEvent } from './ht-event';
3
+ export declare class HtEventBotAiKnowledgeBase extends HtEvent {
4
+ event_data: BaseEventData & EventDataBotAiKnowladgeBase;
5
+ constructor(event: EventBotAiKnowladgeBase, requestData: RequestData);
6
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HtEventBotAiKnowledgeBase = void 0;
4
+ const ht_event_1 = require("./ht-event");
5
+ class HtEventBotAiKnowledgeBase extends ht_event_1.HtEvent {
6
+ constructor(event, requestData) {
7
+ super(event, requestData);
8
+ this.event_data.answer = event.event_data.answer;
9
+ this.event_data.knowledge_source_ids = event.event_data.knowledge_source_ids;
10
+ }
11
+ }
12
+ exports.HtEventBotAiKnowledgeBase = HtEventBotAiKnowledgeBase;
13
+ //# sourceMappingURL=ht-event-bot-knowladge-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ht-event-bot-knowladge-base.js","sourceRoot":"","sources":["../../../src/event-models/ht-event-bot-knowladge-base.ts"],"names":[],"mappings":";;;AAMA,yCAAoC;AAEpC,MAAa,yBAA0B,SAAQ,kBAAO;IAGpD,YAAY,KAA8B,EAAE,WAAwB;QAClE,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;QACzB,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAA;QAChD,IAAI,CAAC,UAAU,CAAC,oBAAoB,GAAG,KAAK,CAAC,UAAU,CAAC,oBAAoB,CAAA;IAC9E,CAAC;CACF;AARD,8DAQC"}
@@ -1,12 +1,12 @@
1
1
  import { BotRequest, Plugin } from '@botonic/core';
2
2
  import { HtEventProps, RequestData } from './types';
3
3
  export interface HubtypeAnalyticsOptions {
4
- getLaguange?: (request: BotRequest) => string;
4
+ getLanguage?: (request: BotRequest) => string;
5
5
  getCountry?: (request: BotRequest) => string;
6
6
  }
7
7
  export default class BotonicPluginHubtypeAnalytics implements Plugin {
8
8
  baseUrl: string;
9
- getLaguange: (request: BotRequest) => string;
9
+ getLanguage: (request: BotRequest) => string;
10
10
  getCountry: (request: BotRequest) => string;
11
11
  constructor(options?: HubtypeAnalyticsOptions);
12
12
  post(): void;
package/lib/cjs/index.js CHANGED
@@ -12,7 +12,7 @@ function getDefaultCountry(request) {
12
12
  class BotonicPluginHubtypeAnalytics {
13
13
  constructor(options) {
14
14
  this.baseUrl = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com';
15
- this.getLaguange = (options === null || options === void 0 ? void 0 : options.getLaguange) || getDefaultLanguage;
15
+ this.getLanguage = (options === null || options === void 0 ? void 0 : options.getLanguage) || getDefaultLanguage;
16
16
  this.getCountry = (options === null || options === void 0 ? void 0 : options.getCountry) || getDefaultCountry;
17
17
  }
18
18
  post() {
@@ -23,7 +23,7 @@ class BotonicPluginHubtypeAnalytics {
23
23
  }
24
24
  getRequestData(request) {
25
25
  return {
26
- language: this.getLaguange(request),
26
+ language: this.getLanguage(request),
27
27
  country: this.getCountry(request),
28
28
  provider: request.session.user.provider,
29
29
  userId: request.session.user.id,
@@ -13,6 +13,7 @@ export declare enum EventName {
13
13
  botStart = "bot_start",
14
14
  botOpen = "bot_open",
15
15
  botAiModel = "bot_ai_model",
16
+ botAiKnowladgeBase = "bot_ai_knowledge_base",
16
17
  botKeywordsModel = "bot_keywords_model",
17
18
  fallback = "fallback",
18
19
  handoffOption = "handoff_option",
@@ -38,7 +39,7 @@ export interface EventAgentRating extends HtBaseEventProps {
38
39
  export interface EventDataRating {
39
40
  case_id: string;
40
41
  rating?: number;
41
- commnent?: string;
42
+ comment?: string;
42
43
  }
43
44
  export interface EventChannelRating extends HtBaseEventProps {
44
45
  event_type: EventName.botChannelRating;
@@ -86,6 +87,14 @@ export interface EventDataBotAiModel {
86
87
  confidence: number;
87
88
  confidence_successful: boolean;
88
89
  }
90
+ export interface EventBotAiKnowladgeBase {
91
+ event_type: EventName.botAiKnowladgeBase;
92
+ event_data: EventDataBotAiKnowladgeBase;
93
+ }
94
+ export interface EventDataBotAiKnowladgeBase {
95
+ answer: string;
96
+ knowledge_source_ids: string[];
97
+ }
89
98
  export interface EventBotKeywordModel extends HtBaseEventProps {
90
99
  event_type: EventName.botKeywordsModel;
91
100
  event_data: EventDataBotKeywordModel;
@@ -113,7 +122,7 @@ export interface EventDataHandoff {
113
122
  available_agents: boolean;
114
123
  threshold_reached: boolean;
115
124
  }
116
- export type HtEventProps = EventAgentRating | EventChannelRating | EventFaqUseful | EventBotRating | EventBotFaq | EventBotStart | EventBotOpen | EventBotAiModel | EventBotKeywordModel | EventFallback | EventHandoffOption | EventHandoffSuccess | EventHandoffFail;
125
+ export type HtEventProps = EventAgentRating | EventChannelRating | EventFaqUseful | EventBotRating | EventBotFaq | EventBotStart | EventBotOpen | EventBotAiModel | EventBotAiKnowladgeBase | EventBotKeywordModel | EventFallback | EventHandoffOption | EventHandoffSuccess | EventHandoffFail;
117
126
  export interface RequestData {
118
127
  language: string;
119
128
  country: string;
package/lib/cjs/types.js CHANGED
@@ -11,6 +11,7 @@ var EventName;
11
11
  EventName["botStart"] = "bot_start";
12
12
  EventName["botOpen"] = "bot_open";
13
13
  EventName["botAiModel"] = "bot_ai_model";
14
+ EventName["botAiKnowladgeBase"] = "bot_ai_knowledge_base";
14
15
  EventName["botKeywordsModel"] = "bot_keywords_model";
15
16
  EventName["fallback"] = "fallback";
16
17
  EventName["handoffOption"] = "handoff_option";
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAQA,IAAY,SAcX;AAdD,WAAY,SAAS;IACnB,gDAAmC,CAAA;IACnC,oDAAuC,CAAA;IACvC,4CAA+B,CAAA;IAC/B,qCAAwB,CAAA;IACxB,+BAAkB,CAAA;IAClB,mCAAsB,CAAA;IACtB,iCAAoB,CAAA;IACpB,wCAA2B,CAAA;IAC3B,oDAAuC,CAAA;IACvC,kCAAqB,CAAA;IACrB,6CAAgC,CAAA;IAChC,+CAAkC,CAAA;IAClC,yCAA4B,CAAA;AAC9B,CAAC,EAdW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAcpB"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAQA,IAAY,SAeX;AAfD,WAAY,SAAS;IACnB,gDAAmC,CAAA;IACnC,oDAAuC,CAAA;IACvC,4CAA+B,CAAA;IAC/B,qCAAwB,CAAA;IACxB,+BAAkB,CAAA;IAClB,mCAAsB,CAAA;IACtB,iCAAoB,CAAA;IACpB,wCAA2B,CAAA;IAC3B,yDAA4C,CAAA;IAC5C,oDAAuC,CAAA;IACvC,kCAAqB,CAAA;IACrB,6CAAgC,CAAA;IAChC,+CAAkC,CAAA;IAClC,yCAA4B,CAAA;AAC9B,CAAC,EAfW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAepB"}
@@ -3,7 +3,7 @@ export class HtEventAgentRating extends HtEvent {
3
3
  constructor(event, requestData) {
4
4
  super(event, requestData);
5
5
  this.event_data.rating = event.event_data.rating;
6
- this.event_data.commnent = event.event_data.commnent;
6
+ this.event_data.comment = event.event_data.comment;
7
7
  this.event_data.case_id = event.event_data.case_id;
8
8
  }
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ht-event-agent-rating.js","sourceRoot":"","sources":["../../../src/event-models/ht-event-agent-rating.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC,MAAM,OAAO,kBAAmB,SAAQ,OAAO;IAG7C,YAAY,KAAuB,EAAE,WAAwB;QAC3D,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;QACzB,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAA;QAChD,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAA;QACpD,IAAI,CAAC,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,CAAA;IACpD,CAAC;CACF"}
1
+ {"version":3,"file":"ht-event-agent-rating.js","sourceRoot":"","sources":["../../../src/event-models/ht-event-agent-rating.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC,MAAM,OAAO,kBAAmB,SAAQ,OAAO;IAG7C,YAAY,KAAuB,EAAE,WAAwB;QAC3D,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;QACzB,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAA;QAChD,IAAI,CAAC,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,CAAA;QAClD,IAAI,CAAC,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,CAAA;IACpD,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ import { BaseEventData, EventBotAiKnowladgeBase, EventDataBotAiKnowladgeBase, RequestData } from '../types';
2
+ import { HtEvent } from './ht-event';
3
+ export declare class HtEventBotAiKnowledgeBase extends HtEvent {
4
+ event_data: BaseEventData & EventDataBotAiKnowladgeBase;
5
+ constructor(event: EventBotAiKnowladgeBase, requestData: RequestData);
6
+ }
@@ -0,0 +1,9 @@
1
+ import { HtEvent } from './ht-event';
2
+ export class HtEventBotAiKnowledgeBase extends HtEvent {
3
+ constructor(event, requestData) {
4
+ super(event, requestData);
5
+ this.event_data.answer = event.event_data.answer;
6
+ this.event_data.knowledge_source_ids = event.event_data.knowledge_source_ids;
7
+ }
8
+ }
9
+ //# sourceMappingURL=ht-event-bot-knowladge-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ht-event-bot-knowladge-base.js","sourceRoot":"","sources":["../../../src/event-models/ht-event-bot-knowladge-base.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC,MAAM,OAAO,yBAA0B,SAAQ,OAAO;IAGpD,YAAY,KAA8B,EAAE,WAAwB;QAClE,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;QACzB,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAA;QAChD,IAAI,CAAC,UAAU,CAAC,oBAAoB,GAAG,KAAK,CAAC,UAAU,CAAC,oBAAoB,CAAA;IAC9E,CAAC;CACF"}
@@ -1,12 +1,12 @@
1
1
  import { BotRequest, Plugin } from '@botonic/core';
2
2
  import { HtEventProps, RequestData } from './types';
3
3
  export interface HubtypeAnalyticsOptions {
4
- getLaguange?: (request: BotRequest) => string;
4
+ getLanguage?: (request: BotRequest) => string;
5
5
  getCountry?: (request: BotRequest) => string;
6
6
  }
7
7
  export default class BotonicPluginHubtypeAnalytics implements Plugin {
8
8
  baseUrl: string;
9
- getLaguange: (request: BotRequest) => string;
9
+ getLanguage: (request: BotRequest) => string;
10
10
  getCountry: (request: BotRequest) => string;
11
11
  constructor(options?: HubtypeAnalyticsOptions);
12
12
  post(): void;
package/lib/esm/index.js CHANGED
@@ -9,7 +9,7 @@ function getDefaultCountry(request) {
9
9
  export default class BotonicPluginHubtypeAnalytics {
10
10
  constructor(options) {
11
11
  this.baseUrl = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com';
12
- this.getLaguange = (options === null || options === void 0 ? void 0 : options.getLaguange) || getDefaultLanguage;
12
+ this.getLanguage = (options === null || options === void 0 ? void 0 : options.getLanguage) || getDefaultLanguage;
13
13
  this.getCountry = (options === null || options === void 0 ? void 0 : options.getCountry) || getDefaultCountry;
14
14
  }
15
15
  post() {
@@ -20,7 +20,7 @@ export default class BotonicPluginHubtypeAnalytics {
20
20
  }
21
21
  getRequestData(request) {
22
22
  return {
23
- language: this.getLaguange(request),
23
+ language: this.getLanguage(request),
24
24
  country: this.getCountry(request),
25
25
  provider: request.session.user.provider,
26
26
  userId: request.session.user.id,
@@ -13,6 +13,7 @@ export declare enum EventName {
13
13
  botStart = "bot_start",
14
14
  botOpen = "bot_open",
15
15
  botAiModel = "bot_ai_model",
16
+ botAiKnowladgeBase = "bot_ai_knowledge_base",
16
17
  botKeywordsModel = "bot_keywords_model",
17
18
  fallback = "fallback",
18
19
  handoffOption = "handoff_option",
@@ -38,7 +39,7 @@ export interface EventAgentRating extends HtBaseEventProps {
38
39
  export interface EventDataRating {
39
40
  case_id: string;
40
41
  rating?: number;
41
- commnent?: string;
42
+ comment?: string;
42
43
  }
43
44
  export interface EventChannelRating extends HtBaseEventProps {
44
45
  event_type: EventName.botChannelRating;
@@ -86,6 +87,14 @@ export interface EventDataBotAiModel {
86
87
  confidence: number;
87
88
  confidence_successful: boolean;
88
89
  }
90
+ export interface EventBotAiKnowladgeBase {
91
+ event_type: EventName.botAiKnowladgeBase;
92
+ event_data: EventDataBotAiKnowladgeBase;
93
+ }
94
+ export interface EventDataBotAiKnowladgeBase {
95
+ answer: string;
96
+ knowledge_source_ids: string[];
97
+ }
89
98
  export interface EventBotKeywordModel extends HtBaseEventProps {
90
99
  event_type: EventName.botKeywordsModel;
91
100
  event_data: EventDataBotKeywordModel;
@@ -113,7 +122,7 @@ export interface EventDataHandoff {
113
122
  available_agents: boolean;
114
123
  threshold_reached: boolean;
115
124
  }
116
- export type HtEventProps = EventAgentRating | EventChannelRating | EventFaqUseful | EventBotRating | EventBotFaq | EventBotStart | EventBotOpen | EventBotAiModel | EventBotKeywordModel | EventFallback | EventHandoffOption | EventHandoffSuccess | EventHandoffFail;
125
+ export type HtEventProps = EventAgentRating | EventChannelRating | EventFaqUseful | EventBotRating | EventBotFaq | EventBotStart | EventBotOpen | EventBotAiModel | EventBotAiKnowladgeBase | EventBotKeywordModel | EventFallback | EventHandoffOption | EventHandoffSuccess | EventHandoffFail;
117
126
  export interface RequestData {
118
127
  language: string;
119
128
  country: string;
package/lib/esm/types.js CHANGED
@@ -8,6 +8,7 @@ export var EventName;
8
8
  EventName["botStart"] = "bot_start";
9
9
  EventName["botOpen"] = "bot_open";
10
10
  EventName["botAiModel"] = "bot_ai_model";
11
+ EventName["botAiKnowladgeBase"] = "bot_ai_knowledge_base";
11
12
  EventName["botKeywordsModel"] = "bot_keywords_model";
12
13
  EventName["fallback"] = "fallback";
13
14
  EventName["handoffOption"] = "handoff_option";
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,SAcX;AAdD,WAAY,SAAS;IACnB,gDAAmC,CAAA;IACnC,oDAAuC,CAAA;IACvC,4CAA+B,CAAA;IAC/B,qCAAwB,CAAA;IACxB,+BAAkB,CAAA;IAClB,mCAAsB,CAAA;IACtB,iCAAoB,CAAA;IACpB,wCAA2B,CAAA;IAC3B,oDAAuC,CAAA;IACvC,kCAAqB,CAAA;IACrB,6CAAgC,CAAA;IAChC,+CAAkC,CAAA;IAClC,yCAA4B,CAAA;AAC9B,CAAC,EAdW,SAAS,KAAT,SAAS,QAcpB"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,SAeX;AAfD,WAAY,SAAS;IACnB,gDAAmC,CAAA;IACnC,oDAAuC,CAAA;IACvC,4CAA+B,CAAA;IAC/B,qCAAwB,CAAA;IACxB,+BAAkB,CAAA;IAClB,mCAAsB,CAAA;IACtB,iCAAoB,CAAA;IACpB,wCAA2B,CAAA;IAC3B,yDAA4C,CAAA;IAC5C,oDAAuC,CAAA;IACvC,kCAAqB,CAAA;IACrB,6CAAgC,CAAA;IAChC,+CAAkC,CAAA;IAClC,yCAA4B,CAAA;AAC9B,CAAC,EAfW,SAAS,KAAT,SAAS,QAepB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botonic/plugin-hubtype-analytics",
3
- "version": "0.23.0",
3
+ "version": "0.23.1-alpha.0",
4
4
  "description": "Plugin for tracking in the Hubtype backend to see the results in the Hubtype Dashbord",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.21.0",
18
- "@botonic/core": "^0.23.0",
18
+ "@botonic/core": "0.23.1-alpha.0",
19
19
  "@types/axios": "^0.14.0",
20
20
  "axios": "^1.4.0"
21
21
  },
@@ -12,7 +12,7 @@ export class HtEventAgentRating extends HtEvent {
12
12
  constructor(event: EventAgentRating, requestData: RequestData) {
13
13
  super(event, requestData)
14
14
  this.event_data.rating = event.event_data.rating
15
- this.event_data.commnent = event.event_data.commnent
15
+ this.event_data.comment = event.event_data.comment
16
16
  this.event_data.case_id = event.event_data.case_id
17
17
  }
18
18
  }
@@ -0,0 +1,17 @@
1
+ import {
2
+ BaseEventData,
3
+ EventBotAiKnowladgeBase,
4
+ EventDataBotAiKnowladgeBase,
5
+ RequestData,
6
+ } from '../types'
7
+ import { HtEvent } from './ht-event'
8
+
9
+ export class HtEventBotAiKnowledgeBase extends HtEvent {
10
+ event_data: BaseEventData & EventDataBotAiKnowladgeBase
11
+
12
+ constructor(event: EventBotAiKnowladgeBase, requestData: RequestData) {
13
+ super(event, requestData)
14
+ this.event_data.answer = event.event_data.answer
15
+ this.event_data.knowledge_source_ids = event.event_data.knowledge_source_ids
16
+ }
17
+ }
package/src/index.ts CHANGED
@@ -5,7 +5,7 @@ import { HtEventProps, RequestData } from './types'
5
5
  import { createHtEvent } from './utils'
6
6
 
7
7
  export interface HubtypeAnalyticsOptions {
8
- getLaguange?: (request: BotRequest) => string
8
+ getLanguage?: (request: BotRequest) => string
9
9
  getCountry?: (request: BotRequest) => string
10
10
  }
11
11
 
@@ -19,11 +19,11 @@ function getDefaultCountry(request: BotRequest): string {
19
19
 
20
20
  export default class BotonicPluginHubtypeAnalytics implements Plugin {
21
21
  baseUrl: string
22
- getLaguange: (request: BotRequest) => string
22
+ getLanguage: (request: BotRequest) => string
23
23
  getCountry: (request: BotRequest) => string
24
24
  constructor(options?: HubtypeAnalyticsOptions) {
25
25
  this.baseUrl = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com'
26
- this.getLaguange = options?.getLaguange || getDefaultLanguage
26
+ this.getLanguage = options?.getLanguage || getDefaultLanguage
27
27
  this.getCountry = options?.getCountry || getDefaultCountry
28
28
  }
29
29
 
@@ -37,7 +37,7 @@ export default class BotonicPluginHubtypeAnalytics implements Plugin {
37
37
 
38
38
  getRequestData(request: BotRequest): RequestData {
39
39
  return {
40
- language: this.getLaguange(request),
40
+ language: this.getLanguage(request),
41
41
  country: this.getCountry(request),
42
42
  provider: request.session.user.provider,
43
43
  userId: request.session.user.id,
package/src/types.ts CHANGED
@@ -15,6 +15,7 @@ export enum EventName {
15
15
  botStart = 'bot_start',
16
16
  botOpen = 'bot_open',
17
17
  botAiModel = 'bot_ai_model',
18
+ botAiKnowladgeBase = 'bot_ai_knowledge_base',
18
19
  botKeywordsModel = 'bot_keywords_model',
19
20
  fallback = 'fallback',
20
21
  handoffOption = 'handoff_option',
@@ -43,7 +44,7 @@ export interface EventAgentRating extends HtBaseEventProps {
43
44
  export interface EventDataRating {
44
45
  case_id: string
45
46
  rating?: number
46
- commnent?: string
47
+ comment?: string
47
48
  }
48
49
  export interface EventChannelRating extends HtBaseEventProps {
49
50
  event_type: EventName.botChannelRating
@@ -101,6 +102,16 @@ export interface EventDataBotAiModel {
101
102
  confidence_successful: boolean
102
103
  }
103
104
 
105
+ export interface EventBotAiKnowladgeBase {
106
+ event_type: EventName.botAiKnowladgeBase
107
+ event_data: EventDataBotAiKnowladgeBase
108
+ }
109
+
110
+ export interface EventDataBotAiKnowladgeBase {
111
+ answer: string
112
+ knowledge_source_ids: string[]
113
+ }
114
+
104
115
  export interface EventBotKeywordModel extends HtBaseEventProps {
105
116
  event_type: EventName.botKeywordsModel
106
117
  event_data: EventDataBotKeywordModel
@@ -143,6 +154,7 @@ export type HtEventProps =
143
154
  | EventBotStart
144
155
  | EventBotOpen
145
156
  | EventBotAiModel
157
+ | EventBotAiKnowladgeBase
146
158
  | EventBotKeywordModel
147
159
  | EventFallback
148
160
  | EventHandoffOption