@botonic/core 0.55.1 → 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.
Files changed (131) hide show
  1. package/lib/esm/constants.js +7 -7
  2. package/lib/esm/constants.js.map +1 -1
  3. package/lib/esm/core-bot.d.ts +3 -3
  4. package/lib/esm/core-bot.js +87 -50
  5. package/lib/esm/core-bot.js.map +1 -1
  6. package/lib/esm/debug/index.d.ts +1 -1
  7. package/lib/esm/debug/index.js +5 -4
  8. package/lib/esm/debug/index.js.map +1 -1
  9. package/lib/esm/debug/inspector.d.ts +1 -1
  10. package/lib/esm/debug/inspector.js +27 -21
  11. package/lib/esm/debug/inspector.js.map +1 -1
  12. package/lib/esm/handoff.d.ts +1 -1
  13. package/lib/esm/handoff.js +82 -53
  14. package/lib/esm/handoff.js.map +1 -1
  15. package/lib/esm/hubtype-service.d.ts +3 -3
  16. package/lib/esm/hubtype-service.js +100 -64
  17. package/lib/esm/hubtype-service.js.map +1 -1
  18. package/lib/esm/index.d.ts +9 -9
  19. package/lib/esm/index.js +21 -12
  20. package/lib/esm/index.js.map +1 -1
  21. package/lib/esm/models/ai-agents.js +15 -15
  22. package/lib/esm/models/ai-agents.js.map +1 -1
  23. package/lib/esm/models/bot-config.js +6 -6
  24. package/lib/esm/models/bot-config.js.map +1 -1
  25. package/lib/esm/models/hubtype-analytics.d.ts +1 -1
  26. package/lib/esm/models/hubtype-analytics.js +10 -10
  27. package/lib/esm/models/hubtype-analytics.js.map +1 -1
  28. package/lib/esm/models/index.d.ts +4 -4
  29. package/lib/esm/models/index.js +11 -7
  30. package/lib/esm/models/index.js.map +1 -1
  31. package/lib/esm/models/legacy-types.d.ts +3 -1
  32. package/lib/esm/models/legacy-types.js +25 -24
  33. package/lib/esm/models/legacy-types.js.map +1 -1
  34. package/lib/esm/package.json +3 -0
  35. package/lib/esm/plugins.d.ts +1 -1
  36. package/lib/esm/plugins.js +7 -8
  37. package/lib/esm/plugins.js.map +1 -1
  38. package/lib/esm/pusher-utils.js +15 -10
  39. package/lib/esm/pusher-utils.js.map +1 -1
  40. package/lib/esm/routing/index.d.ts +2 -2
  41. package/lib/esm/routing/index.js +7 -5
  42. package/lib/esm/routing/index.js.map +1 -1
  43. package/lib/esm/routing/router-utils.d.ts +1 -1
  44. package/lib/esm/routing/router-utils.js +37 -30
  45. package/lib/esm/routing/router-utils.js.map +1 -1
  46. package/lib/esm/routing/router.d.ts +2 -2
  47. package/lib/esm/routing/router.js +152 -149
  48. package/lib/esm/routing/router.js.map +1 -1
  49. package/lib/esm/testing/index.d.ts +1 -1
  50. package/lib/esm/testing/index.js +60 -94
  51. package/lib/esm/testing/index.js.map +1 -1
  52. package/lib/esm/utils/bot-config.d.ts +1 -1
  53. package/lib/esm/utils/bot-config.js +57 -28
  54. package/lib/esm/utils/bot-config.js.map +1 -1
  55. package/lib/esm/utils/check-providers.d.ts +1 -1
  56. package/lib/esm/utils/check-providers.js +14 -17
  57. package/lib/esm/utils/check-providers.js.map +1 -1
  58. package/lib/esm/utils/functional.js +19 -38
  59. package/lib/esm/utils/functional.js.map +1 -1
  60. package/lib/esm/utils/index.d.ts +3 -3
  61. package/lib/esm/utils/index.js +9 -6
  62. package/lib/esm/utils/index.js.map +1 -1
  63. package/package.json +12 -11
  64. package/src/hubtype-service.ts +4 -2
  65. package/src/models/legacy-types.ts +3 -0
  66. package/lib/cjs/constants.d.ts +0 -4
  67. package/lib/cjs/constants.js +0 -8
  68. package/lib/cjs/constants.js.map +0 -1
  69. package/lib/cjs/core-bot.d.ts +0 -43
  70. package/lib/cjs/core-bot.js +0 -205
  71. package/lib/cjs/core-bot.js.map +0 -1
  72. package/lib/cjs/debug/index.d.ts +0 -1
  73. package/lib/cjs/debug/index.js +0 -5
  74. package/lib/cjs/debug/index.js.map +0 -1
  75. package/lib/cjs/debug/inspector.d.ts +0 -24
  76. package/lib/cjs/debug/inspector.js +0 -70
  77. package/lib/cjs/debug/inspector.js.map +0 -1
  78. package/lib/cjs/handoff.d.ts +0 -110
  79. package/lib/cjs/handoff.js +0 -238
  80. package/lib/cjs/handoff.js.map +0 -1
  81. package/lib/cjs/hubtype-service.d.ts +0 -58
  82. package/lib/cjs/hubtype-service.js +0 -205
  83. package/lib/cjs/hubtype-service.js.map +0 -1
  84. package/lib/cjs/index.d.ts +0 -9
  85. package/lib/cjs/index.js +0 -13
  86. package/lib/cjs/index.js.map +0 -1
  87. package/lib/cjs/models/ai-agents.d.ts +0 -140
  88. package/lib/cjs/models/ai-agents.js +0 -30
  89. package/lib/cjs/models/ai-agents.js.map +0 -1
  90. package/lib/cjs/models/bot-config.d.ts +0 -24
  91. package/lib/cjs/models/bot-config.js +0 -10
  92. package/lib/cjs/models/bot-config.js.map +0 -1
  93. package/lib/cjs/models/hubtype-analytics.d.ts +0 -210
  94. package/lib/cjs/models/hubtype-analytics.js +0 -38
  95. package/lib/cjs/models/hubtype-analytics.js.map +0 -1
  96. package/lib/cjs/models/index.d.ts +0 -4
  97. package/lib/cjs/models/index.js +0 -8
  98. package/lib/cjs/models/index.js.map +0 -1
  99. package/lib/cjs/models/legacy-types.d.ts +0 -330
  100. package/lib/cjs/models/legacy-types.js +0 -83
  101. package/lib/cjs/models/legacy-types.js.map +0 -1
  102. package/lib/cjs/plugins.d.ts +0 -9
  103. package/lib/cjs/plugins.js +0 -24
  104. package/lib/cjs/plugins.js.map +0 -1
  105. package/lib/cjs/pusher-utils.d.ts +0 -7
  106. package/lib/cjs/pusher-utils.js +0 -18
  107. package/lib/cjs/pusher-utils.js.map +0 -1
  108. package/lib/cjs/routing/index.d.ts +0 -2
  109. package/lib/cjs/routing/index.js +0 -6
  110. package/lib/cjs/routing/index.js.map +0 -1
  111. package/lib/cjs/routing/router-utils.d.ts +0 -11
  112. package/lib/cjs/routing/router-utils.js +0 -96
  113. package/lib/cjs/routing/router-utils.js.map +0 -1
  114. package/lib/cjs/routing/router.d.ts +0 -54
  115. package/lib/cjs/routing/router.js +0 -330
  116. package/lib/cjs/routing/router.js.map +0 -1
  117. package/lib/cjs/testing/index.d.ts +0 -91
  118. package/lib/cjs/testing/index.js +0 -196
  119. package/lib/cjs/testing/index.js.map +0 -1
  120. package/lib/cjs/utils/bot-config.d.ts +0 -4
  121. package/lib/cjs/utils/bot-config.js +0 -94
  122. package/lib/cjs/utils/bot-config.js.map +0 -1
  123. package/lib/cjs/utils/check-providers.d.ts +0 -8
  124. package/lib/cjs/utils/check-providers.js +0 -34
  125. package/lib/cjs/utils/check-providers.js.map +0 -1
  126. package/lib/cjs/utils/functional.d.ts +0 -10
  127. package/lib/cjs/utils/functional.js +0 -88
  128. package/lib/cjs/utils/functional.js.map +0 -1
  129. package/lib/cjs/utils/index.d.ts +0 -3
  130. package/lib/cjs/utils/index.js +0 -7
  131. package/lib/cjs/utils/index.js.map +0 -1
