@botonic/plugin-flow-builder 0.56.0-alpha.0 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/action/ai-agent-from-user-input.js +6 -0
- package/lib/cjs/action/ai-agent-from-user-input.js.map +1 -1
- package/lib/cjs/action/first-interaction.js +5 -0
- package/lib/cjs/action/first-interaction.js.map +1 -1
- package/lib/cjs/action/get-contents.js +6 -1
- package/lib/cjs/action/get-contents.js.map +1 -1
- package/lib/cjs/action/index.js +5 -0
- package/lib/cjs/action/index.js.map +1 -1
- package/lib/cjs/api.d.ts +5 -1
- package/lib/cjs/api.js +19 -0
- package/lib/cjs/api.js.map +1 -1
- package/lib/cjs/content-fields/flow-ai-agent-base.js +1 -1
- package/lib/cjs/content-fields/flow-ai-agent-base.js.map +1 -1
- package/lib/cjs/content-fields/flow-ai-agent-router.js +1 -0
- package/lib/cjs/content-fields/flow-ai-agent-router.js.map +1 -1
- package/lib/cjs/content-fields/flow-ai-agent.js +1 -0
- package/lib/cjs/content-fields/flow-ai-agent.js.map +1 -1
- package/lib/cjs/content-fields/flow-do-nothing.d.ts +9 -0
- package/lib/cjs/content-fields/flow-do-nothing.js +27 -0
- package/lib/cjs/content-fields/flow-do-nothing.js.map +1 -0
- package/lib/cjs/content-fields/flow-whatsapp-request-contact-info.js +1 -0
- package/lib/cjs/content-fields/flow-whatsapp-request-contact-info.js.map +1 -1
- package/lib/cjs/content-fields/hubtype-fields/do-nothing.d.ts +6 -0
- package/lib/cjs/content-fields/hubtype-fields/do-nothing.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/do-nothing.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/index.d.ts +1 -0
- package/lib/cjs/content-fields/hubtype-fields/index.js +1 -0
- package/lib/cjs/content-fields/hubtype-fields/index.js.map +1 -1
- 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/hubtype-fields/whatsapp-request-contact-info.d.ts +2 -0
- 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/flow-factory.js +2 -0
- package/lib/cjs/flow-factory.js.map +1 -1
- package/lib/cjs/index.d.ts +3 -2
- package/lib/cjs/index.js +12 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/types.d.ts +2 -2
- package/lib/esm/action/ai-agent-from-user-input.js +6 -0
- package/lib/esm/action/ai-agent-from-user-input.js.map +1 -1
- package/lib/esm/action/first-interaction.js +5 -0
- package/lib/esm/action/first-interaction.js.map +1 -1
- package/lib/esm/action/get-contents.js +6 -1
- package/lib/esm/action/get-contents.js.map +1 -1
- package/lib/esm/action/index.js +5 -0
- package/lib/esm/action/index.js.map +1 -1
- package/lib/esm/api.d.ts +5 -1
- package/lib/esm/api.js +19 -0
- package/lib/esm/api.js.map +1 -1
- package/lib/esm/content-fields/flow-ai-agent-base.js +1 -1
- package/lib/esm/content-fields/flow-ai-agent-base.js.map +1 -1
- package/lib/esm/content-fields/flow-ai-agent-router.js +1 -0
- package/lib/esm/content-fields/flow-ai-agent-router.js.map +1 -1
- package/lib/esm/content-fields/flow-ai-agent.js +1 -0
- package/lib/esm/content-fields/flow-ai-agent.js.map +1 -1
- package/lib/esm/content-fields/flow-do-nothing.d.ts +9 -0
- package/lib/esm/content-fields/flow-do-nothing.js +27 -0
- package/lib/esm/content-fields/flow-do-nothing.js.map +1 -0
- package/lib/esm/content-fields/flow-whatsapp-request-contact-info.js +1 -0
- package/lib/esm/content-fields/flow-whatsapp-request-contact-info.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/do-nothing.d.ts +6 -0
- package/lib/esm/content-fields/hubtype-fields/do-nothing.js +3 -0
- package/lib/esm/content-fields/hubtype-fields/do-nothing.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/index.d.ts +1 -0
- package/lib/esm/content-fields/hubtype-fields/index.js +1 -0
- package/lib/esm/content-fields/hubtype-fields/index.js.map +1 -1
- 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/hubtype-fields/whatsapp-request-contact-info.d.ts +2 -0
- package/lib/esm/content-fields/index.d.ts +3 -2
- package/lib/esm/content-fields/index.js +3 -1
- package/lib/esm/content-fields/index.js.map +1 -1
- package/lib/esm/flow-factory.js +2 -0
- package/lib/esm/flow-factory.js.map +1 -1
- package/lib/esm/index.d.ts +3 -2
- package/lib/esm/index.js +12 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/types.d.ts +2 -2
- package/package.json +3 -3
- package/src/action/ai-agent-from-user-input.ts +7 -0
- package/src/action/first-interaction.ts +6 -0
- package/src/action/get-contents.ts +17 -2
- package/src/action/index.tsx +7 -0
- package/src/api.ts +28 -0
- package/src/content-fields/flow-ai-agent-base.tsx +1 -1
- package/src/content-fields/flow-ai-agent-router.tsx +1 -0
- package/src/content-fields/flow-ai-agent.tsx +1 -0
- package/src/content-fields/flow-do-nothing.tsx +29 -0
- package/src/content-fields/flow-whatsapp-request-contact-info.tsx +2 -0
- package/src/content-fields/hubtype-fields/do-nothing.ts +7 -0
- package/src/content-fields/hubtype-fields/index.ts +1 -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/hubtype-fields/whatsapp-request-contact-info.ts +2 -0
- package/src/content-fields/index.ts +5 -2
- package/src/flow-factory.ts +4 -0
- package/src/index.ts +30 -5
- package/src/types.ts +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-factory.js","sourceRoot":"","sources":["../../src/flow-factory.ts"],"names":[],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"flow-factory.js","sourceRoot":"","sources":["../../src/flow-factory.ts"],"names":[],"mappings":";;;AAGA,qDAsByB;AACzB,sFAA+E;AAC/E,oEAIwC;AAExC,MAAa,WAAW;IAKtB,YAAY,UAAsB,EAAE,MAAsB,EAAE,MAAc;QACxE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,cAA+B;QAE/B,QAAQ,cAAc,CAAC,IAAI,EAAE,CAAC;YAC5B,KAAK,sCAAqB,CAAC,IAAI;gBAC7B,OAAO,yBAAQ,CAAC,cAAc,CAC5B,cAAc,EACd,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,UAAU,CAChB,CAAA;YACH,KAAK,sCAAqB,CAAC,KAAK;gBAC9B,OAAO,0BAAS,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;YAC9D,KAAK,sCAAqB,CAAC,QAAQ;gBACjC,OAAO,6BAAY,CAAC,cAAc,CAChC,cAAc,EACd,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,UAAU,CAChB,CAAA;YACH,KAAK,sCAAqB,CAAC,KAAK;gBAC9B,OAAO,0BAAS,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;YAC9D,KAAK,sCAAqB,CAAC,oBAAoB;gBAC7C,OAAO,uCAAsB,CAAC,cAAc,CAC1C,cAAc,EACd,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,CACZ,CAAA;YACH,KAAK,sCAAqB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,CAAC,cAAc,CAAC,cAAc,CAAC,CAAA;YAE5D,KAAK,sCAAqB,CAAC,gBAAgB;gBACzC,OAAO,wCAAuB,CAAC,cAAc,CAC3C,cAAc,EACd,IAAI,CAAC,UAAU,CAChB,CAAA;YAEH,KAAK,sCAAqB,CAAC,UAAU;gBACnC,OAAO,8BAAa,CAAC,cAAc,CAAC,cAAc,CAAC,CAAA;YAErD;gBACE,OAAO,SAAS,CAAA;QACpB,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,0BAA0B,CACtC,cAA8B;QAE9B,QAAQ,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACtC,KAAK,eAAe;gBAClB,OAAO,uCAAsB,CAAC,cAAc,CAC1C,cAAc,EACd,IAAI,CAAC,UAAU,CAChB,CAAA;YACH,KAAK,kBAAkB;gBACrB,OAAO,uCAAsB,CAAC,cAAc,CAC1C,cAAc,EACd,IAAI,CAAC,UAAU,CAChB,CAAA;YACH,KAAK,oBAAoB;gBACvB,OAAO,2CAA0B,CAAC,cAAc,CAC9C,cAAc,EACd,IAAI,CAAC,MAAM,CACZ,CAAA;YACH,KAAK,oBAAoB;gBACvB,OAAO,sCAAqB,CAAC,cAAc,CACzC,cAAc,EACd,IAAI,CAAC,UAAU,CAChB,CAAA;YACH;gBACE,OAAO,SAAS,CAAA;QACpB,CAAC;IACH,CAAC;CACF;AA5HD,kCA4HC"}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
22
22
|
constructor(options: BotonicPluginFlowBuilderOptions<ResolvedPlugins, any>);
|
|
23
23
|
resolveFlowUrl(request: PluginPreRequest): string;
|
|
24
24
|
pre(request: PluginPreRequest): Promise<void>;
|
|
25
|
+
private resolveWhatsappContactRequestPayload;
|
|
25
26
|
private convertWhatsappAiAgentEmptyPayloads;
|
|
26
27
|
private updateRequestBeforeRoutes;
|
|
27
28
|
private removeSourceSuffix;
|
|
@@ -39,7 +40,7 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
39
40
|
export * from './action';
|
|
40
41
|
export { AGENT_RATING_PAYLOAD, EMPTY_PAYLOAD } from './constants';
|
|
41
42
|
export * from './content-fields';
|
|
42
|
-
export { HtBotActionNode } from './content-fields/hubtype-fields';
|
|
43
|
+
export type { HtBotActionNode } from './content-fields/hubtype-fields';
|
|
43
44
|
export { getCommonFlowContentEventArgsForContentId, trackFlowContent, } from './tracking';
|
|
44
|
-
export { BotonicPluginFlowBuilderOptions, ContentFilter, FlowBuilderJSONVersion, PayloadParamsBase, RatingSubmittedInfo, } from './types';
|
|
45
|
+
export { type BotonicPluginFlowBuilderOptions, type ContentFilter, FlowBuilderJSONVersion, type PayloadParamsBase, type RatingSubmittedInfo, } from './types';
|
|
45
46
|
export * from './webview';
|
package/lib/esm/index.js
CHANGED
|
@@ -56,6 +56,7 @@ class BotonicPluginFlowBuilder {
|
|
|
56
56
|
accessToken: this.getAccessToken(request.session),
|
|
57
57
|
request: this.currentRequest,
|
|
58
58
|
});
|
|
59
|
+
this.resolveWhatsappContactRequestPayload(request);
|
|
59
60
|
const checkUserTextInput = (0, input_1.inputHasTextOrTranscript)(request.input) && !request.input.payload;
|
|
60
61
|
if (checkUserTextInput) {
|
|
61
62
|
const resolvedLocale = this.cmsApi.getResolvedLocale();
|
|
@@ -64,6 +65,17 @@ class BotonicPluginFlowBuilder {
|
|
|
64
65
|
}
|
|
65
66
|
await this.updateRequestBeforeRoutes(request);
|
|
66
67
|
}
|
|
68
|
+
resolveWhatsappContactRequestPayload(request) {
|
|
69
|
+
if (request.input.type !== core_1.INPUT.CONTACT ||
|
|
70
|
+
request.input.origin !== core_1.WhatsappInputOrigin.ContactRequest) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const whatsappRequestContactInfoNode = this.cmsApi.getWhatsappRequestContactInfoNode();
|
|
74
|
+
if (whatsappRequestContactInfoNode) {
|
|
75
|
+
request.input.payload = this.cmsApi.getPayload(whatsappRequestContactInfoNode.content.button.target);
|
|
76
|
+
}
|
|
77
|
+
this.cmsApi.removeWhatsappRequestContactId();
|
|
78
|
+
}
|
|
67
79
|
convertWhatsappAiAgentEmptyPayloads(request) {
|
|
68
80
|
if (request.session.user.provider === core_1.PROVIDER.WHATSAPP) {
|
|
69
81
|
const shouldUseReferral = request.input.referral &&
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,wCAQsB;AAEtB,+BAAmC;AAEnC,+BAAsC;AACtC,2CAKoB;AAEpB,oEAKwC;AACxC,iDAA4C;AAC5C,2CAAoE;AACpE,mCASgB;AAChB,6CAAwD;AAExD,2DAA8D;AAC9D,yCAAwD;AAExD,2EAA2E;AAE3E,MAAqB,wBAAwB;IAkB3C,YAAY,OAA8D;QACxE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,qCAAyB,CAAA;QACzD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,8BAAsB,CAAC,MAAM,CAAA;QACvE,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QACxB,IAAI,CAAC,cAAc,GAAG,IAAA,sCAAqB,EAAC,OAAO,CAAC,cAAc,CAAC,CAAA;QACnE,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;QACpC,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAA;QACpD,IAAI,CAAC,kBAAkB,GAAG;YACxB,GAAG,OAAO,EAAE,kBAAkB;YAC9B,SAAS,EAAE,IAAI,CAAC,WAAW,KAAK,8BAAsB,CAAC,MAAM;SAC9D,CAAA;QACD,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe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,CAAA;IACxC,CAAC;IAED,sBAAsB,CAAC,OAAe;QACpC,MAAM,QAAQ,GAAG,OAAO,EAAE,KAAK,CAAC,qBAAS,CAAC,CAAC,CAAC,CAAC,CAAA;QAC7C,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAA;QAEhE,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;QAC1E,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CACpD,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CACtB,CAAA;QACD,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CACnD,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CACvB,CAAA;QAED,OAAO;YACL,GAAG,YAAY;YACf,eAAe;YACf,cAAc;SACf,CAAA;IACH,CAAC;IAED,cAAc,CAAC,WAA8B;QAC3C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;IAChC,CAAC;CACF;AA5PD,2CA4PC;AAED,mDAAwB;AACxB,yCAAiE;AAAxD,iHAAA,oBAAoB,OAAA;AAAE,0GAAA,aAAa,OAAA;AAC5C,2DAAgC;AAEhC,uCAGmB;AAFjB,qIAAA,yCAAyC,OAAA;AACzC,4GAAA,gBAAgB,OAAA;AAElB,iCAMgB;AAHd,+GAAA,sBAAsB,OAAA;AAIxB,oDAAyB"}
|
package/lib/esm/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AiAgentArgs,
|
|
1
|
+
import type { AiAgentArgs, BotContext, GuardrailRule, InferenceResponse, PluginPreRequest, ResolvedPlugins } from '@botonic/core';
|
|
2
2
|
import type { FlowContent } from './content-fields';
|
|
3
3
|
import type { HtFlowBuilderData, HtRatingButton } from './content-fields/hubtype-fields';
|
|
4
4
|
import type { FlowBuilderContentMessage } from './structured-output/flow-builder-content';
|
|
@@ -59,4 +59,4 @@ export interface RatingSubmittedInfo extends HtRatingButton {
|
|
|
59
59
|
possibleOptions: string[];
|
|
60
60
|
possibleValues: number[];
|
|
61
61
|
}
|
|
62
|
-
export { AiAgentArgs, GuardrailRule };
|
|
62
|
+
export type { AiAgentArgs, GuardrailRule };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/plugin-flow-builder",
|
|
3
|
-
"version": "0.56.0
|
|
3
|
+
"version": "0.56.0",
|
|
4
4
|
"main": "./lib/cjs/index.js",
|
|
5
5
|
"module": "./lib/esm/index.js",
|
|
6
6
|
"description": "Use Flow Builder to show your contents",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"format": "biome format --write src/ tests/"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@botonic/react": "^0.56.0
|
|
18
|
+
"@botonic/react": "^0.56.0",
|
|
19
19
|
"axios": "^1.18.1",
|
|
20
20
|
"uuid": "^10.0.0"
|
|
21
21
|
},
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"README.md"
|
|
34
34
|
],
|
|
35
35
|
"engines": {
|
|
36
|
-
"node": ">=22.
|
|
36
|
+
"node": ">=22.23.2",
|
|
37
37
|
"npm": ">=10.0.0"
|
|
38
38
|
},
|
|
39
39
|
"keywords": [
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NluType } from '@botonic/core'
|
|
1
2
|
import type { FlowContent } from '../content-fields/index'
|
|
2
3
|
import { splitAiAgentContents } from '../utils/ai-agent'
|
|
3
4
|
import type { FlowBuilderContext } from './context'
|
|
@@ -46,5 +47,11 @@ export async function getContentsByAiAgentFromUserInput({
|
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
request.input.nluResolution = {
|
|
51
|
+
type: NluType.AiAgent,
|
|
52
|
+
matchedValue: 'ai-agent-from-user-input',
|
|
53
|
+
payload: undefined,
|
|
54
|
+
}
|
|
55
|
+
|
|
49
56
|
return contents
|
|
50
57
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NluType } from '@botonic/core'
|
|
1
2
|
import type { FlowBuilderApi } from '../api'
|
|
2
3
|
import { MAIN_FLOW_NAME } from '../constants'
|
|
3
4
|
import {
|
|
@@ -51,6 +52,11 @@ export async function getContentsByFirstInteraction(
|
|
|
51
52
|
if (request.input.nluResolution || inputHasTextOrTranscript(request.input)) {
|
|
52
53
|
const contentsByUserInput = await getContentsByUserInput(context)
|
|
53
54
|
|
|
55
|
+
if (request.input.nluResolution?.type === NluType.AiAgent) {
|
|
56
|
+
const startContents = await flowBuilderPlugin.getStartContents()
|
|
57
|
+
return [...startContents, ...contentsByUserInput]
|
|
58
|
+
}
|
|
59
|
+
|
|
54
60
|
return [...firstInteractionContents, ...contentsByUserInput]
|
|
55
61
|
}
|
|
56
62
|
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type BotContext,
|
|
3
|
+
INPUT,
|
|
4
|
+
type Input,
|
|
5
|
+
WhatsappInputOrigin,
|
|
6
|
+
} from '@botonic/core'
|
|
2
7
|
import { EMPTY_PAYLOAD } from '../constants'
|
|
3
8
|
import type { FlowContent } from '../content-fields'
|
|
4
9
|
import { inputHasTextOrTranscript } from '../utils/input'
|
|
@@ -35,7 +40,10 @@ export async function getContents(
|
|
|
35
40
|
return await getContentsByFallback(context)
|
|
36
41
|
}
|
|
37
42
|
|
|
38
|
-
if (
|
|
43
|
+
if (
|
|
44
|
+
inputHasTextOrTranscript(botContext.input) ||
|
|
45
|
+
isContactRequested(botContext.input)
|
|
46
|
+
) {
|
|
39
47
|
const aiAgentContents = await getContentsByAiAgentFromUserInput(context)
|
|
40
48
|
if (aiAgentContents.length > 0) {
|
|
41
49
|
return aiAgentContents
|
|
@@ -44,3 +52,10 @@ export async function getContents(
|
|
|
44
52
|
|
|
45
53
|
return await getContentsByFallback(context)
|
|
46
54
|
}
|
|
55
|
+
|
|
56
|
+
function isContactRequested(input: Input) {
|
|
57
|
+
return (
|
|
58
|
+
input.type === INPUT.CONTACT &&
|
|
59
|
+
input.origin === WhatsappInputOrigin.ContactRequest
|
|
60
|
+
)
|
|
61
|
+
}
|
package/src/action/index.tsx
CHANGED
|
@@ -11,8 +11,10 @@ import {
|
|
|
11
11
|
FlowAiAgent,
|
|
12
12
|
FlowAiAgentRouter,
|
|
13
13
|
type FlowContent,
|
|
14
|
+
FlowWhatsappRequestContactInfoNode,
|
|
14
15
|
} from '../content-fields'
|
|
15
16
|
import { splitAiAgentContents } from '../utils/ai-agent'
|
|
17
|
+
import { getFlowBuilderPlugin } from '../utils/get-flow-builder-plugin'
|
|
16
18
|
import { getFlowBuilderActionContext } from './context'
|
|
17
19
|
import { getContentsByFirstInteraction } from './first-interaction'
|
|
18
20
|
import { getContents } from './get-contents'
|
|
@@ -65,6 +67,11 @@ export class FlowBuilderAction extends React.Component<FlowBuilderActionProps> {
|
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
await content.processContent(botContext)
|
|
70
|
+
|
|
71
|
+
if (content instanceof FlowWhatsappRequestContactInfoNode) {
|
|
72
|
+
const flowBuilderPlugin = getFlowBuilderPlugin(botContext.plugins)
|
|
73
|
+
flowBuilderPlugin.cmsApi.setWhatsappRequestContactId(content.id)
|
|
74
|
+
}
|
|
68
75
|
}
|
|
69
76
|
|
|
70
77
|
return contents
|
package/src/api.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
type HtRatingButton,
|
|
19
19
|
type HtRatingNode,
|
|
20
20
|
type HtSmartIntentNode,
|
|
21
|
+
type HtWhatsappRequestContactInfoNode,
|
|
21
22
|
} from './content-fields/hubtype-fields'
|
|
22
23
|
import {
|
|
23
24
|
type FlowBuilderApiOptions,
|
|
@@ -287,6 +288,33 @@ export class FlowBuilderApi {
|
|
|
287
288
|
return this.getNodeById<HtCaptureUserInputNode>(captureUserInputId)
|
|
288
289
|
}
|
|
289
290
|
|
|
291
|
+
getSessionWhatsappRequestContactId(): string | undefined {
|
|
292
|
+
return this.request.session.whatsapp_request_contact?.id
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
setWhatsappRequestContactId(id: string): void {
|
|
296
|
+
if (this.request.session.whatsapp_request_contact) {
|
|
297
|
+
this.request.session.whatsapp_request_contact.id = id
|
|
298
|
+
}
|
|
299
|
+
this.request.session.whatsapp_request_contact = { id }
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
removeWhatsappRequestContactId(): void {
|
|
303
|
+
this.request.session.whatsapp_request_contact = undefined
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
getWhatsappRequestContactInfoNode():
|
|
307
|
+
| HtWhatsappRequestContactInfoNode
|
|
308
|
+
| undefined {
|
|
309
|
+
const whatsappRequestContactId = this.getSessionWhatsappRequestContactId()
|
|
310
|
+
if (!whatsappRequestContactId) {
|
|
311
|
+
return undefined
|
|
312
|
+
}
|
|
313
|
+
return this.getNodeById<HtWhatsappRequestContactInfoNode>(
|
|
314
|
+
whatsappRequestContactId
|
|
315
|
+
)
|
|
316
|
+
}
|
|
317
|
+
|
|
290
318
|
getResolvedLocale(): string {
|
|
291
319
|
const flowLocales = this.flow.locales
|
|
292
320
|
const defaultLocaleCode = this.flow.default_locale_code
|
|
@@ -118,7 +118,7 @@ export abstract class FlowAiAgentBase extends ContentFieldsBase {
|
|
|
118
118
|
botContext: BotContext,
|
|
119
119
|
previousContents?: FlowContent[]
|
|
120
120
|
): Promise<void> {
|
|
121
|
-
if (this.
|
|
121
|
+
if (!this.aiAgentResponse) {
|
|
122
122
|
await this.resolveAIAgentResponse(botContext, previousContents)
|
|
123
123
|
}
|
|
124
124
|
if (this.jsxElements.length === 0) {
|
|
@@ -194,6 +194,7 @@ export class FlowAiAgentRouter extends FlowAiAgentBase {
|
|
|
194
194
|
inputGuardrailsTriggered: [],
|
|
195
195
|
outputGuardrailsTriggered:
|
|
196
196
|
this.aiAgentResponse?.outputGuardrailsTriggered ?? [],
|
|
197
|
+
doNothing: this.aiAgentResponse?.doNothing ?? false,
|
|
197
198
|
}
|
|
198
199
|
const { action, ...specialistEventArgs } = specialistEvent
|
|
199
200
|
await trackEvent(botContext, action, specialistEventArgs)
|
|
@@ -94,6 +94,7 @@ export class FlowAiAgent extends FlowAiAgentBase {
|
|
|
94
94
|
this.aiAgentResponse?.inputGuardrailsTriggered ?? [],
|
|
95
95
|
outputGuardrailsTriggered: [], //aiAgentResponse.outputGuardrailsTriggered,
|
|
96
96
|
error: this.aiAgentResponse?.error ?? false,
|
|
97
|
+
doNothing: this.aiAgentResponse?.doNothing ?? false,
|
|
97
98
|
}
|
|
98
99
|
const { action, ...eventArgs } = event
|
|
99
100
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { BotContext } from '@botonic/core'
|
|
2
|
+
|
|
3
|
+
import { trackOneContent } from '../tracking'
|
|
4
|
+
import { ContentFieldsBase } from './content-fields-base'
|
|
5
|
+
import type { HtDoNothingNode } from './hubtype-fields'
|
|
6
|
+
|
|
7
|
+
export class FlowDoNothing extends ContentFieldsBase {
|
|
8
|
+
static fromHubtypeCMS(cmsDoNothing: HtDoNothingNode): FlowDoNothing {
|
|
9
|
+
const newDoNothing = new FlowDoNothing(cmsDoNothing.id)
|
|
10
|
+
newDoNothing.code = cmsDoNothing.code
|
|
11
|
+
newDoNothing.followUp = cmsDoNothing.follow_up
|
|
12
|
+
|
|
13
|
+
return newDoNothing
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async trackFlow(botContext: BotContext): Promise<void> {
|
|
17
|
+
await trackOneContent(botContext, this)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async processContent(botContext: BotContext): Promise<void> {
|
|
21
|
+
await this.filterContent(botContext, this)
|
|
22
|
+
await this.trackFlow(botContext)
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
toBotonic(): JSX.Element {
|
|
27
|
+
return <></>
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -35,6 +35,8 @@ export class FlowWhatsappRequestContactInfoNode extends ContentFieldsBase {
|
|
|
35
35
|
message: RequestContactInfoMessage,
|
|
36
36
|
botContext: BotContext
|
|
37
37
|
): JSX.Element {
|
|
38
|
+
botContext.session.whatsapp_request_contact = undefined
|
|
39
|
+
|
|
38
40
|
if (!isWhatsapp(botContext.session)) {
|
|
39
41
|
return <Text key={id}>{message.content.text}</Text>
|
|
40
42
|
}
|
|
@@ -4,6 +4,7 @@ import type { HtBotActionNode } from './bot-action'
|
|
|
4
4
|
import type { HtCaptureUserInputNode } from './capture-user-input'
|
|
5
5
|
import type { HtCarouselNode } from './carousel'
|
|
6
6
|
import type { HtCustomConditionalV2Node } from './custom-conditional-v2'
|
|
7
|
+
import type { HtDoNothingNode } from './do-nothing'
|
|
7
8
|
// import { HtChannelConditionalNode } from './channel-conditional'
|
|
8
9
|
// import { HtCountryConditionalNode } from './country-conditional'
|
|
9
10
|
// import { HtCustomConditionalNode } from './custom-conditional'
|
|
@@ -48,6 +49,7 @@ export type HtNodeWithContent =
|
|
|
48
49
|
| HtWhatsappTemplateNode
|
|
49
50
|
| HtCaptureUserInputNode
|
|
50
51
|
| HtCustomConditionalV2Node
|
|
52
|
+
| HtDoNothingNode
|
|
51
53
|
// | HtChannelConditionalNode
|
|
52
54
|
// | HtCountryConditionalNode
|
|
53
55
|
// | HtCustomConditionalNode
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HtButton } from './button'
|
|
1
2
|
import type { HtBaseNode, HtTextLocale } from './common'
|
|
2
3
|
import type { HtNodeWithContentType } from './node-types'
|
|
3
4
|
|
|
@@ -5,5 +6,6 @@ export interface HtWhatsappRequestContactInfoNode extends HtBaseNode {
|
|
|
5
6
|
type: HtNodeWithContentType.WHATSAPP_REQUEST_CONTACT_INFO
|
|
6
7
|
content: {
|
|
7
8
|
text: HtTextLocale[]
|
|
9
|
+
button: HtButton
|
|
8
10
|
}
|
|
9
11
|
}
|
|
@@ -7,6 +7,7 @@ import { FlowCarousel } from './flow-carousel'
|
|
|
7
7
|
import { FlowChannelConditional } from './flow-channel-conditional'
|
|
8
8
|
import { FlowCountryConditional } from './flow-country-conditional'
|
|
9
9
|
import { FlowCustomConditional } from './flow-custom-conditional'
|
|
10
|
+
import { FlowDoNothing } from './flow-do-nothing'
|
|
10
11
|
import { FlowGoToFlow } from './flow-go-to-flow'
|
|
11
12
|
import { FlowHandoff } from './flow-handoff'
|
|
12
13
|
import { FlowImage } from './flow-image'
|
|
@@ -27,14 +28,16 @@ export { ContentFieldsBase } from './content-fields-base'
|
|
|
27
28
|
export { FlowButton } from './flow-button'
|
|
28
29
|
export { FlowElement } from './flow-element'
|
|
29
30
|
export {
|
|
30
|
-
FlowAiAgentRouter,
|
|
31
31
|
FlowAiAgent,
|
|
32
|
+
FlowAiAgentRouter,
|
|
32
33
|
FlowBotAction,
|
|
33
34
|
FlowCaptureUserInput,
|
|
34
35
|
FlowCarousel,
|
|
35
36
|
FlowChannelConditional,
|
|
36
37
|
FlowCountryConditional,
|
|
37
38
|
FlowCustomConditional,
|
|
39
|
+
FlowCustomConditionalV2,
|
|
40
|
+
FlowDoNothing,
|
|
38
41
|
FlowGoToFlow,
|
|
39
42
|
FlowHandoff,
|
|
40
43
|
FlowImage,
|
|
@@ -48,7 +51,6 @@ export {
|
|
|
48
51
|
FlowWhatsappCtaUrlButtonNode,
|
|
49
52
|
FlowWhatsappRequestContactInfoNode,
|
|
50
53
|
FlowWhatsappTemplate,
|
|
51
|
-
FlowCustomConditionalV2,
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
export type FlowContent =
|
|
@@ -72,3 +74,4 @@ export type FlowContent =
|
|
|
72
74
|
| FlowCaptureUserInput
|
|
73
75
|
| FlowAiAgentRouter
|
|
74
76
|
| FlowCustomConditionalV2
|
|
77
|
+
| FlowDoNothing
|
package/src/flow-factory.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
FlowCountryConditional,
|
|
12
12
|
FlowCustomConditional,
|
|
13
13
|
FlowCustomConditionalV2,
|
|
14
|
+
FlowDoNothing,
|
|
14
15
|
FlowGoToFlow,
|
|
15
16
|
FlowHandoff,
|
|
16
17
|
FlowImage,
|
|
@@ -118,6 +119,9 @@ export class FlowFactory {
|
|
|
118
119
|
this.botContext
|
|
119
120
|
)
|
|
120
121
|
|
|
122
|
+
case HtNodeWithContentType.DO_NOTHING:
|
|
123
|
+
return FlowDoNothing.fromHubtypeCMS(hubtypeContent)
|
|
124
|
+
|
|
121
125
|
default:
|
|
122
126
|
return undefined
|
|
123
127
|
}
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
PROVIDER,
|
|
6
6
|
type ResolvedPlugins,
|
|
7
7
|
type Session,
|
|
8
|
+
WhatsappInputOrigin,
|
|
8
9
|
} from '@botonic/core'
|
|
9
10
|
import type { ActionRequest } from '@botonic/react'
|
|
10
11
|
import { v7 as uuidv7 } from 'uuid'
|
|
@@ -105,6 +106,8 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
105
106
|
request: this.currentRequest,
|
|
106
107
|
})
|
|
107
108
|
|
|
109
|
+
this.resolveWhatsappContactRequestPayload(request)
|
|
110
|
+
|
|
108
111
|
const checkUserTextInput =
|
|
109
112
|
inputHasTextOrTranscript(request.input) && !request.input.payload
|
|
110
113
|
|
|
@@ -122,6 +125,28 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
122
125
|
await this.updateRequestBeforeRoutes(request)
|
|
123
126
|
}
|
|
124
127
|
|
|
128
|
+
private resolveWhatsappContactRequestPayload(
|
|
129
|
+
request: PluginPreRequest
|
|
130
|
+
): void {
|
|
131
|
+
if (
|
|
132
|
+
request.input.type !== INPUT.CONTACT ||
|
|
133
|
+
request.input.origin !== WhatsappInputOrigin.ContactRequest
|
|
134
|
+
) {
|
|
135
|
+
return
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const whatsappRequestContactInfoNode =
|
|
139
|
+
this.cmsApi.getWhatsappRequestContactInfoNode()
|
|
140
|
+
|
|
141
|
+
if (whatsappRequestContactInfoNode) {
|
|
142
|
+
request.input.payload = this.cmsApi.getPayload(
|
|
143
|
+
whatsappRequestContactInfoNode.content.button.target
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
this.cmsApi.removeWhatsappRequestContactId()
|
|
148
|
+
}
|
|
149
|
+
|
|
125
150
|
private convertWhatsappAiAgentEmptyPayloads(request: PluginPreRequest): void {
|
|
126
151
|
if (request.session.user.provider === PROVIDER.WHATSAPP) {
|
|
127
152
|
const shouldUseReferral =
|
|
@@ -275,16 +300,16 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
275
300
|
export * from './action'
|
|
276
301
|
export { AGENT_RATING_PAYLOAD, EMPTY_PAYLOAD } from './constants'
|
|
277
302
|
export * from './content-fields'
|
|
278
|
-
export { HtBotActionNode } from './content-fields/hubtype-fields'
|
|
303
|
+
export type { HtBotActionNode } from './content-fields/hubtype-fields'
|
|
279
304
|
export {
|
|
280
305
|
getCommonFlowContentEventArgsForContentId,
|
|
281
306
|
trackFlowContent,
|
|
282
307
|
} from './tracking'
|
|
283
308
|
export {
|
|
284
|
-
BotonicPluginFlowBuilderOptions,
|
|
285
|
-
ContentFilter,
|
|
309
|
+
type BotonicPluginFlowBuilderOptions,
|
|
310
|
+
type ContentFilter,
|
|
286
311
|
FlowBuilderJSONVersion,
|
|
287
|
-
PayloadParamsBase,
|
|
288
|
-
RatingSubmittedInfo,
|
|
312
|
+
type PayloadParamsBase,
|
|
313
|
+
type RatingSubmittedInfo,
|
|
289
314
|
} from './types'
|
|
290
315
|
export * from './webview'
|
package/src/types.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
AiAgentArgs,
|
|
3
|
-
|
|
3
|
+
BotContext,
|
|
4
4
|
GuardrailRule,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
InferenceResponse,
|
|
6
|
+
PluginPreRequest,
|
|
7
|
+
ResolvedPlugins,
|
|
8
8
|
} from '@botonic/core'
|
|
9
9
|
import type { FlowContent } from './content-fields'
|
|
10
10
|
import type {
|
|
@@ -101,4 +101,4 @@ export interface RatingSubmittedInfo extends HtRatingButton {
|
|
|
101
101
|
possibleValues: number[]
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
export { AiAgentArgs, GuardrailRule }
|
|
104
|
+
export type { AiAgentArgs, GuardrailRule }
|