11import i18n from '@/i18n'
2- import { EActionTypes , EMessageTypes } from '@/types/flow'
2+ import { EActionTypes , EGrammarTypes , EMessageTypes } from '@/types/flow'
33import {
44 Bolt ,
55 GitPullRequest ,
@@ -11,7 +11,14 @@ import {
1111 Workflow ,
1212} from 'lucide-react'
1313import { useTranslation } from 'react-i18next'
14- import { CheckVariablesContent , MessageDialogContent } from './node-dialog'
14+ import {
15+ CheckVariablesContent ,
16+ HttpRequestDialogContent ,
17+ MessageDialogContent ,
18+ PromptAndCollectDialogContent ,
19+ SendMailContent ,
20+ SubFlowContent ,
21+ } from './node-dialog'
1522
1623export const MAP_ACTION_TO_LABEL : Record < EActionTypes , string > = {
1724 [ EActionTypes . MESSAGE ] : i18n . t ( 'flowDetail:actions.items.message' ) as string ,
@@ -36,6 +43,11 @@ export const MAP_ACTION_TO_LABEL: Record<EActionTypes, string> = {
3643 ) as string ,
3744}
3845
46+ export const ACTIONS_TO_RENDER_LANG = [
47+ EActionTypes . MESSAGE ,
48+ EActionTypes . PROMPT_AND_COLLECT ,
49+ ]
50+
3951export const useMapActionToLabel = ( ) => {
4052 const { t } = useTranslation ( 'flowDetail' )
4153
@@ -70,7 +82,7 @@ export const MAP_ACTION: Record<
7082 [ EActionTypes . PROMPT_AND_COLLECT ] : {
7183 icon : ( ) => < HelpCircle className = 'w-4 h-4' /> ,
7284 label : 'Prompt and collect' ,
73- dialogContent : ( ) => < MessageDialogContent /> ,
85+ dialogContent : ( ) => < PromptAndCollectDialogContent /> ,
7486 } ,
7587 [ EActionTypes . CHECK_VARIABLES ] : {
7688 icon : ( ) => < Variable className = 'w-4 h-4' /> ,
@@ -80,12 +92,12 @@ export const MAP_ACTION: Record<
8092 [ EActionTypes . HTTP_REQUEST ] : {
8193 icon : ( ) => < GitPullRequest className = 'w-4 h-4' /> ,
8294 label : 'Http request' ,
83- dialogContent : ( ) => < div > Http request </ div > ,
95+ dialogContent : ( ) => < HttpRequestDialogContent / >,
8496 } ,
8597 [ EActionTypes . SEND_MAIL ] : {
8698 icon : ( ) => < Mail className = 'w-4 h-4' /> ,
8799 label : 'Send mail' ,
88- dialogContent : ( ) => < div > Send mail </ div > ,
100+ dialogContent : ( ) => < SendMailContent / >,
89101 } ,
90102 [ EActionTypes . FALLBACK ] : {
91103 icon : ( ) => < Webhook className = 'w-4 h-4' /> ,
@@ -100,7 +112,7 @@ export const MAP_ACTION: Record<
100112 [ EActionTypes . SUB_FLOW ] : {
101113 icon : ( ) => < Workflow className = 'w-4 h-4' /> ,
102114 label : 'Sub flow' ,
103- dialogContent : ( ) => < div > Sub flow </ div > ,
115+ dialogContent : ( ) => < SubFlowContent / >,
104116 } ,
105117}
106118
@@ -136,3 +148,12 @@ export const CONDITIONAL_OPERATOR = [
136148 'in' ,
137149 'not_in' ,
138150]
151+
152+ export const MAP_GRAMMAR_TYPE : Record < EGrammarTypes , string > = {
153+ [ EGrammarTypes . INTENT ] : i18n . t ( 'flowDetail:grammars_type.intent' ) ,
154+ [ EGrammarTypes . NUMBER ] : i18n . t ( 'flowDetail:grammars_type.number' ) ,
155+ [ EGrammarTypes . EMAIL ] : i18n . t ( 'flowDetail:grammars_type.email' ) ,
156+ [ EGrammarTypes . PHONE_NUMBER ] : i18n . t ( 'flowDetail:grammars_type.phone_number' ) ,
157+ [ EGrammarTypes . TEXT ] : i18n . t ( 'flowDetail:grammars_type.text' ) ,
158+ [ EGrammarTypes . YES_NO ] : i18n . t ( 'flowDetail:grammars_type.yes_no' ) ,
159+ }
0 commit comments