reblock
Version:
Build interactive Slack surfaces with React
69 lines (68 loc) • 2.3 kB
TypeScript
import { Root } from '../renderer'
import type React from 'react'
import type Slack from '@slack/bolt'
import type { DistributiveOmit } from '../helpers'
export declare class ModalRoot extends Root {
client: Slack.webApi.WebClient
args: DistributiveOmit<Slack.webApi.ViewsOpenArguments, 'view'>
modalArgs: DistributiveOmit<
Slack.types.ModalView,
'type' | 'blocks' | 'notify_on_close' | 'callback_id'
>
private onSubmit?
private onClose?
private resolve?
private reject?
viewID?: Promise<string>
existingViewID?: string
get isOpen(): boolean
constructor(
client: Slack.webApi.WebClient,
args: DistributiveOmit<Slack.webApi.ViewsOpenArguments, 'view'>,
modalArgs: DistributiveOmit<
Slack.types.ModalView,
'type' | 'blocks' | 'notify_on_close' | 'callback_id'
>,
onSubmit?: ((event: Slack.ViewSubmitAction) => void) | undefined,
onClose?: ((event: Slack.ViewClosedAction) => void) | undefined,
resolve?: ((viewID: string) => void) | undefined,
reject?: ((error: unknown) => void) | undefined
)
publish(): Promise<void>
submit(event: Slack.ViewSubmitAction): Promise<void>
close(event: Slack.ViewClosedAction): Promise<void>
handle: ModalHandle
}
export declare class ModalHandle {
private root
constructor(root: ModalRoot)
get viewID(): string | undefined
get isOpen(): boolean
get rendering(): boolean
stop(behavior?: 'keep' | 'clear' | React.ReactNode): Promise<void>
}
export declare function modal(
app: Slack.App,
argsOrId: string | DistributiveOmit<Slack.webApi.ViewsOpenArguments, 'view'>,
titleOrModalArgs:
| string
| DistributiveOmit<
Slack.types.ModalView,
'type' | 'blocks' | 'notify_on_close' | 'callback_id'
>,
element: React.ReactNode,
onEvent?: (event: Slack.SlackViewAction) => void
): Promise<ModalHandle>
export declare function modal(
app: Slack.App,
argsOrId: string | DistributiveOmit<Slack.webApi.ViewsOpenArguments, 'view'>,
titleOrModalArgs:
| string
| DistributiveOmit<
Slack.types.ModalView,
'type' | 'blocks' | 'notify_on_close' | 'callback_id'
>,
element: React.ReactNode,
onSubmit: (event: Slack.ViewSubmitAction) => void,
onClose: (event: Slack.ViewClosedAction) => void
): Promise<ModalHandle>