@botonic/plugin-flow-builder 0.21.0-alpha.8 → 0.21.1
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.d.ts +1 -1
- package/lib/cjs/action.js +21 -32
- package/lib/cjs/action.js.map +1 -1
- package/lib/cjs/content-fields/content-fields-base.d.ts +2 -1
- package/lib/cjs/content-fields/content-fields-base.js +6 -1
- package/lib/cjs/content-fields/content-fields-base.js.map +1 -1
- package/lib/cjs/content-fields/flow-button.d.ts +0 -1
- package/lib/cjs/content-fields/flow-button.js +4 -2
- package/lib/cjs/content-fields/flow-button.js.map +1 -1
- package/lib/cjs/content-fields/flow-carousel.d.ts +0 -1
- package/lib/cjs/content-fields/flow-carousel.js +2 -2
- package/lib/cjs/content-fields/flow-carousel.js.map +1 -1
- package/lib/cjs/content-fields/flow-image.d.ts +0 -1
- package/lib/cjs/content-fields/flow-text.d.ts +0 -1
- package/lib/cjs/content-fields/flow-video.d.ts +8 -0
- package/lib/cjs/content-fields/flow-video.js +26 -0
- package/lib/cjs/content-fields/flow-video.js.map +1 -0
- package/lib/cjs/content-fields/index.d.ts +1 -0
- package/lib/cjs/content-fields/index.js +3 -1
- package/lib/cjs/content-fields/index.js.map +1 -1
- package/lib/cjs/content-fields/types.d.ts +2 -1
- package/lib/cjs/flow-builder-models.d.ts +27 -5
- package/lib/cjs/flow-builder-models.js +2 -0
- package/lib/cjs/flow-builder-models.js.map +1 -1
- package/lib/cjs/functions/conditional-queue-status.js +1 -1
- package/lib/cjs/functions/conditional-queue-status.js.map +1 -1
- package/lib/cjs/handoff.d.ts +2 -1
- package/lib/cjs/handoff.js +21 -14
- package/lib/cjs/handoff.js.map +1 -1
- package/lib/cjs/helpers.d.ts +5 -0
- package/lib/cjs/helpers.js +14 -0
- package/lib/cjs/helpers.js.map +1 -0
- package/lib/cjs/index.d.ts +9 -4
- package/lib/cjs/index.js +45 -17
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/action.d.ts +1 -1
- package/lib/esm/action.js +22 -33
- package/lib/esm/action.js.map +1 -1
- package/lib/esm/content-fields/content-fields-base.d.ts +2 -1
- package/lib/esm/content-fields/content-fields-base.js +6 -1
- package/lib/esm/content-fields/content-fields-base.js.map +1 -1
- package/lib/esm/content-fields/flow-button.d.ts +0 -1
- package/lib/esm/content-fields/flow-button.js +4 -2
- package/lib/esm/content-fields/flow-button.js.map +1 -1
- package/lib/esm/content-fields/flow-carousel.d.ts +0 -1
- package/lib/esm/content-fields/flow-carousel.js +2 -2
- package/lib/esm/content-fields/flow-carousel.js.map +1 -1
- package/lib/esm/content-fields/flow-image.d.ts +0 -1
- package/lib/esm/content-fields/flow-text.d.ts +0 -1
- package/lib/esm/content-fields/flow-video.d.ts +8 -0
- package/lib/esm/content-fields/flow-video.js +21 -0
- package/lib/esm/content-fields/flow-video.js.map +1 -0
- package/lib/esm/content-fields/index.d.ts +1 -0
- package/lib/esm/content-fields/index.js +1 -0
- package/lib/esm/content-fields/index.js.map +1 -1
- package/lib/esm/content-fields/types.d.ts +2 -1
- package/lib/esm/flow-builder-models.d.ts +27 -5
- package/lib/esm/flow-builder-models.js +2 -0
- package/lib/esm/flow-builder-models.js.map +1 -1
- package/lib/esm/handoff.d.ts +2 -1
- package/lib/esm/handoff.js +21 -14
- package/lib/esm/handoff.js.map +1 -1
- package/lib/esm/helpers.d.ts +5 -0
- package/lib/esm/helpers.js +10 -0
- package/lib/esm/helpers.js.map +1 -0
- package/lib/esm/index.d.ts +9 -4
- package/lib/esm/index.js +46 -18
- package/lib/esm/index.js.map +1 -1
- package/package.json +3 -3
- package/src/action.tsx +25 -35
- package/src/content-fields/content-fields-base.ts +11 -2
- package/src/content-fields/flow-button.tsx +3 -1
- package/src/content-fields/flow-carousel.tsx +4 -1
- package/src/content-fields/flow-video.tsx +22 -0
- package/src/content-fields/index.ts +1 -0
- package/src/content-fields/types.ts +2 -1
- package/src/flow-builder-models.ts +30 -2
- package/src/handoff.ts +25 -16
- package/src/helpers.ts +18 -0
- package/src/index.ts +65 -21
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EACL,YAAY,EAEZ,SAAS,EACT,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EACL,YAAY,EAEZ,SAAS,EACT,QAAQ,EACR,SAAS,GACV,MAAM,kBAAkB,CAAA;AACzB,OAAO,EASL,QAAQ,GAET,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAU/C,MAAM,CAAC,OAAO,OAAO,wBAAwB;IAQ3C,YAAqB,OAAwC;QAAxC,YAAO,GAAP,OAAO,CAAiC;QAC3D,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;QAClC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAA;QAC5C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;QAC9B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,eAAe,EAAE,CAAA;QAClD,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,EAAE,CAAA;QACrD,IAAI,CAAC,SAAS,mCAAQ,iBAAiB,GAAK,eAAe,CAAE,CAAA;IAC/D,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE;YAC7C,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,IAAI,CAAC,cAAc,EAAE,EAAE,EAAE;SAC9D,CAAC,CA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AK,CAAC,uCAAuC,cAAc,EAAE,CAAC,CAAA;SACzE;QACD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CACxB;YACE,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO;YACpC,OAAO,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;SAClE,EACD,GAAG,UAAU,CACd,CAAA;QACD,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CACtE,IAAI,CACL,CAAA;QACD,0CAA0C;QAC1C,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CACrD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,cAAc,CACjC,CAAA;QACD,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,KAAK,CACb,wDAAwD,cAAc,EAAE,CACzE,CAAA;SACF;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAA;IACzB,CAAC;CACF;AAED,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/plugin-flow-builder",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"main": "./lib/cjs/index.js",
|
|
5
5
|
"module": "./lib/esm/index.js",
|
|
6
6
|
"description": "Use Flow Builder to show your contents",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@babel/runtime": "^7.20.13",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
50
|
+
"axios": "^1.3.4",
|
|
51
|
+
"@botonic/react": "^0.21.2"
|
|
52
52
|
}
|
|
53
53
|
}
|
package/src/action.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ActionRequest, RequestContext
|
|
1
|
+
import { ActionRequest, RequestContext } from '@botonic/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
4
|
import { FlowContent } from './content-fields'
|
|
5
5
|
import { doHandoff } from './handoff'
|
|
6
|
-
import
|
|
6
|
+
import { getFlowBuilderPlugin } from './helpers'
|
|
7
7
|
|
|
8
8
|
type FlowBuilderActionProps = {
|
|
9
9
|
content?: FlowContent[]
|
|
@@ -14,52 +14,42 @@ export class FlowBuilderAction extends React.Component<FlowBuilderActionProps> {
|
|
|
14
14
|
static contextType = RequestContext
|
|
15
15
|
|
|
16
16
|
static async botonicInit(request: ActionRequest): Promise<any> {
|
|
17
|
-
const flowBuilderPlugin = request.plugins
|
|
18
|
-
.hubtypeFlowBuilder as BotonicPluginFlowBuilder
|
|
17
|
+
const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)
|
|
19
18
|
const locale = flowBuilderPlugin.getLocale(request.session)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
const payload = request.input.payload
|
|
20
|
+
let targetContentId: string | undefined = payload
|
|
21
|
+
if (!payload && request.session.is_first_interaction) {
|
|
22
|
+
targetContentId = await flowBuilderPlugin.getStartId()
|
|
23
|
+
}
|
|
24
|
+
if (!payload) {
|
|
25
|
+
const intentPayload = await flowBuilderPlugin.getPayloadByIntent(
|
|
26
26
|
request.input,
|
|
27
27
|
locale
|
|
28
28
|
)
|
|
29
|
-
if (intentPayload)
|
|
30
|
-
payload = intentPayload
|
|
31
|
-
}
|
|
29
|
+
if (intentPayload) targetContentId = intentPayload
|
|
32
30
|
const keywordPayload = await flowBuilderPlugin.getPayloadByKeyword(
|
|
33
31
|
request.input,
|
|
34
32
|
locale
|
|
35
33
|
)
|
|
36
|
-
if (keywordPayload)
|
|
37
|
-
payload = keywordPayload
|
|
38
|
-
}
|
|
34
|
+
if (keywordPayload) targetContentId = keywordPayload
|
|
39
35
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (content.length === 0) {
|
|
44
|
-
const handoffParams = {
|
|
45
|
-
queue: 'Test', // TODO: Take it from the flow
|
|
46
|
-
agentEmail: 'test@gmail.com',
|
|
47
|
-
note: 'This is a note that will be attached to the case as a reminder',
|
|
48
|
-
}
|
|
49
|
-
await doHandoff(request, handoffParams.queue, handoffParams.note)
|
|
50
|
-
const isHandoff = true
|
|
51
|
-
return { isHandoff }
|
|
36
|
+
if (!targetContentId) {
|
|
37
|
+
targetContentId = await flowBuilderPlugin.getFallbackId()
|
|
52
38
|
}
|
|
53
|
-
|
|
39
|
+
|
|
40
|
+
const { contents, handoffNode } = await flowBuilderPlugin.getContents(
|
|
41
|
+
targetContentId,
|
|
42
|
+
locale
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
if (handoffNode) await doHandoff(request, locale, handoffNode)
|
|
46
|
+
|
|
47
|
+
return { contents, handoffNode }
|
|
54
48
|
}
|
|
55
49
|
|
|
56
50
|
render(): JSX.Element | JSX.Element[] {
|
|
57
51
|
// @ts-ignore
|
|
58
|
-
const {
|
|
59
|
-
|
|
60
|
-
return <Text>You are being transferred to an agent!</Text>
|
|
61
|
-
} else {
|
|
62
|
-
return contents!.map((content, index) => content.toBotonic(index))
|
|
63
|
-
}
|
|
52
|
+
const { contents, handoffNode } = this.props
|
|
53
|
+
return contents!.map((content, index) => content.toBotonic(index))
|
|
64
54
|
}
|
|
65
55
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
MediaFileLocale,
|
|
3
|
+
TextLocale,
|
|
4
|
+
VideoLocale,
|
|
5
|
+
} from '../flow-builder-models'
|
|
2
6
|
|
|
3
7
|
export abstract class ContentFieldsBase {
|
|
4
8
|
constructor(private readonly id: string) {}
|
|
@@ -9,7 +13,12 @@ export abstract class ContentFieldsBase {
|
|
|
9
13
|
}
|
|
10
14
|
|
|
11
15
|
static getImageByLocale(locale: string, image: MediaFileLocale[]): string {
|
|
12
|
-
const result = image.find(
|
|
16
|
+
const result = image.find(i => i.locale === locale)
|
|
13
17
|
return result?.file ?? ''
|
|
14
18
|
}
|
|
19
|
+
|
|
20
|
+
static getVideoByLocale(locale: string, video: VideoLocale[]): string {
|
|
21
|
+
const result = video.find(v => v.locale === locale)
|
|
22
|
+
return result?.url ?? ''
|
|
23
|
+
}
|
|
15
24
|
}
|
|
@@ -12,7 +12,9 @@ export class FlowButton extends ContentFieldsBase {
|
|
|
12
12
|
static fromHubtypeCMS(component: FbButton, locale: string): FlowButton {
|
|
13
13
|
const newButton = new FlowButton(component.id)
|
|
14
14
|
newButton.text = FlowButton.getTextByLocale(locale, component.text)
|
|
15
|
-
newButton.payload = component.target
|
|
15
|
+
newButton.payload = component.target
|
|
16
|
+
? component.target.id
|
|
17
|
+
: component.payload?.find(payload => payload.locale === locale)?.id
|
|
16
18
|
if (component.url) {
|
|
17
19
|
const urlButton = (component.url as any).find(
|
|
18
20
|
url => url.locale === locale
|
|
@@ -27,7 +27,10 @@ export class FlowCarousel extends ContentFieldsBase {
|
|
|
27
27
|
<Title style=''>{element.title}</Title>
|
|
28
28
|
<Subtitle style=''>{element.subtitle}</Subtitle>
|
|
29
29
|
{/* @ts-ignore */}
|
|
30
|
-
<Button
|
|
30
|
+
<Button
|
|
31
|
+
payload={element.buttons?.payload}
|
|
32
|
+
url={element.buttons?.url}
|
|
33
|
+
>
|
|
31
34
|
{element.buttons?.text}
|
|
32
35
|
</Button>
|
|
33
36
|
,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Video } from '@botonic/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { VideoNode } from '../flow-builder-models'
|
|
5
|
+
import { ContentFieldsBase } from './content-fields-base'
|
|
6
|
+
|
|
7
|
+
export class FlowVideo extends ContentFieldsBase {
|
|
8
|
+
public src = ''
|
|
9
|
+
public code = ''
|
|
10
|
+
|
|
11
|
+
static fromHubtypeCMS(component: VideoNode, locale: string): FlowVideo {
|
|
12
|
+
const newVideo = new FlowVideo(component.id)
|
|
13
|
+
newVideo.code = component.code
|
|
14
|
+
newVideo.src = this.getVideoByLocale(locale, component.content.video)
|
|
15
|
+
return newVideo
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
toBotonic(index: number): JSX.Element {
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
return <Video key={index} src={this.src} />
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FlowCarousel } from './flow-carousel'
|
|
2
2
|
import { FlowImage } from './flow-image'
|
|
3
3
|
import { FlowText } from './flow-text'
|
|
4
|
+
import { FlowVideo } from './flow-video'
|
|
4
5
|
|
|
5
|
-
export type FlowContent = FlowText | FlowImage | FlowCarousel
|
|
6
|
+
export type FlowContent = FlowText | FlowImage | FlowCarousel | FlowVideo
|
|
@@ -18,6 +18,8 @@ export enum NodeType {
|
|
|
18
18
|
URL = 'url',
|
|
19
19
|
PAYLOAD = 'payload',
|
|
20
20
|
FUNCTION = 'function',
|
|
21
|
+
FALLBACK = 'fallback',
|
|
22
|
+
VIDEO = 'video',
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
export interface BaseNode {
|
|
@@ -67,8 +69,8 @@ export interface Button {
|
|
|
67
69
|
text: TextLocale[]
|
|
68
70
|
target?: NodeLink
|
|
69
71
|
hidden: string
|
|
70
|
-
url?: UrlLocale
|
|
71
|
-
payload?: PayloadLocale
|
|
72
|
+
url?: UrlLocale[]
|
|
73
|
+
payload?: PayloadLocale[]
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
export interface TextNodeContent {
|
|
@@ -207,6 +209,30 @@ export interface FunctionNode extends Node {
|
|
|
207
209
|
content: FunctionNodeContent
|
|
208
210
|
}
|
|
209
211
|
|
|
212
|
+
export interface FallbackNodeContent {
|
|
213
|
+
first_message: NodeLink
|
|
214
|
+
second_message: NodeLink
|
|
215
|
+
}
|
|
216
|
+
export interface FallbackNode extends Node {
|
|
217
|
+
type: NodeType.FALLBACK
|
|
218
|
+
content: FallbackNodeContent
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export interface VideoLocale {
|
|
222
|
+
url: string
|
|
223
|
+
is_embedded?: boolean
|
|
224
|
+
locale: string
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface VideoNodeContent {
|
|
228
|
+
video: VideoLocale[]
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export interface VideoNode extends Node {
|
|
232
|
+
type: NodeType.VIDEO
|
|
233
|
+
content: VideoNodeContent
|
|
234
|
+
}
|
|
235
|
+
|
|
210
236
|
export type NodeComponent =
|
|
211
237
|
| TextNode
|
|
212
238
|
| ImageNode
|
|
@@ -218,3 +244,5 @@ export type NodeComponent =
|
|
|
218
244
|
| StartNode
|
|
219
245
|
| PayloadNode
|
|
220
246
|
| FunctionNode
|
|
247
|
+
| FallbackNode
|
|
248
|
+
| VideoNode
|
package/src/handoff.ts
CHANGED
|
@@ -1,28 +1,37 @@
|
|
|
1
1
|
import { HandOffBuilder } from '@botonic/core'
|
|
2
2
|
import { ActionRequest } from '@botonic/react'
|
|
3
3
|
|
|
4
|
+
import { HandoffNode } from './flow-builder-models'
|
|
5
|
+
import { getFlowBuilderPlugin } from './helpers'
|
|
6
|
+
|
|
4
7
|
export async function doHandoff(
|
|
5
8
|
request: ActionRequest,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
agentEmail?: string
|
|
9
|
+
locale: string,
|
|
10
|
+
handoffNode: HandoffNode
|
|
9
11
|
): Promise<void> {
|
|
12
|
+
const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)
|
|
13
|
+
const handoffTargetNode = await flowBuilderPlugin.getHandoffContent(
|
|
14
|
+
handoffNode.target?.id
|
|
15
|
+
)
|
|
10
16
|
// @ts-ignore
|
|
11
|
-
const
|
|
12
|
-
const
|
|
17
|
+
const handOffBuilder = new HandOffBuilder(request.session) // handOffBuilder.withQueue(handoffNode.content.queue)
|
|
18
|
+
const handoffQueues = handoffNode.content.queue
|
|
19
|
+
const queueFound = handoffQueues.find(q => q.locale === locale)
|
|
20
|
+
if (queueFound) handOffBuilder.withQueue(queueFound.id)
|
|
21
|
+
// TODO: Retrieve params from FlowBuilder
|
|
22
|
+
// const handoffParams = {
|
|
23
|
+
// agentEmail: 'test@gmail.com',
|
|
24
|
+
// note: 'This is a note that will be attached to the case as a reminder',
|
|
25
|
+
// }
|
|
13
26
|
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
// if (handoffParams.note) {
|
|
28
|
+
// handOffBuilder.withNote(handoffParams.note)
|
|
29
|
+
// }
|
|
17
30
|
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
}
|
|
31
|
+
// if (handoffParams.agentEmail) {
|
|
32
|
+
// handOffBuilder.withAgentEmail(handoffParams.agentEmail)
|
|
33
|
+
// }
|
|
21
34
|
|
|
22
|
-
|
|
23
|
-
handOffBuilder.withAgentEmail(agentEmail)
|
|
24
|
-
}
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
26
|
-
handOffBuilder.withOnFinishPayload(handoffContent.target?.id!)
|
|
35
|
+
handOffBuilder.withOnFinishPayload(handoffTargetNode.id)
|
|
27
36
|
await handOffBuilder.handOff()
|
|
28
37
|
}
|
package/src/helpers.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Plugin } from '@botonic/core'
|
|
2
|
+
import BotonicPluginFlowBuilder from './index'
|
|
3
|
+
|
|
4
|
+
const FLOW_BUILDER_PLUGIN_NAME = 'BotonicPluginFlowBuilder'
|
|
5
|
+
|
|
6
|
+
export function getFlowBuilderPlugin(plugins: {
|
|
7
|
+
[id: string]: Plugin
|
|
8
|
+
}): BotonicPluginFlowBuilder {
|
|
9
|
+
const flowBuilderPlugin = Object.values(plugins).find(
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
plugin => plugin.name === FLOW_BUILDER_PLUGIN_NAME
|
|
12
|
+
) as BotonicPluginFlowBuilder
|
|
13
|
+
if (!flowBuilderPlugin)
|
|
14
|
+
throw new Error(
|
|
15
|
+
`You must include '@botonic/plugin-flow-builder' in your plugins file.`
|
|
16
|
+
)
|
|
17
|
+
return flowBuilderPlugin
|
|
18
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -12,14 +12,17 @@ import {
|
|
|
12
12
|
FlowContent,
|
|
13
13
|
FlowImage,
|
|
14
14
|
FlowText,
|
|
15
|
+
FlowVideo,
|
|
15
16
|
} from './content-fields'
|
|
16
17
|
import {
|
|
18
|
+
FallbackNode,
|
|
17
19
|
FlowBuilderData,
|
|
18
20
|
FunctionNode,
|
|
19
21
|
HandoffNode,
|
|
20
22
|
IntentNode,
|
|
21
23
|
KeywordNode,
|
|
22
24
|
NodeComponent,
|
|
25
|
+
NodeLink,
|
|
23
26
|
NodeType,
|
|
24
27
|
StartNode,
|
|
25
28
|
} from './flow-builder-models'
|
|
@@ -51,10 +54,10 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
async readFlowContent(): Promise<FlowBuilderData> {
|
|
54
|
-
const
|
|
57
|
+
const { data } = await axios.get(this.flowUrl, {
|
|
55
58
|
headers: { Authorization: `Bearer ${this.getAccessToken()}` },
|
|
56
59
|
})
|
|
57
|
-
return
|
|
60
|
+
return data
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
async pre(request: PluginPreRequest): Promise<void> {
|
|
@@ -71,10 +74,12 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
71
74
|
return content
|
|
72
75
|
}
|
|
73
76
|
|
|
74
|
-
async getHandoffContent(
|
|
77
|
+
async getHandoffContent(
|
|
78
|
+
handoffTargetId: string | undefined
|
|
79
|
+
): Promise<HandoffNode> {
|
|
75
80
|
const flow = await this.flow
|
|
76
81
|
const content = flow.nodes.find(
|
|
77
|
-
node => node.
|
|
82
|
+
node => node.id === handoffTargetId
|
|
78
83
|
) as HandoffNode
|
|
79
84
|
if (!content) throw Error(`Handoff node not found`)
|
|
80
85
|
return content
|
|
@@ -91,6 +96,8 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
91
96
|
return FlowImage.fromHubtypeCMS(hubtypeContent, locale)
|
|
92
97
|
case NodeType.CAROUSEL:
|
|
93
98
|
return FlowCarousel.fromHubtypeCMS(hubtypeContent, locale)
|
|
99
|
+
case NodeType.VIDEO:
|
|
100
|
+
return FlowVideo.fromHubtypeCMS(hubtypeContent, locale)
|
|
94
101
|
default:
|
|
95
102
|
return undefined
|
|
96
103
|
}
|
|
@@ -98,20 +105,47 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
98
105
|
|
|
99
106
|
async getStartId(): Promise<string> {
|
|
100
107
|
const flow = await this.flow
|
|
101
|
-
const startNode = flow.nodes.find(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return
|
|
108
|
+
const startNode = flow.nodes.find(
|
|
109
|
+
node => node.type === NodeType.START_UP
|
|
110
|
+
) as StartNode | undefined
|
|
111
|
+
if (!startNode) throw new Error('start-up id must be defined')
|
|
112
|
+
return startNode.target.id
|
|
106
113
|
}
|
|
107
114
|
|
|
115
|
+
async getFallbackId(): Promise<string> {
|
|
116
|
+
const flow = await this.flow
|
|
117
|
+
const fallbackNode = flow.nodes.find(
|
|
118
|
+
node => node.type === NodeType.FALLBACK
|
|
119
|
+
) as FallbackNode | undefined
|
|
120
|
+
if (!fallbackNode) throw new Error('fallback node must be defined')
|
|
121
|
+
const fallbackFirstMessage = fallbackNode.content.first_message
|
|
122
|
+
const fallbackSecondMessage = fallbackNode.content.second_message
|
|
123
|
+
if (!fallbackSecondMessage) return fallbackFirstMessage.id
|
|
124
|
+
const fallbackIds = [fallbackFirstMessage.id, fallbackSecondMessage.id]
|
|
125
|
+
return fallbackIds[Math.floor(Math.random() * fallbackIds.length)]
|
|
126
|
+
}
|
|
108
127
|
async getContents(
|
|
109
128
|
id: string,
|
|
110
129
|
locale: string,
|
|
111
130
|
prevContents?: FlowContent[]
|
|
112
|
-
): Promise<FlowContent[]> {
|
|
131
|
+
): Promise<{ contents: FlowContent[]; handoffNode: HandoffNode }> {
|
|
113
132
|
const contents = prevContents || []
|
|
114
133
|
const hubtypeContent: any = await this.getContent(id)
|
|
134
|
+
const isHandoff = hubtypeContent.type === NodeType.HANDOFF
|
|
135
|
+
|
|
136
|
+
if (hubtypeContent.content.elements) {
|
|
137
|
+
for (const i in hubtypeContent.content.elements) {
|
|
138
|
+
const button = hubtypeContent.content.elements[i].button
|
|
139
|
+
if (button.url) {
|
|
140
|
+
for (const j in button.url) {
|
|
141
|
+
button.url[j] = {
|
|
142
|
+
...button.url[j],
|
|
143
|
+
...(await this.getContent(button.url[j].id)),
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
115
149
|
if (hubtypeContent.content.buttons) {
|
|
116
150
|
for (const i in hubtypeContent.content.buttons) {
|
|
117
151
|
const button = hubtypeContent.content.buttons[i]
|
|
@@ -138,10 +172,10 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
138
172
|
}
|
|
139
173
|
// execute function
|
|
140
174
|
// return this.getContents(function result_mapping target, locale, contents)
|
|
141
|
-
return contents
|
|
175
|
+
return { contents, handoffNode: isHandoff && hubtypeContent }
|
|
142
176
|
}
|
|
143
177
|
|
|
144
|
-
async
|
|
178
|
+
async getPayloadByIntent(
|
|
145
179
|
input: Input,
|
|
146
180
|
locale: string
|
|
147
181
|
): Promise<string | undefined> {
|
|
@@ -150,14 +184,17 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
150
184
|
const intents = flow.nodes.filter(
|
|
151
185
|
node => node.type === NodeType.INTENT
|
|
152
186
|
) as IntentNode[]
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
187
|
+
const inputIntent = input.intent
|
|
188
|
+
const inputConfidence = input.confidence
|
|
189
|
+
if (inputIntent) {
|
|
190
|
+
const matchedIntentNode = intents.find(
|
|
191
|
+
node =>
|
|
192
|
+
inputIntent &&
|
|
193
|
+
this.hasIntent(node, inputIntent, locale) &&
|
|
194
|
+
inputConfidence &&
|
|
195
|
+
this.hasMetConfidenceThreshold(node, inputConfidence)
|
|
157
196
|
)
|
|
158
|
-
|
|
159
|
-
return matchedIntents[0].target?.id
|
|
160
|
-
}
|
|
197
|
+
return matchedIntentNode?.target?.id
|
|
161
198
|
}
|
|
162
199
|
} catch (error) {
|
|
163
200
|
console.error('Error getting payload by input: ', error)
|
|
@@ -167,10 +204,17 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
167
204
|
}
|
|
168
205
|
|
|
169
206
|
hasIntent(node: IntentNode, intent: string, locale: string): boolean {
|
|
170
|
-
|
|
207
|
+
return node.content.intents.some(
|
|
171
208
|
i => i.locale === locale && i.values.includes(intent)
|
|
172
209
|
)
|
|
173
|
-
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
hasMetConfidenceThreshold(
|
|
213
|
+
node: IntentNode,
|
|
214
|
+
predictedConfidence: number
|
|
215
|
+
): boolean {
|
|
216
|
+
const nodeConfidence = node.content.confidence / 100
|
|
217
|
+
return predictedConfidence >= nodeConfidence
|
|
174
218
|
}
|
|
175
219
|
|
|
176
220
|
async getPayloadByKeyword(
|