@botonic/plugin-flow-builder 0.22.0-beta.3 → 0.22.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 +16 -2
- package/lib/cjs/action.js +21 -19
- package/lib/cjs/action.js.map +1 -1
- package/lib/cjs/api.d.ts +19 -0
- package/lib/cjs/api.js +108 -0
- package/lib/cjs/api.js.map +1 -0
- package/lib/cjs/content-fields/content-fields-base.d.ts +4 -4
- package/lib/cjs/content-fields/content-fields-base.js.map +1 -1
- package/lib/cjs/content-fields/flow-button.d.ts +6 -3
- package/lib/cjs/content-fields/flow-button.js +28 -21
- package/lib/cjs/content-fields/flow-button.js.map +1 -1
- package/lib/cjs/content-fields/flow-carousel.d.ts +3 -2
- package/lib/cjs/content-fields/flow-carousel.js +3 -10
- package/lib/cjs/content-fields/flow-carousel.js.map +1 -1
- package/lib/cjs/content-fields/flow-element.d.ts +6 -3
- package/lib/cjs/content-fields/flow-element.js +16 -5
- package/lib/cjs/content-fields/flow-element.js.map +1 -1
- package/lib/cjs/content-fields/flow-image.d.ts +2 -2
- package/lib/cjs/content-fields/flow-image.js.map +1 -1
- package/lib/cjs/content-fields/flow-text.d.ts +4 -3
- package/lib/cjs/content-fields/flow-text.js +9 -9
- package/lib/cjs/content-fields/flow-text.js.map +1 -1
- package/lib/cjs/content-fields/flow-video.d.ts +2 -2
- package/lib/cjs/content-fields/flow-video.js +0 -1
- package/lib/cjs/content-fields/flow-video.js.map +1 -1
- package/lib/cjs/content-fields/hubtype-fields/button.d.ts +9 -0
- package/lib/cjs/content-fields/hubtype-fields/button.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/button.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/carousel.d.ts +16 -0
- package/lib/cjs/content-fields/hubtype-fields/carousel.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/carousel.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/common.d.ts +55 -0
- package/lib/cjs/content-fields/hubtype-fields/common.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/common.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/fallback.d.ts +9 -0
- package/lib/cjs/content-fields/hubtype-fields/fallback.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/fallback.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/function.d.ts +28 -0
- package/lib/cjs/content-fields/hubtype-fields/function.js +10 -0
- package/lib/cjs/content-fields/hubtype-fields/function.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/handoff.d.ts +10 -0
- package/lib/cjs/content-fields/hubtype-fields/handoff.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/handoff.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/image.d.ts +8 -0
- package/lib/cjs/content-fields/{types.js → hubtype-fields/image.js} +1 -1
- package/lib/cjs/content-fields/hubtype-fields/image.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/index.d.ts +17 -0
- package/lib/cjs/content-fields/hubtype-fields/index.js +21 -0
- package/lib/cjs/content-fields/hubtype-fields/index.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/intent.d.ts +10 -0
- package/lib/cjs/content-fields/hubtype-fields/intent.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/intent.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/keyword.d.ts +9 -0
- package/lib/cjs/content-fields/hubtype-fields/keyword.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/keyword.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.d.ts +23 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.js +31 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/nodes.d.ts +16 -0
- package/lib/cjs/content-fields/hubtype-fields/nodes.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/nodes.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/payload.d.ts +8 -0
- package/lib/cjs/content-fields/hubtype-fields/payload.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/payload.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/start.d.ts +7 -0
- package/lib/cjs/content-fields/hubtype-fields/start.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/start.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/text.d.ts +11 -0
- package/lib/cjs/content-fields/hubtype-fields/text.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/text.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/url.d.ts +8 -0
- package/lib/cjs/content-fields/hubtype-fields/url.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/url.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/video.d.ts +8 -0
- package/lib/cjs/content-fields/hubtype-fields/video.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/video.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.d.ts +21 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.js.map +1 -0
- package/lib/cjs/content-fields/index.d.ts +7 -5
- package/lib/cjs/content-fields/index.js +11 -9
- package/lib/cjs/content-fields/index.js.map +1 -1
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +10 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +32 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +1 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +10 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +29 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +1 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +12 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +33 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -0
- package/lib/cjs/functions/conditional-provider.d.ts +2 -2
- package/lib/cjs/functions/conditional-provider.js +2 -2
- package/lib/cjs/functions/conditional-provider.js.map +1 -1
- package/lib/cjs/functions/conditional-queue-status.d.ts +7 -2
- package/lib/cjs/functions/conditional-queue-status.js +11 -1
- package/lib/cjs/functions/conditional-queue-status.js.map +1 -1
- package/lib/cjs/handoff.d.ts +2 -2
- package/lib/cjs/handoff.js +17 -9
- package/lib/cjs/handoff.js.map +1 -1
- package/lib/cjs/helpers.d.ts +2 -1
- package/lib/cjs/helpers.js +5 -13
- package/lib/cjs/helpers.js.map +1 -1
- package/lib/cjs/index.d.ts +10 -21
- package/lib/cjs/index.js +36 -151
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/types.d.ts +8 -2
- package/lib/cjs/types.js.map +1 -1
- package/lib/esm/action.d.ts +16 -2
- package/lib/esm/action.js +21 -19
- package/lib/esm/action.js.map +1 -1
- package/lib/esm/api.d.ts +19 -0
- package/lib/esm/api.js +103 -0
- package/lib/esm/api.js.map +1 -0
- package/lib/esm/content-fields/content-fields-base.d.ts +4 -4
- package/lib/esm/content-fields/content-fields-base.js.map +1 -1
- package/lib/esm/content-fields/flow-button.d.ts +6 -3
- package/lib/esm/content-fields/flow-button.js +28 -21
- package/lib/esm/content-fields/flow-button.js.map +1 -1
- package/lib/esm/content-fields/flow-carousel.d.ts +3 -2
- package/lib/esm/content-fields/flow-carousel.js +4 -11
- package/lib/esm/content-fields/flow-carousel.js.map +1 -1
- package/lib/esm/content-fields/flow-element.d.ts +6 -3
- package/lib/esm/content-fields/flow-element.js +15 -5
- package/lib/esm/content-fields/flow-element.js.map +1 -1
- package/lib/esm/content-fields/flow-image.d.ts +2 -2
- package/lib/esm/content-fields/flow-image.js.map +1 -1
- package/lib/esm/content-fields/flow-text.d.ts +4 -3
- package/lib/esm/content-fields/flow-text.js +9 -9
- package/lib/esm/content-fields/flow-text.js.map +1 -1
- package/lib/esm/content-fields/flow-video.d.ts +2 -2
- package/lib/esm/content-fields/flow-video.js +0 -1
- package/lib/esm/content-fields/flow-video.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/button.d.ts +9 -0
- package/lib/esm/content-fields/hubtype-fields/button.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/button.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/carousel.d.ts +16 -0
- package/lib/esm/content-fields/hubtype-fields/carousel.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/carousel.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/common.d.ts +55 -0
- package/lib/esm/content-fields/hubtype-fields/common.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/common.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/fallback.d.ts +9 -0
- package/lib/esm/content-fields/hubtype-fields/fallback.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/fallback.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/function.d.ts +28 -0
- package/lib/esm/content-fields/hubtype-fields/function.js +7 -0
- package/lib/esm/content-fields/hubtype-fields/function.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/handoff.d.ts +10 -0
- package/lib/esm/content-fields/hubtype-fields/handoff.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/handoff.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/image.d.ts +8 -0
- package/lib/esm/content-fields/hubtype-fields/image.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/image.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/index.d.ts +17 -0
- package/lib/esm/content-fields/hubtype-fields/index.js +18 -0
- package/lib/esm/content-fields/hubtype-fields/index.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/intent.d.ts +10 -0
- package/lib/esm/content-fields/hubtype-fields/intent.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/intent.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/keyword.d.ts +9 -0
- package/lib/esm/content-fields/hubtype-fields/keyword.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/keyword.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.d.ts +23 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.js +28 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/nodes.d.ts +16 -0
- package/lib/esm/content-fields/hubtype-fields/nodes.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/nodes.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/payload.d.ts +8 -0
- package/lib/esm/content-fields/hubtype-fields/payload.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/payload.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/start.d.ts +7 -0
- package/lib/esm/content-fields/hubtype-fields/start.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/start.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/text.d.ts +11 -0
- package/lib/esm/content-fields/hubtype-fields/text.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/text.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/url.d.ts +8 -0
- package/lib/esm/content-fields/hubtype-fields/url.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/url.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/video.d.ts +8 -0
- package/lib/esm/content-fields/hubtype-fields/video.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/video.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.d.ts +21 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js.map +1 -0
- package/lib/esm/content-fields/index.d.ts +7 -5
- package/lib/esm/content-fields/index.js +6 -4
- package/lib/esm/content-fields/index.js.map +1 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +10 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +28 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +1 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +10 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +25 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +1 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +12 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +28 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -0
- package/lib/esm/functions/conditional-provider.d.ts +2 -2
- package/lib/esm/functions/conditional-provider.js +2 -2
- package/lib/esm/functions/conditional-provider.js.map +1 -1
- package/lib/esm/functions/conditional-queue-status.d.ts +7 -2
- package/lib/esm/functions/conditional-queue-status.js +11 -1
- package/lib/esm/functions/conditional-queue-status.js.map +1 -1
- package/lib/esm/handoff.d.ts +2 -2
- package/lib/esm/handoff.js +17 -9
- package/lib/esm/handoff.js.map +1 -1
- package/lib/esm/helpers.d.ts +2 -1
- package/lib/esm/helpers.js +3 -11
- package/lib/esm/helpers.js.map +1 -1
- package/lib/esm/index.d.ts +10 -21
- package/lib/esm/index.js +38 -153
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/types.d.ts +8 -2
- package/lib/esm/types.js.map +1 -1
- package/package.json +4 -5
- package/src/action.tsx +31 -22
- package/src/api.ts +162 -0
- package/src/content-fields/content-fields-base.ts +7 -7
- package/src/content-fields/flow-button.tsx +40 -19
- package/src/content-fields/flow-carousel.tsx +10 -18
- package/src/content-fields/flow-element.tsx +26 -9
- package/src/content-fields/flow-image.tsx +2 -2
- package/src/content-fields/flow-text.tsx +15 -12
- package/src/content-fields/flow-video.tsx +2 -3
- package/src/content-fields/hubtype-fields/button.ts +15 -0
- package/src/content-fields/hubtype-fields/carousel.ts +18 -0
- package/src/content-fields/hubtype-fields/common.ts +65 -0
- package/src/content-fields/hubtype-fields/fallback.ts +10 -0
- package/src/content-fields/hubtype-fields/function.ts +33 -0
- package/src/content-fields/hubtype-fields/handoff.ts +11 -0
- package/src/content-fields/hubtype-fields/image.ts +9 -0
- package/src/content-fields/hubtype-fields/index.ts +17 -0
- package/src/content-fields/hubtype-fields/intent.ts +11 -0
- package/src/content-fields/hubtype-fields/keyword.ts +10 -0
- package/src/content-fields/hubtype-fields/node-types.ts +26 -0
- package/src/content-fields/hubtype-fields/nodes.ts +32 -0
- package/src/content-fields/hubtype-fields/payload.ts +9 -0
- package/src/content-fields/hubtype-fields/start.ts +8 -0
- package/src/content-fields/hubtype-fields/text.ts +12 -0
- package/src/content-fields/hubtype-fields/url.ts +9 -0
- package/src/content-fields/hubtype-fields/video.ts +9 -0
- package/src/content-fields/hubtype-fields/whatsapp-button-list.ts +25 -0
- package/src/content-fields/index.ts +14 -5
- package/src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.tsx +33 -0
- package/src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.tsx +35 -0
- package/src/content-fields/whatsapp-button-list/flow-whatsapp-button-list.tsx +46 -0
- package/src/functions/conditional-provider.ts +2 -2
- package/src/functions/conditional-queue-status.ts +22 -3
- package/src/handoff.ts +27 -14
- package/src/helpers.ts +8 -19
- package/src/index.ts +55 -197
- package/src/types.ts +14 -2
- package/lib/cjs/content-fields/types.d.ts +0 -5
- package/lib/cjs/content-fields/types.js.map +0 -1
- package/lib/cjs/flow-builder-models.d.ts +0 -196
- package/lib/cjs/flow-builder-models.js +0 -24
- package/lib/cjs/flow-builder-models.js.map +0 -1
- package/lib/esm/content-fields/types.d.ts +0 -5
- package/lib/esm/content-fields/types.js +0 -2
- package/lib/esm/content-fields/types.js.map +0 -1
- package/lib/esm/flow-builder-models.d.ts +0 -196
- package/lib/esm/flow-builder-models.js +0 -21
- package/lib/esm/flow-builder-models.js.map +0 -1
- package/src/.DS_Store +0 -0
- package/src/content-fields/types.ts +0 -6
- package/src/flow-builder-models.ts +0 -249
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HtBaseNode, HtNodeLink } from './common'
|
|
2
|
+
import { HtNodeWithContentType } from './node-types'
|
|
3
|
+
|
|
4
|
+
export interface HtFallbackNode extends HtBaseNode {
|
|
5
|
+
type: HtNodeWithContentType.FALLBACK
|
|
6
|
+
content: {
|
|
7
|
+
first_message?: HtNodeLink
|
|
8
|
+
second_message?: HtNodeLink
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { HtBaseNode, HtNodeLink } from './common'
|
|
2
|
+
import { HtNodeWithContentType } from './node-types'
|
|
3
|
+
|
|
4
|
+
export enum HtArgumentType {
|
|
5
|
+
NUMBER = 'number',
|
|
6
|
+
STRING = 'string',
|
|
7
|
+
JSON = 'json',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface HtFunctionArgument {
|
|
11
|
+
type: HtArgumentType
|
|
12
|
+
name: string
|
|
13
|
+
value: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface HtFunctionArgumentLocale {
|
|
17
|
+
locale: string
|
|
18
|
+
values: HtFunctionArgument[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface HtFunctionResult {
|
|
22
|
+
result: string
|
|
23
|
+
target?: HtNodeLink
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface HtFunctionNode extends HtBaseNode {
|
|
27
|
+
type: HtNodeWithContentType.FUNCTION
|
|
28
|
+
content: {
|
|
29
|
+
action: string
|
|
30
|
+
arguments: HtFunctionArgumentLocale[]
|
|
31
|
+
result_mapping: HtFunctionResult[]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HtBaseNode, HtPayloadLocale, HtQueueLocale } from './common'
|
|
2
|
+
import { HtNodeWithContentType } from './node-types'
|
|
3
|
+
|
|
4
|
+
export interface HtHandoffNode extends HtBaseNode {
|
|
5
|
+
type: HtNodeWithContentType.HANDOFF
|
|
6
|
+
content: {
|
|
7
|
+
queue: HtQueueLocale[]
|
|
8
|
+
payload: HtPayloadLocale[]
|
|
9
|
+
has_auto_assign: boolean
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './button'
|
|
2
|
+
export * from './carousel'
|
|
3
|
+
export * from './common'
|
|
4
|
+
export * from './fallback'
|
|
5
|
+
export * from './function'
|
|
6
|
+
export * from './handoff'
|
|
7
|
+
export * from './image'
|
|
8
|
+
export * from './intent'
|
|
9
|
+
export * from './keyword'
|
|
10
|
+
export * from './node-types'
|
|
11
|
+
export * from './nodes'
|
|
12
|
+
export * from './payload'
|
|
13
|
+
export * from './start'
|
|
14
|
+
export * from './text'
|
|
15
|
+
export * from './url'
|
|
16
|
+
export * from './video'
|
|
17
|
+
export * from './whatsapp-button-list'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HtBaseNode, HtInputLocale, HtTextLocale } from './common'
|
|
2
|
+
import { HtNodeWithContentType } from './node-types'
|
|
3
|
+
|
|
4
|
+
export interface HtIntentNode extends HtBaseNode {
|
|
5
|
+
type: HtNodeWithContentType.INTENT
|
|
6
|
+
content: {
|
|
7
|
+
title: HtTextLocale[]
|
|
8
|
+
intents: HtInputLocale[]
|
|
9
|
+
confidence: number
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HtBaseNode, HtInputLocale, HtTextLocale } from './common'
|
|
2
|
+
import { HtNodeWithContentType } from './node-types'
|
|
3
|
+
|
|
4
|
+
export interface HtKeywordNode extends HtBaseNode {
|
|
5
|
+
type: HtNodeWithContentType.KEYWORD
|
|
6
|
+
content: {
|
|
7
|
+
title: HtTextLocale[]
|
|
8
|
+
keywords: HtInputLocale[]
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export enum HtNodeWithContentType {
|
|
2
|
+
CAROUSEL = 'carousel',
|
|
3
|
+
HANDOFF = 'handoff',
|
|
4
|
+
IMAGE = 'image',
|
|
5
|
+
TEXT = 'text',
|
|
6
|
+
KEYWORD = 'keyword',
|
|
7
|
+
INTENT = 'intent',
|
|
8
|
+
FUNCTION = 'function',
|
|
9
|
+
FALLBACK = 'fallback',
|
|
10
|
+
VIDEO = 'video',
|
|
11
|
+
WHATSAPP_BUTTON_LIST = 'whatsapp-button-list',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export enum HtNodeStartType {
|
|
15
|
+
STARTUP = 'start-up',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export enum HtNodeWithoutContentType {
|
|
19
|
+
URL = 'url',
|
|
20
|
+
PAYLOAD = 'payload',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export enum HtButtonStyle {
|
|
24
|
+
BUTTON = 'button',
|
|
25
|
+
QUICK_REPLY = 'quick-reply',
|
|
26
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { HtCarouselNode } from './carousel'
|
|
2
|
+
import { HtFallbackNode } from './fallback'
|
|
3
|
+
import { HtFunctionNode } from './function'
|
|
4
|
+
import { HtHandoffNode } from './handoff'
|
|
5
|
+
import { HtImageNode } from './image'
|
|
6
|
+
import { HtIntentNode } from './intent'
|
|
7
|
+
import { HtKeywordNode } from './keyword'
|
|
8
|
+
import { HtPayloadNode } from './payload'
|
|
9
|
+
import { HtStartNode } from './start'
|
|
10
|
+
import { HtTextNode } from './text'
|
|
11
|
+
import { HtUrlNode } from './url'
|
|
12
|
+
import { HtVideoNode } from './video'
|
|
13
|
+
import { HtWhatsappButtonListNode } from './whatsapp-button-list'
|
|
14
|
+
|
|
15
|
+
export type HtNodeWithContent =
|
|
16
|
+
| HtTextNode
|
|
17
|
+
| HtImageNode
|
|
18
|
+
| HtVideoNode
|
|
19
|
+
| HtCarouselNode
|
|
20
|
+
| HtHandoffNode
|
|
21
|
+
| HtKeywordNode
|
|
22
|
+
| HtIntentNode
|
|
23
|
+
| HtFunctionNode
|
|
24
|
+
| HtFallbackNode
|
|
25
|
+
| HtWhatsappButtonListNode
|
|
26
|
+
|
|
27
|
+
export type HtNodeWithoutContent = HtUrlNode | HtPayloadNode
|
|
28
|
+
|
|
29
|
+
export type HtNodeComponent =
|
|
30
|
+
| HtNodeWithContent
|
|
31
|
+
| HtNodeWithoutContent
|
|
32
|
+
| HtStartNode
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HtButton } from './button'
|
|
2
|
+
import { HtBaseNode, HtTextLocale } from './common'
|
|
3
|
+
import { HtButtonStyle, HtNodeWithContentType } from './node-types'
|
|
4
|
+
|
|
5
|
+
export interface HtTextNode extends HtBaseNode {
|
|
6
|
+
type: HtNodeWithContentType.TEXT
|
|
7
|
+
content: {
|
|
8
|
+
text: HtTextLocale[]
|
|
9
|
+
buttons_style?: HtButtonStyle
|
|
10
|
+
buttons: HtButton[]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import { HtBaseNode, HtNodeLink, HtTextLocale } from './common'
|
|
3
|
+
import { HtNodeWithContentType } from './node-types'
|
|
4
|
+
|
|
5
|
+
export interface HtWhatsappButtonListRow {
|
|
6
|
+
id: string
|
|
7
|
+
text: HtTextLocale[]
|
|
8
|
+
description: HtTextLocale[]
|
|
9
|
+
target?: HtNodeLink
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface HtWhatsappButtonListSection {
|
|
13
|
+
id: string
|
|
14
|
+
title: HtTextLocale[]
|
|
15
|
+
rows: HtWhatsappButtonListRow[]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface HtWhatsappButtonListNode extends HtBaseNode {
|
|
19
|
+
type: HtNodeWithContentType.WHATSAPP_BUTTON_LIST
|
|
20
|
+
content: {
|
|
21
|
+
text: HtTextLocale[]
|
|
22
|
+
button_text: HtTextLocale[]
|
|
23
|
+
sections: HtWhatsappButtonListSection[]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
import { FlowCarousel } from './flow-carousel'
|
|
2
|
+
import { FlowImage } from './flow-image'
|
|
3
|
+
import { FlowText } from './flow-text'
|
|
4
|
+
import { FlowVideo } from './flow-video'
|
|
5
|
+
import { FlowWhatsappButtonList } from './whatsapp-button-list/flow-whatsapp-button-list'
|
|
6
|
+
|
|
1
7
|
export { ContentFieldsBase } from './content-fields-base'
|
|
2
8
|
export { FlowButton } from './flow-button'
|
|
3
|
-
export { FlowCarousel } from './flow-carousel'
|
|
4
9
|
export { FlowElement } from './flow-element'
|
|
5
|
-
export { FlowImage
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
|
|
10
|
+
export { FlowCarousel, FlowImage, FlowText, FlowVideo, FlowWhatsappButtonList }
|
|
11
|
+
|
|
12
|
+
export type FlowContent =
|
|
13
|
+
| FlowCarousel
|
|
14
|
+
| FlowImage
|
|
15
|
+
| FlowText
|
|
16
|
+
| FlowVideo
|
|
17
|
+
| FlowWhatsappButtonList
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { WhatsappButtonListRowProps } from '@botonic/react/lib/cjs/components/whatsapp-button-list'
|
|
2
|
+
|
|
3
|
+
import { ContentFieldsBase } from '../content-fields-base'
|
|
4
|
+
import { HtWhatsappButtonListRow } from '../hubtype-fields'
|
|
5
|
+
|
|
6
|
+
export class FlowWhatsappButtonListRow extends ContentFieldsBase {
|
|
7
|
+
public title = ''
|
|
8
|
+
public description = ''
|
|
9
|
+
public targetId?: string
|
|
10
|
+
|
|
11
|
+
static fromHubtypeCMS(
|
|
12
|
+
component: HtWhatsappButtonListRow,
|
|
13
|
+
locale: string
|
|
14
|
+
): FlowWhatsappButtonListRow {
|
|
15
|
+
const newRow = new FlowWhatsappButtonListRow(component.id)
|
|
16
|
+
newRow.title = this.getTextByLocale(locale, component.text)
|
|
17
|
+
newRow.description = this.getTextByLocale(locale, component.description)
|
|
18
|
+
newRow.targetId = component.target?.id
|
|
19
|
+
return newRow
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
toBotonic(): WhatsappButtonListRowProps | undefined {
|
|
23
|
+
if (!this.targetId) {
|
|
24
|
+
console.error(`Row with title: '${this.title}' has no target`)
|
|
25
|
+
return undefined
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
id: this.targetId,
|
|
29
|
+
title: this.title,
|
|
30
|
+
description: this.description,
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WhatsappButtonListRowProps,
|
|
3
|
+
WhatsappButtonListSectionProps,
|
|
4
|
+
} from '@botonic/react/lib/cjs/components/whatsapp-button-list'
|
|
5
|
+
|
|
6
|
+
import { HtWhatsappButtonListSection } from '../hubtype-fields'
|
|
7
|
+
import { ContentFieldsBase } from './../content-fields-base'
|
|
8
|
+
import { FlowWhatsappButtonListRow } from './flow-whatsapp-button-list-row'
|
|
9
|
+
|
|
10
|
+
export class FlowWhatsappButtonListSection extends ContentFieldsBase {
|
|
11
|
+
public title = ''
|
|
12
|
+
public rows: FlowWhatsappButtonListRow[] = []
|
|
13
|
+
|
|
14
|
+
static fromHubtypeCMS(
|
|
15
|
+
component: HtWhatsappButtonListSection,
|
|
16
|
+
locale: string
|
|
17
|
+
): FlowWhatsappButtonListSection {
|
|
18
|
+
const newButton = new FlowWhatsappButtonListSection(component.id)
|
|
19
|
+
newButton.title = this.getTextByLocale(locale, component.title)
|
|
20
|
+
newButton.rows = component.rows.map(row =>
|
|
21
|
+
FlowWhatsappButtonListRow.fromHubtypeCMS(row, locale)
|
|
22
|
+
)
|
|
23
|
+
return newButton
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
toBotonic(): WhatsappButtonListSectionProps {
|
|
27
|
+
const rows = this.rows.reduce((acc: WhatsappButtonListRowProps[], row) => {
|
|
28
|
+
const botonicRow = row.toBotonic()
|
|
29
|
+
if (botonicRow) acc.push(botonicRow)
|
|
30
|
+
return acc
|
|
31
|
+
}, [])
|
|
32
|
+
|
|
33
|
+
return { title: this.title, rows }
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { WhatsappButtonList } from '@botonic/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { HtWhatsappButtonListNode } from '../hubtype-fields'
|
|
5
|
+
import { ContentFieldsBase } from './../content-fields-base'
|
|
6
|
+
import { FlowWhatsappButtonListSection } from './flow-whatsapp-button-list-section'
|
|
7
|
+
|
|
8
|
+
export class FlowWhatsappButtonList extends ContentFieldsBase {
|
|
9
|
+
public code = ''
|
|
10
|
+
public text = ''
|
|
11
|
+
public listButtonText = ''
|
|
12
|
+
public sections: FlowWhatsappButtonListSection[] = []
|
|
13
|
+
|
|
14
|
+
static fromHubtypeCMS(
|
|
15
|
+
component: HtWhatsappButtonListNode,
|
|
16
|
+
locale: string
|
|
17
|
+
): FlowWhatsappButtonList {
|
|
18
|
+
const newWhatsappButtonList = new FlowWhatsappButtonList(component.id)
|
|
19
|
+
newWhatsappButtonList.code = component.code
|
|
20
|
+
newWhatsappButtonList.text = this.getTextByLocale(
|
|
21
|
+
locale,
|
|
22
|
+
component.content.text
|
|
23
|
+
)
|
|
24
|
+
newWhatsappButtonList.listButtonText = this.getTextByLocale(
|
|
25
|
+
locale,
|
|
26
|
+
component.content.button_text
|
|
27
|
+
)
|
|
28
|
+
newWhatsappButtonList.sections = component.content.sections.map(section =>
|
|
29
|
+
FlowWhatsappButtonListSection.fromHubtypeCMS(section, locale)
|
|
30
|
+
)
|
|
31
|
+
return newWhatsappButtonList
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
toBotonic(id: string): JSX.Element {
|
|
35
|
+
return (
|
|
36
|
+
<WhatsappButtonList
|
|
37
|
+
key={id}
|
|
38
|
+
body={this.text}
|
|
39
|
+
action={{
|
|
40
|
+
button: this.listButtonText,
|
|
41
|
+
sections: this.sections.map(section => section.toBotonic()),
|
|
42
|
+
}}
|
|
43
|
+
></WhatsappButtonList>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export function conditionalProvider({
|
|
2
|
-
const provider = session.user.provider
|
|
1
|
+
export function conditionalProvider({ request, results }): string {
|
|
2
|
+
const provider = request.session.user.provider
|
|
3
3
|
if (results.includes(provider)) return provider
|
|
4
4
|
return 'default'
|
|
5
5
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { ActionRequest } from '@botonic/react'
|
|
1
2
|
import axios from 'axios'
|
|
2
3
|
|
|
4
|
+
import { getFlowBuilderPlugin } from '../helpers'
|
|
3
5
|
import { getWebpackEnvVar } from '../utils'
|
|
4
6
|
|
|
5
7
|
const _HUBTYPE_API_URL_ = getWebpackEnvVar(
|
|
@@ -9,11 +11,17 @@ const _HUBTYPE_API_URL_ = getWebpackEnvVar(
|
|
|
9
11
|
'https://api.hubtype.com'
|
|
10
12
|
)
|
|
11
13
|
|
|
14
|
+
type ConditionalQueueStatusArgs = {
|
|
15
|
+
request: ActionRequest
|
|
16
|
+
queue_id: string
|
|
17
|
+
queue_name: string
|
|
18
|
+
}
|
|
19
|
+
|
|
12
20
|
export async function conditionalQueueStatus({
|
|
21
|
+
request,
|
|
13
22
|
queue_id,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}): Promise<string> {
|
|
23
|
+
queue_name,
|
|
24
|
+
}: ConditionalQueueStatusArgs): Promise<string> {
|
|
17
25
|
const response = await axios.get(
|
|
18
26
|
`${_HUBTYPE_API_URL_}/v1/queues/${queue_id}/availability/`,
|
|
19
27
|
// TODO: Make it configurable in the future
|
|
@@ -26,5 +34,16 @@ export async function conditionalQueueStatus({
|
|
|
26
34
|
}
|
|
27
35
|
)
|
|
28
36
|
const isAvailable = response.data.available
|
|
37
|
+
|
|
38
|
+
const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)
|
|
39
|
+
if (flowBuilderPlugin.trackEvent) {
|
|
40
|
+
const eventName = `QUEUE_${isAvailable ? 'OPEN' : 'CLOSED'}`
|
|
41
|
+
const args = {
|
|
42
|
+
queue_id,
|
|
43
|
+
queue_name,
|
|
44
|
+
}
|
|
45
|
+
await flowBuilderPlugin.trackEvent(request, eventName, args)
|
|
46
|
+
}
|
|
47
|
+
|
|
29
48
|
return isAvailable ? 'open' : 'closed'
|
|
30
49
|
}
|
package/src/handoff.ts
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import { HandOffBuilder } from '@botonic/core'
|
|
2
2
|
import { ActionRequest } from '@botonic/react'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { HtHandoffNode, HtPayloadNode } from './content-fields/hubtype-fields'
|
|
5
5
|
import { getFlowBuilderPlugin } from './helpers'
|
|
6
|
+
import BotonicPluginFlowBuilder from './index'
|
|
6
7
|
|
|
7
8
|
export async function doHandoff(
|
|
8
9
|
request: ActionRequest,
|
|
9
10
|
locale: string,
|
|
10
|
-
handoffNode:
|
|
11
|
+
handoffNode: HtHandoffNode
|
|
11
12
|
): Promise<void> {
|
|
13
|
+
const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)
|
|
12
14
|
// @ts-ignore
|
|
13
15
|
const handOffBuilder = new HandOffBuilder(request.session)
|
|
14
16
|
const handoffQueues = handoffNode.content.queue
|
|
15
17
|
const queueFound = handoffQueues.find(q => q.locale === locale)
|
|
16
18
|
if (queueFound) handOffBuilder.withQueue(queueFound.id)
|
|
17
19
|
|
|
18
|
-
const onFinishPayload = await getOnFinishPayload(
|
|
20
|
+
const onFinishPayload = await getOnFinishPayload(
|
|
21
|
+
flowBuilderPlugin,
|
|
22
|
+
handoffNode,
|
|
23
|
+
locale
|
|
24
|
+
)
|
|
19
25
|
if (onFinishPayload) handOffBuilder.withOnFinishPayload(onFinishPayload)
|
|
20
26
|
if (handoffNode.content.has_auto_assign) {
|
|
21
27
|
handOffBuilder.withAutoAssignOnWaiting(true)
|
|
@@ -36,19 +42,26 @@ export async function doHandoff(
|
|
|
36
42
|
// }
|
|
37
43
|
|
|
38
44
|
await handOffBuilder.handOff()
|
|
45
|
+
|
|
46
|
+
if (flowBuilderPlugin.trackEvent) {
|
|
47
|
+
await flowBuilderPlugin.trackEvent(request, 'HANDOFF_SUCCESSFULL', {
|
|
48
|
+
queue_id: queueFound?.id,
|
|
49
|
+
queue_name: queueFound?.name,
|
|
50
|
+
})
|
|
51
|
+
}
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
async function getOnFinishPayload(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
55
|
+
flowBuilderPlugin: BotonicPluginFlowBuilder,
|
|
56
|
+
handoffNode: HtHandoffNode,
|
|
57
|
+
locale: string
|
|
45
58
|
): Promise<string | undefined> {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
if (handoffNode.target?.id) {
|
|
60
|
+
const handoffTargetNode = flowBuilderPlugin.cmsApi.getNode<HtHandoffNode>(
|
|
61
|
+
handoffNode.target?.id
|
|
62
|
+
)
|
|
63
|
+
if (handoffTargetNode?.id) return handoffTargetNode?.id
|
|
64
|
+
}
|
|
52
65
|
|
|
53
66
|
const payloadId = handoffNode.content.payload.find(
|
|
54
67
|
payload => payload.locale === locale
|
|
@@ -56,7 +69,7 @@ async function getOnFinishPayload(
|
|
|
56
69
|
|
|
57
70
|
if (!payloadId) return undefined
|
|
58
71
|
|
|
59
|
-
const actionPayload =
|
|
72
|
+
const actionPayload = flowBuilderPlugin.cmsApi.getNode(payloadId)
|
|
60
73
|
|
|
61
|
-
return (actionPayload as
|
|
74
|
+
return (actionPayload as HtPayloadNode).content.payload
|
|
62
75
|
}
|
package/src/helpers.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Plugin } from '@botonic/core'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
HtHandoffNode,
|
|
5
|
+
HtNodeWithContent,
|
|
6
|
+
HtNodeWithContentType,
|
|
7
|
+
} from './content-fields/hubtype-fields'
|
|
2
8
|
import BotonicPluginFlowBuilder from './index'
|
|
3
|
-
import { NodeComponent } from './flow-builder-models'
|
|
4
9
|
|
|
5
10
|
const FLOW_BUILDER_PLUGIN_NAME = 'BotonicPluginFlowBuilder'
|
|
6
11
|
|
|
@@ -18,22 +23,6 @@ export function getFlowBuilderPlugin(plugins: {
|
|
|
18
23
|
return flowBuilderPlugin
|
|
19
24
|
}
|
|
20
25
|
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
contentKey: string,
|
|
24
|
-
getContentFn: any
|
|
25
|
-
): Promise<void> {
|
|
26
|
-
if (hubtypeContent.content[contentKey]) {
|
|
27
|
-
for (const i in hubtypeContent.content[contentKey]) {
|
|
28
|
-
const button = hubtypeContent.content[contentKey][i].button
|
|
29
|
-
if (button?.url) {
|
|
30
|
-
for (const j in button.url) {
|
|
31
|
-
button.url[j] = {
|
|
32
|
-
...button.url[j],
|
|
33
|
-
...(await getContentFn(button.url[j].id)),
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
26
|
+
export function isHandoffNode(node: HtNodeWithContent): node is HtHandoffNode {
|
|
27
|
+
return node.type === HtNodeWithContentType.HANDOFF
|
|
39
28
|
}
|