package/lib/esm/index.js CHANGED
@@ -1,13 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./constants"), exports);
5
- tslib_1.__exportStar(require("./core-bot"), exports);
6
- tslib_1.__exportStar(require("./debug"), exports);
7
- tslib_1.__exportStar(require("./handoff"), exports);
8
- tslib_1.__exportStar(require("./hubtype-service"), exports);
9
- tslib_1.__exportStar(require("./models"), exports);
10
- tslib_1.__exportStar(require("./plugins"), exports);
11
- tslib_1.__exportStar(require("./routing"), exports);
12
- tslib_1.__exportStar(require("./utils"), exports);
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
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,sDAA2B;AAC3B,qDAA0B;AAC1B,kDAAuB;AACvB,oDAAyB;AACzB,4DAAiC;AACjC,mDAAwB;AACxB,oDAAyB;AACzB,oDAAyB;AACzB,kDAAuB"}
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"}
@@ -1,30 +1,30 @@
1
- "use strict";
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
6
  OutputMessageType["Exit"] = "exit";
11
- })(OutputMessageType || (exports.OutputMessageType = OutputMessageType = {}));
12
- var VerbosityLevel;
13
- (function (VerbosityLevel) {
7
+ return OutputMessageType;
8
+ }({});
9
+ var ai_agents_VerbosityLevel = /*#__PURE__*/ function(VerbosityLevel) {
14
10
  VerbosityLevel["Low"] = "low";
15
11
  VerbosityLevel["Medium"] = "medium";
16
12
  VerbosityLevel["High"] = "high";
17
- })(VerbosityLevel || (exports.VerbosityLevel = VerbosityLevel = {}));
18
- var ReasoningEffort;
19
- (function (ReasoningEffort) {
13
+ return VerbosityLevel;
14
+ }({});
15
+ var ai_agents_ReasoningEffort = /*#__PURE__*/ function(ReasoningEffort) {
20
16
  ReasoningEffort["None"] = "none";
21
17
  ReasoningEffort["Low"] = "low";
22
18
  ReasoningEffort["Medium"] = "medium";
23
19
  ReasoningEffort["High"] = "high";
24
- })(ReasoningEffort || (exports.ReasoningEffort = ReasoningEffort = {}));
25
- var AiAgentType;
26
- (function (AiAgentType) {
20
+ return ReasoningEffort;
21
+ }({});
22
+ var ai_agents_AiAgentType = /*#__PURE__*/ function(AiAgentType) {
27
23
  AiAgentType["Specialist"] = "specialist";
28
24
  AiAgentType["Router"] = "router";
29
- })(AiAgentType || (exports.AiAgentType = AiAgentType = {}));
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
+
30
30
  //# sourceMappingURL=ai-agents.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ai-agents.js","sourceRoot":"","sources":["../../../src/models/ai-agents.ts"],"names":[],"mappings":";;;AAEA,IAAY,iBAMX;AAND,WAAY,iBAAiB;IAC3B,kCAAa,CAAA;IACb,wDAAmC,CAAA;IACnC,gDAA2B,CAAA;IAC3B,0CAAqB,CAAA;IACrB,kCAAa,CAAA;AACf,CAAC,EANW,iBAAiB,iCAAjB,iBAAiB,QAM5B;AAwGD,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,mCAAiB,CAAA;IACjB,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB;AAED,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,8BAAW,CAAA;IACX,oCAAiB,CAAA;IACjB,gCAAa,CAAA;AACf,CAAC,EALW,eAAe,+BAAf,eAAe,QAK1B;AAYD,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,wCAAyB,CAAA;IACzB,gCAAiB,CAAA;AACnB,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB"}
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
- "use strict";
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
- })(VariableType || (exports.VariableType = VariableType = {}));
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","sourceRoot":"","sources":["../../../src/models/bot-config.ts"],"names":[],"mappings":";;;AAoBA,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,iCAAiB,CAAA;IACjB,mCAAmB,CAAA;AACrB,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB"}
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,4 +1,4 @@
1
- import type { AvailableSpecialist, ToolExecution } from './ai-agents';
1
+ import type { AvailableSpecialist, ToolExecution } from './ai-agents.js';
2
2
  export declare const EVENT_FORMAT_VERSION = 5;
