@botonic/core 0.56.0-alpha.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/constants.js +7 -7
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/core-bot.d.ts +3 -3
- package/lib/esm/core-bot.js +87 -50
- package/lib/esm/core-bot.js.map +1 -1
- package/lib/esm/debug/index.d.ts +1 -1
- package/lib/esm/debug/index.js +5 -4
- package/lib/esm/debug/index.js.map +1 -1
- package/lib/esm/debug/inspector.d.ts +1 -1
- package/lib/esm/debug/inspector.js +27 -21
- package/lib/esm/debug/inspector.js.map +1 -1
- package/lib/esm/handoff.d.ts +1 -1
- package/lib/esm/handoff.js +82 -53
- package/lib/esm/handoff.js.map +1 -1
- package/lib/esm/hubtype-service.d.ts +3 -3
- package/lib/esm/hubtype-service.js +100 -64
- package/lib/esm/hubtype-service.js.map +1 -1
- package/lib/esm/index.d.ts +9 -9
- package/lib/esm/index.js +21 -12
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/models/ai-agents.d.ts +1 -8
- package/lib/esm/models/ai-agents.js +15 -16
- package/lib/esm/models/ai-agents.js.map +1 -1
- package/lib/esm/models/bot-config.js +6 -6
- package/lib/esm/models/bot-config.js.map +1 -1
- package/lib/esm/models/hubtype-analytics.d.ts +1 -1
- package/lib/esm/models/hubtype-analytics.js +10 -10
- package/lib/esm/models/hubtype-analytics.js.map +1 -1
- package/lib/esm/models/index.d.ts +4 -4
- package/lib/esm/models/index.js +11 -7
- package/lib/esm/models/index.js.map +1 -1
- package/lib/esm/models/legacy-types.js +24 -24
- package/lib/esm/models/legacy-types.js.map +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/esm/plugins.d.ts +1 -1
- package/lib/esm/plugins.js +7 -8
- package/lib/esm/plugins.js.map +1 -1
- package/lib/esm/pusher-utils.js +15 -10
- package/lib/esm/pusher-utils.js.map +1 -1
- package/lib/esm/routing/index.d.ts +2 -2
- package/lib/esm/routing/index.js +7 -5
- package/lib/esm/routing/index.js.map +1 -1
- package/lib/esm/routing/router-utils.d.ts +1 -1
- package/lib/esm/routing/router-utils.js +37 -30
- package/lib/esm/routing/router-utils.js.map +1 -1
- package/lib/esm/routing/router.d.ts +2 -2
- package/lib/esm/routing/router.js +152 -149
- package/lib/esm/routing/router.js.map +1 -1
- package/lib/esm/testing/index.d.ts +1 -1
- package/lib/esm/testing/index.js +60 -94
- package/lib/esm/testing/index.js.map +1 -1
- package/lib/esm/utils/bot-config.d.ts +1 -1
- package/lib/esm/utils/bot-config.js +57 -28
- package/lib/esm/utils/bot-config.js.map +1 -1
- package/lib/esm/utils/check-providers.d.ts +1 -1
- package/lib/esm/utils/check-providers.js +14 -17
- package/lib/esm/utils/check-providers.js.map +1 -1
- package/lib/esm/utils/functional.js +19 -38
- package/lib/esm/utils/functional.js.map +1 -1
- package/lib/esm/utils/index.d.ts +3 -3
- package/lib/esm/utils/index.js +9 -6
- package/lib/esm/utils/index.js.map +1 -1
- package/package.json +12 -11
- package/src/hubtype-service.ts +4 -2
- package/src/models/ai-agents.ts +0 -9
- package/lib/cjs/constants.d.ts +0 -4
- package/lib/cjs/constants.js +0 -8
- package/lib/cjs/constants.js.map +0 -1
- package/lib/cjs/core-bot.d.ts +0 -43
- package/lib/cjs/core-bot.js +0 -205
- package/lib/cjs/core-bot.js.map +0 -1
- package/lib/cjs/debug/index.d.ts +0 -1
- package/lib/cjs/debug/index.js +0 -5
- package/lib/cjs/debug/index.js.map +0 -1
- package/lib/cjs/debug/inspector.d.ts +0 -24
- package/lib/cjs/debug/inspector.js +0 -70
- package/lib/cjs/debug/inspector.js.map +0 -1
- package/lib/cjs/handoff.d.ts +0 -110
- package/lib/cjs/handoff.js +0 -238
- package/lib/cjs/handoff.js.map +0 -1
- package/lib/cjs/hubtype-service.d.ts +0 -58
- package/lib/cjs/hubtype-service.js +0 -205
- package/lib/cjs/hubtype-service.js.map +0 -1
- package/lib/cjs/index.d.ts +0 -9
- package/lib/cjs/index.js +0 -13
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/models/ai-agents.d.ts +0 -147
- package/lib/cjs/models/ai-agents.js +0 -31
- package/lib/cjs/models/ai-agents.js.map +0 -1
- package/lib/cjs/models/bot-config.d.ts +0 -24
- package/lib/cjs/models/bot-config.js +0 -10
- package/lib/cjs/models/bot-config.js.map +0 -1
- package/lib/cjs/models/hubtype-analytics.d.ts +0 -210
- package/lib/cjs/models/hubtype-analytics.js +0 -38
- package/lib/cjs/models/hubtype-analytics.js.map +0 -1
- package/lib/cjs/models/index.d.ts +0 -4
- package/lib/cjs/models/index.js +0 -8
- package/lib/cjs/models/index.js.map +0 -1
- package/lib/cjs/models/legacy-types.d.ts +0 -332
- package/lib/cjs/models/legacy-types.js +0 -84
- package/lib/cjs/models/legacy-types.js.map +0 -1
- package/lib/cjs/plugins.d.ts +0 -9
- package/lib/cjs/plugins.js +0 -24
- package/lib/cjs/plugins.js.map +0 -1
- package/lib/cjs/pusher-utils.d.ts +0 -7
- package/lib/cjs/pusher-utils.js +0 -18
- package/lib/cjs/pusher-utils.js.map +0 -1
- package/lib/cjs/routing/index.d.ts +0 -2
- package/lib/cjs/routing/index.js +0 -6
- package/lib/cjs/routing/index.js.map +0 -1
- package/lib/cjs/routing/router-utils.d.ts +0 -11
- package/lib/cjs/routing/router-utils.js +0 -96
- package/lib/cjs/routing/router-utils.js.map +0 -1
- package/lib/cjs/routing/router.d.ts +0 -54
- package/lib/cjs/routing/router.js +0 -330
- package/lib/cjs/routing/router.js.map +0 -1
- package/lib/cjs/testing/index.d.ts +0 -91
- package/lib/cjs/testing/index.js +0 -196
- package/lib/cjs/testing/index.js.map +0 -1
- package/lib/cjs/utils/bot-config.d.ts +0 -4
- package/lib/cjs/utils/bot-config.js +0 -94
- package/lib/cjs/utils/bot-config.js.map +0 -1
- package/lib/cjs/utils/check-providers.d.ts +0 -8
- package/lib/cjs/utils/check-providers.js +0 -34
- package/lib/cjs/utils/check-providers.js.map +0 -1
- package/lib/cjs/utils/functional.d.ts +0 -10
- package/lib/cjs/utils/functional.js +0 -88
- package/lib/cjs/utils/functional.js.map +0 -1
- package/lib/cjs/utils/index.d.ts +0 -3
- package/lib/cjs/utils/index.js +0 -7
- package/lib/cjs/utils/index.js.map +0 -1
package/lib/esm/index.js
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
export * from "./constants.js";
|
|
2
|
+
export * from "./core-bot.js";
|
|
3
|
+
export * from "./debug/index.js";
|
|
4
|
+
export * from "./handoff.js";
|
|
5
|
+
export * from "./hubtype-service.js";
|
|
6
|
+
export * from "./models/index.js";
|
|
7
|
+
export * from "./plugins.js";
|
|
8
|
+
export * from "./routing/index.js";
|
|
9
|
+
export * from "./utils/index.js";
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export {};
|
|
21
|
+
|
|
13
22
|
//# 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":["export * from './constants'\nexport * from './core-bot'\nexport * from './debug'\nexport * from './handoff'\nexport * from './hubtype-service'\nexport * from './models'\nexport * from './plugins'\nexport * from './routing'\nexport * from './utils'\n"],"names":[],"mappings":";;;;;;;;;AAA2B;AACD;AACH;AACE;AACQ;AACT;AACC;AACA;AACF"}
|
|
@@ -4,7 +4,6 @@ export declare enum OutputMessageType {
|
|
|
4
4
|
TextWithButtons = "textWithButtons",
|
|
5
5
|
BotExecutor = "botExecutor",
|
|
6
6
|
Carousel = "carousel",
|
|
7
|
-
RequestContactInfo = "requestContactInfo",
|
|
8
7
|
Exit = "exit"
|
|
9
8
|
}
|
|
10
9
|
export interface BaseMessage<T extends string = OutputMessageType> {
|
|
@@ -53,16 +52,10 @@ export interface CarouselMessage extends BaseMessage {
|
|
|
53
52
|
elements: CarouselElement[];
|
|
54
53
|
};
|
|
55
54
|
}
|
|
56
|
-
export interface RequestContactInfoMessage extends BaseMessage {
|
|
57
|
-
type: OutputMessageType.RequestContactInfo;
|
|
58
|
-
content: {
|
|
59
|
-
text: string;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
55
|
export interface ExitMessage extends BaseMessage {
|
|
63
56
|
type: OutputMessageType.Exit;
|
|
64
57
|
}
|
|
65
|
-
export type OutputMessage<Extra extends BaseMessage<string> = never> = TextMessage | TextWithButtonsMessage | BotExecutorMessage | CarouselMessage |
|
|
58
|
+
export type OutputMessage<Extra extends BaseMessage<string> = never> = TextMessage | TextWithButtonsMessage | BotExecutorMessage | CarouselMessage | ExitMessage | Extra;
|
|
66
59
|
export type AgenticOutputMessage<Extra extends BaseMessage<string> = never> = Exclude<OutputMessage<Extra>, ExitMessage>;
|
|
67
60
|
export interface ToolExecution {
|
|
68
61
|
toolName: string;
|
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AiAgentType = exports.ReasoningEffort = exports.VerbosityLevel = exports.OutputMessageType = void 0;
|
|
4
|
-
var OutputMessageType;
|
|
5
|
-
(function (OutputMessageType) {
|
|
1
|
+
var ai_agents_OutputMessageType = /*#__PURE__*/ function(OutputMessageType) {
|
|
6
2
|
OutputMessageType["Text"] = "text";
|
|
7
3
|
OutputMessageType["TextWithButtons"] = "textWithButtons";
|
|
8
4
|
OutputMessageType["BotExecutor"] = "botExecutor";
|
|
9
5
|
OutputMessageType["Carousel"] = "carousel";
|
|
10
|
-
OutputMessageType["RequestContactInfo"] = "requestContactInfo";
|
|
11
6
|
OutputMessageType["Exit"] = "exit";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
return OutputMessageType;
|
|
8
|
+
}({});
|
|
9
|
+
var ai_agents_VerbosityLevel = /*#__PURE__*/ function(VerbosityLevel) {
|
|
15
10
|
VerbosityLevel["Low"] = "low";
|
|
16
11
|
VerbosityLevel["Medium"] = "medium";
|
|
17
12
|
VerbosityLevel["High"] = "high";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
return VerbosityLevel;
|
|
14
|
+
}({});
|
|
15
|
+
var ai_agents_ReasoningEffort = /*#__PURE__*/ function(ReasoningEffort) {
|
|
21
16
|
ReasoningEffort["None"] = "none";
|
|
22
17
|
ReasoningEffort["Low"] = "low";
|
|
23
18
|
ReasoningEffort["Medium"] = "medium";
|
|
24
19
|
ReasoningEffort["High"] = "high";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
return ReasoningEffort;
|
|
21
|
+
}({});
|
|
22
|
+
var ai_agents_AiAgentType = /*#__PURE__*/ function(AiAgentType) {
|
|
28
23
|
AiAgentType["Specialist"] = "specialist";
|
|
29
24
|
AiAgentType["Router"] = "router";
|
|
30
|
-
|
|
25
|
+
return AiAgentType;
|
|
26
|
+
}({});
|
|
27
|
+
|
|
28
|
+
export { ai_agents_AiAgentType as AiAgentType, ai_agents_OutputMessageType as OutputMessageType, ai_agents_ReasoningEffort as ReasoningEffort, ai_agents_VerbosityLevel as VerbosityLevel };
|
|
29
|
+
|
|
31
30
|
//# sourceMappingURL=ai-agents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-agents.js","
|
|
1
|
+
{"version":3,"file":"models/ai-agents.js","sources":["../../../src/models/ai-agents.ts"],"sourcesContent":["import type { z } from 'zod'\n\nexport enum OutputMessageType {\n Text = 'text',\n TextWithButtons = 'textWithButtons',\n BotExecutor = 'botExecutor',\n Carousel = 'carousel',\n Exit = 'exit',\n}\n\nexport interface BaseMessage<T extends string = OutputMessageType> {\n type: T\n}\n\nexport interface Button {\n text: string\n payload?: string\n url?: string\n target?: string\n}\nexport interface ButtonWithPayload {\n text: string\n payload: string\n}\n\nexport interface TextMessage extends BaseMessage {\n type: OutputMessageType.Text\n content: {\n text: string\n }\n}\n\nexport interface TextWithButtonsMessage extends BaseMessage {\n type: OutputMessageType.TextWithButtons\n content: {\n text: string\n buttons: Button[]\n }\n}\n\nexport interface BotExecutorMessage extends BaseMessage {\n type: OutputMessageType.BotExecutor\n content: {\n text: string\n buttons: ButtonWithPayload[]\n }\n}\n\ninterface CarouselElement {\n title: string\n subtitle: string\n image: string\n button: Button\n}\n\nexport interface CarouselMessage extends BaseMessage {\n type: OutputMessageType.Carousel\n content: {\n text?: string\n elements: CarouselElement[]\n }\n}\n\nexport interface ExitMessage extends BaseMessage {\n type: OutputMessageType.Exit\n}\n\nexport type OutputMessage<Extra extends BaseMessage<string> = never> =\n | TextMessage\n | TextWithButtonsMessage\n | BotExecutorMessage\n | CarouselMessage\n | ExitMessage\n | Extra\n\nexport type AgenticOutputMessage<Extra extends BaseMessage<string> = never> =\n Exclude<OutputMessage<Extra>, ExitMessage>\n\nexport interface ToolExecution {\n toolName: string\n toolArguments: Record<string, any>\n toolResults?: string\n knowledgebaseSourcesIds?: string[]\n knowledgebaseChunksIds?: string[]\n}\n\nexport interface AvailableSpecialist {\n name: string\n description: string\n}\n\nexport interface RunResult<Extra extends BaseMessage<string> = never> {\n messages: AgenticOutputMessage<Extra>[]\n toolsExecuted: ToolExecution[]\n memoryLength: number\n exit: boolean\n error: boolean\n inputGuardrailsTriggered: string[]\n outputGuardrailsTriggered: string[]\n startingAgentName: string\n lastAgentName: string\n availableSpecialists: AvailableSpecialist[]\n isTransferredToSpecialist: boolean\n}\n\nexport type InferenceResponse<Extra extends BaseMessage<string> = never> =\n RunResult<Extra>\n\nexport interface GuardrailRule {\n name: string\n description: string\n}\nexport enum VerbosityLevel {\n Low = 'low',\n Medium = 'medium',\n High = 'high',\n}\n\nexport enum ReasoningEffort {\n None = 'none',\n Low = 'low',\n Medium = 'medium',\n High = 'high',\n}\n\nexport interface HubtypeAssistantMessage {\n role: 'assistant'\n content: string\n}\n\nexport interface HubtypeUserMessage {\n role: 'user'\n content: string\n}\n\nexport enum AiAgentType {\n Specialist = 'specialist',\n Router = 'router',\n}\n\nexport type AiAgentArgs = AiAgentSpecialistArgs | AIAgentRouterArgs\n\nexport type AiAgentBaseArgs = {\n type: AiAgentType\n name: string\n instructions: string\n model: string\n verbosity: VerbosityLevel\n reasoningEffort?: ReasoningEffort\n disableForceRetrieveKnowledge?: boolean // If true, the agent will not force the retrieve knowledge tool to be used.\n inputGuardrailRules?: GuardrailRule[]\n previousHubtypeMessages?: HubtypeAssistantMessage[]\n outputMessagesSchemas?: z.ZodObject<any>[]\n forceToolNameOverride?: string\n}\n\nexport interface AiAgentSpecialistArgs extends AiAgentBaseArgs {\n type: AiAgentType.Specialist\n activeTools: { name: string }[]\n sourceIds: string[]\n}\n\ninterface AIAgentRoute extends AiAgentSpecialistArgs {\n description: string\n}\n\nexport interface AIAgentRouterArgs extends AiAgentBaseArgs {\n type: AiAgentType.Router\n specialists: AIAgentRoute[]\n}\n"],"names":["OutputMessageType","VerbosityLevel","ReasoningEffort","AiAgentType"],"mappings":"AAEO,IAAKA,2BAAiBA,0BAAjBA;;;;;;WAAAA;MAMX;AAwGM,IAAKC,wBAAcA,0BAAdA;;;;WAAAA;MAIX;AAEM,IAAKC,yBAAeA,0BAAfA;;;;;WAAAA;MAKX;AAYM,IAAKC,qBAAWA,0BAAXA;;;WAAAA;MAGX"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VariableType = void 0;
|
|
4
|
-
var VariableType;
|
|
5
|
-
(function (VariableType) {
|
|
1
|
+
var bot_config_VariableType = /*#__PURE__*/ function(VariableType) {
|
|
6
2
|
VariableType["String"] = "string";
|
|
7
3
|
VariableType["Number"] = "number";
|
|
8
4
|
VariableType["Boolean"] = "boolean";
|
|
9
|
-
|
|
5
|
+
return VariableType;
|
|
6
|
+
}({});
|
|
7
|
+
|
|
8
|
+
export { bot_config_VariableType as VariableType };
|
|
9
|
+
|
|
10
10
|
//# sourceMappingURL=bot-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bot-config.js","
|
|
1
|
+
{"version":3,"file":"models/bot-config.js","sources":["../../../src/models/bot-config.ts"],"sourcesContent":["import type { core } from 'zod'\n\n// This types are used in the bot-config.ts file to load the bot config when deploy a bot.\nexport interface BotConfigJSON {\n tools: ToolConfigJSON[]\n payloads: string[]\n webviews: WebviewConfigJSON[]\n variables?: VariableConfigJSON[]\n}\n\nexport interface ToolConfigJSON {\n name: string\n schema?: core.JSONSchema.JSONSchema\n description: string\n}\n\nexport interface WebviewConfigJSON {\n name: string\n}\n\nexport enum VariableType {\n String = 'string',\n Number = 'number',\n Boolean = 'boolean',\n}\n\nexport interface VariableConfigJSON {\n key_path: string\n type: VariableType\n}\n"],"names":["VariableType"],"mappings":"AAoBO,IAAKA,uBAAYA,0BAAZA;;;;WAAAA;MAIX"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.WebviewEndFailType = exports.EventAction = exports.EVENT_FORMAT_VERSION = void 0;
|
|
4
|
-
exports.EVENT_FORMAT_VERSION = 5;
|
|
5
|
-
var EventAction;
|
|
6
|
-
(function (EventAction) {
|
|
1
|
+
const EVENT_FORMAT_VERSION = 5;
|
|
2
|
+
var hubtype_analytics_EventAction = /*#__PURE__*/ function(EventAction) {
|
|
7
3
|
EventAction["AiAgent"] = "ai_agent";
|
|
8
4
|
EventAction["FeedbackCase"] = "feedback_case";
|
|
9
5
|
EventAction["FeedbackMessage"] = "feedback_message";
|
|
@@ -28,11 +24,15 @@ var EventAction;
|
|
|
28
24
|
EventAction["RedirectFlow"] = "redirect_flow";
|
|
29
25
|
EventAction["CaptureUserInput"] = "capture_user_input";
|
|
30
26
|
EventAction["AiAgentRouter"] = "ai_agent_router";
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
return EventAction;
|
|
28
|
+
}({});
|
|
29
|
+
var hubtype_analytics_WebviewEndFailType = /*#__PURE__*/ function(WebviewEndFailType) {
|
|
34
30
|
WebviewEndFailType["CanceledByUser"] = "canceled_by_user";
|
|
35
31
|
WebviewEndFailType["ApiError"] = "api_error";
|
|
36
32
|
WebviewEndFailType["NeedsEscalation"] = "needs_escalation";
|
|
37
|
-
|
|
33
|
+
return WebviewEndFailType;
|
|
34
|
+
}({});
|
|
35
|
+
|
|
36
|
+
export { EVENT_FORMAT_VERSION, hubtype_analytics_EventAction as EventAction, hubtype_analytics_WebviewEndFailType as WebviewEndFailType };
|
|
37
|
+
|
|
38
38
|
//# sourceMappingURL=hubtype-analytics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hubtype-analytics.js","
|
|
1
|
+
{"version":3,"file":"models/hubtype-analytics.js","sources":["../../../src/models/hubtype-analytics.ts"],"sourcesContent":["import type { AvailableSpecialist, ToolExecution } from './ai-agents'\n\nexport const EVENT_FORMAT_VERSION = 5\n\nexport enum EventAction {\n AiAgent = 'ai_agent',\n FeedbackCase = 'feedback_case',\n FeedbackMessage = 'feedback_message',\n FeedbackConversation = 'feedback_conversation',\n FeedbackWebview = 'feedback_webview',\n FlowNode = 'flow_node',\n ConditionalCountry = 'conditional_country',\n ConditionalQueueStatus = 'conditional_queue_status',\n ConditionalCustom = 'conditional_custom',\n ConditionalChannel = 'conditional_channel',\n BotAction = 'bot_action',\n WebviewActionTriggered = 'webview_action_triggered',\n HandoffOption = 'handoff_option',\n HandoffSuccess = 'handoff_success',\n HandoffFail = 'handoff_fail',\n Keyword = 'nlu_keyword',\n IntentSmart = 'nlu_intent_smart',\n Fallback = 'fallback',\n WebviewStep = 'webview_step',\n WebviewEnd = 'webview_end',\n Custom = 'custom',\n RedirectFlow = 'redirect_flow',\n CaptureUserInput = 'capture_user_input',\n AiAgentRouter = 'ai_agent_router',\n}\n\nexport interface HtBaseEventProps {\n action: EventAction\n}\n\nexport interface HtBaseEventAllFlowProps extends HtBaseEventProps {\n flowThreadId: string\n flowId: string\n flowName: string\n flowNodeId: string\n flowNodeContentId: string\n flowNodeIsMeaningful: boolean\n}\n\nexport interface EventFeedback extends HtBaseEventProps {\n action:\n | EventAction.FeedbackCase\n | EventAction.FeedbackConversation\n | EventAction.FeedbackMessage\n | EventAction.FeedbackWebview\n feedbackTargetId: string\n feedbackGroupId: string\n possibleOptions: string[]\n possibleValues?: number[]\n option: string\n value?: number\n comment?: string\n}\n\nexport interface EventFlow extends HtBaseEventProps {\n action: EventAction.FlowNode\n flowThreadId: string\n flowId: string\n flowName: string\n flowNodeId: string\n flowNodeContentId: string\n flowNodeIsMeaningful?: boolean\n}\n\nexport interface EventBotAction extends HtBaseEventAllFlowProps {\n action: EventAction.BotAction\n payload: string\n}\n\nexport interface EventConditionalCountry extends HtBaseEventAllFlowProps {\n action: EventAction.ConditionalCountry\n country: string\n}\n\nexport interface EventConditionalQueueStatus extends HtBaseEventAllFlowProps {\n action: EventAction.ConditionalQueueStatus\n queueId: string\n queueName: string\n isQueueOpen: boolean\n isAvailableAgent: boolean\n}\n\nexport interface EventConditionalCustom extends HtBaseEventAllFlowProps {\n action: EventAction.ConditionalCustom\n conditionalVariable: string\n variableFormat: string\n operator: string\n}\n\nexport interface EventConditionalChannel extends HtBaseEventAllFlowProps {\n action: EventAction.ConditionalChannel\n channel: string\n}\n\nexport interface EventHandoff extends HtBaseEventProps {\n action: EventAction.HandoffSuccess | EventAction.HandoffFail\n flowThreadId?: string\n flowId: string\n flowName: string\n flowNodeId: string\n flowNodeContentId: string\n queueId: string\n queueName: string\n caseId?: string\n isQueueOpen?: boolean\n isAvailableAgent?: boolean\n isThresholdReached?: boolean\n}\n\nexport interface EventHandoffOption extends HtBaseEventProps {\n action: EventAction.HandoffOption\n flowThreadId?: string\n flowId: string\n flowName: string\n flowNodeId: string\n flowNodeContentId: string\n queueId?: string\n queueName?: string\n}\n\nexport interface EventKeyword extends HtBaseEventProps {\n action: EventAction.Keyword\n flowThreadId: string\n flowId: string\n flowName: string\n flowNodeId: string\n flowNodeContentId: string\n nluKeywordName: string\n nluKeywordIsRegex?: boolean\n nluKeywordMessageId: string\n userInput: string\n}\n\nexport interface EventIntentSmart extends HtBaseEventProps {\n action: EventAction.IntentSmart\n flowThreadId: string\n flowId: string\n flowName: string\n flowNodeId: string\n flowNodeContentId: string\n nluIntentSmartTitle: string\n nluIntentSmartNumUsed: number\n nluIntentSmartMessageId: string\n userInput: string\n}\n\nexport interface EventWebviewActionTriggered extends HtBaseEventAllFlowProps {\n action: EventAction.WebviewActionTriggered\n webviewTargetId: string\n webviewName: string\n webviewParams?: Record<string, string>\n}\n\nexport interface EventAiAgent extends HtBaseEventAllFlowProps {\n action: EventAction.AiAgent\n toolsExecuted: ToolExecution[]\n inputMessageId: string\n memoryLength: number\n inputGuardrailsTriggered: string[]\n outputGuardrailsTriggered: string[]\n exit: boolean\n error: boolean\n}\n\nexport interface EventAiAgentRouter extends HtBaseEventAllFlowProps {\n action: EventAction.AiAgentRouter\n inputMessageId: string\n memoryLength: number\n inputGuardrailsTriggered: string[]\n outputGuardrailsTriggered: string[]\n exit: boolean\n error: boolean\n startingAgentName: string\n lastAgentName: string\n availableSpecialists: AvailableSpecialist[]\n isTransferredToSpecialist: boolean\n}\n\nexport interface EventRedirectFlow extends HtBaseEventAllFlowProps {\n action: EventAction.RedirectFlow\n flowTargetId: string\n flowTargetName: string\n}\n\nexport interface EventCaptureUserInput extends HtBaseEventAllFlowProps {\n action: EventAction.CaptureUserInput\n fieldName: string\n userInput: string\n captureSuccess: boolean\n messageId: string\n}\n\nexport interface EventFallback extends HtBaseEventProps {\n action: EventAction.Fallback\n flowId: string\n flowName: string\n flowNodeId: string\n flowNodeContentId: string\n userInput: string\n fallbackOut: number\n fallbackMessageId: string\n}\n\nexport interface EventWebviewStep extends HtBaseEventProps {\n action: EventAction.WebviewStep\n flowThreadId?: string\n webviewThreadId: string\n webviewName: string\n webviewStepName: string\n webviewStepNumber: number\n}\n\nexport interface EventWebviewEnd extends HtBaseEventProps {\n action: EventAction.WebviewEnd\n flowThreadId?: string\n webviewThreadId: string\n webviewName: string\n webviewStepName?: string\n webviewStepNumber?: number\n webviewEndFailType?: WebviewEndFailType\n webviewEndFailMessage?: string\n}\n\nexport enum WebviewEndFailType {\n CanceledByUser = 'canceled_by_user',\n ApiError = 'api_error',\n NeedsEscalation = 'needs_escalation',\n}\n\nexport interface EventCustom extends HtBaseEventProps {\n action: EventAction.Custom\n customFields?: Record<string, any>\n customSensitiveFields?: Record<string, any>\n}\n"],"names":["EVENT_FORMAT_VERSION","EventAction","WebviewEndFailType"],"mappings":"AAEO,MAAMA,oBAAoBA,GAAG,EAAC;AAE9B,IAAKC,6BAAWA,0BAAXA;;;;;;;;;;;;;;;;;;;;;;;;;WAAAA;MAyBX;AAuMM,IAAKC,oCAAkBA,0BAAlBA;;;;WAAAA;MAIX"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './ai-agents';
|
|
2
|
-
export * from './bot-config';
|
|
3
|
-
export * from './hubtype-analytics';
|
|
4
|
-
export * from './legacy-types';
|
|
1
|
+
export * from './ai-agents.js';
|
|
2
|
+
export * from './bot-config.js';
|
|
3
|
+
export * from './hubtype-analytics.js';
|
|
4
|
+
export * from './legacy-types.js';
|
package/lib/esm/models/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export * from "./ai-agents.js";
|
|
2
|
+
export * from "./bot-config.js";
|
|
3
|
+
export * from "./hubtype-analytics.js";
|
|
4
|
+
export * from "./legacy-types.js";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export {};
|
|
11
|
+
|
|
8
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"models/index.js","sources":["../../../src/models/index.ts"],"sourcesContent":["export * from './ai-agents'\nexport * from './bot-config'\nexport * from './hubtype-analytics'\nexport * from './legacy-types'\n"],"names":[],"mappings":";;;;AAA2B;AACC;AACO;AACL"}
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// TODO: This file contains all the legacy types we had in index.ts. After some refactors, we should be able to get rid of many of them.
|
|
3
|
-
|
|
4
|
-
exports.BotonicAction = exports.CaseStatus = exports.NluType = exports.INPUT = exports.PROVIDER = exports.CASE_RESOLUTION = exports.CASE_STATUS = void 0;
|
|
5
|
-
var CASE_STATUS;
|
|
6
|
-
(function (CASE_STATUS) {
|
|
2
|
+
var legacy_types_CASE_STATUS = /*#__PURE__*/ function(CASE_STATUS) {
|
|
7
3
|
CASE_STATUS["WAITING"] = "status_waiting";
|
|
8
4
|
CASE_STATUS["ATTENDING"] = "status_attending";
|
|
9
5
|
CASE_STATUS["IDLE"] = "status_idle";
|
|
10
6
|
CASE_STATUS["RESOLVED"] = "status_resolved";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
return CASE_STATUS;
|
|
8
|
+
}({});
|
|
9
|
+
var legacy_types_CASE_RESOLUTION = /*#__PURE__*/ function(CASE_RESOLUTION) {
|
|
14
10
|
CASE_RESOLUTION["OK"] = "result_ok";
|
|
15
11
|
CASE_RESOLUTION["NOK"] = "result_nok";
|
|
16
12
|
CASE_RESOLUTION["NOT_SOLVED"] = "result_not_solved";
|
|
17
13
|
CASE_RESOLUTION["BANNED"] = "result_banned";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
return CASE_RESOLUTION;
|
|
15
|
+
}({});
|
|
16
|
+
var legacy_types_PROVIDER = /*#__PURE__*/ function(PROVIDER) {
|
|
21
17
|
PROVIDER["APPLE"] = "apple";
|
|
22
18
|
PROVIDER["DEV"] = "dev";
|
|
23
19
|
PROVIDER["FACEBOOK"] = "facebook";
|
|
@@ -30,9 +26,9 @@ var PROVIDER;
|
|
|
30
26
|
PROVIDER["WEBCHAT"] = "webchat";
|
|
31
27
|
PROVIDER["WECHAT"] = "wechat";
|
|
32
28
|
PROVIDER["WHATSAPP"] = "whatsapp";
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
return PROVIDER;
|
|
30
|
+
}({});
|
|
31
|
+
var legacy_types_INPUT = /*#__PURE__*/ function(INPUT) {
|
|
36
32
|
INPUT["TEXT"] = "text";
|
|
37
33
|
INPUT["POSTBACK"] = "postback";
|
|
38
34
|
INPUT["AUDIO"] = "audio";
|
|
@@ -61,24 +57,28 @@ var INPUT;
|
|
|
61
57
|
INPUT["EVENT_QUEUE_POSITION_CHANGED"] = "case_event_queue_position_changed";
|
|
62
58
|
INPUT["EVENT_CASE_STATUS_CHANGED"] = "case_event_status_changed";
|
|
63
59
|
INPUT["SYSTEM_DEBUG_TRACE"] = "system_debug_trace";
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
return INPUT;
|
|
61
|
+
}({});
|
|
62
|
+
var legacy_types_NluType = /*#__PURE__*/ function(NluType) {
|
|
67
63
|
NluType["Keyword"] = "keyword";
|
|
68
64
|
NluType["SmartIntent"] = "smart-intent";
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
return NluType;
|
|
66
|
+
}({});
|
|
67
|
+
var legacy_types_CaseStatus = /*#__PURE__*/ function(CaseStatus) {
|
|
72
68
|
CaseStatus["Waiting"] = "status_waiting";
|
|
73
69
|
CaseStatus["Attending"] = "status_attending";
|
|
74
70
|
CaseStatus["Idle"] = "status_idle";
|
|
75
71
|
CaseStatus["Resolved"] = "status_resolved";
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
return CaseStatus;
|
|
73
|
+
}({});
|
|
74
|
+
var legacy_types_BotonicAction = /*#__PURE__*/ function(BotonicAction) {
|
|
79
75
|
BotonicAction["Redirect"] = "redirect_action";
|
|
80
76
|
BotonicAction["CreateCase"] = "create_case";
|
|
81
77
|
BotonicAction["DeleteUser"] = "delete_user";
|
|
82
78
|
BotonicAction["DiscardCase"] = "discard_case";
|
|
83
|
-
|
|
79
|
+
return BotonicAction;
|
|
80
|
+
}({});
|
|
81
|
+
|
|
82
|
+
export { legacy_types_BotonicAction as BotonicAction, legacy_types_CASE_RESOLUTION as CASE_RESOLUTION, legacy_types_CASE_STATUS as CASE_STATUS, legacy_types_CaseStatus as CaseStatus, legacy_types_INPUT as INPUT, legacy_types_NluType as NluType, legacy_types_PROVIDER as PROVIDER };
|
|
83
|
+
|
|
84
84
|
//# sourceMappingURL=legacy-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-types.js","sourceRoot":"","sources":["../../../src/models/legacy-types.ts"],"names":[],"mappings":";AAAA,wIAAwI;;;AAExI,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,yCAA0B,CAAA;IAC1B,6CAA8B,CAAA;IAC9B,mCAAoB,CAAA;IACpB,2CAA4B,CAAA;AAC9B,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AAQD,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,mCAAgB,CAAA;IAChB,qCAAkB,CAAA;IAClB,mDAAgC,CAAA;IAChC,2CAAwB,CAAA;AAC1B,CAAC,EALW,eAAe,+BAAf,eAAe,QAK1B;AAQD,IAAY,QAaX;AAbD,WAAY,QAAQ;IAClB,2BAAe,CAAA;IACf,uBAAW,CAAA;IACX,iCAAqB,CAAA;IACrB,+BAAmB,CAAA;IACnB,mCAAuB,CAAA;IACvB,iCAAqB,CAAA;IACrB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IACrB,+BAAmB,CAAA;IACnB,+BAAmB,CAAA;IACnB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;AACvB,CAAC,EAbW,QAAQ,wBAAR,QAAQ,QAanB;AAeD,IAAY,KA6BX;AA7BD,WAAY,KAAK;IACf,sBAAa,CAAA;IACb,8BAAqB,CAAA;IACrB,wBAAe,CAAA;IACf,wBAAe,CAAA;IACf,wBAAe,CAAA;IACf,8BAAqB,CAAA;IACrB,8BAAqB,CAAA;IACrB,4BAAmB,CAAA;IACnB,yCAAgC,CAAA;IAChC,8BAAqB,CAAA;IACrB,0BAAiB,CAAA;IACjB,6CAAoC,CAAA;IACpC,+CAAsC,CAAA;IACtC,oBAAW,CAAA;IACX,iCAAwB,CAAA;IACxB,sDAA6C,CAAA;IAC7C,4DAAmD,CAAA;IACnD,wEAA+D,CAAA;IAC/D,8CAAqC,CAAA;IACrC,8CAAqC,CAAA;IACrC,wDAA+C,CAAA;IAC/C,gEAAuD,CAAA;IACvD,4DAAmD,CAAA;IACnD,0CAAiC,CAAA;IACjC,yEAAgE,CAAA;IAChE,2EAAkE,CAAA;IAClE,gEAAuD,CAAA;IACvD,kDAAyC,CAAA;AAC3C,CAAC,EA7BW,KAAK,qBAAL,KAAK,QA6BhB;AA+CD,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,8BAAmB,CAAA;IACnB,uCAA4B,CAAA;AAC9B,CAAC,EAHW,OAAO,uBAAP,OAAO,QAGlB;AAwCD,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,wCAA0B,CAAA;IAC1B,4CAA8B,CAAA;IAC9B,kCAAoB,CAAA;IACpB,0CAA4B,CAAA;AAC9B,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB;AAqRD,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,6CAA4B,CAAA;IAC5B,2CAA0B,CAAA;IAC1B,2CAA0B,CAAA;IAC1B,6CAA4B,CAAA;AAC9B,CAAC,EALW,aAAa,6BAAb,aAAa,QAKxB"}
|
|
1
|
+
{"version":3,"file":"models/legacy-types.js","sources":["../../../src/models/legacy-types.ts"],"sourcesContent":["// TODO: This file contains all the legacy types we had in index.ts. After some refactors, we should be able to get rid of many of them.\n\nexport enum CASE_STATUS {\n WAITING = 'status_waiting',\n ATTENDING = 'status_attending',\n IDLE = 'status_idle',\n RESOLVED = 'status_resolved',\n}\n\nexport type CaseStatusType =\n | CASE_STATUS.ATTENDING\n | CASE_STATUS.IDLE\n | CASE_STATUS.RESOLVED\n | CASE_STATUS.WAITING\n\nexport enum CASE_RESOLUTION {\n OK = 'result_ok',\n NOK = 'result_nok',\n NOT_SOLVED = 'result_not_solved',\n BANNED = 'result_banned',\n}\n\nexport type CaseResolution =\n | CASE_RESOLUTION.BANNED\n | CASE_RESOLUTION.NOK\n | CASE_RESOLUTION.NOT_SOLVED\n | CASE_RESOLUTION.OK\n\nexport enum PROVIDER {\n APPLE = 'apple',\n DEV = 'dev',\n FACEBOOK = 'facebook',\n GENERIC = 'generic',\n INSTAGRAM = 'instagram',\n INTERCOM = 'intercom',\n SMOOCH = 'smooch',\n TELEGRAM = 'telegram',\n TWITTER = 'twitter',\n WEBCHAT = 'webchat',\n WECHAT = 'wechat',\n WHATSAPP = 'whatsapp',\n}\n\nexport type ProviderType =\n | PROVIDER.DEV\n | PROVIDER.FACEBOOK\n | PROVIDER.GENERIC\n | PROVIDER.INSTAGRAM\n | PROVIDER.INTERCOM\n | PROVIDER.SMOOCH\n | PROVIDER.TELEGRAM\n | PROVIDER.TWITTER\n | PROVIDER.WEBCHAT\n | PROVIDER.WECHAT\n | PROVIDER.WHATSAPP\n\nexport enum INPUT {\n TEXT = 'text',\n POSTBACK = 'postback',\n AUDIO = 'audio',\n IMAGE = 'image',\n VIDEO = 'video',\n DOCUMENT = 'document',\n LOCATION = 'location',\n CONTACT = 'contact',\n BUTTON_MESSAGE = 'buttonmessage',\n CAROUSEL = 'carousel',\n CUSTOM = 'custom',\n WEBCHAT_SETTINGS = 'webchatsettings',\n WHATSAPP_TEMPLATE = 'whatsapptemplate',\n RAW = 'raw',\n CHAT_EVENT = 'chatevent',\n WHATSAPP_BUTTON_LIST = 'whatsapp-button-list',\n WHATSAPP_CTA_URL_BUTTON = 'whatsapp-cta-url-button',\n WHATSAPP_REQUEST_CONTACT_INFO = 'whatsapp-request-contact-info',\n WHATSAPP_CATALOG = 'whatsapp-catalog',\n WHATSAPP_PRODUCT = 'whatsapp-product',\n WHATSAPP_PRODUCT_LIST = 'whatsapp-product-list',\n WHATSAPP_PRODUCT_CAROUSEL = 'whatsapp-product-carousel',\n WHATSAPP_MEDIA_CAROUSEL = 'whatsapp-media-carousel',\n WHATSAPP_ORDER = 'whatsapp_order',\n EVENT_AGENT_MESSAGE_CREATED = 'case_event_agent_message_created',\n EVENT_QUEUE_POSITION_CHANGED = 'case_event_queue_position_changed',\n EVENT_CASE_STATUS_CHANGED = 'case_event_status_changed',\n SYSTEM_DEBUG_TRACE = 'system_debug_trace',\n}\n\ninterface PluginConstructor<T> {\n new (arg: T): Plugin\n}\n\nexport interface PluginConfig<T> {\n id: string\n options?: T\n resolve: { default: PluginConstructor<T> }\n}\n\nexport type ResolvedPlugins = Record<string, Plugin>\n\nexport type InputType =\n | INPUT.AUDIO\n | INPUT.BUTTON_MESSAGE\n | INPUT.CAROUSEL\n | INPUT.CONTACT\n | INPUT.CUSTOM\n | INPUT.DOCUMENT\n | INPUT.IMAGE\n | INPUT.LOCATION\n | INPUT.POSTBACK\n | INPUT.TEXT\n | INPUT.VIDEO\n | INPUT.CHAT_EVENT\n | INPUT.WEBCHAT_SETTINGS\n | INPUT.WHATSAPP_TEMPLATE\n | INPUT.WHATSAPP_BUTTON_LIST\n | INPUT.WHATSAPP_CTA_URL_BUTTON\n | INPUT.WHATSAPP_REQUEST_CONTACT_INFO\n | INPUT.WHATSAPP_CATALOG\n | INPUT.WHATSAPP_PRODUCT\n | INPUT.WHATSAPP_PRODUCT_LIST\n | INPUT.WHATSAPP_PRODUCT_CAROUSEL\n | INPUT.WHATSAPP_MEDIA_CAROUSEL\n | INPUT.WHATSAPP_ORDER\n | INPUT.EVENT_AGENT_MESSAGE_CREATED\n | INPUT.EVENT_QUEUE_POSITION_CHANGED\n | INPUT.EVENT_CASE_STATUS_CHANGED\n\n/** Generated by Translation plugins: GoogleTranslation **/\nexport interface Translations {\n [languageCode: string]: string\n}\n\nexport enum NluType {\n Keyword = 'keyword',\n SmartIntent = 'smart-intent',\n}\n\nexport interface Input {\n text?: string\n src?: string\n data?: string\n path?: string\n payload?: string\n referral?: string\n type: InputType\n context?: {\n campaign?: Campaign\n campaigns_v2?: CampaignV2[]\n salesforce?: {\n access_token: string\n }\n }\n transcript?: string\n message_id: string\n bot_interaction_id: string\n catalog_id?: string\n product_items?: ProductItem[]\n nluResolution?: {\n type: NluType\n matchedValue: string\n payload?: string\n }\n origin?: string\n}\n\nexport interface CaseEventQueuePositionChangedInput {\n type: INPUT.EVENT_QUEUE_POSITION_CHANGED\n case_id: string\n prev_queue_position: number | null\n prev_queue_position_notified_at: string | null\n current_queue_position: number\n current_queue_position_notified_at: string\n total_queue_waiting_cases_number: number\n}\n\nexport enum CaseStatus {\n Waiting = 'status_waiting',\n Attending = 'status_attending',\n Idle = 'status_idle',\n Resolved = 'status_resolved',\n}\n\nexport interface CaseEventStatusChangedInput {\n type: INPUT.EVENT_CASE_STATUS_CHANGED\n case_id: string\n prev_status: CaseStatus | null\n next_status: CaseStatus\n}\n\nexport interface CaseEventAgentMessageCreatedInput {\n type: INPUT.EVENT_AGENT_MESSAGE_CREATED\n agent_id?: string\n agent_name?: string\n message?: {\n type: string\n data: string\n }\n}\n\ninterface ProductItem {\n product_retailer_id: string\n quantity: number\n item_price: number\n currency: string\n}\n\nexport interface Campaign {\n id: string\n name: string\n status: string\n start_date: string\n end_date: string\n bot_path: string\n template_name: string\n}\n\nexport interface CampaignV2 {\n id: string\n name: string\n agent_context?: string\n end_date?: string\n}\n\nexport interface ContactInfo {\n name: string\n type: string\n value: string\n description?: string\n}\n\nexport interface SessionUser<TExtraData = any> {\n id: string\n // login\n username?: string\n // person name\n name?: string\n // whatsapp, telegram,...\n provider: ProviderType\n // The provider's user id\n extra_data?: TExtraData\n contact_info?: ContactInfo[]\n imp_id?: string\n provider_id?: string\n locale: string\n country: string\n system_locale: string\n system_locale_updated?: boolean\n}\n\nexport interface HubtypeCaseContactReason {\n id: string\n name: string\n project_id: string\n}\n\nexport interface SessionBot {\n id: string\n name?: string\n}\n\nexport interface Session<TExtraData = any> {\n bot: SessionBot\n __retries: number\n _access_token: string\n _hubtype_api: string\n is_first_interaction: boolean\n is_test_integration: boolean\n last_session?: any\n organization_id: string\n organization: string\n user: SessionUser<TExtraData>\n // after handoff\n _botonic_action?: BotonicActionType\n _hubtype_case_resolution?: CaseResolution\n _hubtype_case_id?: string\n _hubtype_case_typification?: string\n _hubtype_case_contact_reasons?: HubtypeCaseContactReason[]\n _shadowing?: boolean\n external?: any\n zendesk_ticket_id?: string\n flow_thread_id?: string\n __campaign?: {\n id: string\n path: string\n active: boolean\n }\n capture_user_input?: {\n node_id: string\n }\n}\n\nexport type InputMatcher = (input: Input) => boolean\nexport type ParamsMatcher =\n | { [key: string]: string }\n | ((params: { [key: string]: string }) => boolean)\nexport type SessionMatcher<TExtraData = any> = (\n session: Session<TExtraData>\n) => boolean\nexport type RequestMatcher<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> = (request: BotContext<TPlugins, TExtraData>) => boolean\nexport type StringMatcher = RegExp | string | ((data: string) => boolean)\n\nexport type RouteMatcher =\n | InputMatcher\n | ParamsMatcher\n | RequestMatcher\n | SessionMatcher\n | StringMatcher\n\nexport interface Route<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> {\n action?: any\n childRoutes?: Route[]\n lastRoutePath?: string\n ignoreRetry?: boolean\n path: RoutePath\n redirect?: string\n retry?: number\n\n // matchers\n input?: InputMatcher\n params?: ParamsMatcher\n payload?: StringMatcher\n request?: RequestMatcher<TPlugins, TExtraData>\n session?: SessionMatcher<TExtraData>\n text?: StringMatcher\n data?: StringMatcher\n type?: StringMatcher\n}\n\nexport type Routes<R = Route> = R[] | ((request: BotContext) => R[])\n\nexport interface BotRequest<TExtraData = any> {\n input: Input\n lastRoutePath: RoutePath\n session: Session<TExtraData>\n settings: BotSettings\n secrets: BotSecrets\n}\n\nexport interface BotSettings {\n HUBTYPE_API_URL: string\n STATIC_URL: string\n LITELLM_API_URL: string\n AZURE_OPENAI_API_BASE: string\n AZURE_OPENAI_API_VERSION: string\n LANGUAGE_DETECTION_ENABLED?: boolean\n CUSTOM_SHORT_URL_HOST: string | null\n custom: Record<string, any>\n}\n\nexport interface BotSecrets {\n HUBTYPE_ACCESS_TOKEN: string\n LITELLM_API_KEY: string\n AZURE_OPENAI_API_KEY: string\n custom: Record<string, any>\n}\n\nexport interface BotContext<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> extends BotRequest<TExtraData> {\n getUserCountry: () => string\n getUserLocale: () => string\n getSystemLocale: () => string\n setUserCountry: (country: string) => void\n setUserLocale: (locale: string) => void\n setSystemLocale: (locale: string) => void\n defaultDelay: number\n defaultTyping: number\n params: Record<string, string>\n plugins: TPlugins\n}\n\n/** The response of the bot for the triggered actions, which can be\n * the one matched by the routes, the default action and the retry actions.\n * See Response at @botonic/react's index.d.ts for the React type\n * */\nexport interface BotResponse extends BotRequest {\n response: any\n}\n\nexport type PluginPreRequest<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> = BotContext<TPlugins, TExtraData>\n\nexport type PluginPostRequest<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> = BotContext<TPlugins, TExtraData> & {\n response: string | null\n}\n\nexport interface Plugin {\n post?(request: PluginPostRequest): void | Promise<void>\n pre?(request: PluginPreRequest): void | Promise<void>\n}\n\nexport interface Params {\n [key: string]: any\n}\n\nexport type Nullable<T> = T | null\n\nexport type Action = Nullable<() => any>\nexport type RoutePath = Nullable<string>\n\nexport interface ProcessInputResult {\n action: Action\n emptyAction: Action\n fallbackAction: Action\n lastRoutePath: RoutePath\n params: Params\n}\n\nexport type MatchedValue = boolean | RegExpExecArray | null\n\nexport type RoutingState = {\n currentRoute: Nullable<Route>\n matchedRoute: Nullable<Route>\n params: Params\n isFlowBroken: boolean\n}\n\nexport interface RouteParams {\n route: Nullable<Route>\n params: Params\n}\nexport interface PathParams {\n path: RoutePath\n params: Params\n}\n\nexport type MatchingProp =\n | 'text'\n | 'payload'\n | 'type'\n | 'input'\n | 'session'\n | 'request'\n\nexport type Matcher = string | RegExp | ((args) => boolean)\n\nexport type BotonicActionType =\n | `${BotonicAction.CreateCase}${BotonicActionSeparator}${string}`\n | `${BotonicAction.Redirect}${BotonicActionSeparator}${string}`\n | `${BotonicAction.DiscardCase}${BotonicActionSeparator}${string}`\n | `${BotonicAction.DiscardCase}`\n | `${BotonicAction.DeleteUser}`\n\ntype BotonicActionSeparator = ':'\n\nexport enum BotonicAction {\n Redirect = 'redirect_action',\n CreateCase = 'create_case',\n DeleteUser = 'delete_user',\n DiscardCase = 'discard_case',\n}\n"],"names":["CASE_STATUS","CASE_RESOLUTION","PROVIDER","INPUT","NluType","CaseStatus","BotonicAction"],"mappings":"AAAA,wIAAwI;AAEjI,IAAKA,wBAAWA,0BAAXA;;;;;WAAAA;MAKX;AAQM,IAAKC,4BAAeA,0BAAfA;;;;;WAAAA;MAKX;AAQM,IAAKC,qBAAQA,0BAARA;;;;;;;;;;;;;WAAAA;MAaX;AAeM,IAAKC,kBAAKA,0BAALA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAAAA;MA6BX;AA+CM,IAAKC,oBAAOA,0BAAPA;;;WAAAA;MAGX;AAwCM,IAAKC,uBAAUA,0BAAVA;;;;;WAAAA;MAKX;AAqRM,IAAKC,0BAAaA,0BAAbA;;;;;WAAAA;MAKX"}
|
package/lib/esm/plugins.d.ts
CHANGED
package/lib/esm/plugins.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runPlugins = runPlugins;
|
|
4
|
-
async function runPlugins({ botContext, mode, response = null, }) {
|
|
1
|
+
async function runPlugins({ botContext, mode, response = null }) {
|
|
5
2
|
const plugins = botContext.plugins;
|
|
6
|
-
for
|
|
3
|
+
for(const key in plugins){
|
|
7
4
|
const plugin = plugins[key];
|
|
8
5
|
try {
|
|
9
6
|
if (mode === 'pre' && typeof plugin.pre === 'function') {
|
|
@@ -12,13 +9,15 @@ async function runPlugins({ botContext, mode, response = null, }) {
|
|
|
12
9
|
if (mode === 'post' && typeof plugin.post === 'function') {
|
|
13
10
|
await plugin.post({
|
|
14
11
|
...botContext,
|
|
15
|
-
response
|
|
12
|
+
response
|
|
16
13
|
});
|
|
17
14
|
}
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
15
|
+
} catch (e) {
|
|
20
16
|
console.log(e);
|
|
21
17
|
}
|
|
22
18
|
}
|
|
23
19
|
}
|
|
20
|
+
|
|
21
|
+
export { runPlugins };
|
|
22
|
+
|
|
24
23
|
//# sourceMappingURL=plugins.js.map
|
package/lib/esm/plugins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","
|
|
1
|
+
{"version":3,"file":"plugins.js","sources":["../../src/plugins.ts"],"sourcesContent":["import type { BotContext, Plugin } from './models'\n\ninterface RunPluginArgs {\n botContext: BotContext\n mode: PluginMode\n response?: string | null\n}\n\ntype PluginMode = 'pre' | 'post'\n\nexport async function runPlugins({\n botContext,\n mode,\n response = null,\n}: RunPluginArgs): Promise<void> {\n const plugins = botContext.plugins\n for (const key in plugins) {\n const plugin: Plugin = plugins[key]\n try {\n if (mode === 'pre' && typeof plugin.pre === 'function') {\n await plugin.pre(botContext)\n }\n if (mode === 'post' && typeof plugin.post === 'function') {\n await plugin.post({\n ...botContext,\n response,\n })\n }\n } catch (e) {\n console.log(e)\n }\n }\n}\n"],"names":["runPlugins","botContext","mode","response","plugins","key","plugin","e","console"],"mappings":"AAUO,eAAeA,UAAUA,CAAC,EAC/BC,UAAU,EACVC,IAAI,EACJC,WAAW,IAAI,EACD;IACd,MAAMC,UAAUH,WAAW,OAAO;IAClC,IAAK,MAAMI,OAAOD,QAAS;QACzB,MAAME,SAAiBF,OAAO,CAACC,IAAI;QACnC,IAAI;YACF,IAAIH,SAAS,SAAS,OAAOI,OAAO,GAAG,KAAK,YAAY;gBACtD,MAAMA,OAAO,GAAG,CAACL;YACnB;YACA,IAAIC,SAAS,UAAU,OAAOI,OAAO,IAAI,KAAK,YAAY;gBACxD,MAAMA,OAAO,IAAI,CAAC;oBAChB,GAAGL,UAAU;oBACbE;gBACF;YACF;QACF,EAAE,OAAOI,GAAG;YACVC,QAAQ,GAAG,CAACD;QACd;IACF;AACF"}
|
package/lib/esm/pusher-utils.js
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { inflate } from "pako";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
7
|
* @param compressedData a string representing gzipped data previously encoded to base64 for very large contents
|
|
8
8
|
* @returns a string representing the information of a very large content
|
|
9
9
|
* Ref: https://stackoverflow.com/questions/4875020/javascript-decompress-inflate-unzip-ungzip-strings (check jsfiddle proposal)
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const charData = strData.split('').map(x
|
|
14
|
-
|
|
15
|
-
const
|
|
10
|
+
*/ function decompressData(compressedData) {
|
|
11
|
+
const strData = atob(compressedData) // Decode base64 (convert ascii to binary)
|
|
12
|
+
;
|
|
13
|
+
const charData = strData.split('').map((x)=>x.charCodeAt(0)) // Convert binary string to character-number array
|
|
14
|
+
;
|
|
15
|
+
const binData = new Uint8Array(charData) // Turn number array into byte-array
|
|
16
|
+
;
|
|
17
|
+
const data = inflate(binData);
|
|
16
18
|
return new TextDecoder('utf-8').decode(data);
|
|
17
19
|
}
|
|
20
|
+
|
|
21
|
+
export { decompressData };
|
|
22
|
+
|
|
18
23
|
//# sourceMappingURL=pusher-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pusher-utils.js","
|
|
1
|
+
{"version":3,"file":"pusher-utils.js","sources":["../../src/pusher-utils.ts"],"sourcesContent":["import { inflate } from 'pako'\n\n/**\n *\n * @param compressedData a string representing gzipped data previously encoded to base64 for very large contents\n * @returns a string representing the information of a very large content\n * Ref: https://stackoverflow.com/questions/4875020/javascript-decompress-inflate-unzip-ungzip-strings (check jsfiddle proposal)\n */\nexport function decompressData(compressedData: string): string {\n const strData = atob(compressedData) // Decode base64 (convert ascii to binary)\n const charData = strData.split('').map(x => x.charCodeAt(0)) // Convert binary string to character-number array\n const binData = new Uint8Array(charData) // Turn number array into byte-array\n const data = inflate(binData)\n return new TextDecoder('utf-8').decode(data)\n}\n"],"names":["inflate","decompressData","compressedData","strData","atob","charData","x","binData","Uint8Array","data","TextDecoder"],"mappings":";;;AAA8B;AAE9B;;;;;CAKC,GACM,SAASC,cAAcA,CAACC,cAAsB;IACnD,MAAMC,UAAUC,KAAKF,gBAAgB,0CAA0C;;IAC/E,MAAMG,WAAWF,QAAQ,KAAK,CAAC,IAAI,GAAG,CAACG,CAAAA,IAAKA,EAAE,UAAU,CAAC,IAAI,kDAAkD;;IAC/G,MAAMC,UAAU,IAAIC,WAAWH,UAAU,oCAAoC;;IAC7E,MAAMI,OAAOT,OAAOA,CAACO;IACrB,OAAO,IAAIG,YAAY,SAAS,MAAM,CAACD;AACzC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './router';
|
|
2
|
-
export * from './router-utils';
|
|
1
|
+
export * from './router.js';
|
|
2
|
+
export * from './router-utils.js';
|
package/lib/esm/routing/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export * from "./router.js";
|
|
2
|
+
export * from "./router-utils.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export {};
|
|
7
|
+
|
|
6
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"routing/index.js","sources":["../../../src/routing/index.ts"],"sourcesContent":["export * from './router'\nexport * from './router-utils'\n"],"names":[],"mappings":";;AAAwB;AACM"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Action, BotContext, Input, Params, PathParams, Route, Routes } from '../models';
|
|
1
|
+
import type { Action, BotContext, Input, Params, PathParams, Route, Routes } from '../models/index.js';
|
|
2
2
|
export declare class NoMatchingRouteError extends Error {
|
|
3
3
|
input: Input;
|
|
4
4
|
constructor(input: Input);
|