Skip to content

Commit 6ee02a8

Browse files
author
Theodore Li
committed
Simplify subblocks for google service account
1 parent 48c417f commit 6ee02a8

File tree

14 files changed

+47
-187
lines changed

14 files changed

+47
-187
lines changed

apps/sim/blocks/blocks/agent.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -152,19 +152,6 @@ Return ONLY the JSON array.`,
152152
value: providers.vertex.models,
153153
},
154154
},
155-
{
156-
id: 'isServiceAccount',
157-
title: 'Is Service Account',
158-
type: 'short-input',
159-
hidden: true,
160-
},
161-
{
162-
id: 'impersonateUserEmail',
163-
title: 'Impersonated Account',
164-
type: 'short-input',
165-
placeholder: 'Email to impersonate (for service accounts)',
166-
condition: { field: 'isServiceAccount', value: 'true' },
167-
},
168155
{
169156
id: 'reasoningEffort',
170157
title: 'Reasoning Effort',

apps/sim/blocks/blocks/gmail.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { GmailIcon } from '@/components/icons'
22
import { getScopesForService } from '@/lib/oauth/utils'
33
import type { BlockConfig } from '@/blocks/types'
44
import { AuthMode, IntegrationType } from '@/blocks/types'
5-
import { createVersionedToolSelector, normalizeFileInput } from '@/blocks/utils'
5+
import { createVersionedToolSelector, normalizeFileInput, SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
66
import type { GmailToolResponse } from '@/tools/gmail/types'
77
import { getTrigger } from '@/triggers'
88

@@ -95,19 +95,7 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
9595
placeholder: 'Enter credential ID',
9696
required: true,
9797
},
98-
{
99-
id: 'isServiceAccount',
100-
title: 'Is Service Account',
101-
type: 'short-input',
102-
hidden: true,
103-
},
104-
{
105-
id: 'impersonateUserEmail',
106-
title: 'Impersonated Account',
107-
type: 'short-input',
108-
placeholder: 'Email to impersonate (for service accounts)',
109-
condition: { field: 'isServiceAccount', value: 'true' },
110-
},
98+
...SERVICE_ACCOUNT_SUBBLOCKS,
11199
// Send Email Fields
112100
{
113101
id: 'to',

apps/sim/blocks/blocks/google_calendar.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { GoogleCalendarIcon } from '@/components/icons'
22
import { getScopesForService } from '@/lib/oauth/utils'
33
import type { BlockConfig } from '@/blocks/types'
44
import { AuthMode, IntegrationType } from '@/blocks/types'
5-
import { createVersionedToolSelector } from '@/blocks/utils'
5+
import { createVersionedToolSelector, SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
66
import type { GoogleCalendarResponse } from '@/tools/google_calendar/types'
77

88
export const GoogleCalendarBlock: BlockConfig<GoogleCalendarResponse> = {
@@ -58,19 +58,7 @@ export const GoogleCalendarBlock: BlockConfig<GoogleCalendarResponse> = {
5858
placeholder: 'Enter credential ID',
5959
required: true,
6060
},
61-
{
62-
id: 'isServiceAccount',
63-
title: 'Is Service Account',
64-
type: 'short-input',
65-
hidden: true,
66-
},
67-
{
68-
id: 'impersonateUserEmail',
69-
title: 'Impersonated Account',
70-
type: 'short-input',
71-
placeholder: 'Email to impersonate (for service accounts)',
72-
condition: { field: 'isServiceAccount', value: 'true' },
73-
},
61+
...SERVICE_ACCOUNT_SUBBLOCKS,
7462
// Calendar selector (basic mode) - not needed for list_calendars
7563
{
7664
id: 'calendarId',

apps/sim/blocks/blocks/google_contacts.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { GoogleContactsIcon } from '@/components/icons'
22
import { getScopesForService } from '@/lib/oauth/utils'
33
import type { BlockConfig } from '@/blocks/types'
44
import { AuthMode, IntegrationType } from '@/blocks/types'
5+
import { SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
56
import type { GoogleContactsResponse } from '@/tools/google_contacts/types'
67

78
export const GoogleContactsBlock: BlockConfig<GoogleContactsResponse> = {
@@ -52,19 +53,7 @@ export const GoogleContactsBlock: BlockConfig<GoogleContactsResponse> = {
5253
placeholder: 'Enter credential ID',
5354
required: true,
5455
},
55-
{
56-
id: 'isServiceAccount',
57-
title: 'Is Service Account',
58-
type: 'short-input',
59-
hidden: true,
60-
},
61-
{
62-
id: 'impersonateUserEmail',
63-
title: 'Impersonated Account',
64-
type: 'short-input',
65-
placeholder: 'Email to impersonate (for service accounts)',
66-
condition: { field: 'isServiceAccount', value: 'true' },
67-
},
56+
...SERVICE_ACCOUNT_SUBBLOCKS,
6857

6958
// Create Contact Fields
7059
{

apps/sim/blocks/blocks/google_docs.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { GoogleDocsIcon } from '@/components/icons'
22
import { getScopesForService } from '@/lib/oauth/utils'
33
import type { BlockConfig } from '@/blocks/types'
44
import { AuthMode, IntegrationType } from '@/blocks/types'
5+
import { SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
56
import type { GoogleDocsResponse } from '@/tools/google_docs/types'
67

78
export const GoogleDocsBlock: BlockConfig<GoogleDocsResponse> = {
@@ -51,19 +52,7 @@ export const GoogleDocsBlock: BlockConfig<GoogleDocsResponse> = {
5152
placeholder: 'Enter credential ID',
5253
required: true,
5354
},
54-
{
55-
id: 'isServiceAccount',
56-
title: 'Is Service Account',
57-
type: 'short-input',
58-
hidden: true,
59-
},
60-
{
61-
id: 'impersonateUserEmail',
62-
title: 'Impersonated Account',
63-
type: 'short-input',
64-
placeholder: 'Email to impersonate (for service accounts)',
65-
condition: { field: 'isServiceAccount', value: 'true' },
66-
},
55+
...SERVICE_ACCOUNT_SUBBLOCKS,
6756
// Document selector (basic mode)
6857
{
6958
id: 'documentId',

apps/sim/blocks/blocks/google_drive.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { GoogleDriveIcon } from '@/components/icons'
22
import { getScopesForService } from '@/lib/oauth/utils'
33
import type { BlockConfig } from '@/blocks/types'
44
import { AuthMode, IntegrationType } from '@/blocks/types'
5-
import { normalizeFileInput } from '@/blocks/utils'
5+
import { normalizeFileInput, SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
66
import type { GoogleDriveResponse } from '@/tools/google_drive/types'
77

88
export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = {
@@ -63,19 +63,7 @@ export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = {
6363
placeholder: 'Enter credential ID',
6464
required: true,
6565
},
66-
{
67-
id: 'isServiceAccount',
68-
title: 'Is Service Account',
69-
type: 'short-input',
70-
hidden: true,
71-
},
72-
{
73-
id: 'impersonateUserEmail',
74-
title: 'Impersonated Account',
75-
type: 'short-input',
76-
placeholder: 'Email to impersonate (for service accounts)',
77-
condition: { field: 'isServiceAccount', value: 'true' },
78-
},
66+
...SERVICE_ACCOUNT_SUBBLOCKS,
7967
// Create/Upload File Fields
8068
{
8169
id: 'fileName',

apps/sim/blocks/blocks/google_forms.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { GoogleFormsIcon } from '@/components/icons'
22
import { getScopesForService } from '@/lib/oauth/utils'
33
import type { BlockConfig } from '@/blocks/types'
44
import { IntegrationType } from '@/blocks/types'
5+
import { SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
56
import { getTrigger } from '@/triggers'
67

78
export const GoogleFormsBlock: BlockConfig = {
@@ -54,19 +55,7 @@ export const GoogleFormsBlock: BlockConfig = {
5455
placeholder: 'Enter credential ID',
5556
required: true,
5657
},
57-
{
58-
id: 'isServiceAccount',
59-
title: 'Is Service Account',
60-
type: 'short-input',
61-
hidden: true,
62-
},
63-
{
64-
id: 'impersonateUserEmail',
65-
title: 'Impersonated Account',
66-
type: 'short-input',
67-
placeholder: 'Email to impersonate (for service accounts)',
68-
condition: { field: 'isServiceAccount', value: 'true' },
69-
},
58+
...SERVICE_ACCOUNT_SUBBLOCKS,
7059
// Form selector (basic mode)
7160
{
7261
id: 'formSelector',

apps/sim/blocks/blocks/google_groups.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { GoogleGroupsIcon } from '@/components/icons'
22
import { getScopesForService } from '@/lib/oauth/utils'
33
import type { BlockConfig } from '@/blocks/types'
44
import { AuthMode, IntegrationType } from '@/blocks/types'
5+
import { SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
56

67
export const GoogleGroupsBlock: BlockConfig = {
78
type: 'google_groups',
@@ -61,19 +62,7 @@ export const GoogleGroupsBlock: BlockConfig = {
6162
placeholder: 'Enter credential ID',
6263
required: true,
6364
},
64-
{
65-
id: 'isServiceAccount',
66-
title: 'Is Service Account',
67-
type: 'short-input',
68-
hidden: true,
69-
},
70-
{
71-
id: 'impersonateUserEmail',
72-
title: 'Impersonated Account',
73-
type: 'short-input',
74-
placeholder: 'Email to impersonate (for service accounts)',
75-
condition: { field: 'isServiceAccount', value: 'true' },
76-
},
65+
...SERVICE_ACCOUNT_SUBBLOCKS,
7766

7867
{
7968
id: 'customer',

apps/sim/blocks/blocks/google_meet.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { GoogleMeetIcon } from '@/components/icons'
22
import { getScopesForService } from '@/lib/oauth/utils'
33
import type { BlockConfig } from '@/blocks/types'
44
import { AuthMode, IntegrationType } from '@/blocks/types'
5+
import { SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
56
import type { GoogleMeetResponse } from '@/tools/google_meet/types'
67

78
export const GoogleMeetBlock: BlockConfig<GoogleMeetResponse> = {
@@ -52,19 +53,7 @@ export const GoogleMeetBlock: BlockConfig<GoogleMeetResponse> = {
5253
placeholder: 'Enter credential ID',
5354
required: true,
5455
},
55-
{
56-
id: 'isServiceAccount',
57-
title: 'Is Service Account',
58-
type: 'short-input',
59-
hidden: true,
60-
},
61-
{
62-
id: 'impersonateUserEmail',
63-
title: 'Impersonated Account',
64-
type: 'short-input',
65-
placeholder: 'Email to impersonate (for service accounts)',
66-
condition: { field: 'isServiceAccount', value: 'true' },
67-
},
56+
...SERVICE_ACCOUNT_SUBBLOCKS,
6857

6958
// Create Space Fields
7059
{

apps/sim/blocks/blocks/google_sheets.ts

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { GoogleSheetsIcon } from '@/components/icons'
22
import { getScopesForService } from '@/lib/oauth/utils'
33
import type { BlockConfig } from '@/blocks/types'
44
import { AuthMode, IntegrationType } from '@/blocks/types'
5-
import { createVersionedToolSelector } from '@/blocks/utils'
5+
import { createVersionedToolSelector, SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
66
import type { GoogleSheetsResponse, GoogleSheetsV2Response } from '@/tools/google_sheets/types'
77

88
// Legacy block - hidden from toolbar
@@ -55,19 +55,7 @@ export const GoogleSheetsBlock: BlockConfig<GoogleSheetsResponse> = {
5555
placeholder: 'Enter credential ID',
5656
required: true,
5757
},
58-
{
59-
id: 'isServiceAccount',
60-
title: 'Is Service Account',
61-
type: 'short-input',
62-
hidden: true,
63-
},
64-
{
65-
id: 'impersonateUserEmail',
66-
title: 'Impersonated Account',
67-
type: 'short-input',
68-
placeholder: 'Email to impersonate (for service accounts)',
69-
condition: { field: 'isServiceAccount', value: 'true' },
70-
},
58+
...SERVICE_ACCOUNT_SUBBLOCKS,
7159
// Spreadsheet Selector
7260
{
7361
id: 'spreadsheetId',
@@ -363,19 +351,7 @@ export const GoogleSheetsV2Block: BlockConfig<GoogleSheetsV2Response> = {
363351
placeholder: 'Enter credential ID',
364352
required: true,
365353
},
366-
{
367-
id: 'isServiceAccount',
368-
title: 'Is Service Account',
369-
type: 'short-input',
370-
hidden: true,
371-
},
372-
{
373-
id: 'impersonateUserEmail',
374-
title: 'Impersonated Account',
375-
type: 'short-input',
376-
placeholder: 'Email to impersonate (for service accounts)',
377-
condition: { field: 'isServiceAccount', value: 'true' },
378-
},
354+
...SERVICE_ACCOUNT_SUBBLOCKS,
379355
// Spreadsheet Selector (basic mode) - not for create operation
380356
{
381357
id: 'spreadsheetId',

0 commit comments

Comments
 (0)