3
3
  export declare enum EventAction {
4
4
  AiAgent = "ai_agent",
@@ -1,9 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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
- })(EventAction || (exports.EventAction = EventAction = {}));
32
- var WebviewEndFailType;
33
- (function (WebviewEndFailType) {
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
- })(WebviewEndFailType || (exports.WebviewEndFailType = WebviewEndFailType = {}));
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","sourceRoot":"","sources":["../../../src/models/hubtype-analytics.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAG,CAAC,CAAA;AAErC,IAAY,WAyBX;AAzBD,WAAY,WAAW;IACrB,mCAAoB,CAAA;IACpB,6CAA8B,CAAA;IAC9B,mDAAoC,CAAA;IACpC,6DAA8C,CAAA;IAC9C,mDAAoC,CAAA;IACpC,qCAAsB,CAAA;IACtB,yDAA0C,CAAA;IAC1C,kEAAmD,CAAA;IACnD,uDAAwC,CAAA;IACxC,yDAA0C,CAAA;IAC1C,uCAAwB,CAAA;IACxB,kEAAmD,CAAA;IACnD,+CAAgC,CAAA;IAChC,iDAAkC,CAAA;IAClC,2CAA4B,CAAA;IAC5B,sCAAuB,CAAA;IACvB,+CAAgC,CAAA;IAChC,oCAAqB,CAAA;IACrB,2CAA4B,CAAA;IAC5B,yCAA0B,CAAA;IAC1B,gCAAiB,CAAA;IACjB,6CAA8B,CAAA;IAC9B,sDAAuC,CAAA;IACvC,gDAAiC,CAAA;AACnC,CAAC,EAzBW,WAAW,2BAAX,WAAW,QAyBtB;AAuMD,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,yDAAmC,CAAA;IACnC,4CAAsB,CAAA;IACtB,0DAAoC,CAAA;AACtC,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B"}
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';
@@ -1,8 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./ai-agents"), exports);
5
- tslib_1.__exportStar(require("./bot-config"), exports);
6
- tslib_1.__exportStar(require("./hubtype-analytics"), exports);
7
- tslib_1.__exportStar(require("./legacy-types"), exports);
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","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":";;;AAAA,sDAA2B;AAC3B,uDAA4B;AAC5B,8DAAmC;AACnC,yDAA8B"}
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"}
@@ -45,6 +45,7 @@ export declare enum INPUT {
45
45
  CHAT_EVENT = "chatevent",
46
46
  WHATSAPP_BUTTON_LIST = "whatsapp-button-list",
47
47
  WHATSAPP_CTA_URL_BUTTON = "whatsapp-cta-url-button",
48
+ WHATSAPP_REQUEST_CONTACT_INFO = "whatsapp-request-contact-info",
48
49
  WHATSAPP_CATALOG = "whatsapp-catalog",
49
50
  WHATSAPP_PRODUCT = "whatsapp-product",
50
51
  WHATSAPP_PRODUCT_LIST = "whatsapp-product-list",
@@ -67,7 +68,7 @@ export interface PluginConfig<T> {
67
68
  };
68
69
  }
