@botonic/plugin-hubtype-analytics 0.55.0 → 0.57.0-rslib-esm.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.
- package/lib/esm/event-models/ht-event-ai-agent-router.d.ts +2 -2
- package/lib/esm/event-models/ht-event-ai-agent-router.js +26 -12
- package/lib/esm/event-models/ht-event-ai-agent-router.js.map +1 -1
- package/lib/esm/event-models/ht-event-ai-agent.d.ts +2 -2
- package/lib/esm/event-models/ht-event-ai-agent.js +46 -35
- package/lib/esm/event-models/ht-event-ai-agent.js.map +1 -1
- package/lib/esm/event-models/ht-event-bot-action.d.ts +2 -2
- package/lib/esm/event-models/ht-event-bot-action.js +26 -11
- package/lib/esm/event-models/ht-event-bot-action.js.map +1 -1
- package/lib/esm/event-models/ht-event-capture-user-input.d.ts +2 -2
- package/lib/esm/event-models/ht-event-capture-user-input.js +26 -11
- package/lib/esm/event-models/ht-event-capture-user-input.js.map +1 -1
- package/lib/esm/event-models/ht-event-conditional-channel.d.ts +2 -2
- package/lib/esm/event-models/ht-event-conditional-channel.js +26 -11
- package/lib/esm/event-models/ht-event-conditional-channel.js.map +1 -1
- package/lib/esm/event-models/ht-event-conditional-country.d.ts +2 -2
- package/lib/esm/event-models/ht-event-conditional-country.js +26 -11
- package/lib/esm/event-models/ht-event-conditional-country.js.map +1 -1
- package/lib/esm/event-models/ht-event-conditional-custom.d.ts +2 -2
- package/lib/esm/event-models/ht-event-conditional-custom.js +26 -11
- package/lib/esm/event-models/ht-event-conditional-custom.js.map +1 -1
- package/lib/esm/event-models/ht-event-conditional-queue-status.d.ts +2 -2
- package/lib/esm/event-models/ht-event-conditional-queue-status.js +26 -11
- package/lib/esm/event-models/ht-event-conditional-queue-status.js.map +1 -1
- package/lib/esm/event-models/ht-event-custom.d.ts +2 -2
- package/lib/esm/event-models/ht-event-custom.js +26 -11
- package/lib/esm/event-models/ht-event-custom.js.map +1 -1
- package/lib/esm/event-models/ht-event-fallback.d.ts +2 -2
- package/lib/esm/event-models/ht-event-fallback.js +26 -11
- package/lib/esm/event-models/ht-event-fallback.js.map +1 -1
- package/lib/esm/event-models/ht-event-feedback.d.ts +2 -2
- package/lib/esm/event-models/ht-event-feedback.js +25 -10
- 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 +26 -11
- package/lib/esm/event-models/ht-event-flow.js.map +1 -1
- package/lib/esm/event-models/ht-event-handoff-option.d.ts +2 -2
- package/lib/esm/event-models/ht-event-handoff-option.js +25 -10
- package/lib/esm/event-models/ht-event-handoff-option.js.map +1 -1
- package/lib/esm/event-models/ht-event-handoff.d.ts +2 -2
- package/lib/esm/event-models/ht-event-handoff.js +25 -10
- package/lib/esm/event-models/ht-event-handoff.js.map +1 -1
- package/lib/esm/event-models/ht-event-intent-smart.d.ts +2 -2
- package/lib/esm/event-models/ht-event-intent-smart.js +26 -11
- package/lib/esm/event-models/ht-event-intent-smart.js.map +1 -1
- package/lib/esm/event-models/ht-event-keyword.d.ts +2 -2
- package/lib/esm/event-models/ht-event-keyword.js +26 -11
- package/lib/esm/event-models/ht-event-keyword.js.map +1 -1
- package/lib/esm/event-models/ht-event-redirect-flow.d.ts +2 -2
- package/lib/esm/event-models/ht-event-redirect-flow.js +26 -11
- package/lib/esm/event-models/ht-event-redirect-flow.js.map +1 -1
- package/lib/esm/event-models/ht-event-webview-action-triggered.d.ts +2 -2
- package/lib/esm/event-models/ht-event-webview-action-triggered.js +26 -11
- package/lib/esm/event-models/ht-event-webview-action-triggered.js.map +1 -1
- package/lib/esm/event-models/ht-event-webview-end.d.ts +2 -2
- package/lib/esm/event-models/ht-event-webview-end.js +25 -10
- package/lib/esm/event-models/ht-event-webview-end.js.map +1 -1
- package/lib/esm/event-models/ht-event-webview-step.d.ts +2 -2
- package/lib/esm/event-models/ht-event-webview-step.js +25 -10
- package/lib/esm/event-models/ht-event-webview-step.js.map +1 -1
- package/lib/esm/event-models/ht-event.d.ts +1 -1
- package/lib/esm/event-models/ht-event.js +30 -8
- package/lib/esm/event-models/ht-event.js.map +1 -1
- package/lib/esm/event-models/index.d.ts +20 -20
- package/lib/esm/event-models/index.js +62 -43
- package/lib/esm/event-models/index.js.map +1 -1
- package/lib/esm/index.d.ts +4 -5
- package/lib/esm/index.js +45 -22
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/esm/types.d.ts +2 -2
- package/lib/esm/types.js +10 -9
- package/lib/esm/types.js.map +1 -1
- package/lib/esm/utils.d.ts +2 -2
- package/lib/esm/utils.js +59 -53
- package/lib/esm/utils.js.map +1 -1
- package/package.json +8 -7
- package/src/types.ts +40 -40
- package/lib/cjs/event-models/ht-event-ai-agent-router.d.ts +0 -21
- package/lib/cjs/event-models/ht-event-ai-agent-router.js +0 -31
- package/lib/cjs/event-models/ht-event-ai-agent-router.js.map +0 -1
- package/lib/cjs/event-models/ht-event-ai-agent.d.ts +0 -28
- package/lib/cjs/event-models/ht-event-ai-agent.js +0 -55
- package/lib/cjs/event-models/ht-event-ai-agent.js.map +0 -1
- package/lib/cjs/event-models/ht-event-bot-action.d.ts +0 -12
- package/lib/cjs/event-models/ht-event-bot-action.js +0 -21
- package/lib/cjs/event-models/ht-event-bot-action.js.map +0 -1
- package/lib/cjs/event-models/ht-event-capture-user-input.d.ts +0 -15
- package/lib/cjs/event-models/ht-event-capture-user-input.js +0 -24
- package/lib/cjs/event-models/ht-event-capture-user-input.js.map +0 -1
- package/lib/cjs/event-models/ht-event-conditional-channel.d.ts +0 -12
- package/lib/cjs/event-models/ht-event-conditional-channel.js +0 -21
- package/lib/cjs/event-models/ht-event-conditional-channel.js.map +0 -1
- package/lib/cjs/event-models/ht-event-conditional-country.d.ts +0 -12
- package/lib/cjs/event-models/ht-event-conditional-country.js +0 -21
- package/lib/cjs/event-models/ht-event-conditional-country.js.map +0 -1
- package/lib/cjs/event-models/ht-event-conditional-custom.d.ts +0 -14
- package/lib/cjs/event-models/ht-event-conditional-custom.js +0 -23
- package/lib/cjs/event-models/ht-event-conditional-custom.js.map +0 -1
- package/lib/cjs/event-models/ht-event-conditional-queue-status.d.ts +0 -15
- package/lib/cjs/event-models/ht-event-conditional-queue-status.js +0 -24
- package/lib/cjs/event-models/ht-event-conditional-queue-status.js.map +0 -1
- package/lib/cjs/event-models/ht-event-custom.d.ts +0 -7
- package/lib/cjs/event-models/ht-event-custom.js +0 -16
- package/lib/cjs/event-models/ht-event-custom.js.map +0 -1
- package/lib/cjs/event-models/ht-event-fallback.d.ts +0 -12
- package/lib/cjs/event-models/ht-event-fallback.js +0 -21
- package/lib/cjs/event-models/ht-event-fallback.js.map +0 -1
- package/lib/cjs/event-models/ht-event-feedback.d.ts +0 -13
- package/lib/cjs/event-models/ht-event-feedback.js +0 -21
- package/lib/cjs/event-models/ht-event-feedback.js.map +0 -1
- package/lib/cjs/event-models/ht-event-flow.d.ts +0 -11
- package/lib/cjs/event-models/ht-event-flow.js +0 -20
- package/lib/cjs/event-models/ht-event-flow.js.map +0 -1
- package/lib/cjs/event-models/ht-event-handoff-option.d.ts +0 -13
- package/lib/cjs/event-models/ht-event-handoff-option.js +0 -20
- package/lib/cjs/event-models/ht-event-handoff-option.js.map +0 -1
- package/lib/cjs/event-models/ht-event-handoff.d.ts +0 -17
- package/lib/cjs/event-models/ht-event-handoff.js +0 -25
- package/lib/cjs/event-models/ht-event-handoff.js.map +0 -1
- package/lib/cjs/event-models/ht-event-intent-smart.d.ts +0 -14
- package/lib/cjs/event-models/ht-event-intent-smart.js +0 -23
- package/lib/cjs/event-models/ht-event-intent-smart.js.map +0 -1
- package/lib/cjs/event-models/ht-event-keyword.d.ts +0 -14
- package/lib/cjs/event-models/ht-event-keyword.js +0 -23
- package/lib/cjs/event-models/ht-event-keyword.js.map +0 -1
- package/lib/cjs/event-models/ht-event-redirect-flow.d.ts +0 -14
- package/lib/cjs/event-models/ht-event-redirect-flow.js +0 -22
- package/lib/cjs/event-models/ht-event-redirect-flow.js.map +0 -1
- package/lib/cjs/event-models/ht-event-webview-action-triggered.d.ts +0 -14
- package/lib/cjs/event-models/ht-event-webview-action-triggered.js +0 -23
- package/lib/cjs/event-models/ht-event-webview-action-triggered.js.map +0 -1
- package/lib/cjs/event-models/ht-event-webview-end.d.ts +0 -13
- package/lib/cjs/event-models/ht-event-webview-end.js +0 -21
- package/lib/cjs/event-models/ht-event-webview-end.js.map +0 -1
- package/lib/cjs/event-models/ht-event-webview-step.d.ts +0 -11
- package/lib/cjs/event-models/ht-event-webview-step.js +0 -19
- package/lib/cjs/event-models/ht-event-webview-step.js.map +0 -1
- package/lib/cjs/event-models/ht-event.d.ts +0 -14
- package/lib/cjs/event-models/ht-event.js +0 -18
- package/lib/cjs/event-models/ht-event.js.map +0 -1
- package/lib/cjs/event-models/index.d.ts +0 -20
- package/lib/cjs/event-models/index.js +0 -44
- package/lib/cjs/event-models/index.js.map +0 -1
- package/lib/cjs/index.d.ts +0 -17
- package/lib/cjs/index.js +0 -70
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/types.d.ts +0 -14
- package/lib/cjs/types.js +0 -12
- package/lib/cjs/types.js.map +0 -1
- package/lib/cjs/utils.d.ts +0 -3
- package/lib/cjs/utils.js +0 -58
- package/lib/cjs/utils.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type EventWebviewActionTriggered, type RequestData } from '../types';
|
|
2
|
-
import { HtEvent } from './ht-event';
|
|
1
|
+
import { type EventWebviewActionTriggered, type RequestData } from '../types.js';
|
|
2
|
+
import { HtEvent } from './ht-event.js';
|
|
3
3
|
export declare class HtEventWebviewActionTriggered extends HtEvent {
|
|
4
4
|
flow_thread_id: string;
|
|
5
5
|
flow_id: string;
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { EventAction, EventType } from "../types.js";
|
|
2
|
+
import { HtEvent } from "./ht-event.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function _define_property(obj, key, value) {
|
|
7
|
+
if (key in obj) {
|
|
8
|
+
Object.defineProperty(obj, key, {
|
|
9
|
+
value: value,
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true
|
|
13
|
+
});
|
|
14
|
+
} else obj[key] = value;
|
|
15
|
+
return obj;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class HtEventWebviewActionTriggered extends HtEvent {
|
|
20
|
+
constructor(event, requestData){
|
|
21
|
+
super(event, requestData), _define_property(this, "flow_thread_id", void 0), _define_property(this, "flow_id", void 0), _define_property(this, "flow_name", void 0), _define_property(this, "flow_node_id", void 0), _define_property(this, "flow_node_content_id", void 0), _define_property(this, "flow_node_is_meaningful", void 0), _define_property(this, "webview_name", void 0), _define_property(this, "webview_target_id", void 0), _define_property(this, "webview_params", void 0);
|
|
22
|
+
this.type = EventType.BotEvent;
|
|
23
|
+
this.action = EventAction.WebviewActionTriggered;
|
|
11
24
|
this.flow_thread_id = event.flowThreadId;
|
|
12
25
|
this.flow_id = event.flowId;
|
|
13
26
|
this.flow_name = event.flowName;
|
|
@@ -19,5 +32,7 @@ class HtEventWebviewActionTriggered extends ht_event_1.HtEvent {
|
|
|
19
32
|
this.webview_params = event.webviewParams;
|
|
20
33
|
}
|
|
21
34
|
}
|
|
22
|
-
|
|
35
|
+
|
|
36
|
+
export { HtEventWebviewActionTriggered };
|
|
37
|
+
|
|
23
38
|
//# sourceMappingURL=ht-event-webview-action-triggered.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ht-event-webview-action-triggered.js","
|
|
1
|
+
{"version":3,"file":"event-models/ht-event-webview-action-triggered.js","sources":["../../../src/event-models/ht-event-webview-action-triggered.ts"],"sourcesContent":["import {\n EventAction,\n EventType,\n type EventWebviewActionTriggered,\n type RequestData,\n} from '../types'\nimport { HtEvent } from './ht-event'\n\nexport class HtEventWebviewActionTriggered extends HtEvent {\n flow_thread_id: string\n flow_id: string\n flow_name: string\n flow_node_id: string\n flow_node_content_id: string\n flow_node_is_meaningful: boolean\n webview_name: string\n webview_target_id: string\n webview_params?: Record<string, string>\n\n constructor(event: EventWebviewActionTriggered, requestData: RequestData) {\n super(event, requestData)\n this.type = EventType.BotEvent\n this.action = EventAction.WebviewActionTriggered\n this.flow_thread_id = event.flowThreadId\n this.flow_id = event.flowId\n this.flow_name = event.flowName\n this.flow_node_id = event.flowNodeId\n this.flow_node_content_id = event.flowNodeContentId\n this.flow_node_is_meaningful = event.flowNodeIsMeaningful\n this.webview_name = event.webviewName\n this.webview_target_id = event.webviewTargetId\n this.webview_params = event.webviewParams\n }\n}\n"],"names":["EventAction","EventType","HtEvent","HtEventWebviewActionTriggered","event","requestData"],"mappings":";;;;;;;;;;;;;;;;AAKiB;AACmB;AAE7B,MAAMG,6BAA6BA,SAASD,OAAOA;IAWxD,YAAYE,KAAkC,EAAEC,WAAwB,CAAE;QACxE,KAAK,CAACD,OAAOC,cAXf,kDACA,2CACA,6CACA,gDACA,wDACA,2DACA,gDACA,qDACA;QAIE,IAAI,CAAC,IAAI,GAAGJ,kBAAkB;QAC9B,IAAI,CAAC,MAAM,GAAGD,kCAAkC;QAChD,IAAI,CAAC,cAAc,GAAGI,MAAM,YAAY;QACxC,IAAI,CAAC,OAAO,GAAGA,MAAM,MAAM;QAC3B,IAAI,CAAC,SAAS,GAAGA,MAAM,QAAQ;QAC/B,IAAI,CAAC,YAAY,GAAGA,MAAM,UAAU;QACpC,IAAI,CAAC,oBAAoB,GAAGA,MAAM,iBAAiB;QACnD,IAAI,CAAC,uBAAuB,GAAGA,MAAM,oBAAoB;QACzD,IAAI,CAAC,YAAY,GAAGA,MAAM,WAAW;QACrC,IAAI,CAAC,iBAAiB,GAAGA,MAAM,eAAe;QAC9C,IAAI,CAAC,cAAc,GAAGA,MAAM,aAAa;IAC3C;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type EventAction, type EventWebviewEnd, type RequestData } from '../types';
|
|
2
|
-
import { HtEvent } from './ht-event';
|
|
1
|
+
import { type EventAction, type EventWebviewEnd, type RequestData } from '../types.js';
|
|
2
|
+
import { HtEvent } from './ht-event.js';
|
|
3
3
|
export declare class HtEventWebviewEnd extends HtEvent {
|
|
4
4
|
action: EventAction.WebviewEnd;
|
|
5
5
|
flow_thread_id?: string;
|
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { EventType } from "../types.js";
|
|
2
|
+
import { HtEvent } from "./ht-event.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function _define_property(obj, key, value) {
|
|
7
|
+
if (key in obj) {
|
|
8
|
+
Object.defineProperty(obj, key, {
|
|
9
|
+
value: value,
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true
|
|
13
|
+
});
|
|
14
|
+
} else obj[key] = value;
|
|
15
|
+
return obj;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class HtEventWebviewEnd extends HtEvent {
|
|
20
|
+
constructor(event, requestData){
|
|
21
|
+
super(event, requestData), _define_property(this, "action", void 0), _define_property(this, "flow_thread_id", void 0), _define_property(this, "webview_thread_id", void 0), _define_property(this, "webview_name", void 0), _define_property(this, "webview_end_step_name", void 0), _define_property(this, "webview_end_step_n", void 0), _define_property(this, "webview_end_fail_type", void 0), _define_property(this, "webview_end_fail_message", void 0);
|
|
22
|
+
this.type = EventType.WebEvent;
|
|
10
23
|
this.action = event.action;
|
|
11
24
|
this.flow_thread_id = event.flowThreadId;
|
|
12
25
|
this.webview_thread_id = event.webviewThreadId;
|
|
@@ -17,5 +30,7 @@ class HtEventWebviewEnd extends ht_event_1.HtEvent {
|
|
|
17
30
|
this.webview_end_fail_message = event.webviewEndFailMessage;
|
|
18
31
|
}
|
|
19
32
|
}
|
|
20
|
-
|
|
33
|
+
|
|
34
|
+
export { HtEventWebviewEnd };
|
|
35
|
+
|
|
21
36
|
//# sourceMappingURL=ht-event-webview-end.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ht-event-webview-end.js","
|
|
1
|
+
{"version":3,"file":"event-models/ht-event-webview-end.js","sources":["../../../src/event-models/ht-event-webview-end.ts"],"sourcesContent":["import {\n type EventAction,\n EventType,\n type EventWebviewEnd,\n type RequestData,\n} from '../types'\nimport { HtEvent } from './ht-event'\n\nexport class HtEventWebviewEnd extends HtEvent {\n action: EventAction.WebviewEnd\n flow_thread_id?: string\n webview_thread_id: string\n webview_name: string\n webview_end_step_name?: string\n webview_end_step_n?: number\n webview_end_fail_type?: string\n webview_end_fail_message?: string\n\n constructor(event: EventWebviewEnd, requestData: RequestData) {\n super(event, requestData)\n this.type = EventType.WebEvent\n this.action = event.action\n this.flow_thread_id = event.flowThreadId\n this.webview_thread_id = event.webviewThreadId\n this.webview_name = event.webviewName\n this.webview_end_step_name = event.webviewStepName\n this.webview_end_step_n = event.webviewStepNumber\n this.webview_end_fail_type = event.webviewEndFailType\n this.webview_end_fail_message = event.webviewEndFailMessage\n }\n}\n"],"names":["EventType","HtEvent","HtEventWebviewEnd","event","requestData"],"mappings":";;;;;;;;;;;;;;;;AAKiB;AACmB;AAE7B,MAAME,iBAAiBA,SAASD,OAAOA;IAU5C,YAAYE,KAAsB,EAAEC,WAAwB,CAAE;QAC5D,KAAK,CAACD,OAAOC,cAVf,0CACA,kDACA,qDACA,gDACA,yDACA,sDACA,yDACA;QAIE,IAAI,CAAC,IAAI,GAAGJ,kBAAkB;QAC9B,IAAI,CAAC,MAAM,GAAGG,MAAM,MAAM;QAC1B,IAAI,CAAC,cAAc,GAAGA,MAAM,YAAY;QACxC,IAAI,CAAC,iBAAiB,GAAGA,MAAM,eAAe;QAC9C,IAAI,CAAC,YAAY,GAAGA,MAAM,WAAW;QACrC,IAAI,CAAC,qBAAqB,GAAGA,MAAM,eAAe;QAClD,IAAI,CAAC,kBAAkB,GAAGA,MAAM,iBAAiB;QACjD,IAAI,CAAC,qBAAqB,GAAGA,MAAM,kBAAkB;QACrD,IAAI,CAAC,wBAAwB,GAAGA,MAAM,qBAAqB;IAC7D;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type EventAction, type EventWebviewStep, type RequestData } from '../types';
|
|
2
|
-
import { HtEvent } from './ht-event';
|
|
1
|
+
import { type EventAction, type EventWebviewStep, type RequestData } from '../types.js';
|
|
2
|
+
import { HtEvent } from './ht-event.js';
|
|
3
3
|
export declare class HtEventWebviewStep extends HtEvent {
|
|
4
4
|
action: EventAction.WebviewStep;
|
|
5
5
|
flow_thread_id?: string;
|
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { EventType } from "../types.js";
|
|
2
|
+
import { HtEvent } from "./ht-event.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function _define_property(obj, key, value) {
|
|
7
|
+
if (key in obj) {
|
|
8
|
+
Object.defineProperty(obj, key, {
|
|
9
|
+
value: value,
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true
|
|
13
|
+
});
|
|
14
|
+
} else obj[key] = value;
|
|
15
|
+
return obj;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class HtEventWebviewStep extends HtEvent {
|
|
20
|
+
constructor(event, requestData){
|
|
21
|
+
super(event, requestData), _define_property(this, "action", void 0), _define_property(this, "flow_thread_id", void 0), _define_property(this, "webview_thread_id", void 0), _define_property(this, "webview_name", void 0), _define_property(this, "webview_step_name", void 0), _define_property(this, "webview_step_n", void 0);
|
|
22
|
+
this.type = EventType.WebEvent;
|
|
10
23
|
this.action = event.action;
|
|
11
24
|
this.flow_thread_id = event.flowThreadId;
|
|
12
25
|
this.webview_thread_id = event.webviewThreadId;
|
|
@@ -15,5 +28,7 @@ class HtEventWebviewStep extends ht_event_1.HtEvent {
|
|
|
15
28
|
this.webview_step_n = event.webviewStepNumber;
|
|
16
29
|
}
|
|
17
30
|
}
|
|
18
|
-
|
|
31
|
+
|
|
32
|
+
export { HtEventWebviewStep };
|
|
33
|
+
|
|
19
34
|
//# sourceMappingURL=ht-event-webview-step.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ht-event-webview-step.js","
|
|
1
|
+
{"version":3,"file":"event-models/ht-event-webview-step.js","sources":["../../../src/event-models/ht-event-webview-step.ts"],"sourcesContent":["import {\n type EventAction,\n EventType,\n type EventWebviewStep,\n type RequestData,\n} from '../types'\nimport { HtEvent } from './ht-event'\n\nexport class HtEventWebviewStep extends HtEvent {\n action: EventAction.WebviewStep\n flow_thread_id?: string\n webview_thread_id: string\n webview_name: string\n webview_step_name: string\n webview_step_n: number\n\n constructor(event: EventWebviewStep, requestData: RequestData) {\n super(event, requestData)\n this.type = EventType.WebEvent\n this.action = event.action\n this.flow_thread_id = event.flowThreadId\n this.webview_thread_id = event.webviewThreadId\n this.webview_name = event.webviewName\n this.webview_step_name = event.webviewStepName\n this.webview_step_n = event.webviewStepNumber\n }\n}\n"],"names":["EventType","HtEvent","HtEventWebviewStep","event","requestData"],"mappings":";;;;;;;;;;;;;;;;AAKiB;AACmB;AAE7B,MAAME,kBAAkBA,SAASD,OAAOA;IAQ7C,YAAYE,KAAuB,EAAEC,WAAwB,CAAE;QAC7D,KAAK,CAACD,OAAOC,cARf,0CACA,kDACA,qDACA,gDACA,qDACA;QAIE,IAAI,CAAC,IAAI,GAAGJ,kBAAkB;QAC9B,IAAI,CAAC,MAAM,GAAGG,MAAM,MAAM;QAC1B,IAAI,CAAC,cAAc,GAAGA,MAAM,YAAY;QACxC,IAAI,CAAC,iBAAiB,GAAGA,MAAM,eAAe;QAC9C,IAAI,CAAC,YAAY,GAAGA,MAAM,WAAW;QACrC,IAAI,CAAC,iBAAiB,GAAGA,MAAM,eAAe;QAC9C,IAAI,CAAC,cAAc,GAAGA,MAAM,iBAAiB;IAC/C;AACF"}
|
|
@@ -1,12 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { EVENT_FORMAT_VERSION } from "@botonic/core";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function _define_property(obj, key, value) {
|
|
5
|
+
if (key in obj) {
|
|
6
|
+
Object.defineProperty(obj, key, {
|
|
7
|
+
value: value,
|
|
8
|
+
enumerable: true,
|
|
9
|
+
configurable: true,
|
|
10
|
+
writable: true
|
|
11
|
+
});
|
|
12
|
+
} else obj[key] = value;
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
6
16
|
class HtEvent {
|
|
7
|
-
constructor(event, requestData)
|
|
17
|
+
constructor(event, requestData){
|
|
18
|
+
_define_property(this, "chat_id", void 0);
|
|
19
|
+
_define_property(this, "type", void 0);
|
|
20
|
+
_define_property(this, "format_version", void 0);
|
|
21
|
+
_define_property(this, "bot_version", void 0);
|
|
22
|
+
_define_property(this, "flow_version", void 0);
|
|
23
|
+
_define_property(this, "action", void 0);
|
|
24
|
+
_define_property(this, "bot_interaction_id", void 0);
|
|
25
|
+
_define_property(this, "user_locale", void 0);
|
|
26
|
+
_define_property(this, "user_country", void 0);
|
|
27
|
+
_define_property(this, "system_locale", void 0);
|
|
8
28
|
this.chat_id = requestData.userId;
|
|
9
|
-
this.format_version =
|
|
29
|
+
this.format_version = EVENT_FORMAT_VERSION;
|
|
10
30
|
this.action = event.action;
|
|
11
31
|
this.bot_interaction_id = requestData.botInteractionId;
|
|
12
32
|
this.user_locale = requestData.userLocale;
|
|
@@ -14,5 +34,7 @@ class HtEvent {
|
|
|
14
34
|
this.system_locale = requestData.systemLocale;
|
|
15
35
|
}
|
|
16
36
|
}
|
|
17
|
-
|
|
37
|
+
|
|
38
|
+
export { HtEvent };
|
|
39
|
+
|
|
18
40
|
//# sourceMappingURL=ht-event.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ht-event.js","
|
|
1
|
+
{"version":3,"file":"event-models/ht-event.js","sources":["../../../src/event-models/ht-event.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport { EVENT_FORMAT_VERSION } from '@botonic/core'\n\nimport type {\n EventAction,\n EventType,\n HtEventProps,\n RequestData,\n} from '../types'\nexport class HtEvent {\n chat_id?: string\n type: EventType\n format_version?: number\n bot_version?: string\n flow_version?: string\n action: EventAction\n bot_interaction_id?: string\n user_locale: string\n user_country: string\n system_locale: string\n\n constructor(event: HtEventProps, requestData: RequestData) {\n this.chat_id = requestData.userId\n this.format_version = EVENT_FORMAT_VERSION\n this.action = event.action\n this.bot_interaction_id = requestData.botInteractionId\n this.user_locale = requestData.userLocale\n this.user_country = requestData.userCountry\n this.system_locale = requestData.systemLocale\n }\n}\n"],"names":["EVENT_FORMAT_VERSION","HtEvent","event","requestData"],"mappings":";;;;;;;;;;;;;;AAAA,uDAAuD,GACH;AAQ7C,MAAMC,OAAOA;IAYlB,YAAYC,KAAmB,EAAEC,WAAwB,CAAE;QAX3D;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QAGE,IAAI,CAAC,OAAO,GAAGA,YAAY,MAAM;QACjC,IAAI,CAAC,cAAc,GAAGH,oBAAoBA;QAC1C,IAAI,CAAC,MAAM,GAAGE,MAAM,MAAM;QAC1B,IAAI,CAAC,kBAAkB,GAAGC,YAAY,gBAAgB;QACtD,IAAI,CAAC,WAAW,GAAGA,YAAY,UAAU;QACzC,IAAI,CAAC,YAAY,GAAGA,YAAY,WAAW;QAC3C,IAAI,CAAC,aAAa,GAAGA,YAAY,YAAY;IAC/C;AACF"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export { HtEvent } from './ht-event';
|
|
2
|
-
export { HtEventAiAgent } from './ht-event-ai-agent';
|
|
3
|
-
export { HtEventAiAgentRouter } from './ht-event-ai-agent-router';
|
|
4
|
-
export { HtEventBotAction } from './ht-event-bot-action';
|
|
5
|
-
export { HtEventConditionalChannel } from './ht-event-conditional-channel';
|
|
6
|
-
export { HtEventConditionalCountry } from './ht-event-conditional-country';
|
|
7
|
-
export { HtEventConditionalCustom } from './ht-event-conditional-custom';
|
|
8
|
-
export { HtEventConditionalQueueStatus } from './ht-event-conditional-queue-status';
|
|
9
|
-
export { HtEventCustom } from './ht-event-custom';
|
|
10
|
-
export { HtEventFallback } from './ht-event-fallback';
|
|
11
|
-
export { HtEventFeedback } from './ht-event-feedback';
|
|
12
|
-
export { HtEventFlow } from './ht-event-flow';
|
|
13
|
-
export { HtEventHandoff } from './ht-event-handoff';
|
|
14
|
-
export { HtEventHandoffOption } from './ht-event-handoff-option';
|
|
15
|
-
export { HtEventIntentSmart } from './ht-event-intent-smart';
|
|
16
|
-
export { HtEventKeyword } from './ht-event-keyword';
|
|
17
|
-
export { HtEventRedirectFlow } from './ht-event-redirect-flow';
|
|
18
|
-
export { HtEventWebviewActionTriggered } from './ht-event-webview-action-triggered';
|
|
19
|
-
export { HtEventWebviewEnd } from './ht-event-webview-end';
|
|
20
|
-
export { HtEventWebviewStep } from './ht-event-webview-step';
|
|
1
|
+
export { HtEvent } from './ht-event.js';
|
|
2
|
+
export { HtEventAiAgent } from './ht-event-ai-agent.js';
|
|
3
|
+
export { HtEventAiAgentRouter } from './ht-event-ai-agent-router.js';
|
|
4
|
+
export { HtEventBotAction } from './ht-event-bot-action.js';
|
|
5
|
+
export { HtEventConditionalChannel } from './ht-event-conditional-channel.js';
|
|
6
|
+
export { HtEventConditionalCountry } from './ht-event-conditional-country.js';
|
|
7
|
+
export { HtEventConditionalCustom } from './ht-event-conditional-custom.js';
|
|
8
|
+
export { HtEventConditionalQueueStatus } from './ht-event-conditional-queue-status.js';
|
|
9
|
+
export { HtEventCustom } from './ht-event-custom.js';
|
|
10
|
+
export { HtEventFallback } from './ht-event-fallback.js';
|
|
11
|
+
export { HtEventFeedback } from './ht-event-feedback.js';
|
|
12
|
+
export { HtEventFlow } from './ht-event-flow.js';
|
|
13
|
+
export { HtEventHandoff } from './ht-event-handoff.js';
|
|
14
|
+
export { HtEventHandoffOption } from './ht-event-handoff-option.js';
|
|
15
|
+
export { HtEventIntentSmart } from './ht-event-intent-smart.js';
|
|
16
|
+
export { HtEventKeyword } from './ht-event-keyword.js';
|
|
17
|
+
export { HtEventRedirectFlow } from './ht-event-redirect-flow.js';
|
|
18
|
+
export { HtEventWebviewActionTriggered } from './ht-event-webview-action-triggered.js';
|
|
19
|
+
export { HtEventWebviewEnd } from './ht-event-webview-end.js';
|
|
20
|
+
export { HtEventWebviewStep } from './ht-event-webview-step.js';
|
|
@@ -1,44 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
export { HtEvent } from "./ht-event.js";
|
|
43
|
+
export { HtEventAiAgent } from "./ht-event-ai-agent.js";
|
|
44
|
+
export { HtEventAiAgentRouter } from "./ht-event-ai-agent-router.js";
|
|
45
|
+
export { HtEventBotAction } from "./ht-event-bot-action.js";
|
|
46
|
+
export { HtEventConditionalChannel } from "./ht-event-conditional-channel.js";
|
|
47
|
+
export { HtEventConditionalCountry } from "./ht-event-conditional-country.js";
|
|
48
|
+
export { HtEventConditionalCustom } from "./ht-event-conditional-custom.js";
|
|
49
|
+
export { HtEventConditionalQueueStatus } from "./ht-event-conditional-queue-status.js";
|
|
50
|
+
export { HtEventCustom } from "./ht-event-custom.js";
|
|
51
|
+
export { HtEventFallback } from "./ht-event-fallback.js";
|
|
52
|
+
export { HtEventFeedback } from "./ht-event-feedback.js";
|
|
53
|
+
export { HtEventFlow } from "./ht-event-flow.js";
|
|
54
|
+
export { HtEventHandoff } from "./ht-event-handoff.js";
|
|
55
|
+
export { HtEventHandoffOption } from "./ht-event-handoff-option.js";
|
|
56
|
+
export { HtEventIntentSmart } from "./ht-event-intent-smart.js";
|
|
57
|
+
export { HtEventKeyword } from "./ht-event-keyword.js";
|
|
58
|
+
export { HtEventRedirectFlow } from "./ht-event-redirect-flow.js";
|
|
59
|
+
export { HtEventWebviewActionTriggered } from "./ht-event-webview-action-triggered.js";
|
|
60
|
+
export { HtEventWebviewEnd } from "./ht-event-webview-end.js";
|
|
61
|
+
export { HtEventWebviewStep } from "./ht-event-webview-step.js";
|
|
62
|
+
|
|
44
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"event-models/index.js","sources":["../../../src/event-models/index.ts"],"sourcesContent":["export { HtEvent } from './ht-event'\nexport { HtEventAiAgent } from './ht-event-ai-agent'\nexport { HtEventAiAgentRouter } from './ht-event-ai-agent-router'\nexport { HtEventBotAction } from './ht-event-bot-action'\nexport { HtEventConditionalChannel } from './ht-event-conditional-channel'\nexport { HtEventConditionalCountry } from './ht-event-conditional-country'\nexport { HtEventConditionalCustom } from './ht-event-conditional-custom'\nexport { HtEventConditionalQueueStatus } from './ht-event-conditional-queue-status'\nexport { HtEventCustom } from './ht-event-custom'\nexport { HtEventFallback } from './ht-event-fallback'\nexport { HtEventFeedback } from './ht-event-feedback'\nexport { HtEventFlow } from './ht-event-flow'\nexport { HtEventHandoff } from './ht-event-handoff'\nexport { HtEventHandoffOption } from './ht-event-handoff-option'\nexport { HtEventIntentSmart } from './ht-event-intent-smart'\nexport { HtEventKeyword } from './ht-event-keyword'\nexport { HtEventRedirectFlow } from './ht-event-redirect-flow'\nexport { HtEventWebviewActionTriggered } from './ht-event-webview-action-triggered'\nexport { HtEventWebviewEnd } from './ht-event-webview-end'\nexport { HtEventWebviewStep } from './ht-event-webview-step'\n"],"names":["HtEvent","HtEventAiAgent","HtEventAiAgentRouter","HtEventBotAction","HtEventConditionalChannel","HtEventConditionalCountry","HtEventConditionalCustom","HtEventConditionalQueueStatus","HtEventCustom","HtEventFallback","HtEventFeedback","HtEventFlow","HtEventHandoff","HtEventHandoffOption","HtEventIntentSmart","HtEventKeyword","HtEventRedirectFlow","HtEventWebviewActionTriggered","HtEventWebviewEnd","HtEventWebviewStep"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAoC;AACgB;AACa;AACT;AACkB;AACA;AACF;AACW;AAClC;AACI;AACA;AACR;AACM;AACa;AACJ;AACT;AACW;AACqB;AACzB;AACE"}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { BotContext, Plugin } from '@botonic/core';
|
|
2
|
-
import
|
|
3
|
-
import { type HtEventProps, type RequestData } from './types';
|
|
2
|
+
import { type HtEventProps, type RequestData } from './types.js';
|
|
4
3
|
export default class BotonicPluginHubtypeAnalytics implements Plugin {
|
|
5
4
|
eventsBaseUrl: string;
|
|
6
5
|
constructor();
|
|
7
6
|
post(): void;
|
|
8
|
-
trackEvent(request: BotContext, htEventProps: HtEventProps): Promise<axios.AxiosResponse<any, any, {}>>;
|
|
7
|
+
trackEvent(request: BotContext, htEventProps: HtEventProps): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
9
8
|
getRequestData(request: BotContext): RequestData;
|
|
10
9
|
private isLambdaEvent;
|
|
11
10
|
private sendEvent;
|
|
@@ -14,5 +13,5 @@ export default class BotonicPluginHubtypeAnalytics implements Plugin {
|
|
|
14
13
|
private sendWebEventByBotId;
|
|
15
14
|
private sendWebEventByProviderId;
|
|
16
15
|
}
|
|
17
|
-
export * from './types';
|
|
18
|
-
export * from './utils';
|
|
16
|
+
export * from './types.js';
|
|
17
|
+
export * from './utils.js';
|
package/lib/esm/index.js
CHANGED
|
@@ -1,20 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { EventType } from "./types.js";
|
|
3
|
+
import { createHtEvent } from "./utils.js";
|
|
4
|
+
|
|
5
|
+
export * from "./types.js";
|
|
6
|
+
export * from "./utils.js";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
function _define_property(obj, key, value) {
|
|
11
|
+
if (key in obj) {
|
|
12
|
+
Object.defineProperty(obj, key, {
|
|
13
|
+
value: value,
|
|
14
|
+
enumerable: true,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true
|
|
17
|
+
});
|
|
18
|
+
} else obj[key] = value;
|
|
19
|
+
return obj;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
7
24
|
class BotonicPluginHubtypeAnalytics {
|
|
8
|
-
constructor() {
|
|
9
|
-
const hubtypeUrl = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com';
|
|
10
|
-
this.eventsBaseUrl = `${hubtypeUrl}/external/v2/conversational_apps`;
|
|
11
|
-
}
|
|
12
25
|
post() {
|
|
13
26
|
return;
|
|
14
27
|
}
|
|
15
28
|
async trackEvent(request, htEventProps) {
|
|
16
29
|
const requestData = this.getRequestData(request);
|
|
17
|
-
const event =
|
|
30
|
+
const event = createHtEvent(requestData, htEventProps);
|
|
18
31
|
return this.sendEvent(request, event);
|
|
19
32
|
}
|
|
20
33
|
getRequestData(request) {
|
|
@@ -23,14 +36,14 @@ class BotonicPluginHubtypeAnalytics {
|
|
|
23
36
|
botInteractionId: request.input?.bot_interaction_id,
|
|
24
37
|
userLocale: request.getUserLocale(),
|
|
25
38
|
userCountry: request.getUserCountry(),
|
|
26
|
-
systemLocale: request.getSystemLocale()
|
|
39
|
+
systemLocale: request.getSystemLocale()
|
|
27
40
|
};
|
|
28
41
|
}
|
|
29
42
|
isLambdaEvent(request) {
|
|
30
43
|
return request.session?.bot?.id !== undefined;
|
|
31
44
|
}
|
|
32
45
|
sendEvent(request, event) {
|
|
33
|
-
if (event.type ===
|
|
46
|
+
if (event.type === EventType.BotEvent) {
|
|
34
47
|
return this.sendBotEvent(request, event);
|
|
35
48
|
}
|
|
36
49
|
return this.sendWebEvent(request, event);
|
|
@@ -39,9 +52,11 @@ class BotonicPluginHubtypeAnalytics {
|
|
|
39
52
|
const botId = request.session.bot.id;
|
|
40
53
|
const url = `${this.eventsBaseUrl}/${botId}/bot_event/`;
|
|
41
54
|
const config = {
|
|
42
|
-
headers: {
|
|
55
|
+
headers: {
|
|
56
|
+
Authorization: `Bearer ${request.session._access_token}`
|
|
57
|
+
}
|
|
43
58
|
};
|
|
44
|
-
return
|
|
59
|
+
return axios.post(url, event, config);
|
|
45
60
|
}
|
|
46
61
|
sendWebEvent(request, event) {
|
|
47
62
|
if (this.isLambdaEvent(request)) {
|
|
@@ -52,19 +67,27 @@ class BotonicPluginHubtypeAnalytics {
|
|
|
52
67
|
sendWebEventByBotId(request, event) {
|
|
53
68
|
const botId = request.session.bot.id;
|
|
54
69
|
const url = `${this.eventsBaseUrl}/${botId}/web_event/`;
|
|
55
|
-
return
|
|
70
|
+
return axios.post(url, event);
|
|
56
71
|
}
|
|
57
72
|
sendWebEventByProviderId(request, event) {
|
|
58
73
|
const url = `${this.eventsBaseUrl}/web_event/`;
|
|
59
74
|
const config = {
|
|
60
75
|
params: {
|
|
61
|
-
provider_id: request.session.user.id
|
|
62
|
-
}
|
|
76
|
+
provider_id: request.session.user.id
|
|
77
|
+
}
|
|
63
78
|
};
|
|
64
|
-
return
|
|
79
|
+
return axios.post(url, event, config);
|
|
80
|
+
}
|
|
81
|
+
constructor(){
|
|
82
|
+
_define_property(this, "eventsBaseUrl", void 0);
|
|
83
|
+
const hubtypeUrl = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com';
|
|
84
|
+
this.eventsBaseUrl = `${hubtypeUrl}/external/v2/conversational_apps`;
|
|
65
85
|
}
|
|
66
86
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
export default BotonicPluginHubtypeAnalytics;
|
|
92
|
+
|
|
70
93
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import type { BotContext, Plugin } from '@botonic/core'\nimport axios from 'axios'\n\nimport type { HtEvent } from './event-models'\nimport { EventType, type HtEventProps, type RequestData } from './types'\nimport { createHtEvent } from './utils'\n\nexport default class BotonicPluginHubtypeAnalytics implements Plugin {\n eventsBaseUrl: string\n constructor() {\n const hubtypeUrl = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com'\n this.eventsBaseUrl = `${hubtypeUrl}/external/v2/conversational_apps`\n }\n\n post(): void {\n return\n }\n\n async trackEvent(request: BotContext, htEventProps: HtEventProps) {\n const requestData = this.getRequestData(request)\n const event = createHtEvent(requestData, htEventProps)\n return this.sendEvent(request, event)\n }\n\n getRequestData(request: BotContext): RequestData {\n return {\n userId: this.isLambdaEvent(request) ? request.session.user.id : undefined,\n botInteractionId: request.input?.bot_interaction_id,\n userLocale: request.getUserLocale(),\n userCountry: request.getUserCountry(),\n systemLocale: request.getSystemLocale(),\n }\n }\n\n private isLambdaEvent(request: BotContext): boolean {\n return request.session?.bot?.id !== undefined\n }\n\n private sendEvent(request: BotContext, event: HtEvent) {\n if (event.type === EventType.BotEvent) {\n return this.sendBotEvent(request, event)\n }\n\n return this.sendWebEvent(request, event)\n }\n\n private sendBotEvent(request: BotContext, event: HtEvent) {\n const botId = request.session.bot.id\n const url = `${this.eventsBaseUrl}/${botId}/bot_event/`\n const config = {\n headers: { Authorization: `Bearer ${request.session._access_token}` },\n }\n return axios.post(url, event, config)\n }\n\n private sendWebEvent(request: BotContext, event: HtEvent) {\n if (this.isLambdaEvent(request)) {\n return this.sendWebEventByBotId(request, event)\n }\n\n return this.sendWebEventByProviderId(request, event)\n }\n\n private sendWebEventByBotId(request: BotContext, event: HtEvent) {\n const botId = request.session.bot.id\n const url = `${this.eventsBaseUrl}/${botId}/web_event/`\n return axios.post(url, event)\n }\n\n private sendWebEventByProviderId(request: BotContext, event: HtEvent) {\n const url = `${this.eventsBaseUrl}/web_event/`\n const config = {\n params: {\n provider_id: request.session.user.id,\n },\n }\n return axios.post(url, event, config)\n }\n}\n\nexport * from './types'\nexport * from './utils'\n"],"names":["axios","EventType","createHtEvent","BotonicPluginHubtypeAnalytics","request","htEventProps","requestData","event","undefined","botId","url","config","hubtypeUrl","process"],"mappings":";;;;;;;;;;;;;;;;;;;;AACyB;AAG+C;AACjC;AAExB,MAAMG,6BAA6BA;IAOhD,OAAa;QACX;IACF;IAEA,MAAM,WAAWC,OAAmB,EAAEC,YAA0B,EAAE;QAChE,MAAMC,cAAc,IAAI,CAAC,cAAc,CAACF;QACxC,MAAMG,QAAQL,aAAaA,CAACI,aAAaD;QACzC,OAAO,IAAI,CAAC,SAAS,CAACD,SAASG;IACjC;IAEA,eAAeH,OAAmB,EAAe;QAC/C,OAAO;YACL,QAAQ,IAAI,CAAC,aAAa,CAACA,WAAWA,QAAQ,OAAO,CAAC,IAAI,CAAC,EAAE,GAAGI;YAChE,kBAAkBJ,QAAQ,KAAK,EAAE;YACjC,YAAYA,QAAQ,aAAa;YACjC,aAAaA,QAAQ,cAAc;YACnC,cAAcA,QAAQ,eAAe;QACvC;IACF;IAEQ,cAAcA,OAAmB,EAAW;QAClD,OAAOA,QAAQ,OAAO,EAAE,KAAK,OAAOI;IACtC;IAEQ,UAAUJ,OAAmB,EAAEG,KAAc,EAAE;QACrD,IAAIA,MAAM,IAAI,KAAKN,kBAAkB,EAAE;YACrC,OAAO,IAAI,CAAC,YAAY,CAACG,SAASG;QACpC;QAEA,OAAO,IAAI,CAAC,YAAY,CAACH,SAASG;IACpC;IAEQ,aAAaH,OAAmB,EAAEG,KAAc,EAAE;QACxD,MAAME,QAAQL,QAAQ,OAAO,CAAC,GAAG,CAAC,EAAE;QACpC,MAAMM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAED,MAAM,WAAW,CAAC;QACvD,MAAME,SAAS;YACb,SAAS;gBAAE,eAAe,CAAC,OAAO,EAAEP,QAAQ,OAAO,CAAC,aAAa,EAAE;YAAC;QACtE;QACA,OAAOJ,UAAU,CAACU,KAAKH,OAAOI;IAChC;IAEQ,aAAaP,OAAmB,EAAEG,KAAc,EAAE;QACxD,IAAI,IAAI,CAAC,aAAa,CAACH,UAAU;YAC/B,OAAO,IAAI,CAAC,mBAAmB,CAACA,SAASG;QAC3C;QAEA,OAAO,IAAI,CAAC,wBAAwB,CAACH,SAASG;IAChD;IAEQ,oBAAoBH,OAAmB,EAAEG,KAAc,EAAE;QAC/D,MAAME,QAAQL,QAAQ,OAAO,CAAC,GAAG,CAAC,EAAE;QACpC,MAAMM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAED,MAAM,WAAW,CAAC;QACvD,OAAOT,UAAU,CAACU,KAAKH;IACzB;IAEQ,yBAAyBH,OAAmB,EAAEG,KAAc,EAAE;QACpE,MAAMG,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC;QAC9C,MAAMC,SAAS;YACb,QAAQ;gBACN,aAAaP,QAAQ,OAAO,CAAC,IAAI,CAAC,EAAE;YACtC;QACF;QACA,OAAOJ,UAAU,CAACU,KAAKH,OAAOI;IAChC;IApEA,aAAc;QADd;QAEE,MAAMC,aAAaC,QAAQ,GAAG,CAAC,eAAe,IAAI;QAClD,IAAI,CAAC,aAAa,GAAG,GAAGD,WAAW,gCAAgC,CAAC;IACtE;AAkEF;AAAC;AAEsB;AACA"}
|
package/lib/esm/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AvailableSpecialist, EventAction, EventAiAgent, type EventAiAgentRouter, EventBotAction, EventCaptureUserInput, EventConditionalChannel, EventConditionalCountry, EventConditionalCustom, EventConditionalQueueStatus, EventCustom, EventFallback, EventFeedback, EventFlow, EventHandoff, EventHandoffOption, EventIntentSmart, EventKeyword, type EventRedirectFlow, EventWebviewActionTriggered, EventWebviewEnd, EventWebviewStep, ToolExecution, WebviewEndFailType } from '@botonic/core';
|
|
1
|
+
import { type AvailableSpecialist, EventAction, type EventAiAgent, type EventAiAgentRouter, type EventBotAction, type EventCaptureUserInput, type EventConditionalChannel, type EventConditionalCountry, type EventConditionalCustom, type EventConditionalQueueStatus, type EventCustom, type EventFallback, type EventFeedback, type EventFlow, type EventHandoff, type EventHandoffOption, type EventIntentSmart, type EventKeyword, type EventRedirectFlow, type EventWebviewActionTriggered, type EventWebviewEnd, type EventWebviewStep, type ToolExecution, WebviewEndFailType } from '@botonic/core';
|
|
2
2
|
export declare enum EventType {
|
|
3
3
|
BotEvent = "botevent",
|
|
4
4
|
WebEvent = "webevent"
|
|
@@ -11,4 +11,4 @@ export interface RequestData {
|
|
|
11
11
|
userCountry: string;
|
|
12
12
|
systemLocale: string;
|
|
13
13
|
}
|
|
14
|
-
export { EventAction, EventAiAgent, type EventAiAgentRouter, AvailableSpecialist, EventBotAction, EventCaptureUserInput, EventConditionalChannel, EventConditionalCountry, EventConditionalCustom, EventConditionalQueueStatus, EventCustom, EventFallback, EventFeedback, EventFlow, EventHandoff, EventHandoffOption, EventIntentSmart, EventKeyword, EventWebviewActionTriggered, EventWebviewEnd, EventWebviewStep, ToolExecution, WebviewEndFailType, };
|
|
14
|
+
export { EventAction, type EventAiAgent, type EventAiAgentRouter, type AvailableSpecialist, type EventBotAction, type EventCaptureUserInput, type EventConditionalChannel, type EventConditionalCountry, type EventConditionalCustom, type EventConditionalQueueStatus, type EventCustom, type EventFallback, type EventFeedback, type EventFlow, type EventHandoff, type EventHandoffOption, type EventIntentSmart, type EventKeyword, type EventWebviewActionTriggered, type EventWebviewEnd, type EventWebviewStep, type ToolExecution, WebviewEndFailType, };
|