@botonic/plugin-hubtype-analytics 0.22.0-alpha.3 → 0.22.0-alpha.5
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/README.md +9 -4
- package/lib/cjs/event-models/ht-event-agent-rating.d.ts +6 -0
- package/lib/cjs/event-models/ht-event-agent-rating.js +12 -0
- package/lib/cjs/event-models/ht-event-agent-rating.js.map +1 -0
- package/lib/cjs/event-models/ht-event-bot-ai-model.d.ts +6 -0
- package/lib/cjs/event-models/ht-event-bot-ai-model.js +15 -0
- package/lib/cjs/event-models/ht-event-bot-ai-model.js.map +1 -0
- package/lib/cjs/event-models/ht-event-bot-faq.d.ts +6 -0
- package/lib/cjs/event-models/ht-event-bot-faq.js +12 -0
- package/lib/cjs/event-models/ht-event-bot-faq.js.map +1 -0
- package/lib/cjs/event-models/ht-event-bot-keyword-model.d.ts +6 -0
- package/lib/cjs/event-models/ht-event-bot-keyword-model.js +13 -0
- package/lib/cjs/event-models/ht-event-bot-keyword-model.js.map +1 -0
- package/lib/cjs/event-models/ht-event-bot-rating.d.ts +6 -0
- package/lib/cjs/event-models/ht-event-bot-rating.js +14 -0
- package/lib/cjs/event-models/ht-event-bot-rating.js.map +1 -0
- package/lib/cjs/event-models/ht-event-channel-rating.d.ts +6 -0
- package/lib/cjs/event-models/ht-event-channel-rating.js +12 -0
- package/lib/cjs/event-models/ht-event-channel-rating.js.map +1 -0
- package/lib/cjs/event-models/ht-event-faq-useful.d.ts +6 -0
- package/lib/cjs/event-models/ht-event-faq-useful.js +13 -0
- package/lib/cjs/event-models/ht-event-faq-useful.js.map +1 -0
- package/lib/cjs/event-models/ht-event-handoff-fail.d.ts +6 -0
- package/lib/cjs/event-models/ht-event-handoff-fail.js +14 -0
- package/lib/cjs/event-models/ht-event-handoff-fail.js.map +1 -0
- package/lib/cjs/event-models/ht-event-handoff-success.d.ts +6 -0
- package/lib/cjs/event-models/ht-event-handoff-success.js +14 -0
- package/lib/cjs/event-models/ht-event-handoff-success.js.map +1 -0
- package/lib/cjs/event-models/ht-event.d.ts +7 -0
- package/lib/cjs/event-models/ht-event.js +19 -0
- package/lib/cjs/event-models/ht-event.js.map +1 -0
- package/lib/cjs/index.d.ts +7 -4
- package/lib/cjs/index.js +22 -11
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/types.d.ts +70 -59
- package/lib/cjs/types.js.map +1 -1
- package/lib/cjs/utils.d.ts +3 -0
- package/lib/cjs/utils.js +46 -0
- package/lib/cjs/utils.js.map +1 -0
- package/lib/esm/event-models/ht-event-agent-rating.d.ts +6 -0
- package/lib/esm/event-models/ht-event-agent-rating.js +8 -0
- package/lib/esm/event-models/ht-event-agent-rating.js.map +1 -0
- package/lib/esm/event-models/ht-event-bot-ai-model.d.ts +6 -0
- package/lib/esm/event-models/ht-event-bot-ai-model.js +11 -0
- package/lib/esm/event-models/ht-event-bot-ai-model.js.map +1 -0
- package/lib/esm/event-models/ht-event-bot-faq.d.ts +6 -0
- package/lib/esm/event-models/ht-event-bot-faq.js +8 -0
- package/lib/esm/event-models/ht-event-bot-faq.js.map +1 -0
- package/lib/esm/event-models/ht-event-bot-keyword-model.d.ts +6 -0
- package/lib/esm/event-models/ht-event-bot-keyword-model.js +9 -0
- package/lib/esm/event-models/ht-event-bot-keyword-model.js.map +1 -0
- package/lib/esm/event-models/ht-event-bot-rating.d.ts +6 -0
- package/lib/esm/event-models/ht-event-bot-rating.js +10 -0
- package/lib/esm/event-models/ht-event-bot-rating.js.map +1 -0
- package/lib/esm/event-models/ht-event-channel-rating.d.ts +6 -0
- package/lib/esm/event-models/ht-event-channel-rating.js +8 -0
- package/lib/esm/event-models/ht-event-channel-rating.js.map +1 -0
- package/lib/esm/event-models/ht-event-faq-useful.d.ts +6 -0
- package/lib/esm/event-models/ht-event-faq-useful.js +9 -0
- package/lib/esm/event-models/ht-event-faq-useful.js.map +1 -0
- package/lib/esm/event-models/ht-event-handoff-fail.d.ts +6 -0
- package/lib/esm/event-models/ht-event-handoff-fail.js +10 -0
- package/lib/esm/event-models/ht-event-handoff-fail.js.map +1 -0
- package/lib/esm/event-models/ht-event-handoff-success.d.ts +6 -0
- package/lib/esm/event-models/ht-event-handoff-success.js +10 -0
- package/lib/esm/event-models/ht-event-handoff-success.js.map +1 -0
- package/lib/esm/event-models/ht-event.d.ts +7 -0
- package/lib/esm/event-models/ht-event.js +15 -0
- package/lib/esm/event-models/ht-event.js.map +1 -0
- package/lib/esm/index.d.ts +7 -4
- package/lib/esm/index.js +22 -11
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/types.d.ts +70 -59
- package/lib/esm/types.js.map +1 -1
- package/lib/esm/utils.d.ts +3 -0
- package/lib/esm/utils.js +42 -0
- package/lib/esm/utils.js.map +1 -0
- package/package.json +2 -2
- package/src/event-models/ht-event-agent-rating.ts +16 -0
- package/src/event-models/ht-event-bot-ai-model.ts +19 -0
- package/src/event-models/ht-event-bot-faq.ts +16 -0
- package/src/event-models/ht-event-bot-keyword-model.ts +17 -0
- package/src/event-models/ht-event-bot-rating.ts +18 -0
- package/src/event-models/ht-event-channel-rating.ts +16 -0
- package/src/event-models/ht-event-faq-useful.ts +17 -0
- package/src/event-models/ht-event-handoff-fail.ts +18 -0
- package/src/event-models/ht-event-handoff-success.ts +18 -0
- package/src/event-models/ht-event.ts +20 -0
- package/src/index.ts +30 -18
- package/src/types.ts +76 -49
- package/src/utils.ts +46 -0
package/README.md
CHANGED
|
@@ -2,25 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
## What Does This Plugin Do?
|
|
4
4
|
|
|
5
|
-
This plugin
|
|
5
|
+
This plugin is used to integrate Hubtype Analytics Service in your Botonic project.
|
|
6
6
|
|
|
7
7
|
## Setup
|
|
8
8
|
|
|
9
9
|
1. Install the plugin from npm (or yarn):
|
|
10
10
|
|
|
11
11
|
```
|
|
12
|
-
npm i
|
|
12
|
+
npm i @botonic/plugin-hubtype-analytics
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
2. Add it to the `src/plugins.js` file defining the projectId of the Project you want to use:
|
|
16
16
|
|
|
17
|
+
You can define two optional functions to obtain the language and the country.
|
|
18
|
+
By default if you do not define these functions it will use the language defined in request.session.user.extra_data.language and country defined in request.session.user.extra_data.country
|
|
19
|
+
|
|
17
20
|
```
|
|
18
21
|
export const plugins = [
|
|
19
22
|
{
|
|
20
23
|
id: 'hubtype-analytics',
|
|
21
24
|
resolve: require('@botonic/plugin-hubtype-analytics'),
|
|
22
25
|
options: {
|
|
23
|
-
|
|
26
|
+
getLaguange?: (request: BotRequest) => request.session.user.extra_data.lang
|
|
27
|
+
getCountry?: (request: BotRequest) => request.session.user.extra_data.store
|
|
24
28
|
},
|
|
25
29
|
},
|
|
26
30
|
]
|
|
@@ -47,4 +51,5 @@ You can use it in your actions for example an event to check that a faq has been
|
|
|
47
51
|
|
|
48
52
|
## Plugin Options
|
|
49
53
|
|
|
50
|
-
- **`
|
|
54
|
+
- **`getLaguange`**: getLaguange(request) function to define the language when it is not in request.session.user.extra_data.language
|
|
55
|
+
- **`getCountry`**: getCountry(request) function to define the country when it is not in request.session.user.extra_data.country
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseEventData, EventAgentRating, EventDataRating, RequestData } from '../types';
|
|
2
|
+
import { HtEvent } from './ht-event';
|
|
3
|
+
export declare class HtEventAgentRating extends HtEvent {
|
|
4
|
+
event_data: BaseEventData & EventDataRating;
|
|
5
|
+
constructor(event: EventAgentRating, requestData: RequestData);
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HtEventAgentRating = void 0;
|
|
4
|
+
const ht_event_1 = require("./ht-event");
|
|
5
|
+
class HtEventAgentRating extends ht_event_1.HtEvent {
|
|
6
|
+
constructor(event, requestData) {
|
|
7
|
+
super(event, requestData);
|
|
8
|
+
this.event_data.rating = event.event_data.rating;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.HtEventAgentRating = HtEventAgentRating;
|
|
12
|
+
//# sourceMappingURL=ht-event-agent-rating.js.map
|
|
@@ -0,0 +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;IAClD,CAAC;CACF;AAPD,gDAOC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseEventData, EventBotAiModel, EventDataBotAiModel, RequestData } from '../types';
|
|
2
|
+
import { HtEvent } from './ht-event';
|
|
3
|
+
export declare class HtEventBotAiModel extends HtEvent {
|
|
4
|
+
event_data: BaseEventData & EventDataBotAiModel;
|
|
5
|
+
constructor(event: EventBotAiModel, requestData: RequestData);
|
|
6
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HtEventBotAiModel = void 0;
|
|
4
|
+
const ht_event_1 = require("./ht-event");
|
|
5
|
+
class HtEventBotAiModel extends ht_event_1.HtEvent {
|
|
6
|
+
constructor(event, requestData) {
|
|
7
|
+
super(event, requestData);
|
|
8
|
+
this.event_data.intent = event.event_data.intent;
|
|
9
|
+
this.event_data.confidence = event.event_data.confidence;
|
|
10
|
+
this.event_data.confidence_successful =
|
|
11
|
+
event.event_data.confidence_successful;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.HtEventBotAiModel = HtEventBotAiModel;
|
|
15
|
+
//# sourceMappingURL=ht-event-bot-ai-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ht-event-bot-ai-model.js","sourceRoot":"","sources":["../../../src/event-models/ht-event-bot-ai-model.ts"],"names":[],"mappings":";;;AAMA,yCAAoC;AAEpC,MAAa,iBAAkB,SAAQ,kBAAO;IAG5C,YAAY,KAAsB,EAAE,WAAwB;QAC1D,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,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,UAAU,CAAA;QACxD,IAAI,CAAC,UAAU,CAAC,qBAAqB;YACnC,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAA;IAC1C,CAAC;CACF;AAVD,8CAUC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseEventData, EventBotFaq, EventDataBotFaq, RequestData } from '../types';
|
|
2
|
+
import { HtEvent } from './ht-event';
|
|
3
|
+
export declare class HtEventBotFaq extends HtEvent {
|
|
4
|
+
event_data: BaseEventData & EventDataBotFaq;
|
|
5
|
+
constructor(event: EventBotFaq, requestData: RequestData);
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HtEventBotFaq = void 0;
|
|
4
|
+
const ht_event_1 = require("./ht-event");
|
|
5
|
+
class HtEventBotFaq extends ht_event_1.HtEvent {
|
|
6
|
+
constructor(event, requestData) {
|
|
7
|
+
super(event, requestData);
|
|
8
|
+
this.event_data.faq_name = event.event_data.faq_name;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.HtEventBotFaq = HtEventBotFaq;
|
|
12
|
+
//# sourceMappingURL=ht-event-bot-faq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ht-event-bot-faq.js","sourceRoot":"","sources":["../../../src/event-models/ht-event-bot-faq.ts"],"names":[],"mappings":";;;AAMA,yCAAoC;AAEpC,MAAa,aAAc,SAAQ,kBAAO;IAGxC,YAAY,KAAkB,EAAE,WAAwB;QACtD,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;QACzB,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAA;IACtD,CAAC;CACF;AAPD,sCAOC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseEventData, EventBotKeywordModel, EventDataBotKeywordModel, RequestData } from '../types';
|
|
2
|
+
import { HtEvent } from './ht-event';
|
|
3
|
+
export declare class HtEventBotKeywordModel extends HtEvent {
|
|
4
|
+
event_data: BaseEventData & EventDataBotKeywordModel;
|
|
5
|
+
constructor(event: EventBotKeywordModel, requestData: RequestData);
|
|
6
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HtEventBotKeywordModel = void 0;
|
|
4
|
+
const ht_event_1 = require("./ht-event");
|
|
5
|
+
class HtEventBotKeywordModel extends ht_event_1.HtEvent {
|
|
6
|
+
constructor(event, requestData) {
|
|
7
|
+
super(event, requestData);
|
|
8
|
+
this.event_data.confidence_successful =
|
|
9
|
+
event.event_data.confidence_successful;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.HtEventBotKeywordModel = HtEventBotKeywordModel;
|
|
13
|
+
//# sourceMappingURL=ht-event-bot-keyword-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ht-event-bot-keyword-model.js","sourceRoot":"","sources":["../../../src/event-models/ht-event-bot-keyword-model.ts"],"names":[],"mappings":";;;AAMA,yCAAoC;AAEpC,MAAa,sBAAuB,SAAQ,kBAAO;IAGjD,YAAY,KAA2B,EAAE,WAAwB;QAC/D,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;QACzB,IAAI,CAAC,UAAU,CAAC,qBAAqB;YACnC,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAA;IAC1C,CAAC;CACF;AARD,wDAQC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseEventData, EventBotRating, EventDataBotRating, RequestData } from '../types';
|
|
2
|
+
import { HtEvent } from './ht-event';
|
|
3
|
+
export declare class HtEventBotRating extends HtEvent {
|
|
4
|
+
event_data: BaseEventData & EventDataBotRating;
|
|
5
|
+
constructor(event: EventBotRating, requestData: RequestData);
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HtEventBotRating = void 0;
|
|
4
|
+
const ht_event_1 = require("./ht-event");
|
|
5
|
+
class HtEventBotRating extends ht_event_1.HtEvent {
|
|
6
|
+
constructor(event, requestData) {
|
|
7
|
+
super(event, requestData);
|
|
8
|
+
this.event_data.rating = event.event_data.rating;
|
|
9
|
+
this.event_data.free_comment = event.event_data.free_comment;
|
|
10
|
+
this.event_data.selected_options = event.event_data.selected_options;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.HtEventBotRating = HtEventBotRating;
|
|
14
|
+
//# sourceMappingURL=ht-event-bot-rating.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ht-event-bot-rating.js","sourceRoot":"","sources":["../../../src/event-models/ht-event-bot-rating.ts"],"names":[],"mappings":";;;AAMA,yCAAoC;AAEpC,MAAa,gBAAiB,SAAQ,kBAAO;IAG3C,YAAY,KAAqB,EAAE,WAAwB;QACzD,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,YAAY,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAA;QAC5D,IAAI,CAAC,UAAU,CAAC,gBAAgB,GAAG,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAA;IACtE,CAAC;CACF;AATD,4CASC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseEventData, EventChannelRating, EventDataRating, RequestData } from '../types';
|
|
2
|
+
import { HtEvent } from './ht-event';
|
|
3
|
+
export declare class HtEventChannelRating extends HtEvent {
|
|
4
|
+
event_data: BaseEventData & EventDataRating;
|
|
5
|
+
constructor(event: EventChannelRating, requestData: RequestData);
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HtEventChannelRating = void 0;
|
|
4
|
+
const ht_event_1 = require("./ht-event");
|
|
5
|
+
class HtEventChannelRating extends ht_event_1.HtEvent {
|
|
6
|
+
constructor(event, requestData) {
|
|
7
|
+
super(event, requestData);
|
|
8
|
+
this.event_data.rating = event.event_data.rating;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.HtEventChannelRating = HtEventChannelRating;
|
|
12
|
+
//# sourceMappingURL=ht-event-channel-rating.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ht-event-channel-rating.js","sourceRoot":"","sources":["../../../src/event-models/ht-event-channel-rating.ts"],"names":[],"mappings":";;;AAMA,yCAAoC;AAEpC,MAAa,oBAAqB,SAAQ,kBAAO;IAG/C,YAAY,KAAyB,EAAE,WAAwB;QAC7D,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;QACzB,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAA;IAClD,CAAC;CACF;AAPD,oDAOC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseEventData, EventDataUseful, EventFaqUseful, RequestData } from '../types';
|
|
2
|
+
import { HtEvent } from './ht-event';
|
|
3
|
+
export declare class HtEventFaqUseful extends HtEvent {
|
|
4
|
+
event_data: BaseEventData & EventDataUseful;
|
|
5
|
+
constructor(event: EventFaqUseful, requestData: RequestData);
|
|
6
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HtEventFaqUseful = void 0;
|
|
4
|
+
const ht_event_1 = require("./ht-event");
|
|
5
|
+
class HtEventFaqUseful extends ht_event_1.HtEvent {
|
|
6
|
+
constructor(event, requestData) {
|
|
7
|
+
super(event, requestData);
|
|
8
|
+
this.event_data.faq_name = event.event_data.faq_name;
|
|
9
|
+
this.event_data.useful = event.event_data.useful;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.HtEventFaqUseful = HtEventFaqUseful;
|
|
13
|
+
//# sourceMappingURL=ht-event-faq-useful.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ht-event-faq-useful.js","sourceRoot":"","sources":["../../../src/event-models/ht-event-faq-useful.ts"],"names":[],"mappings":";;;AAMA,yCAAoC;AAEpC,MAAa,gBAAiB,SAAQ,kBAAO;IAG3C,YAAY,KAAqB,EAAE,WAAwB;QACzD,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;QACzB,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAA;QACpD,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAA;IAClD,CAAC;CACF;AARD,4CAQC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseEventData, EventDataHandoff, EventHandoffFail, RequestData } from '../types';
|
|
2
|
+
import { HtEvent } from './ht-event';
|
|
3
|
+
export declare class HtEventHandoffFail extends HtEvent {
|
|
4
|
+
event_data: BaseEventData & EventDataHandoff;
|
|
5
|
+
constructor(event: EventHandoffFail, requestData: RequestData);
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HtEventHandoffFail = void 0;
|
|
4
|
+
const ht_event_1 = require("./ht-event");
|
|
5
|
+
class HtEventHandoffFail extends ht_event_1.HtEvent {
|
|
6
|
+
constructor(event, requestData) {
|
|
7
|
+
super(event, requestData);
|
|
8
|
+
this.event_data.queue_open = event.event_data.queue_open;
|
|
9
|
+
this.event_data.available_agents = event.event_data.available_agents;
|
|
10
|
+
this.event_data.threshold_reached = event.event_data.threshold_reached;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.HtEventHandoffFail = HtEventHandoffFail;
|
|
14
|
+
//# sourceMappingURL=ht-event-handoff-fail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ht-event-handoff-fail.js","sourceRoot":"","sources":["../../../src/event-models/ht-event-handoff-fail.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,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,UAAU,CAAA;QACxD,IAAI,CAAC,UAAU,CAAC,gBAAgB,GAAG,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAA;QACpE,IAAI,CAAC,UAAU,CAAC,iBAAiB,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAA;IACxE,CAAC;CACF;AATD,gDASC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseEventData, EventDataHandoff, EventHandoffSuccess, RequestData } from '../types';
|
|
2
|
+
import { HtEvent } from './ht-event';
|
|
3
|
+
export declare class HtEventHandoffSuccess extends HtEvent {
|
|
4
|
+
event_data: BaseEventData & EventDataHandoff;
|
|
5
|
+
constructor(event: EventHandoffSuccess, requestData: RequestData);
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HtEventHandoffSuccess = void 0;
|
|
4
|
+
const ht_event_1 = require("./ht-event");
|
|
5
|
+
class HtEventHandoffSuccess extends ht_event_1.HtEvent {
|
|
6
|
+
constructor(event, requestData) {
|
|
7
|
+
super(event, requestData);
|
|
8
|
+
this.event_data.queue_open = event.event_data.queue_open;
|
|
9
|
+
this.event_data.available_agents = event.event_data.available_agents;
|
|
10
|
+
this.event_data.threshold_reached = event.event_data.threshold_reached;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.HtEventHandoffSuccess = HtEventHandoffSuccess;
|
|
14
|
+
//# sourceMappingURL=ht-event-handoff-success.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ht-event-handoff-success.js","sourceRoot":"","sources":["../../../src/event-models/ht-event-handoff-success.ts"],"names":[],"mappings":";;;AAMA,yCAAoC;AAEpC,MAAa,qBAAsB,SAAQ,kBAAO;IAGhD,YAAY,KAA0B,EAAE,WAAwB;QAC9D,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;QACzB,IAAI,CAAC,UAAU,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,UAAU,CAAA;QACxD,IAAI,CAAC,UAAU,CAAC,gBAAgB,GAAG,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAA;QACpE,IAAI,CAAC,UAAU,CAAC,iBAAiB,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAA;IACxE,CAAC;CACF;AATD,sDASC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HtEvent = void 0;
|
|
4
|
+
class HtEvent {
|
|
5
|
+
constructor(event, requestData) {
|
|
6
|
+
this.chat = requestData.userId;
|
|
7
|
+
this.event_type = event.event_type;
|
|
8
|
+
this.event_data = {
|
|
9
|
+
channel: requestData.provider,
|
|
10
|
+
event_datetime: new Date().toISOString(),
|
|
11
|
+
enduser_language: requestData.language,
|
|
12
|
+
enduser_country: requestData.country,
|
|
13
|
+
format_version: 1,
|
|
14
|
+
// flow_version?: string
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.HtEvent = HtEvent;
|
|
19
|
+
//# sourceMappingURL=ht-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ht-event.js","sourceRoot":"","sources":["../../../src/event-models/ht-event.ts"],"names":[],"mappings":";;;AAEA,MAAa,OAAO;IAKlB,YAAY,KAAmB,EAAE,WAAwB;QACvD,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,MAAM,CAAA;QAC9B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAA;QAClC,IAAI,CAAC,UAAU,GAAG;YAChB,OAAO,EAAE,WAAW,CAAC,QAAQ;YAC7B,cAAc,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACxC,gBAAgB,EAAE,WAAW,CAAC,QAAQ;YACtC,eAAe,EAAE,WAAW,CAAC,OAAO;YACpC,cAAc,EAAE,CAAC;YACjB,wBAAwB;SACzB,CAAA;IACH,CAAC;CACF;AAjBD,0BAiBC"}
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { BotRequest, Plugin } from '@botonic/core';
|
|
2
|
-
import {
|
|
2
|
+
import { HtEventProps, RequestData } from './types';
|
|
3
3
|
export interface HubtypeAnalyticsOptions {
|
|
4
|
-
|
|
4
|
+
getLaguange?: (request: BotRequest) => string;
|
|
5
|
+
getCountry?: (request: BotRequest) => string;
|
|
5
6
|
}
|
|
6
7
|
export default class BotonicPluginHubtypeAnalytics implements Plugin {
|
|
7
8
|
baseUrl: string;
|
|
9
|
+
getLaguange: (request: BotRequest) => string;
|
|
10
|
+
getCountry: (request: BotRequest) => string;
|
|
8
11
|
constructor(options: HubtypeAnalyticsOptions);
|
|
9
|
-
pre(): void;
|
|
10
12
|
post(): void;
|
|
11
13
|
getUrl(request: BotRequest): string;
|
|
12
|
-
|
|
14
|
+
getRequestData(request: BotRequest): RequestData;
|
|
15
|
+
trackEvent(request: BotRequest, htEventProps: HtEventProps): Promise<import("axios").AxiosResponse<any, any>>;
|
|
13
16
|
}
|
package/lib/cjs/index.js
CHANGED
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
function getDefaultLanguage(request) {
|
|
7
|
+
return request.session.user.extra_data.language;
|
|
8
|
+
}
|
|
9
|
+
function getDefaultCountry(request) {
|
|
10
|
+
return request.session.user.extra_data.country;
|
|
11
|
+
}
|
|
5
12
|
class BotonicPluginHubtypeAnalytics {
|
|
6
13
|
constructor(options) {
|
|
7
|
-
this.baseUrl =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return;
|
|
14
|
+
this.baseUrl = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com';
|
|
15
|
+
this.getLaguange = options.getLaguange || getDefaultLanguage;
|
|
16
|
+
this.getCountry = options.getCountry || getDefaultCountry;
|
|
11
17
|
}
|
|
12
18
|
post() {
|
|
13
19
|
return;
|
|
@@ -15,16 +21,21 @@ class BotonicPluginHubtypeAnalytics {
|
|
|
15
21
|
getUrl(request) {
|
|
16
22
|
return `${this.baseUrl}/external/v1/conversational_apps/${request.session.bot.id}/bot_event/`;
|
|
17
23
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
getRequestData(request) {
|
|
25
|
+
return {
|
|
26
|
+
language: this.getLaguange(request),
|
|
27
|
+
country: this.getCountry(request),
|
|
28
|
+
provider: request.session.user.provider,
|
|
29
|
+
userId: request.session.user.id,
|
|
24
30
|
};
|
|
31
|
+
}
|
|
32
|
+
async trackEvent(request, htEventProps) {
|
|
33
|
+
const url = this.getUrl(request);
|
|
34
|
+
const requestData = this.getRequestData(request);
|
|
35
|
+
const event = (0, utils_1.createHtEvent)(requestData, htEventProps);
|
|
25
36
|
const headers = { Authorization: `Bearer ${request.session._access_token}` };
|
|
26
37
|
const config = { headers };
|
|
27
|
-
return axios_1.default.post(url,
|
|
38
|
+
return axios_1.default.post(url, event, config);
|
|
28
39
|
}
|
|
29
40
|
}
|
|
30
41
|
exports.default = BotonicPluginHubtypeAnalytics;
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AACA,0DAAyB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AACA,0DAAyB;AAGzB,mCAAuC;AAOvC,SAAS,kBAAkB,CAAC,OAAmB;IAC7C,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAA;AACjD,CAAC;AAED,SAAS,iBAAiB,CAAC,OAAmB;IAC5C,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAA;AAChD,CAAC;AAED,MAAqB,6BAA6B;IAIhD,YAAY,OAAgC;QAC1C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,yBAAyB,CAAA;QACvE,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,kBAAkB,CAAA;QAC5D,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,iBAAiB,CAAA;IAC3D,CAAC;IAED,IAAI;QACF,OAAM;IACR,CAAC;IAED,MAAM,CAAC,OAAmB;QACxB,OAAO,GAAG,IAAI,CAAC,OAAO,oCAAoC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,aAAa,CAAA;IAC/F,CAAC;IAED,cAAc,CAAC,OAAmB;QAChC,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;YACnC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YACjC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ;YACvC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;SAChC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAAmB,EAAE,YAA0B;QAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAChC,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;QAChD,MAAM,KAAK,GAAG,IAAA,qBAAa,EAAC,WAAW,EAAE,YAAY,CAAC,CAAA;QACtD,MAAM,OAAO,GAAG,EAAE,aAAa,EAAE,UAAU,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAA;QAC5E,MAAM,MAAM,GAAG,EAAE,OAAO,EAAE,CAAA;QAC1B,OAAO,eAAK,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IACvC,CAAC;CACF;AAnCD,gDAmCC"}
|
package/lib/cjs/types.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { PROVIDER } from '@botonic/core';
|
|
2
|
+
export interface Event {
|
|
3
|
+
chat: string;
|
|
4
|
+
event_type: EventName;
|
|
5
|
+
event_data: BaseEventData;
|
|
6
|
+
}
|
|
1
7
|
export declare enum EventName {
|
|
2
8
|
botAgentRating = "bot_agent_rating",
|
|
3
9
|
botChannelRating = "bot_channel_rating",
|
|
@@ -13,93 +19,98 @@ export declare enum EventName {
|
|
|
13
19
|
handoffSuccess = "handoff_success",
|
|
14
20
|
handoffFail = "handoff_fail"
|
|
15
21
|
}
|
|
16
|
-
interface
|
|
17
|
-
|
|
22
|
+
export interface BaseEventData {
|
|
23
|
+
channel: string;
|
|
24
|
+
event_datetime: string;
|
|
18
25
|
enduser_language: string;
|
|
26
|
+
enduser_country?: string;
|
|
19
27
|
format_version?: number;
|
|
20
28
|
bot_version?: string;
|
|
21
29
|
flow_version?: string;
|
|
22
30
|
}
|
|
23
|
-
export interface
|
|
31
|
+
export interface HtBaseEventProps {
|
|
32
|
+
event_type: EventName;
|
|
33
|
+
}
|
|
34
|
+
export interface EventAgentRating extends HtBaseEventProps {
|
|
24
35
|
event_type: EventName.botAgentRating;
|
|
25
|
-
event_data:
|
|
26
|
-
rating: number;
|
|
27
|
-
};
|
|
36
|
+
event_data: EventDataRating;
|
|
28
37
|
}
|
|
29
|
-
export interface EventChannelRating {
|
|
38
|
+
export interface EventChannelRating extends HtBaseEventProps {
|
|
30
39
|
event_type: EventName.botChannelRating;
|
|
31
|
-
event_data:
|
|
32
|
-
rating: number;
|
|
33
|
-
};
|
|
40
|
+
event_data: EventDataRating;
|
|
34
41
|
}
|
|
35
|
-
export interface
|
|
42
|
+
export interface EventDataRating {
|
|
43
|
+
rating: number;
|
|
44
|
+
}
|
|
45
|
+
export interface EventFaqUseful extends HtBaseEventProps {
|
|
36
46
|
event_type: EventName.botFaqUseful;
|
|
37
|
-
event_data:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
event_data: EventDataUseful;
|
|
48
|
+
}
|
|
49
|
+
export interface EventDataUseful {
|
|
50
|
+
faq_name: string;
|
|
51
|
+
useful: boolean;
|
|
41
52
|
}
|
|
42
|
-
export interface EventBotRating {
|
|
53
|
+
export interface EventBotRating extends HtBaseEventProps {
|
|
43
54
|
event_type: EventName.botRating;
|
|
44
|
-
event_data:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
export interface EventBotFaq {
|
|
55
|
+
event_data: EventDataBotRating;
|
|
56
|
+
}
|
|
57
|
+
export interface EventDataBotRating {
|
|
58
|
+
rating: number;
|
|
59
|
+
free_comment?: string;
|
|
60
|
+
selected_options?: string[];
|
|
61
|
+
}
|
|
62
|
+
export interface EventBotFaq extends HtBaseEventProps {
|
|
53
63
|
event_type: EventName.botFaq;
|
|
54
|
-
event_data:
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
event_data: EventDataBotFaq;
|
|
65
|
+
}
|
|
66
|
+
export interface EventDataBotFaq {
|
|
67
|
+
faq_name: string;
|
|
57
68
|
}
|
|
58
|
-
export interface EventBotStart {
|
|
69
|
+
export interface EventBotStart extends HtBaseEventProps {
|
|
59
70
|
event_type: EventName.botStart;
|
|
60
|
-
event_data: EventData;
|
|
61
71
|
}
|
|
62
72
|
export interface EventBotOpen {
|
|
63
73
|
event_type: EventName.botOpen;
|
|
64
|
-
event_data: EventData;
|
|
65
74
|
}
|
|
66
75
|
export interface EventBotAiModel {
|
|
67
76
|
event_type: EventName.botAiModel;
|
|
68
|
-
event_data:
|
|
69
|
-
intent: string;
|
|
70
|
-
confidence: number;
|
|
71
|
-
confidence_successful: boolean;
|
|
72
|
-
};
|
|
77
|
+
event_data: EventDataBotAiModel;
|
|
73
78
|
}
|
|
74
|
-
export interface
|
|
79
|
+
export interface EventDataBotAiModel {
|
|
80
|
+
intent: string;
|
|
81
|
+
confidence: number;
|
|
82
|
+
confidence_successful: boolean;
|
|
83
|
+
}
|
|
84
|
+
export interface EventBotKeywordModel extends HtBaseEventProps {
|
|
75
85
|
event_type: EventName.botKeywordsModel;
|
|
76
|
-
event_data:
|
|
77
|
-
|
|
78
|
-
|
|
86
|
+
event_data: EventDataBotKeywordModel;
|
|
87
|
+
}
|
|
88
|
+
export interface EventDataBotKeywordModel {
|
|
89
|
+
confidence_successful: boolean;
|
|
79
90
|
}
|
|
80
|
-
export interface EventFallback {
|
|
91
|
+
export interface EventFallback extends HtBaseEventProps {
|
|
81
92
|
event_type: EventName.fallback;
|
|
82
|
-
event_data: EventData;
|
|
83
93
|
}
|
|
84
|
-
export interface EventHandoffOption {
|
|
94
|
+
export interface EventHandoffOption extends HtBaseEventProps {
|
|
85
95
|
event_type: EventName.handoffOption;
|
|
86
|
-
event_data: EventData;
|
|
87
96
|
}
|
|
88
|
-
export interface EventHandoffSuccess {
|
|
97
|
+
export interface EventHandoffSuccess extends HtBaseEventProps {
|
|
89
98
|
event_type: EventName.handoffSuccess;
|
|
90
|
-
event_data:
|
|
91
|
-
queue_open: boolean;
|
|
92
|
-
available_agents: boolean;
|
|
93
|
-
threshold_reached: boolean;
|
|
94
|
-
};
|
|
99
|
+
event_data: EventDataHandoff;
|
|
95
100
|
}
|
|
96
|
-
export interface EventHandoffFail {
|
|
101
|
+
export interface EventHandoffFail extends HtBaseEventProps {
|
|
97
102
|
event_type: EventName.handoffFail;
|
|
98
|
-
event_data:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
export
|
|
103
|
+
event_data: EventDataHandoff;
|
|
104
|
+
}
|
|
105
|
+
export interface EventDataHandoff {
|
|
106
|
+
queue_open: boolean;
|
|
107
|
+
available_agents: boolean;
|
|
108
|
+
threshold_reached: boolean;
|
|
109
|
+
}
|
|
110
|
+
export type HtEventProps = EventAgentRating | EventChannelRating | EventFaqUseful | EventBotRating | EventBotFaq | EventBotStart | EventBotOpen | EventBotAiModel | EventBotKeywordModel | EventFallback | EventHandoffOption | EventHandoffSuccess | EventHandoffFail;
|
|
111
|
+
export interface RequestData {
|
|
112
|
+
language: string;
|
|
113
|
+
country: string;
|
|
114
|
+
provider: PROVIDER;
|
|
115
|
+
userId: string;
|
|
116
|
+
}
|
package/lib/cjs/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;
|
|
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"}
|
package/lib/cjs/utils.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createHtEvent = void 0;
|
|
4
|
+
const ht_event_1 = require("./event-models/ht-event");
|
|
5
|
+
const ht_event_agent_rating_1 = require("./event-models/ht-event-agent-rating");
|
|
6
|
+
const ht_event_bot_ai_model_1 = require("./event-models/ht-event-bot-ai-model");
|
|
7
|
+
const ht_event_bot_faq_1 = require("./event-models/ht-event-bot-faq");
|
|
8
|
+
const ht_event_bot_keyword_model_1 = require("./event-models/ht-event-bot-keyword-model");
|
|
9
|
+
const ht_event_bot_rating_1 = require("./event-models/ht-event-bot-rating");
|
|
10
|
+
const ht_event_channel_rating_1 = require("./event-models/ht-event-channel-rating");
|
|
11
|
+
const ht_event_faq_useful_1 = require("./event-models/ht-event-faq-useful");
|
|
12
|
+
const ht_event_handoff_fail_1 = require("./event-models/ht-event-handoff-fail");
|
|
13
|
+
const ht_event_handoff_success_1 = require("./event-models/ht-event-handoff-success");
|
|
14
|
+
const types_1 = require("./types");
|
|
15
|
+
function createHtEvent(requestData, htEventProps) {
|
|
16
|
+
if (htEventProps.event_type === types_1.EventName.botAgentRating) {
|
|
17
|
+
return new ht_event_agent_rating_1.HtEventAgentRating(htEventProps, requestData);
|
|
18
|
+
}
|
|
19
|
+
if (htEventProps.event_type === types_1.EventName.botChannelRating) {
|
|
20
|
+
return new ht_event_channel_rating_1.HtEventChannelRating(htEventProps, requestData);
|
|
21
|
+
}
|
|
22
|
+
if (htEventProps.event_type === types_1.EventName.botFaqUseful) {
|
|
23
|
+
return new ht_event_faq_useful_1.HtEventFaqUseful(htEventProps, requestData);
|
|
24
|
+
}
|
|
25
|
+
if (htEventProps.event_type === types_1.EventName.botRating) {
|
|
26
|
+
return new ht_event_bot_rating_1.HtEventBotRating(htEventProps, requestData);
|
|
27
|
+
}
|
|
28
|
+
if (htEventProps.event_type === types_1.EventName.botFaq) {
|
|
29
|
+
return new ht_event_bot_faq_1.HtEventBotFaq(htEventProps, requestData);
|
|
30
|
+
}
|
|
31
|
+
if (htEventProps.event_type === types_1.EventName.botAiModel) {
|
|
32
|
+
return new ht_event_bot_ai_model_1.HtEventBotAiModel(htEventProps, requestData);
|
|
33
|
+
}
|
|
34
|
+
if (htEventProps.event_type === types_1.EventName.botKeywordsModel) {
|
|
35
|
+
return new ht_event_bot_keyword_model_1.HtEventBotKeywordModel(htEventProps, requestData);
|
|
36
|
+
}
|
|
37
|
+
if (htEventProps.event_type === types_1.EventName.handoffSuccess) {
|
|
38
|
+
return new ht_event_handoff_success_1.HtEventHandoffSuccess(htEventProps, requestData);
|
|
39
|
+
}
|
|
40
|
+
if (htEventProps.event_type === types_1.EventName.handoffFail) {
|
|
41
|
+
return new ht_event_handoff_fail_1.HtEventHandoffFail(htEventProps, requestData);
|
|
42
|
+
}
|
|
43
|
+
return new ht_event_1.HtEvent(htEventProps, requestData);
|
|
44
|
+
}
|
|
45
|
+
exports.createHtEvent = createHtEvent;
|
|
46
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AACjD,gFAAyE;AACzE,gFAAwE;AACxE,sEAA+D;AAC/D,0FAAkF;AAClF,4EAAqE;AACrE,oFAA6E;AAC7E,4EAAqE;AACrE,gFAAyE;AACzE,sFAA+E;AAC/E,mCAA8D;AAE9D,SAAgB,aAAa,CAC3B,WAAwB,EACxB,YAA0B;IAE1B,IAAI,YAAY,CAAC,UAAU,KAAK,iBAAS,CAAC,cAAc,EAAE;QACxD,OAAO,IAAI,0CAAkB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;KACzD;IACD,IAAI,YAAY,CAAC,UAAU,KAAK,iBAAS,CAAC,gBAAgB,EAAE;QAC1D,OAAO,IAAI,8CAAoB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;KAC3D;IACD,IAAI,YAAY,CAAC,UAAU,KAAK,iBAAS,CAAC,YAAY,EAAE;QACtD,OAAO,IAAI,sCAAgB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;KACvD;IACD,IAAI,YAAY,CAAC,UAAU,KAAK,iBAAS,CAAC,SAAS,EAAE;QACnD,OAAO,IAAI,sCAAgB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;KACvD;IACD,IAAI,YAAY,CAAC,UAAU,KAAK,iBAAS,CAAC,MAAM,EAAE;QAChD,OAAO,IAAI,gCAAa,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;KACpD;IACD,IAAI,YAAY,CAAC,UAAU,KAAK,iBAAS,CAAC,UAAU,EAAE;QACpD,OAAO,IAAI,yCAAiB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;KACxD;IACD,IAAI,YAAY,CAAC,UAAU,KAAK,iBAAS,CAAC,gBAAgB,EAAE;QAC1D,OAAO,IAAI,mDAAsB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;KAC7D;IACD,IAAI,YAAY,CAAC,UAAU,KAAK,iBAAS,CAAC,cAAc,EAAE;QACxD,OAAO,IAAI,gDAAqB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;KAC5D;IACD,IAAI,YAAY,CAAC,UAAU,KAAK,iBAAS,CAAC,WAAW,EAAE;QACrD,OAAO,IAAI,0CAAkB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;KACzD;IAED,OAAO,IAAI,kBAAO,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;AAC/C,CAAC;AAjCD,sCAiCC"}
|