69
70
  export type ResolvedPlugins = Record<string, Plugin>;
70
- export type InputType = INPUT.AUDIO | INPUT.BUTTON_MESSAGE | INPUT.CAROUSEL | INPUT.CONTACT | INPUT.CUSTOM | INPUT.DOCUMENT | INPUT.IMAGE | INPUT.LOCATION | INPUT.POSTBACK | INPUT.TEXT | INPUT.VIDEO | INPUT.CHAT_EVENT | INPUT.WEBCHAT_SETTINGS | INPUT.WHATSAPP_TEMPLATE | INPUT.WHATSAPP_BUTTON_LIST | INPUT.WHATSAPP_CTA_URL_BUTTON | INPUT.WHATSAPP_CATALOG | INPUT.WHATSAPP_PRODUCT | INPUT.WHATSAPP_PRODUCT_LIST | INPUT.WHATSAPP_PRODUCT_CAROUSEL | INPUT.WHATSAPP_MEDIA_CAROUSEL | INPUT.WHATSAPP_ORDER | INPUT.EVENT_AGENT_MESSAGE_CREATED | INPUT.EVENT_QUEUE_POSITION_CHANGED | INPUT.EVENT_CASE_STATUS_CHANGED;
71
+ export type InputType = INPUT.AUDIO | INPUT.BUTTON_MESSAGE | INPUT.CAROUSEL | INPUT.CONTACT | INPUT.CUSTOM | INPUT.DOCUMENT | INPUT.IMAGE | INPUT.LOCATION | INPUT.POSTBACK | INPUT.TEXT | INPUT.VIDEO | INPUT.CHAT_EVENT | INPUT.WEBCHAT_SETTINGS | INPUT.WHATSAPP_TEMPLATE | INPUT.WHATSAPP_BUTTON_LIST | INPUT.WHATSAPP_CTA_URL_BUTTON | INPUT.WHATSAPP_REQUEST_CONTACT_INFO | INPUT.WHATSAPP_CATALOG | INPUT.WHATSAPP_PRODUCT | INPUT.WHATSAPP_PRODUCT_LIST | INPUT.WHATSAPP_PRODUCT_CAROUSEL | INPUT.WHATSAPP_MEDIA_CAROUSEL | INPUT.WHATSAPP_ORDER | INPUT.EVENT_AGENT_MESSAGE_CREATED | INPUT.EVENT_QUEUE_POSITION_CHANGED | INPUT.EVENT_CASE_STATUS_CHANGED;
71
72
  /** Generated by Translation plugins: GoogleTranslation **/
