From 71ec0ae7ec05de61339b11596dd6abd9b81c87cf Mon Sep 17 00:00:00 2001 From: Kazuhiro Sera Date: Tue, 3 Oct 2023 14:18:32 +0900 Subject: [PATCH] Add rich_text_input block payload support --- package.json | 2 +- src/types/actions/block-action.ts | 14 +++++++++++--- src/types/view/index.ts | 3 ++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 5575e468f..8145f09ea 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@slack/logger": "^4.0.0", "@slack/oauth": "^2.6.1", "@slack/socket-mode": "^1.3.2", - "@slack/types": "^2.8.0", + "@slack/types": "^2.9.0", "@slack/web-api": "^6.7.1", "@types/express": "^4.16.1", "@types/promise.allsettled": "^1.0.3", diff --git a/src/types/actions/block-action.ts b/src/types/actions/block-action.ts index 98d73e318..402a813d6 100644 --- a/src/types/actions/block-action.ts +++ b/src/types/actions/block-action.ts @@ -1,4 +1,4 @@ -import { PlainTextElement, Confirmation, Option } from '@slack/types'; +import { PlainTextElement, Confirmation, Option, RichTextBlock } from '@slack/types'; import { StringIndexed } from '../helpers'; import { ViewOutput, ViewStateValue } from '../view'; @@ -24,7 +24,8 @@ export type BlockElementAction = | TimepickerAction | RadioButtonsAction | CheckboxesAction - | PlainTextInputAction; + | PlainTextInputAction + | RichTextInputAction; /** * Any action from Slack's interactive elements @@ -207,12 +208,19 @@ export interface CheckboxesAction extends BasicElementAction<'checkboxes'> { } /** - * An action from a plain_text_input element (must use dispatch_action: true) + * An action from a plain_text_input element (must use dispatch_action: true) */ export interface PlainTextInputAction extends BasicElementAction<'plain_text_input'> { value: string; } +/** + * An action from a rich_text_input element (must use dispatch_action: true) + */ +export interface RichTextInputAction extends BasicElementAction<'rich_text_input'> { + rich_text_value: RichTextBlock; +} + /** * A Slack Block Kit element action wrapped in the standard metadata. * diff --git a/src/types/view/index.ts b/src/types/view/index.ts index c0046d2a1..b31bd7352 100644 --- a/src/types/view/index.ts +++ b/src/types/view/index.ts @@ -1,4 +1,4 @@ -import { Block, KnownBlock, PlainTextElement, View } from '@slack/types'; +import { Block, KnownBlock, PlainTextElement, RichTextBlock, View } from '@slack/types'; import { AckFn, RespondFn } from '../utilities'; /** @@ -143,6 +143,7 @@ export interface ViewStateValue { selected_channels?: string[]; selected_users?: string[]; selected_options?: ViewStateSelectedOption[]; + rich_text_value?: RichTextBlock; } export interface ViewOutput {