Skip to content

Commit f9a35aa

Browse files
aadamgoughwaleedlatif1
authored andcommitted
fix(grain): fixed output and dropdown (#2685)
* fixed output and dropdown * changed payload * removed comments
1 parent 69284ae commit f9a35aa

File tree

8 files changed

+175
-356
lines changed

8 files changed

+175
-356
lines changed

apps/sim/blocks/blocks/grain.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { GrainIcon } from '@/components/icons'
22
import type { BlockConfig } from '@/blocks/types'
33
import { AuthMode } from '@/blocks/types'
44
import { getTrigger } from '@/triggers'
5+
import { grainTriggerOptions } from '@/triggers/grain/utils'
56

67
export const GrainBlock: BlockConfig = {
78
type: 'grain',
@@ -207,13 +208,21 @@ export const GrainBlock: BlockConfig = {
207208
value: ['grain_delete_hook'],
208209
},
209210
},
210-
// Trigger SubBlocks
211-
...getTrigger('grain_recording_created').subBlocks,
212-
...getTrigger('grain_recording_updated').subBlocks,
213-
...getTrigger('grain_highlight_created').subBlocks,
214-
...getTrigger('grain_highlight_updated').subBlocks,
215-
...getTrigger('grain_story_created').subBlocks,
216-
...getTrigger('grain_webhook').subBlocks,
211+
{
212+
id: 'selectedTriggerId',
213+
title: 'Trigger Type',
214+
type: 'dropdown',
215+
mode: 'trigger',
216+
options: grainTriggerOptions,
217+
value: () => 'grain_webhook',
218+
required: true,
219+
},
220+
...getTrigger('grain_recording_created').subBlocks.slice(1),
221+
...getTrigger('grain_recording_updated').subBlocks.slice(1),
222+
...getTrigger('grain_highlight_created').subBlocks.slice(1),
223+
...getTrigger('grain_highlight_updated').subBlocks.slice(1),
224+
...getTrigger('grain_story_created').subBlocks.slice(1),
225+
...getTrigger('grain_webhook').subBlocks.slice(1),
217226
],
218227
tools: {
219228
access: [

apps/sim/triggers/grain/highlight_created.ts

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { GrainIcon } from '@/components/icons'
22
import type { TriggerConfig } from '@/triggers/types'
3-
import { buildHighlightOutputs, grainSetupInstructions } from './utils'
3+
import { buildHighlightOutputs, grainSetupInstructions, grainTriggerOptions } from './utils'
44

55
export const grainHighlightCreatedTrigger: TriggerConfig = {
66
id: 'grain_highlight_created',
@@ -11,6 +11,15 @@ export const grainHighlightCreatedTrigger: TriggerConfig = {
1111
icon: GrainIcon,
1212

1313
subBlocks: [
14+
{
15+
id: 'selectedTriggerId',
16+
title: 'Trigger Type',
17+
type: 'dropdown',
18+
mode: 'trigger',
19+
options: grainTriggerOptions,
20+
value: () => 'grain_highlight_created',
21+
required: true,
22+
},
1423
{
1524
id: 'apiKey',
1625
title: 'API Key',
@@ -25,42 +34,6 @@ export const grainHighlightCreatedTrigger: TriggerConfig = {
2534
value: 'grain_highlight_created',
2635
},
2736
},
28-
{
29-
id: 'includeHighlights',
30-
title: 'Include Highlights',
31-
type: 'switch',
32-
description: 'Include highlights/clips in webhook payload.',
33-
defaultValue: false,
34-
mode: 'trigger',
35-
condition: {
36-
field: 'selectedTriggerId',
37-
value: 'grain_highlight_created',
38-
},
39-
},
40-
{
41-
id: 'includeParticipants',
42-
title: 'Include Participants',
43-
type: 'switch',
44-
description: 'Include participant list in webhook payload.',
45-
defaultValue: false,
46-
mode: 'trigger',
47-
condition: {
48-
field: 'selectedTriggerId',
49-
value: 'grain_highlight_created',
50-
},
51-
},
52-
{
53-
id: 'includeAiSummary',
54-
title: 'Include AI Summary',
55-
type: 'switch',
56-
description: 'Include AI-generated summary in webhook payload.',
57-
defaultValue: false,
58-
mode: 'trigger',
59-
condition: {
60-
field: 'selectedTriggerId',
61-
value: 'grain_highlight_created',
62-
},
63-
},
6437
{
6538
id: 'triggerInstructions',
6639
title: 'Setup Instructions',

apps/sim/triggers/grain/highlight_updated.ts

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { GrainIcon } from '@/components/icons'
22
import type { TriggerConfig } from '@/triggers/types'
3-
import { buildHighlightOutputs, grainSetupInstructions } from './utils'
3+
import { buildHighlightOutputs, grainSetupInstructions, grainTriggerOptions } from './utils'
44

55
export const grainHighlightUpdatedTrigger: TriggerConfig = {
66
id: 'grain_highlight_updated',
@@ -11,6 +11,15 @@ export const grainHighlightUpdatedTrigger: TriggerConfig = {
1111
icon: GrainIcon,
1212

1313
subBlocks: [
14+
{
15+
id: 'selectedTriggerId',
16+
title: 'Trigger Type',
17+
type: 'dropdown',
18+
mode: 'trigger',
19+
options: grainTriggerOptions,
20+
value: () => 'grain_highlight_updated',
21+
required: true,
22+
},
1423
{
1524
id: 'apiKey',
1625
title: 'API Key',
@@ -25,42 +34,6 @@ export const grainHighlightUpdatedTrigger: TriggerConfig = {
2534
value: 'grain_highlight_updated',
2635
},
2736
},
28-
{
29-
id: 'includeHighlights',
30-
title: 'Include Highlights',
31-
type: 'switch',
32-
description: 'Include highlights/clips in webhook payload.',
33-
defaultValue: false,
34-
mode: 'trigger',
35-
condition: {
36-
field: 'selectedTriggerId',
37-
value: 'grain_highlight_updated',
38-
},
39-
},
40-
{
41-
id: 'includeParticipants',
42-
title: 'Include Participants',
43-
type: 'switch',
44-
description: 'Include participant list in webhook payload.',
45-
defaultValue: false,
46-
mode: 'trigger',
47-
condition: {
48-
field: 'selectedTriggerId',
49-
value: 'grain_highlight_updated',
50-
},
51-
},
52-
{
53-
id: 'includeAiSummary',
54-
title: 'Include AI Summary',
55-
type: 'switch',
56-
description: 'Include AI-generated summary in webhook payload.',
57-
defaultValue: false,
58-
mode: 'trigger',
59-
condition: {
60-
field: 'selectedTriggerId',
61-
value: 'grain_highlight_updated',
62-
},
63-
},
6437
{
6538
id: 'triggerInstructions',
6639
title: 'Setup Instructions',

apps/sim/triggers/grain/recording_created.ts

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { GrainIcon } from '@/components/icons'
22
import type { TriggerConfig } from '@/triggers/types'
3-
import { buildRecordingOutputs, grainSetupInstructions } from './utils'
3+
import { buildRecordingOutputs, grainSetupInstructions, grainTriggerOptions } from './utils'
44

55
export const grainRecordingCreatedTrigger: TriggerConfig = {
66
id: 'grain_recording_created',
@@ -11,6 +11,15 @@ export const grainRecordingCreatedTrigger: TriggerConfig = {
1111
icon: GrainIcon,
1212

1313
subBlocks: [
14+
{
15+
id: 'selectedTriggerId',
16+
title: 'Trigger Type',
17+
type: 'dropdown',
18+
mode: 'trigger',
19+
options: grainTriggerOptions,
20+
value: () => 'grain_recording_created',
21+
required: true,
22+
},
1423
{
1524
id: 'apiKey',
1625
title: 'API Key',
@@ -25,42 +34,6 @@ export const grainRecordingCreatedTrigger: TriggerConfig = {
2534
value: 'grain_recording_created',
2635
},
2736
},
28-
{
29-
id: 'includeHighlights',
30-
title: 'Include Highlights',
31-
type: 'switch',
32-
description: 'Include highlights/clips in webhook payload.',
33-
defaultValue: false,
34-
mode: 'trigger',
35-
condition: {
36-
field: 'selectedTriggerId',
37-
value: 'grain_recording_created',
38-
},
39-
},
40-
{
41-
id: 'includeParticipants',
42-
title: 'Include Participants',
43-
type: 'switch',
44-
description: 'Include participant list in webhook payload.',
45-
defaultValue: false,
46-
mode: 'trigger',
47-
condition: {
48-
field: 'selectedTriggerId',
49-
value: 'grain_recording_created',
50-
},
51-
},
52-
{
53-
id: 'includeAiSummary',
54-
title: 'Include AI Summary',
55-
type: 'switch',
56-
description: 'Include AI-generated summary in webhook payload.',
57-
defaultValue: false,
58-
mode: 'trigger',
59-
condition: {
60-
field: 'selectedTriggerId',
61-
value: 'grain_recording_created',
62-
},
63-
},
6437
{
6538
id: 'triggerInstructions',
6639
title: 'Setup Instructions',

apps/sim/triggers/grain/recording_updated.ts

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { GrainIcon } from '@/components/icons'
22
import type { TriggerConfig } from '@/triggers/types'
3-
import { buildRecordingOutputs, grainSetupInstructions } from './utils'
3+
import { buildRecordingOutputs, grainSetupInstructions, grainTriggerOptions } from './utils'
44

55
export const grainRecordingUpdatedTrigger: TriggerConfig = {
66
id: 'grain_recording_updated',
@@ -11,6 +11,15 @@ export const grainRecordingUpdatedTrigger: TriggerConfig = {
1111
icon: GrainIcon,
1212

1313
subBlocks: [
14+
{
15+
id: 'selectedTriggerId',
16+
title: 'Trigger Type',
17+
type: 'dropdown',
18+
mode: 'trigger',
19+
options: grainTriggerOptions,
20+
value: () => 'grain_recording_updated',
21+
required: true,
22+
},
1423
{
1524
id: 'apiKey',
1625
title: 'API Key',
@@ -25,42 +34,6 @@ export const grainRecordingUpdatedTrigger: TriggerConfig = {
2534
value: 'grain_recording_updated',
2635
},
2736
},
28-
{
29-
id: 'includeHighlights',
30-
title: 'Include Highlights',
31-
type: 'switch',
32-
description: 'Include highlights/clips in webhook payload.',
33-
defaultValue: false,
34-
mode: 'trigger',
35-
condition: {
36-
field: 'selectedTriggerId',
37-
value: 'grain_recording_updated',
38-
},
39-
},
40-
{
41-
id: 'includeParticipants',
42-
title: 'Include Participants',
43-
type: 'switch',
44-
description: 'Include participant list in webhook payload.',
45-
defaultValue: false,
46-
mode: 'trigger',
47-
condition: {
48-
field: 'selectedTriggerId',
49-
value: 'grain_recording_updated',
50-
},
51-
},
52-
{
53-
id: 'includeAiSummary',
54-
title: 'Include AI Summary',
55-
type: 'switch',
56-
description: 'Include AI-generated summary in webhook payload.',
57-
defaultValue: false,
58-
mode: 'trigger',
59-
condition: {
60-
field: 'selectedTriggerId',
61-
value: 'grain_recording_updated',
62-
},
63-
},
6437
{
6538
id: 'triggerInstructions',
6639
title: 'Setup Instructions',

apps/sim/triggers/grain/story_created.ts

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { GrainIcon } from '@/components/icons'
22
import type { TriggerConfig } from '@/triggers/types'
3-
import { buildStoryOutputs, grainSetupInstructions } from './utils'
3+
import { buildStoryOutputs, grainSetupInstructions, grainTriggerOptions } from './utils'
44

55
export const grainStoryCreatedTrigger: TriggerConfig = {
66
id: 'grain_story_created',
@@ -11,6 +11,15 @@ export const grainStoryCreatedTrigger: TriggerConfig = {
1111
icon: GrainIcon,
1212

1313
subBlocks: [
14+
{
15+
id: 'selectedTriggerId',
16+
title: 'Trigger Type',
17+
type: 'dropdown',
18+
mode: 'trigger',
19+
options: grainTriggerOptions,
20+
value: () => 'grain_story_created',
21+
required: true,
22+
},
1423
{
1524
id: 'apiKey',
1625
title: 'API Key',
@@ -25,42 +34,6 @@ export const grainStoryCreatedTrigger: TriggerConfig = {
2534
value: 'grain_story_created',
2635
},
2736
},
28-
{
29-
id: 'includeHighlights',
30-
title: 'Include Highlights',
31-
type: 'switch',
32-
description: 'Include highlights/clips in webhook payload.',
33-
defaultValue: false,
34-
mode: 'trigger',
35-
condition: {
36-
field: 'selectedTriggerId',
37-
value: 'grain_story_created',
38-
},
39-
},
40-
{
41-
id: 'includeParticipants',
42-
title: 'Include Participants',
43-
type: 'switch',
44-
description: 'Include participant list in webhook payload.',
45-
defaultValue: false,
46-
mode: 'trigger',
47-
condition: {
48-
field: 'selectedTriggerId',
49-
value: 'grain_story_created',
50-
},
51-
},
52-
{
53-
id: 'includeAiSummary',
54-
title: 'Include AI Summary',
55-
type: 'switch',
56-
description: 'Include AI-generated summary in webhook payload.',
57-
defaultValue: false,
58-
mode: 'trigger',
59-
condition: {
60-
field: 'selectedTriggerId',
61-
value: 'grain_story_created',
62-
},
63-
},
6437
{
6538
id: 'triggerInstructions',
6639
title: 'Setup Instructions',

0 commit comments

Comments
 (0)