@botonic/plugin-flow-builder 0.27.0-alpha.3 → 0.27.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/action/fallback.d.ts +3 -0
- package/lib/cjs/action/fallback.js +30 -0
- package/lib/cjs/action/fallback.js.map +1 -0
- package/lib/cjs/action/index.d.ts +8 -0
- package/lib/cjs/action/index.js +8 -32
- package/lib/cjs/action/index.js.map +1 -1
- package/lib/cjs/action/knowledge-bases.d.ts +3 -4
- package/lib/cjs/action/knowledge-bases.js +51 -49
- package/lib/cjs/action/knowledge-bases.js.map +1 -1
- package/lib/cjs/api.d.ts +2 -0
- package/lib/cjs/api.js +10 -0
- package/lib/cjs/api.js.map +1 -1
- package/lib/cjs/constants.d.ts +3 -0
- package/lib/cjs/constants.js +4 -1
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/content-fields/flow-knowledge-base.d.ts +9 -0
- package/lib/cjs/content-fields/flow-knowledge-base.js +25 -0
- package/lib/cjs/content-fields/flow-knowledge-base.js.map +1 -0
- package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.d.ts +1 -1
- package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.js.map +1 -1
- package/lib/cjs/content-fields/hubtype-fields/common.d.ts +1 -0
- package/lib/cjs/content-fields/hubtype-fields/index.d.ts +2 -0
- package/lib/cjs/content-fields/hubtype-fields/index.js +2 -0
- package/lib/cjs/content-fields/hubtype-fields/index.js.map +1 -1
- package/lib/cjs/content-fields/hubtype-fields/knowledge-base.d.ts +8 -0
- package/lib/cjs/content-fields/hubtype-fields/knowledge-base.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/knowledge-base.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.d.ts +2 -1
- package/lib/cjs/content-fields/hubtype-fields/node-types.js +1 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.js.map +1 -1
- package/lib/cjs/content-fields/hubtype-fields/nodes.d.ts +2 -1
- package/lib/cjs/content-fields/index.d.ts +3 -2
- package/lib/cjs/content-fields/index.js +3 -1
- package/lib/cjs/content-fields/index.js.map +1 -1
- package/lib/cjs/index.d.ts +4 -4
- package/lib/cjs/index.js +7 -7
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/types.d.ts +4 -2
- package/lib/cjs/types.js.map +1 -1
- package/lib/cjs/user-input/intent.js +1 -0
- package/lib/cjs/user-input/intent.js.map +1 -1
- package/lib/cjs/user-input/keyword.js +1 -0
- package/lib/cjs/user-input/keyword.js.map +1 -1
- package/lib/cjs/user-input/smart-intent.js +1 -0
- package/lib/cjs/user-input/smart-intent.js.map +1 -1
- package/lib/esm/action/fallback.d.ts +3 -0
- package/lib/esm/action/fallback.js +26 -0
- package/lib/esm/action/fallback.js.map +1 -0
- package/lib/esm/action/index.d.ts +8 -0
- package/lib/esm/action/index.js +9 -33
- package/lib/esm/action/index.js.map +1 -1
- package/lib/esm/action/knowledge-bases.d.ts +3 -4
- package/lib/esm/action/knowledge-bases.js +49 -47
- package/lib/esm/action/knowledge-bases.js.map +1 -1
- package/lib/esm/api.d.ts +2 -0
- package/lib/esm/api.js +11 -1
- package/lib/esm/api.js.map +1 -1
- package/lib/esm/constants.d.ts +3 -0
- package/lib/esm/constants.js +3 -0
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/content-fields/flow-knowledge-base.d.ts +9 -0
- package/lib/esm/content-fields/flow-knowledge-base.js +21 -0
- package/lib/esm/content-fields/flow-knowledge-base.js.map +1 -0
- package/lib/esm/content-fields/flow-whatsapp-cta-url-button.d.ts +1 -1
- package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/common.d.ts +1 -0
- package/lib/esm/content-fields/hubtype-fields/index.d.ts +2 -0
- package/lib/esm/content-fields/hubtype-fields/index.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/index.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/knowledge-base.d.ts +8 -0
- package/lib/esm/content-fields/hubtype-fields/knowledge-base.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/knowledge-base.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.d.ts +2 -1
- package/lib/esm/content-fields/hubtype-fields/node-types.js +1 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/nodes.d.ts +2 -1
- package/lib/esm/content-fields/index.d.ts +3 -2
- package/lib/esm/content-fields/index.js +2 -1
- package/lib/esm/content-fields/index.js.map +1 -1
- package/lib/esm/index.d.ts +4 -4
- package/lib/esm/index.js +5 -6
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/types.d.ts +4 -2
- package/lib/esm/types.js.map +1 -1
- package/lib/esm/user-input/intent.js +1 -0
- package/lib/esm/user-input/intent.js.map +1 -1
- package/lib/esm/user-input/keyword.js +1 -0
- package/lib/esm/user-input/keyword.js.map +1 -1
- package/lib/esm/user-input/smart-intent.js +1 -0
- package/lib/esm/user-input/smart-intent.js.map +1 -1
- package/package.json +1 -1
- package/src/action/fallback.ts +42 -0
- package/src/action/index.tsx +11 -52
- package/src/action/knowledge-bases.ts +91 -61
- package/src/api.ts +19 -1
- package/src/constants.ts +4 -0
- package/src/content-fields/flow-knowledge-base.tsx +23 -0
- package/src/content-fields/flow-whatsapp-cta-url-button.tsx +1 -2
- package/src/content-fields/hubtype-fields/common.ts +1 -0
- package/src/content-fields/hubtype-fields/index.ts +2 -0
- package/src/content-fields/hubtype-fields/knowledge-base.ts +9 -0
- package/src/content-fields/hubtype-fields/node-types.ts +1 -0
- package/src/content-fields/hubtype-fields/nodes.ts +2 -0
- package/src/content-fields/index.ts +10 -1
- package/src/index.ts +11 -18
- package/src/types.ts +14 -8
- package/src/user-input/intent.ts +1 -0
- package/src/user-input/keyword.ts +1 -0
- package/src/user-input/smart-intent.ts +1 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getContentsByFallback = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const tracking_1 = require("../tracking");
|
|
6
|
+
function getContentsByFallback({ cmsApi, flowBuilderPlugin, request, resolvedLocale, }) {
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
const fallbackNode = yield getFallbackNode(cmsApi, request);
|
|
9
|
+
const fallbackContents = yield flowBuilderPlugin.getContentsByNode(fallbackNode, resolvedLocale);
|
|
10
|
+
return fallbackContents;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
exports.getContentsByFallback = getContentsByFallback;
|
|
14
|
+
function getFallbackNode(cmsApi, request) {
|
|
15
|
+
var _a;
|
|
16
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
if (((_a = request.session.user.extra_data) === null || _a === void 0 ? void 0 : _a.isFirstFallbackOption) === undefined) {
|
|
18
|
+
request.session.user.extra_data = Object.assign(Object.assign({}, request.session.user.extra_data), { isFirstFallbackOption: true });
|
|
19
|
+
}
|
|
20
|
+
const isFirstFallbackOption = !!request.session.user.extra_data.isFirstFallbackOption;
|
|
21
|
+
const fallbackNode = cmsApi.getFallbackNode(isFirstFallbackOption);
|
|
22
|
+
request.session.user.extra_data.isFirstFallbackOption = !isFirstFallbackOption;
|
|
23
|
+
(0, tracking_1.trackEvent)(request, tracking_1.EventAction.Fallback, {
|
|
24
|
+
fallbackOut: isFirstFallbackOption ? 1 : 2,
|
|
25
|
+
fallbackMessageId: request.input.message_id,
|
|
26
|
+
});
|
|
27
|
+
return fallbackNode;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=fallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fallback.js","sourceRoot":"","sources":["../../../src/action/fallback.ts"],"names":[],"mappings":";;;;AAIA,0CAAqD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Content } from '../content-fields';
|
|
5
|
+
import BotonicPluginFlowBuilder from '../index';
|
|
4
6
|
export type FlowBuilderActionProps = {
|
|
5
7
|
contents: FlowContent[];
|
|
6
8
|
};
|
|
@@ -15,3 +17,9 @@ export declare class FlowBuilderAction extends React.Component<FlowBuilderAction
|
|
|
15
17
|
export declare class FlowBuilderMultichannelAction extends FlowBuilderAction {
|
|
16
18
|
render(): JSX.Element | JSX.Element[];
|
|
17
19
|
}
|
|
20
|
+
export interface FlowBuilderContext {
|
|
21
|
+
cmsApi: FlowBuilderApi;
|
|
22
|
+
flowBuilderPlugin: BotonicPluginFlowBuilder;
|
|
23
|
+
request: ActionRequest;
|
|
24
|
+
resolvedLocale: string;
|
|
25
|
+
}
|
package/lib/cjs/action/index.js
CHANGED
|
@@ -3,16 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FlowBuilderMultichannelAction = exports.FlowBuilderAction = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const core_1 = require("@botonic/core");
|
|
6
7
|
const react_1 = require("@botonic/react");
|
|
7
8
|
const react_2 = tslib_1.__importDefault(require("react"));
|
|
8
9
|
const content_fields_1 = require("../content-fields");
|
|
9
10
|
const helpers_1 = require("../helpers");
|
|
10
11
|
const tracking_1 = require("../tracking");
|
|
12
|
+
const fallback_1 = require("./fallback");
|
|
11
13
|
const knowledge_bases_1 = require("./knowledge-bases");
|
|
12
14
|
class FlowBuilderAction extends react_2.default.Component {
|
|
13
15
|
static botonicInit(request) {
|
|
14
16
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
17
|
const contents = yield getContents(request);
|
|
18
|
+
yield (0, tracking_1.trackFlowContent)(request, contents);
|
|
16
19
|
const handoffContent = contents.find(content => content instanceof content_fields_1.FlowHandoff);
|
|
17
20
|
if (handoffContent) {
|
|
18
21
|
yield handoffContent.doHandoff(request);
|
|
@@ -54,7 +57,10 @@ function getContents(request) {
|
|
|
54
57
|
if (request.input.payload) {
|
|
55
58
|
return yield getContentsByPayload(context);
|
|
56
59
|
}
|
|
57
|
-
|
|
60
|
+
if (request.input.data && request.input.type === core_1.INPUT.TEXT) {
|
|
61
|
+
return yield (0, knowledge_bases_1.getContentsByKnowledgeBase)(context);
|
|
62
|
+
}
|
|
63
|
+
return yield (0, fallback_1.getContentsByFallback)(context);
|
|
58
64
|
});
|
|
59
65
|
}
|
|
60
66
|
function getContentsByPayload({ cmsApi, flowBuilderPlugin, request, resolvedLocale, }) {
|
|
@@ -63,39 +69,9 @@ function getContentsByPayload({ cmsApi, flowBuilderPlugin, request, resolvedLoca
|
|
|
63
69
|
? cmsApi.getNodeById(request.input.payload)
|
|
64
70
|
: undefined;
|
|
65
71
|
if (targetNode) {
|
|
66
|
-
|
|
67
|
-
yield (0, tracking_1.trackFlowContent)(request, contents);
|
|
68
|
-
return contents;
|
|
72
|
+
return yield flowBuilderPlugin.getContentsByNode(targetNode, resolvedLocale);
|
|
69
73
|
}
|
|
70
74
|
return [];
|
|
71
75
|
});
|
|
72
76
|
}
|
|
73
|
-
function getContentsByFallback({ cmsApi, flowBuilderPlugin, request, resolvedLocale, }) {
|
|
74
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const fallbackNode = yield getFallbackNode(cmsApi, request);
|
|
76
|
-
const fallbackContents = yield flowBuilderPlugin.getContentsByNode(fallbackNode, resolvedLocale);
|
|
77
|
-
yield (0, tracking_1.trackFlowContent)(request, fallbackContents);
|
|
78
|
-
return fallbackContents;
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
function getFallbackNode(cmsApi, request) {
|
|
82
|
-
var _a;
|
|
83
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
if (((_a = request.session.user.extra_data) === null || _a === void 0 ? void 0 : _a.isFirstFallbackOption) === undefined) {
|
|
85
|
-
request.session.user.extra_data = Object.assign(Object.assign({}, request.session.user.extra_data), { isFirstFallbackOption: true });
|
|
86
|
-
}
|
|
87
|
-
const knowledgeBaseNode = yield (0, knowledge_bases_1.createNodeFromKnowledgeBase)(cmsApi, request);
|
|
88
|
-
if (knowledgeBaseNode) {
|
|
89
|
-
return knowledgeBaseNode;
|
|
90
|
-
}
|
|
91
|
-
const isFirstFallbackOption = !!request.session.user.extra_data.isFirstFallbackOption;
|
|
92
|
-
const fallbackNode = cmsApi.getFallbackNode(isFirstFallbackOption);
|
|
93
|
-
request.session.user.extra_data.isFirstFallbackOption = !isFirstFallbackOption;
|
|
94
|
-
(0, tracking_1.trackEvent)(request, tracking_1.EventAction.Fallback, {
|
|
95
|
-
fallbackOut: isFirstFallbackOption ? 1 : 2,
|
|
96
|
-
fallbackMessageId: request.input.message_id,
|
|
97
|
-
});
|
|
98
|
-
return fallbackNode;
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
77
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/action/index.tsx"],"names":[],"mappings":";;;;;AAAA,0CAA4E;AAC5E,0DAAyB;AAGzB,sDAA4D;AAE5D,wCAAiD;AAEjD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/action/index.tsx"],"names":[],"mappings":";;;;;AAAA,wCAAqC;AACrC,0CAA4E;AAC5E,0DAAyB;AAGzB,sDAA4D;AAE5D,wCAAiD;AAEjD,0CAA8C;AAC9C,yCAAkD;AAClD,uDAA8D;AAM9D,MAAa,iBAAkB,SAAQ,eAAK,CAAC,SAAiC;IAG5E,MAAM,CAAO,WAAW,CACtB,OAAsB;;YAEtB,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAA;YAC3C,MAAM,IAAA,2BAAgB,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;YAEzC,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAClC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CAAC,MAAM,CAAC,CAAA;QACzE,MAAM,OAAO,GAAG;YACd,MAAM;YACN,iBAAiB;YACjB,OAAO;YACP,cAAc;SACf,CAAA;QAED,IAAI,OAAO,CAAC,OAAO,CAAC,oBAAoB,EAAE;YACxC,OAAO,MAAM,iBAAiB,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAA;SAChE;QAED,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE;YACzB,OAAO,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAA;SAC3C;QAED,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,YAAK,CAAC,IAAI,EAAE;YAC3D,OAAO,MAAM,IAAA,4CAA0B,EAAC,OAAO,CAAC,CAAA;SACjD;QAED,OAAO,MAAM,IAAA,gCAAqB,EAAC,OAAO,CAAC,CAAA;IAC7C,CAAC;CAAA;AASD,SAAe,oBAAoB,CAAC,EAClC,MAAM,EACN,iBAAiB,EACjB,OAAO,EACP,cAAc,GACK;;QACnB,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO;YACtC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAoB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;YAC9D,CAAC,CAAC,SAAS,CAAA;QAEb,IAAI,UAAU,EAAE;YACd,OAAO,MAAM,iBAAiB,CAAC,iBAAiB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAA;SAC7E;QAED,OAAO,EAAE,CAAA;IACX,CAAC;CAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare function createNodeFromKnowledgeBase(cmsApi: FlowBuilderApi, request: ActionRequest): Promise<HtNodeWithContent | undefined>;
|
|
1
|
+
import { FlowContent } from '../content-fields';
|
|
2
|
+
import { FlowBuilderContext } from './index';
|
|
3
|
+
export declare function getContentsByKnowledgeBase({ cmsApi, flowBuilderPlugin, request, resolvedLocale, }: FlowBuilderContext): Promise<FlowContent[]>;
|
|
@@ -1,64 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getContentsByKnowledgeBase = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const helpers_1 = require("../helpers");
|
|
5
|
+
const core_1 = require("@botonic/core");
|
|
6
|
+
const content_fields_1 = require("../content-fields");
|
|
8
7
|
const tracking_1 = require("../tracking");
|
|
9
|
-
|
|
8
|
+
const fallback_1 = require("./fallback");
|
|
9
|
+
function getContentsByKnowledgeBase({ cmsApi, flowBuilderPlugin, request, resolvedLocale, }) {
|
|
10
10
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const startNodeKnowledeBaseFlow = cmsApi.getStartNodeKnowledeBaseFlow();
|
|
12
|
+
if (!startNodeKnowledeBaseFlow) {
|
|
13
|
+
return yield (0, fallback_1.getContentsByFallback)({
|
|
14
|
+
cmsApi,
|
|
15
|
+
flowBuilderPlugin,
|
|
16
|
+
request,
|
|
17
|
+
resolvedLocale,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
const contents = yield flowBuilderPlugin.getContentsByNode(startNodeKnowledeBaseFlow, resolvedLocale);
|
|
21
|
+
const knowledgeBaseContent = contents.find(content => content instanceof content_fields_1.FlowKnowledgeBase);
|
|
22
|
+
if (!knowledgeBaseContent) {
|
|
23
|
+
return contents;
|
|
24
|
+
}
|
|
15
25
|
if (flowBuilderPlugin.getKnowledgeBaseResponse &&
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
knowledgeBaseResponse.isFaithuful) {
|
|
22
|
-
const knowledgeBaseNode = {
|
|
23
|
-
type: hubtype_fields_1.HtNodeWithContentType.TEXT,
|
|
24
|
-
content: {
|
|
25
|
-
text: [
|
|
26
|
-
{
|
|
27
|
-
message: knowledgeBaseResponse.answer,
|
|
28
|
-
locale: resolvedLocale,
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
buttons_style: undefined,
|
|
32
|
-
buttons: [],
|
|
33
|
-
},
|
|
34
|
-
flow_id: 'randomUUID',
|
|
35
|
-
id: (0, uuid_1.v4)(),
|
|
36
|
-
code: 'knowledge-response',
|
|
37
|
-
meta: {
|
|
38
|
-
x: 0,
|
|
39
|
-
y: 0,
|
|
40
|
-
},
|
|
41
|
-
follow_up: knowledgeBaseConfig.followup,
|
|
42
|
-
};
|
|
43
|
-
return knowledgeBaseNode;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
console.error('Hubtype knowledge base api error: ', { e });
|
|
26
|
+
request.input.data &&
|
|
27
|
+
request.input.type === core_1.INPUT.TEXT) {
|
|
28
|
+
const contentsWithKnowledgeResponse = yield getContentsWithKnowledgeResponse(flowBuilderPlugin.getKnowledgeBaseResponse, request, knowledgeBaseContent, contents);
|
|
29
|
+
if (contentsWithKnowledgeResponse) {
|
|
30
|
+
return contentsWithKnowledgeResponse;
|
|
48
31
|
}
|
|
49
32
|
}
|
|
50
|
-
return
|
|
33
|
+
return yield (0, fallback_1.getContentsByFallback)({
|
|
34
|
+
cmsApi,
|
|
35
|
+
flowBuilderPlugin,
|
|
36
|
+
request,
|
|
37
|
+
resolvedLocale,
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
exports.getContentsByKnowledgeBase = getContentsByKnowledgeBase;
|
|
42
|
+
function getContentsWithKnowledgeResponse(getKnowledgeBaseResponse, request, knowledgeBaseContent, contents) {
|
|
43
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const knowledgeBaseResponse = yield getKnowledgeBaseResponse(request, request.input.data, knowledgeBaseContent.sources);
|
|
45
|
+
yield trackKnowledgeBase(knowledgeBaseResponse, request);
|
|
46
|
+
if (!knowledgeBaseResponse.hasKnowledge ||
|
|
47
|
+
!knowledgeBaseResponse.isFaithuful) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
return updateContentsWithAnswer(contents, knowledgeBaseResponse.answer);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function updateContentsWithAnswer(contents, answer) {
|
|
54
|
+
return contents.map(content => {
|
|
55
|
+
if (content instanceof content_fields_1.FlowKnowledgeBase) {
|
|
56
|
+
content.text = answer;
|
|
57
|
+
}
|
|
58
|
+
return content;
|
|
51
59
|
});
|
|
52
60
|
}
|
|
53
|
-
exports.createNodeFromKnowledgeBase = createNodeFromKnowledgeBase;
|
|
54
61
|
function trackKnowledgeBase(response, request) {
|
|
55
62
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
/* TODO:
|
|
57
|
-
In order to have all these parameters in the base knowlege response
|
|
58
|
-
it is necessary to use the new endpoint to which the knowledge sources
|
|
59
|
-
have to be indicated. For now this will not work, we need to finish
|
|
60
|
-
the knowldege base node in the flow builder frontend.
|
|
61
|
-
*/
|
|
62
63
|
const knowledgebaseInferenceId = response.inferenceId;
|
|
63
64
|
const knowledgebaseSourcesIds = response.sources.map(source => source.knowledgeSourceId);
|
|
64
65
|
const knowledgebaseChunksIds = response.sources.map(source => source.knowledgeChunkId);
|
|
@@ -76,6 +77,7 @@ function trackKnowledgeBase(response, request) {
|
|
|
76
77
|
knowledgebaseSourcesIds,
|
|
77
78
|
knowledgebaseChunksIds,
|
|
78
79
|
knowledgebaseMessageId,
|
|
80
|
+
userInput: request.input.data,
|
|
79
81
|
});
|
|
80
82
|
});
|
|
81
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledge-bases.js","sourceRoot":"","sources":["../../../src/action/knowledge-bases.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"knowledge-bases.js","sourceRoot":"","sources":["../../../src/action/knowledge-bases.ts"],"names":[],"mappings":";;;;AAAA,wCAAqC;AAGrC,sDAAkE;AAClE,0CAA8E;AAE9E,yCAAkD;AAGlD,SAAsB,0BAA0B,CAAC,EAC/C,MAAM,EACN,iBAAiB,EACjB,OAAO,EACP,cAAc,GACK;;QACnB,MAAM,yBAAyB,GAAG,MAAM,CAAC,4BAA4B,EAAE,CAAA;QAEvE,IAAI,CAAC,yBAAyB,EAAE;YAC9B,OAAO,MAAM,IAAA,gCAAqB,EAAC;gBACjC,MAAM;gBACN,iBAAiB;gBACjB,OAAO;gBACP,cAAc;aACf,CAAC,CAAA;SACH;QAED,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,iBAAiB,CACxD,yBAAyB,EACzB,cAAc,CACf,CAAA;QAED,MAAM,oBAAoB,GAAG,QAAQ,CAAC,IAAI,CACxC,OAAO,CAAC,EAAE,CAAC,OAAO,YAAY,kCAAiB,CAC3B,CAAA;QAEtB,IAAI,CAAC,oBAAoB,EAAE;YACzB,OAAO,QAAQ,CAAA;SAChB;QAED,IACE,iBAAiB,CAAC,wBAAwB;YAC1C,OAAO,CAAC,KAAK,CAAC,IAAI;YAClB,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,YAAK,CAAC,IAAI,EACjC;YACA,MAAM,6BAA6B,GACjC,MAAM,gCAAgC,CACpC,iBAAiB,CAAC,wBAAwB,EAC1C,OAAO,EACP,oBAAoB,EACpB,QAAQ,CACT,CAAA;YAEH,IAAI,6BAA6B,EAAE;gBACjC,OAAO,6BAA6B,CAAA;aACrC;SACF;QAED,OAAO,MAAM,IAAA,gCAAqB,EAAC;YACjC,MAAM;YACN,iBAAiB;YACjB,OAAO;YACP,cAAc;SACf,CAAC,CAAA;IACJ,CAAC;CAAA;AAtDD,gEAsDC;AAED,SAAe,gCAAgC,CAC7C,wBAA+C,EAC/C,OAAsB,EACtB,oBAAuC,EACvC,QAAuB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AAC,WAAW,CAAA;SAC9D;QAED,MAAM,IAAA,qBAAU,EAAC,OAAO,EAAE,sBAAW,CAAC,aAAa,EAAE;YACnD,wBAAwB;YACxB,uBAAuB;YACvB,uBAAuB;YACvB,sBAAsB;YACtB,sBAAsB;YACtB,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;SAC9B,CAAC,CAAA;IACJ,CAAC;CAAA"}
|
package/lib/cjs/api.d.ts
CHANGED
|
@@ -27,5 +27,7 @@ export declare class FlowBuilderApi {
|
|
|
27
27
|
createPayloadWithParams(botActionNode: HtBotActionNode): string;
|
|
28
28
|
private getFollowUpContentID;
|
|
29
29
|
getFlowName(flowId: string): string;
|
|
30
|
+
getStartNodeKnowledeBaseFlow(): HtNodeWithContent | undefined;
|
|
31
|
+
isKnowledgeBaseEnabled(): boolean;
|
|
30
32
|
getResolvedLocale(locale: string): string;
|
|
31
33
|
}
|
package/lib/cjs/api.js
CHANGED
|
@@ -138,6 +138,16 @@ class FlowBuilderApi {
|
|
|
138
138
|
const flow = this.flow.flows.find(flow => flow.id === flowId);
|
|
139
139
|
return flow ? flow.name : '';
|
|
140
140
|
}
|
|
141
|
+
getStartNodeKnowledeBaseFlow() {
|
|
142
|
+
const knowledgeBaseFlow = this.flow.flows.find(flow => flow.name === constants_1.KNOWLEDGE_BASE_FLOW_NAME);
|
|
143
|
+
if (!knowledgeBaseFlow) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
return this.getNodeById(knowledgeBaseFlow.start_node_id);
|
|
147
|
+
}
|
|
148
|
+
isKnowledgeBaseEnabled() {
|
|
149
|
+
return this.flow.is_knowledge_base_active || false;
|
|
150
|
+
}
|
|
141
151
|
getResolvedLocale(locale) {
|
|
142
152
|
if (this.flow.locales.find(flowLocale => flowLocale === locale)) {
|
|
143
153
|
return locale;
|
package/lib/cjs/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src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,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,oCAAwB,CAC/C,CAAA;QACD,IAAI,CAAC,iBAAiB,EAAE;YACtB,OAAO,SAAS,CAAA;SACjB;QACD,OAAO,IAAI,CAAC,WAAW,CAAoB,iBAAiB,CAAC,aAAa,CAAC,CAAA;IAC7E,CAAC;IAED,sBAAsB;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,wBAAwB,IAAI,KAAK,CAAA;IACpD,CAAC;IAED,iBAAiB,CAAC,MAAc;QAC9B,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,KAAK,MAAM,CAAC,EAAE;YAC/D,OAAO,MAAM,CAAA;SACd;QACD,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QACrC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,KAAK,QAAQ,CAAC,EAAE;YACjE,OAAO,CAAC,GAAG,CAAC,WAAW,MAAM,yBAAyB,QAAQ,EAAE,CAAC,CAAA;YACjE,OAAO,QAAQ,CAAA;SAChB;QACD,MAAM,IAAI,KAAK,CACb,WAAW,MAAM,2BAA2B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAChE,CAAA;IACH,CAAC;CACF;AApND,wCAoNC"}
|
package/lib/cjs/constants.d.ts
CHANGED
|
@@ -5,3 +5,6 @@ export declare const BOT_ACTION_PAYLOAD_PREFIX: string;
|
|
|
5
5
|
export declare const VARIABLE_PATTERN: RegExp;
|
|
6
6
|
export declare const ACCESS_TOKEN_VARIABLE_KEY = "_access_token";
|
|
7
7
|
export declare const REG_EXP_PATTERN: RegExp;
|
|
8
|
+
export declare const MAIN_FLOW_NAME = "Main";
|
|
9
|
+
export declare const KNOWLEDGE_BASE_FLOW_NAME = "Knowledge base";
|
|
10
|
+
export declare const FALLBACK_FLOW_NAME = "Fallback";
|
package/lib/cjs/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REG_EXP_PATTERN = exports.ACCESS_TOKEN_VARIABLE_KEY = exports.VARIABLE_PATTERN = exports.BOT_ACTION_PAYLOAD_PREFIX = exports.SOURCE_INFO_SEPARATOR = exports.SEPARATOR = exports.FLOW_BUILDER_API_URL_PROD = void 0;
|
|
3
|
+
exports.FALLBACK_FLOW_NAME = exports.KNOWLEDGE_BASE_FLOW_NAME = exports.MAIN_FLOW_NAME = exports.REG_EXP_PATTERN = exports.ACCESS_TOKEN_VARIABLE_KEY = exports.VARIABLE_PATTERN = exports.BOT_ACTION_PAYLOAD_PREFIX = exports.SOURCE_INFO_SEPARATOR = exports.SEPARATOR = exports.FLOW_BUILDER_API_URL_PROD = void 0;
|
|
4
4
|
exports.FLOW_BUILDER_API_URL_PROD = 'https://api.ent0.flowbuilder.prod.hubtype.com';
|
|
5
5
|
exports.SEPARATOR = '|';
|
|
6
6
|
exports.SOURCE_INFO_SEPARATOR = `${exports.SEPARATOR}source_`;
|
|
@@ -8,4 +8,7 @@ exports.BOT_ACTION_PAYLOAD_PREFIX = `ba${exports.SEPARATOR}`;
|
|
|
8
8
|
exports.VARIABLE_PATTERN = /{([^}]+)}/g;
|
|
9
9
|
exports.ACCESS_TOKEN_VARIABLE_KEY = '_access_token';
|
|
10
10
|
exports.REG_EXP_PATTERN = /^\/(.*)\/([gimyus]*)$/;
|
|
11
|
+
exports.MAIN_FLOW_NAME = 'Main';
|
|
12
|
+
exports.KNOWLEDGE_BASE_FLOW_NAME = 'Knowledge base';
|
|
13
|
+
exports.FALLBACK_FLOW_NAME = 'Fallback';
|
|
11
14
|
//# sourceMappingURL=constants.js.map
|
package/lib/cjs/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GACpC,+CAA+C,CAAA;AACpC,QAAA,SAAS,GAAG,GAAG,CAAA;AACf,QAAA,qBAAqB,GAAG,GAAG,iBAAS,SAAS,CAAA;AAC7C,QAAA,yBAAyB,GAAG,KAAK,iBAAS,EAAE,CAAA;AAC5C,QAAA,gBAAgB,GAAG,YAAY,CAAA;AAC/B,QAAA,yBAAyB,GAAG,eAAe,CAAA;AAC3C,QAAA,eAAe,GAAG,uBAAuB,CAAA"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GACpC,+CAA+C,CAAA;AACpC,QAAA,SAAS,GAAG,GAAG,CAAA;AACf,QAAA,qBAAqB,GAAG,GAAG,iBAAS,SAAS,CAAA;AAC7C,QAAA,yBAAyB,GAAG,KAAK,iBAAS,EAAE,CAAA;AAC5C,QAAA,gBAAgB,GAAG,YAAY,CAAA;AAC/B,QAAA,yBAAyB,GAAG,eAAe,CAAA;AAC3C,QAAA,eAAe,GAAG,uBAAuB,CAAA;AAEzC,QAAA,cAAc,GAAG,MAAM,CAAA;AACvB,QAAA,wBAAwB,GAAG,gBAAgB,CAAA;AAC3C,QAAA,kBAAkB,GAAG,UAAU,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ContentFieldsBase } from './content-fields-base';
|
|
2
|
+
import { HtKnowledgeBaseNode } from './hubtype-fields';
|
|
3
|
+
export declare class FlowKnowledgeBase extends ContentFieldsBase {
|
|
4
|
+
code: string;
|
|
5
|
+
sources: string[];
|
|
6
|
+
text: string;
|
|
7
|
+
static fromHubtypeCMS(component: HtKnowledgeBaseNode): FlowKnowledgeBase;
|
|
8
|
+
toBotonic(id: string): JSX.Element;
|
|
9
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowKnowledgeBase = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("@botonic/react");
|
|
6
|
+
const content_fields_base_1 = require("./content-fields-base");
|
|
7
|
+
class FlowKnowledgeBase extends content_fields_base_1.ContentFieldsBase {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.code = '';
|
|
11
|
+
this.sources = [];
|
|
12
|
+
this.text = '';
|
|
13
|
+
}
|
|
14
|
+
static fromHubtypeCMS(component) {
|
|
15
|
+
const newKnowledgeBase = new FlowKnowledgeBase(component.id);
|
|
16
|
+
newKnowledgeBase.code = component.code;
|
|
17
|
+
newKnowledgeBase.sources = component.content.sources;
|
|
18
|
+
return newKnowledgeBase;
|
|
19
|
+
}
|
|
20
|
+
toBotonic(id) {
|
|
21
|
+
return (0, jsx_runtime_1.jsx)(react_1.Text, { children: this.text }, id);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.FlowKnowledgeBase = FlowKnowledgeBase;
|
|
25
|
+
//# sourceMappingURL=flow-knowledge-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-knowledge-base.js","sourceRoot":"","sources":["../../../src/content-fields/flow-knowledge-base.tsx"],"names":[],"mappings":";;;;AAAA,0CAAqC;AAGrC,+DAAyD;AAGzD,MAAa,iBAAkB,SAAQ,uCAAiB;IAAxD;;QACS,SAAI,GAAG,EAAE,CAAA;QACT,YAAO,GAAa,EAAE,CAAA;QACtB,SAAI,GAAG,EAAE,CAAA;IAalB,CAAC;IAXC,MAAM,CAAC,cAAc,CAAC,SAA8B;QAClD,MAAM,gBAAgB,GAAG,IAAI,iBAAiB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC5D,gBAAgB,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAA;QACtC,gBAAgB,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,CAAA;QAEpD,OAAO,gBAAgB,CAAA;IACzB,CAAC;IAED,SAAS,CAAC,EAAU;QAClB,OAAO,uBAAC,YAAI,cAAW,IAAI,CAAC,IAAI,IAAd,EAAE,CAAoB,CAAA;IAC1C,CAAC;CACF;AAhBD,8CAgBC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FlowBuilderApi } from '../api';
|
|
2
2
|
import { ContentFieldsBase } from './content-fields-base';
|
|
3
|
-
import { HtWhatsappCTAUrlButtonNode } from './hubtype-fields
|
|
3
|
+
import { HtWhatsappCTAUrlButtonNode } from './hubtype-fields';
|
|
4
4
|
export declare class FlowWhatsappCtaUrlButtonNode extends ContentFieldsBase {
|
|
5
5
|
code: string;
|
|
6
6
|
text: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-whatsapp-cta-url-button.js","sourceRoot":"","sources":["../../../src/content-fields/flow-whatsapp-cta-url-button.tsx"],"names":[],"mappings":";;;;AAAA,0CAAqD;AAIrD,+DAAyD;AACzD,+CAA0C;
|
|
1
|
+
{"version":3,"file":"flow-whatsapp-cta-url-button.js","sourceRoot":"","sources":["../../../src/content-fields/flow-whatsapp-cta-url-button.tsx"],"names":[],"mappings":";;;;AAAA,0CAAqD;AAIrD,+DAAyD;AACzD,+CAA0C;AAG1C,MAAa,4BAA6B,SAAQ,uCAAiB;IAAnE;;QACS,SAAI,GAAG,EAAE,CAAA;QACT,SAAI,GAAG,EAAE,CAAA;QAGT,gBAAW,GAAG,EAAE,CAAA;QAChB,QAAG,GAAW,EAAE,CAAA;IA+CzB,CAAC;IA7CC,MAAM,CAAC,cAAc,CACnB,SAAqC,EACrC,MAAc,EACd,MAAsB;QAEtB,MAAM,oBAAoB,GAAG,IAAI,4BAA4B,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC3E,oBAAoB,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAA;QAC1C,oBAAoB,CAAC,IAAI,GAAG,IAAI,CAAC,eAAe,CAC9C,MAAM,EACN,SAAS,CAAC,OAAO,CAAC,IAAI,CACvB,CAAA;QACD,oBAAoB,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,CAChD,MAAM,EACN,SAAS,CAAC,OAAO,CAAC,MAAM,CACzB,CAAA;QACD,oBAAoB,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,CAChD,MAAM,EACN,SAAS,CAAC,OAAO,CAAC,MAAM,CACzB,CAAA;QACD,MAAM,MAAM,GAAG,wBAAU,CAAC,cAAc,CACtC,SAAS,CAAC,OAAO,CAAC,MAAM,EACxB,MAAM,EACN,MAAM,CACP,CAAA;QACD,oBAAoB,CAAC,WAAW,GAAG,MAAM,CAAC,IAAI,CAAA;QAC9C,MAAM,KAAK,GAAG,wBAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QACnE,IAAI,KAAK,EAAE;YACT,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAY,KAAK,CAAC,CAAA;YACpD,oBAAoB,CAAC,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAA;SAC/C;QACD,OAAO,oBAAoB,CAAA;IAC7B,CAAC;IAED,SAAS,CAAC,EAAU;QAClB,OAAO,CACL,uBAAC,4BAAoB,IAEnB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,GAAG,EAAE,IAAI,CAAC,GAAG,IALR,EAAE,CAMP,CACH,CAAA;IACH,CAAC;CACF;AArDD,oEAqDC"}
|
|
@@ -9,6 +9,7 @@ export * from './handoff';
|
|
|
9
9
|
export * from './image';
|
|
10
10
|
export * from './intent';
|
|
11
11
|
export * from './keyword';
|
|
12
|
+
export * from './knowledge-base';
|
|
12
13
|
export * from './node-types';
|
|
13
14
|
export * from './nodes';
|
|
14
15
|
export * from './payload';
|
|
@@ -17,3 +18,4 @@ export * from './text';
|
|
|
17
18
|
export * from './url';
|
|
18
19
|
export * from './video';
|
|
19
20
|
export * from './whatsapp-button-list';
|
|
21
|
+
export * from './whatsapp-cta-url-button';
|
|
@@ -12,6 +12,7 @@ tslib_1.__exportStar(require("./handoff"), exports);
|
|
|
12
12
|
tslib_1.__exportStar(require("./image"), exports);
|
|
13
13
|
tslib_1.__exportStar(require("./intent"), exports);
|
|
14
14
|
tslib_1.__exportStar(require("./keyword"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./knowledge-base"), exports);
|
|
15
16
|
tslib_1.__exportStar(require("./node-types"), exports);
|
|
16
17
|
tslib_1.__exportStar(require("./nodes"), exports);
|
|
17
18
|
tslib_1.__exportStar(require("./payload"), exports);
|
|
@@ -20,4 +21,5 @@ tslib_1.__exportStar(require("./text"), exports);
|
|
|
20
21
|
tslib_1.__exportStar(require("./url"), exports);
|
|
21
22
|
tslib_1.__exportStar(require("./video"), exports);
|
|
22
23
|
tslib_1.__exportStar(require("./whatsapp-button-list"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./whatsapp-cta-url-button"), exports);
|
|
23
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/index.ts"],"names":[],"mappings":";;;AAAA,uDAA4B;AAC5B,mDAAwB;AACxB,qDAA0B;AAC1B,mDAAwB;AACxB,qDAA0B;AAC1B,qDAA0B;AAC1B,uDAA4B;AAC5B,oDAAyB;AACzB,kDAAuB;AACvB,mDAAwB;AACxB,oDAAyB;AACzB,uDAA4B;AAC5B,kDAAuB;AACvB,oDAAyB;AACzB,yDAA8B;AAC9B,iDAAsB;AACtB,gDAAqB;AACrB,kDAAuB;AACvB,iEAAsC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/index.ts"],"names":[],"mappings":";;;AAAA,uDAA4B;AAC5B,mDAAwB;AACxB,qDAA0B;AAC1B,mDAAwB;AACxB,qDAA0B;AAC1B,qDAA0B;AAC1B,uDAA4B;AAC5B,oDAAyB;AACzB,kDAAuB;AACvB,mDAAwB;AACxB,oDAAyB;AACzB,2DAAgC;AAChC,uDAA4B;AAC5B,kDAAuB;AACvB,oDAAyB;AACzB,yDAA8B;AAC9B,iDAAsB;AACtB,gDAAqB;AACrB,kDAAuB;AACvB,iEAAsC;AACtC,oEAAyC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledge-base.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/knowledge-base.ts"],"names":[],"mappings":""}
|
|
@@ -10,7 +10,8 @@ export declare enum HtNodeWithContentType {
|
|
|
10
10
|
FALLBACK = "fallback",
|
|
11
11
|
VIDEO = "video",
|
|
12
12
|
WHATSAPP_BUTTON_LIST = "whatsapp-button-list",
|
|
13
|
-
WHATSAPP_CTA_URL_BUTTON = "whatsapp-cta-url-button"
|
|
13
|
+
WHATSAPP_CTA_URL_BUTTON = "whatsapp-cta-url-button",
|
|
14
|
+
KNOWLEDGE_BASE = "knowledge-base"
|
|
14
15
|
}
|
|
15
16
|
export declare enum HtNodeWithoutContentType {
|
|
16
17
|
URL = "url",
|
|
@@ -15,6 +15,7 @@ var HtNodeWithContentType;
|
|
|
15
15
|
HtNodeWithContentType["VIDEO"] = "video";
|
|
16
16
|
HtNodeWithContentType["WHATSAPP_BUTTON_LIST"] = "whatsapp-button-list";
|
|
17
17
|
HtNodeWithContentType["WHATSAPP_CTA_URL_BUTTON"] = "whatsapp-cta-url-button";
|
|
18
|
+
HtNodeWithContentType["KNOWLEDGE_BASE"] = "knowledge-base";
|
|
18
19
|
})(HtNodeWithContentType = exports.HtNodeWithContentType || (exports.HtNodeWithContentType = {}));
|
|
19
20
|
var HtNodeWithoutContentType;
|
|
20
21
|
(function (HtNodeWithoutContentType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-types.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/node-types.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"node-types.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/node-types.ts"],"names":[],"mappings":";;;AAAA,IAAY,qBAcX;AAdD,WAAY,qBAAqB;IAC/B,8CAAqB,CAAA;IACrB,4CAAmB,CAAA;IACnB,wCAAe,CAAA;IACf,sCAAa,CAAA;IACb,4CAAmB,CAAA;IACnB,0CAAiB,CAAA;IACjB,sDAA6B,CAAA;IAC7B,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;IACrB,wCAAe,CAAA;IACf,sEAA6C,CAAA;IAC7C,4EAAmD,CAAA;IACnD,0DAAiC,CAAA;AACnC,CAAC,EAdW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAchC;AAED,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAClC,uCAAW,CAAA;IACX,+CAAmB,CAAA;IACnB,qDAAyB,CAAA;IACzB,qDAAyB,CAAA;AAC3B,CAAC,EALW,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QAKnC;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,4CAA2B,CAAA;AAC7B,CAAC,EAHW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAGxB"}
|
|
@@ -7,6 +7,7 @@ import { HtHandoffNode } from './handoff';
|
|
|
7
7
|
import { HtImageNode } from './image';
|
|
8
8
|
import { HtIntentNode } from './intent';
|
|
9
9
|
import { HtKeywordNode } from './keyword';
|
|
10
|
+
import { HtKnowledgeBaseNode } from './knowledge-base';
|
|
10
11
|
import { HtPayloadNode } from './payload';
|
|
11
12
|
import { HtSmartIntentNode } from './smart-intent';
|
|
12
13
|
import { HtTextNode } from './text';
|
|
@@ -14,6 +15,6 @@ import { HtUrlNode } from './url';
|
|
|
14
15
|
import { HtVideoNode } from './video';
|
|
15
16
|
import { HtWhatsappButtonListNode } from './whatsapp-button-list';
|
|
16
17
|
import { HtWhatsappCTAUrlButtonNode } from './whatsapp-cta-url-button';
|
|
17
|
-
export type HtNodeWithContent = HtTextNode | HtImageNode | HtVideoNode | HtCarouselNode | HtHandoffNode | HtKeywordNode | HtIntentNode | HtFunctionNode | HtFallbackNode | HtWhatsappButtonListNode | HtWhatsappCTAUrlButtonNode | HtSmartIntentNode;
|
|
18
|
+
export type HtNodeWithContent = HtTextNode | HtImageNode | HtVideoNode | HtCarouselNode | HtHandoffNode | HtKeywordNode | HtIntentNode | HtFunctionNode | HtFallbackNode | HtWhatsappButtonListNode | HtWhatsappCTAUrlButtonNode | HtSmartIntentNode | HtKnowledgeBaseNode;
|
|
18
19
|
export type HtNodeWithoutContent = HtUrlNode | HtPayloadNode | HtGoToFlow | HtBotActionNode;
|
|
19
20
|
export type HtNodeComponent = HtNodeWithContent | HtNodeWithoutContent;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FlowCarousel } from './flow-carousel';
|
|
2
2
|
import { FlowHandoff } from './flow-handoff';
|
|
3
3
|
import { FlowImage } from './flow-image';
|
|
4
|
+
import { FlowKnowledgeBase } from './flow-knowledge-base';
|
|
4
5
|
import { FlowText } from './flow-text';
|
|
5
6
|
import { FlowVideo } from './flow-video';
|
|
6
7
|
import { FlowWhatsappCtaUrlButtonNode } from './flow-whatsapp-cta-url-button';
|
|
@@ -8,7 +9,7 @@ import { FlowWhatsappButtonList } from './whatsapp-button-list/flow-whatsapp-but
|
|
|
8
9
|
export { ContentFieldsBase } from './content-fields-base';
|
|
9
10
|
export { FlowButton } from './flow-button';
|
|
10
11
|
export { FlowElement } from './flow-element';
|
|
11
|
-
export { FlowCarousel, FlowImage, FlowText, FlowVideo, FlowWhatsappButtonList };
|
|
12
|
+
export { FlowCarousel, FlowImage, FlowKnowledgeBase, FlowText, FlowVideo, FlowWhatsappButtonList, };
|
|
12
13
|
export { FlowHandoff } from './flow-handoff';
|
|
13
14
|
export { FlowWhatsappCtaUrlButtonNode } from './flow-whatsapp-cta-url-button';
|
|
14
|
-
export type FlowContent = FlowCarousel | FlowImage | FlowText | FlowVideo | FlowWhatsappButtonList | FlowWhatsappCtaUrlButtonNode | FlowHandoff;
|
|
15
|
+
export type FlowContent = FlowCarousel | FlowImage | FlowText | FlowVideo | FlowWhatsappButtonList | FlowWhatsappCtaUrlButtonNode | FlowHandoff | FlowKnowledgeBase;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FlowWhatsappCtaUrlButtonNode = exports.FlowHandoff = exports.FlowWhatsappButtonList = exports.FlowVideo = exports.FlowText = exports.FlowImage = exports.FlowCarousel = exports.FlowElement = exports.FlowButton = exports.ContentFieldsBase = void 0;
|
|
3
|
+
exports.FlowWhatsappCtaUrlButtonNode = exports.FlowHandoff = exports.FlowWhatsappButtonList = exports.FlowVideo = exports.FlowText = exports.FlowKnowledgeBase = exports.FlowImage = exports.FlowCarousel = exports.FlowElement = exports.FlowButton = exports.ContentFieldsBase = void 0;
|
|
4
4
|
const flow_carousel_1 = require("./flow-carousel");
|
|
5
5
|
Object.defineProperty(exports, "FlowCarousel", { enumerable: true, get: function () { return flow_carousel_1.FlowCarousel; } });
|
|
6
6
|
const flow_image_1 = require("./flow-image");
|
|
7
7
|
Object.defineProperty(exports, "FlowImage", { enumerable: true, get: function () { return flow_image_1.FlowImage; } });
|
|
8
|
+
const flow_knowledge_base_1 = require("./flow-knowledge-base");
|
|
9
|
+
Object.defineProperty(exports, "FlowKnowledgeBase", { enumerable: true, get: function () { return flow_knowledge_base_1.FlowKnowledgeBase; } });
|
|
8
10
|
const flow_text_1 = require("./flow-text");
|
|
9
11
|
Object.defineProperty(exports, "FlowText", { enumerable: true, get: function () { return flow_text_1.FlowText; } });
|
|
10
12
|
const flow_video_1 = require("./flow-video");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/content-fields/index.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/content-fields/index.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAa5C,6FAbO,4BAAY,OAaP;AAXd,6CAAwC;AAYtC,0FAZO,sBAAS,OAYP;AAXX,+DAAyD;AAYvD,kGAZO,uCAAiB,OAYP;AAXnB,2CAAsC;AAYpC,yFAZO,oBAAQ,OAYP;AAXV,6CAAwC;AAYtC,0FAZO,sBAAS,OAYP;AAVX,gGAAyF;AAWvF,uGAXO,kDAAsB,OAWP;AATxB,6DAAyD;AAAhD,wHAAA,iBAAiB,OAAA;AAC1B,6CAA0C;AAAjC,yGAAA,UAAU,OAAA;AACnB,+CAA4C;AAAnC,2GAAA,WAAW,OAAA;AASpB,+CAA4C;AAAnC,2GAAA,WAAW,OAAA;AACpB,+EAA6E;AAApE,4IAAA,4BAA4B,OAAA"}
|