@botonic/plugin-hubtype-analytics 0.27.0-alpha.0 → 0.27.0-alpha.2
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/cjs/event-models/ht-event-custom.d.ts +2 -1
- package/lib/cjs/event-models/ht-event-custom.js +2 -10
- package/lib/cjs/event-models/ht-event-custom.js.map +1 -1
- package/lib/cjs/event-models/ht-event-fallback.d.ts +3 -2
- package/lib/cjs/event-models/ht-event-fallback.js +3 -2
- package/lib/cjs/event-models/ht-event-fallback.js.map +1 -1
- package/lib/cjs/event-models/ht-event-feedback.d.ts +1 -2
- package/lib/cjs/event-models/ht-event-feedback.js +1 -2
- package/lib/cjs/event-models/ht-event-feedback.js.map +1 -1
- package/lib/cjs/event-models/ht-event-flow.d.ts +2 -2
- package/lib/cjs/event-models/ht-event-flow.js +1 -1
- package/lib/cjs/event-models/ht-event-handoff.d.ts +4 -4
- package/lib/cjs/event-models/ht-event-handoff.js +5 -4
- package/lib/cjs/event-models/ht-event-handoff.js.map +1 -1
- package/lib/cjs/event-models/ht-event-intent-smart.d.ts +1 -1
- package/lib/cjs/event-models/ht-event-intent-smart.js +1 -1
- package/lib/cjs/event-models/ht-event-intent.d.ts +1 -1
- package/lib/cjs/event-models/ht-event-intent.js +1 -1
- package/lib/cjs/event-models/ht-event-keyword.d.ts +1 -1
- package/lib/cjs/event-models/ht-event-keyword.js +1 -1
- package/lib/cjs/event-models/ht-event-knowledge-base.d.ts +3 -1
- package/lib/cjs/event-models/ht-event-knowledge-base.js +3 -1
- package/lib/cjs/event-models/ht-event-knowledge-base.js.map +1 -1
- package/lib/cjs/event-models/ht-event-webview.d.ts +2 -2
- package/lib/cjs/event-models/ht-event-webview.js +1 -1
- package/lib/cjs/event-models/ht-event.d.ts +0 -2
- package/lib/cjs/event-models/ht-event.js +0 -2
- package/lib/cjs/event-models/ht-event.js.map +1 -1
- package/lib/cjs/index.js +4 -6
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/types.d.ts +43 -38
- package/lib/cjs/types.js +25 -22
- package/lib/cjs/types.js.map +1 -1
- package/lib/cjs/utils.js +16 -16
- package/lib/cjs/utils.js.map +1 -1
- package/lib/esm/event-models/ht-event-custom.d.ts +2 -1
- package/lib/esm/event-models/ht-event-custom.js +3 -11
- package/lib/esm/event-models/ht-event-custom.js.map +1 -1
- package/lib/esm/event-models/ht-event-fallback.d.ts +3 -2
- package/lib/esm/event-models/ht-event-fallback.js +3 -2
- package/lib/esm/event-models/ht-event-fallback.js.map +1 -1
- package/lib/esm/event-models/ht-event-feedback.d.ts +1 -2
- package/lib/esm/event-models/ht-event-feedback.js +1 -2
- package/lib/esm/event-models/ht-event-feedback.js.map +1 -1
- package/lib/esm/event-models/ht-event-flow.d.ts +2 -2
- package/lib/esm/event-models/ht-event-flow.js +1 -1
- package/lib/esm/event-models/ht-event-handoff.d.ts +4 -4
- package/lib/esm/event-models/ht-event-handoff.js +5 -4
- package/lib/esm/event-models/ht-event-handoff.js.map +1 -1
- package/lib/esm/event-models/ht-event-intent-smart.d.ts +1 -1
- package/lib/esm/event-models/ht-event-intent-smart.js +1 -1
- package/lib/esm/event-models/ht-event-intent.d.ts +1 -1
- package/lib/esm/event-models/ht-event-intent.js +1 -1
- package/lib/esm/event-models/ht-event-keyword.d.ts +1 -1
- package/lib/esm/event-models/ht-event-keyword.js +1 -1
- package/lib/esm/event-models/ht-event-knowledge-base.d.ts +3 -1
- package/lib/esm/event-models/ht-event-knowledge-base.js +3 -1
- package/lib/esm/event-models/ht-event-knowledge-base.js.map +1 -1
- package/lib/esm/event-models/ht-event-webview.d.ts +2 -2
- package/lib/esm/event-models/ht-event-webview.js +1 -1
- package/lib/esm/event-models/ht-event.d.ts +0 -2
- package/lib/esm/event-models/ht-event.js +0 -2
- package/lib/esm/event-models/ht-event.js.map +1 -1
- package/lib/esm/index.js +4 -6
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/types.d.ts +43 -38
- package/lib/esm/types.js +24 -21
- package/lib/esm/types.js.map +1 -1
- package/lib/esm/utils.js +16 -16
- package/lib/esm/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/event-models/ht-event-custom.ts +5 -19
- package/src/event-models/ht-event-fallback.ts +6 -4
- package/src/event-models/ht-event-feedback.ts +5 -7
- package/src/event-models/ht-event-flow.ts +3 -3
- package/src/event-models/ht-event-handoff.ts +11 -10
- package/src/event-models/ht-event-intent-smart.ts +2 -2
- package/src/event-models/ht-event-intent.ts +2 -2
- package/src/event-models/ht-event-keyword.ts +2 -2
- package/src/event-models/ht-event-knowledge-base.ts +6 -2
- package/src/event-models/ht-event-webview.ts +3 -3
- package/src/event-models/ht-event.ts +0 -4
- package/src/index.ts +6 -6
- package/src/types.ts +49 -45
- package/src/utils.ts +16 -16
package/lib/esm/types.js
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
export var EventType;
|
|
2
2
|
(function (EventType) {
|
|
3
|
-
EventType["
|
|
4
|
-
EventType["
|
|
5
|
-
EventType["
|
|
3
|
+
EventType["Feedback"] = "feedback";
|
|
4
|
+
EventType["Botevent"] = "botevent";
|
|
5
|
+
EventType["Webevent"] = "webevent";
|
|
6
6
|
})(EventType || (EventType = {}));
|
|
7
7
|
export var EventAction;
|
|
8
8
|
(function (EventAction) {
|
|
9
|
-
EventAction["
|
|
10
|
-
EventAction["
|
|
11
|
-
EventAction["
|
|
12
|
-
EventAction["
|
|
13
|
-
EventAction["
|
|
14
|
-
EventAction["
|
|
15
|
-
EventAction["
|
|
16
|
-
EventAction["
|
|
17
|
-
EventAction["
|
|
18
|
-
EventAction["
|
|
19
|
-
EventAction["
|
|
20
|
-
EventAction["
|
|
21
|
-
EventAction["
|
|
22
|
-
EventAction["
|
|
23
|
-
EventAction["
|
|
24
|
-
EventAction["
|
|
25
|
-
EventAction["customWeb"] = "custom_web";
|
|
9
|
+
EventAction["FeedbackCase"] = "feedback_case";
|
|
10
|
+
EventAction["FeedbackMessage"] = "feddback_message";
|
|
11
|
+
EventAction["FeedbackConversation"] = "feddback_conversation";
|
|
12
|
+
EventAction["FeedbackWebview"] = "feddback_webview";
|
|
13
|
+
EventAction["FlowNode"] = "flow_node";
|
|
14
|
+
EventAction["HandoffOption"] = "handoff_option";
|
|
15
|
+
EventAction["HandoffSuccess"] = "handoff_success";
|
|
16
|
+
EventAction["HandoffFail"] = "handoff_fail";
|
|
17
|
+
EventAction["Keyword"] = "nlu_keyword";
|
|
18
|
+
EventAction["Intent"] = "nlu_intent";
|
|
19
|
+
EventAction["IntentSmart"] = "nlu_intent_smart";
|
|
20
|
+
EventAction["Knowledgebase"] = "knowledgebase";
|
|
21
|
+
EventAction["Fallback"] = "fallback";
|
|
22
|
+
EventAction["WebviewStep"] = "webview_step";
|
|
23
|
+
EventAction["WebviewEnd"] = "webview_end";
|
|
24
|
+
EventAction["Custom"] = "custom";
|
|
26
25
|
})(EventAction || (EventAction = {}));
|
|
27
|
-
export
|
|
26
|
+
export var KnowledgebaseFailReason;
|
|
27
|
+
(function (KnowledgebaseFailReason) {
|
|
28
|
+
KnowledgebaseFailReason["NoKnowledge"] = "no_knowledge";
|
|
29
|
+
KnowledgebaseFailReason["Hallucination"] = "hallucination";
|
|
30
|
+
})(KnowledgebaseFailReason || (KnowledgebaseFailReason = {}));
|
|
28
31
|
//# sourceMappingURL=types.js.map
|
package/lib/esm/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":"AAAA,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,kCAAqB,CAAA;IACrB,kCAAqB,CAAA;IACrB,kCAAqB,CAAA;AACvB,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAED,MAAM,CAAN,IAAY,WAiBX;AAjBD,WAAY,WAAW;IACrB,6CAA8B,CAAA;IAC9B,mDAAoC,CAAA;IACpC,6DAA8C,CAAA;IAC9C,mDAAoC,CAAA;IACpC,qCAAsB,CAAA;IACtB,+CAAgC,CAAA;IAChC,iDAAkC,CAAA;IAClC,2CAA4B,CAAA;IAC5B,sCAAuB,CAAA;IACvB,oCAAqB,CAAA;IACrB,+CAAgC,CAAA;IAChC,8CAA+B,CAAA;IAC/B,oCAAqB,CAAA;IACrB,2CAA4B,CAAA;IAC5B,yCAA0B,CAAA;IAC1B,gCAAiB,CAAA;AACnB,CAAC,EAjBW,WAAW,KAAX,WAAW,QAiBtB;AAwGD,MAAM,CAAN,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IACjC,uDAA4B,CAAA;IAC5B,0DAA+B,CAAA;AACjC,CAAC,EAHW,uBAAuB,KAAvB,uBAAuB,QAGlC"}
|
package/lib/esm/utils.js
CHANGED
|
@@ -2,31 +2,31 @@ import { HtEvent, HtEventCustom, HtEventFallback, HtEventFeedback, HtEventFlow,
|
|
|
2
2
|
import { EventAction } from './types';
|
|
3
3
|
export function createHtEvent(requestData, htEventProps) {
|
|
4
4
|
switch (htEventProps.action) {
|
|
5
|
-
case EventAction.
|
|
6
|
-
case EventAction.
|
|
7
|
-
case EventAction.
|
|
8
|
-
case EventAction.
|
|
5
|
+
case EventAction.FeedbackCase:
|
|
6
|
+
case EventAction.FeedbackConversation:
|
|
7
|
+
case EventAction.FeedbackMessage:
|
|
8
|
+
case EventAction.FeedbackWebview:
|
|
9
9
|
return new HtEventFeedback(htEventProps, requestData);
|
|
10
|
-
case EventAction.
|
|
10
|
+
case EventAction.FlowNode:
|
|
11
11
|
return new HtEventFlow(htEventProps, requestData);
|
|
12
|
-
case EventAction.
|
|
13
|
-
case EventAction.
|
|
14
|
-
case EventAction.
|
|
12
|
+
case EventAction.HandoffOption:
|
|
13
|
+
case EventAction.HandoffSuccess:
|
|
14
|
+
case EventAction.HandoffFail:
|
|
15
15
|
return new HtEventHandoff(htEventProps, requestData);
|
|
16
|
-
case EventAction.
|
|
16
|
+
case EventAction.Intent:
|
|
17
17
|
return new HtEventIntent(htEventProps, requestData);
|
|
18
|
-
case EventAction.
|
|
18
|
+
case EventAction.Keyword:
|
|
19
19
|
return new HtEventKeyword(htEventProps, requestData);
|
|
20
|
-
case EventAction.
|
|
20
|
+
case EventAction.IntentSmart:
|
|
21
21
|
return new HtEventIntentSmart(htEventProps, requestData);
|
|
22
|
-
case EventAction.
|
|
22
|
+
case EventAction.Knowledgebase:
|
|
23
23
|
return new HtEventKnowledgeBase(htEventProps, requestData);
|
|
24
|
-
case EventAction.
|
|
24
|
+
case EventAction.Fallback:
|
|
25
25
|
return new HtEventFallback(htEventProps, requestData);
|
|
26
|
-
case EventAction.
|
|
26
|
+
case EventAction.WebviewStep:
|
|
27
|
+
case EventAction.WebviewEnd:
|
|
27
28
|
return new HtEventWebview(htEventProps, requestData);
|
|
28
|
-
case EventAction.
|
|
29
|
-
case EventAction.customWeb:
|
|
29
|
+
case EventAction.Custom:
|
|
30
30
|
return new HtEventCustom(htEventProps, requestData);
|
|
31
31
|
default:
|
|
32
32
|
return new HtEvent(htEventProps, requestData);
|
package/lib/esm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,aAAa,EACb,eAAe,EACf,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,cAAc,GACf,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,WAAW,EAA6B,MAAM,SAAS,CAAA;AAEhE,MAAM,UAAU,aAAa,CAC3B,WAAwB,EACxB,YAA0B;IAE1B,QAAQ,YAAY,CAAC,MAAM,EAAE;QAC3B,KAAK,WAAW,CAAC,YAAY,CAAC;QAC9B,KAAK,WAAW,CAAC,oBAAoB,CAAC;QACtC,KAAK,WAAW,C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CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/plugin-hubtype-analytics",
|
|
3
|
-
"version": "0.27.0-alpha.
|
|
3
|
+
"version": "0.27.0-alpha.2",
|
|
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",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime": "^7.21.0",
|
|
17
|
-
"@botonic/core": "^0.27.0-alpha.
|
|
17
|
+
"@botonic/core": "^0.27.0-alpha.1",
|
|
18
18
|
"axios": "^1.6.8"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CUSTOM_PREFIX,
|
|
3
|
-
EventAction,
|
|
4
|
-
EventCustom,
|
|
5
|
-
EventType,
|
|
6
|
-
RequestData,
|
|
7
|
-
} from '../types'
|
|
1
|
+
import { EventAction, EventCustom, EventType, RequestData } from '../types'
|
|
8
2
|
import { HtEvent } from './ht-event'
|
|
9
3
|
|
|
10
4
|
interface EventDataCustom {
|
|
11
|
-
action: EventAction.
|
|
5
|
+
action: EventAction.Custom
|
|
6
|
+
custom_fields: Record<string, any>
|
|
12
7
|
}
|
|
13
8
|
|
|
14
9
|
export class HtEventCustom extends HtEvent {
|
|
@@ -16,16 +11,7 @@ export class HtEventCustom extends HtEvent {
|
|
|
16
11
|
|
|
17
12
|
constructor(event: EventCustom, requestData: RequestData) {
|
|
18
13
|
super(event, requestData)
|
|
19
|
-
this.type =
|
|
20
|
-
|
|
21
|
-
? EventType.botevent
|
|
22
|
-
: EventType.webevent
|
|
23
|
-
|
|
24
|
-
// Set in data with all attributs that start with 'custom_'
|
|
25
|
-
for (const key in event.data) {
|
|
26
|
-
if (key.startsWith(CUSTOM_PREFIX)) {
|
|
27
|
-
this.data[key] = event.data[key]
|
|
28
|
-
}
|
|
29
|
-
}
|
|
14
|
+
this.type = EventType.Webevent
|
|
15
|
+
this.data.custom_fields = event.data.customFields
|
|
30
16
|
}
|
|
31
17
|
}
|
|
@@ -2,8 +2,9 @@ import { EventAction, EventFallback, EventType, RequestData } from '../types'
|
|
|
2
2
|
import { HtEvent } from './ht-event'
|
|
3
3
|
|
|
4
4
|
interface EventDataFallback {
|
|
5
|
-
action: EventAction.
|
|
6
|
-
|
|
5
|
+
action: EventAction.Fallback
|
|
6
|
+
fallback_out: number
|
|
7
|
+
fallback_message_id: string
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export class HtEventFallback extends HtEvent {
|
|
@@ -11,7 +12,8 @@ export class HtEventFallback extends HtEvent {
|
|
|
11
12
|
|
|
12
13
|
constructor(event: EventFallback, requestData: RequestData) {
|
|
13
14
|
super(event, requestData)
|
|
14
|
-
this.type = EventType.
|
|
15
|
-
this.data.
|
|
15
|
+
this.type = EventType.Botevent
|
|
16
|
+
this.data.fallback_out = event.data.fallbackOut
|
|
17
|
+
this.data.fallback_message_id = event.data.fallbackMessageId
|
|
16
18
|
}
|
|
17
19
|
}
|
|
@@ -3,11 +3,10 @@ import { HtEvent } from './ht-event'
|
|
|
3
3
|
|
|
4
4
|
interface EventDataFeedback {
|
|
5
5
|
action:
|
|
6
|
-
| EventAction.
|
|
7
|
-
| EventAction.
|
|
8
|
-
| EventAction.
|
|
9
|
-
| EventAction.
|
|
10
|
-
message_generated_by?: string
|
|
6
|
+
| EventAction.FeedbackCase
|
|
7
|
+
| EventAction.FeedbackConversation
|
|
8
|
+
| EventAction.FeedbackMessage
|
|
9
|
+
| EventAction.FeedbackWebview
|
|
11
10
|
feedback_target_id?: string
|
|
12
11
|
feedback_group_id?: string
|
|
13
12
|
possible_options: string[]
|
|
@@ -21,8 +20,7 @@ export class HtEventFeedback extends HtEvent {
|
|
|
21
20
|
|
|
22
21
|
constructor(event: EventFeedback, requestData: RequestData) {
|
|
23
22
|
super(event, requestData)
|
|
24
|
-
this.type = EventType.
|
|
25
|
-
this.data.message_generated_by = event.data.messageGeneratedBy // ?? nomes te valor quan action es message. Si es message de knowledge base => sources y chunks. Quan es un node de flow builder => content_id
|
|
23
|
+
this.type = EventType.Feedback
|
|
26
24
|
this.data.feedback_target_id = event.data.feedbackTargetId // ?? case_id, message_id, conversation_id ???, webview_name
|
|
27
25
|
this.data.feedback_group_id = event.data.feedbackGroupId // ??
|
|
28
26
|
this.data.possible_options = event.data.possibleOptions
|
|
@@ -2,13 +2,13 @@ import { EventAction, EventFlow, EventType, RequestData } from '../types'
|
|
|
2
2
|
import { HtEvent } from './ht-event'
|
|
3
3
|
|
|
4
4
|
interface EventDataFlow {
|
|
5
|
-
action: EventAction.
|
|
5
|
+
action: EventAction.FlowNode
|
|
6
6
|
flow_thread_id: string
|
|
7
7
|
flow_id: string
|
|
8
8
|
flow_name: string
|
|
9
9
|
flow_node_id: string
|
|
10
10
|
flow_node_content_id: string
|
|
11
|
-
flow_node_is_meaningful
|
|
11
|
+
flow_node_is_meaningful: boolean
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export class HtEventFlow extends HtEvent {
|
|
@@ -16,7 +16,7 @@ export class HtEventFlow extends HtEvent {
|
|
|
16
16
|
|
|
17
17
|
constructor(event: EventFlow, requestData: RequestData) {
|
|
18
18
|
super(event, requestData)
|
|
19
|
-
this.type = EventType.
|
|
19
|
+
this.type = EventType.Botevent
|
|
20
20
|
this.data.flow_thread_id = event.data.flowThreadId // This value is managed by the flow builder plugin, stored in the session and updated every time the content connected to the conversation start is displayed
|
|
21
21
|
this.data.flow_id = event.data.flowId
|
|
22
22
|
this.data.flow_name = event.data.flowName
|
|
@@ -3,15 +3,15 @@ import { HtEvent } from './ht-event'
|
|
|
3
3
|
|
|
4
4
|
interface EventDataHandoff {
|
|
5
5
|
action:
|
|
6
|
-
| EventAction.
|
|
7
|
-
| EventAction.
|
|
8
|
-
| EventAction.
|
|
6
|
+
| EventAction.HandoffOption
|
|
7
|
+
| EventAction.HandoffSuccess
|
|
8
|
+
| EventAction.HandoffFail
|
|
9
9
|
handoff_queue_id: string
|
|
10
10
|
handoff_queue_name: string
|
|
11
11
|
handoff_case_id?: string
|
|
12
|
-
is_queue_open
|
|
13
|
-
handoff_is_available_agent
|
|
14
|
-
handoff_is_threshold_reached
|
|
12
|
+
is_queue_open: boolean
|
|
13
|
+
handoff_is_available_agent: boolean
|
|
14
|
+
handoff_is_threshold_reached: boolean
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export class HtEventHandoff extends HtEvent {
|
|
@@ -19,12 +19,13 @@ export class HtEventHandoff extends HtEvent {
|
|
|
19
19
|
|
|
20
20
|
constructor(event: EventHandoff, requestData: RequestData) {
|
|
21
21
|
super(event, requestData)
|
|
22
|
-
this.type = EventType.
|
|
22
|
+
this.type = EventType.Botevent
|
|
23
23
|
this.data.handoff_queue_id = event.data.queueId
|
|
24
24
|
this.data.handoff_queue_name = event.data.queueName
|
|
25
25
|
this.data.handoff_case_id = event.data.caseId
|
|
26
|
-
this.data.is_queue_open = event.data.isQueueOpen
|
|
27
|
-
this.data.handoff_is_available_agent = event.data.isAvailableAgent
|
|
28
|
-
this.data.handoff_is_threshold_reached =
|
|
26
|
+
this.data.is_queue_open = event.data.isQueueOpen || false
|
|
27
|
+
this.data.handoff_is_available_agent = event.data.isAvailableAgent || false
|
|
28
|
+
this.data.handoff_is_threshold_reached =
|
|
29
|
+
event.data.isThresholdReached || false
|
|
29
30
|
}
|
|
30
31
|
}
|
|
@@ -2,7 +2,7 @@ import { EventAction, EventIntentSmart, EventType, RequestData } from '../types'
|
|
|
2
2
|
import { HtEvent } from './ht-event'
|
|
3
3
|
|
|
4
4
|
interface EventDataIntentSmart {
|
|
5
|
-
action: EventAction.
|
|
5
|
+
action: EventAction.IntentSmart
|
|
6
6
|
nlu_intent_smart_title: string
|
|
7
7
|
nlu_intent_smart_num_used: number
|
|
8
8
|
nlu_intent_smart_message_id: string
|
|
@@ -13,7 +13,7 @@ export class HtEventIntentSmart extends HtEvent {
|
|
|
13
13
|
|
|
14
14
|
constructor(event: EventIntentSmart, requestData: RequestData) {
|
|
15
15
|
super(event, requestData)
|
|
16
|
-
this.type = EventType.
|
|
16
|
+
this.type = EventType.Botevent
|
|
17
17
|
this.data.nlu_intent_smart_title = event.data.nluIntentSmartTitle
|
|
18
18
|
this.data.nlu_intent_smart_num_used = event.data.nluIntentSmartNumUsed
|
|
19
19
|
this.data.nlu_intent_smart_message_id = event.data.nluIntentSmartMessageId
|
|
@@ -2,7 +2,7 @@ import { EventAction, EventIntent, EventType, RequestData } from '../types'
|
|
|
2
2
|
import { HtEvent } from './ht-event'
|
|
3
3
|
|
|
4
4
|
interface EventDataIntent {
|
|
5
|
-
action: EventAction.
|
|
5
|
+
action: EventAction.Intent
|
|
6
6
|
nlu_intent_label: string
|
|
7
7
|
nlu_intent_confidence: number
|
|
8
8
|
nlu_intent_threshold: number
|
|
@@ -14,7 +14,7 @@ export class HtEventIntent extends HtEvent {
|
|
|
14
14
|
|
|
15
15
|
constructor(event: EventIntent, requestData: RequestData) {
|
|
16
16
|
super(event, requestData)
|
|
17
|
-
this.type = EventType.
|
|
17
|
+
this.type = EventType.Botevent
|
|
18
18
|
this.data.nlu_intent_label = event.data.nluIntentLabel
|
|
19
19
|
this.data.nlu_intent_confidence = event.data.nluIntentConfidence
|
|
20
20
|
this.data.nlu_intent_threshold = event.data.nluIntentThreshold
|
|
@@ -2,7 +2,7 @@ import { EventAction, EventKeyword, EventType, RequestData } from '../types'
|
|
|
2
2
|
import { HtEvent } from './ht-event'
|
|
3
3
|
|
|
4
4
|
interface EventDataKeyword {
|
|
5
|
-
action: EventAction.
|
|
5
|
+
action: EventAction.Keyword
|
|
6
6
|
nlu_keyword_id: string
|
|
7
7
|
nlu_keyword_name: string
|
|
8
8
|
nlu_keyword_is_regex: boolean
|
|
@@ -14,7 +14,7 @@ export class HtEventKeyword extends HtEvent {
|
|
|
14
14
|
|
|
15
15
|
constructor(event: EventKeyword, requestData: RequestData) {
|
|
16
16
|
super(event, requestData)
|
|
17
|
-
this.type = EventType.
|
|
17
|
+
this.type = EventType.Botevent
|
|
18
18
|
this.data.nlu_keyword_id = event.data.nluKeywordId
|
|
19
19
|
this.data.nlu_keyword_name = event.data.nluKeywordName
|
|
20
20
|
this.data.nlu_keyword_is_regex = event.data.nluKeywordIsRegex || false
|
|
@@ -7,10 +7,12 @@ import {
|
|
|
7
7
|
import { HtEvent } from './ht-event'
|
|
8
8
|
|
|
9
9
|
interface EventDataKnowledgeBase {
|
|
10
|
-
action: EventAction.
|
|
10
|
+
action: EventAction.Knowledgebase
|
|
11
|
+
knowledgebase_inference_id: string
|
|
11
12
|
knowledgebase_fail_reason?: string
|
|
12
13
|
knowledgebase_sources_ids: string[]
|
|
13
14
|
knowledgebase_chunks_ids: string[]
|
|
15
|
+
knowledgebase_message_id: string
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export class HtEventKnowledgeBase extends HtEvent {
|
|
@@ -18,9 +20,11 @@ export class HtEventKnowledgeBase extends HtEvent {
|
|
|
18
20
|
|
|
19
21
|
constructor(event: EventKnowledgeBase, requestData: RequestData) {
|
|
20
22
|
super(event, requestData)
|
|
21
|
-
this.type = EventType.
|
|
23
|
+
this.type = EventType.Botevent
|
|
24
|
+
this.data.knowledgebase_inference_id = event.data.knowledgebaseInferenceId
|
|
22
25
|
this.data.knowledgebase_fail_reason = event.data.knowledgebaseFailReason
|
|
23
26
|
this.data.knowledgebase_sources_ids = event.data.knowledgebaseSourcesIds
|
|
24
27
|
this.data.knowledgebase_chunks_ids = event.data.knowledgebaseChunksIds
|
|
28
|
+
this.data.knowledgebase_message_id = event.data.knowledgebaseMessageId
|
|
25
29
|
}
|
|
26
30
|
}
|
|
@@ -2,10 +2,10 @@ import { EventAction, EventType, EventWebview, RequestData } from '../types'
|
|
|
2
2
|
import { HtEvent } from './ht-event'
|
|
3
3
|
|
|
4
4
|
interface EventDataWebview {
|
|
5
|
-
action: EventAction.
|
|
5
|
+
action: EventAction.WebviewStep | EventAction.WebviewEnd
|
|
6
6
|
webview_thread_id: string
|
|
7
7
|
webview_name: string
|
|
8
|
-
webview_step_name
|
|
8
|
+
webview_step_name?: string
|
|
9
9
|
webview_end_fail_type?: string
|
|
10
10
|
webview_end_fail_message?: string
|
|
11
11
|
}
|
|
@@ -15,7 +15,7 @@ export class HtEventWebview extends HtEvent {
|
|
|
15
15
|
|
|
16
16
|
constructor(event: EventWebview, requestData: RequestData) {
|
|
17
17
|
super(event, requestData)
|
|
18
|
-
this.type = EventType.
|
|
18
|
+
this.type = EventType.Webevent
|
|
19
19
|
this.data.webview_thread_id = event.data.webviewThreadId
|
|
20
20
|
this.data.webview_name = event.data.webviewName
|
|
21
21
|
this.data.webview_step_name = event.data.webviewStepName
|
|
@@ -3,8 +3,6 @@ import { EventType, HtEventProps, RequestData } from '../types'
|
|
|
3
3
|
export class HtEvent {
|
|
4
4
|
chat_id: string
|
|
5
5
|
type: EventType
|
|
6
|
-
channel: string
|
|
7
|
-
created_at: string
|
|
8
6
|
chat_language: string
|
|
9
7
|
chat_country?: string
|
|
10
8
|
format_version?: number
|
|
@@ -14,8 +12,6 @@ export class HtEvent {
|
|
|
14
12
|
|
|
15
13
|
constructor(event: HtEventProps, requestData: RequestData) {
|
|
16
14
|
this.chat_id = requestData.userId
|
|
17
|
-
this.channel = requestData.provider
|
|
18
|
-
this.created_at = new Date().toISOString()
|
|
19
15
|
this.chat_language = requestData.language
|
|
20
16
|
this.chat_country = requestData.country
|
|
21
17
|
this.format_version = 2
|
package/src/index.ts
CHANGED
|
@@ -33,17 +33,16 @@ export default class BotonicPluginHubtypeAnalytics implements Plugin {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
getUrl(request: BotRequest, eventType: EventType) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return `${this.baseUrl}/external/v2/conversational_apps/${
|
|
36
|
+
const endpoint =
|
|
37
|
+
eventType === EventType.Botevent ? 'bot_event' : 'web_event'
|
|
38
|
+
const botId = request.session.bot.id
|
|
39
|
+
return `${this.baseUrl}/external/v2/conversational_apps/${botId}/${endpoint}/`
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
getRequestData(request: BotRequest): RequestData {
|
|
43
43
|
return {
|
|
44
44
|
language: this.getLanguage(request),
|
|
45
45
|
country: this.getCountry(request),
|
|
46
|
-
provider: request.session.user.provider,
|
|
47
46
|
userId: request.session.user.id,
|
|
48
47
|
}
|
|
49
48
|
}
|
|
@@ -58,7 +57,8 @@ export default class BotonicPluginHubtypeAnalytics implements Plugin {
|
|
|
58
57
|
private sendEvent(request: BotRequest, event: HtEvent) {
|
|
59
58
|
const url = this.getUrl(request, event.type)
|
|
60
59
|
const headers = { Authorization: `Bearer ${request.session._access_token}` }
|
|
61
|
-
const config = event.type !== EventType.
|
|
60
|
+
const config = event.type !== EventType.Webevent ? { headers } : undefined
|
|
61
|
+
|
|
62
62
|
return axios.post(url, event, config)
|
|
63
63
|
}
|
|
64
64
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
import { PROVIDER } from '@botonic/core'
|
|
2
|
-
|
|
3
1
|
export enum EventType {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
Feedback = 'feedback',
|
|
3
|
+
Botevent = 'botevent',
|
|
4
|
+
Webevent = 'webevent',
|
|
7
5
|
}
|
|
8
6
|
|
|
9
7
|
export enum EventAction {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
customWeb = 'custom_web', // Custom event for web
|
|
8
|
+
FeedbackCase = 'feedback_case',
|
|
9
|
+
FeedbackMessage = 'feddback_message',
|
|
10
|
+
FeedbackConversation = 'feddback_conversation',
|
|
11
|
+
FeedbackWebview = 'feddback_webview',
|
|
12
|
+
FlowNode = 'flow_node',
|
|
13
|
+
HandoffOption = 'handoff_option',
|
|
14
|
+
HandoffSuccess = 'handoff_success',
|
|
15
|
+
HandoffFail = 'handoff_fail',
|
|
16
|
+
Keyword = 'nlu_keyword',
|
|
17
|
+
Intent = 'nlu_intent',
|
|
18
|
+
IntentSmart = 'nlu_intent_smart',
|
|
19
|
+
Knowledgebase = 'knowledgebase',
|
|
20
|
+
Fallback = 'fallback',
|
|
21
|
+
WebviewStep = 'webview_step',
|
|
22
|
+
WebviewEnd = 'webview_end',
|
|
23
|
+
Custom = 'custom',
|
|
27
24
|
}
|
|
28
25
|
|
|
29
26
|
export interface HtBaseEventProps {
|
|
@@ -32,10 +29,10 @@ export interface HtBaseEventProps {
|
|
|
32
29
|
|
|
33
30
|
export interface EventFeedback extends HtBaseEventProps {
|
|
34
31
|
action:
|
|
35
|
-
| EventAction.
|
|
36
|
-
| EventAction.
|
|
37
|
-
| EventAction.
|
|
38
|
-
| EventAction.
|
|
32
|
+
| EventAction.FeedbackCase
|
|
33
|
+
| EventAction.FeedbackConversation
|
|
34
|
+
| EventAction.FeedbackMessage
|
|
35
|
+
| EventAction.FeedbackWebview
|
|
39
36
|
data: EventPropsFeedback
|
|
40
37
|
}
|
|
41
38
|
|
|
@@ -50,7 +47,7 @@ export interface EventPropsFeedback {
|
|
|
50
47
|
}
|
|
51
48
|
|
|
52
49
|
export interface EventFlow extends HtBaseEventProps {
|
|
53
|
-
action: EventAction.
|
|
50
|
+
action: EventAction.FlowNode
|
|
54
51
|
data: EventPropsFlow
|
|
55
52
|
}
|
|
56
53
|
|
|
@@ -65,9 +62,9 @@ export interface EventPropsFlow {
|
|
|
65
62
|
|
|
66
63
|
export interface EventHandoff extends HtBaseEventProps {
|
|
67
64
|
action:
|
|
68
|
-
| EventAction.
|
|
69
|
-
| EventAction.
|
|
70
|
-
| EventAction.
|
|
65
|
+
| EventAction.HandoffOption
|
|
66
|
+
| EventAction.HandoffSuccess
|
|
67
|
+
| EventAction.HandoffFail
|
|
71
68
|
data: EventPropsHandoff
|
|
72
69
|
}
|
|
73
70
|
|
|
@@ -81,7 +78,7 @@ export interface EventPropsHandoff {
|
|
|
81
78
|
}
|
|
82
79
|
|
|
83
80
|
export interface EventIntent extends HtBaseEventProps {
|
|
84
|
-
action: EventAction.
|
|
81
|
+
action: EventAction.Intent
|
|
85
82
|
data: EventPropsIntent
|
|
86
83
|
}
|
|
87
84
|
|
|
@@ -93,7 +90,7 @@ export interface EventPropsIntent {
|
|
|
93
90
|
}
|
|
94
91
|
|
|
95
92
|
export interface EventKeyword extends HtBaseEventProps {
|
|
96
|
-
action: EventAction.
|
|
93
|
+
action: EventAction.Keyword
|
|
97
94
|
data: EventPropsKeyword
|
|
98
95
|
}
|
|
99
96
|
|
|
@@ -105,7 +102,7 @@ export interface EventPropsKeyword {
|
|
|
105
102
|
}
|
|
106
103
|
|
|
107
104
|
export interface EventIntentSmart extends HtBaseEventProps {
|
|
108
|
-
action: EventAction.
|
|
105
|
+
action: EventAction.IntentSmart
|
|
109
106
|
data: EventPropsIntentSmart
|
|
110
107
|
}
|
|
111
108
|
|
|
@@ -116,46 +113,54 @@ export interface EventPropsIntentSmart {
|
|
|
116
113
|
}
|
|
117
114
|
|
|
118
115
|
export interface EventKnowledgeBase extends HtBaseEventProps {
|
|
119
|
-
action: EventAction.
|
|
116
|
+
action: EventAction.Knowledgebase
|
|
120
117
|
data: EventPropsKnowledgeBase
|
|
121
118
|
}
|
|
122
119
|
|
|
123
120
|
export interface EventPropsKnowledgeBase {
|
|
124
|
-
|
|
121
|
+
knowledgebaseInferenceId: string
|
|
122
|
+
knowledgebaseFailReason?: KnowledgebaseFailReason
|
|
125
123
|
knowledgebaseSourcesIds: string[]
|
|
126
124
|
knowledgebaseChunksIds: string[]
|
|
125
|
+
knowledgebaseMessageId: string
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export enum KnowledgebaseFailReason {
|
|
129
|
+
NoKnowledge = 'no_knowledge',
|
|
130
|
+
Hallucination = 'hallucination',
|
|
127
131
|
}
|
|
128
132
|
|
|
129
133
|
export interface EventFallback extends HtBaseEventProps {
|
|
130
|
-
action: EventAction.
|
|
134
|
+
action: EventAction.Fallback
|
|
131
135
|
data: EventPropsFallbackBase
|
|
132
136
|
}
|
|
133
137
|
|
|
134
138
|
export interface EventPropsFallbackBase {
|
|
135
|
-
|
|
139
|
+
fallbackOut: number
|
|
140
|
+
fallbackMessageId: string
|
|
136
141
|
}
|
|
137
142
|
|
|
138
143
|
export interface EventWebview extends HtBaseEventProps {
|
|
139
|
-
action: EventAction.
|
|
144
|
+
action: EventAction.WebviewStep | EventAction.WebviewEnd
|
|
140
145
|
data: EventPropsWebview
|
|
141
146
|
}
|
|
142
147
|
|
|
143
148
|
export interface EventPropsWebview {
|
|
144
149
|
webviewThreadId: string
|
|
145
150
|
webviewName: string
|
|
146
|
-
webviewStepName
|
|
151
|
+
webviewStepName?: string
|
|
147
152
|
webviewEndFailType?: string
|
|
148
153
|
webviewEndFailMessage?: string
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
export interface EventCustom extends HtBaseEventProps {
|
|
152
|
-
action: EventAction.
|
|
153
|
-
data:
|
|
157
|
+
action: EventAction.Custom
|
|
158
|
+
data: EventPropsCustom
|
|
154
159
|
}
|
|
155
160
|
|
|
156
|
-
export
|
|
157
|
-
|
|
158
|
-
|
|
161
|
+
export interface EventPropsCustom {
|
|
162
|
+
customFields: Record<string, any>
|
|
163
|
+
}
|
|
159
164
|
|
|
160
165
|
export type HtEventProps =
|
|
161
166
|
| EventFeedback
|
|
@@ -172,6 +177,5 @@ export type HtEventProps =
|
|
|
172
177
|
export interface RequestData {
|
|
173
178
|
language: string
|
|
174
179
|
country: string
|
|
175
|
-
provider: PROVIDER
|
|
176
180
|
userId: string
|
|
177
181
|
}
|