@@ -2,9 +2,9 @@ import { GoogleCalendarIcon } from '@/components/icons'
22import type {
33 GoogleCalendarCreateResponse ,
44 GoogleCalendarGetResponse ,
5+ GoogleCalendarInviteResponse ,
56 GoogleCalendarListResponse ,
67 GoogleCalendarQuickAddResponse ,
7- GoogleCalendarUpdateResponse ,
88} from '@/tools/google_calendar/types'
99import type { BlockConfig } from '../types'
1010
@@ -13,14 +13,14 @@ type GoogleCalendarResponse =
1313 | GoogleCalendarListResponse
1414 | GoogleCalendarGetResponse
1515 | GoogleCalendarQuickAddResponse
16- | GoogleCalendarUpdateResponse
16+ | GoogleCalendarInviteResponse
1717
1818export const GoogleCalendarBlock : BlockConfig < GoogleCalendarResponse > = {
1919 type : 'google_calendar' ,
2020 name : 'Google Calendar' ,
2121 description : 'Manage Google Calendar events' ,
2222 longDescription :
23- ' Integrate Google Calendar functionality to create, read, update, and list calendar events within your workflow. Automate scheduling, check availability, and manage events using OAuth authentication.' ,
23+ " Integrate Google Calendar functionality to create, read, update, and list calendar events within your workflow. Automate scheduling, check availability, and manage events using OAuth authentication. Email invitations are sent asynchronously and delivery depends on recipients' Google Calendar settings." ,
2424 docsLink : 'https://docs.simstudio.ai/tools/google-calendar' ,
2525 category : 'tools' ,
2626 bgColor : '#E0E0E0' ,
@@ -36,6 +36,7 @@ export const GoogleCalendarBlock: BlockConfig<GoogleCalendarResponse> = {
3636 { label : 'List Events' , id : 'list' } ,
3737 { label : 'Get Event' , id : 'get' } ,
3838 { label : 'Quick Add (Natural Language)' , id : 'quick_add' } ,
39+ { label : 'Invite Attendees' , id : 'invite' } ,
3940 ] ,
4041 } ,
4142 {
@@ -133,66 +134,29 @@ export const GoogleCalendarBlock: BlockConfig<GoogleCalendarResponse> = {
133134 title : 'Event ID' ,
134135 type : 'short-input' ,
135136 layout : 'full' ,
136- placeholder : 'Event ID to retrieve ' ,
137- condition : { field : 'operation' , value : 'get' } ,
137+ placeholder : 'Event ID' ,
138+ condition : { field : 'operation' , value : [ 'get' , 'invite' ] } ,
138139 } ,
139140
140- // Update Event Fields
141- {
142- id : 'eventId' ,
143- title : 'Event ID' ,
144- type : 'short-input' ,
145- layout : 'full' ,
146- placeholder : 'Event ID to update' ,
147- condition : { field : 'operation' , value : 'update' } ,
148- } ,
149- {
150- id : 'summary' ,
151- title : 'Event Title' ,
152- type : 'short-input' ,
153- layout : 'full' ,
154- placeholder : 'Updated meeting title' ,
155- condition : { field : 'operation' , value : 'update' } ,
156- } ,
157- {
158- id : 'description' ,
159- title : 'Description' ,
160- type : 'long-input' ,
161- layout : 'full' ,
162- placeholder : 'Updated description' ,
163- condition : { field : 'operation' , value : 'update' } ,
164- } ,
165- {
166- id : 'location' ,
167- title : 'Location' ,
168- type : 'short-input' ,
169- layout : 'full' ,
170- placeholder : 'Updated location' ,
171- condition : { field : 'operation' , value : 'update' } ,
172- } ,
173- {
174- id : 'startDateTime' ,
175- title : 'Start Date & Time' ,
176- type : 'short-input' ,
177- layout : 'half' ,
178- placeholder : '2025-06-03T10:00:00-08:00' ,
179- condition : { field : 'operation' , value : 'update' } ,
180- } ,
181- {
182- id : 'endDateTime' ,
183- title : 'End Date & Time' ,
184- type : 'short-input' ,
185- layout : 'half' ,
186- placeholder : '2025-06-03T11:00:00-08:00' ,
187- condition : { field : 'operation' , value : 'update' } ,
188- } ,
141+ // Invite Attendees Fields
189142 {
190143 id : 'attendees' ,
191144 title : 'Attendees (comma-separated emails)' ,
192145 type : 'short-input' ,
193146 layout : 'full' ,
194147 placeholder : 'john@example.com, jane@example.com' ,
195- condition : { field : 'operation' , value : 'update' } ,
148+ condition : { field : 'operation' , value : 'invite' } ,
149+ } ,
150+ {
151+ id : 'replaceExisting' ,
152+ title : 'Replace Existing Attendees' ,
153+ type : 'dropdown' ,
154+ layout : 'full' ,
155+ condition : { field : 'operation' , value : 'invite' } ,
156+ options : [
157+ { label : 'Add to existing attendees' , id : 'false' } ,
158+ { label : 'Replace all attendees' , id : 'true' } ,
159+ ] ,
196160 } ,
197161
198162 // Quick Add Fields
@@ -213,20 +177,20 @@ export const GoogleCalendarBlock: BlockConfig<GoogleCalendarResponse> = {
213177 condition : { field : 'operation' , value : 'quick_add' } ,
214178 } ,
215179
216- // Notification setting (for create, update, quick_add )
180+ // Notification setting (for create, quick_add, invite )
217181 {
218182 id : 'sendUpdates' ,
219183 title : 'Send Email Notifications' ,
220184 type : 'dropdown' ,
221185 layout : 'full' ,
222186 condition : {
223187 field : 'operation' ,
224- value : [ 'create' , 'update ' , 'quick_add ' ] ,
188+ value : [ 'create' , 'quick_add ' , 'invite ' ] ,
225189 } ,
226190 options : [
227- { label : 'All' , id : 'all' } ,
228- { label : 'External Only ' , id : 'externalOnly' } ,
229- { label : 'None' , id : 'none' } ,
191+ { label : 'All attendees (recommended) ' , id : 'all' } ,
192+ { label : 'External attendees only ' , id : 'externalOnly' } ,
193+ { label : 'None (no emails sent) ' , id : 'none' } ,
230194 ] ,
231195 } ,
232196 ] ,
@@ -236,6 +200,7 @@ export const GoogleCalendarBlock: BlockConfig<GoogleCalendarResponse> = {
236200 'google_calendar_list' ,
237201 'google_calendar_get' ,
238202 'google_calendar_quick_add' ,
203+ 'google_calendar_invite' ,
239204 ] ,
240205 config : {
241206 tool : ( params ) => {
@@ -248,12 +213,14 @@ export const GoogleCalendarBlock: BlockConfig<GoogleCalendarResponse> = {
248213 return 'google_calendar_get'
249214 case 'quick_add' :
250215 return 'google_calendar_quick_add'
216+ case 'invite' :
217+ return 'google_calendar_invite'
251218 default :
252219 throw new Error ( `Invalid Google Calendar operation: ${ params . operation } ` )
253220 }
254221 } ,
255222 params : ( params ) => {
256- const { credential, operation, attendees, ...rest } = params
223+ const { credential, operation, attendees, replaceExisting , ...rest } = params
257224
258225 const processedParams = { ...rest }
259226
@@ -270,8 +237,13 @@ export const GoogleCalendarBlock: BlockConfig<GoogleCalendarResponse> = {
270237 }
271238 }
272239
240+ // Convert replaceExisting string to boolean for invite operation
241+ if ( operation === 'invite' && replaceExisting !== undefined ) {
242+ processedParams . replaceExisting = replaceExisting === 'true'
243+ }
244+
273245 // Set default sendUpdates to 'all' if not specified for operations that support it
274- if ( [ 'create' , 'update ' , 'quick_add ' ] . includes ( operation ) && ! processedParams . sendUpdates ) {
246+ if ( [ 'create' , 'quick_add ' , 'invite ' ] . includes ( operation ) && ! processedParams . sendUpdates ) {
275247 processedParams . sendUpdates = 'all'
276248 }
277249
@@ -299,12 +271,15 @@ export const GoogleCalendarBlock: BlockConfig<GoogleCalendarResponse> = {
299271 timeMin : { type : 'string' , required : false } ,
300272 timeMax : { type : 'string' , required : false } ,
301273
302- // Get/Update operation inputs
274+ // Get/Invite operation inputs
303275 eventId : { type : 'string' , required : false } ,
304276
305277 // Quick add inputs
306278 text : { type : 'string' , required : false } ,
307279
280+ // Invite specific inputs
281+ replaceExisting : { type : 'string' , required : false } ,
282+
308283 // Common inputs
309284 sendUpdates : { type : 'string' , required : false } ,
310285 } ,
0 commit comments