@@ -14,17 +14,17 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
1414 icon : GmailIcon ,
1515 subBlocks : [
1616 // Operation selector
17- // {
18- // id: 'operation',
19- // title: 'Operation',
20- // type: 'dropdown',
21- // layout: 'full',
22- // options: [
23- // { label: 'Send Email', id: 'send_gmail' },
24- // // { label: 'Read Email', id: 'read_gmail' },
25- // // { label: 'Search Emails ', id: 'search_gmail ' },
26- // ],
27- // },
17+ {
18+ id : 'operation' ,
19+ title : 'Operation' ,
20+ type : 'dropdown' ,
21+ layout : 'full' ,
22+ options : [
23+ { label : 'Send Email' , id : 'send_gmail' } ,
24+ // { label: 'Read Email', id: 'read_gmail' },
25+ { label : 'Draft Email ' , id : 'draft_gmail ' } ,
26+ ] ,
27+ } ,
2828 // Gmail Credentials
2929 {
3030 id : 'credential' ,
@@ -48,23 +48,23 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
4848 type : 'short-input' ,
4949 layout : 'full' ,
5050 placeholder : 'Recipient email address' ,
51- // condition: { field: 'operation', value: 'send_gmail' },
51+ condition : { field : 'operation' , value : [ 'send_gmail' , 'draft_gmail' ] } ,
5252 } ,
5353 {
5454 id : 'subject' ,
5555 title : 'Subject' ,
5656 type : 'short-input' ,
5757 layout : 'full' ,
5858 placeholder : 'Email subject' ,
59- // condition: { field: 'operation', value: 'send_gmail' },
59+ condition : { field : 'operation' , value : [ 'send_gmail' , 'draft_gmail' ] } ,
6060 } ,
6161 {
6262 id : 'body' ,
6363 title : 'Body' ,
6464 type : 'long-input' ,
6565 layout : 'full' ,
6666 placeholder : 'Email content' ,
67- // condition: { field: 'operation', value: 'send_gmail' },
67+ condition : { field : 'operation' , value : [ 'send_gmail' , 'draft_gmail' ] } ,
6868 } ,
6969 // Read Email Fields - Add folder selector
7070 // {
@@ -130,22 +130,17 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
130130 // },
131131 ] ,
132132 tools : {
133- access : [ 'gmail_send' , 'gmail_read' , 'gmail_search '] ,
133+ access : [ 'gmail_send' , 'gmail_draft ' ] ,
134134 config : {
135135 tool : ( params ) => {
136- // Since we only have send_gmail now, we can simplify this
137- return 'gmail_send'
138-
139- // switch (params.operation) {
140- // case 'send_gmail':
141- // return 'gmail_send'
142- // case 'read_gmail':
143- // return 'gmail_read'
144- // case 'search_gmail':
145- // return 'gmail_search'
146- // default:
147- // throw new Error(`Invalid Gmail operation: ${params.operation}`)
148- // }
136+ switch ( params . operation ) {
137+ case 'send_gmail' :
138+ return 'gmail_send'
139+ case 'draft_gmail' :
140+ return 'gmail_draft'
141+ default :
142+ throw new Error ( `Invalid Gmail operation: ${ params . operation } ` )
143+ }
149144 } ,
150145 params : ( params ) => {
151146 // Pass the credential directly from the credential field
@@ -158,13 +153,13 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
158153
159154 return {
160155 ...rest ,
161- credential, // Keep the credential parameter
156+ credential,
162157 }
163158 } ,
164159 } ,
165160 } ,
166161 inputs : {
167- // operation: { type: 'string', required: true },
162+ operation : { type : 'string' , required : true } ,
168163 credential : { type : 'string' , required : true } ,
169164 // Send operation inputs
170165 to : { type : 'string' , required : false } ,
0 commit comments