72
73
  export interface Translations {
73
74
  [languageCode: string]: string;
@@ -101,6 +102,7 @@ export interface Input {
101
102
  matchedValue: string;
102
103
  payload?: string;
103
104
  };
105
+ origin?: string;
104
106
  }
105
107
  export interface CaseEventQueuePositionChangedInput {
106
108
  type: INPUT.EVENT_QUEUE_POSITION_CHANGED;
@@ -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
- Object.defineProperty(exports, "__esModule", { value: true });
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
- })(CASE_STATUS || (exports.CASE_STATUS = CASE_STATUS = {}));
12
- var CASE_RESOLUTION;
13
- (function (CASE_RESOLUTION) {
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
- })(CASE_RESOLUTION || (exports.CASE_RESOLUTION = CASE_RESOLUTION = {}));
19
- var PROVIDER;
20
- (function (PROVIDER) {
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
- })(PROVIDER || (exports.PROVIDER = PROVIDER = {}));
34
- var INPUT;
35
- (function (INPUT) {
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";
@@ -50,6 +46,7 @@ var INPUT;
50
46
  INPUT["CHAT_EVENT"] = "chatevent";
51
47
  INPUT["WHATSAPP_BUTTON_LIST"] = "whatsapp-button-list";
52
48
  INPUT["WHATSAPP_CTA_URL_BUTTON"] = "whatsapp-cta-url-button";
49
+ INPUT["WHATSAPP_REQUEST_CONTACT_INFO"] = "whatsapp-request-contact-info";
53
50
  INPUT["WHATSAPP_CATALOG"] = "whatsapp-catalog";
54
51
  INPUT["WHATSAPP_PRODUCT"] = "whatsapp-product";
55
52
  INPUT["WHATSAPP_PRODUCT_LIST"] = "whatsapp-product-list";
@@ -60,24 +57,28 @@ var INPUT;
60
57
  INPUT["EVENT_QUEUE_POSITION_CHANGED"] = "case_event_queue_position_changed";
61
58
  INPUT["EVENT_CASE_STATUS_CHANGED"] = "case_event_status_changed";
62
59
  INPUT["SYSTEM_DEBUG_TRACE"] = "system_debug_trace";
63
- })(INPUT || (exports.INPUT = INPUT = {}));
64
- var NluType;
65
- (function (NluType) {
60
+ return INPUT;
61
+ }({});
62
+ var legacy_types_NluType = /*#__PURE__*/ function(NluType) {
66
63
  NluType["Keyword"] = "keyword";
67
64
  NluType["SmartIntent"] = "smart-intent";
68
- })(NluType || (exports.NluType = NluType = {}));
69
- var CaseStatus;
70
- (function (CaseStatus) {
65
+ return NluType;
66
+ }({});
67
+ var legacy_types_CaseStatus = /*#__PURE__*/ function(CaseStatus) {
71
68
  CaseStatus["Waiting"] = "status_waiting";
72
69
  CaseStatus["Attending"] = "status_attending";
73
70
  CaseStatus["Idle"] = "status_idle";
74
71
  CaseStatus["Resolved"] = "status_resolved";
75
- })(CaseStatus || (exports.CaseStatus = CaseStatus = {}));
76
- var BotonicAction;
77
- (function (BotonicAction) {
72
+ return CaseStatus;
73
+ }({});
74
+ var legacy_types_BotonicAction = /*#__PURE__*/ function(BotonicAction) {
78
75
  BotonicAction["Redirect"] = "redirect_action";
79
76
  BotonicAction["CreateCase"] = "create_case";
80
77
  BotonicAction["DeleteUser"] = "delete_user";
81
78
  BotonicAction["DiscardCase"] = "discard_case";
82
- })(BotonicAction || (exports.BotonicAction = BotonicAction = {}));
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
+
83
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,KA4BX;AA5BD,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,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,EA5BW,KAAK,qBAAL,KAAK,QA4BhB;AA8CD,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,8BAAmB,CAAA;IACnB,uCAA4B,CAAA;AAC9B,CAAC,EAHW,OAAO,uBAAP,OAAO,QAGlB;AAuCD,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"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -1,4 +1,4 @@
1
- import type { BotContext } from './models';
1
+ import type { BotContext } from './models/index.js';
2
2
  interface RunPluginArgs {
3
3
  botContext: BotContext;
4
4
  mode: PluginMode;
@@ -1,9 +1,6 @@
1
- "use strict";
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 (const key in plugins) {
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
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/plugins.ts"],"names":[],"mappings":";;AAUA,gCAsBC;AAtBM,KAAK,UAAU,UAAU,CAAC,EAC/B,UAAU,EACV,IAAI,EACJ,QAAQ,GAAG,IAAI,GACD;IACd,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAA;IAClC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAW,OAAO,CAAC,GAAG,CAAC,CAAA;QACnC,IAAI,CAAC;YACH,IAAI,IAAI,KAAK,KAAK,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,UAAU,EAAE,CAAC;gBACvD,MAAM,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;YAC9B,CAAC;YACD,IAAI,IAAI,KAAK,MAAM,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;gBACzD,MAAM,MAAM,CAAC,IAAI,CAAC;oBAChB,GAAG,UAAU;oBACb,QAAQ;iBACT,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QAChB,CAAC;IACH,CAAC;AACH,CAAC"}
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"}
@@ -1,18 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decompressData = decompressData;
4
- const pako_1 = require("pako");
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
- function decompressData(compressedData) {
12
- const strData = atob(compressedData); // Decode base64 (convert ascii to binary)
13
- const charData = strData.split('').map(x => x.charCodeAt(0)); // Convert binary string to character-number array
14
- const binData = new Uint8Array(charData); // Turn number array into byte-array
15
- const data = (0, pako_1.inflate)(binData);
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","sourceRoot":"","sources":["../../src/pusher-utils.ts"],"names":[],"mappings":";;AAQA,wCAMC;AAdD,+BAA8B;AAE9B;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,cAAsB;IACnD,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,CAAA,CAAC,0CAA0C;IAC/E,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,kDAAkD;IAC/G,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAA,CAAC,oCAAoC;IAC7E,MAAM,IAAI,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,CAAA;IAC7B,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AAC9C,CAAC"}
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';
@@ -1,6 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./router"), exports);
5
- tslib_1.__exportStar(require("./router-utils"), exports);
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","sourceRoot":"","sources":["../../../src/routing/index.ts"],"names":[],"mappings":";;;AAAA,mDAAwB;AACxB,yDAA8B"}
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);