Skip to content

Commit 0448480

Browse files
feat(slack): GA slack_v2 — drop preview, hide legacy block, remove entitlement evaluator
1 parent b6aab2c commit 0448480

3 files changed

Lines changed: 14 additions & 34 deletions

File tree

apps/sim/blocks/blocks/slack.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ export const SlackBlock: BlockConfig<SlackResponse> = {
2121
bgColor: '#611f69',
2222
icon: SlackIcon,
2323
triggerAllowed: true,
24-
// Superseded by slack_v2, but stays discoverable until v2 GAs — hiding both
25-
// would leave no Slack block in the toolbar while v2 is preview-gated. At v2
26-
// GA this becomes `hideFromToolbar: true` (superseded-version paradigm).
24+
// Superseded by slack_v2 (GA): hidden from discovery like other legacy _vN
25+
// blocks; existing workflows keep executing it.
26+
hideFromToolbar: true,
2727
subBlocks: [
2828
{
2929
id: 'operation',
@@ -2465,9 +2465,10 @@ Return ONLY the integer Unix timestamp - no explanations, no quotes, no extra te
24652465
team_id: { type: 'string', description: 'Slack workspace/team ID' },
24662466
event_id: { type: 'string', description: 'Unique event identifier for the trigger' },
24672467
},
2468-
// Trigger capabilities moved to slack_v2 so the trigger surfaces once.
2469-
// Legacy webhook trigger stays available while slack_v2 (which hosts the
2470-
// redesigned slack_oauth trigger) is preview-gated; drops at v2 GA.
2468+
// The legacy webhook trigger must STAY enabled: webhook-execution gates on
2469+
// blockConfig.triggers.enabled at runtime, so disabling it would break every
2470+
// deployed v1 Slack trigger workflow. New discovery surfaces only slack_v2
2471+
// (this block is hideFromToolbar).
24712472
triggers: {
24722473
enabled: true,
24732474
available: ['slack_webhook'],
@@ -2627,6 +2628,11 @@ export const SlackBlockMeta = {
26272628
],
26282629
} as const satisfies BlockMeta
26292630

2631+
export const SlackV2BlockMeta = {
2632+
tags: ['messaging', 'webhooks', 'automation'],
2633+
url: 'https://slack.com',
2634+
} as const satisfies BlockMeta
2635+
26302636
const SLACK_WEBHOOK_TRIGGER_SUBBLOCK_IDS = new Set(
26312637
getTrigger('slack_webhook').subBlocks.map((sb) => sb.id)
26322638
)
@@ -2677,11 +2683,6 @@ export const SlackV2Block: BlockConfig<SlackResponse> = {
26772683
...SlackBlock,
26782684
type: 'slack_v2',
26792685
hideFromToolbar: false,
2680-
// Preview-gated: hidden from every discovery surface until revealed via the
2681-
// block-visibility AppConfig (hosted) or PREVIEW_BLOCKS=slack_v2 (dev /
2682-
// self-host). At GA: drop this flag, add SlackV2BlockMeta + docs, and set
2683-
// hideFromToolbar on v1.
2684-
preview: true,
26852686
subBlocks: [
26862687
...SlackBlock.subBlocks.flatMap((sb) => {
26872688
// Drop the legacy paste-secret trigger config (v1 hosts slack_webhook)

apps/sim/blocks/registry-maps.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ import { ShopifyBlock, ShopifyBlockMeta } from '@/blocks/blocks/shopify'
278278
import { SimWorkspaceEventBlock } from '@/blocks/blocks/sim_workspace_event'
279279
import { SimilarwebBlock, SimilarwebBlockMeta } from '@/blocks/blocks/similarweb'
280280
import { SixtyfourBlock, SixtyfourBlockMeta } from '@/blocks/blocks/sixtyfour'
281-
import { SlackBlock, SlackBlockMeta, SlackV2Block } from '@/blocks/blocks/slack'
281+
import { SlackBlock, SlackBlockMeta, SlackV2Block, SlackV2BlockMeta } from '@/blocks/blocks/slack'
282282
import { SmtpBlock, SmtpBlockMeta } from '@/blocks/blocks/smtp'
283283
import { SportmonksBlock, SportmonksBlockMeta } from '@/blocks/blocks/sportmonks'
284284
import { SpotifyBlock, SpotifyBlockMeta } from '@/blocks/blocks/spotify'
@@ -878,6 +878,7 @@ export const BLOCK_META_REGISTRY: Record<string, BlockMeta> = {
878878
similarweb: SimilarwebBlockMeta,
879879
sixtyfour: SixtyfourBlockMeta,
880880
slack: SlackBlockMeta,
881+
slack_v2: SlackV2BlockMeta,
881882
smtp: SmtpBlockMeta,
882883
sportmonks: SportmonksBlockMeta,
883884
spotify: SpotifyBlockMeta,

apps/sim/lib/copilot/entitlements.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { createLogger } from '@sim/logger'
22
import { getErrorMessage } from '@sim/utils/errors'
33
import { LRUCache } from 'lru-cache'
4-
import { getBlockVisibilityForCopilot } from '@/lib/copilot/block-visibility'
54
import { isCustomBlocksEligible } from '@/lib/workflows/custom-blocks/operations'
6-
import { SlackV2Block } from '@/blocks/blocks/slack'
7-
import { isHiddenUnder } from '@/blocks/visibility/context'
85

96
const logger = createLogger('CopilotEntitlements')
107

@@ -13,24 +10,6 @@ const logger = createLogger('CopilotEntitlements')
1310
* its `core.Entitlement*` constants to gate agent surfaces.
1411
*/
1512
export const CUSTOM_BLOCKS_ENTITLEMENT = 'custom-blocks'
16-
export const SLACK_V2_ENTITLEMENT = 'slack-v2'
17-
18-
/**
19-
* The slack_v2 surface (the preview block's tips, the workspace prompt's Slack
20-
* tip listing, and the slack_custom_bot credential tag) follows the viewer's
21-
* block-visibility projection — the same predicate that hides the slack_v2
22-
* schema in the copilot VFS — so tip and schema visibility cannot diverge.
23-
* Argument-order flip is deliberate: evaluators are (workspaceId, userId?),
24-
* getBlockVisibilityForCopilot is (userId, workspaceId). No userId → fail
25-
* closed (visibility is per-viewer; an anonymous evaluation must not reveal a
26-
* preview block). Once slack_v2 GAs (preview flag dropped), this evaluator
27-
* returns true everywhere without changes.
28-
*/
29-
async function isSlackV2Visible(workspaceId: string, userId?: string): Promise<boolean> {
30-
if (!userId) return false
31-
const vis = await getBlockVisibilityForCopilot(userId, workspaceId)
32-
return !isHiddenUnder(vis, SlackV2Block)
33-
}
3413

3514
/**
3615
* Workspace entitlements — plan/flag-gated org capabilities sent to the
@@ -54,7 +33,6 @@ const ENTITLEMENT_EVALUATORS: Record<
5433
(workspaceId: string, userId?: string) => Promise<boolean>
5534
> = {
5635
[CUSTOM_BLOCKS_ENTITLEMENT]: isCustomBlocksEligible,
57-
[SLACK_V2_ENTITLEMENT]: isSlackV2Visible,
5836
}
5937

6038
const entitlementsCache = new LRUCache<string, Promise<string[]>>({

0 commit comments

Comments
 (0)