From 65c1b8a9dca13b403d1532c5f85db0a86efeb4ee Mon Sep 17 00:00:00 2001 From: allx Date: Sat, 6 Dec 2025 00:15:09 +0200 Subject: [PATCH 1/5] Add rich text, markdown, table, and new elements support Introduces support for Slack's rich text blocks and elements, including new Bits (RichTextSection, RichTextList, RichTextQuote, RichTextPreformatted, RichTextText, RichTextEmoji, RichTextLink, RichTextUser, RichTextChannel, RichTextUsergroup, RichTextBroadcast, RichTextDate, RichTextColor, RichTextTeam), Blocks (RichText, Markdown, Table, ContextActions), and Elements (WorkflowButton, IconButton, FeedbackButtons, RichTextInput). Updates documentation, constants, and tests to cover all new features and objects. --- README.md | 22 + docs/_sidebar.md | 22 + docs/bits/rich-text-broadcast.md | 46 + docs/bits/rich-text-channel.md | 44 + docs/bits/rich-text-color.md | 73 ++ docs/bits/rich-text-date.md | 62 + docs/bits/rich-text-emoji.md | 42 + docs/bits/rich-text-link.md | 48 + docs/bits/rich-text-list.md | 55 + docs/bits/rich-text-preformatted.md | 50 + docs/bits/rich-text-quote.md | 50 + docs/bits/rich-text-section.md | 49 + docs/bits/rich-text-team.md | 73 ++ docs/bits/rich-text-text.md | 65 + docs/bits/rich-text-user.md | 44 + docs/bits/rich-text-usergroup.md | 44 + docs/blocks/context-actions.md | 55 + docs/blocks/markdown.md | 57 + docs/blocks/rich-text.md | 79 ++ docs/blocks/table.md | 61 + docs/elements/feedback-buttons.md | 61 + docs/elements/icon-button.md | 93 ++ docs/elements/rich-text-input.md | 75 ++ docs/elements/workflow-button.md | 81 ++ docs/support.md | 23 + src/bits/index.ts | 205 +++- src/bits/rich-text-broadcast.ts | 62 + src/bits/rich-text-channel.ts | 62 + src/bits/rich-text-color.ts | 83 ++ src/bits/rich-text-date.ts | 68 ++ src/bits/rich-text-emoji.ts | 36 + src/bits/rich-text-link.ts | 78 ++ src/bits/rich-text-list.ts | 43 + src/bits/rich-text-preformatted.ts | 39 + src/bits/rich-text-quote.ts | 39 + src/bits/rich-text-section.ts | 36 + src/bits/rich-text-team.ts | 84 ++ src/bits/rich-text-text.ts | 74 ++ src/bits/rich-text-user.ts | 62 + src/bits/rich-text-usergroup.ts | 62 + src/blocks/context-actions.ts | 47 + src/blocks/index.ts | 62 + src/blocks/markdown.ts | 42 + src/blocks/rich-text.ts | 43 + src/blocks/table.ts | 63 + src/elements/feedback-buttons.ts | 72 ++ src/elements/icon-button.ts | 87 ++ src/elements/index.ts | 64 + src/elements/rich-text-input.ts | 73 ++ src/elements/workflow-button.ts | 84 ++ src/internal/constants/block-types.ts | 4 + src/internal/constants/element-types.ts | 4 + src/internal/constants/index.ts | 1 + .../constants/rich-text-element-types.ts | 18 + tests/bits/mocks/index.ts | 12 + tests/bits/mocks/rich-text-broadcast.mock.ts | 7 + tests/bits/mocks/rich-text-channel.mock.ts | 7 + tests/bits/mocks/rich-text-color.mock.ts | 7 + tests/bits/mocks/rich-text-date.mock.ts | 8 + tests/bits/mocks/rich-text-emoji.mock.ts | 7 + tests/bits/mocks/rich-text-link.mock.ts | 8 + tests/bits/mocks/rich-text-list.mock.ts | 9 + .../bits/mocks/rich-text-preformatted.mock.ts | 7 + tests/bits/mocks/rich-text-quote.mock.ts | 7 + tests/bits/mocks/rich-text-section.mock.ts | 5 + tests/bits/mocks/rich-text-team.mock.ts | 7 + tests/bits/mocks/rich-text-text.mock.ts | 7 + tests/bits/mocks/rich-text-user.mock.ts | 7 + tests/bits/mocks/rich-text-usergroup.mock.ts | 7 + tests/bits/rich-text-broadcast.spec.ts | 19 + tests/bits/rich-text-channel.spec.ts | 19 + tests/bits/rich-text-color.spec.ts | 19 + tests/bits/rich-text-date.spec.ts | 19 + tests/bits/rich-text-emoji.spec.ts | 11 + tests/bits/rich-text-link.spec.ts | 26 + tests/bits/rich-text-list.spec.ts | 11 + tests/bits/rich-text-preformatted.spec.ts | 11 + tests/bits/rich-text-quote.spec.ts | 11 + tests/bits/rich-text-section.spec.ts | 20 + tests/bits/rich-text-team.spec.ts | 19 + tests/bits/rich-text-text.spec.ts | 44 + tests/bits/rich-text-user.spec.ts | 19 + tests/bits/rich-text-usergroup.spec.ts | 19 + tests/blocks/context-actions.spec.ts | 22 + tests/blocks/markdown.spec.ts | 22 + tests/blocks/mocks/context-actions.mock.ts | 7 + tests/blocks/mocks/markdown.mock.ts | 8 + tests/blocks/mocks/table.mock.ts | 7 + tests/blocks/table.spec.ts | 22 + tests/elements/feedback-buttons.spec.ts | 22 + tests/elements/icon-button.spec.ts | 25 + tests/elements/mocks/feedback-buttons.mock.ts | 7 + tests/elements/mocks/icon-button.mock.ts | 11 + tests/elements/mocks/rich-text-input.mock.ts | 8 + tests/elements/mocks/workflow-button.mock.ts | 8 + tests/elements/rich-text-input.spec.ts | 24 + tests/elements/workflow-button.spec.ts | 23 + tmp-docs/block-elements.ts | 1047 +++++++++++++++++ tmp-docs/blocks.ts | 455 +++++++ tmp-docs/composition-objects.ts | 259 ++++ tmp-docs/extensions.ts | 98 ++ 101 files changed, 5524 insertions(+), 1 deletion(-) create mode 100644 docs/bits/rich-text-broadcast.md create mode 100644 docs/bits/rich-text-channel.md create mode 100644 docs/bits/rich-text-color.md create mode 100644 docs/bits/rich-text-date.md create mode 100644 docs/bits/rich-text-emoji.md create mode 100644 docs/bits/rich-text-link.md create mode 100644 docs/bits/rich-text-list.md create mode 100644 docs/bits/rich-text-preformatted.md create mode 100644 docs/bits/rich-text-quote.md create mode 100644 docs/bits/rich-text-section.md create mode 100644 docs/bits/rich-text-team.md create mode 100644 docs/bits/rich-text-text.md create mode 100644 docs/bits/rich-text-user.md create mode 100644 docs/bits/rich-text-usergroup.md create mode 100644 docs/blocks/context-actions.md create mode 100644 docs/blocks/markdown.md create mode 100644 docs/blocks/rich-text.md create mode 100644 docs/blocks/table.md create mode 100644 docs/elements/feedback-buttons.md create mode 100644 docs/elements/icon-button.md create mode 100644 docs/elements/rich-text-input.md create mode 100644 docs/elements/workflow-button.md create mode 100644 src/bits/rich-text-broadcast.ts create mode 100644 src/bits/rich-text-channel.ts create mode 100644 src/bits/rich-text-color.ts create mode 100644 src/bits/rich-text-date.ts create mode 100644 src/bits/rich-text-emoji.ts create mode 100644 src/bits/rich-text-link.ts create mode 100644 src/bits/rich-text-list.ts create mode 100644 src/bits/rich-text-preformatted.ts create mode 100644 src/bits/rich-text-quote.ts create mode 100644 src/bits/rich-text-section.ts create mode 100644 src/bits/rich-text-team.ts create mode 100644 src/bits/rich-text-text.ts create mode 100644 src/bits/rich-text-user.ts create mode 100644 src/bits/rich-text-usergroup.ts create mode 100644 src/blocks/context-actions.ts create mode 100644 src/blocks/markdown.ts create mode 100644 src/blocks/rich-text.ts create mode 100644 src/blocks/table.ts create mode 100644 src/elements/feedback-buttons.ts create mode 100644 src/elements/icon-button.ts create mode 100644 src/elements/rich-text-input.ts create mode 100644 src/elements/workflow-button.ts create mode 100644 src/internal/constants/rich-text-element-types.ts create mode 100644 tests/bits/mocks/rich-text-broadcast.mock.ts create mode 100644 tests/bits/mocks/rich-text-channel.mock.ts create mode 100644 tests/bits/mocks/rich-text-color.mock.ts create mode 100644 tests/bits/mocks/rich-text-date.mock.ts create mode 100644 tests/bits/mocks/rich-text-emoji.mock.ts create mode 100644 tests/bits/mocks/rich-text-link.mock.ts create mode 100644 tests/bits/mocks/rich-text-list.mock.ts create mode 100644 tests/bits/mocks/rich-text-preformatted.mock.ts create mode 100644 tests/bits/mocks/rich-text-quote.mock.ts create mode 100644 tests/bits/mocks/rich-text-section.mock.ts create mode 100644 tests/bits/mocks/rich-text-team.mock.ts create mode 100644 tests/bits/mocks/rich-text-text.mock.ts create mode 100644 tests/bits/mocks/rich-text-user.mock.ts create mode 100644 tests/bits/mocks/rich-text-usergroup.mock.ts create mode 100644 tests/bits/rich-text-broadcast.spec.ts create mode 100644 tests/bits/rich-text-channel.spec.ts create mode 100644 tests/bits/rich-text-color.spec.ts create mode 100644 tests/bits/rich-text-date.spec.ts create mode 100644 tests/bits/rich-text-emoji.spec.ts create mode 100644 tests/bits/rich-text-link.spec.ts create mode 100644 tests/bits/rich-text-list.spec.ts create mode 100644 tests/bits/rich-text-preformatted.spec.ts create mode 100644 tests/bits/rich-text-quote.spec.ts create mode 100644 tests/bits/rich-text-section.spec.ts create mode 100644 tests/bits/rich-text-team.spec.ts create mode 100644 tests/bits/rich-text-text.spec.ts create mode 100644 tests/bits/rich-text-user.spec.ts create mode 100644 tests/bits/rich-text-usergroup.spec.ts create mode 100644 tests/blocks/context-actions.spec.ts create mode 100644 tests/blocks/markdown.spec.ts create mode 100644 tests/blocks/mocks/context-actions.mock.ts create mode 100644 tests/blocks/mocks/markdown.mock.ts create mode 100644 tests/blocks/mocks/table.mock.ts create mode 100644 tests/blocks/table.spec.ts create mode 100644 tests/elements/feedback-buttons.spec.ts create mode 100644 tests/elements/icon-button.spec.ts create mode 100644 tests/elements/mocks/feedback-buttons.mock.ts create mode 100644 tests/elements/mocks/icon-button.mock.ts create mode 100644 tests/elements/mocks/rich-text-input.mock.ts create mode 100644 tests/elements/mocks/workflow-button.mock.ts create mode 100644 tests/elements/rich-text-input.spec.ts create mode 100644 tests/elements/workflow-button.spec.ts create mode 100644 tmp-docs/block-elements.ts create mode 100644 tmp-docs/blocks.ts create mode 100644 tmp-docs/composition-objects.ts create mode 100644 tmp-docs/extensions.ts diff --git a/README.md b/README.md index 6147507c..e676033a 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,10 @@ Below is a list of supported objects and how to access them in **Block Builder** | Input | Block | :white_check_mark: | `Blocks.Input()` | Section | Block | :white_check_mark: | `Blocks.Section()` | Video | Block | :white_check_mark: | `Blocks.Video()` +| Rich Text | Block | :white_check_mark: | `Blocks.RichText()` +| Markdown | Block | :white_check_mark: | `Blocks.Markdown()` +| Table | Block | :white_check_mark: | `Blocks.Table()` +| Context Actions | Block | :white_check_mark: | `Blocks.ContextActions()` | Button | Element | :white_check_mark:️ | `Elements.Button()` | Checkboxes | Element | :white_check_mark: | `Elements.Checkboxes()` | Date Picker | Element | :white_check_mark: | `Elements.DatePicker()` @@ -158,9 +162,27 @@ Below is a list of supported objects and how to access them in **Block Builder** | Select Menus | Element | :white_check_mark: | `Elements.[Type]Select()` | Multi-Select Menus | Element | :white_check_mark: | `Elements.[Type]MultiSelect()` | URL Input | Element | :white_check_mark: | `Elements.NumberInput()` +| Workflow Button | Element | :white_check_mark: | `Elements.WorkflowButton()` +| Icon Button | Element | :white_check_mark: | `Elements.IconButton()` +| Feedback Buttons | Element | :white_check_mark: | `Elements.FeedbackButtons()` +| Rich Text Input | Element | :white_check_mark: | `Elements.RichTextInput()` | Option | Composition Object | :white_check_mark: | `Bits.Option()` | Confirm Dialog | Composition Object | :white_check_mark: | `Bits.ConfirmationDialog()` | Option Group | Composition Object | :white_check_mark: | `Bits.OptionGroup()` +| Rich Text Section | Composition Object | :white_check_mark: | `Bits.RichTextSection()` +| Rich Text List | Composition Object | :white_check_mark: | `Bits.RichTextList()` +| Rich Text Quote | Composition Object | :white_check_mark: | `Bits.RichTextQuote()` +| Rich Text Preformatted | Composition Object | :white_check_mark: | `Bits.RichTextPreformatted()` +| Rich Text Text | Composition Object | :white_check_mark: | `Bits.RichTextText()` +| Rich Text Emoji | Composition Object | :white_check_mark: | `Bits.RichTextEmoji()` +| Rich Text Link | Composition Object | :white_check_mark: | `Bits.RichTextLink()` +| Rich Text User | Composition Object | :white_check_mark: | `Bits.RichTextUser()` +| Rich Text Channel | Composition Object | :white_check_mark: | `Bits.RichTextChannel()` +| Rich Text Usergroup | Composition Object | :white_check_mark: | `Bits.RichTextUsergroup()` +| Rich Text Broadcast | Composition Object | :white_check_mark: | `Bits.RichTextBroadcast()` +| Rich Text Date | Composition Object | :white_check_mark: | `Bits.RichTextDate()` +| Rich Text Color | Composition Object | :white_check_mark: | `Bits.RichTextColor()` +| Rich Text Team | Composition Object | :white_check_mark: | `Bits.RichTextTeam()` | Attachment | Legacy Feature | :white_check_mark: | `Bits.Attachment()` ### Creating a Simple Interactive Message diff --git a/docs/_sidebar.md b/docs/_sidebar.md index d0f07a1b..de2d85dd 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -33,6 +33,10 @@ * [Input](blocks/input.md "Block Builder – Input – Maintainable JavaScript Code for Slack Block Kit") * [Section](blocks/section.md "Block Builder – Section – Maintainable JavaScript Code for Slack Block Kit") * [Video](blocks/video.md "Block Builder – Video – Maintainable JavaScript Code for Slack Block Kit") + * [Rich Text](blocks/rich-text.md "Block Builder – Rich Text – Maintainable JavaScript Code for Slack Block Kit") + * [Markdown](blocks/markdown.md "Block Builder – Markdown – Maintainable JavaScript Code for Slack Block Kit") + * [Table](blocks/table.md "Block Builder – Table – Maintainable JavaScript Code for Slack Block Kit") + * [Context Actions](blocks/context-actions.md "Block Builder – Context Actions – Maintainable JavaScript Code for Slack Block Kit") * **Element References** @@ -60,6 +64,10 @@ * [URL Input](elements/url-input.md "Block Builder – URL Input – Maintainable JavaScript Code for Slack Block Kit") * [User Multi-Select](elements/user-multi-select.md "Block Builder – User Multi-Select – Maintainable JavaScript Code for Slack Block Kit") * [User Select](elements/user-select.md "Block Builder – User Select – Maintainable JavaScript Code for Slack Block Kit") + * [Workflow Button](elements/workflow-button.md "Block Builder – Workflow Button – Maintainable JavaScript Code for Slack Block Kit") + * [Icon Button](elements/icon-button.md "Block Builder – Icon Button – Maintainable JavaScript Code for Slack Block Kit") + * [Feedback Buttons](elements/feedback-buttons.md "Block Builder – Feedback Buttons – Maintainable JavaScript Code for Slack Block Kit") + * [Rich Text Input](elements/rich-text-input.md "Block Builder – Rich Text Input – Maintainable JavaScript Code for Slack Block Kit") * **Bit References** * [Introduction](bits/introduction.md "Block Builder – Bits – Introduction – Maintainable JavaScript Code for Slack Block Kit") @@ -67,6 +75,20 @@ * [Confirmation Dialog](bits/confirmation-dialog.md "Block Builder – Confirmation Dialog – Maintainable JavaScript Code for Slack Block Kit") * [Option](bits/option.md "Block Builder – Option – Maintainable JavaScript Code for Slack Block Kit") * [Option Group](bits/option-group.md "Block Builder – Option Group – Maintainable JavaScript Code for Slack Block Kit") + * [Rich Text Section](bits/rich-text-section.md "Block Builder – Rich Text Section – Maintainable JavaScript Code for Slack Block Kit") + * [Rich Text List](bits/rich-text-list.md "Block Builder – Rich Text List – Maintainable JavaScript Code for Slack Block Kit") + * [Rich Text Quote](bits/rich-text-quote.md "Block Builder – Rich Text Quote – Maintainable JavaScript Code for Slack Block Kit") + * [Rich Text Preformatted](bits/rich-text-preformatted.md "Block Builder – Rich Text Preformatted – Maintainable JavaScript Code for Slack Block Kit") + * [Rich Text Text](bits/rich-text-text.md "Block Builder – Rich Text Text – Maintainable JavaScript Code for Slack Block Kit") + * [Rich Text Emoji](bits/rich-text-emoji.md "Block Builder – Rich Text Emoji – Maintainable JavaScript Code for Slack Block Kit") + * [Rich Text Link](bits/rich-text-link.md "Block Builder – Rich Text Link – Maintainable JavaScript Code for Slack Block Kit") + * [Rich Text User](bits/rich-text-user.md "Block Builder – Rich Text User – Maintainable JavaScript Code for Slack Block Kit") + * [Rich Text Channel](bits/rich-text-channel.md "Block Builder – Rich Text Channel – Maintainable JavaScript Code for Slack Block Kit") + * [Rich Text Usergroup](bits/rich-text-usergroup.md "Block Builder – Rich Text Usergroup – Maintainable JavaScript Code for Slack Block Kit") + * [Rich Text Broadcast](bits/rich-text-broadcast.md "Block Builder – Rich Text Broadcast – Maintainable JavaScript Code for Slack Block Kit") + * [Rich Text Date](bits/rich-text-date.md "Block Builder – Rich Text Date – Maintainable JavaScript Code for Slack Block Kit") + * [Rich Text Color](bits/rich-text-color.md "Block Builder – Rich Text Color – Maintainable JavaScript Code for Slack Block Kit") + * [Rich Text Team](bits/rich-text-team.md "Block Builder – Rich Text Team – Maintainable JavaScript Code for Slack Block Kit") * **Component References** * [Paginator](components/paginator.md "Block Builder – Paginator – Maintainable JavaScript Code for Slack Block Kit") diff --git a/docs/bits/rich-text-broadcast.md b/docs/bits/rich-text-broadcast.md new file mode 100644 index 00000000..8209b30a --- /dev/null +++ b/docs/bits/rich-text-broadcast.md @@ -0,0 +1,46 @@ +# Rich Text Broadcast + +?> **Note:** This document is a reference to the `RichTextBroadcastBuilder` object in **Block Builder**. For creating @here, @channel, or @everyone mentions in rich text. + +### Creating an Instance + +```javascript +import { RichTextBroadcast } from 'slack-block-builder'; + +const myObj = RichTextBroadcast(params?); +``` + +```javascript +import { Bits } from 'slack-block-builder'; + +const myObj = Bits.RichTextBroadcast(params?); +``` + +### Params + +`range` – *String* – The broadcast range: `'here'`, `'channel'`, or `'everyone'` + +### Styling Methods + +```javascript +RichTextBroadcastBuilder.bold(); +RichTextBroadcastBuilder.italic(); +RichTextBroadcastBuilder.strike(); +RichTextBroadcastBuilder.code(); +``` + +### Example + +```javascript +import { RichTextBroadcast } from 'slack-block-builder'; + +RichTextBroadcast({ range: 'here' }); +RichTextBroadcast({ range: 'channel' }); +RichTextBroadcast({ range: 'everyone' }); +``` + +### Other Methods + +```javascript +RichTextBroadcastBuilder.end(); +``` diff --git a/docs/bits/rich-text-channel.md b/docs/bits/rich-text-channel.md new file mode 100644 index 00000000..fa65ec53 --- /dev/null +++ b/docs/bits/rich-text-channel.md @@ -0,0 +1,44 @@ +# Rich Text Channel + +?> **Note:** This document is a reference to the `RichTextChannelBuilder` object in **Block Builder**. For creating #channel mentions in rich text. + +### Creating an Instance + +```javascript +import { RichTextChannel } from 'slack-block-builder'; + +const myObj = RichTextChannel(params?); +``` + +```javascript +import { Bits } from 'slack-block-builder'; + +const myObj = Bits.RichTextChannel(params?); +``` + +### Params + +`channelId` – *String* – The channel ID to mention (e.g., `'C1234ABCD'`) + +### Styling Methods + +```javascript +RichTextChannelBuilder.bold(); +RichTextChannelBuilder.italic(); +RichTextChannelBuilder.strike(); +RichTextChannelBuilder.code(); +``` + +### Example + +```javascript +import { RichTextChannel } from 'slack-block-builder'; + +RichTextChannel({ channelId: 'C1234ABCD' }); +``` + +### Other Methods + +```javascript +RichTextChannelBuilder.end(); +``` diff --git a/docs/bits/rich-text-color.md b/docs/bits/rich-text-color.md new file mode 100644 index 00000000..3383bc07 --- /dev/null +++ b/docs/bits/rich-text-color.md @@ -0,0 +1,73 @@ +# Rich Text Color + +?> **Note:** This document is a reference to the `RichTextColorBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Rich Text element docs](https://api.slack.com/reference/block-kit/blocks#element-types) on Slack's doc site. + +### Creating an Instance + +The function that creates a new instance of `RichTextColorBuilder` is available as both a top-level import and as a member of its 'category', `Bits`: + +```javascript +import { RichTextColor } from 'slack-block-builder'; + +const myObj = RichTextColor(params?); + +``` + +```javascript +import { Bits } from 'slack-block-builder'; + +const myObj = Bits.RichTextColor(params?); +``` + +### Params + +Each instance of the `RichTextColorBuilder` object has chainable setter methods for the object's properties. However, properties with primitive values can optionally be passed to the instantiating function, should you prefer: + +`value` – *String* + + +?> **Note:** For an explanation of any one of the parameters, see its corresponding setter method below. + +### Setter Methods + +All setter methods return `this`, the instance of `RichTextColorBuilder` on which it is called. + +```javascript +RichTextColorBuilder.value(string); +``` + +Sets the hex color value (e.g., '#FF5733'). + +```javascript +RichTextColorBuilder.bold(); +``` + +Makes the color text bold. + +```javascript +RichTextColorBuilder.italic(); +``` + +Makes the color text italic. + +```javascript +RichTextColorBuilder.strike(); +``` + +Adds strikethrough to the color text. + +```javascript +RichTextColorBuilder.code(); +``` + +Formats the color text as inline code. + +### Other Methods + +The `RichTextColorBuilder` object also has other methods available: + +```javascript +RichTextColorBuilder.end(); +``` + +Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object. diff --git a/docs/bits/rich-text-date.md b/docs/bits/rich-text-date.md new file mode 100644 index 00000000..365ae953 --- /dev/null +++ b/docs/bits/rich-text-date.md @@ -0,0 +1,62 @@ +# Rich Text Date + +?> **Note:** This document is a reference to the `RichTextDateBuilder` object in **Block Builder**. For creating formatted date/time elements in rich text. + +### Creating an Instance + +```javascript +import { RichTextDate } from 'slack-block-builder'; + +const myObj = RichTextDate(params?); +``` + +```javascript +import { Bits } from 'slack-block-builder'; + +const myObj = Bits.RichTextDate(params?); +``` + +### Params + +`timestamp` – *Number* – Unix timestamp in seconds + +`format` – *String* – Date format template (e.g., `'{date_long}'`, `'{time}'`) + +`url` – *String* – Optional URL to link the date + +`fallback` – *String* – Fallback text if date can't be displayed + +### Available Format Tokens + +- `{date_num}` – YYYY-MM-DD +- `{date_short}` – Aug 9, 2020 +- `{date_long}` – Monday, December 23rd, 2013 +- `{date}` – Same as date_long_full without year +- `{time}` – Time of day (12 or 24 hour) +- `{ago}` – e.g., "3 minutes ago" + +### Styling Methods + +```javascript +RichTextDateBuilder.bold(); +RichTextDateBuilder.italic(); +RichTextDateBuilder.strike(); +RichTextDateBuilder.code(); +``` + +### Example + +```javascript +import { RichTextDate } from 'slack-block-builder'; + +RichTextDate({ + timestamp: 1628633820, + format: '{date_long} at {time}' +}); +``` + +### Other Methods + +```javascript +RichTextDateBuilder.end(); +``` diff --git a/docs/bits/rich-text-emoji.md b/docs/bits/rich-text-emoji.md new file mode 100644 index 00000000..729dbbc0 --- /dev/null +++ b/docs/bits/rich-text-emoji.md @@ -0,0 +1,42 @@ +# Rich Text Emoji + +?> **Note:** This document is a reference to the `RichTextEmojiBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://api.slack.com/reference/block-kit/blocks#element-types) on Slack's doc site. + +### Creating an Instance + +```javascript +import { RichTextEmoji } from 'slack-block-builder'; + +const myObj = RichTextEmoji(params?); +``` + +```javascript +import { Bits } from 'slack-block-builder'; + +const myObj = Bits.RichTextEmoji(params?); +``` + +### Params + +`name` – *String* – The emoji name without colons (e.g., `'wave'`) + +`unicode` – *String* – Lowercase hexadecimal Unicode representation + +`url` – *String* – URL for custom emoji + +### Example + +```javascript +import { RichTextEmoji } from 'slack-block-builder'; + +RichTextEmoji({ name: 'wave' }); +RichTextEmoji({ name: 'thumbsup' }); +``` + +### Other Methods + +```javascript +RichTextEmojiBuilder.end(); +``` + +Performs no alterations to the object on which it is called. diff --git a/docs/bits/rich-text-link.md b/docs/bits/rich-text-link.md new file mode 100644 index 00000000..6b81b7be --- /dev/null +++ b/docs/bits/rich-text-link.md @@ -0,0 +1,48 @@ +# Rich Text Link + +?> **Note:** This document is a reference to the `RichTextLinkBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://api.slack.com/reference/block-kit/blocks#element-types) on Slack's doc site. + +### Creating an Instance + +```javascript +import { RichTextLink } from 'slack-block-builder'; + +const myObj = RichTextLink(params?); +``` + +```javascript +import { Bits } from 'slack-block-builder'; + +const myObj = Bits.RichTextLink(params?); +``` + +### Params + +`url` – *String* – The URL to link to + +`text` – *String* – The display text for the link + +`unsafe` – *Boolean* – Whether the link is unsafe + +### Styling Methods + +```javascript +RichTextLinkBuilder.bold(); +RichTextLinkBuilder.italic(); +RichTextLinkBuilder.strike(); +RichTextLinkBuilder.code(); +``` + +### Example + +```javascript +import { RichTextLink } from 'slack-block-builder'; + +RichTextLink({ url: 'https://example.com', text: 'Click here' }).bold(); +``` + +### Other Methods + +```javascript +RichTextLinkBuilder.end(); +``` diff --git a/docs/bits/rich-text-list.md b/docs/bits/rich-text-list.md new file mode 100644 index 00000000..87baf955 --- /dev/null +++ b/docs/bits/rich-text-list.md @@ -0,0 +1,55 @@ +# Rich Text List + +?> **Note:** This document is a reference to the `RichTextListBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://api.slack.com/reference/block-kit/blocks#rich_text_list) on Slack's doc site. + +### Creating an Instance + +```javascript +import { RichTextList } from 'slack-block-builder'; + +const myObj = RichTextList(params?); +``` + +```javascript +import { Bits } from 'slack-block-builder'; + +const myObj = Bits.RichTextList(params?); +``` + +### Params + +`style` – *String* – Either `'bullet'` or `'ordered'` + +`indent` – *Number* – Indentation level (0-8) + +`border` – *Number* – Whether to show a border (0 or 1) + +### Setter Methods + +All setter methods return `this`, the instance of `RichTextListBuilder` on which it is called. + +```javascript +RichTextListBuilder.elements(...elements); +``` + +Adds list items to the list. Each item should be a `RichTextSection` builder. + +### Example + +```javascript +import { RichTextList, RichTextSection, RichTextText } from 'slack-block-builder'; + +RichTextList({ style: 'bullet' }) + .elements( + RichTextSection().elements(RichTextText({ text: 'First item' })), + RichTextSection().elements(RichTextText({ text: 'Second item' })) + ); +``` + +### Other Methods + +```javascript +RichTextListBuilder.end(); +``` + +Performs no alterations to the object on which it is called. diff --git a/docs/bits/rich-text-preformatted.md b/docs/bits/rich-text-preformatted.md new file mode 100644 index 00000000..d30f6340 --- /dev/null +++ b/docs/bits/rich-text-preformatted.md @@ -0,0 +1,50 @@ +# Rich Text Preformatted + +?> **Note:** This document is a reference to the `RichTextPreformattedBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://api.slack.com/reference/block-kit/blocks#rich_text_preformatted) on Slack's doc site. + +### Creating an Instance + +```javascript +import { RichTextPreformatted } from 'slack-block-builder'; + +const myObj = RichTextPreformatted(params?); +``` + +```javascript +import { Bits } from 'slack-block-builder'; + +const myObj = Bits.RichTextPreformatted(params?); +``` + +### Params + +`border` – *Number* – Whether to show a border (0 or 1) + +### Setter Methods + +All setter methods return `this`, the instance of `RichTextPreformattedBuilder` on which it is called. + +```javascript +RichTextPreformattedBuilder.elements(...elements); +``` + +Adds text or link elements to the code block. Accepts `RichTextText` and `RichTextLink` builders only. + +### Example + +```javascript +import { RichTextPreformatted, RichTextText } from 'slack-block-builder'; + +RichTextPreformatted() + .elements( + RichTextText({ text: 'const greeting = "Hello, World!";' }) + ); +``` + +### Other Methods + +```javascript +RichTextPreformattedBuilder.end(); +``` + +Performs no alterations to the object on which it is called. diff --git a/docs/bits/rich-text-quote.md b/docs/bits/rich-text-quote.md new file mode 100644 index 00000000..a16422da --- /dev/null +++ b/docs/bits/rich-text-quote.md @@ -0,0 +1,50 @@ +# Rich Text Quote + +?> **Note:** This document is a reference to the `RichTextQuoteBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://api.slack.com/reference/block-kit/blocks#rich_text_quote) on Slack's doc site. + +### Creating an Instance + +```javascript +import { RichTextQuote } from 'slack-block-builder'; + +const myObj = RichTextQuote(params?); +``` + +```javascript +import { Bits } from 'slack-block-builder'; + +const myObj = Bits.RichTextQuote(params?); +``` + +### Params + +`border` – *Number* – Whether to show a border (0 or 1) + +### Setter Methods + +All setter methods return `this`, the instance of `RichTextQuoteBuilder` on which it is called. + +```javascript +RichTextQuoteBuilder.elements(...elements); +``` + +Adds inline rich text elements to the quote. Accepts `RichTextText`, `RichTextEmoji`, `RichTextLink`, and other inline elements. + +### Example + +```javascript +import { RichTextQuote, RichTextText } from 'slack-block-builder'; + +RichTextQuote() + .elements( + RichTextText({ text: 'This is a quoted text block.' }).italic() + ); +``` + +### Other Methods + +```javascript +RichTextQuoteBuilder.end(); +``` + +Performs no alterations to the object on which it is called. diff --git a/docs/bits/rich-text-section.md b/docs/bits/rich-text-section.md new file mode 100644 index 00000000..e886fc07 --- /dev/null +++ b/docs/bits/rich-text-section.md @@ -0,0 +1,49 @@ +# Rich Text Section + +?> **Note:** This document is a reference to the `RichTextSectionBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://api.slack.com/reference/block-kit/blocks#rich_text_section) on Slack's doc site. + +### Creating an Instance + +The function that creates a new instance of `RichTextSectionBuilder` is available as both a top-level import and as a member of its 'category', `Bits`: + +```javascript +import { RichTextSection } from 'slack-block-builder'; + +const myObj = RichTextSection(params?); +``` + +```javascript +import { Bits } from 'slack-block-builder'; + +const myObj = Bits.RichTextSection(params?); +``` + +### Setter Methods + +All setter methods return `this`, the instance of `RichTextSectionBuilder` on which it is called. + +```javascript +RichTextSectionBuilder.elements(...elements); +``` + +Adds inline rich text elements to the section. Accepts `RichTextText`, `RichTextEmoji`, `RichTextLink`, `RichTextUser`, `RichTextChannel`, `RichTextUsergroup`, `RichTextBroadcast`, and `RichTextDate` builders. + +### Example + +```javascript +import { RichTextSection, RichTextText, RichTextEmoji } from 'slack-block-builder'; + +RichTextSection() + .elements( + RichTextText({ text: 'Hello ' }).bold(), + RichTextEmoji({ name: 'wave' }) + ); +``` + +### Other Methods + +```javascript +RichTextSectionBuilder.end(); +``` + +Performs no alterations to the object on which it is called. It is meant to simulate a closing tag for those who prefer an explicit end. diff --git a/docs/bits/rich-text-team.md b/docs/bits/rich-text-team.md new file mode 100644 index 00000000..c81ef4fb --- /dev/null +++ b/docs/bits/rich-text-team.md @@ -0,0 +1,73 @@ +# Rich Text Team + +?> **Note:** This document is a reference to the `RichTextTeamBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Rich Text element docs](https://api.slack.com/reference/block-kit/blocks#element-types) on Slack's doc site. + +### Creating an Instance + +The function that creates a new instance of `RichTextTeamBuilder` is available as both a top-level import and as a member of its 'category', `Bits`: + +```javascript +import { RichTextTeam } from 'slack-block-builder'; + +const myObj = RichTextTeam(params?); + +``` + +```javascript +import { Bits } from 'slack-block-builder'; + +const myObj = Bits.RichTextTeam(params?); +``` + +### Params + +Each instance of the `RichTextTeamBuilder` object has chainable setter methods for the object's properties. However, properties with primitive values can optionally be passed to the instantiating function, should you prefer: + +`teamId` – *String* + + +?> **Note:** For an explanation of any one of the parameters, see its corresponding setter method below. + +### Setter Methods + +All setter methods return `this`, the instance of `RichTextTeamBuilder` on which it is called. + +```javascript +RichTextTeamBuilder.teamId(string); +``` + +Sets the team/workspace ID for the mention (e.g., 'T1234ABCD'). + +```javascript +RichTextTeamBuilder.bold(); +``` + +Makes the team mention bold. + +```javascript +RichTextTeamBuilder.italic(); +``` + +Makes the team mention italic. + +```javascript +RichTextTeamBuilder.strike(); +``` + +Adds strikethrough to the team mention. + +```javascript +RichTextTeamBuilder.code(); +``` + +Formats the team mention as inline code. + +### Other Methods + +The `RichTextTeamBuilder` object also has other methods available: + +```javascript +RichTextTeamBuilder.end(); +``` + +Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object. diff --git a/docs/bits/rich-text-text.md b/docs/bits/rich-text-text.md new file mode 100644 index 00000000..489f472f --- /dev/null +++ b/docs/bits/rich-text-text.md @@ -0,0 +1,65 @@ +# Rich Text Text + +?> **Note:** This document is a reference to the `RichTextTextBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://api.slack.com/reference/block-kit/blocks#element-types) on Slack's doc site. + +### Creating an Instance + +```javascript +import { RichTextText } from 'slack-block-builder'; + +const myObj = RichTextText(params?); +``` + +```javascript +import { Bits } from 'slack-block-builder'; + +const myObj = Bits.RichTextText(params?); +``` + +### Params + +`text` – *String* – The text content + +### Styling Methods + +All styling methods return `this`, enabling chaining. + +```javascript +RichTextTextBuilder.bold(); +``` + +Makes the text bold. + +```javascript +RichTextTextBuilder.italic(); +``` + +Makes the text italic. + +```javascript +RichTextTextBuilder.strike(); +``` + +Adds strikethrough to the text. + +```javascript +RichTextTextBuilder.code(); +``` + +Formats the text as inline code. + +### Example + +```javascript +import { RichTextText } from 'slack-block-builder'; + +RichTextText({ text: 'Important message' }).bold().italic(); +``` + +### Other Methods + +```javascript +RichTextTextBuilder.end(); +``` + +Performs no alterations to the object on which it is called. diff --git a/docs/bits/rich-text-user.md b/docs/bits/rich-text-user.md new file mode 100644 index 00000000..3109b7db --- /dev/null +++ b/docs/bits/rich-text-user.md @@ -0,0 +1,44 @@ +# Rich Text User + +?> **Note:** This document is a reference to the `RichTextUserBuilder` object in **Block Builder**. For creating @user mentions in rich text. + +### Creating an Instance + +```javascript +import { RichTextUser } from 'slack-block-builder'; + +const myObj = RichTextUser(params?); +``` + +```javascript +import { Bits } from 'slack-block-builder'; + +const myObj = Bits.RichTextUser(params?); +``` + +### Params + +`userId` – *String* – The user ID to mention (e.g., `'U1234ABCD'`) + +### Styling Methods + +```javascript +RichTextUserBuilder.bold(); +RichTextUserBuilder.italic(); +RichTextUserBuilder.strike(); +RichTextUserBuilder.code(); +``` + +### Example + +```javascript +import { RichTextUser } from 'slack-block-builder'; + +RichTextUser({ userId: 'U1234ABCD' }).bold(); +``` + +### Other Methods + +```javascript +RichTextUserBuilder.end(); +``` diff --git a/docs/bits/rich-text-usergroup.md b/docs/bits/rich-text-usergroup.md new file mode 100644 index 00000000..ae5c312a --- /dev/null +++ b/docs/bits/rich-text-usergroup.md @@ -0,0 +1,44 @@ +# Rich Text Usergroup + +?> **Note:** This document is a reference to the `RichTextUsergroupBuilder` object in **Block Builder**. For creating @usergroup mentions in rich text. + +### Creating an Instance + +```javascript +import { RichTextUsergroup } from 'slack-block-builder'; + +const myObj = RichTextUsergroup(params?); +``` + +```javascript +import { Bits } from 'slack-block-builder'; + +const myObj = Bits.RichTextUsergroup(params?); +``` + +### Params + +`usergroupId` – *String* – The usergroup ID to mention (e.g., `'S1234ABCD'`) + +### Styling Methods + +```javascript +RichTextUsergroupBuilder.bold(); +RichTextUsergroupBuilder.italic(); +RichTextUsergroupBuilder.strike(); +RichTextUsergroupBuilder.code(); +``` + +### Example + +```javascript +import { RichTextUsergroup } from 'slack-block-builder'; + +RichTextUsergroup({ usergroupId: 'S1234ABCD' }); +``` + +### Other Methods + +```javascript +RichTextUsergroupBuilder.end(); +``` diff --git a/docs/blocks/context-actions.md b/docs/blocks/context-actions.md new file mode 100644 index 00000000..b826c120 --- /dev/null +++ b/docs/blocks/context-actions.md @@ -0,0 +1,55 @@ +# Context Actions + +?> **Note:** This document is a reference to the `ContextActionsBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Context Actions docs](https://api.slack.com/reference/block-kit/blocks#context_actions) on Slack's doc site. + +### Creating an Instance + +The function that creates a new instance of `ContextActionsBuilder` is available as both a top-level import and as a member of its 'category', `Blocks`: + +```javascript +import { ContextActions } from 'slack-block-builder'; + +const myObj = ContextActions(params?); + +``` + +```javascript +import { Blocks } from 'slack-block-builder'; + +const myObj = Blocks.ContextActions(params?); +``` + +### Params + +Each instance of the `ContextActionsBuilder` object has chainable setter methods for the object's properties. However, properties with primitive values can optionally be passed to the instantiating function, should you prefer: + +`blockId` – *String* + + +?> **Note:** For an explanation of any one of the parameters, see its corresponding setter method below. + +### Setter Methods + +All setter methods return `this`, the instance of `ContextActionsBuilder` on which it is called. + +```javascript +ContextActionsBuilder.blockId(string); +``` + +Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. + +```javascript +ContextActionsBuilder.elements(...elements); +``` + +Adds elements to the context actions block. Accepts FeedbackButtons or IconButton elements. + +### Other Methods + +The `ContextActionsBuilder` object also has other methods available: + +```javascript +ContextActionsBuilder.end(); +``` + +Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object. diff --git a/docs/blocks/markdown.md b/docs/blocks/markdown.md new file mode 100644 index 00000000..fe7b144d --- /dev/null +++ b/docs/blocks/markdown.md @@ -0,0 +1,57 @@ +# Markdown + +?> **Note:** This document is a reference to the `MarkdownBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Markdown docs](https://api.slack.com/reference/block-kit/blocks#markdown) on Slack's doc site. + +### Creating an Instance + +The function that creates a new instance of `MarkdownBuilder` is available as both a top-level import and as a member of its 'category', `Blocks`: + +```javascript +import { Markdown } from 'slack-block-builder'; + +const myObj = Markdown(params?); + +``` + +```javascript +import { Blocks } from 'slack-block-builder'; + +const myObj = Blocks.Markdown(params?); +``` + +### Params + +Each instance of the `MarkdownBuilder` object has chainable setter methods for the object's properties. However, properties with primitive values can optionally be passed to the instantiating function, should you prefer: + +`blockId` – *String* + +`text` – *String* + + +?> **Note:** For an explanation of any one of the parameters, see its corresponding setter method below. + +### Setter Methods + +All setter methods return `this`, the instance of `MarkdownBuilder` on which it is called. + +```javascript +MarkdownBuilder.blockId(string); +``` + +Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. + +```javascript +MarkdownBuilder.text(string); +``` + +Sets the markdown text content. Standard markdown is supported and will be translated by Slack. Maximum of 12,000 characters. + +### Other Methods + +The `MarkdownBuilder` object also has other methods available: + +```javascript +MarkdownBuilder.end(); +``` + +Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object. diff --git a/docs/blocks/rich-text.md b/docs/blocks/rich-text.md new file mode 100644 index 00000000..34ba6eba --- /dev/null +++ b/docs/blocks/rich-text.md @@ -0,0 +1,79 @@ +# Rich Text + +?> **Note:** This document is a reference to the `RichTextBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Rich Text docs](https://api.slack.com/reference/block-kit/blocks#rich_text) on Slack's doc site. + +### Creating an Instance + +The function that creates a new instance of `RichTextBuilder` is available as both a top-level import and as a member of its 'category', `Blocks`: + +```javascript +import { RichText } from 'slack-block-builder'; + +const myObj = RichText(params?); + +``` + +```javascript +import { Blocks } from 'slack-block-builder'; + +const myObj = Blocks.RichText(params?); +``` + +### Params + +Each instance of the `RichTextBuilder` object has chainable setter methods for the object's properties. However, properties with primitive values can optionally be passed to the instantiating function, should you prefer: + +`blockId` – *String* + + +?> **Note:** For an explanation of any one of the parameters, see its corresponding setter method below. + +### Setter Methods + +All setter methods return `this`, the instance of `RichTextBuilder` on which it is called. + +```javascript +RichTextBuilder.blockId(string); +``` + +Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. + +```javascript +RichTextBuilder.elements(...elements); +``` + +Adds rich text elements to the block. Accepts `RichTextSection`, `RichTextList`, `RichTextQuote`, and `RichTextPreformatted` builders. + +### Example Usage + +```javascript +import { RichText, RichTextSection, RichTextText, RichTextEmoji, RichTextList } from 'slack-block-builder'; + +const block = RichText() + .elements( + RichTextSection() + .elements( + RichTextText({ text: 'Hello ' }).bold(), + RichTextEmoji({ name: 'wave' }), + RichTextText({ text: ' Welcome to the team!' }) + ), + RichTextList({ style: 'bullet' }) + .elements( + RichTextSection() + .elements(RichTextText({ text: 'First item' })), + RichTextSection() + .elements(RichTextText({ text: 'Second item' })) + ) + ) + .buildToJSON(); +``` + +### Other Methods + +The `RichTextBuilder` object also has other methods available: + +```javascript +RichTextBuilder.end(); +``` + +Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object. diff --git a/docs/blocks/table.md b/docs/blocks/table.md new file mode 100644 index 00000000..42124c3e --- /dev/null +++ b/docs/blocks/table.md @@ -0,0 +1,61 @@ +# Table + +?> **Note:** This document is a reference to the `TableBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Table docs](https://api.slack.com/reference/block-kit/blocks#table) on Slack's doc site. + +### Creating an Instance + +The function that creates a new instance of `TableBuilder` is available as both a top-level import and as a member of its 'category', `Blocks`: + +```javascript +import { Table } from 'slack-block-builder'; + +const myObj = Table(params?); + +``` + +```javascript +import { Blocks } from 'slack-block-builder'; + +const myObj = Blocks.Table(params?); +``` + +### Params + +Each instance of the `TableBuilder` object has chainable setter methods for the object's properties. However, properties with primitive values can optionally be passed to the instantiating function, should you prefer: + +`blockId` – *String* + + +?> **Note:** For an explanation of any one of the parameters, see its corresponding setter method below. + +### Setter Methods + +All setter methods return `this`, the instance of `TableBuilder` on which it is called. + +```javascript +TableBuilder.blockId(string); +``` + +Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. + +```javascript +TableBuilder.rows(array); +``` + +Sets the table rows. Each row is an array of cells containing rich_text or raw_text objects. + +```javascript +TableBuilder.columnSettings(array); +``` + +Sets column behavior settings. Each item can have `align` ('left', 'center', 'right') and `is_wrapped` (boolean) properties. + +### Other Methods + +The `TableBuilder` object also has other methods available: + +```javascript +TableBuilder.end(); +``` + +Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object. diff --git a/docs/elements/feedback-buttons.md b/docs/elements/feedback-buttons.md new file mode 100644 index 00000000..6623eeed --- /dev/null +++ b/docs/elements/feedback-buttons.md @@ -0,0 +1,61 @@ +# Feedback Buttons + +?> **Note:** This document is a reference to the `FeedbackButtonsBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Feedback Buttons docs](https://api.slack.com/reference/block-kit/block-elements#feedback_buttons) on Slack's doc site. + +### Creating an Instance + +The function that creates a new instance of `FeedbackButtonsBuilder` is available as both a top-level import and as a member of its 'category', `Elements`: + +```javascript +import { FeedbackButtons } from 'slack-block-builder'; + +const myObj = FeedbackButtons(params?); + +``` + +```javascript +import { Elements } from 'slack-block-builder'; + +const myObj = Elements.FeedbackButtons(params?); +``` + +### Params + +Each instance of the `FeedbackButtonsBuilder` object has chainable setter methods for the object's properties. However, properties with primitive values can optionally be passed to the instantiating function, should you prefer: + +`actionId` – *String* + + +?> **Note:** For an explanation of any one of the parameters, see its corresponding setter method below. + +### Setter Methods + +All setter methods return `this`, the instance of `FeedbackButtonsBuilder` on which it is called. + +```javascript +FeedbackButtonsBuilder.actionId(string); +``` + +Sets a string to be an identifier for the source of an action in interaction payloads. + +```javascript +FeedbackButtonsBuilder.positiveButton(config); +``` + +Sets the positive feedback button configuration. Config object should have: `text` (string), `value` (string), and optional `accessibilityLabel` (string). + +```javascript +FeedbackButtonsBuilder.negativeButton(config); +``` + +Sets the negative feedback button configuration. Config object should have: `text` (string), `value` (string), and optional `accessibilityLabel` (string). + +### Other Methods + +The `FeedbackButtonsBuilder` object also has other methods available: + +```javascript +FeedbackButtonsBuilder.end(); +``` + +Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object. diff --git a/docs/elements/icon-button.md b/docs/elements/icon-button.md new file mode 100644 index 00000000..0692dfe2 --- /dev/null +++ b/docs/elements/icon-button.md @@ -0,0 +1,93 @@ +# Icon Button + +?> **Note:** This document is a reference to the `IconButtonBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Icon Button docs](https://api.slack.com/reference/block-kit/block-elements#icon_button) on Slack's doc site. + +### Creating an Instance + +The function that creates a new instance of `IconButtonBuilder` is available as both a top-level import and as a member of its 'category', `Elements`: + +```javascript +import { IconButton } from 'slack-block-builder'; + +const myObj = IconButton(params?); + +``` + +```javascript +import { Elements } from 'slack-block-builder'; + +const myObj = Elements.IconButton(params?); +``` + +### Params + +Each instance of the `IconButtonBuilder` object has chainable setter methods for the object's properties. However, properties with primitive values can optionally be passed to the instantiating function, should you prefer: + +`accessibilityLabel` – *String* + +`actionId` – *String* + +`icon` – *String* + +`text` – *String* + +`value` – *String* + + +?> **Note:** For an explanation of any one of the parameters, see its corresponding setter method below. + +### Setter Methods + +All setter methods return `this`, the instance of `IconButtonBuilder` on which it is called. + +```javascript +IconButtonBuilder.actionId(string); +``` + +Sets a string to be an identifier for the source of an action in interaction payloads. + +```javascript +IconButtonBuilder.icon(string); +``` + +Sets the icon to display on the button (e.g., 'trash', 'edit'). + +```javascript +IconButtonBuilder.text(string); +``` + +Sets the text for the button (used for accessibility). + +```javascript +IconButtonBuilder.value(string); +``` + +Sets the value to be passed to your app when this button is clicked. + +```javascript +IconButtonBuilder.accessibilityLabel(string); +``` + +Sets a longer descriptive text that will be read out by screen readers. + +```javascript +IconButtonBuilder.visibleToUserIds(...userIds); +``` + +Sets user IDs for which the icon button appears. + +```javascript +IconButtonBuilder.confirm(ConfirmationDialogBuilder); +``` + +Sets a confirmation dialog to be shown before the action is executed. + +### Other Methods + +The `IconButtonBuilder` object also has other methods available: + +```javascript +IconButtonBuilder.end(); +``` + +Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object. diff --git a/docs/elements/rich-text-input.md b/docs/elements/rich-text-input.md new file mode 100644 index 00000000..f7af612b --- /dev/null +++ b/docs/elements/rich-text-input.md @@ -0,0 +1,75 @@ +# Rich Text Input + +?> **Note:** This document is a reference to the `RichTextInputBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Rich Text Input docs](https://api.slack.com/reference/block-kit/block-elements#rich_text_input) on Slack's doc site. + +### Creating an Instance + +The function that creates a new instance of `RichTextInputBuilder` is available as both a top-level import and as a member of its 'category', `Elements`: + +```javascript +import { RichTextInput } from 'slack-block-builder'; + +const myObj = RichTextInput(params?); + +``` + +```javascript +import { Elements } from 'slack-block-builder'; + +const myObj = Elements.RichTextInput(params?); +``` + +### Params + +Each instance of the `RichTextInputBuilder` object has chainable setter methods for the object's properties. However, properties with primitive values can optionally be passed to the instantiating function, should you prefer: + +`actionId` – *String* + +`placeholder` – *String* + + +?> **Note:** For an explanation of any one of the parameters, see its corresponding setter method below. + +### Setter Methods + +All setter methods return `this`, the instance of `RichTextInputBuilder` on which it is called. + +```javascript +RichTextInputBuilder.actionId(string); +``` + +Sets a string to be an identifier for the source of an action in interaction payloads. + +```javascript +RichTextInputBuilder.placeholder(string); +``` + +Sets placeholder text displayed in the input when empty. + +```javascript +RichTextInputBuilder.initialValue(RichTextBuilder); +``` + +Sets the initial value for the rich text input using a RichText block builder. + +```javascript +RichTextInputBuilder.focusOnLoad(boolean?); +``` + +Sets the element to have auto focus on opening the view. Defaults to true if called without argument. + +```javascript +RichTextInputBuilder.dispatchActionConfig(config); +``` + +Configures when to dispatch actions for this input. Config object has `trigger_actions_on` array with values like 'on_enter_pressed' or 'on_character_entered'. + +### Other Methods + +The `RichTextInputBuilder` object also has other methods available: + +```javascript +RichTextInputBuilder.end(); +``` + +Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object. diff --git a/docs/elements/workflow-button.md b/docs/elements/workflow-button.md new file mode 100644 index 00000000..6a6a41ed --- /dev/null +++ b/docs/elements/workflow-button.md @@ -0,0 +1,81 @@ +# Workflow Button + +?> **Note:** This document is a reference to the `WorkflowButtonBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Workflow Button docs](https://api.slack.com/reference/block-kit/block-elements#workflow_button) on Slack's doc site. + +### Creating an Instance + +The function that creates a new instance of `WorkflowButtonBuilder` is available as both a top-level import and as a member of its 'category', `Elements`: + +```javascript +import { WorkflowButton } from 'slack-block-builder'; + +const myObj = WorkflowButton(params?); + +``` + +```javascript +import { Elements } from 'slack-block-builder'; + +const myObj = Elements.WorkflowButton(params?); +``` + +### Params + +Each instance of the `WorkflowButtonBuilder` object has chainable setter methods for the object's properties. However, properties with primitive values can optionally be passed to the instantiating function, should you prefer: + +`accessibilityLabel` – *String* + +`text` – *String* + + +?> **Note:** For an explanation of any one of the parameters, see its corresponding setter method below. + +### Setter Methods + +All setter methods return `this`, the instance of `WorkflowButtonBuilder` on which it is called. + +```javascript +WorkflowButtonBuilder.text(string); +``` + +Sets the display text for the button. + +```javascript +WorkflowButtonBuilder.accessibilityLabel(string); +``` + +Sets a longer descriptive text that will be read out by screen readers instead of the button text object. + +```javascript +WorkflowButtonBuilder.workflow(object); +``` + +Sets the workflow configuration with a trigger URL and optional customizable input parameters. + +```javascript +WorkflowButtonBuilder.confirm(ConfirmationDialogBuilder); +``` + +Sets a confirmation dialog to be shown before the workflow is triggered. + +```javascript +WorkflowButtonBuilder.primary(); +``` + +Sets the button style to primary (green). + +```javascript +WorkflowButtonBuilder.danger(); +``` + +Sets the button style to danger (red). + +### Other Methods + +The `WorkflowButtonBuilder` object also has other methods available: + +```javascript +WorkflowButtonBuilder.end(); +``` + +Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object. diff --git a/docs/support.md b/docs/support.md index b2e8a948..e8305b28 100644 --- a/docs/support.md +++ b/docs/support.md @@ -20,6 +20,10 @@ Below is a list of supported components and how to access them in **Block Builde | Input | Block | **Yes** | `Blocks.Input()` | [View Docs](/blocks/input.md) | Section | Block | **Yes** | `Blocks.Section()` | [View Docs](/blocks/section.md) | Video | Video | **Yes** | `Blocks.Video()` | [View Docs](/blocks/video.md) +| Rich Text | Block | **Yes** | `Blocks.RichText()` | [View Docs](/blocks/rich-text.md) +| Markdown | Block | **Yes** | `Blocks.Markdown()` | [View Docs](/blocks/markdown.md) +| Table | Block | **Yes** | `Blocks.Table()` | [View Docs](/blocks/table.md) +| Context Actions | Block | **Yes** | `Blocks.ContextActions()` | [View Docs](/blocks/context-actions.md) | Button | Element | **Yes**️ | `Elements.Button()` | [View Docs](/elements/button.md) | Checkboxes | Element | **Yes** | `Elements.Checkboxes()` | [View Docs](/elements/checkboxes.md) | Date Picker | Element | **Yes** | `Elements.DatePicker()` | [View Docs](/elements/date-picker.md) @@ -34,8 +38,27 @@ Below is a list of supported components and how to access them in **Block Builde | Select Menus | Element | **Yes** | `Elements.[Type]Select()` | | Multi-Select Menus | Element | **Yes** | `Elements.[Type]MultiSelect()` | | URL Input | Element | **Yes** | `Elements.URLInput()` | [View Docs](/elements/url-input.md) +| Workflow Button | Element | **Yes** | `Elements.WorkflowButton()` | [View Docs](/elements/workflow-button.md) +| Icon Button | Element | **Yes** | `Elements.IconButton()` | [View Docs](/elements/icon-button.md) +| Feedback Buttons | Element | **Yes** | `Elements.FeedbackButtons()` | [View Docs](/elements/feedback-buttons.md) +| Rich Text Input | Element | **Yes** | `Elements.RichTextInput()` | [View Docs](/elements/rich-text-input.md) +| File Input | Element | **Yes** | `Elements.FileInput()` | [View Docs](/elements/file-input.md) | Attachment | Legacy Feature | **Yes** | `Bits.Attachment()` | [View Docs](/bits/attachment.md) | Confirmation Dialog | Composition Object | **Yes** | `Bits.ConfirmationDialog()` | [View Docs](/bits/confirmation-dialog.md) | Option | Composition Object | **Yes** | `Bits.Option()` | [View Docs](/bits/option.md) | Option Group | Composition Object | **Yes** | `Bits.OptionGroup()` | [View Docs](/bits/option-group.md) +| Rich Text Section | Composition Object | **Yes** | `Bits.RichTextSection()` | [View Docs](/bits/rich-text-section.md) +| Rich Text List | Composition Object | **Yes** | `Bits.RichTextList()` | [View Docs](/bits/rich-text-list.md) +| Rich Text Quote | Composition Object | **Yes** | `Bits.RichTextQuote()` | [View Docs](/bits/rich-text-quote.md) +| Rich Text Preformatted | Composition Object | **Yes** | `Bits.RichTextPreformatted()` | [View Docs](/bits/rich-text-preformatted.md) +| Rich Text Text | Composition Object | **Yes** | `Bits.RichTextText()` | [View Docs](/bits/rich-text-text.md) +| Rich Text Emoji | Composition Object | **Yes** | `Bits.RichTextEmoji()` | [View Docs](/bits/rich-text-emoji.md) +| Rich Text Link | Composition Object | **Yes** | `Bits.RichTextLink()` | [View Docs](/bits/rich-text-link.md) +| Rich Text User | Composition Object | **Yes** | `Bits.RichTextUser()` | [View Docs](/bits/rich-text-user.md) +| Rich Text Channel | Composition Object | **Yes** | `Bits.RichTextChannel()` | [View Docs](/bits/rich-text-channel.md) +| Rich Text Usergroup | Composition Object | **Yes** | `Bits.RichTextUsergroup()` | [View Docs](/bits/rich-text-usergroup.md) +| Rich Text Broadcast | Composition Object | **Yes** | `Bits.RichTextBroadcast()` | [View Docs](/bits/rich-text-broadcast.md) +| Rich Text Date | Composition Object | **Yes** | `Bits.RichTextDate()` | [View Docs](/bits/rich-text-date.md) +| Rich Text Color | Composition Object | **Yes** | `Bits.RichTextColor()` | [View Docs](/bits/rich-text-color.md) +| Rich Text Team | Composition Object | **Yes** | `Bits.RichTextTeam()` | [View Docs](/bits/rich-text-team.md) diff --git a/src/bits/index.ts b/src/bits/index.ts index 4fdb2a51..b36fdf92 100644 --- a/src/bits/index.ts +++ b/src/bits/index.ts @@ -4,6 +4,20 @@ import { AttachmentBuilder, AttachmentParams } from './attachment'; import { ConfirmationDialogBuilder, ConfirmationDialogParams } from './confirmation-dialog'; import { OptionBuilder, OptionParams } from './option'; import { OptionGroupBuilder, OptionGroupParams } from './option-group'; +import { RichTextSectionBuilder, RichTextSectionParams } from './rich-text-section'; +import { RichTextListBuilder, RichTextListParams } from './rich-text-list'; +import { RichTextQuoteBuilder, RichTextQuoteParams } from './rich-text-quote'; +import { RichTextPreformattedBuilder, RichTextPreformattedParams } from './rich-text-preformatted'; +import { RichTextTextBuilder, RichTextTextParams } from './rich-text-text'; +import { RichTextEmojiBuilder, RichTextEmojiParams } from './rich-text-emoji'; +import { RichTextLinkBuilder, RichTextLinkParams } from './rich-text-link'; +import { RichTextUserBuilder, RichTextUserParams } from './rich-text-user'; +import { RichTextChannelBuilder, RichTextChannelParams } from './rich-text-channel'; +import { RichTextUsergroupBuilder, RichTextUsergroupParams } from './rich-text-usergroup'; +import { RichTextBroadcastBuilder, RichTextBroadcastParams } from './rich-text-broadcast'; +import { RichTextDateBuilder, RichTextDateParams } from './rich-text-date'; +import { RichTextColorBuilder, RichTextColorParams } from './rich-text-color'; +import { RichTextTeamBuilder, RichTextTeamParams } from './rich-text-team'; export type { AttachmentBuilder, @@ -14,6 +28,34 @@ export type { OptionParams, OptionGroupBuilder, OptionGroupParams, + RichTextSectionBuilder, + RichTextSectionParams, + RichTextListBuilder, + RichTextListParams, + RichTextQuoteBuilder, + RichTextQuoteParams, + RichTextPreformattedBuilder, + RichTextPreformattedParams, + RichTextTextBuilder, + RichTextTextParams, + RichTextEmojiBuilder, + RichTextEmojiParams, + RichTextLinkBuilder, + RichTextLinkParams, + RichTextUserBuilder, + RichTextUserParams, + RichTextChannelBuilder, + RichTextChannelParams, + RichTextUsergroupBuilder, + RichTextUsergroupParams, + RichTextBroadcastBuilder, + RichTextBroadcastParams, + RichTextDateBuilder, + RichTextDateParams, + RichTextColorBuilder, + RichTextColorParams, + RichTextTeamBuilder, + RichTextTeamParams, }; /** @@ -36,7 +78,7 @@ export function Attachment(params?: AttachmentParams): AttachmentBuilder { * @param {string} [params.title] Sets the title displayed in the confirmation dialog. * @param {string} [params.text] Sets the textual content of the confirmation dialog. * @param {string} [params.confirm] Sets the text for the button that confirms the action. - * @param {string} [params.deny]Sets the text for the button that cancels the action. + * @param {string} [params.deny] Sets the text for the button that cancels the action. * * {@link https://api.slack.com/reference/block-kit/composition-objects#confirm|View in Slack API Documentation} */ @@ -70,11 +112,172 @@ export function OptionGroup(params?: OptionGroupParams): OptionGroupBuilder { return new OptionGroupBuilder(params); } +/** + * @description Creates a rich text section element. + * {@link https://api.slack.com/reference/block-kit/blocks#rich_text_section|View in Slack API Documentation} + */ +export function RichTextSection(params?: RichTextSectionParams): RichTextSectionBuilder { + return new RichTextSectionBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.style] The list style - 'bullet' or 'ordered'. + * @param {number} [params.indent] The indentation level (0-8). + * @param {number} [params.border] Whether to show a border (0 or 1). + * + * {@link https://api.slack.com/reference/block-kit/blocks#rich_text_list|View in Slack API Documentation} + */ +export function RichTextList(params?: RichTextListParams): RichTextListBuilder { + return new RichTextListBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {number} [params.border] Whether to show a border (0 or 1). + * + * {@link https://api.slack.com/reference/block-kit/blocks#rich_text_quote|View in Slack API Documentation} + */ +export function RichTextQuote(params?: RichTextQuoteParams): RichTextQuoteBuilder { + return new RichTextQuoteBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {number} [params.border] Whether to show a border (0 or 1). + * + * {@link https://api.slack.com/reference/block-kit/blocks#rich_text_preformatted|View in Slack API Documentation} + */ +export function RichTextPreformatted(params?: RichTextPreformattedParams): RichTextPreformattedBuilder { + return new RichTextPreformattedBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.text] The text content. + * + * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + */ +export function RichTextText(params?: RichTextTextParams): RichTextTextBuilder { + return new RichTextTextBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.name] The emoji name without colons. + * @param {string} [params.unicode] The unicode representation. + * @param {string} [params.url] URL for custom emoji. + * + * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + */ +export function RichTextEmoji(params?: RichTextEmojiParams): RichTextEmojiBuilder { + return new RichTextEmojiBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.url] The URL to link to. + * @param {string} [params.text] The link text. + * @param {boolean} [params.unsafe] Whether the link is unsafe. + * + * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + */ +export function RichTextLink(params?: RichTextLinkParams): RichTextLinkBuilder { + return new RichTextLinkBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.userId] The user ID to mention. + * + * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + */ +export function RichTextUser(params?: RichTextUserParams): RichTextUserBuilder { + return new RichTextUserBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.channelId] The channel ID to mention. + * + * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + */ +export function RichTextChannel(params?: RichTextChannelParams): RichTextChannelBuilder { + return new RichTextChannelBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.usergroupId] The usergroup ID to mention. + * + * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + */ +export function RichTextUsergroup(params?: RichTextUsergroupParams): RichTextUsergroupBuilder { + return new RichTextUsergroupBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.range] The broadcast range - 'here', 'channel', or 'everyone'. + * + * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + */ +export function RichTextBroadcast(params?: RichTextBroadcastParams): RichTextBroadcastBuilder { + return new RichTextBroadcastBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {number} [params.timestamp] Unix timestamp in seconds. + * @param {string} [params.format] The date format template. + * @param {string} [params.url] Optional URL to link the date. + * @param {string} [params.fallback] Fallback text if date can't be displayed. + * + * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + */ +export function RichTextDate(params?: RichTextDateParams): RichTextDateBuilder { + return new RichTextDateBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.value] The hex color value. + * + * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + */ +export function RichTextColor(params?: RichTextColorParams): RichTextColorBuilder { + return new RichTextColorBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.teamId] The team/workspace ID to mention. + * + * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + */ +export function RichTextTeam(params?: RichTextTeamParams): RichTextTeamBuilder { + return new RichTextTeamBuilder(params); +} + const bits = { Attachment, ConfirmationDialog, Option, OptionGroup, + RichTextSection, + RichTextList, + RichTextQuote, + RichTextPreformatted, + RichTextText, + RichTextEmoji, + RichTextLink, + RichTextUser, + RichTextChannel, + RichTextUsergroup, + RichTextBroadcast, + RichTextDate, + RichTextColor, + RichTextTeam, }; // Strange export. I know. For IDE highlighting purposes. diff --git a/src/bits/rich-text-broadcast.ts b/src/bits/rich-text-broadcast.ts new file mode 100644 index 00000000..1c5c3455 --- /dev/null +++ b/src/bits/rich-text-broadcast.ts @@ -0,0 +1,62 @@ +import { BitBuilderBase } from '../internal/base'; +import { RichTextElementType } from '../internal/constants'; +import { SlackDto } from '../internal/dto'; +import { applyMixins } from '../internal/helpers'; +import { End } from '../internal/methods'; + +export interface RichTextBroadcastParams { + range?: 'here' | 'channel' | 'everyone'; +} + +export interface RichTextBroadcastBuilder extends End { + bold(): this; + italic(): this; + strike(): this; + code(): this; +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@displayName Rich Text Broadcast Mention + */ + +export class RichTextBroadcastBuilder extends BitBuilderBase { + /** @internal */ + + public bold(): this { + this.props.style = { ...this.props.style, bold: true }; + return this; + } + + public italic(): this { + this.props.style = { ...this.props.style, italic: true }; + return this; + } + + public strike(): this { + this.props.style = { ...this.props.style, strike: true }; + return this; + } + + public code(): this { + this.props.style = { ...this.props.style, code: true }; + return this; + } + + public build(): Readonly { + const result: Record = { + type: RichTextElementType.Broadcast, + range: this.props.range, + }; + + if (this.props.style && Object.keys(this.props.style).length > 0) { + result.style = this.props.style; + } + + return this.getResult(SlackDto, result); + } +} + +applyMixins(RichTextBroadcastBuilder, [ + End, +]); diff --git a/src/bits/rich-text-channel.ts b/src/bits/rich-text-channel.ts new file mode 100644 index 00000000..f0ec7397 --- /dev/null +++ b/src/bits/rich-text-channel.ts @@ -0,0 +1,62 @@ +import { BitBuilderBase } from '../internal/base'; +import { RichTextElementType } from '../internal/constants'; +import { SlackDto } from '../internal/dto'; +import { applyMixins } from '../internal/helpers'; +import { End } from '../internal/methods'; + +export interface RichTextChannelParams { + channelId?: string; +} + +export interface RichTextChannelBuilder extends End { + bold(): this; + italic(): this; + strike(): this; + code(): this; +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@displayName Rich Text Channel Mention + */ + +export class RichTextChannelBuilder extends BitBuilderBase { + /** @internal */ + + public bold(): this { + this.props.style = { ...this.props.style, bold: true }; + return this; + } + + public italic(): this { + this.props.style = { ...this.props.style, italic: true }; + return this; + } + + public strike(): this { + this.props.style = { ...this.props.style, strike: true }; + return this; + } + + public code(): this { + this.props.style = { ...this.props.style, code: true }; + return this; + } + + public build(): Readonly { + const result: Record = { + type: RichTextElementType.Channel, + channel_id: this.props.channelId, + }; + + if (this.props.style && Object.keys(this.props.style).length > 0) { + result.style = this.props.style; + } + + return this.getResult(SlackDto, result); + } +} + +applyMixins(RichTextChannelBuilder, [ + End, +]); diff --git a/src/bits/rich-text-color.ts b/src/bits/rich-text-color.ts new file mode 100644 index 00000000..ea01a711 --- /dev/null +++ b/src/bits/rich-text-color.ts @@ -0,0 +1,83 @@ +import { BitBuilderBase } from '../internal/base'; +import { RichTextElementType } from '../internal/constants'; +import { SlackDto } from '../internal/dto'; +import { applyMixins } from '../internal/helpers'; +import { End } from '../internal/methods'; + +export interface RichTextColorParams { + value?: string; +} + +export interface RichTextColorBuilder extends End { + bold(): this; + italic(): this; + strike(): this; + code(): this; +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@displayName Rich Text Color + */ + +export class RichTextColorBuilder extends BitBuilderBase { + /** @internal */ + + /** + * @description Sets the hex color value. + * @param {string} value - The hex color value (e.g., '#FF5733'). + */ + public value(value: string): this { + this.props.value = value; + return this; + } + + /** + * @description Makes the color text bold. + */ + public bold(): this { + this.props.style = { ...this.props.style, bold: true }; + return this; + } + + /** + * @description Makes the color text italic. + */ + public italic(): this { + this.props.style = { ...this.props.style, italic: true }; + return this; + } + + /** + * @description Adds strikethrough to the color text. + */ + public strike(): this { + this.props.style = { ...this.props.style, strike: true }; + return this; + } + + /** + * @description Formats the color text as inline code. + */ + public code(): this { + this.props.style = { ...this.props.style, code: true }; + return this; + } + + public build(): Readonly { + const result: Record = { + type: RichTextElementType.Color, + value: this.props.value, + }; + + if (this.props.style && Object.keys(this.props.style).length > 0) { + result.style = this.props.style; + } + + return this.getResult(SlackDto, result); + } +} + +applyMixins(RichTextColorBuilder, [ + End, +]); diff --git a/src/bits/rich-text-date.ts b/src/bits/rich-text-date.ts new file mode 100644 index 00000000..cea0a860 --- /dev/null +++ b/src/bits/rich-text-date.ts @@ -0,0 +1,68 @@ +import { BitBuilderBase } from '../internal/base'; +import { RichTextElementType } from '../internal/constants'; +import { SlackDto } from '../internal/dto'; +import { applyMixins } from '../internal/helpers'; +import { End } from '../internal/methods'; + +export interface RichTextDateParams { + timestamp?: number; + format?: string; + url?: string; + fallback?: string; +} + +export interface RichTextDateBuilder extends End { + bold(): this; + italic(): this; + strike(): this; + code(): this; +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@displayName Rich Text Date + */ + +export class RichTextDateBuilder extends BitBuilderBase { + /** @internal */ + + public bold(): this { + this.props.style = { ...this.props.style, bold: true }; + return this; + } + + public italic(): this { + this.props.style = { ...this.props.style, italic: true }; + return this; + } + + public strike(): this { + this.props.style = { ...this.props.style, strike: true }; + return this; + } + + public code(): this { + this.props.style = { ...this.props.style, code: true }; + return this; + } + + public build(): Readonly { + const result: Record = { + type: RichTextElementType.Date, + timestamp: this.props.timestamp, + format: this.props.format, + url: this.props.url, + fallback: this.props.fallback, + }; + + if (this.props.style && Object.keys(this.props.style).length > 0) { + result.style = this.props.style; + } + + return this.getResult(SlackDto, result); + } +} + +applyMixins(RichTextDateBuilder, [ + End, +]); diff --git a/src/bits/rich-text-emoji.ts b/src/bits/rich-text-emoji.ts new file mode 100644 index 00000000..448520d6 --- /dev/null +++ b/src/bits/rich-text-emoji.ts @@ -0,0 +1,36 @@ +import { BitBuilderBase } from '../internal/base'; +import { RichTextElementType } from '../internal/constants'; +import { SlackDto } from '../internal/dto'; +import { applyMixins } from '../internal/helpers'; +import { End } from '../internal/methods'; + +export interface RichTextEmojiParams { + name?: string; + unicode?: string; + url?: string; +} + +export interface RichTextEmojiBuilder extends End { +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@displayName Rich Text Emoji + */ + +export class RichTextEmojiBuilder extends BitBuilderBase { + /** @internal */ + + public build(): Readonly { + return this.getResult(SlackDto, { + type: RichTextElementType.Emoji, + name: this.props.name, + unicode: this.props.unicode, + url: this.props.url, + }); + } +} + +applyMixins(RichTextEmojiBuilder, [ + End, +]); diff --git a/src/bits/rich-text-link.ts b/src/bits/rich-text-link.ts new file mode 100644 index 00000000..e900f768 --- /dev/null +++ b/src/bits/rich-text-link.ts @@ -0,0 +1,78 @@ +import { BitBuilderBase } from '../internal/base'; +import { RichTextElementType } from '../internal/constants'; +import { SlackDto } from '../internal/dto'; +import { applyMixins } from '../internal/helpers'; +import { End } from '../internal/methods'; + +export interface RichTextLinkParams { + url?: string; + text?: string; + unsafe?: boolean; +} + +export interface RichTextLinkBuilder extends End { + bold(): this; + italic(): this; + strike(): this; + code(): this; +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@displayName Rich Text Link + */ + +export class RichTextLinkBuilder extends BitBuilderBase { + /** @internal */ + + /** + * @description Makes the link text bold. + */ + public bold(): this { + this.props.style = { ...this.props.style, bold: true }; + return this; + } + + /** + * @description Makes the link text italic. + */ + public italic(): this { + this.props.style = { ...this.props.style, italic: true }; + return this; + } + + /** + * @description Adds strikethrough to the link text. + */ + public strike(): this { + this.props.style = { ...this.props.style, strike: true }; + return this; + } + + /** + * @description Formats the link text as inline code. + */ + public code(): this { + this.props.style = { ...this.props.style, code: true }; + return this; + } + + public build(): Readonly { + const result: Record = { + type: RichTextElementType.Link, + url: this.props.url, + text: this.props.text, + unsafe: this.props.unsafe, + }; + + if (this.props.style && Object.keys(this.props.style).length > 0) { + result.style = this.props.style; + } + + return this.getResult(SlackDto, result); + } +} + +applyMixins(RichTextLinkBuilder, [ + End, +]); diff --git a/src/bits/rich-text-list.ts b/src/bits/rich-text-list.ts new file mode 100644 index 00000000..16a27634 --- /dev/null +++ b/src/bits/rich-text-list.ts @@ -0,0 +1,43 @@ +import { BitBuilderBase } from '../internal/base'; +import { RichTextElementType } from '../internal/constants'; +import { SlackDto } from '../internal/dto'; +import { applyMixins, getBuilderResults } from '../internal/helpers'; +import { + Elements, + End, +} from '../internal/methods'; + +export interface RichTextListParams { + style?: 'bullet' | 'ordered'; + indent?: number; + border?: 0 | 1; +} + +export interface RichTextListBuilder extends End, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + Elements { +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#rich_text_list + * @@displayName Rich Text List + */ + +export class RichTextListBuilder extends BitBuilderBase { + /** @internal */ + + public build(): Readonly { + return this.getResult(SlackDto, { + type: RichTextElementType.List, + elements: getBuilderResults(this.props.elements), + style: this.props.style, + indent: this.props.indent, + border: this.props.border, + }); + } +} + +applyMixins(RichTextListBuilder, [ + End, + Elements, +]); diff --git a/src/bits/rich-text-preformatted.ts b/src/bits/rich-text-preformatted.ts new file mode 100644 index 00000000..c931d8a6 --- /dev/null +++ b/src/bits/rich-text-preformatted.ts @@ -0,0 +1,39 @@ +import { BitBuilderBase } from '../internal/base'; +import { RichTextElementType } from '../internal/constants'; +import { SlackDto } from '../internal/dto'; +import { applyMixins, getBuilderResults } from '../internal/helpers'; +import { + Elements, + End, +} from '../internal/methods'; + +export interface RichTextPreformattedParams { + border?: 0 | 1; +} + +export interface RichTextPreformattedBuilder extends End, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + Elements { +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#rich_text_preformatted + * @@displayName Rich Text Preformatted + */ + +export class RichTextPreformattedBuilder extends BitBuilderBase { + /** @internal */ + + public build(): Readonly { + return this.getResult(SlackDto, { + type: RichTextElementType.Preformatted, + elements: getBuilderResults(this.props.elements), + border: this.props.border, + }); + } +} + +applyMixins(RichTextPreformattedBuilder, [ + End, + Elements, +]); diff --git a/src/bits/rich-text-quote.ts b/src/bits/rich-text-quote.ts new file mode 100644 index 00000000..5e8b98e5 --- /dev/null +++ b/src/bits/rich-text-quote.ts @@ -0,0 +1,39 @@ +import { BitBuilderBase } from '../internal/base'; +import { RichTextElementType } from '../internal/constants'; +import { SlackDto } from '../internal/dto'; +import { applyMixins, getBuilderResults } from '../internal/helpers'; +import { + Elements, + End, +} from '../internal/methods'; + +export interface RichTextQuoteParams { + border?: 0 | 1; +} + +export interface RichTextQuoteBuilder extends End, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + Elements { +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#rich_text_quote + * @@displayName Rich Text Quote + */ + +export class RichTextQuoteBuilder extends BitBuilderBase { + /** @internal */ + + public build(): Readonly { + return this.getResult(SlackDto, { + type: RichTextElementType.Quote, + elements: getBuilderResults(this.props.elements), + border: this.props.border, + }); + } +} + +applyMixins(RichTextQuoteBuilder, [ + End, + Elements, +]); diff --git a/src/bits/rich-text-section.ts b/src/bits/rich-text-section.ts new file mode 100644 index 00000000..70157e5e --- /dev/null +++ b/src/bits/rich-text-section.ts @@ -0,0 +1,36 @@ +import { BitBuilderBase } from '../internal/base'; +import { RichTextElementType } from '../internal/constants'; +import { SlackDto } from '../internal/dto'; +import { applyMixins, getBuilderResults } from '../internal/helpers'; +import { + Elements, + End, +} from '../internal/methods'; + +export interface RichTextSectionParams { } + +export interface RichTextSectionBuilder extends End, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + Elements { +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#rich_text_section + * @@displayName Rich Text Section + */ + +export class RichTextSectionBuilder extends BitBuilderBase { + /** @internal */ + + public build(): Readonly { + return this.getResult(SlackDto, { + type: RichTextElementType.Section, + elements: getBuilderResults(this.props.elements), + }); + } +} + +applyMixins(RichTextSectionBuilder, [ + End, + Elements, +]); diff --git a/src/bits/rich-text-team.ts b/src/bits/rich-text-team.ts new file mode 100644 index 00000000..d3305da9 --- /dev/null +++ b/src/bits/rich-text-team.ts @@ -0,0 +1,84 @@ +import { BitBuilderBase } from '../internal/base'; +import { RichTextElementType } from '../internal/constants'; +import { SlackDto } from '../internal/dto'; +import { applyMixins } from '../internal/helpers'; +import { End } from '../internal/methods'; + +export interface RichTextTeamParams { + teamId?: string; +} + +export interface RichTextTeamBuilder extends End { + teamId(teamId: string): this; + bold(): this; + italic(): this; + strike(): this; + code(): this; +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@displayName Rich Text Team + */ + +export class RichTextTeamBuilder extends BitBuilderBase { + /** @internal */ + + /** + * @description Sets the team/workspace ID for the mention. + * @param {string} teamId - The encoded team ID (e.g., T1234ABCD). + */ + public teamId(teamId: string): this { + this.props.teamId = teamId; + return this; + } + + /** + * @description Makes the team mention bold. + */ + public bold(): this { + this.props.style = { ...this.props.style, bold: true }; + return this; + } + + /** + * @description Makes the team mention italic. + */ + public italic(): this { + this.props.style = { ...this.props.style, italic: true }; + return this; + } + + /** + * @description Adds strikethrough to the team mention. + */ + public strike(): this { + this.props.style = { ...this.props.style, strike: true }; + return this; + } + + /** + * @description Formats the team mention as inline code. + */ + public code(): this { + this.props.style = { ...this.props.style, code: true }; + return this; + } + + public build(): Readonly { + const result: Record = { + type: RichTextElementType.Team, + team_id: this.props.teamId, + }; + + if (this.props.style && Object.keys(this.props.style).length > 0) { + result.style = this.props.style; + } + + return this.getResult(SlackDto, result); + } +} + +applyMixins(RichTextTeamBuilder, [ + End, +]); diff --git a/src/bits/rich-text-text.ts b/src/bits/rich-text-text.ts new file mode 100644 index 00000000..ff2682fd --- /dev/null +++ b/src/bits/rich-text-text.ts @@ -0,0 +1,74 @@ +import { BitBuilderBase } from '../internal/base'; +import { RichTextElementType } from '../internal/constants'; +import { SlackDto } from '../internal/dto'; +import { applyMixins } from '../internal/helpers'; +import { End } from '../internal/methods'; + +export interface RichTextTextParams { + text?: string; +} + +export interface RichTextTextBuilder extends End { + bold(): this; + italic(): this; + strike(): this; + code(): this; +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@displayName Rich Text Text + */ + +export class RichTextTextBuilder extends BitBuilderBase { + /** @internal */ + + /** + * @description Makes the text bold. + */ + public bold(): this { + this.props.style = { ...this.props.style, bold: true }; + return this; + } + + /** + * @description Makes the text italic. + */ + public italic(): this { + this.props.style = { ...this.props.style, italic: true }; + return this; + } + + /** + * @description Adds strikethrough to the text. + */ + public strike(): this { + this.props.style = { ...this.props.style, strike: true }; + return this; + } + + /** + * @description Formats the text as inline code. + */ + public code(): this { + this.props.style = { ...this.props.style, code: true }; + return this; + } + + public build(): Readonly { + const result: Record = { + type: RichTextElementType.Text, + text: this.props.text, + }; + + if (this.props.style && Object.keys(this.props.style).length > 0) { + result.style = this.props.style; + } + + return this.getResult(SlackDto, result); + } +} + +applyMixins(RichTextTextBuilder, [ + End, +]); diff --git a/src/bits/rich-text-user.ts b/src/bits/rich-text-user.ts new file mode 100644 index 00000000..21e6cbaa --- /dev/null +++ b/src/bits/rich-text-user.ts @@ -0,0 +1,62 @@ +import { BitBuilderBase } from '../internal/base'; +import { RichTextElementType } from '../internal/constants'; +import { SlackDto } from '../internal/dto'; +import { applyMixins } from '../internal/helpers'; +import { End } from '../internal/methods'; + +export interface RichTextUserParams { + userId?: string; +} + +export interface RichTextUserBuilder extends End { + bold(): this; + italic(): this; + strike(): this; + code(): this; +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@displayName Rich Text User Mention + */ + +export class RichTextUserBuilder extends BitBuilderBase { + /** @internal */ + + public bold(): this { + this.props.style = { ...this.props.style, bold: true }; + return this; + } + + public italic(): this { + this.props.style = { ...this.props.style, italic: true }; + return this; + } + + public strike(): this { + this.props.style = { ...this.props.style, strike: true }; + return this; + } + + public code(): this { + this.props.style = { ...this.props.style, code: true }; + return this; + } + + public build(): Readonly { + const result: Record = { + type: RichTextElementType.User, + user_id: this.props.userId, + }; + + if (this.props.style && Object.keys(this.props.style).length > 0) { + result.style = this.props.style; + } + + return this.getResult(SlackDto, result); + } +} + +applyMixins(RichTextUserBuilder, [ + End, +]); diff --git a/src/bits/rich-text-usergroup.ts b/src/bits/rich-text-usergroup.ts new file mode 100644 index 00000000..07a95a4e --- /dev/null +++ b/src/bits/rich-text-usergroup.ts @@ -0,0 +1,62 @@ +import { BitBuilderBase } from '../internal/base'; +import { RichTextElementType } from '../internal/constants'; +import { SlackDto } from '../internal/dto'; +import { applyMixins } from '../internal/helpers'; +import { End } from '../internal/methods'; + +export interface RichTextUsergroupParams { + usergroupId?: string; +} + +export interface RichTextUsergroupBuilder extends End { + bold(): this; + italic(): this; + strike(): this; + code(): this; +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@displayName Rich Text Usergroup Mention + */ + +export class RichTextUsergroupBuilder extends BitBuilderBase { + /** @internal */ + + public bold(): this { + this.props.style = { ...this.props.style, bold: true }; + return this; + } + + public italic(): this { + this.props.style = { ...this.props.style, italic: true }; + return this; + } + + public strike(): this { + this.props.style = { ...this.props.style, strike: true }; + return this; + } + + public code(): this { + this.props.style = { ...this.props.style, code: true }; + return this; + } + + public build(): Readonly { + const result: Record = { + type: RichTextElementType.Usergroup, + usergroup_id: this.props.usergroupId, + }; + + if (this.props.style && Object.keys(this.props.style).length > 0) { + result.style = this.props.style; + } + + return this.getResult(SlackDto, result); + } +} + +applyMixins(RichTextUsergroupBuilder, [ + End, +]); diff --git a/src/blocks/context-actions.ts b/src/blocks/context-actions.ts new file mode 100644 index 00000000..4093c616 --- /dev/null +++ b/src/blocks/context-actions.ts @@ -0,0 +1,47 @@ +import { BlockBuilderBase } from '../internal/base'; +import { BlockType } from '../internal/constants'; +import { SlackBlockDto } from '../internal/dto'; +import { applyMixins, getBuilderResults } from '../internal/helpers'; +import { + BlockId, + End, +} from '../internal/methods'; + +export interface ContextActionsParams { + blockId?: string; +} + +export interface ContextActionsBuilder extends BlockId, + End { + elements(...elements: unknown[]): this; +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#context_actions + * @@displayName Context Actions + */ + +export class ContextActionsBuilder extends BlockBuilderBase { + /** @internal */ + + /** + * @description Adds elements (FeedbackButtons or IconButton) to the context actions block. + * @param {...unknown[]} elements - FeedbackButtons or IconButton elements. + */ + public elements(...elements: unknown[]): this { + this.props.elements = [...(this.props.elements || []), ...elements].flat(); + return this; + } + + public build(): Readonly { + return this.getResult(SlackBlockDto, { + type: BlockType.ContextActions, + elements: getBuilderResults(this.props.elements), + }); + } +} + +applyMixins(ContextActionsBuilder, [ + BlockId, + End, +]); diff --git a/src/blocks/index.ts b/src/blocks/index.ts index 4648636d..b1c511bb 100644 --- a/src/blocks/index.ts +++ b/src/blocks/index.ts @@ -9,6 +9,10 @@ import { ImageBuilder, ImageParams } from './image'; import { InputBuilder, InputParams } from './input'; import { SectionBuilder, SectionParams } from './section'; import { VideoBuilder, VideoParams } from './video'; +import { RichTextBuilder, RichTextParams } from './rich-text'; +import { MarkdownBuilder, MarkdownParams } from './markdown'; +import { TableBuilder, TableParams } from './table'; +import { ContextActionsBuilder, ContextActionsParams } from './context-actions'; export type { ActionsBuilder, @@ -29,6 +33,14 @@ export type { SectionParams, VideoBuilder, VideoParams, + RichTextBuilder, + RichTextParams, + MarkdownBuilder, + MarkdownParams, + TableBuilder, + TableParams, + ContextActionsBuilder, + ContextActionsParams, }; /** @@ -149,6 +161,51 @@ export function Video(params?: VideoParams): VideoBuilder { return new VideoBuilder(params); } +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. + * + * {@link https://api.slack.com/reference/block-kit/blocks#rich_text|View in Slack API Documentation} + */ + +export function RichText(params?: RichTextParams): RichTextBuilder { + return new RichTextBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. + * @param {string} [params.text] Sets the markdown text content. + * + * {@link https://api.slack.com/reference/block-kit/blocks#markdown|View in Slack API Documentation} + */ + +export function Markdown(params?: MarkdownParams): MarkdownBuilder { + return new MarkdownBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. + * + * {@link https://api.slack.com/reference/block-kit/blocks#table|View in Slack API Documentation} + */ + +export function Table(params?: TableParams): TableBuilder { + return new TableBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. + * + * {@link https://api.slack.com/reference/block-kit/blocks#context_actions|View in Slack API Documentation} + */ + +export function ContextActions(params?: ContextActionsParams): ContextActionsBuilder { + return new ContextActionsBuilder(params); +} + const blocks = { Actions, Context, @@ -159,8 +216,13 @@ const blocks = { Input, Section, Video, + RichText, + Markdown, + Table, + ContextActions, }; // Strange export. I know. For IDE highlighting purposes. export { blocks as Blocks }; + diff --git a/src/blocks/markdown.ts b/src/blocks/markdown.ts new file mode 100644 index 00000000..007d3b72 --- /dev/null +++ b/src/blocks/markdown.ts @@ -0,0 +1,42 @@ +import { BlockBuilderBase } from '../internal/base'; +import { BlockType } from '../internal/constants'; +import { SlackBlockDto } from '../internal/dto'; +import { applyMixins } from '../internal/helpers'; +import { + BlockId, + End, + Text, +} from '../internal/methods'; + +export interface MarkdownParams { + blockId?: string; + text?: string; +} + +export interface MarkdownBuilder extends BlockId, + End, + Text { +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#markdown + * @@displayName Markdown + */ + +export class MarkdownBuilder extends BlockBuilderBase { + /** @internal */ + + public build(): Readonly { + return this.getResult(SlackBlockDto, { + type: BlockType.Markdown, + text: this.props.text, + }); + } +} + +applyMixins(MarkdownBuilder, [ + BlockId, + End, + Text, +]); + diff --git a/src/blocks/rich-text.ts b/src/blocks/rich-text.ts new file mode 100644 index 00000000..7e2352f5 --- /dev/null +++ b/src/blocks/rich-text.ts @@ -0,0 +1,43 @@ +import { BlockBuilderBase } from '../internal/base'; +import { BlockType } from '../internal/constants'; +import { SlackBlockDto } from '../internal/dto'; +import { applyMixins, getBuilderResults } from '../internal/helpers'; +import { + BlockId, + Elements, + End, +} from '../internal/methods'; + +import type { SlackDto } from '../internal/dto'; + +export interface RichTextParams { + blockId?: string; +} + +export interface RichTextBuilder extends BlockId, + End, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + Elements { +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#rich_text + * @@displayName Rich Text + */ + +export class RichTextBuilder extends BlockBuilderBase { + /** @internal */ + + public build(): Readonly { + return this.getResult(SlackBlockDto, { + type: BlockType.RichText, + elements: getBuilderResults(this.props.elements), + }); + } +} + +applyMixins(RichTextBuilder, [ + BlockId, + End, + Elements, +]); diff --git a/src/blocks/table.ts b/src/blocks/table.ts new file mode 100644 index 00000000..cd852fe2 --- /dev/null +++ b/src/blocks/table.ts @@ -0,0 +1,63 @@ +import { BlockBuilderBase } from '../internal/base'; +import { BlockType } from '../internal/constants'; +import { SlackBlockDto } from '../internal/dto'; +import { applyMixins } from '../internal/helpers'; +import { + BlockId, + End, +} from '../internal/methods'; + +interface ColumnSettings { + align?: 'left' | 'center' | 'right'; + is_wrapped?: boolean; +} + +export interface TableParams { + blockId?: string; +} + +export interface TableBuilder extends BlockId, + End { + rows(rows: unknown[][]): this; + columnSettings(settings: ColumnSettings[]): this; +} + +/** + * @@link https://api.slack.com/reference/block-kit/blocks#table + * @@displayName Table + */ + +export class TableBuilder extends BlockBuilderBase { + /** @internal */ + + /** + * @description Sets the table rows. Each row is an array of cells (rich_text or raw_text). + * @param {unknown[][]} rows - Array of rows, each containing cell objects. + */ + public rows(rows: unknown[][]): this { + this.props.rows = rows; + return this; + } + + /** + * @description Sets column behavior settings. + * @param {ColumnSettings[]} settings - Array of column settings with align and is_wrapped options. + */ + public columnSettings(settings: ColumnSettings[]): this { + this.props.columnSettings = settings; + return this; + } + + public build(): Readonly { + return this.getResult(SlackBlockDto, { + type: BlockType.Table, + rows: this.props.rows, + column_settings: this.props.columnSettings, + }); + } +} + +applyMixins(TableBuilder, [ + BlockId, + End, +]); diff --git a/src/elements/feedback-buttons.ts b/src/elements/feedback-buttons.ts new file mode 100644 index 00000000..a8b25ef2 --- /dev/null +++ b/src/elements/feedback-buttons.ts @@ -0,0 +1,72 @@ +import { ElementBuilderBase } from '../internal/base'; +import { ElementType } from '../internal/constants'; +import { SlackElementDto } from '../internal/dto'; +import { applyMixins, getPlainTextObject } from '../internal/helpers'; +import { + ActionId, + End, +} from '../internal/methods'; + +interface FeedbackButtonConfig { + text: string; + value: string; + accessibilityLabel?: string; +} + +export interface FeedbackButtonsParams { + actionId?: string; +} + +export interface FeedbackButtonsBuilder extends ActionId, + End { + positiveButton(config: FeedbackButtonConfig): this; + negativeButton(config: FeedbackButtonConfig): this; +} + +/** + * @@link https://api.slack.com/reference/block-kit/block-elements#feedback_buttons + * @@displayName Feedback Buttons + */ + +export class FeedbackButtonsBuilder extends ElementBuilderBase { + /** @internal */ + + /** + * @description Sets the positive feedback button configuration. + * @param {FeedbackButtonConfig} config - Button configuration with text, value, and optional accessibility label. + */ + public positiveButton(config: FeedbackButtonConfig): this { + this.props.positiveButton = { + text: getPlainTextObject(config.text), + value: config.value, + accessibility_label: config.accessibilityLabel, + }; + return this; + } + + /** + * @description Sets the negative feedback button configuration. + * @param {FeedbackButtonConfig} config - Button configuration with text, value, and optional accessibility label. + */ + public negativeButton(config: FeedbackButtonConfig): this { + this.props.negativeButton = { + text: getPlainTextObject(config.text), + value: config.value, + accessibility_label: config.accessibilityLabel, + }; + return this; + } + + public build(): Readonly { + return this.getResult(SlackElementDto, { + type: ElementType.FeedbackButtons, + positive_button: this.props.positiveButton, + negative_button: this.props.negativeButton, + }); + } +} + +applyMixins(FeedbackButtonsBuilder, [ + ActionId, + End, +]); diff --git a/src/elements/icon-button.ts b/src/elements/icon-button.ts new file mode 100644 index 00000000..abcce4ac --- /dev/null +++ b/src/elements/icon-button.ts @@ -0,0 +1,87 @@ +import { ElementBuilderBase } from '../internal/base'; +import { ElementType } from '../internal/constants'; +import { SlackElementDto } from '../internal/dto'; +import { applyMixins, getPlainTextObject, getBuilderResult } from '../internal/helpers'; +import { + AccessibilityLabel, + ActionId, + End, + Text, + Value, +} from '../internal/methods'; + +import type { SlackDto } from '../internal/dto'; +import type { ConfirmationDialogBuilder } from '../bits'; + +export interface IconButtonParams { + accessibilityLabel?: string; + actionId?: string; + icon?: string; + text?: string; + value?: string; +} + +export interface IconButtonBuilder extends AccessibilityLabel, + ActionId, + End, + Text, + Value { + icon(icon: string): this; + visibleToUserIds(...userIds: string[]): this; + confirm(dialog: ConfirmationDialogBuilder): this; +} + +/** + * @@link https://api.slack.com/reference/block-kit/block-elements#icon_button + * @@displayName Icon Button + */ + +export class IconButtonBuilder extends ElementBuilderBase { + /** @internal */ + + /** + * @description Sets the icon to display on the button (e.g., 'trash', 'edit'). + * @param {string} icon - The icon name. + */ + public icon(icon: string): this { + this.props.icon = icon; + return this; + } + + /** + * @description Sets user IDs for which the icon appears. + * @param {...string[]} userIds - User IDs who can see this button. + */ + public visibleToUserIds(...userIds: string[]): this { + this.props.visibleToUserIds = userIds.flat(); + return this; + } + + /** + * @description Sets a confirmation dialog to be shown before the action is executed. + * @param {ConfirmationDialogBuilder} dialog - A ConfirmationDialog builder. + */ + public confirm(dialog: ConfirmationDialogBuilder): this { + this.props.confirm = dialog; + return this; + } + + public build(): Readonly { + return this.getResult(SlackElementDto, { + type: ElementType.IconButton, + icon: this.props.icon, + text: getPlainTextObject(this.props.text), + confirm: getBuilderResult(this.props.confirm), + visible_to_user_ids: this.props.visibleToUserIds, + }); + } +} + +applyMixins(IconButtonBuilder, [ + AccessibilityLabel, + ActionId, + End, + Text, + Value, +]); + diff --git a/src/elements/index.ts b/src/elements/index.ts index d70c0585..793b2c4b 100644 --- a/src/elements/index.ts +++ b/src/elements/index.ts @@ -23,6 +23,10 @@ import { TimePickerBuilder, TimePickerParams } from './timepicker'; import { URLInputBuilder, URLInputParams } from './url-input'; import { UserMultiSelectBuilder, UserMultiSelectParams } from './user-multi-select'; import { UserSelectBuilder, UserSelectParams } from './user-select'; +import { WorkflowButtonBuilder, WorkflowButtonParams } from './workflow-button'; +import { IconButtonBuilder, IconButtonParams } from './icon-button'; +import { FeedbackButtonsBuilder, FeedbackButtonsParams } from './feedback-buttons'; +import { RichTextInputBuilder, RichTextInputParams } from './rich-text-input'; export type { ButtonBuilder, @@ -71,6 +75,14 @@ export type { UserSelectParams, FileInputBuilder, FileInputParams, + WorkflowButtonBuilder, + WorkflowButtonParams, + IconButtonBuilder, + IconButtonParams, + FeedbackButtonsBuilder, + FeedbackButtonsParams, + RichTextInputBuilder, + RichTextInputParams, }; /** @@ -375,6 +387,54 @@ export function UserSelect(params?: UserSelectParams): UserSelectBuilder { return new UserSelectBuilder(params); } +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.text] Sets the display text for the workflow button. + * @param {string} [params.accessibilityLabel] Sets accessibility label. + * + * {@link https://api.slack.com/reference/block-kit/block-elements#workflow_button|View in Slack API Documentation} + */ + +export function WorkflowButton(params?: WorkflowButtonParams): WorkflowButtonBuilder { + return new WorkflowButtonBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action. + * @param {string} [params.icon] Sets the icon to display. + * @param {string} [params.text] Sets the text for the button. + * + * {@link https://api.slack.com/reference/block-kit/block-elements#icon_button|View in Slack API Documentation} + */ + +export function IconButton(params?: IconButtonParams): IconButtonBuilder { + return new IconButtonBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action. + * + * {@link https://api.slack.com/reference/block-kit/block-elements#feedback_buttons|View in Slack API Documentation} + */ + +export function FeedbackButtons(params?: FeedbackButtonsParams): FeedbackButtonsBuilder { + return new FeedbackButtonsBuilder(params); +} + +/** + * @param {Object} [params] Parameters passed to the constructor. + * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action. + * @param {string} [params.placeholder] Sets placeholder text. + * + * {@link https://api.slack.com/reference/block-kit/block-elements#rich_text_input|View in Slack API Documentation} + */ + +export function RichTextInput(params?: RichTextInputParams): RichTextInputBuilder { + return new RichTextInputBuilder(params); +} + const elements = { Button, ChannelMultiSelect, @@ -399,6 +459,10 @@ const elements = { UserMultiSelect, UserSelect, FileInput, + WorkflowButton, + IconButton, + FeedbackButtons, + RichTextInput, }; // Strange export. I know. For IDE highlighting purposes. diff --git a/src/elements/rich-text-input.ts b/src/elements/rich-text-input.ts new file mode 100644 index 00000000..63762716 --- /dev/null +++ b/src/elements/rich-text-input.ts @@ -0,0 +1,73 @@ +import { ElementBuilderBase } from '../internal/base'; +import { ElementType } from '../internal/constants'; +import { SlackElementDto } from '../internal/dto'; +import { applyMixins, getPlainTextObject, getBuilderResult } from '../internal/helpers'; +import { + ActionId, + End, + FocusOnLoad, + Placeholder, +} from '../internal/methods'; + +import type { SlackDto } from '../internal/dto'; +import type { RichTextBuilder } from '../blocks/rich-text'; + +interface DispatchActionConfig { + trigger_actions_on?: ('on_enter_pressed' | 'on_character_entered')[]; +} + +export interface RichTextInputParams { + actionId?: string; + placeholder?: string; +} + +export interface RichTextInputBuilder extends ActionId, + End, + FocusOnLoad, + Placeholder { + initialValue(value: RichTextBuilder): this; + dispatchActionConfig(config: DispatchActionConfig): this; +} + +/** + * @@link https://api.slack.com/reference/block-kit/block-elements#rich_text_input + * @@displayName Rich Text Input + */ + +export class RichTextInputBuilder extends ElementBuilderBase { + /** @internal */ + + /** + * @description Sets the initial value for the rich text input. + * @param {RichTextBuilder} value - A RichText block builder with initial content. + */ + public initialValue(value: RichTextBuilder): this { + this.props.initialValue = value; + return this; + } + + /** + * @description Configures when to dispatch actions for this input. + * @param {DispatchActionConfig} config - Configuration for action dispatch triggers. + */ + public dispatchActionConfig(config: DispatchActionConfig): this { + this.props.dispatchActionConfig = config; + return this; + } + + public build(): Readonly { + return this.getResult(SlackElementDto, { + type: ElementType.RichTextInput, + placeholder: getPlainTextObject(this.props.placeholder), + initial_value: getBuilderResult(this.props.initialValue), + dispatch_action_config: this.props.dispatchActionConfig, + }); + } +} + +applyMixins(RichTextInputBuilder, [ + ActionId, + End, + FocusOnLoad, + Placeholder, +]); diff --git a/src/elements/workflow-button.ts b/src/elements/workflow-button.ts new file mode 100644 index 00000000..5a643722 --- /dev/null +++ b/src/elements/workflow-button.ts @@ -0,0 +1,84 @@ +import { ElementBuilderBase } from '../internal/base'; +import { ElementType } from '../internal/constants'; +import { SlackElementDto } from '../internal/dto'; +import { applyMixins, getPlainTextObject, getBuilderResult } from '../internal/helpers'; +import { + AccessibilityLabel, + Danger, + End, + Primary, + Text, +} from '../internal/methods'; + +import type { SlackDto } from '../internal/dto'; +import type { ConfirmationDialogBuilder } from '../bits'; + +interface WorkflowTrigger { + url: string; + customizable_input_parameters?: Array<{ + name: string; + value: string; + }>; +} + +interface Workflow { + trigger: WorkflowTrigger; +} + +export interface WorkflowButtonParams { + accessibilityLabel?: string; + text?: string; +} + +export interface WorkflowButtonBuilder extends AccessibilityLabel, + Danger, + End, + Primary, + Text { + workflow(workflow: Workflow): this; + confirm(dialog: ConfirmationDialogBuilder): this; +} + +/** + * @@link https://api.slack.com/reference/block-kit/block-elements#workflow_button + * @@displayName Workflow Button + */ + +export class WorkflowButtonBuilder extends ElementBuilderBase { + /** @internal */ + + /** + * @description Sets the workflow configuration with trigger URL and optional input parameters. + * @param {Workflow} workflow - The workflow configuration object. + */ + public workflow(workflow: Workflow): this { + this.props.workflow = workflow; + return this; + } + + /** + * @description Sets a confirmation dialog to be shown before the workflow is triggered. + * @param {ConfirmationDialogBuilder} dialog - A ConfirmationDialog builder. + */ + public confirm(dialog: ConfirmationDialogBuilder): this { + this.props.confirm = dialog; + return this; + } + + public build(): Readonly { + return this.getResult(SlackElementDto, { + type: ElementType.WorkflowButton, + text: getPlainTextObject(this.props.text), + workflow: this.props.workflow, + confirm: getBuilderResult(this.props.confirm), + }); + } +} + +applyMixins(WorkflowButtonBuilder, [ + AccessibilityLabel, + Danger, + End, + Primary, + Text, +]); diff --git a/src/internal/constants/block-types.ts b/src/internal/constants/block-types.ts index 8044d44e..b69f04f7 100644 --- a/src/internal/constants/block-types.ts +++ b/src/internal/constants/block-types.ts @@ -8,4 +8,8 @@ export enum BlockType { Image = 'image', Header = 'header', Video = 'video', + RichText = 'rich_text', + Markdown = 'markdown', + Table = 'table', + ContextActions = 'context_actions', } diff --git a/src/internal/constants/element-types.ts b/src/internal/constants/element-types.ts index e3db3418..89950e7c 100644 --- a/src/internal/constants/element-types.ts +++ b/src/internal/constants/element-types.ts @@ -22,4 +22,8 @@ export enum ElementType { EmailInput = 'email_text_input', NumberInput = 'number_input', FileInput = 'file_input', + WorkflowButton = 'workflow_button', + IconButton = 'icon_button', + FeedbackButtons = 'feedback_buttons', + RichTextInput = 'rich_text_input', } diff --git a/src/internal/constants/index.ts b/src/internal/constants/index.ts index 29c2cac2..ec56fa11 100644 --- a/src/internal/constants/index.ts +++ b/src/internal/constants/index.ts @@ -10,3 +10,4 @@ export * from './paginator-button-id'; export * from './props'; export * from './response-types'; export * from './surface-types'; +export * from './rich-text-element-types'; diff --git a/src/internal/constants/rich-text-element-types.ts b/src/internal/constants/rich-text-element-types.ts new file mode 100644 index 00000000..662de8e5 --- /dev/null +++ b/src/internal/constants/rich-text-element-types.ts @@ -0,0 +1,18 @@ +export enum RichTextElementType { + // Block-level elements + Section = 'rich_text_section', + List = 'rich_text_list', + Quote = 'rich_text_quote', + Preformatted = 'rich_text_preformatted', + // Inline elements + Text = 'text', + Emoji = 'emoji', + Link = 'link', + User = 'user', + Usergroup = 'usergroup', + Channel = 'channel', + Team = 'team', + Broadcast = 'broadcast', + Color = 'color', + Date = 'date', +} diff --git a/tests/bits/mocks/index.ts b/tests/bits/mocks/index.ts index 5767d3ac..c9d8300b 100644 --- a/tests/bits/mocks/index.ts +++ b/tests/bits/mocks/index.ts @@ -2,3 +2,15 @@ export * as Attachment from './attachment.mock'; export * as ConfirmationDialog from './confirmation-dialog.mock'; export * as Option from './option.mock'; export * as OptionGroup from './option-group.mock'; +export * as RichTextSection from './rich-text-section.mock'; +export * as RichTextList from './rich-text-list.mock'; +export * as RichTextQuote from './rich-text-quote.mock'; +export * as RichTextPreformatted from './rich-text-preformatted.mock'; +export * as RichTextText from './rich-text-text.mock'; +export * as RichTextEmoji from './rich-text-emoji.mock'; +export * as RichTextLink from './rich-text-link.mock'; +export * as RichTextUser from './rich-text-user.mock'; +export * as RichTextChannel from './rich-text-channel.mock'; +export * as RichTextUsergroup from './rich-text-usergroup.mock'; +export * as RichTextBroadcast from './rich-text-broadcast.mock'; +export * as RichTextDate from './rich-text-date.mock'; diff --git a/tests/bits/mocks/rich-text-broadcast.mock.ts b/tests/bits/mocks/rich-text-broadcast.mock.ts new file mode 100644 index 00000000..efb55d21 --- /dev/null +++ b/tests/bits/mocks/rich-text-broadcast.mock.ts @@ -0,0 +1,7 @@ +import { RichTextBroadcastBuilder } from '../../../src/bits/rich-text-broadcast'; + +export const params = { + range: 'here' as const, +}; + +export const mock = new RichTextBroadcastBuilder(params); diff --git a/tests/bits/mocks/rich-text-channel.mock.ts b/tests/bits/mocks/rich-text-channel.mock.ts new file mode 100644 index 00000000..7b1ad04c --- /dev/null +++ b/tests/bits/mocks/rich-text-channel.mock.ts @@ -0,0 +1,7 @@ +import { RichTextChannelBuilder } from '../../../src/bits/rich-text-channel'; + +export const params = { + channelId: 'C1234ABCD', +}; + +export const mock = new RichTextChannelBuilder(params); diff --git a/tests/bits/mocks/rich-text-color.mock.ts b/tests/bits/mocks/rich-text-color.mock.ts new file mode 100644 index 00000000..7a975bef --- /dev/null +++ b/tests/bits/mocks/rich-text-color.mock.ts @@ -0,0 +1,7 @@ +import { RichTextColorBuilder } from '../../../src/bits/rich-text-color'; + +export const params = { + value: '#FF5733', +}; + +export const mock = new RichTextColorBuilder(params); diff --git a/tests/bits/mocks/rich-text-date.mock.ts b/tests/bits/mocks/rich-text-date.mock.ts new file mode 100644 index 00000000..51a2cb35 --- /dev/null +++ b/tests/bits/mocks/rich-text-date.mock.ts @@ -0,0 +1,8 @@ +import { RichTextDateBuilder } from '../../../src/bits/rich-text-date'; + +export const params = { + timestamp: 1628633820, + format: '{date_long}', +}; + +export const mock = new RichTextDateBuilder(params); diff --git a/tests/bits/mocks/rich-text-emoji.mock.ts b/tests/bits/mocks/rich-text-emoji.mock.ts new file mode 100644 index 00000000..80fd9804 --- /dev/null +++ b/tests/bits/mocks/rich-text-emoji.mock.ts @@ -0,0 +1,7 @@ +import { RichTextEmojiBuilder } from '../../../src/bits/rich-text-emoji'; + +export const params = { + name: 'wave', +}; + +export const mock = new RichTextEmojiBuilder(params); diff --git a/tests/bits/mocks/rich-text-link.mock.ts b/tests/bits/mocks/rich-text-link.mock.ts new file mode 100644 index 00000000..08e36b04 --- /dev/null +++ b/tests/bits/mocks/rich-text-link.mock.ts @@ -0,0 +1,8 @@ +import { RichTextLinkBuilder } from '../../../src/bits/rich-text-link'; + +export const params = { + url: 'https://example.com', + text: 'Click here', +}; + +export const mock = new RichTextLinkBuilder(params); diff --git a/tests/bits/mocks/rich-text-list.mock.ts b/tests/bits/mocks/rich-text-list.mock.ts new file mode 100644 index 00000000..f669d8c6 --- /dev/null +++ b/tests/bits/mocks/rich-text-list.mock.ts @@ -0,0 +1,9 @@ +import { RichTextListBuilder } from '../../../src/bits/rich-text-list'; + +export const params = { + style: 'bullet' as const, + indent: 0, + border: 0 as const, +}; + +export const mock = new RichTextListBuilder(params); diff --git a/tests/bits/mocks/rich-text-preformatted.mock.ts b/tests/bits/mocks/rich-text-preformatted.mock.ts new file mode 100644 index 00000000..cc4c1100 --- /dev/null +++ b/tests/bits/mocks/rich-text-preformatted.mock.ts @@ -0,0 +1,7 @@ +import { RichTextPreformattedBuilder } from '../../../src/bits/rich-text-preformatted'; + +export const params = { + border: 0 as const, +}; + +export const mock = new RichTextPreformattedBuilder(params); diff --git a/tests/bits/mocks/rich-text-quote.mock.ts b/tests/bits/mocks/rich-text-quote.mock.ts new file mode 100644 index 00000000..30edb024 --- /dev/null +++ b/tests/bits/mocks/rich-text-quote.mock.ts @@ -0,0 +1,7 @@ +import { RichTextQuoteBuilder } from '../../../src/bits/rich-text-quote'; + +export const params = { + border: 0 as const, +}; + +export const mock = new RichTextQuoteBuilder(params); diff --git a/tests/bits/mocks/rich-text-section.mock.ts b/tests/bits/mocks/rich-text-section.mock.ts new file mode 100644 index 00000000..656b76da --- /dev/null +++ b/tests/bits/mocks/rich-text-section.mock.ts @@ -0,0 +1,5 @@ +import { RichTextSectionBuilder } from '../../../src/bits/rich-text-section'; + +export const params = {}; + +export const mock = new RichTextSectionBuilder(params); diff --git a/tests/bits/mocks/rich-text-team.mock.ts b/tests/bits/mocks/rich-text-team.mock.ts new file mode 100644 index 00000000..67156edd --- /dev/null +++ b/tests/bits/mocks/rich-text-team.mock.ts @@ -0,0 +1,7 @@ +import { RichTextTeamBuilder } from '../../../src/bits/rich-text-team'; + +export const params = { + teamId: 'T1234ABCD', +}; + +export const mock = new RichTextTeamBuilder(params); diff --git a/tests/bits/mocks/rich-text-text.mock.ts b/tests/bits/mocks/rich-text-text.mock.ts new file mode 100644 index 00000000..e9c5355e --- /dev/null +++ b/tests/bits/mocks/rich-text-text.mock.ts @@ -0,0 +1,7 @@ +import { RichTextTextBuilder } from '../../../src/bits/rich-text-text'; + +export const params = { + text: 'Hello, world!', +}; + +export const mock = new RichTextTextBuilder(params); diff --git a/tests/bits/mocks/rich-text-user.mock.ts b/tests/bits/mocks/rich-text-user.mock.ts new file mode 100644 index 00000000..82436040 --- /dev/null +++ b/tests/bits/mocks/rich-text-user.mock.ts @@ -0,0 +1,7 @@ +import { RichTextUserBuilder } from '../../../src/bits/rich-text-user'; + +export const params = { + userId: 'U1234ABCD', +}; + +export const mock = new RichTextUserBuilder(params); diff --git a/tests/bits/mocks/rich-text-usergroup.mock.ts b/tests/bits/mocks/rich-text-usergroup.mock.ts new file mode 100644 index 00000000..efc553d1 --- /dev/null +++ b/tests/bits/mocks/rich-text-usergroup.mock.ts @@ -0,0 +1,7 @@ +import { RichTextUsergroupBuilder } from '../../../src/bits/rich-text-usergroup'; + +export const params = { + usergroupId: 'S1234ABCD', +}; + +export const mock = new RichTextUsergroupBuilder(params); diff --git a/tests/bits/rich-text-broadcast.spec.ts b/tests/bits/rich-text-broadcast.spec.ts new file mode 100644 index 00000000..72910465 --- /dev/null +++ b/tests/bits/rich-text-broadcast.spec.ts @@ -0,0 +1,19 @@ +import { RichTextBroadcastBuilder } from '../../src/bits/rich-text-broadcast'; +import { SlackDto } from '../../src/internal'; +import { RichTextElementType } from '../../src/internal/constants'; + +describe('RichTextBroadcastBuilder', () => { + it('should build with type broadcast', () => { + const result = new RichTextBroadcastBuilder({ range: 'here' }).build() as any; + expect(result).toBeInstanceOf(SlackDto); + expect(result.type).toBe(RichTextElementType.Broadcast); + }); + + it('should apply styles', () => { + const result = new RichTextBroadcastBuilder({ range: 'here' }) + .bold() + .italic() + .build() as any; + expect(result.style).toEqual({ bold: true, italic: true }); + }); +}); diff --git a/tests/bits/rich-text-channel.spec.ts b/tests/bits/rich-text-channel.spec.ts new file mode 100644 index 00000000..f30c9b51 --- /dev/null +++ b/tests/bits/rich-text-channel.spec.ts @@ -0,0 +1,19 @@ +import { RichTextChannelBuilder } from '../../src/bits/rich-text-channel'; +import { SlackDto } from '../../src/internal'; +import { RichTextElementType } from '../../src/internal/constants'; + +describe('RichTextChannelBuilder', () => { + it('should build with type channel', () => { + const result = new RichTextChannelBuilder({ channelId: 'C1234ABCD' }).build() as any; + expect(result).toBeInstanceOf(SlackDto); + expect(result.type).toBe(RichTextElementType.Channel); + }); + + it('should apply styles', () => { + const result = new RichTextChannelBuilder({ channelId: 'C1234ABCD' }) + .bold() + .italic() + .build() as any; + expect(result.style).toEqual({ bold: true, italic: true }); + }); +}); diff --git a/tests/bits/rich-text-color.spec.ts b/tests/bits/rich-text-color.spec.ts new file mode 100644 index 00000000..ad86ea04 --- /dev/null +++ b/tests/bits/rich-text-color.spec.ts @@ -0,0 +1,19 @@ +import { RichTextColorBuilder as Class } from '../../src/bits/rich-text-color'; +import { SlackDto as DtoClass } from '../../src/internal'; +import { params } from './mocks/rich-text-color.mock'; +import { testCompositeBuilderClass } from '../test-composite-builder-class'; + +const className = 'RichTextColor'; +const category = 'Bits'; + +const config = { + Class, + DtoClass, + params, + className, + category, +}; + +const methodsConfig: unknown[] = []; + +testCompositeBuilderClass({ config, methods: methodsConfig }); diff --git a/tests/bits/rich-text-date.spec.ts b/tests/bits/rich-text-date.spec.ts new file mode 100644 index 00000000..fb8c7b9a --- /dev/null +++ b/tests/bits/rich-text-date.spec.ts @@ -0,0 +1,19 @@ +import { RichTextDateBuilder } from '../../src/bits/rich-text-date'; +import { SlackDto } from '../../src/internal'; +import { RichTextElementType } from '../../src/internal/constants'; + +describe('RichTextDateBuilder', () => { + it('should build with type date', () => { + const result = new RichTextDateBuilder({ timestamp: 1628633820 }).build() as any; + expect(result).toBeInstanceOf(SlackDto); + expect(result.type).toBe(RichTextElementType.Date); + }); + + it('should apply styles', () => { + const result = new RichTextDateBuilder({ timestamp: 1628633820 }) + .bold() + .italic() + .build() as any; + expect(result.style).toEqual({ bold: true, italic: true }); + }); +}); diff --git a/tests/bits/rich-text-emoji.spec.ts b/tests/bits/rich-text-emoji.spec.ts new file mode 100644 index 00000000..54de5eb8 --- /dev/null +++ b/tests/bits/rich-text-emoji.spec.ts @@ -0,0 +1,11 @@ +import { RichTextEmojiBuilder } from '../../src/bits/rich-text-emoji'; +import { SlackDto } from '../../src/internal'; +import { RichTextElementType } from '../../src/internal/constants'; + +describe('RichTextEmojiBuilder', () => { + it('should build with type emoji', () => { + const result = new RichTextEmojiBuilder({ name: 'wave' }).build() as any; + expect(result).toBeInstanceOf(SlackDto); + expect(result.type).toBe(RichTextElementType.Emoji); + }); +}); diff --git a/tests/bits/rich-text-link.spec.ts b/tests/bits/rich-text-link.spec.ts new file mode 100644 index 00000000..135ce1a6 --- /dev/null +++ b/tests/bits/rich-text-link.spec.ts @@ -0,0 +1,26 @@ +import { RichTextLinkBuilder } from '../../src/bits/rich-text-link'; +import { SlackDto } from '../../src/internal'; +import { RichTextElementType } from '../../src/internal/constants'; + +describe('RichTextLinkBuilder', () => { + it('should build with type link', () => { + const result = new RichTextLinkBuilder({ url: 'https://example.com' }).build() as any; + expect(result).toBeInstanceOf(SlackDto); + expect(result.type).toBe(RichTextElementType.Link); + }); + + it('should apply bold style', () => { + const result = new RichTextLinkBuilder({ url: 'https://example.com' }) + .bold() + .build() as any; + expect(result.style).toEqual({ bold: true }); + }); + + it('should apply multiple styles', () => { + const result = new RichTextLinkBuilder({ url: 'https://example.com' }) + .bold() + .italic() + .build() as any; + expect(result.style).toEqual({ bold: true, italic: true }); + }); +}); diff --git a/tests/bits/rich-text-list.spec.ts b/tests/bits/rich-text-list.spec.ts new file mode 100644 index 00000000..bc889361 --- /dev/null +++ b/tests/bits/rich-text-list.spec.ts @@ -0,0 +1,11 @@ +import { RichTextListBuilder } from '../../src/bits/rich-text-list'; +import { SlackDto } from '../../src/internal'; +import { RichTextElementType } from '../../src/internal/constants'; + +describe('RichTextListBuilder', () => { + it('should build with type rich_text_list', () => { + const result = new RichTextListBuilder({ style: 'bullet' }).build() as any; + expect(result).toBeInstanceOf(SlackDto); + expect(result.type).toBe(RichTextElementType.List); + }); +}); diff --git a/tests/bits/rich-text-preformatted.spec.ts b/tests/bits/rich-text-preformatted.spec.ts new file mode 100644 index 00000000..17d62c7d --- /dev/null +++ b/tests/bits/rich-text-preformatted.spec.ts @@ -0,0 +1,11 @@ +import { RichTextPreformattedBuilder } from '../../src/bits/rich-text-preformatted'; +import { SlackDto } from '../../src/internal'; +import { RichTextElementType } from '../../src/internal/constants'; + +describe('RichTextPreformattedBuilder', () => { + it('should build with type rich_text_preformatted', () => { + const result = new RichTextPreformattedBuilder().build() as any; + expect(result).toBeInstanceOf(SlackDto); + expect(result.type).toBe(RichTextElementType.Preformatted); + }); +}); diff --git a/tests/bits/rich-text-quote.spec.ts b/tests/bits/rich-text-quote.spec.ts new file mode 100644 index 00000000..92bf227e --- /dev/null +++ b/tests/bits/rich-text-quote.spec.ts @@ -0,0 +1,11 @@ +import { RichTextQuoteBuilder } from '../../src/bits/rich-text-quote'; +import { SlackDto } from '../../src/internal'; +import { RichTextElementType } from '../../src/internal/constants'; + +describe('RichTextQuoteBuilder', () => { + it('should build with type rich_text_quote', () => { + const result = new RichTextQuoteBuilder().build() as any; + expect(result).toBeInstanceOf(SlackDto); + expect(result.type).toBe(RichTextElementType.Quote); + }); +}); diff --git a/tests/bits/rich-text-section.spec.ts b/tests/bits/rich-text-section.spec.ts new file mode 100644 index 00000000..437a9ee7 --- /dev/null +++ b/tests/bits/rich-text-section.spec.ts @@ -0,0 +1,20 @@ +import { RichTextSectionBuilder } from '../../src/bits/rich-text-section'; +import { RichTextTextBuilder } from '../../src/bits/rich-text-text'; +import { SlackDto } from '../../src/internal'; +import { RichTextElementType } from '../../src/internal/constants'; + +describe('RichTextSectionBuilder', () => { + it('should build with type rich_text_section', () => { + const result = new RichTextSectionBuilder().build() as any; + expect(result).toBeInstanceOf(SlackDto); + expect(result.type).toBe(RichTextElementType.Section); + }); + + it('should build with elements', () => { + const result = new RichTextSectionBuilder() + .elements(new RichTextTextBuilder({ text: 'Hello' })) + .build() as any; + expect(result.elements).toHaveLength(1); + expect(result.elements[0].type).toBe(RichTextElementType.Text); + }); +}); diff --git a/tests/bits/rich-text-team.spec.ts b/tests/bits/rich-text-team.spec.ts new file mode 100644 index 00000000..b0be2ccc --- /dev/null +++ b/tests/bits/rich-text-team.spec.ts @@ -0,0 +1,19 @@ +import { RichTextTeamBuilder as Class } from '../../src/bits/rich-text-team'; +import { SlackDto as DtoClass } from '../../src/internal'; +import { params } from './mocks/rich-text-team.mock'; +import { testCompositeBuilderClass } from '../test-composite-builder-class'; + +const className = 'RichTextTeam'; +const category = 'Bits'; + +const config = { + Class, + DtoClass, + params, + className, + category, +}; + +const methodsConfig: unknown[] = []; + +testCompositeBuilderClass({ config, methods: methodsConfig }); diff --git a/tests/bits/rich-text-text.spec.ts b/tests/bits/rich-text-text.spec.ts new file mode 100644 index 00000000..0ad7c568 --- /dev/null +++ b/tests/bits/rich-text-text.spec.ts @@ -0,0 +1,44 @@ +import { RichTextTextBuilder } from '../../src/bits/rich-text-text'; +import { SlackDto } from '../../src/internal'; +import { RichTextElementType } from '../../src/internal/constants'; + +describe('RichTextTextBuilder', () => { + it('should build with type text', () => { + const result = new RichTextTextBuilder({ text: 'Hello' }).build() as any; + expect(result).toBeInstanceOf(SlackDto); + expect(result.type).toBe(RichTextElementType.Text); + }); + + it('should apply bold style', () => { + const result = new RichTextTextBuilder({ text: 'Hello' }).bold().build() as any; + expect(result.style).toEqual({ bold: true }); + }); + + it('should apply italic style', () => { + const result = new RichTextTextBuilder({ text: 'Hello' }).italic().build() as any; + expect(result.style).toEqual({ italic: true }); + }); + + it('should apply strike style', () => { + const result = new RichTextTextBuilder({ text: 'Hello' }).strike().build() as any; + expect(result.style).toEqual({ strike: true }); + }); + + it('should apply code style', () => { + const result = new RichTextTextBuilder({ text: 'Hello' }).code().build() as any; + expect(result.style).toEqual({ code: true }); + }); + + it('should apply multiple styles', () => { + const result = new RichTextTextBuilder({ text: 'Hello' }) + .bold() + .italic() + .build() as any; + expect(result.style).toEqual({ bold: true, italic: true }); + }); + + it('should not include style when no styles applied', () => { + const result = new RichTextTextBuilder({ text: 'Hello' }).build() as any; + expect(result.style).toBeUndefined(); + }); +}); diff --git a/tests/bits/rich-text-user.spec.ts b/tests/bits/rich-text-user.spec.ts new file mode 100644 index 00000000..eadf235e --- /dev/null +++ b/tests/bits/rich-text-user.spec.ts @@ -0,0 +1,19 @@ +import { RichTextUserBuilder } from '../../src/bits/rich-text-user'; +import { SlackDto } from '../../src/internal'; +import { RichTextElementType } from '../../src/internal/constants'; + +describe('RichTextUserBuilder', () => { + it('should build with type user', () => { + const result = new RichTextUserBuilder({ userId: 'U1234ABCD' }).build() as any; + expect(result).toBeInstanceOf(SlackDto); + expect(result.type).toBe(RichTextElementType.User); + }); + + it('should apply styles', () => { + const result = new RichTextUserBuilder({ userId: 'U1234ABCD' }) + .bold() + .italic() + .build() as any; + expect(result.style).toEqual({ bold: true, italic: true }); + }); +}); diff --git a/tests/bits/rich-text-usergroup.spec.ts b/tests/bits/rich-text-usergroup.spec.ts new file mode 100644 index 00000000..794c1ae8 --- /dev/null +++ b/tests/bits/rich-text-usergroup.spec.ts @@ -0,0 +1,19 @@ +import { RichTextUsergroupBuilder } from '../../src/bits/rich-text-usergroup'; +import { SlackDto } from '../../src/internal'; +import { RichTextElementType } from '../../src/internal/constants'; + +describe('RichTextUsergroupBuilder', () => { + it('should build with type usergroup', () => { + const result = new RichTextUsergroupBuilder({ usergroupId: 'S1234ABCD' }).build() as any; + expect(result).toBeInstanceOf(SlackDto); + expect(result.type).toBe(RichTextElementType.Usergroup); + }); + + it('should apply styles', () => { + const result = new RichTextUsergroupBuilder({ usergroupId: 'S1234ABCD' }) + .bold() + .italic() + .build() as any; + expect(result.style).toEqual({ bold: true, italic: true }); + }); +}); diff --git a/tests/blocks/context-actions.spec.ts b/tests/blocks/context-actions.spec.ts new file mode 100644 index 00000000..7fcd38a0 --- /dev/null +++ b/tests/blocks/context-actions.spec.ts @@ -0,0 +1,22 @@ +import { ContextActionsBuilder as Class } from '../../src/blocks/context-actions'; +import { SlackBlockDto as DtoClass } from '../../src/internal'; +import { params } from './mocks/context-actions.mock'; +import * as methods from '../methods'; +import { testCompositeBuilderClass } from '../test-composite-builder-class'; + +const className = 'ContextActionsBuilder'; +const category = 'Blocks'; + +const config = { + Class, + DtoClass, + params, + className, + category, +}; + +const methodsConfig = [ + methods.blockId, +]; + +testCompositeBuilderClass({ config, methods: methodsConfig }); diff --git a/tests/blocks/markdown.spec.ts b/tests/blocks/markdown.spec.ts new file mode 100644 index 00000000..0c398293 --- /dev/null +++ b/tests/blocks/markdown.spec.ts @@ -0,0 +1,22 @@ +import { MarkdownBuilder as Class } from '../../src/blocks/markdown'; +import { SlackBlockDto as DtoClass } from '../../src/internal'; +import { params } from './mocks/markdown.mock'; +import * as methods from '../methods'; +import { testCompositeBuilderClass } from '../test-composite-builder-class'; + +const className = 'MarkdownBuilder'; +const category = 'Blocks'; + +const config = { + Class, + DtoClass, + params, + className, + category, +}; + +const methodsConfig = [ + methods.blockId, +]; + +testCompositeBuilderClass({ config, methods: methodsConfig }); diff --git a/tests/blocks/mocks/context-actions.mock.ts b/tests/blocks/mocks/context-actions.mock.ts new file mode 100644 index 00000000..7d9409a8 --- /dev/null +++ b/tests/blocks/mocks/context-actions.mock.ts @@ -0,0 +1,7 @@ +import { ContextActionsBuilder } from '../../../src/blocks/context-actions'; + +export const params = { + blockId: 'blockId', +}; + +export const mock = new ContextActionsBuilder(params); diff --git a/tests/blocks/mocks/markdown.mock.ts b/tests/blocks/mocks/markdown.mock.ts new file mode 100644 index 00000000..4ff822df --- /dev/null +++ b/tests/blocks/mocks/markdown.mock.ts @@ -0,0 +1,8 @@ +import { MarkdownBuilder } from '../../../src/blocks/markdown'; + +export const params = { + blockId: 'blockId', + text: '# Hello World', +}; + +export const mock = new MarkdownBuilder(params); diff --git a/tests/blocks/mocks/table.mock.ts b/tests/blocks/mocks/table.mock.ts new file mode 100644 index 00000000..62f56a68 --- /dev/null +++ b/tests/blocks/mocks/table.mock.ts @@ -0,0 +1,7 @@ +import { TableBuilder } from '../../../src/blocks/table'; + +export const params = { + blockId: 'blockId', +}; + +export const mock = new TableBuilder(params); diff --git a/tests/blocks/table.spec.ts b/tests/blocks/table.spec.ts new file mode 100644 index 00000000..c3411d90 --- /dev/null +++ b/tests/blocks/table.spec.ts @@ -0,0 +1,22 @@ +import { TableBuilder as Class } from '../../src/blocks/table'; +import { SlackBlockDto as DtoClass } from '../../src/internal'; +import { params } from './mocks/table.mock'; +import * as methods from '../methods'; +import { testCompositeBuilderClass } from '../test-composite-builder-class'; + +const className = 'TableBuilder'; +const category = 'Blocks'; + +const config = { + Class, + DtoClass, + params, + className, + category, +}; + +const methodsConfig = [ + methods.blockId, +]; + +testCompositeBuilderClass({ config, methods: methodsConfig }); diff --git a/tests/elements/feedback-buttons.spec.ts b/tests/elements/feedback-buttons.spec.ts new file mode 100644 index 00000000..33718b8f --- /dev/null +++ b/tests/elements/feedback-buttons.spec.ts @@ -0,0 +1,22 @@ +import { FeedbackButtonsBuilder as Class } from '../../src/elements/feedback-buttons'; +import { SlackElementDto as DtoClass } from '../../src/internal'; +import { params } from './mocks/feedback-buttons.mock'; +import * as methods from '../methods'; +import { testCompositeBuilderClass } from '../test-composite-builder-class'; + +const className = 'FeedbackButtons'; +const category = 'Elements'; + +const config = { + Class, + DtoClass, + params, + className, + category, +}; + +const methodsConfig = [ + methods.actionId, +]; + +testCompositeBuilderClass({ config, methods: methodsConfig }); diff --git a/tests/elements/icon-button.spec.ts b/tests/elements/icon-button.spec.ts new file mode 100644 index 00000000..5787e59e --- /dev/null +++ b/tests/elements/icon-button.spec.ts @@ -0,0 +1,25 @@ +import { IconButtonBuilder as Class } from '../../src/elements/icon-button'; +import { SlackElementDto as DtoClass } from '../../src/internal'; +import { params } from './mocks/icon-button.mock'; +import * as methods from '../methods'; +import { testCompositeBuilderClass } from '../test-composite-builder-class'; + +const className = 'IconButton'; +const category = 'Elements'; + +const config = { + Class, + DtoClass, + params, + className, + category, +}; + +const methodsConfig = [ + methods.actionId, + methods.value, + methods.accessibilityLabel, + methods.text, +]; + +testCompositeBuilderClass({ config, methods: methodsConfig }); diff --git a/tests/elements/mocks/feedback-buttons.mock.ts b/tests/elements/mocks/feedback-buttons.mock.ts new file mode 100644 index 00000000..9e3baf4d --- /dev/null +++ b/tests/elements/mocks/feedback-buttons.mock.ts @@ -0,0 +1,7 @@ +import { FeedbackButtonsBuilder } from '../../../src/elements/feedback-buttons'; + +export const params = { + actionId: 'actionId', +}; + +export const mock = new FeedbackButtonsBuilder(params); diff --git a/tests/elements/mocks/icon-button.mock.ts b/tests/elements/mocks/icon-button.mock.ts new file mode 100644 index 00000000..de96e8dc --- /dev/null +++ b/tests/elements/mocks/icon-button.mock.ts @@ -0,0 +1,11 @@ +import { IconButtonBuilder } from '../../../src/elements/icon-button'; + +export const params = { + actionId: 'actionId', + icon: 'trash', + text: 'Delete', + value: 'delete-value', + accessibilityLabel: 'Delete item', +}; + +export const mock = new IconButtonBuilder(params); diff --git a/tests/elements/mocks/rich-text-input.mock.ts b/tests/elements/mocks/rich-text-input.mock.ts new file mode 100644 index 00000000..6c480adc --- /dev/null +++ b/tests/elements/mocks/rich-text-input.mock.ts @@ -0,0 +1,8 @@ +import { RichTextInputBuilder } from '../../../src/elements/rich-text-input'; + +export const params = { + actionId: 'actionId', + placeholder: 'Enter rich text...', +}; + +export const mock = new RichTextInputBuilder(params); diff --git a/tests/elements/mocks/workflow-button.mock.ts b/tests/elements/mocks/workflow-button.mock.ts new file mode 100644 index 00000000..2be59edc --- /dev/null +++ b/tests/elements/mocks/workflow-button.mock.ts @@ -0,0 +1,8 @@ +import { WorkflowButtonBuilder } from '../../../src/elements/workflow-button'; + +export const params = { + accessibilityLabel: 'Run workflow button', + text: 'Run Workflow', +}; + +export const mock = new WorkflowButtonBuilder(params); diff --git a/tests/elements/rich-text-input.spec.ts b/tests/elements/rich-text-input.spec.ts new file mode 100644 index 00000000..4d0b11b0 --- /dev/null +++ b/tests/elements/rich-text-input.spec.ts @@ -0,0 +1,24 @@ +import { RichTextInputBuilder as Class } from '../../src/elements/rich-text-input'; +import { SlackElementDto as DtoClass } from '../../src/internal'; +import { params } from './mocks/rich-text-input.mock'; +import * as methods from '../methods'; +import { testCompositeBuilderClass } from '../test-composite-builder-class'; + +const className = 'RichTextInput'; +const category = 'Elements'; + +const config = { + Class, + DtoClass, + params, + className, + category, +}; + +const methodsConfig = [ + methods.actionId, + methods.placeholder, + methods.focusOnLoad, +]; + +testCompositeBuilderClass({ config, methods: methodsConfig }); diff --git a/tests/elements/workflow-button.spec.ts b/tests/elements/workflow-button.spec.ts new file mode 100644 index 00000000..33b51552 --- /dev/null +++ b/tests/elements/workflow-button.spec.ts @@ -0,0 +1,23 @@ +import { WorkflowButtonBuilder as Class } from '../../src/elements/workflow-button'; +import { SlackElementDto as DtoClass } from '../../src/internal'; +import { params } from './mocks/workflow-button.mock'; +import * as methods from '../methods'; +import { testCompositeBuilderClass } from '../test-composite-builder-class'; + +const className = 'WorkflowButton'; +const category = 'Elements'; + +const config = { + Class, + DtoClass, + params, + className, + category, +}; + +const methodsConfig = [ + methods.accessibilityLabel, + methods.text, +]; + +testCompositeBuilderClass({ config, methods: methodsConfig }); diff --git a/tmp-docs/block-elements.ts b/tmp-docs/block-elements.ts new file mode 100644 index 00000000..806561d7 --- /dev/null +++ b/tmp-docs/block-elements.ts @@ -0,0 +1,1047 @@ +// This file contains objects documented here: https://docs.slack.dev/reference/block-kit/block-elements + +import type { RichTextBlock } from './blocks'; +import type { + ColorScheme, + Option, + PlainTextElement, + PlainTextOption, + SlackFileImageObject, + UrlImageObject, +} from './composition-objects'; +import type { + Actionable, + Confirmable, + Dispatchable, + Focusable, + MaxItemsSelectable, + Placeholdable, + RichTextBorderable, + RichTextStyleable, + URLRespondable, +} from './extensions'; + +/** + * @description Allows users a direct path to performing basic actions. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/button-element Button element reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interactionThis is an interactive component - see our guide to enabling interactivity}. + */ +export interface Button extends Actionable, Confirmable { + /** + * @description The type of element. In this case `type` is always `button`. + */ + type: 'button'; + /** + * @description A {@link PlainTextElement} that defines the button's text. `text` may truncate with ~30 characters. + * Maximum length for the text in this field is 75 characters. + */ + text: PlainTextElement; + /** + * @description The value to send along with the {@link https://docs.slack.dev/interactivity/handling-user-interaction#payloads interaction payload}. + * Maximum length for this field is 2000 characters. + */ + value?: string; + /** + * @description A URL to load in the user's browser when the button is clicked. Maximum length for this field is 3000 + * characters. If you're using `url`, you'll still receive an {@link https://docs.slack.dev/interactivity/handling-user-interaction#payloads interaction payload} + * and will need to send an {@link https://docs.slack.dev/interactivity/handling-user-interaction#acknowledgment_response acknowledgement response}. + */ + url?: string; + /** + * @description Decorates buttons with alternative visual color schemes. Use this option with restraint. + * `primary` gives buttons a green outline and text, ideal for affirmation or confirmation actions. `primary` should + * only be used for one button within a set. + * `danger` gives buttons a red outline and text, and should be used when the action is destructive. Use `danger` even + * more sparingly than primary. + * If you don't include this field, the default button style will be used. + */ + style?: ColorScheme; + /** + * @description A label for longer descriptive text about a button element. This label will be read out by screen + * readers instead of the button `text` object. Maximum length for this field is 75 characters. + */ + accessibility_label?: string; +} + +/** + * @description Allows users to choose multiple items from a list of options. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/checkboxes-element Checkboxes element reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface Checkboxes extends Actionable, Confirmable, Focusable { + /** + * @description The type of element. In this case `type` is always `checkboxes`. + */ + type: 'checkboxes'; + /** + * @description An array of {@link Option} objects that exactly matches one or more of the options within `options`. + * These options will be selected when the checkbox group initially loads. + */ + initial_options?: Option[]; + /** + * @description An array of {@link Option} objects. A maximum of 10 options are allowed. + */ + options: Option[]; +} + +/** + * @description Allows users to select a date from a calendar style UI. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/date-picker-element Date picker element reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface Datepicker extends Actionable, Confirmable, Focusable, Placeholdable { + /** + * @description The type of element. In this case `type` is always `datepicker`. + */ + type: 'datepicker'; + /** + * @description The initial date that is selected when the element is loaded. + * This should be in the format `YYYY-MM-DD`. + */ + initial_date?: string; +} + +/** + * @description Allows users to select both a date and a time of day, formatted as a Unix timestamp. On desktop + * clients, this time picker will take the form of a dropdown list and the date picker will take the form of a dropdown + * calendar. Both options will have free-text entry for precise choices. On mobile clients, the time picker and date + * picker will use native UIs. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/datetime-picker-element Datetime picker element reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface DateTimepicker extends Actionable, Confirmable, Focusable { + /** + * @description The type of element. In this case `type` is always `datetimepicker`. + */ + type: 'datetimepicker'; + /** + * @description The initial date and time that is selected when the element is loaded, represented as a UNIX + * timestamp in seconds. This should be in the format of 10 digits, for example `1628633820` represents the date and + * time August 10th, 2021 at 03:17pm PST. + */ + initial_date_time?: number; +} + +/** + * @description Allows user to enter an email into a single-line field. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/email-input-element Email input element reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface EmailInput extends Actionable, Dispatchable, Focusable, Placeholdable { + /** + * @description The type of element. In this case `type` is always `email_text_input`. + */ + type: 'email_text_input'; + /** + * @description The initial value in the email input when it is loaded. + */ + initial_value?: string; +} + +/** + * @description Buttons to indicate positive or negative feedback. + */ +export interface FeedbackButtons extends Actionable { + /** + * @description The type of block. For a feedback buttons block, `type` is always `feedback_buttons`. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/feedback-buttons-element Feedback buttons element reference}. + */ + type: 'feedback_buttons'; + /** + * @description A button to indicate positive feedback. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/feedback-buttons-element/#button-object-fields Feedback buttons object fields reference}. + */ + positive_button: { + /** + * @description Defines an object containing some text. + * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}. + */ + text: PlainTextElement; + /** + * @description A label for longer descriptive text about a button element. This label will be read out by screen readers instead of the button `text` object. Maximum length for this field is 75 characters. + */ + accessibility_label?: string; + /** + * @description The positive feedback button value. + */ + value: string; + }; + /** + * @description A button to indicate negative feedback. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/feedback-buttons-element/#button-object-fields Feedback buttons object fields reference}. + */ + negative_button: { + /** + * @description Defines an object containing some text. + * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}. + */ + text: PlainTextElement; + /** + * @description A label for longer descriptive text about a button element. This label will be read out by screen readers instead of the button `text` object. Maximum length for this field is 75 characters. + */ + accessibility_label?: string; + /** + * @description The negative feedback button value. + */ + value: string; + }; +} + +/** + * @description Allows user to upload files. In order to use the `file_input` element within your app, + * your app must have the `files:read` scope. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/file-input-element File input element reference}. + */ +export interface FileInput extends Actionable { + /** + * @description The type of element. In this case `type` is always `file_input`. + */ + type: 'file_input'; + /** + * @description An array of valid {@link https://docs.slack.dev/reference/objects/file-object file extensions} that will be accepted + * for this element. All file extensions will be accepted if `filetypes` is not specified. This validation is provided + * for convenience only, and you should perform your own file type validation based on what you expect to receive. + */ + filetypes?: string[]; + /** + * @description Maximum number of files that can be uploaded for this `file_input` element. Minimum of `1`, maximum of + * `10`. Defaults to `10` if not specified. + */ + max_files?: number; +} + +/** + * @description An icon button to perform actions. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/icon-button-element Icon button element reference}. + */ +export interface IconButton extends Actionable, Confirmable { + /** + * @description The type of element. In this case `type` is always `icon_button`. + */ + type: 'icon_button'; + /** + * @description The icon to show. + * @example trash + */ + icon: string; + /** + * @description Defines an object containing some text. + * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}. + */ + text: PlainTextElement; + /** + * @description A label for longer descriptive text about a button element. This label will be read out by screen readers instead of the button `text` object. Maximum length for this field is 75 characters. + */ + accessibility_label?: string; + /** + * @description The button value. + */ + value?: string; + /** + * @description User IDs for which the icon appears. + */ + visible_to_user_ids?: string[]; +} + +/** + * @description Displays an image as part of a larger block of content. Use this `image` block if you want a block with + * only an image in it. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/image-element Image element reference}. + */ +export type ImageElement = { + /** + * @description The type of element. In this case `type` is always `image`. + */ + type: 'image'; + /** + * @description A plain-text summary of the image. This should not contain any markup. + */ + alt_text: string; +} & (UrlImageObject | SlackFileImageObject); + +/* + * Multi-select and Select menus follow + */ + +// Selects and Multiselects are available in different surface areas so I've separated them here +/** + * @description Allows users to choose an option from a drop down menu. + * The select menu also includes type-ahead functionality, where a user can type a part or all of an option string to + * filter the list. There are different types of select menu elements that depend on different data sources for their + * lists of options: {@link StaticSelect}, {@link ExternalSelect}, {@link UsersSelect}, {@link ConversationsSelect}, + * {@link ChannelsSelect}. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element Select menu element reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export type Select = UsersSelect | StaticSelect | ConversationsSelect | ChannelsSelect | ExternalSelect; + +/** + * @description Allows users to select multiple items from a list of options. + * Just like regular {@link Select}, multi-select menus also include type-ahead functionality, where a user can type a + * part or all of an option string to filter the list. + * There are different types of multi-select menu that depend on different data sources for their lists of options: + * {@link MultiStaticSelect}, {@link MultiExternalSelect}, {@link MultiUsersSelect}, {@link MultiConversationsSelect}, + * {@link MultiChannelsSelect}. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menus-element Multi-select menu element reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export type MultiSelect = + | MultiUsersSelect + | MultiStaticSelect + | MultiConversationsSelect + | MultiChannelsSelect + | MultiExternalSelect; + +/** + * @description This select menu will populate its options with a list of Slack users visible to the current user in the + * active workspace. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#users_select Select menu of users reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface UsersSelect extends Actionable, Confirmable, Focusable, Placeholdable { + /** + * @description The type of element. In this case `type` is always `users_select`. + */ + type: 'users_select'; + /** + * @description The user ID of any valid user to be pre-selected when the menu loads. + */ + initial_user?: string; +} + +/** + * @description This multi-select menu will populate its options with a list of Slack users visible to the current user + * in the active workspace. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#users_multi_select Multi-select menu of users reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface MultiUsersSelect extends Actionable, Confirmable, Focusable, MaxItemsSelectable, Placeholdable { + /** + * @description The type of element. In this case `type` is always `multi_users_select`. + */ + type: 'multi_users_select'; + /** + * @description An array of user IDs of any valid users to be pre-selected when the menu loads. + */ + initial_users?: string[]; +} + +/** + * @description This is the simplest form of select menu, with a static list of options passed in when defining the + * element. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#static_select Select menu of static options reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface StaticSelect extends Actionable, Confirmable, Focusable, Placeholdable { + /** + * @description The type of element. In this case `type` is always `static_select`. + */ + type: 'static_select'; + // TODO: breaking change: use discriminative union and separate types for static select of options vs. option groups + /** + * @description A single option that exactly matches one of the options within `options` or `option_groups`. + * This option will be selected when the menu initially loads. + */ + initial_option?: PlainTextOption; + // TODO: breaking change: use discriminative union and separate types for static select of options vs. option groups + // so this is not always optional. Also in theory this should support mrkdown options too? + /** + * @description An array of {@link PlainTextOption}. Maximum number of options is 100. If `option_groups` is + * specified, this field should not be. + */ + options?: PlainTextOption[]; + // TODO: breaking change: use composition-objects.ts' `OptionGroup` - which allows both plaintext and mrkdown + // options, whereas the below doesn't. Also use a discriminative union here to separate option vs. option groups + // static menu. + /** + * @description An array of option group objects. Maximum number of option groups is 100. If `options` is specified, + * this field should not be. + */ + option_groups?: { + label: PlainTextElement; + options: PlainTextOption[]; + }[]; +} + +/** + * @description This is the simplest form of select menu, with a static list of options passed in when defining the + * element. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#static_multi_select Multi-select menu of static options reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface MultiStaticSelect extends Actionable, Confirmable, Focusable, MaxItemsSelectable, Placeholdable { + /** + * @description The type of element. In this case `type` is always `multi_static_select`. + */ + type: 'multi_static_select'; + // TODO: breaking change: use discriminative union and separate types for static select of options vs. option groups + /** + * @description An array of option objects that exactly match one or more of the options within `options` or + * `option_groups`. These options will be selected when the menu initially loads. + */ + initial_options?: PlainTextOption[]; + // TODO: breaking change: use discriminative union and separate types for static select of options vs. option groups + // so this is not always optional. Also in theory this should support mrkdown options too? + /** + * @description An array of {@link PlainTextOption}. Maximum number of options is 100. If `option_groups` is + * specified, this field should not be. + */ + options?: PlainTextOption[]; + // TODO: breaking change: use composition-objects.ts' `OptionGroup` - which allows both plaintext and mrkdown + // options, whereas the below doesn't. Also use a discriminative union here to separate option vs. option groups + // static menu. + /** + * @description An array of option group objects. Maximum number of option groups is 100. If `options` is specified, + * this field should not be. + */ + option_groups?: { + label: PlainTextElement; + options: PlainTextOption[]; + }[]; +} + +/** + * @description This select menu will populate its options with a list of public and private channels, DMs, and MPIMs + * visible to the current user in the active workspace. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#conversations_select Select menu of conversations reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface ConversationsSelect extends Actionable, Confirmable, Focusable, Placeholdable, URLRespondable { + /** + * @description The type of element. In this case `type` is always `conversations_select`. + */ + type: 'conversations_select'; + /** + * @description The ID of any valid conversation to be pre-selected when the menu loads. If + * `default_to_current_conversation` is also supplied, `initial_conversation` will take precedence. + */ + initial_conversation?: string; + /** + * @description Pre-populates the select menu with the conversation that the user was viewing when they opened the + * modal, if available. Default is `false`. + */ + default_to_current_conversation?: boolean; + /** + * @description A filter object that reduces the list of available conversations using the specified criteria. + */ + filter?: { + // TODO: breaking change: replace with ConversationFilter object from composition-objects + include?: ('im' | 'mpim' | 'private' | 'public')[]; + exclude_external_shared_channels?: boolean; + exclude_bot_users?: boolean; + }; +} + +// TODO: breaking change: maybe can use a discriminative union to differentiate between a multi-select convo element +// that uses `default_to_current_conversation` vs. `initial_conversation`? +/** + * @description This multi-select menu will populate its options with a list of public and private channels, DMs, and + * MPIMs visible to the current user in the active workspace. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#conversation_multi_select Multi-select menu of conversations reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface MultiConversationsSelect + extends Actionable, + Confirmable, + Focusable, + MaxItemsSelectable, + Placeholdable { + /** + * @description The type of element. In this case `type` is always `conversations_select`. + */ + type: 'multi_conversations_select'; + // TODO: breaking change: change array type to formalize 'at least one element' requirement. + /** + * @description An array of one or more IDs of any valid conversations to be pre-selected when the menu loads. If + * `default_to_current_conversation` is also supplied, `initial_conversation` will be ignored. + */ + initial_conversations?: string[]; + /** + * @description Pre-populates the select menu with the conversation that the user was viewing when they opened the + * modal, if available. Default is `false`. + */ + default_to_current_conversation?: boolean; + /** + * @description A filter object that reduces the list of available conversations using the specified criteria. + */ + filter?: { + // TODO: breaking change: replace with ConversationFilter object from composition-objects + include?: ('im' | 'mpim' | 'private' | 'public')[]; + exclude_external_shared_channels?: boolean; + exclude_bot_users?: boolean; + }; +} + +/** + * @description This select menu will populate its options with a list of public channels visible to the current user + * in the active workspace. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#channels_select Select menu of public channels reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface ChannelsSelect extends Actionable, Confirmable, Focusable, Placeholdable, URLRespondable { + /** + * @description The type of element. In this case `type` is always `channels_select`. + */ + type: 'channels_select'; + /** + * @description The ID of any valid public channel to be pre-selected when the menu loads. + */ + initial_channel?: string; +} + +/** + * @description This multi-select menu will populate its options with a list of public channels visible to the current + * user in the active workspace. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#channel_multi_select Multi-select menu of public channels reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface MultiChannelsSelect extends Actionable, Confirmable, Focusable, MaxItemsSelectable, Placeholdable { + /** + * @description The type of element. In this case `type` is always `multi_channels_select`. + */ + type: 'multi_channels_select'; + // TODO: breaking change: change type to enforce 'at least one' array restriction + /** + * @description An array of one or more IDs of any valid public channel to be pre-selected when the menu loads. + */ + initial_channels?: string[]; +} + +/** + * @description This select menu will load its options from an external data source, allowing for a dynamic list of + * options. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#external_select Select menu of external data source reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface ExternalSelect extends Actionable, Confirmable, Focusable, Placeholdable { + /** + * @description The type of element. In this case `type` is always `external_select`. + */ + type: 'external_select'; + // TODO: breaking change: should be able to support both options and option groups, both mrkdwn and plaintext + /** + * @description A single option to be selected when the menu initially loads. + */ + initial_option?: PlainTextOption; + /** + * @description When the typeahead field is used, a request will be sent on every character change. If you prefer + * fewer requests or more fully ideated queries, use the `min_query_length` attribute to tell Slack the fewest number + * of typed characters required before dispatch. The default value is `3`. + */ + min_query_length?: number; +} + +/** + * @description This menu will load its options from an external data source, allowing for a dynamic list of options. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#external_multi_select Multi-select menu of external data source reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface MultiExternalSelect extends Actionable, Confirmable, Focusable, MaxItemsSelectable, Placeholdable { + /** + * @description The type of element. In this case `type` is always `multi_external_select`. + */ + type: 'multi_external_select'; + // TODO: breaking change: should be able to support both options and option groups, both mrkdwn and plaintext + /** + * @description An array of options to be selected when the menu initially loads. + */ + initial_options?: PlainTextOption[]; + /** + * @description When the typeahead field is used, a request will be sent on every character change. If you prefer + * fewer requests or more fully ideated queries, use the `min_query_length` attribute to tell Slack the fewest number + * of typed characters required before dispatch. The default value is `3`. + */ + min_query_length?: number; +} + +/* + * End of select/multi-select menus + */ + +/** + * @description Allows user to enter a number into a single-line field. The number input element accepts both whole and + * decimal numbers. For example, 0.25, 5.5, and -10 are all valid input values. Decimal numbers are only allowed when + * `is_decimal_allowed` is equal to `true`. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/number-input-element Number input element reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface NumberInput extends Actionable, Dispatchable, Focusable, Placeholdable { + /** + * @description The type of element. In this case `type` is always `number_input`. + */ + type: 'number_input'; + /** + * @description Decimal numbers are allowed if this property is `true`, set the value to `false` otherwise. + */ + is_decimal_allowed: boolean; + /** + * @description The initial value in the input when it is loaded. + */ + initial_value?: string; + /** + * @description The minimum value, cannot be greater than `max_value`. + */ + min_value?: string; + /** + * @description The maximum value, cannot be less than `min_value`. + */ + max_value?: string; +} + +/** + * @description Allows users to press a button to view a list of options. + * Unlike the select menu, there is no typeahead field, and the button always appears with an ellipsis ('…') rather + * than customizable text. As such, it is usually used if you want a more compact layout than a select menu, or to + * supply a list of less visually important actions after a row of buttons. You can also specify simple URL links as + * overflow menu options, instead of actions. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/overflow-menu-element Overflow menu element reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface Overflow extends Actionable, Confirmable { + /** + * @description The type of element. In this case `type` is always `number_input`. + */ + type: 'overflow'; + // TODO: breaking change: this should support mrkdown options too? + /** + * @description An array of up to 5 {@link PlainTextOption} to display in the menu. + */ + options: PlainTextOption[]; +} + +/** + * @description Allows users to enter freeform text data into a single-line or multi-line field. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/plain-text-input-element Plain-text input element reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface PlainTextInput extends Actionable, Dispatchable, Focusable, Placeholdable { + /** + * @description The type of element. In this case `type` is always `plain_text_input`. + */ + type: 'plain_text_input'; + /** + * @description The initial value in the plain-text input when it is loaded. + */ + initial_value?: string; + /** + * @description Indicates whether the input will be a single line (`false`) or a larger textarea (`true`). + * Defaults to `false`. + */ + multiline?: boolean; + /** + * @description The minimum length of input that the user must provide. If the user provides less, they will receive + * an error. Maximum value is 3000. + */ + min_length?: number; + /** + * @description The maximum length of input that the user can provide. If the user provides more, + * they will receive an error. + */ + max_length?: number; +} + +/** + * @description Allows users to choose one item from a list of possible options. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/radio-button-group-element Radio button group element reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface RadioButtons extends Actionable, Confirmable, Focusable { + /** + * @description The type of element. In this case `type` is always `radio_buttons`. + */ + type: 'radio_buttons'; + /** + * @description An {@link Option} object that exactly matches one of the options within `options`. This option will + * be selected when the radio button group initially loads. + */ + initial_option?: Option; + /** + * @description An array of {@link Option} objects. A maximum of 10 options are allowed. + */ + options: Option[]; +} + +/** + * @description Allows users to choose a time from a rich dropdown UI. On desktop clients, this time picker will take + * the form of a dropdown list with free-text entry for precise choices. On mobile clients, the time picker will use + * native time picker UIs. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/time-picker-element Time picker element reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface Timepicker extends Actionable, Confirmable, Focusable, Placeholdable { + /** + * @description The type of element. In this case `type` is always `timepicker`. + */ + type: 'timepicker'; + /** + * @description The initial time that is selected when the element is loaded. This should be in the format `HH:mm`, + * where `HH` is the 24-hour format of an hour (00 to 23) and `mm` is minutes with leading zeros (00 to 59), + * for example 22:25 for 10:25pm. + */ + initial_time?: string; + /** + * @description A string in the IANA format, e.g. 'America/Chicago'. The timezone is displayed to end users as hint + * text underneath the time picker. It is also passed to the app upon certain interactions, such as view_submission. + */ + timezone?: string; +} + +/** + * @description Allows user to enter a URL into a single-line field. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/url-input-element URL input element reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface URLInput extends Actionable, Dispatchable, Focusable, Placeholdable { + /** + * @description The type of element. In this case `type` is always `url_text_input`. + */ + type: 'url_text_input'; + /** + * @description The initial value in the URL input when it is loaded. + */ + initial_value?: string; +} + +/** + * @description Allows users to run a {@link https://docs.slack.dev/tools/deno-slack-sdk/guides/creating-link-triggers/#workflow_buttons link trigger} with customizable inputs. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/workflow-button-element Workflow button element reference}. + */ +export interface WorkflowButton extends Confirmable { + /** + * @description The type of element. In this case `type` is always `workflow_button`. + */ + type: 'workflow_button'; + /** + * @description A {@link PlainTextElement} that defines the button's text. `text` may truncate with ~30 characters. + * Maximum length for the `text` in this field is 75 characters. + */ + text: PlainTextElement; + /** + * @description A workflow object that contains details about the workflow that will run when the button is clicked. + */ + workflow: { + /** + * @description Properties of the {@link https://docs.slack.dev/tools/deno-slack-sdk/guides/creating-link-triggers/#workflow_buttons link trigger} + * that will be invoked via this button. + */ + trigger: { + /** + * @description The trigger URL of the {@link https://docs.slack.dev/tools/deno-slack-sdk/guides/creating-link-triggers/#workflow_buttons link trigger} + */ + url: string; + /** + * @description List of customizable input parameters and their values. Should match input parameters specified on + * the provided trigger. + */ + customizable_input_parameters?: { + /** + * @description Name of the customizable input, which should be the name of a workflow input parameter for the + * matching workflow of the link trigger. + */ + name: string; + /** + * @description The value of the customizable input parameter. The type of the value is expected to match the + * specified type for the matching workflow input parameter. + */ + value: string; + }[]; + }; + }; + /** + * @description Decorates buttons with alternative visual color schemes. Use this option with restraint. + * `primary` gives buttons a green outline and text, ideal for affirmation or confirmation actions. `primary` should + * only be used for one button within a set. + * `danger` gives buttons a red outline and text, and should be used when the action is destructive. Use `danger` even + * more sparingly than primary. + * If you don't include this field, the default button style will be used. + */ + style?: ColorScheme; + /** + * @description A label for longer descriptive text about a button element. This label will be read out by screen + * readers instead of the button `text` object. Maximum length for this field is 75 characters. + */ + accessibility_label?: string; +} + +/** + * @description A broadcast mention element for use in a rich text message. + */ +export interface RichTextBroadcastMention extends RichTextStyleable { + /** + * @description The type of element. In this case `type` is always `broadcast`. + */ + type: 'broadcast'; + /** + * @description The range of the broadcast; can be one of `here`, `channel` and `everyone`. + */ + range: 'here' | 'channel' | 'everyone'; +} + +/** + * @description A hex color element for use in a rich text message. + */ +export interface RichTextColor extends RichTextStyleable { + /** + * @description The type of element. In this case `type` is always `color`. + */ + type: 'color'; + /** + * @description The hex value for the color. + */ + value: string; +} + +/** + * @description A channel mention element for use in a rich text message. + */ +export interface RichTextChannelMention extends RichTextStyleable { + /** + * @description The type of element. In this case `type` is always `channel`. + */ + type: 'channel'; + /** + * @description The encoded channel ID, e.g. C1234ABCD. + */ + channel_id: string; +} + +/** + * @description A date element for use in a rich text message. + */ +export interface RichTextDate extends RichTextStyleable { + /** + * @description The type of element. In this case `type` is always `date`. + */ + type: 'date'; + /** + * @description A UNIX timestamp for the date to be displayed in seconds. + */ + timestamp: number; + /** + * @description A template string containing curly-brace-enclosed tokens to substitute your provided `timestamp` + * in a particularly-formatted way. For example: `Posted at {date_long}`. The available date formatting tokens are: + * - `{day_divider_pretty}`: Shows `today`, `yesterday` or `tomorrow` if applicable. Otherwise, if the date is in + * current year, uses the `{date_long}` format without the year. Otherwise, falls back to using the `{date_long}` + * format. + * - `{date_num}`: Shows date as YYYY-MM-DD. + * - `{date_slash}`: Shows date as DD/MM/YYYY (subject to locale preferences). + * - `{date_long}`: Shows date as a long-form sentence including day-of-week, e.g. `Monday, December 23rd, 2013`. + * - `{date_long_full}`: Shows date as a long-form sentence without day-of-week, e.g. `August 9, 2020`. + * - `{date_long_pretty}`: Shows `yesterday`, `today` or `tomorrow`, otherwise uses the `{date_long}` format. + * - `{date}`: Same as `{date_long_full}` but without the year. + * - `{date_pretty}`: Shows `today`, `yesterday` or `tomorrow` if applicable, otherwise uses the `{date}` format. + * - `{date_short}`: Shows date using short month names without day-of-week, e.g. `Aug 9, 2020`. + * - `{date_short_pretty}`: Shows `today`, `yesterday` or `tomorrow` if applicable, otherwise uses the `{date_short}` + * format. + * - `{time}`: Depending on user preferences, shows just the time-of-day portion of the timestamp using either 12 or + * 24 hour clock formats, e.g. `2:34 PM` or `14:34`. + * - `{time_secs}`: Depending on user preferences, shows just the time-of-day portion of the timestamp using either 12 + * or 24 hour clock formats, including seconds, e.g. `2:34:56 PM` or `14:34:56`. + * - `{ago}`: A human-readable period of time, e.g. `3 minutes ago`, `4 hours ago`, `2 days ago`. + * TODO: test/document `{member_local_time}`, `{status_expiration}` and `{calendar_header}` + */ + format: string; + /** + * @description URL to link the entire `format` string to. + */ + url?: string; + /** + * @description Text to display in place of the date should parsing, formatting or displaying fails. + */ + fallback?: string; +} + +/** + * @description An emoji element for use in a rich text message. + */ +export interface RichTextEmoji extends RichTextStyleable { + /** + * @description The type of element. In this case `type` is always `emoji`. + */ + type: 'emoji'; + /** + * @description Name of emoji, without colons or skin tones, e.g. `wave` + */ + name: string; + /** + * @description Lowercase hexadecimal Unicode representation of a standard emoji (not for use with custom emoji). + */ + unicode?: string; + /** + * @description URL of emoji asset. Only used when sharing custom emoji across workspaces. + */ + url?: string; +} + +/** + * @description A link element for use in a rich text message. + */ +export interface RichTextLink extends RichTextStyleable { + /** + * @description The type of element. In this case `type` is always `link`. + */ + type: 'link'; + /** + * @description The text to link. + */ + text?: string; + /** + * @description TODO: ? + */ + unsafe?: boolean; + /** + * @description URL to link to. + */ + url: string; +} + +/** + * @description A workspace or team mention element for use in a rich text message. + */ +export interface RichTextTeamMention extends RichTextStyleable { + /** + * @description The type of element. In this case `type` is always `team`. + */ + type: 'team'; + /** + * @description The encoded team ID, e.g. T1234ABCD. + */ + team_id: string; +} + +/** + * @description A generic text element for use in a rich text message. + */ +export interface RichTextText extends RichTextStyleable { + /** + * @description The type of element. In this case `type` is always `text`. + */ + type: 'text'; + /** + * @description The text to render. + */ + text: string; +} + +/** + * @description A user mention element for use in a rich text message. + */ +export interface RichTextUserMention extends RichTextStyleable { + /** + * @description The type of element. In this case `type` is always `user`. + */ + type: 'user'; + /** + * @description The encoded user ID, e.g. U1234ABCD. + */ + user_id: string; +} + +/** + * @description A usergroup mention element for use in a rich text message. + */ +export interface RichTextUsergroupMention extends RichTextStyleable { + /** + * @description The type of element. In this case `type` is always `usergroup`. + */ + type: 'usergroup'; + /** + * @description The encoded usergroup ID, e.g. S1234ABCD. + */ + usergroup_id: string; +} + +/** + * @description Union of rich text sub-elements for use within rich text blocks. + */ +export type RichTextElement = + | RichTextBroadcastMention + | RichTextColor + | RichTextChannelMention + | RichTextDate + | RichTextEmoji + | RichTextLink + | RichTextTeamMention + | RichTextText + | RichTextUserMention + | RichTextUsergroupMention; + +/** + * @description A section block within a rich text field. + */ +export interface RichTextSection { + /** + * @description The type of element. In this case `type` is always `rich_text_section`. + */ + type: 'rich_text_section'; + elements: RichTextElement[]; +} + +/** + * @description A list block within a rich text field. + */ +export interface RichTextList extends RichTextBorderable { + /** + * @description The type of element. In this case `type` is always `rich_text_list`. + */ + type: 'rich_text_list'; + /** + * @description An array of {@link RichTextSection} elements comprising each list item. + */ + elements: RichTextSection[]; + /** + * @description The type of list. Can be either `bullet` (the list points are all rendered the same way) or `ordered` + * (the list points increase numerically from 1). + */ + style: 'bullet' | 'ordered'; + /** + * @description The style of the list points. Can be a number from `0` (default) to `8`. Yields a different character + * or characters rendered as the list points. Also affected by the `style` property. + */ + indent?: number; +} + +/** + * @description A quote block within a rich text field. + */ +export interface RichTextQuote extends RichTextBorderable { + /** + * @description The type of element. In this case `type` is always `rich_text_quote`. + */ + type: 'rich_text_quote'; + /** + * @description An array of {@link RichTextElement} comprising the quote block. + */ + elements: RichTextElement[]; +} + +/** + * @description A block of preformatted text within a rich text field. + */ +export interface RichTextPreformatted extends RichTextBorderable { + /** + * @description The type of element. In this case `type` is always `rich_text_preformatted`. + */ + type: 'rich_text_preformatted'; + /** + * @description An array of either {@link RichTextLink} or {@link RichTextText} comprising the preformatted text. + */ + elements: (RichTextText | RichTextLink)[]; +} + +/** + * @description A rich text input creates a composer/WYSIWYG editor for entering formatted text, offering nearly the + * same experience you have writing messages in Slack. + * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/rich-text-input-element Rich-text input element reference}. + * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. + */ +export interface RichTextInput extends Actionable, Dispatchable, Focusable, Placeholdable { + /** + * @description The type of element. In this case `type` is always `rich_text_input`. + */ + type: 'rich_text_input'; + /** + * @description Initial contents of the input when it is loaded. + */ + initial_value?: RichTextBlock; +} diff --git a/tmp-docs/blocks.ts b/tmp-docs/blocks.ts new file mode 100644 index 00000000..17d710ac --- /dev/null +++ b/tmp-docs/blocks.ts @@ -0,0 +1,455 @@ +// This file contains objects documented here: https://docs.slack.dev/reference/block-kit/blocks +import type { + Button, + Checkboxes, + Datepicker, + DateTimepicker, + EmailInput, + FeedbackButtons, + FileInput, + IconButton, + ImageElement, + MultiSelect, + NumberInput, + Overflow, + PlainTextInput, + RadioButtons, + RichTextInput, + RichTextList, + RichTextPreformatted, + RichTextQuote, + RichTextSection, + Select, + Timepicker, + URLInput, + WorkflowButton, +} from './block-elements'; +import type { + PlainTextElement, + RawTextElement, + SlackFileImageObject, + TextObject, + UrlImageObject, +} from './composition-objects'; + +export interface Block { + /** + * @description The type of block. + */ + type: string; + /** + * @description A string acting as a unique identifier for a block. If not specified, a `block_id` will be generated. + * You can use this `block_id` when you receive an interaction payload to + * {@link https://docs.slack.dev/interactivity/handling-user-interaction#payloads identify the source of the action}. + * Maximum length for this field is 255 characters. `block_id` should be unique for each message and each iteration of + * a message. If a message is updated, use a new `block_id`. + */ + block_id?: string; +} + +/** + * A helper union type of all known Blocks, as listed out on the + * {@link https://docs.slack.dev/reference/block-kit/blocks Blocks reference}. + */ +export type KnownBlock = + | ActionsBlock + | ContextBlock + | ContextActionsBlock + | DividerBlock + | FileBlock + | HeaderBlock + | ImageBlock + | InputBlock + | MarkdownBlock + | RichTextBlock + | SectionBlock + | TableBlock + | VideoBlock; + +/** + * A helper union type of all known Blocks as well as the generic {@link Block} interface. A full list of known blocks + * is available here: {@link https://docs.slack.dev/reference/block-kit/blocks Blocks reference}. + */ +export type AnyBlock = KnownBlock | Block; + +/** + * A helper union type of all Block Elements that can be used in an {@link ActionsBlock}. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/actions-block Actions block reference}. + */ +export type ActionsBlockElement = + | Button + | Checkboxes + | Datepicker + | DateTimepicker + | MultiSelect + | Overflow + | RadioButtons + | Select + | Timepicker + | WorkflowButton + | RichTextInput; + +/** + * @description Holds multiple interactive elements. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/actions-block Actions block reference}. + */ +export interface ActionsBlock extends Block { + /** + * @description The type of block. For an actions block, `type` is always `actions`. + */ + type: 'actions'; + /** + * @description An array of {@link InteractiveElements} objects. + * There is a maximum of 25 elements in each action block. + */ + elements: ActionsBlockElement[]; // TODO: breaking change: min 1 item +} + +/** + * A helper union type of all Block Elements that can be used in a {@link ContextBlock}. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/context-block Context block reference}. + */ +export type ContextBlockElement = ImageElement | TextObject; + +/** + * @description Displays contextual info, which can include both images and text. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/context-block Context block reference}. + */ +export interface ContextBlock extends Block { + /** + * @description The type of block. For a context block, `type` is always `context`. + */ + type: 'context'; + /** + * @description An array of {@link ImageElement}, {@link PlainTextElement} or {@link MrkdwnElement} objects. + * Maximum number of items is 10. + */ + elements: ContextBlockElement[]; // TODO: breaking change: min 1 item +} + +/** + * A helper union type of all Block Elements that can be used in a {@link ContextActionsBlock}. + */ +export type ContextActionsBlockElement = FeedbackButtons | IconButton; + +/** + * @description Displays actions as contextual info, which can include both feedback buttons and icon buttons. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/context-actions-block Context actions block reference}. + */ +export interface ContextActionsBlock extends Block { + /** + * @description The type of block. For a context actions block, `type` is always `context_actions`. + */ + type: 'context_actions'; + /** + * @description An array of {@link FeedbackButtons} or {@link IconButton} block elements. Maximum number of items is 5. + */ + elements: ContextActionsBlockElement[]; +} + +/** + * @description Visually separates pieces of info inside of a message. A content divider, like an `
`, to split up + * different blocks inside of a message. The divider block is nice and neat, requiring only a `type`. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/divider-block Divider block reference}. + */ +export interface DividerBlock extends Block { + /** + * @description The type of block. For a divider block, `type` is always `divider`. + */ + type: 'divider'; +} + +/** + * @description Displays a {@link https://docs.slack.dev/messaging/working-with-files#remote remote file}. You can't add this block to + * app surfaces directly, but it will show up when {@link https://docs.slack.dev/messaging/retrieving-messages retrieving messages} + * that contain remote files. If you want to add remote files to messages, + * {@link https://docs.slack.dev/messaging/working-with-files#remote follow our guide}. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/file-block File block reference}. + */ +export interface FileBlock extends Block { + /** + * @description The type of block. For a file block, `type` is always `file`. + */ + type: 'file'; + /** + * @description At the moment, source will always be `remote` for a remote file. + */ + source: string; // TODO: breaking change: set this to the string literal 'remote' + /** + * @description The external unique ID for this file. + */ + external_id: string; +} + +/** + * @description Displays a larger-sized text block. A `header` is a plain-text block that displays in a larger, bold + * font. Use it to delineate between different groups of content in your app's surfaces. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/header-block Header block reference}. + */ +export interface HeaderBlock extends Block { + /** + * @description The type of block. For a header block, `type` is always `header`. + */ + type: 'header'; + /** + * @description The text for the block, in the form of a {@link PlainTextElement}. + * Maximum length for the text in this field is 150 characters. + */ + text: PlainTextElement; +} + +/** + * @description Displays an image. A simple image block, designed to make those cat photos really pop. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/image-block Image block reference}. + */ +export type ImageBlock = { + /** + * @description The type of block. For an image block, `type` is always `image`. + */ + type: 'image'; + /** + * @description A plain-text summary of the image. This should not contain any markup. + * Maximum length for this field is 2000 characters. + */ + alt_text: string; + /** + * @description An optional title for the image in the form of a {@link PlainTextElement} object. + * Maximum length for the text in this field is 2000 characters. + */ + title?: PlainTextElement; +} & Block & + (UrlImageObject | SlackFileImageObject); + +/** + * A helper union type of all Block Elements that can be used in an {@link InputBlock}. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/input-block Input block reference}. + */ +export type InputBlockElement = + | Checkboxes + | Datepicker + | DateTimepicker + | EmailInput + | FileInput + | MultiSelect + | NumberInput + | PlainTextInput + | RadioButtons + | RichTextInput + | Select + | Timepicker + | URLInput; + +/** + * @description Collects information from users via block elements. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/input-block Input block reference}. + * @see {@link https://docs.slack.dev/surfaces/modals#gathering_input Collecting input in modals guide}. + * @see {@link https://docs.slack.dev/surfaces/app-home Collecting input in Home tabs guide}. + */ +export interface InputBlock extends Block { + /** + * @description The type of block. For an input block, `type` is always `input`. + */ + type: 'input'; + /** + * @description A label that appears above an input element in the form of a {@link PlainTextElement} object. + * Maximum length for the text in this field is 2000 characters. + */ + label: PlainTextElement; + /** + * @description An optional hint that appears below an input element in a lighter grey. It must be a + * {@link PlainTextElement object}. Maximum length for the `text` in this field is 2000 characters. + */ + hint?: PlainTextElement; + /** + * @description A boolean that indicates whether the input element may be empty when a user submits the modal. + * Defaults to `false`. + */ + optional?: boolean; + /** + * @description A block element. + */ + element: InputBlockElement; + /** + * @description A boolean that indicates whether or not the use of elements in this block should dispatch a + * {@link https://docs.slack.dev/reference/interaction-payloads/block_actions-payload block_actions payload}. Defaults to `false`. + */ + dispatch_action?: boolean; +} + +/** + * @description This block can be used with AI apps when you expect a markdown response from an LLM that can get lost in + * translation rendering in Slack. Providing it in a markdown block leaves the translating to Slack to ensure your message + * appears as intended. Note that passing a single block may result in multiple blocks after translation. + * @see {@link https://api.slack.com/reference/block-kit/blocks#markdown Markdown block reference}. + */ +export interface MarkdownBlock extends Block { + /** + * @description The type of block. For a markdown block, `type` is always `markdown`. + */ + type: 'markdown'; + /** + * @description The standard markdown-formatted text. Limit 12,000 characters max. + */ + text: string; +} + +/** + * A helper union type of all Block Elements that can be used in a {@link RichTextBlock}. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block Rich text block reference}. + */ +export type RichTextBlockElement = RichTextSection | RichTextList | RichTextQuote | RichTextPreformatted; + +/** + * @description Displays formatted, structured representation of text. It is also the output of the Slack client's + * WYSIWYG message composer, so all messages sent by end-users will have this format. Use this block to include + * user-defined formatted text in your Block Kit payload. While it is possible to format text with `mrkdwn`, + * `rich_text` is strongly preferred and allows greater flexibility. + * You might encounter a `rich_text` block in a message payload, as a built-in type in workflow apps, or as output of + * the {@link RichTextInput}. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block Rich text block reference}. + */ +export interface RichTextBlock extends Block { + /** + * @description The type of block. For a rich text block, `type` is always `rich_text`. + */ + type: 'rich_text'; + elements: RichTextBlockElement[]; +} + +/** + * A helper union type of all Block Elements that can be used as an accessory in a {@link SectionBlock}. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/section-block Section block reference}. + */ +export type SectionBlockAccessory = + | Button + | Checkboxes + | Datepicker + | ImageElement + | MultiSelect + | Overflow + | RadioButtons + | Select + | Timepicker + | WorkflowButton; + +// TODO: breaking change: use a discriminative union to represent section block using `text` or `fields` but +// not both or neither. +/** + * @description Displays text, possibly alongside block elements. A section can be used as a simple text block, in + * combination with text fields, or side-by-side with certain + * {@link https://docs.slack.dev/reference/block-kit/block-elements block elements}. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/section-block Section block reference}. + */ +export interface SectionBlock extends Block { + /** + * @description The type of block. For a section block, `type` is always `section`. + */ + type: 'section'; + /** + * @description The text for the block, in the form of a {@link TextObject}. Minimum length for the `text` in this + * field is 1 and maximum length is 3000 characters. This field is not required if a valid array of `fields` objects + * is provided instead. + */ + text?: TextObject; + /** + * @description Required if no `text` is provided. An array of text objects. Any text objects included with `fields` + * will be rendered in a compact format that allows for 2 columns of side-by-side text. Maximum number of items is 10. + * Maximum length for the text in each item is 2000 characters. + * {@link https://app.slack.com/block-kit-builder/#%7B%22blocks%22:%5B%7B%22type%22:%22section%22,%22text%22:%7B%22text%22:%22A%20message%20*with%20some%20bold%20text*%20and%20_some%20italicized%20text_.%22,%22type%22:%22mrkdwn%22%7D,%22fields%22:%5B%7B%22type%22:%22mrkdwn%22,%22text%22:%22*Priority*%22%7D,%7B%22type%22:%22mrkdwn%22,%22text%22:%22*Type*%22%7D,%7B%22type%22:%22plain_text%22,%22text%22:%22High%22%7D,%7B%22type%22:%22plain_text%22,%22text%22:%22String%22%7D%5D%7D%5D%7D Click here for an example}. + */ + fields?: TextObject[]; // either this or text must be defined, also min 1 item + /** + * @description One of the compatible element objects. + */ + accessory?: SectionBlockAccessory; + /** + * Whether or not this section block's text should always expand when rendered. If false or not provided, it may be rendered with a 'see more' option to expand and show the full text. For AI Assistant apps, this allows the app to post long messages without users needing to click 'see more' to expand the message. + */ + expand?: boolean; +} + +/** + * @description Displays structured information in a table. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/table-block Table block reference}. + */ +export interface TableBlock extends Block { + /** + * @description The type of block. For a table block, `type` is always `table`. + */ + type: 'table'; + /** + * @description An array consisting of table rows. Maximum 100 rows. Each row object is an array with a max of 20 table cells. Table cells can have a type of raw_text or rich_text. + */ + rows: (RichTextBlock | RawTextElement)[][]; + /** + * @description An array describing column behavior. If there are fewer items in the column_settings array than there are columns in the table, then the items in the the column_settings array will describe the same number of columns in the table as there are in the array itself. Any additional columns will have the default behavior. Maximum 20 items. + */ + column_settings?: TableBlockColumnSettings[]; +} + +/** + * Schema for column_settings of the table block. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/table-block/#schema-for-column_settings}. + */ +interface TableBlockColumnSettings { + /** + * @description The alignment for items in this column. Can be left, center, or right. Defaults to left if not defined. + */ + align?: 'left' | 'center' | 'right'; + /** + * @description Whether the contents of this column should be wrapped or not. Defaults to false if not defined. + */ + is_wrapped?: boolean; +} + +/** + * @description Displays an embedded video player. A video block is designed to embed videos in all app surfaces (e.g. + * link unfurls, messages, modals, App Home) — anywhere you can put blocks! To use the video block within your app, you + * must have the {@link https://docs.slack.dev/reference/scopes/links.embed.write `links.embed:write` scope}. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/video-block Video block reference}. + */ +export interface VideoBlock extends Block { + /** + * @description The type of block. For a video block, `type` is always `video`. + */ + type: 'video'; + /** + * @description The URL to be embedded. Must match any existing + * {@link https://docs.slack.dev/messaging/unfurling-links-in-messages unfurl domains} within the app + * and point to a HTTPS URL. + */ + video_url: string; + /** + * @description The thumbnail image URL. + */ + thumbnail_url: string; + /** + * @description A tooltip for the video. Required for accessibility. + */ + alt_text: string; + /** + * @description Video title as a {@link PlainTextElement} object. `text` within must be less than 200 characters. + */ + title: PlainTextElement; + /** + * @description Hyperlink for the title text. Must correspond to the non-embeddable URL for the video. + * Must go to an HTTPS URL. + */ + title_url?: string; + /** + * @description Author name to be displayed. Must be less than 50 characters. + */ + author_name?: string; + /** + * @description The originating application or domain of the video, e.g. YouTube. + */ + provider_name?: string; + /** + * @description Icon for the video provider, e.g. YouTube icon. + */ + provider_icon_url?: string; + /** + * @description Description for video using a {@link PlainTextElement} object. + */ + description?: PlainTextElement; +} diff --git a/tmp-docs/composition-objects.ts b/tmp-docs/composition-objects.ts new file mode 100644 index 00000000..88683034 --- /dev/null +++ b/tmp-docs/composition-objects.ts @@ -0,0 +1,259 @@ +// This file contains objects documented here: https://docs.slack.dev/reference/block-kit/composition-objects + +/** + * Re-usable labels for common color schemes present in Slack. `danger` displays with a red background (red text on + * mobile), while `primary` displays with a green background (green text on mobile). + */ +export type ColorScheme = 'primary' | 'danger'; + +/** The conversation type as available within the Slack UI. */ +export type ConversationType = 'im' | 'mpim' | 'private' | 'public'; + +// TODO: breaking change: remove `Confirm` and move properties to `ConfirmationDialog` below on next major release. +/** + * @deprecated {@link Confirm} aliased to {@link ConfirmationDialog} in order to make the construct clearer + * and line up terminology with docs.slack.dev. + * @description Defines a dialog that adds a confirmation step to interactive elements. + * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/confirmation-dialog-object Confirmation dialog object reference}. + */ +export interface Confirm { + /** + * @description A {@link PlainTextElement} text object that defines the dialog's title. + * Maximum length for this field is 100 characters. + */ + title?: PlainTextElement; // TODO: breaking change, title is required according to https://docs.slack.dev/reference/block-kit/composition-objects/confirmation-dialog-object + /** + * @description A {@link PlainTextElement} text object that defines the explanatory text that appears in the confirm + * dialog. Maximum length for the `text` in this field is 300 characters. + */ + text: PlainTextElement | MrkdwnElement; // TODO: breaking change: this should not be a mrkdwnelement + /** + * @description A {@link PlainTextElement} text object to define the text of the button that confirms the action. + * Maximum length for the `text` in this field is 30 characters. + */ + confirm?: PlainTextElement; // TODO: breaking change, confirm is required according to https://docs.slack.dev/reference/block-kit/composition-objects/confirmation-dialog-object + /** + * @description A {@link PlainTextElement} text object to define the text of the button that cancels the action. + * Maximum length for the `text` in this field is 30 characters. + */ + deny?: PlainTextElement; // TODO: breaking change, deny is required according to https://docs.slack.dev/reference/block-kit/composition-objects/confirmation-dialog-object + /** + * @description Defines the color scheme applied to the `confirm` button. A value of `danger` will display the button + * with a red background on desktop, or red text on mobile. A value of `primary` will display the button with a green + * background on desktop, or blue text on mobile. If this field is not provided, the default value will be `primary`. + */ + style?: ColorScheme; +} + +/** + * @description Defines a dialog that adds a confirmation step to interactive elements. + * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/confirmation-dialog-object Confirmation dialog object reference}. + */ +export interface ConfirmationDialog extends Confirm {} + +/** + * @description Defines when a {@link PlainTextElement} will return a {@link https://docs.slack.dev/reference/interaction-payloads/block_actions-payload `block_actions` interaction payload}. + * @see {@link https://docs.slack.dev/reference/interaction-payloads/block_actions-payload `block_actions` interaction payload}. + */ +export interface DispatchActionConfig { + /** + * @description An array of interaction types that you would like to receive a + * {@link https://docs.slack.dev/reference/interaction-payloads/block_actions-payload `block_actions` payload} for. Should be + * one or both of: + * `on_enter_pressed` — payload is dispatched when user presses the enter key while the input is in focus. Hint + * text will appear underneath the input explaining to the user to press enter to submit. + * `on_character_entered` — payload is dispatched when a character is entered (or removed) in the input. + */ + trigger_actions_on?: ('on_enter_pressed' | 'on_character_entered')[]; +} + +interface OptionDescriptor { + /** + * @description A unique string value that will be passed to your app when this option is chosen. + * Maximum length for this field is 75 characters. + */ + value?: string; // TODO: breaking change - value is required according to https://docs.slack.dev/reference/block-kit/composition-objects/option-object + /** + * @description Only available in overflow menus! A URL to load in the user's browser when the option is clicked. + * Maximum length for this field is 3000 characters. + */ + url?: string; + /** + * @description A {@link PlainTextElement} that defines a line of descriptive text shown below the `text` field. + * Maximum length for the `text` within this field is 75 characters. + */ + description?: PlainTextElement; +} + +export interface MrkdwnOption extends OptionDescriptor { + /** + * @description A {@link MrkdwnElement} that defines the text shown in the option on the menu. To be used with + * radio buttons and checkboxes. Maximum length for the `text` in this field is 75 characters. + */ + text: MrkdwnElement; +} + +export interface PlainTextOption extends OptionDescriptor { + /** + * @description A {@link PlainTextElement} that defines the text shown in the option on the menu. To be used with + * overflow, select and multi-select menus. Maximum length for the `text` in this field is 75 characters. + */ + text: PlainTextElement; +} + +/** + * @description Defines a single item in a number of item selection elements. An object that represents a single + * selectable item in a select menu, multi-select menu, checkbox group, radio button group, or overflow menu. + * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/option-object Option object reference}. + */ +export type Option = MrkdwnOption | PlainTextOption; + +/** + * @description Defines a way to group options in a select or multi-select menu. + * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/option-group-object Option group object reference}. + */ +export interface OptionGroup { + /** + * @description A {@link PlainTextElement} text object that defines the label shown above this group of options. + * Maximum length for the `text` in this field is 75 characters. + */ + label: PlainTextElement; + /** + * @description An array of {@link Option} that belong to this specific group. Maximum of 100 items. + */ + options: Option[]; +} + +/** + * @description Defines an object containing some text. Can be either a {@link PlainTextElement} or a + * {@link MrkdwnElement}. + * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}. + */ +export type TextObject = PlainTextElement | MrkdwnElement; + +/** + * @description Defines an object containing some text. + * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}. + */ +export interface PlainTextElement { + /** + * @description The formatting to use for this text object. + */ + type: 'plain_text'; + /** + * @description The text for the block. The minimum length is 1 and maximum length is 3000 characters. + */ + text: string; + /** + * @description Indicates whether emojis in a text field should be escaped into the colon emoji format. + */ + emoji?: boolean; +} + +/** + * @description Defines an object containing some text. + * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}. + */ +export interface MrkdwnElement { + /** + * @description The formatting to use for this text object. + */ + type: 'mrkdwn'; + /** + * @description The text for the block. This field accepts any of the standard text formatting markup. + * The minimum length is 1 and maximum length is 3000 characters. + */ + text: string; + /** + * @description When set to `false` (as is default) URLs will be auto-converted into links, conversation names will + * be link-ified, and certain mentions will be {@link https://docs.slack.dev/messaging/formatting-message-text automatically parsed}. + * Using a value of `true` will skip any preprocessing of this nature, although you can still include + * {@link https://docs.slack.dev/messaging/formatting-message-text manual parsing strings}. + */ + verbatim?: boolean; +} + +/** + * @description Defines an object containing some text. + * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}. + */ +export interface RawTextElement { + /** + * @description The formatting to use for this text object. + */ + type: 'raw_text'; + /** + * @description The text for the block. The minimum length is 1 character. + */ + text: string; +} + +interface BaseConversationFilter { + /** + * @description Indicates which type of conversations should be included in the list. When this field is provided, any + * conversations that do not match will be excluded. You should provide an array of strings from the following options: + * `im`, `mpim`, `private`, and `public`. The array cannot be empty. + */ + include?: [ConversationType, ...ConversationType[]]; + /** + * @description Indicates whether to exclude external {@link https://docs.slack.dev/apis/slack-connect shared channels} + * from conversation lists. This field will not exclude users from shared channels. Defaults to `false`. + */ + exclude_external_shared_channels?: boolean; + /** + * @description Indicates whether to exclude bot users from conversation lists. Defaults to `false`. + */ + exclude_bot_users?: boolean; +} + +/** + * @description Defines a filter for the list of options in a conversation selector menu. The menu can be either a + * conversations select menu or a conversations multi-select menu. + * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/conversation-filter-object Conversation filter object reference}. + */ +export type ConversationFilter = + | (BaseConversationFilter & Required>) + | (BaseConversationFilter & Required>) + | (BaseConversationFilter & Required>); +/** + * @description Object for image which contains a image_url. + */ +export interface UrlImageObject { + /** + * @description The URL of the image to be displayed. + */ + image_url: string; +} + +/** + * @description Object for image which contains a slack_file. + */ +export interface SlackFileImageObject { + /** + * @description The slack file of the image to be displayed. + */ + slack_file: SlackFile; +} + +interface SlackFileViaUrl { + /** + * @description This URL can be the `url_private` or the `permalink` of the {@link Slack file https://docs.slack.dev/reference/objects/file-object}. + */ + url: string; +} + +interface SlackFileViaId { + /** + * @description `id` of the {@link Slack file https://docs.slack.dev/reference/objects/file-objecte}. + */ + id: string; +} + +/** + * @description Defines an object containing Slack file information to be used in an image block or image element. + * This {@link file https://docs.slack.dev/reference/objects/file-object} must be an image and you must provide either the URL or ID. In addition, + * the user posting these blocks must have access to this file. If both are provided then the payload will be rejected. + * Currently only `png`, `jpg`, `jpeg`, and `gif` Slack image files are supported. + * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/slack-file-object Slack File object reference}. + */ +export type SlackFile = SlackFileViaUrl | SlackFileViaId; diff --git a/tmp-docs/extensions.ts b/tmp-docs/extensions.ts new file mode 100644 index 00000000..a0b524f1 --- /dev/null +++ b/tmp-docs/extensions.ts @@ -0,0 +1,98 @@ +// This file contains reusable extensions/mixins that other Block Kit elements will extend from. +import type { ConfirmationDialog, DispatchActionConfig, PlainTextElement } from './composition-objects'; + +// TODO: breaking change: remove `Action` and move properties to `Actionable` on next major release. +/** + * @deprecated {@link Action} aliased to {@link Actionable} in order to name the mixins in this file consistently. + */ +export interface Action { + type: string; + /** + * @description: An identifier for this action. You can use this when you receive an interaction payload to + * {@link https://docs.slack.dev/interactivity/handling-user-interaction#payloads identify the source of the action}. Should be unique + * among all other `action_id`s in the containing block. Maximum length for this field is 255 characters. + */ + action_id?: string; +} + +export interface Actionable extends Action {} + +export interface Confirmable { + /** + * @description A {@link Confirm} object that defines an optional confirmation dialog after the element is interacted + * with. + */ + confirm?: ConfirmationDialog; +} + +export interface Dispatchable { + /** + * @description A {@link DispatchActionConfig} object that determines when during text input the element returns a + * {@link https://docs.slack.dev/reference/interaction-payloads/block_actions-payload `block_actions` payload}. + */ + dispatch_action_config?: DispatchActionConfig; +} + +export interface Focusable { + /** + * @description Indicates whether the element will be set to auto focus within the + * {@link https://docs.slack.dev/surfaces/modals `view` object}. Only one element can be set to `true`. + * Defaults to `false`. + */ + focus_on_load?: boolean; +} + +export interface MaxItemsSelectable { + /** + * @description Specifies the maximum number of items that can be selected. Minimum number is 1. + */ + max_selected_items?: number; +} + +export interface Placeholdable { + /** + * @description A {@link PlainTextElement} object that defines the placeholder text shown on the element. Maximum + * length for the `text` field in this object is 150 characters. + */ + placeholder?: PlainTextElement; +} + +export interface URLRespondable { + /** + * @description When set to `true`, the {@link https://docs.slack.dev/reference/interaction-payloads/view-interactions-payload#view_submission `view_submission` payload} + * from the menu's parent view will contain a `response_url`. This `response_url` can be used for + * {@link https://docs.slack.dev/interactivity/handling-user-interaction#message_responses message responses}. The target conversation + * for the message will be determined by the value of this select menu. + */ + response_url_enabled?: boolean; +} + +/** For use in setting border style details on certain Rich Text elements. */ +export interface RichTextBorderable { + /** + * @description Whether to render a quote-block-like border on the inline side of the list. `0` renders no border + * while `1` renders a border. + */ + border?: 0 | 1; +} + +/** + * @description For use styling Rich Text sub-elements. + */ +export interface RichTextStyleable { + /** + * @description A limited style object for styling rich text `text` elements. + */ + style?: { + /** @description When `true`, boldens the text in this element. Defaults to `false`. */ + bold?: boolean; + /** @description When `true`, the text is preformatted in an inline code style. Defaults to `false. */ + code?: boolean; + /** @description When `true`, italicizes the text in this element. Defaults to `false`. */ + italic?: boolean; + /** @description When `true`, strikes through the text in this element. Defaults to `false`. */ + strike?: boolean; + /** @description When `true`, underlines the text in this element. Defaults to `false`. */ + underline?: boolean; + }; +} From 371fefc6e3262ffb3634ca04e871ea5041a0355e Mon Sep 17 00:00:00 2001 From: allx Date: Sat, 6 Dec 2025 00:25:44 +0200 Subject: [PATCH 2/5] Update Slack API links to docs.slack.dev Replaces all references to api.slack.com in documentation and source code with docs.slack.dev, ensuring all links point to the new Slack API documentation domain. --- README.md | 2 +- docs/bits/rich-text-color.md | 2 +- docs/bits/rich-text-emoji.md | 2 +- docs/bits/rich-text-link.md | 2 +- docs/bits/rich-text-list.md | 2 +- docs/bits/rich-text-preformatted.md | 2 +- docs/bits/rich-text-quote.md | 2 +- docs/bits/rich-text-section.md | 2 +- docs/bits/rich-text-team.md | 2 +- docs/bits/rich-text-text.md | 2 +- docs/blocks/context-actions.md | 2 +- docs/blocks/markdown.md | 2 +- docs/blocks/rich-text.md | 2 +- docs/blocks/table.md | 2 +- docs/elements/feedback-buttons.md | 2 +- docs/elements/icon-button.md | 2 +- docs/elements/rich-text-input.md | 2 +- docs/elements/workflow-button.md | 2 +- docs/support.md | 2 +- src/bits/attachment.ts | 2 +- src/bits/confirmation-dialog.ts | 2 +- src/bits/index.ts | 36 +++---- src/bits/option-group.ts | 2 +- src/bits/option.ts | 2 +- src/bits/rich-text-broadcast.ts | 2 +- src/bits/rich-text-channel.ts | 2 +- src/bits/rich-text-color.ts | 2 +- src/bits/rich-text-date.ts | 2 +- src/bits/rich-text-emoji.ts | 2 +- src/bits/rich-text-link.ts | 2 +- src/bits/rich-text-list.ts | 2 +- src/bits/rich-text-preformatted.ts | 2 +- src/bits/rich-text-quote.ts | 2 +- src/bits/rich-text-section.ts | 2 +- src/bits/rich-text-team.ts | 2 +- src/bits/rich-text-text.ts | 2 +- src/bits/rich-text-user.ts | 2 +- src/bits/rich-text-usergroup.ts | 2 +- src/blocks/actions.ts | 2 +- src/blocks/context-actions.ts | 2 +- src/blocks/context.ts | 2 +- src/blocks/divider.ts | 2 +- src/blocks/file.ts | 2 +- src/blocks/header.ts | 2 +- src/blocks/image.ts | 2 +- src/blocks/index.ts | 26 ++--- src/blocks/input.ts | 2 +- src/blocks/markdown.ts | 2 +- src/blocks/rich-text.ts | 2 +- src/blocks/section.ts | 2 +- src/blocks/table.ts | 2 +- src/blocks/video.ts | 2 +- src/elements/button.ts | 2 +- src/elements/channel-multi-select.ts | 2 +- src/elements/channel-select.ts | 2 +- src/elements/checkboxes.ts | 2 +- src/elements/conversation-multi-select.ts | 2 +- src/elements/conversation-select.ts | 2 +- src/elements/date-picker.ts | 2 +- src/elements/date-time-picker.ts | 2 +- src/elements/email-input.ts | 2 +- src/elements/external-multi-select.ts | 2 +- src/elements/external-select.ts | 2 +- src/elements/feedback-buttons.ts | 2 +- src/elements/file-input.ts | 2 +- src/elements/icon-button.ts | 2 +- src/elements/img.ts | 2 +- src/elements/index.ts | 54 +++++----- src/elements/number-input.ts | 2 +- src/elements/overflow-menu.ts | 2 +- src/elements/radio-buttons.ts | 2 +- src/elements/rich-text-input.ts | 2 +- src/elements/static-multi-select.ts | 2 +- src/elements/static-select.ts | 2 +- src/elements/text-input.ts | 2 +- src/elements/timepicker.ts | 2 +- src/elements/url-input.ts | 2 +- src/elements/user-multi-select.ts | 2 +- src/elements/user-select.ts | 2 +- src/elements/workflow-button.ts | 2 +- src/internal/methods/append-methods.ts | 22 ++-- src/internal/methods/configuration-methods.ts | 42 ++++---- src/internal/methods/other-methods.ts | 6 +- src/internal/methods/set-methods.ts | 102 +++++++++--------- src/surfaces/home-tab.ts | 2 +- src/surfaces/index.ts | 8 +- src/surfaces/message.ts | 2 +- src/surfaces/modal.ts | 2 +- src/surfaces/workflow-step.ts | 2 +- tmp-docs/blocks.ts | 2 +- 90 files changed, 230 insertions(+), 230 deletions(-) diff --git a/README.md b/README.md index e676033a..9a9fc227 100644 --- a/README.md +++ b/README.md @@ -420,7 +420,7 @@ const unfurl = ({ channel, ts, url }) => client.chat.unfurl({ .catch((error) => console.log(error)); ``` -Both `OptionCollection()` and `OptionGroupCollection()` come in handy when returning an array of options or option groups for select menus with external data sources, as seen in [Slack's API docs](https://api.slack.com/reference/block-kit/block-elements#external_multi_select): +Both `OptionCollection()` and `OptionGroupCollection()` come in handy when returning an array of options or option groups for select menus with external data sources, as seen in [Slack's API docs](https://docs.slack.dev/reference/block-kit/block-elements#external_multi_select): ```javascript return { options: OptionCollection( /* Pass in options */ ) }; diff --git a/docs/bits/rich-text-color.md b/docs/bits/rich-text-color.md index 3383bc07..c974e18a 100644 --- a/docs/bits/rich-text-color.md +++ b/docs/bits/rich-text-color.md @@ -1,6 +1,6 @@ # Rich Text Color -?> **Note:** This document is a reference to the `RichTextColorBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Rich Text element docs](https://api.slack.com/reference/block-kit/blocks#element-types) on Slack's doc site. +?> **Note:** This document is a reference to the `RichTextColorBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Rich Text element docs](https://docs.slack.dev/reference/block-kit/blocks#element-types) on Slack's doc site. ### Creating an Instance diff --git a/docs/bits/rich-text-emoji.md b/docs/bits/rich-text-emoji.md index 729dbbc0..36beb696 100644 --- a/docs/bits/rich-text-emoji.md +++ b/docs/bits/rich-text-emoji.md @@ -1,6 +1,6 @@ # Rich Text Emoji -?> **Note:** This document is a reference to the `RichTextEmojiBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://api.slack.com/reference/block-kit/blocks#element-types) on Slack's doc site. +?> **Note:** This document is a reference to the `RichTextEmojiBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://docs.slack.dev/reference/block-kit/blocks#element-types) on Slack's doc site. ### Creating an Instance diff --git a/docs/bits/rich-text-link.md b/docs/bits/rich-text-link.md index 6b81b7be..c8beef4c 100644 --- a/docs/bits/rich-text-link.md +++ b/docs/bits/rich-text-link.md @@ -1,6 +1,6 @@ # Rich Text Link -?> **Note:** This document is a reference to the `RichTextLinkBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://api.slack.com/reference/block-kit/blocks#element-types) on Slack's doc site. +?> **Note:** This document is a reference to the `RichTextLinkBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://docs.slack.dev/reference/block-kit/blocks#element-types) on Slack's doc site. ### Creating an Instance diff --git a/docs/bits/rich-text-list.md b/docs/bits/rich-text-list.md index 87baf955..818f1ab6 100644 --- a/docs/bits/rich-text-list.md +++ b/docs/bits/rich-text-list.md @@ -1,6 +1,6 @@ # Rich Text List -?> **Note:** This document is a reference to the `RichTextListBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://api.slack.com/reference/block-kit/blocks#rich_text_list) on Slack's doc site. +?> **Note:** This document is a reference to the `RichTextListBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://docs.slack.dev/reference/block-kit/blocks#rich_text_list) on Slack's doc site. ### Creating an Instance diff --git a/docs/bits/rich-text-preformatted.md b/docs/bits/rich-text-preformatted.md index d30f6340..06847487 100644 --- a/docs/bits/rich-text-preformatted.md +++ b/docs/bits/rich-text-preformatted.md @@ -1,6 +1,6 @@ # Rich Text Preformatted -?> **Note:** This document is a reference to the `RichTextPreformattedBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://api.slack.com/reference/block-kit/blocks#rich_text_preformatted) on Slack's doc site. +?> **Note:** This document is a reference to the `RichTextPreformattedBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://docs.slack.dev/reference/block-kit/blocks#rich_text_preformatted) on Slack's doc site. ### Creating an Instance diff --git a/docs/bits/rich-text-quote.md b/docs/bits/rich-text-quote.md index a16422da..26845142 100644 --- a/docs/bits/rich-text-quote.md +++ b/docs/bits/rich-text-quote.md @@ -1,6 +1,6 @@ # Rich Text Quote -?> **Note:** This document is a reference to the `RichTextQuoteBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://api.slack.com/reference/block-kit/blocks#rich_text_quote) on Slack's doc site. +?> **Note:** This document is a reference to the `RichTextQuoteBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://docs.slack.dev/reference/block-kit/blocks#rich_text_quote) on Slack's doc site. ### Creating an Instance diff --git a/docs/bits/rich-text-section.md b/docs/bits/rich-text-section.md index e886fc07..70917dd2 100644 --- a/docs/bits/rich-text-section.md +++ b/docs/bits/rich-text-section.md @@ -1,6 +1,6 @@ # Rich Text Section -?> **Note:** This document is a reference to the `RichTextSectionBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://api.slack.com/reference/block-kit/blocks#rich_text_section) on Slack's doc site. +?> **Note:** This document is a reference to the `RichTextSectionBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://docs.slack.dev/reference/block-kit/blocks#rich_text_section) on Slack's doc site. ### Creating an Instance diff --git a/docs/bits/rich-text-team.md b/docs/bits/rich-text-team.md index c81ef4fb..4bd4cd3e 100644 --- a/docs/bits/rich-text-team.md +++ b/docs/bits/rich-text-team.md @@ -1,6 +1,6 @@ # Rich Text Team -?> **Note:** This document is a reference to the `RichTextTeamBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Rich Text element docs](https://api.slack.com/reference/block-kit/blocks#element-types) on Slack's doc site. +?> **Note:** This document is a reference to the `RichTextTeamBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Rich Text element docs](https://docs.slack.dev/reference/block-kit/blocks#element-types) on Slack's doc site. ### Creating an Instance diff --git a/docs/bits/rich-text-text.md b/docs/bits/rich-text-text.md index 489f472f..4bf673f4 100644 --- a/docs/bits/rich-text-text.md +++ b/docs/bits/rich-text-text.md @@ -1,6 +1,6 @@ # Rich Text Text -?> **Note:** This document is a reference to the `RichTextTextBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://api.slack.com/reference/block-kit/blocks#element-types) on Slack's doc site. +?> **Note:** This document is a reference to the `RichTextTextBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [Rich Text Block docs](https://docs.slack.dev/reference/block-kit/blocks#element-types) on Slack's doc site. ### Creating an Instance diff --git a/docs/blocks/context-actions.md b/docs/blocks/context-actions.md index b826c120..2e7fce95 100644 --- a/docs/blocks/context-actions.md +++ b/docs/blocks/context-actions.md @@ -1,6 +1,6 @@ # Context Actions -?> **Note:** This document is a reference to the `ContextActionsBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Context Actions docs](https://api.slack.com/reference/block-kit/blocks#context_actions) on Slack's doc site. +?> **Note:** This document is a reference to the `ContextActionsBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Context Actions docs](https://docs.slack.dev/reference/block-kit/blocks#context_actions) on Slack's doc site. ### Creating an Instance diff --git a/docs/blocks/markdown.md b/docs/blocks/markdown.md index fe7b144d..76534cd8 100644 --- a/docs/blocks/markdown.md +++ b/docs/blocks/markdown.md @@ -1,6 +1,6 @@ # Markdown -?> **Note:** This document is a reference to the `MarkdownBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Markdown docs](https://api.slack.com/reference/block-kit/blocks#markdown) on Slack's doc site. +?> **Note:** This document is a reference to the `MarkdownBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Markdown docs](https://docs.slack.dev/reference/block-kit/blocks#markdown) on Slack's doc site. ### Creating an Instance diff --git a/docs/blocks/rich-text.md b/docs/blocks/rich-text.md index 34ba6eba..04599910 100644 --- a/docs/blocks/rich-text.md +++ b/docs/blocks/rich-text.md @@ -1,6 +1,6 @@ # Rich Text -?> **Note:** This document is a reference to the `RichTextBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Rich Text docs](https://api.slack.com/reference/block-kit/blocks#rich_text) on Slack's doc site. +?> **Note:** This document is a reference to the `RichTextBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Rich Text docs](https://docs.slack.dev/reference/block-kit/blocks#rich_text) on Slack's doc site. ### Creating an Instance diff --git a/docs/blocks/table.md b/docs/blocks/table.md index 42124c3e..e84988b0 100644 --- a/docs/blocks/table.md +++ b/docs/blocks/table.md @@ -1,6 +1,6 @@ # Table -?> **Note:** This document is a reference to the `TableBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Table docs](https://api.slack.com/reference/block-kit/blocks#table) on Slack's doc site. +?> **Note:** This document is a reference to the `TableBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Table docs](https://docs.slack.dev/reference/block-kit/blocks#table) on Slack's doc site. ### Creating an Instance diff --git a/docs/elements/feedback-buttons.md b/docs/elements/feedback-buttons.md index 6623eeed..e294c937 100644 --- a/docs/elements/feedback-buttons.md +++ b/docs/elements/feedback-buttons.md @@ -1,6 +1,6 @@ # Feedback Buttons -?> **Note:** This document is a reference to the `FeedbackButtonsBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Feedback Buttons docs](https://api.slack.com/reference/block-kit/block-elements#feedback_buttons) on Slack's doc site. +?> **Note:** This document is a reference to the `FeedbackButtonsBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Feedback Buttons docs](https://docs.slack.dev/reference/block-kit/block-elements#feedback_buttons) on Slack's doc site. ### Creating an Instance diff --git a/docs/elements/icon-button.md b/docs/elements/icon-button.md index 0692dfe2..2091c42b 100644 --- a/docs/elements/icon-button.md +++ b/docs/elements/icon-button.md @@ -1,6 +1,6 @@ # Icon Button -?> **Note:** This document is a reference to the `IconButtonBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Icon Button docs](https://api.slack.com/reference/block-kit/block-elements#icon_button) on Slack's doc site. +?> **Note:** This document is a reference to the `IconButtonBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Icon Button docs](https://docs.slack.dev/reference/block-kit/block-elements#icon_button) on Slack's doc site. ### Creating an Instance diff --git a/docs/elements/rich-text-input.md b/docs/elements/rich-text-input.md index f7af612b..9fd5fe7c 100644 --- a/docs/elements/rich-text-input.md +++ b/docs/elements/rich-text-input.md @@ -1,6 +1,6 @@ # Rich Text Input -?> **Note:** This document is a reference to the `RichTextInputBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Rich Text Input docs](https://api.slack.com/reference/block-kit/block-elements#rich_text_input) on Slack's doc site. +?> **Note:** This document is a reference to the `RichTextInputBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Rich Text Input docs](https://docs.slack.dev/reference/block-kit/block-elements#rich_text_input) on Slack's doc site. ### Creating an Instance diff --git a/docs/elements/workflow-button.md b/docs/elements/workflow-button.md index 6a6a41ed..4c477f9a 100644 --- a/docs/elements/workflow-button.md +++ b/docs/elements/workflow-button.md @@ -1,6 +1,6 @@ # Workflow Button -?> **Note:** This document is a reference to the `WorkflowButtonBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Workflow Button docs](https://api.slack.com/reference/block-kit/block-elements#workflow_button) on Slack's doc site. +?> **Note:** This document is a reference to the `WorkflowButtonBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Workflow Button docs](https://docs.slack.dev/reference/block-kit/block-elements#workflow_button) on Slack's doc site. ### Creating an Instance diff --git a/docs/support.md b/docs/support.md index e8305b28..8c07f5ba 100644 --- a/docs/support.md +++ b/docs/support.md @@ -4,7 +4,7 @@ At the time of writing this doc, **Block Builder** supports every component prov Below is a list of supported components and how to access them in **Block Builder**. -?> **Note:** A few of the [composition objects](https://api.slack.com/reference/block-kit/composition-objects), such as the plain-text and markdown objects are not mentioned here, as they are built in the background, as part of a more UI-focus component. +?> **Note:** A few of the [composition objects](https://docs.slack.dev/reference/block-kit/composition-objects), such as the plain-text and markdown objects are not mentioned here, as they are built in the background, as part of a more UI-focus component. | **Name** | **Type** | **Support** | **Accessed Via** | **Docs** |---------------------|--------------------|---------------------|--------------------------------|-------------- diff --git a/src/bits/attachment.ts b/src/bits/attachment.ts index 151ca4cb..980d83eb 100644 --- a/src/bits/attachment.ts +++ b/src/bits/attachment.ts @@ -23,7 +23,7 @@ export interface AttachmentBuilder extends Blocks, } /** - * @@link https://api.slack.com/reference/messaging/attachments + * @@link https://docs.slack.dev/reference/messaging/attachments * @@displayName Attachment */ diff --git a/src/bits/confirmation-dialog.ts b/src/bits/confirmation-dialog.ts index 8a0af63d..c08ff10c 100644 --- a/src/bits/confirmation-dialog.ts +++ b/src/bits/confirmation-dialog.ts @@ -28,7 +28,7 @@ export interface ConfirmationDialogBuilder extends Confirm, } /** - * @@link https://api.slack.com/reference/block-kit/composition-objects#confirm + * @@link https://docs.slack.dev/reference/block-kit/composition-objects#confirm * @@displayName Confirmation Dialog */ diff --git a/src/bits/index.ts b/src/bits/index.ts index b36fdf92..bc25569b 100644 --- a/src/bits/index.ts +++ b/src/bits/index.ts @@ -66,7 +66,7 @@ export type { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.color] Sets the color of the block quote border. * - * {@link https://api.slack.com/reference/messaging/attachments|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/messaging/attachments|View in Slack API Documentation} */ export function Attachment(params?: AttachmentParams): AttachmentBuilder { @@ -80,7 +80,7 @@ export function Attachment(params?: AttachmentParams): AttachmentBuilder { * @param {string} [params.confirm] Sets the text for the button that confirms the action. * @param {string} [params.deny] Sets the text for the button that cancels the action. * - * {@link https://api.slack.com/reference/block-kit/composition-objects#confirm|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/composition-objects#confirm|View in Slack API Documentation} */ export function ConfirmationDialog(params?: ConfirmationDialogParams): ConfirmationDialogBuilder { @@ -94,7 +94,7 @@ export function ConfirmationDialog(params?: ConfirmationDialogParams): Confirmat * @param {string} [params.description] Sets a description shown next to the option, if in a radio button input. * @param {string} [params.url] Sets the URL to redirect the user to when this option is clicked, if in an overlow menu. * - * {@link https://api.slack.com/reference/block-kit/composition-objects#option|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/composition-objects#option|View in Slack API Documentation} */ export function Option(params?: OptionParams): OptionBuilder { @@ -105,7 +105,7 @@ export function Option(params?: OptionParams): OptionBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.label] Sets the label shown above the group of option. * - * {@link https://api.slack.com/reference/block-kit/composition-objects#option_group|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/composition-objects#option_group|View in Slack API Documentation} */ export function OptionGroup(params?: OptionGroupParams): OptionGroupBuilder { @@ -114,7 +114,7 @@ export function OptionGroup(params?: OptionGroupParams): OptionGroupBuilder { /** * @description Creates a rich text section element. - * {@link https://api.slack.com/reference/block-kit/blocks#rich_text_section|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#rich_text_section|View in Slack API Documentation} */ export function RichTextSection(params?: RichTextSectionParams): RichTextSectionBuilder { return new RichTextSectionBuilder(params); @@ -126,7 +126,7 @@ export function RichTextSection(params?: RichTextSectionParams): RichTextSection * @param {number} [params.indent] The indentation level (0-8). * @param {number} [params.border] Whether to show a border (0 or 1). * - * {@link https://api.slack.com/reference/block-kit/blocks#rich_text_list|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#rich_text_list|View in Slack API Documentation} */ export function RichTextList(params?: RichTextListParams): RichTextListBuilder { return new RichTextListBuilder(params); @@ -136,7 +136,7 @@ export function RichTextList(params?: RichTextListParams): RichTextListBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {number} [params.border] Whether to show a border (0 or 1). * - * {@link https://api.slack.com/reference/block-kit/blocks#rich_text_quote|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#rich_text_quote|View in Slack API Documentation} */ export function RichTextQuote(params?: RichTextQuoteParams): RichTextQuoteBuilder { return new RichTextQuoteBuilder(params); @@ -146,7 +146,7 @@ export function RichTextQuote(params?: RichTextQuoteParams): RichTextQuoteBuilde * @param {Object} [params] Parameters passed to the constructor. * @param {number} [params.border] Whether to show a border (0 or 1). * - * {@link https://api.slack.com/reference/block-kit/blocks#rich_text_preformatted|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#rich_text_preformatted|View in Slack API Documentation} */ export function RichTextPreformatted(params?: RichTextPreformattedParams): RichTextPreformattedBuilder { return new RichTextPreformattedBuilder(params); @@ -156,7 +156,7 @@ export function RichTextPreformatted(params?: RichTextPreformattedParams): RichT * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.text] The text content. * - * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} */ export function RichTextText(params?: RichTextTextParams): RichTextTextBuilder { return new RichTextTextBuilder(params); @@ -168,7 +168,7 @@ export function RichTextText(params?: RichTextTextParams): RichTextTextBuilder { * @param {string} [params.unicode] The unicode representation. * @param {string} [params.url] URL for custom emoji. * - * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} */ export function RichTextEmoji(params?: RichTextEmojiParams): RichTextEmojiBuilder { return new RichTextEmojiBuilder(params); @@ -180,7 +180,7 @@ export function RichTextEmoji(params?: RichTextEmojiParams): RichTextEmojiBuilde * @param {string} [params.text] The link text. * @param {boolean} [params.unsafe] Whether the link is unsafe. * - * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} */ export function RichTextLink(params?: RichTextLinkParams): RichTextLinkBuilder { return new RichTextLinkBuilder(params); @@ -190,7 +190,7 @@ export function RichTextLink(params?: RichTextLinkParams): RichTextLinkBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.userId] The user ID to mention. * - * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} */ export function RichTextUser(params?: RichTextUserParams): RichTextUserBuilder { return new RichTextUserBuilder(params); @@ -200,7 +200,7 @@ export function RichTextUser(params?: RichTextUserParams): RichTextUserBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.channelId] The channel ID to mention. * - * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} */ export function RichTextChannel(params?: RichTextChannelParams): RichTextChannelBuilder { return new RichTextChannelBuilder(params); @@ -210,7 +210,7 @@ export function RichTextChannel(params?: RichTextChannelParams): RichTextChannel * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.usergroupId] The usergroup ID to mention. * - * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} */ export function RichTextUsergroup(params?: RichTextUsergroupParams): RichTextUsergroupBuilder { return new RichTextUsergroupBuilder(params); @@ -220,7 +220,7 @@ export function RichTextUsergroup(params?: RichTextUsergroupParams): RichTextUse * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.range] The broadcast range - 'here', 'channel', or 'everyone'. * - * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} */ export function RichTextBroadcast(params?: RichTextBroadcastParams): RichTextBroadcastBuilder { return new RichTextBroadcastBuilder(params); @@ -233,7 +233,7 @@ export function RichTextBroadcast(params?: RichTextBroadcastParams): RichTextBro * @param {string} [params.url] Optional URL to link the date. * @param {string} [params.fallback] Fallback text if date can't be displayed. * - * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} */ export function RichTextDate(params?: RichTextDateParams): RichTextDateBuilder { return new RichTextDateBuilder(params); @@ -243,7 +243,7 @@ export function RichTextDate(params?: RichTextDateParams): RichTextDateBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.value] The hex color value. * - * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} */ export function RichTextColor(params?: RichTextColorParams): RichTextColorBuilder { return new RichTextColorBuilder(params); @@ -253,7 +253,7 @@ export function RichTextColor(params?: RichTextColorParams): RichTextColorBuilde * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.teamId] The team/workspace ID to mention. * - * {@link https://api.slack.com/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} */ export function RichTextTeam(params?: RichTextTeamParams): RichTextTeamBuilder { return new RichTextTeamBuilder(params); diff --git a/src/bits/option-group.ts b/src/bits/option-group.ts index b4f75c21..df8d33a7 100644 --- a/src/bits/option-group.ts +++ b/src/bits/option-group.ts @@ -17,7 +17,7 @@ export interface OptionGroupBuilder extends End, } /** - * @@link https://api.slack.com/reference/block-kit/composition-objects#option_group + * @@link https://docs.slack.dev/reference/block-kit/composition-objects#option_group * @@displayName Option Group */ diff --git a/src/bits/option.ts b/src/bits/option.ts index 5642cb40..ffe592d5 100644 --- a/src/bits/option.ts +++ b/src/bits/option.ts @@ -26,7 +26,7 @@ export interface OptionBuilder extends Description, } /** - * @@link https://api.slack.com/reference/block-kit/composition-objects#option + * @@link https://docs.slack.dev/reference/block-kit/composition-objects#option * @@displayName Option */ diff --git a/src/bits/rich-text-broadcast.ts b/src/bits/rich-text-broadcast.ts index 1c5c3455..b7d0fe7c 100644 --- a/src/bits/rich-text-broadcast.ts +++ b/src/bits/rich-text-broadcast.ts @@ -16,7 +16,7 @@ export interface RichTextBroadcastBuilder extends End { } /** - * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types * @@displayName Rich Text Broadcast Mention */ diff --git a/src/bits/rich-text-channel.ts b/src/bits/rich-text-channel.ts index f0ec7397..cf209569 100644 --- a/src/bits/rich-text-channel.ts +++ b/src/bits/rich-text-channel.ts @@ -16,7 +16,7 @@ export interface RichTextChannelBuilder extends End { } /** - * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types * @@displayName Rich Text Channel Mention */ diff --git a/src/bits/rich-text-color.ts b/src/bits/rich-text-color.ts index ea01a711..f4a5af48 100644 --- a/src/bits/rich-text-color.ts +++ b/src/bits/rich-text-color.ts @@ -16,7 +16,7 @@ export interface RichTextColorBuilder extends End { } /** - * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types * @@displayName Rich Text Color */ diff --git a/src/bits/rich-text-date.ts b/src/bits/rich-text-date.ts index cea0a860..1e4ee611 100644 --- a/src/bits/rich-text-date.ts +++ b/src/bits/rich-text-date.ts @@ -19,7 +19,7 @@ export interface RichTextDateBuilder extends End { } /** - * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types * @@displayName Rich Text Date */ diff --git a/src/bits/rich-text-emoji.ts b/src/bits/rich-text-emoji.ts index 448520d6..a8c8d186 100644 --- a/src/bits/rich-text-emoji.ts +++ b/src/bits/rich-text-emoji.ts @@ -14,7 +14,7 @@ export interface RichTextEmojiBuilder extends End { } /** - * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types * @@displayName Rich Text Emoji */ diff --git a/src/bits/rich-text-link.ts b/src/bits/rich-text-link.ts index e900f768..1970bba3 100644 --- a/src/bits/rich-text-link.ts +++ b/src/bits/rich-text-link.ts @@ -18,7 +18,7 @@ export interface RichTextLinkBuilder extends End { } /** - * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types * @@displayName Rich Text Link */ diff --git a/src/bits/rich-text-list.ts b/src/bits/rich-text-list.ts index 16a27634..1d0d8b81 100644 --- a/src/bits/rich-text-list.ts +++ b/src/bits/rich-text-list.ts @@ -19,7 +19,7 @@ export interface RichTextListBuilder extends End, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#rich_text_list + * @@link https://docs.slack.dev/reference/block-kit/blocks#rich_text_list * @@displayName Rich Text List */ diff --git a/src/bits/rich-text-preformatted.ts b/src/bits/rich-text-preformatted.ts index c931d8a6..68f2a58a 100644 --- a/src/bits/rich-text-preformatted.ts +++ b/src/bits/rich-text-preformatted.ts @@ -17,7 +17,7 @@ export interface RichTextPreformattedBuilder extends End, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#rich_text_preformatted + * @@link https://docs.slack.dev/reference/block-kit/blocks#rich_text_preformatted * @@displayName Rich Text Preformatted */ diff --git a/src/bits/rich-text-quote.ts b/src/bits/rich-text-quote.ts index 5e8b98e5..ddd5ea12 100644 --- a/src/bits/rich-text-quote.ts +++ b/src/bits/rich-text-quote.ts @@ -17,7 +17,7 @@ export interface RichTextQuoteBuilder extends End, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#rich_text_quote + * @@link https://docs.slack.dev/reference/block-kit/blocks#rich_text_quote * @@displayName Rich Text Quote */ diff --git a/src/bits/rich-text-section.ts b/src/bits/rich-text-section.ts index 70157e5e..0bf599e1 100644 --- a/src/bits/rich-text-section.ts +++ b/src/bits/rich-text-section.ts @@ -15,7 +15,7 @@ export interface RichTextSectionBuilder extends End, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#rich_text_section + * @@link https://docs.slack.dev/reference/block-kit/blocks#rich_text_section * @@displayName Rich Text Section */ diff --git a/src/bits/rich-text-team.ts b/src/bits/rich-text-team.ts index d3305da9..76e2c973 100644 --- a/src/bits/rich-text-team.ts +++ b/src/bits/rich-text-team.ts @@ -17,7 +17,7 @@ export interface RichTextTeamBuilder extends End { } /** - * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types * @@displayName Rich Text Team */ diff --git a/src/bits/rich-text-text.ts b/src/bits/rich-text-text.ts index ff2682fd..024111b6 100644 --- a/src/bits/rich-text-text.ts +++ b/src/bits/rich-text-text.ts @@ -16,7 +16,7 @@ export interface RichTextTextBuilder extends End { } /** - * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types * @@displayName Rich Text Text */ diff --git a/src/bits/rich-text-user.ts b/src/bits/rich-text-user.ts index 21e6cbaa..90723a81 100644 --- a/src/bits/rich-text-user.ts +++ b/src/bits/rich-text-user.ts @@ -16,7 +16,7 @@ export interface RichTextUserBuilder extends End { } /** - * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types * @@displayName Rich Text User Mention */ diff --git a/src/bits/rich-text-usergroup.ts b/src/bits/rich-text-usergroup.ts index 07a95a4e..e0282c13 100644 --- a/src/bits/rich-text-usergroup.ts +++ b/src/bits/rich-text-usergroup.ts @@ -16,7 +16,7 @@ export interface RichTextUsergroupBuilder extends End { } /** - * @@link https://api.slack.com/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types * @@displayName Rich Text Usergroup Mention */ diff --git a/src/blocks/actions.ts b/src/blocks/actions.ts index d34a2bda..a452ab1c 100644 --- a/src/blocks/actions.ts +++ b/src/blocks/actions.ts @@ -21,7 +21,7 @@ export interface ActionsBuilder extends BlockId, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#actions + * @@link https://docs.slack.dev/reference/block-kit/blocks#actions * @@displayName Actions */ diff --git a/src/blocks/context-actions.ts b/src/blocks/context-actions.ts index 4093c616..9316b096 100644 --- a/src/blocks/context-actions.ts +++ b/src/blocks/context-actions.ts @@ -17,7 +17,7 @@ export interface ContextActionsBuilder extends BlockId, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#context_actions + * @@link https://docs.slack.dev/reference/block-kit/blocks#context_actions * @@displayName Context Actions */ diff --git a/src/blocks/context.ts b/src/blocks/context.ts index fa173f75..e7f80a03 100644 --- a/src/blocks/context.ts +++ b/src/blocks/context.ts @@ -20,7 +20,7 @@ export interface ContextBuilder extends BlockId, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#context + * @@link https://docs.slack.dev/reference/block-kit/blocks#context * @@displayName Context */ diff --git a/src/blocks/divider.ts b/src/blocks/divider.ts index fcede8aa..e4b07120 100644 --- a/src/blocks/divider.ts +++ b/src/blocks/divider.ts @@ -13,7 +13,7 @@ export interface DividerBuilder extends BlockId, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#divider + * @@link https://docs.slack.dev/reference/block-kit/blocks#divider * @@displayName Divider */ diff --git a/src/blocks/file.ts b/src/blocks/file.ts index c44f661e..8bb097db 100644 --- a/src/blocks/file.ts +++ b/src/blocks/file.ts @@ -19,7 +19,7 @@ export interface FileBuilder extends BlockId, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#file + * @@link https://docs.slack.dev/reference/block-kit/blocks#file * @@displayName File */ diff --git a/src/blocks/header.ts b/src/blocks/header.ts index 2df46461..2f81c49c 100644 --- a/src/blocks/header.ts +++ b/src/blocks/header.ts @@ -19,7 +19,7 @@ export interface HeaderBuilder extends BlockId, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#header + * @@link https://docs.slack.dev/reference/block-kit/blocks#header * @@displayName Header */ diff --git a/src/blocks/image.ts b/src/blocks/image.ts index 7e266e3d..367d5551 100644 --- a/src/blocks/image.ts +++ b/src/blocks/image.ts @@ -25,7 +25,7 @@ export interface ImageBuilder extends AltText, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#image + * @@link https://docs.slack.dev/reference/block-kit/blocks#image * @@displayName Image */ diff --git a/src/blocks/index.ts b/src/blocks/index.ts index b1c511bb..6f2272c2 100644 --- a/src/blocks/index.ts +++ b/src/blocks/index.ts @@ -51,7 +51,7 @@ export type { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. * - * {@link https://api.slack.com/reference/block-kit/blocks#actions|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#actions|View in Slack API Documentation} */ export function Actions(params?: ActionsParams): ActionsBuilder { @@ -62,7 +62,7 @@ export function Actions(params?: ActionsParams): ActionsBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. * - * {@link https://api.slack.com/reference/block-kit/blocks#context|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#context|View in Slack API Documentation} */ export function Context(params?: ContextParams): ContextBuilder { @@ -73,7 +73,7 @@ export function Context(params?: ContextParams): ContextBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. * - * {@link https://api.slack.com/reference/block-kit/blocks#divider|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#divider|View in Slack API Documentation} */ export function Divider(params?: DividerParams): DividerBuilder { @@ -85,7 +85,7 @@ export function Divider(params?: DividerParams): DividerBuilder { * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. * @param {string} [params.externalId] Sets a custom identifier for the file that must be unique for all images on a per-team basis. * - * {@link https://api.slack.com/reference/block-kit/blocks#file|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#file|View in Slack API Documentation} */ export function File(params?: FileParams): FileBuilder { @@ -97,7 +97,7 @@ export function File(params?: FileParams): FileBuilder { * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. * @param {string} [params.text] Sets the text to be displayed in the header block. * - * {@link https://api.slack.com/reference/block-kit/blocks#header|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#header|View in Slack API Documentation} */ export function Header(params?: HeaderParams): HeaderBuilder { @@ -111,7 +111,7 @@ export function Header(params?: HeaderParams): HeaderBuilder { * @param {string} [params.altText] Sets a textual summary for the image. * @param {string} [params.title] Sets an optional title for the image. * - * {@link https://api.slack.com/reference/block-kit/blocks#image|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#image|View in Slack API Documentation} */ export function Image(params?: ImageParams): ImageBuilder { @@ -124,7 +124,7 @@ export function Image(params?: ImageParams): ImageBuilder { * @param {string} [params.label] Sets the label to be displayed above the input. * @param {string} [params.hint] Sets the hint to be displayed under the input. * - * {@link https://api.slack.com/reference/block-kit/blocks#input|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#input|View in Slack API Documentation} */ export function Input(params?: InputParams): InputBuilder { @@ -136,7 +136,7 @@ export function Input(params?: InputParams): InputBuilder { * @param {string} [params.blockId] Sets a string to be an identifier for the block, that will be available in interaction payloadsSets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. * @param {string} [params.text] Sets the text to be displayed in the section block. * - * {@link https://api.slack.com/reference/block-kit/blocks#section|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#section|View in Slack API Documentation} */ export function Section(params?: SectionParams): SectionBuilder { @@ -154,7 +154,7 @@ export function Section(params?: SectionParams): SectionBuilder { * @param {string} [params.titleUrl] A hyperlink for the video's title text. * @param {string} [params.videoUrl] The URL of the video to embed in the Video block. * - * {@link https://api.slack.com/reference/block-kit/blocks#section|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#section|View in Slack API Documentation} */ export function Video(params?: VideoParams): VideoBuilder { @@ -165,7 +165,7 @@ export function Video(params?: VideoParams): VideoBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. * - * {@link https://api.slack.com/reference/block-kit/blocks#rich_text|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#rich_text|View in Slack API Documentation} */ export function RichText(params?: RichTextParams): RichTextBuilder { @@ -177,7 +177,7 @@ export function RichText(params?: RichTextParams): RichTextBuilder { * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. * @param {string} [params.text] Sets the markdown text content. * - * {@link https://api.slack.com/reference/block-kit/blocks#markdown|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#markdown|View in Slack API Documentation} */ export function Markdown(params?: MarkdownParams): MarkdownBuilder { @@ -188,7 +188,7 @@ export function Markdown(params?: MarkdownParams): MarkdownBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. * - * {@link https://api.slack.com/reference/block-kit/blocks#table|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#table|View in Slack API Documentation} */ export function Table(params?: TableParams): TableBuilder { @@ -199,7 +199,7 @@ export function Table(params?: TableParams): TableBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. * - * {@link https://api.slack.com/reference/block-kit/blocks#context_actions|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks#context_actions|View in Slack API Documentation} */ export function ContextActions(params?: ContextActionsParams): ContextActionsBuilder { diff --git a/src/blocks/input.ts b/src/blocks/input.ts index dfccf6fa..706ccafa 100644 --- a/src/blocks/input.ts +++ b/src/blocks/input.ts @@ -31,7 +31,7 @@ export interface InputBuilder extends BlockId, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#input + * @@link https://docs.slack.dev/reference/block-kit/blocks#input * @@displayName Input */ diff --git a/src/blocks/markdown.ts b/src/blocks/markdown.ts index 007d3b72..6bb29448 100644 --- a/src/blocks/markdown.ts +++ b/src/blocks/markdown.ts @@ -19,7 +19,7 @@ export interface MarkdownBuilder extends BlockId, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#markdown + * @@link https://docs.slack.dev/reference/block-kit/blocks#markdown * @@displayName Markdown */ diff --git a/src/blocks/rich-text.ts b/src/blocks/rich-text.ts index 7e2352f5..0c455e50 100644 --- a/src/blocks/rich-text.ts +++ b/src/blocks/rich-text.ts @@ -21,7 +21,7 @@ export interface RichTextBuilder extends BlockId, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#rich_text + * @@link https://docs.slack.dev/reference/block-kit/blocks#rich_text * @@displayName Rich Text */ diff --git a/src/blocks/section.ts b/src/blocks/section.ts index 95930e08..7a4d755f 100644 --- a/src/blocks/section.ts +++ b/src/blocks/section.ts @@ -30,7 +30,7 @@ export interface SectionBuilder extends Accessory, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#section + * @@link https://docs.slack.dev/reference/block-kit/blocks#section * @@displayName Section */ diff --git a/src/blocks/table.ts b/src/blocks/table.ts index cd852fe2..13b82be0 100644 --- a/src/blocks/table.ts +++ b/src/blocks/table.ts @@ -23,7 +23,7 @@ export interface TableBuilder extends BlockId, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#table + * @@link https://docs.slack.dev/reference/block-kit/blocks#table * @@displayName Table */ diff --git a/src/blocks/video.ts b/src/blocks/video.ts index f81c1e04..1f5c5f1b 100644 --- a/src/blocks/video.ts +++ b/src/blocks/video.ts @@ -42,7 +42,7 @@ export interface VideoBuilder extends AltText, } /** - * @@link https://api.slack.com/reference/block-kit/blocks#video + * @@link https://docs.slack.dev/reference/block-kit/blocks#video * @@displayName Video */ diff --git a/src/elements/button.ts b/src/elements/button.ts index 2f9b9038..b11e927a 100644 --- a/src/elements/button.ts +++ b/src/elements/button.ts @@ -37,7 +37,7 @@ export interface ButtonBuilder extends AccessibilityLabel, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#button + * @@link https://docs.slack.dev/reference/block-kit/block-elements#button * @@displayName Button */ diff --git a/src/elements/channel-multi-select.ts b/src/elements/channel-multi-select.ts index 83ce6221..924a1d6d 100644 --- a/src/elements/channel-multi-select.ts +++ b/src/elements/channel-multi-select.ts @@ -31,7 +31,7 @@ export interface ChannelMultiSelectBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#channel_multi_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements#channel_multi_select * @@displayName Channel Multi-Select */ diff --git a/src/elements/channel-select.ts b/src/elements/channel-select.ts index 9efdff33..2bf0c51c 100644 --- a/src/elements/channel-select.ts +++ b/src/elements/channel-select.ts @@ -31,7 +31,7 @@ export interface ChannelSelectBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#channel_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements#channel_select * @@displayName Channel Select */ diff --git a/src/elements/checkboxes.ts b/src/elements/checkboxes.ts index d2f29b01..5c2c5176 100644 --- a/src/elements/checkboxes.ts +++ b/src/elements/checkboxes.ts @@ -27,7 +27,7 @@ export interface CheckboxesBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#checkboxes + * @@link https://docs.slack.dev/reference/block-kit/block-elements#checkboxes * @@displayName Checkboxes */ diff --git a/src/elements/conversation-multi-select.ts b/src/elements/conversation-multi-select.ts index 254dca16..c7e42217 100644 --- a/src/elements/conversation-multi-select.ts +++ b/src/elements/conversation-multi-select.ts @@ -44,7 +44,7 @@ export interface ConversationMultiSelectBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#conversation_multi_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements#conversation_multi_select * @@displayName Conversation Multi-Select */ diff --git a/src/elements/conversation-select.ts b/src/elements/conversation-select.ts index f8bbac59..7f5b9641 100644 --- a/src/elements/conversation-select.ts +++ b/src/elements/conversation-select.ts @@ -44,7 +44,7 @@ export interface ConversationSelectBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#conversation_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements#conversation_select * @@displayName Conversation Select */ diff --git a/src/elements/date-picker.ts b/src/elements/date-picker.ts index 214643bf..647b16e1 100644 --- a/src/elements/date-picker.ts +++ b/src/elements/date-picker.ts @@ -34,7 +34,7 @@ export interface DatePickerBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#datepicker + * @@link https://docs.slack.dev/reference/block-kit/block-elements#datepicker * @@displayName Date Picker */ diff --git a/src/elements/date-time-picker.ts b/src/elements/date-time-picker.ts index e4e43c6d..065674a7 100644 --- a/src/elements/date-time-picker.ts +++ b/src/elements/date-time-picker.ts @@ -26,7 +26,7 @@ export interface DateTimePickerBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#datetimepicker + * @@link https://docs.slack.dev/reference/block-kit/block-elements#datetimepicker * @@displayName Date Picker */ diff --git a/src/elements/email-input.ts b/src/elements/email-input.ts index b8bf324a..e0a5af15 100644 --- a/src/elements/email-input.ts +++ b/src/elements/email-input.ts @@ -28,7 +28,7 @@ export interface EmailInputBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#email + * @@link https://docs.slack.dev/reference/block-kit/block-elements#email * @@displayName Email Input */ diff --git a/src/elements/external-multi-select.ts b/src/elements/external-multi-select.ts index 1bd47e25..d31bc4c6 100644 --- a/src/elements/external-multi-select.ts +++ b/src/elements/external-multi-select.ts @@ -39,7 +39,7 @@ export interface ExternalMultiSelectBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#external_multi_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements#external_multi_select * @@displayName External Multi-Select */ diff --git a/src/elements/external-select.ts b/src/elements/external-select.ts index 3020ff18..e325d029 100644 --- a/src/elements/external-select.ts +++ b/src/elements/external-select.ts @@ -31,7 +31,7 @@ export interface ExternalSelectBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#external_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements#external_select * @@displayName External Select */ diff --git a/src/elements/feedback-buttons.ts b/src/elements/feedback-buttons.ts index a8b25ef2..2083bee8 100644 --- a/src/elements/feedback-buttons.ts +++ b/src/elements/feedback-buttons.ts @@ -24,7 +24,7 @@ export interface FeedbackButtonsBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#feedback_buttons + * @@link https://docs.slack.dev/reference/block-kit/block-elements#feedback_buttons * @@displayName Feedback Buttons */ diff --git a/src/elements/file-input.ts b/src/elements/file-input.ts index 95053070..276e6c91 100644 --- a/src/elements/file-input.ts +++ b/src/elements/file-input.ts @@ -22,7 +22,7 @@ export interface FileInputBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#file_input + * @@link https://docs.slack.dev/reference/block-kit/block-elements#file_input * @@displayName File Input Builder */ diff --git a/src/elements/icon-button.ts b/src/elements/icon-button.ts index abcce4ac..c1f65a3e 100644 --- a/src/elements/icon-button.ts +++ b/src/elements/icon-button.ts @@ -32,7 +32,7 @@ export interface IconButtonBuilder extends AccessibilityLabel, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#icon_button + * @@link https://docs.slack.dev/reference/block-kit/block-elements#icon_button * @@displayName Icon Button */ diff --git a/src/elements/img.ts b/src/elements/img.ts index 4a1dccf0..0ec77195 100644 --- a/src/elements/img.ts +++ b/src/elements/img.ts @@ -19,7 +19,7 @@ export interface ImgBuilder extends AltText, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#image + * @@link https://docs.slack.dev/reference/block-kit/block-elements#image * @@displayName Image */ diff --git a/src/elements/index.ts b/src/elements/index.ts index 793b2c4b..706b135c 100644 --- a/src/elements/index.ts +++ b/src/elements/index.ts @@ -97,7 +97,7 @@ export type { * @param {string} [params.url] Sets the URL to redirect the user to when this button is clicked. * @param {string} [params.value] Sets the value to be passed to your app when this button is clicked. * - * {@link https://api.slack.com/reference/block-kit/block-elements#button|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#button|View in Slack API Documentation} */ export function Button(params?: ButtonParams): ButtonBuilder { @@ -110,7 +110,7 @@ export function Button(params?: ButtonParams): ButtonBuilder { * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select. * - * {@link https://api.slack.com/reference/block-kit/block-elements#channel_multi_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#channel_multi_select|View in Slack API Documentation} */ export function ChannelMultiSelect(params?: ChannelMultiSelectParams): ChannelMultiSelectBuilder { @@ -123,7 +123,7 @@ export function ChannelMultiSelect(params?: ChannelMultiSelectParams): ChannelMu * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialChannel] Sets the default selected item in the menu. * - * {@link https://api.slack.com/reference/block-kit/block-elements#channel_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#channel_select|View in Slack API Documentation} */ export function ChannelSelect(params?: ChannelSelectParams): ChannelSelectBuilder { @@ -134,7 +134,7 @@ export function ChannelSelect(params?: ChannelSelectParams): ChannelSelectBuilde * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * - * {@link https://api.slack.com/reference/block-kit/block-elements#checkboxes|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#checkboxes|View in Slack API Documentation} */ export function Checkboxes(params?: CheckboxesParams): CheckboxesBuilder { @@ -147,7 +147,7 @@ export function Checkboxes(params?: CheckboxesParams): CheckboxesBuilder { * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select. * - * {@link https://api.slack.com/reference/block-kit/block-elements#conversation_multi_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#conversation_multi_select|View in Slack API Documentation} */ export function ConversationMultiSelect(params?: ConversationMultiSelectParams): ConversationMultiSelectBuilder { @@ -160,7 +160,7 @@ export function ConversationMultiSelect(params?: ConversationMultiSelectParams): * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialConversation] Sets the default selected item in the menu. * - * {@link https://api.slack.com/reference/block-kit/block-elements#conversation_multi_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#conversation_multi_select|View in Slack API Documentation} */ export function ConversationSelect(params?: ConversationSelectParams): ConversationSelectBuilder { @@ -173,7 +173,7 @@ export function ConversationSelect(params?: ConversationSelectParams): Conversat * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialDate] Sets the default selected date in the menu. * - * {@link https://api.slack.com/reference/block-kit/block-elements#datepicker|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#datepicker|View in Slack API Documentation} */ export function DatePicker(params?: DatePickerParams): DatePickerBuilder { @@ -185,7 +185,7 @@ export function DatePicker(params?: DatePickerParams): DatePickerBuilder { * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.initialDateTime] Sets the default selected date and time for the date time picker. * - * {@link https://api.slack.com/reference/block-kit/block-elements#datetimepicker|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#datetimepicker|View in Slack API Documentation} */ export function DateTimePicker(params?: DateTimePickerParams): DateTimePickerBuilder { @@ -198,7 +198,7 @@ export function DateTimePicker(params?: DateTimePickerParams): DateTimePickerBui * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialValue] Sets the default email entered into the Email input at modal render. * - * {@link https://api.slack.com/reference/block-kit/block-elements#email|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#email|View in Slack API Documentation} */ export function EmailInput(params?: EmailInputParams): EmailInputBuilder { @@ -212,7 +212,7 @@ export function EmailInput(params?: EmailInputParams): EmailInputBuilder { * @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select. * @param {int} [params.minQueryLength] Sets a minimum number of characters types before querying your options URL. * - * {@link https://api.slack.com/reference/block-kit/block-elements#external_multi_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#external_multi_select|View in Slack API Documentation} */ export function ExternalMultiSelect(params?: ExternalMultiSelectParams): ExternalMultiSelectBuilder { @@ -225,7 +225,7 @@ export function ExternalMultiSelect(params?: ExternalMultiSelectParams): Externa * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [params.minQueryLength] Sets a minimum number of characters types before querying your options URL. * - * {@link https://api.slack.com/reference/block-kit/block-elements#external_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#external_select|View in Slack API Documentation} */ export function ExternalSelect(params?: ExternalSelectParams): ExternalSelectBuilder { @@ -237,7 +237,7 @@ export function ExternalSelect(params?: ExternalSelectParams): ExternalSelectBui * @param {string} [params.imageUrl] Sets the source URL from which the image will be loaded. * @param {string} [params.altText] Sets the textual summary of the image. * - * {@link https://api.slack.com/reference/block-kit/block-elements#image|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#image|View in Slack API Documentation} */ export function Img(params?: ImgParams): ImgBuilder { @@ -249,7 +249,7 @@ export function Img(params?: ImgParams): ImgBuilder { * @param {string} [params.filetypes] Sets the accepted filetypes. * @param {string} [params.maxFiles] Sets the maximum number of files to upload. * - * {@link https://api.slack.com/reference/block-kit/block-elements#file_input|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#file_input|View in Slack API Documentation} */ export function FileInput(params?: FileInputParams): FileInputBuilder { @@ -265,7 +265,7 @@ export function FileInput(params?: FileInputParams): FileInputBuilder { * @param {int} [params.minValue] Sets a minimum value for the number input. * @param {int} [params.maxValue] Sets a maximum value for the number input. * - * {@link https://api.slack.com/reference/block-kit/block-elements#number|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#number|View in Slack API Documentation} */ export function NumberInput(params?: NumberInputParams): NumberInputBuilder { @@ -276,7 +276,7 @@ export function NumberInput(params?: NumberInputParams): NumberInputBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * - * {@link https://api.slack.com/reference/block-kit/block-elements#overflow|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#overflow|View in Slack API Documentation} */ export function OverflowMenu(params?: OverflowMenuParams): OverflowMenuBuilder { @@ -287,7 +287,7 @@ export function OverflowMenu(params?: OverflowMenuParams): OverflowMenuBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * - * {@link https://api.slack.com/reference/block-kit/block-elements#radio|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#radio|View in Slack API Documentation} */ export function RadioButtons(params?: RadioButtonsParams): RadioButtonsBuilder { @@ -300,7 +300,7 @@ export function RadioButtons(params?: RadioButtonsParams): RadioButtonsBuilder { * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select. * - * {@link https://api.slack.com/reference/block-kit/block-elements#static_multi_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#static_multi_select|View in Slack API Documentation} */ export function StaticMultiSelect(params?: StaticMultiSelectParams): StaticMultiSelectBuilder { @@ -312,7 +312,7 @@ export function StaticMultiSelect(params?: StaticMultiSelectParams): StaticMulti * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * - * {@link https://api.slack.com/reference/block-kit/block-elements#static_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#static_select|View in Slack API Documentation} */ export function StaticSelect(params?: StaticSelectParams): StaticSelectBuilder { @@ -328,7 +328,7 @@ export function StaticSelect(params?: StaticSelectParams): StaticSelectBuilder { * @param {int} [params.minLength] Sets a minimum character count in order for the user to submit the form. * @param {int} [params.maxLength] Sets a maximum character count allowed to send the form. * - * {@link https://api.slack.com/reference/block-kit/block-elements#input|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#input|View in Slack API Documentation} */ export function TextInput(params?: TextInputParams): TextInputBuilder { @@ -341,7 +341,7 @@ export function TextInput(params?: TextInputParams): TextInputBuilder { * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialTime] Sets the default selected time in the menu. * - * {@link https://api.slack.com/reference/block-kit/block-elements#timepicker|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#timepicker|View in Slack API Documentation} */ export function TimePicker(params?: TimePickerParams): TimePickerBuilder { @@ -354,7 +354,7 @@ export function TimePicker(params?: TimePickerParams): TimePickerBuilder { * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialValue] Sets the default URL entered into the URL input at modal render. * - * {@link https://api.slack.com/reference/block-kit/block-elements#url|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#url|View in Slack API Documentation} */ export function URLInput(params?: URLInputParams): URLInputBuilder { @@ -367,7 +367,7 @@ export function URLInput(params?: URLInputParams): URLInputBuilder { * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select. * - * {@link https://api.slack.com/reference/block-kit/block-elements#users_multi_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#users_multi_select|View in Slack API Documentation} */ export function UserMultiSelect(params?: UserMultiSelectParams): UserMultiSelectBuilder { @@ -380,7 +380,7 @@ export function UserMultiSelect(params?: UserMultiSelectParams): UserMultiSelect * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialUser] Setts the default selected user in the menu. * - * {@link https://api.slack.com/reference/block-kit/block-elements#users_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#users_select|View in Slack API Documentation} */ export function UserSelect(params?: UserSelectParams): UserSelectBuilder { @@ -392,7 +392,7 @@ export function UserSelect(params?: UserSelectParams): UserSelectBuilder { * @param {string} [params.text] Sets the display text for the workflow button. * @param {string} [params.accessibilityLabel] Sets accessibility label. * - * {@link https://api.slack.com/reference/block-kit/block-elements#workflow_button|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#workflow_button|View in Slack API Documentation} */ export function WorkflowButton(params?: WorkflowButtonParams): WorkflowButtonBuilder { @@ -405,7 +405,7 @@ export function WorkflowButton(params?: WorkflowButtonParams): WorkflowButtonBui * @param {string} [params.icon] Sets the icon to display. * @param {string} [params.text] Sets the text for the button. * - * {@link https://api.slack.com/reference/block-kit/block-elements#icon_button|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#icon_button|View in Slack API Documentation} */ export function IconButton(params?: IconButtonParams): IconButtonBuilder { @@ -416,7 +416,7 @@ export function IconButton(params?: IconButtonParams): IconButtonBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action. * - * {@link https://api.slack.com/reference/block-kit/block-elements#feedback_buttons|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#feedback_buttons|View in Slack API Documentation} */ export function FeedbackButtons(params?: FeedbackButtonsParams): FeedbackButtonsBuilder { @@ -428,7 +428,7 @@ export function FeedbackButtons(params?: FeedbackButtonsParams): FeedbackButtons * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action. * @param {string} [params.placeholder] Sets placeholder text. * - * {@link https://api.slack.com/reference/block-kit/block-elements#rich_text_input|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements#rich_text_input|View in Slack API Documentation} */ export function RichTextInput(params?: RichTextInputParams): RichTextInputBuilder { diff --git a/src/elements/number-input.ts b/src/elements/number-input.ts index cacd1c64..150240bb 100644 --- a/src/elements/number-input.ts +++ b/src/elements/number-input.ts @@ -42,7 +42,7 @@ export interface NumberInputBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#number + * @@link https://docs.slack.dev/reference/block-kit/block-elements#number * @@displayName Email Input */ diff --git a/src/elements/overflow-menu.ts b/src/elements/overflow-menu.ts index 2c2ccdb6..d5fc39e6 100644 --- a/src/elements/overflow-menu.ts +++ b/src/elements/overflow-menu.ts @@ -23,7 +23,7 @@ export interface OverflowMenuBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#overflow + * @@link https://docs.slack.dev/reference/block-kit/block-elements#overflow * @@displayName Overflow Menu */ diff --git a/src/elements/radio-buttons.ts b/src/elements/radio-buttons.ts index 1781dc52..a9685b1a 100644 --- a/src/elements/radio-buttons.ts +++ b/src/elements/radio-buttons.ts @@ -27,7 +27,7 @@ export interface RadioButtonsBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#radio + * @@link https://docs.slack.dev/reference/block-kit/block-elements#radio * @@displayName Radio Buttons */ diff --git a/src/elements/rich-text-input.ts b/src/elements/rich-text-input.ts index 63762716..36a16050 100644 --- a/src/elements/rich-text-input.ts +++ b/src/elements/rich-text-input.ts @@ -30,7 +30,7 @@ export interface RichTextInputBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#rich_text_input + * @@link https://docs.slack.dev/reference/block-kit/block-elements/rich-text-input-element * @@displayName Rich Text Input */ diff --git a/src/elements/static-multi-select.ts b/src/elements/static-multi-select.ts index bd78e8fc..f7c1c003 100644 --- a/src/elements/static-multi-select.ts +++ b/src/elements/static-multi-select.ts @@ -29,7 +29,7 @@ export interface StaticMultiSelectParams { } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#static_multi_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements#static_multi_select * @@displayName Static Multi-Select */ diff --git a/src/elements/static-select.ts b/src/elements/static-select.ts index 36f06b3b..6968f721 100644 --- a/src/elements/static-select.ts +++ b/src/elements/static-select.ts @@ -37,7 +37,7 @@ export interface StaticSelectBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#static_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements#static_select * @@displayName Static Select */ diff --git a/src/elements/text-input.ts b/src/elements/text-input.ts index 8ea2f54c..ab29665f 100644 --- a/src/elements/text-input.ts +++ b/src/elements/text-input.ts @@ -37,7 +37,7 @@ export interface TextInputBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#input + * @@link https://docs.slack.dev/reference/block-kit/block-elements#input * @@displayName Plain-Text Input */ diff --git a/src/elements/timepicker.ts b/src/elements/timepicker.ts index cc33569e..e7c0b716 100644 --- a/src/elements/timepicker.ts +++ b/src/elements/timepicker.ts @@ -29,7 +29,7 @@ export interface TimePickerBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#timepicker + * @@link https://docs.slack.dev/reference/block-kit/block-elements#timepicker * @@displayName Time Picker */ diff --git a/src/elements/url-input.ts b/src/elements/url-input.ts index ba07849f..0c60868b 100644 --- a/src/elements/url-input.ts +++ b/src/elements/url-input.ts @@ -28,7 +28,7 @@ export interface URLInputBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#url + * @@link https://docs.slack.dev/reference/block-kit/block-elements#url * @@displayName URL Input */ diff --git a/src/elements/user-multi-select.ts b/src/elements/user-multi-select.ts index 75ddf660..51713d75 100644 --- a/src/elements/user-multi-select.ts +++ b/src/elements/user-multi-select.ts @@ -30,7 +30,7 @@ export interface UserMultiSelectBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#users_multi_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements#users_multi_select * @@displayName User Multi-Select */ diff --git a/src/elements/user-select.ts b/src/elements/user-select.ts index c66556c4..0ac04d24 100644 --- a/src/elements/user-select.ts +++ b/src/elements/user-select.ts @@ -28,7 +28,7 @@ export interface UserSelectBuilder extends ActionId, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#users_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements#users_select * @@displayName User Select */ diff --git a/src/elements/workflow-button.ts b/src/elements/workflow-button.ts index 5a643722..479794d8 100644 --- a/src/elements/workflow-button.ts +++ b/src/elements/workflow-button.ts @@ -40,7 +40,7 @@ export interface WorkflowButtonBuilder extends AccessibilityLabel, } /** - * @@link https://api.slack.com/reference/block-kit/block-elements#workflow_button + * @@link https://docs.slack.dev/reference/block-kit/block-elements#workflow_button * @@displayName Workflow Button */ diff --git a/src/internal/methods/append-methods.ts b/src/internal/methods/append-methods.ts index 41e3c13f..0aa2708b 100644 --- a/src/internal/methods/append-methods.ts +++ b/src/internal/methods/append-methods.ts @@ -11,7 +11,7 @@ export abstract class Attachments extends Builder { /** * @description Adds attachments to your message. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -28,7 +28,7 @@ export abstract class Blocks extends Builder { * * **Required for modals, home tabs, and workflow steps** ⚠ * * Maximum of 100 blocks. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -46,7 +46,7 @@ export abstract class Elements extends Builder { * * Maximum of 5 elements. * * Supported elements are buttons, select and overflow menus, and date pickers. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -65,7 +65,7 @@ export abstract class Fields extends Builder { * * Maximum of 2000 characters for each field. * * Markdown supported. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -81,7 +81,7 @@ export abstract class Filter extends Builder { * **Slack Validation Rules and Tips:** * * Possible values are *im*, *impm*, *private*, and *public*. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -94,7 +94,7 @@ export abstract class InitialChannels extends Builder { /** * @description Pre-populates the menu with selected, default channels. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -107,7 +107,7 @@ export abstract class InitialConversations extends Builder { /** * @description Pre-populates the menu with selected, default conversations. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -123,7 +123,7 @@ export abstract class InitialOptions extends Builder { * **Slack Validation Rules and Tips:** * * Must be exact matches to options in the menu. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -136,7 +136,7 @@ export abstract class InitialUsers extends Builder { /** * @description Pre-populates the menu with selected, default users. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -153,7 +153,7 @@ export abstract class OptionGroups extends Builder { * * Maximum of 100 options. * * Both options and options groups cannot be defined at the same time for any element. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -171,7 +171,7 @@ export abstract class Options extends Builder { * * Maximum of 100 options. * * Both options and options groups cannot be defined at the same time for any element. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ diff --git a/src/internal/methods/configuration-methods.ts b/src/internal/methods/configuration-methods.ts index 2c425f84..228f987c 100644 --- a/src/internal/methods/configuration-methods.ts +++ b/src/internal/methods/configuration-methods.ts @@ -13,7 +13,7 @@ export abstract class AsUser extends Builder { /** * @description Sets the message to be sent as either the user whose auth token is being used or as the bot user associated with your app. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -26,7 +26,7 @@ export abstract class ClearOnClose extends Builder { /** * @description Instructs the Slack API to close all open views in the view stack when this particular view is closed. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -39,7 +39,7 @@ export abstract class Danger extends Builder { /** * @description For a button element, this changes the color to red. For confirmation dialogs, this sets the main button in the bottom right corner to red, indicating that an action is potentially destructive. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -55,7 +55,7 @@ export abstract class DefaultToCurrentConversation extends Builder { * **Slack Validation Rules and Tips:** * * If initial conversations are provided, this option is ignored. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -68,7 +68,7 @@ export abstract class DeleteOriginal extends Builder { /** * @description Instructs the Slack API to delete the message from which the interaction originated when sending the current message. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -81,7 +81,7 @@ export abstract class DispatchAction extends Builder { /** * @description Instructs the Slack API to send an interaction event to your app when the element in the input block has been interacted with. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -94,7 +94,7 @@ export abstract class DispatchActionOnCharacterEntered extends Builder { /** * @description Instructs the Slack API to dispatch an interaction payload to your app when the user enters or deletes a character in the input. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -107,7 +107,7 @@ export abstract class DispatchActionOnEnterPressed extends Builder { /** * @description Instructs the Slack API to dispatch an interaction payload to your app when the user presses the enter key while the input is in focus. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -120,7 +120,7 @@ export abstract class Ephemeral extends Builder { /** * @description Instructs the Slack API to display the message only to the user who invoked the interaction payload or slash command. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -133,7 +133,7 @@ export abstract class ExcludeExternalSharedChannels extends Builder { /** * @description Excludes conversations shared with external organizations from the menu's options. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -146,7 +146,7 @@ export abstract class ExcludeBotUsers extends Builder { /** * @description Excludes conversations with bot users from the menu's options. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -159,7 +159,7 @@ export abstract class FocusOnLoad extends Builder { /** * @description Sets an element to have auto focus on opening the view * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -172,7 +172,7 @@ export abstract class IgnoreMarkdown extends Builder { /** * @description Instructs the Slack API to ignore any markdown in the text property of the message. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -185,7 +185,7 @@ export abstract class InChannel extends Builder { /** * @description Instructs the Slack API to make the message visible to everyone in the channel from which the interaction payload or slash command originated. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -198,7 +198,7 @@ export abstract class Multiline extends Builder { /** * @description Sets the text input to be a larger, multi-line input for larger portions of text. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -211,7 +211,7 @@ export abstract class NotifyOnClose extends Builder { /** * @description Instructs the Slack API to send an interaction payload to your app when the view is closed. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -224,7 +224,7 @@ export abstract class Optional extends Builder { /** * @description Lets the Slack API know that inputting data in the the input is not required for the view to be successfully submitted. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -237,7 +237,7 @@ export abstract class Primary extends Builder { /** * @description For a button element, this changes the color to green. For confirmation dialogs, this sets the main button in the bottom right corner to green, which is meant to confirm the action. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -250,7 +250,7 @@ export abstract class ReplaceOriginal extends Builder { /** * @description Instructs the Slack API to replace the original message, from which the interaction payload originated, with the current message. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -266,7 +266,7 @@ export abstract class ResponseUrlEnabled extends Builder { * **Slack Validation Rules and Tips:** * * Only available in views with input blocks. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -279,7 +279,7 @@ export abstract class SubmitDisabled extends Builder { /** * @description Configures the workflow step to have a disabled submit button until the user has input data into one or more inputs. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ diff --git a/src/internal/methods/other-methods.ts b/src/internal/methods/other-methods.ts index 42e0cdfd..e6ae25ac 100644 --- a/src/internal/methods/other-methods.ts +++ b/src/internal/methods/other-methods.ts @@ -30,7 +30,7 @@ export abstract class End extends Builder { /** * @description Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -43,7 +43,7 @@ export abstract class GetAttachments extends Builder { /** * @description Builds the view and returns a Slack API-compatible array of attachments. * - * {@link https://api.slack.com/reference/messaging/attachments|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/messaging/attachments|View in Slack API Documentation} */ public getAttachments(): Readonly[] { @@ -55,7 +55,7 @@ export abstract class GetBlocks extends Builder { /** * @description Builds the view and returns a Slack API-compatible array of blocks. * - * {@link https://api.slack.com/block-kit|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit|View in Slack API Documentation} */ public getBlocks(): Readonly[] { diff --git a/src/internal/methods/set-methods.ts b/src/internal/methods/set-methods.ts index 3c7bbf1e..36e95055 100644 --- a/src/internal/methods/set-methods.ts +++ b/src/internal/methods/set-methods.ts @@ -14,7 +14,7 @@ export abstract class AccessibilityLabel extends Builder { * **Slack Validation Rules and Tips:** * * Maximum of 75 characters. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -31,7 +31,7 @@ export abstract class Accessory extends Builder { * * Maximum of 1 element. * * Can be any one of the elements. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -49,7 +49,7 @@ export abstract class ActionId extends Builder { * * Each element in a view or message must have its own unique action ID. * * Maximum of 255 characters. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -68,7 +68,7 @@ export abstract class AltText extends Builder { * * Maximum of 2000 characters. * * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -85,7 +85,7 @@ export abstract class AuthorName extends Builder { * * Maximum of 50 characters. * * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -103,7 +103,7 @@ export abstract class BlockId extends Builder { * * Each block in a view or message must have its own unique action ID. * * If the contents of a block is updated, the block ID should also be updated. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -120,7 +120,7 @@ export abstract class CallbackId extends Builder { * * Maximum of 255 characters. * * It is recommended that sensitive data not be stored in the callback ID. Instead, use the `privateMetaData()` method. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -133,7 +133,7 @@ export abstract class Channel extends Builder { /** * @description Sets the Slack channel ID to which the message will be sent via the API. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -149,7 +149,7 @@ export abstract class Close extends Builder { * **Slack Validation Rules and Tips:** * * Maximum of 24 characters. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -162,7 +162,7 @@ export abstract class Color extends Builder { /** * @description Sets the color for the blockquote border to the left of the attachment. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -175,7 +175,7 @@ export abstract class Confirm extends Builder { /** * @description For confirmation dialogs, sets the text of the button that confirms the action to which the confirmation dialog has been added. For elements, adds a confirmation dialog that is displayed when the user interacts with the element to confirm the selection or action. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -192,7 +192,7 @@ export abstract class Deny extends Builder { * * **Required** ⚠ * * Maximum of 30 characters. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -208,7 +208,7 @@ export abstract class Description extends Builder { * **Slack Validation Rules and Tips:** * * Maximum of 75 characters. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -226,7 +226,7 @@ export abstract class Element extends Builder { * * Maximum of 1 element. * * Supports text inputs, select and multi-select menus, as well as date pickers and checkbox inputs. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -243,7 +243,7 @@ export abstract class ExternalId extends Builder { * * Maximum of 255 characters. * * When used, an external ID must be unique to a certain view. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -256,7 +256,7 @@ export abstract class Fallback extends Builder { /** * @description Sets the plain text summary of the attachment used in clients that can't display formatted text (eg. IRC, mobile notifications). * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -272,7 +272,7 @@ export abstract class Hint extends Builder { * **Slack Validation Rules and Tips:** * * Maximum of 2000 characters. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -289,7 +289,7 @@ export abstract class ImageUrl extends Builder { * * **Required** ⚠ * * Maximum of 2000 characters. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -302,7 +302,7 @@ export abstract class InitialChannel extends Builder { /** * @description Pre-populates the menu with a selected, default channel. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -315,7 +315,7 @@ export abstract class InitialConversation extends Builder { /** * @description Pre-populates the menu with a selected, default conversation. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -328,7 +328,7 @@ export abstract class InitialDate extends Builder { /** * @description Pre-populates the date picker with a selected, default date. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -341,7 +341,7 @@ export abstract class InitialDateTime extends Builder { /** * @description Pre-populates the date time picker with a selected, default date and time. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -357,7 +357,7 @@ export abstract class InitialOption extends Builder { * **Slack Validation Rules and Tips:** * * Must be an exact match for one of the options in the menu. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -373,7 +373,7 @@ export abstract class InitialTime extends Builder { * **Slack Validation Rules and Tips:** * * Set in HH:mm format, where HH is 24-hour hour format and mm is minutes with a leading zero. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -386,7 +386,7 @@ export abstract class InitialUser extends Builder { /** * @description Pre-populates the menu with a selected, default user. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -399,7 +399,7 @@ export abstract class InitialValue extends Builder { /** * @description Pre-populates the input with a default value. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -415,7 +415,7 @@ export abstract class IsDecimalAllowed extends Builder { * **Slack Validation Rules and Tips:** * * **Required** ⚠ * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -433,7 +433,7 @@ export abstract class Label extends Builder { * * For input blocks, maximum of 2000 characters. * * For option groups, maximum of 75 characters. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -446,7 +446,7 @@ export abstract class MaxLength extends Builder { /** * @description Sets a maximum character count allowed in the given text input. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -459,7 +459,7 @@ export abstract class MaxSelectedItems extends Builder { /** * @description Sets a limit to how many items the user can select in the multi-select menu. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -475,7 +475,7 @@ export abstract class MaxValue extends Builder { * **Slack Validation Rules and Tips:** * * Cannot be less than the minimum value. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -491,7 +491,7 @@ export abstract class MinQueryLength extends Builder { * **Slack Validation Rules and Tips:** * * If not set, the request will be sent on every character entered or removed. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -507,7 +507,7 @@ export abstract class MinLength extends Builder { * **Slack Validation Rules and Tips:** * * Maximum 3000 characters. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -523,7 +523,7 @@ export abstract class MinValue extends Builder { * **Slack Validation Rules and Tips:** * * Cannot be less than the maximum value. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -539,7 +539,7 @@ export abstract class Placeholder extends Builder { * **Slack Validation Rules and Tips:** * * Maximum of 150 characters. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -552,7 +552,7 @@ export abstract class PostAt extends Builder { /** * @description Sets a time in the future for the message to be sent to the channel or user, as a scheduled message. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -569,7 +569,7 @@ export abstract class PrivateMetaData extends Builder { * * Maximum 3000 characters. * * Typically used to persist data or store context between views. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -582,7 +582,7 @@ export abstract class ProviderIconUrl extends Builder { /** * @description Icon for the video provider - ex. YouTube or Vimeo icon. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -595,7 +595,7 @@ export abstract class ProviderName extends Builder { /** * @description The originating application or domain of the video ex. YouTube or Vimeo. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -611,7 +611,7 @@ export abstract class Submit extends Builder { * **Slack Validation Rules and Tips:** * * Maximum of 24 characters. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -631,7 +631,7 @@ export abstract class Text extends Builder { * * For confirmation dialogs, maximum of 75 characters. * * For section and header blocks, maximum of 3000 characters. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -644,7 +644,7 @@ export abstract class ThreadTs extends Builder { /** * @description Instructs the Slack API to send the message to the thread of the message associated with the timestamp. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -660,7 +660,7 @@ export abstract class ThumbnailUrl extends Builder { * **Slack Validation Rules and Tips:** * * **Required property for Video blocks** ⚠ * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -679,7 +679,7 @@ export abstract class Title extends Builder { * * For images, maximum of 2000 characters. * * For confirmation dialogs, maximum of 100 characters. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -696,7 +696,7 @@ export abstract class TitleUrl extends Builder { * * Must correspond to the non-embeddable URL for the video. * * Must go to an HTTPS URL. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -709,7 +709,7 @@ export abstract class Ts extends Builder { /** * @description Instructs the Slack API to use the message to replaced an existing message. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -726,7 +726,7 @@ export abstract class Url extends Builder { * * Maximum of 3000 characters. * * For options, it is only supported for options in an overflow menu. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -743,7 +743,7 @@ export abstract class Value extends Builder { * * For buttons, maximum of 2000 characters. * * For options, maximum of 75 characters. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -761,7 +761,7 @@ export abstract class VideoUrl extends Builder { * * Must match any existing unfurl domains within the app. * * Must point to an HTTPS URL. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -774,7 +774,7 @@ export abstract class MaxFiles extends Builder { /** * @description Maximum number of files that can be uploaded for this file_input element. Minimum of 1, maximum of 10. Defaults to 10 if not specified. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ @@ -793,7 +793,7 @@ export abstract class Filetypes extends Builder { * * Maximum of 2000 characters for each field. * * Markdown supported. * - * {@link https://api.slack.com/block-kit|Open Official Slack Block Kit Documentation} + * {@link https://docs.slack.dev/reference/block-kit|Open Official Slack Block Kit Documentation} * {@link https://www.blockbuilder.dev|Open Block Builder Documentation} */ diff --git a/src/surfaces/home-tab.ts b/src/surfaces/home-tab.ts index ac7316bc..f88ee0e7 100644 --- a/src/surfaces/home-tab.ts +++ b/src/surfaces/home-tab.ts @@ -35,7 +35,7 @@ export interface HomeTabBuilder extends Blocks, } /** - * @@link https://api.slack.com/reference/surfaces/views + * @@link https://docs.slack.dev/surfaces/modals * @@displayName Home Tab */ diff --git a/src/surfaces/index.ts b/src/surfaces/index.ts index e9aeb295..943f3634 100644 --- a/src/surfaces/index.ts +++ b/src/surfaces/index.ts @@ -26,7 +26,7 @@ export type { * @param {string} [params.externalId] Sets a custom identifier that must be unique for all views on a per-team basis. * @param {string} [params.privateMetaData] Sets a string sent back to your server together with all action and submission events. * - * {@link https://api.slack.com/surfaces/tabs|View in Slack API Documentation} + * {@link https://docs.slack.dev/surfaces/app-home|View in Slack API Documentation} */ export function HomeTab(params?: HomeTabParams): HomeTabBuilder { @@ -40,7 +40,7 @@ export function HomeTab(params?: HomeTabParams): HomeTabBuilder { * @param {timestamp} [params.threadTs] Sets the message to be a reply in a thread to the message whose timestamp is passed. * @param {timestamp} [params.postAt] Sets a time for the message to be posted, as a scheduled message. * - * {@link https://api.slack.com/messaging/composing|View in Slack API Documentation} + * {@link https://docs.slack.dev/messaging/composing|View in Slack API Documentation} */ export function Message(params?: MessageParams): MessageBuilder { @@ -56,7 +56,7 @@ export function Message(params?: MessageParams): MessageBuilder { * @param {string} [params.externalId] Sets a custom identifier that must be unique for all views on a per-team basis. * @param {string} [params.privateMetaData] Sets a string sent back to your server together with all action and submission events. * - * {@link https://api.slack.com/reference/surfaces/views|View in Slack API Documentation} + * {@link https://docs.slack.dev/surfaces/modals|View in Slack API Documentation} */ export function Modal(params?: ModalParams): ModalBuilder { @@ -68,7 +68,7 @@ export function Modal(params?: ModalParams): ModalBuilder { * @param {string} [params.callbackId] Sets a string sent back to your server together with all action and submission events. * @param {string} [params.privateMetaData] Sets a string sent back to your server together with all action and submission events. * - * {@link https://api.slack.com/reference/surfaces/views|View in Slack API Documentation} + * {@link https://docs.slack.dev/surfaces/modals|View in Slack API Documentation} */ export function WorkflowStep(params?: WorkflowStepParams): WorkflowStepBuilder { diff --git a/src/surfaces/message.ts b/src/surfaces/message.ts index 40f43dea..3130cc0c 100644 --- a/src/surfaces/message.ts +++ b/src/surfaces/message.ts @@ -56,7 +56,7 @@ export interface MessageBuilder extends AsUser, } /** - * @@link https://api.slack.com/messaging/composing + * @@link https://docs.slack.dev/messaging/composing * @@displayName Message */ diff --git a/src/surfaces/modal.ts b/src/surfaces/modal.ts index c4820c53..e1755056 100644 --- a/src/surfaces/modal.ts +++ b/src/surfaces/modal.ts @@ -49,7 +49,7 @@ export interface ModalBuilder extends Blocks, } /** - * @@link https://api.slack.com/reference/surfaces/views + * @@link https://docs.slack.dev/surfaces/modals * @@displayName Modal */ diff --git a/src/surfaces/workflow-step.ts b/src/surfaces/workflow-step.ts index 2ec5fcfd..2d0e8abe 100644 --- a/src/surfaces/workflow-step.ts +++ b/src/surfaces/workflow-step.ts @@ -34,7 +34,7 @@ export interface WorkflowStepBuilder extends Blocks, } /** - * @@link https://api.slack.com/reference/workflows/configuration-view + * @@link https://docs.slack.dev/workflows/steps * @@displayName Workflow Step */ diff --git a/tmp-docs/blocks.ts b/tmp-docs/blocks.ts index 17d710ac..94b2aff0 100644 --- a/tmp-docs/blocks.ts +++ b/tmp-docs/blocks.ts @@ -280,7 +280,7 @@ export interface InputBlock extends Block { * @description This block can be used with AI apps when you expect a markdown response from an LLM that can get lost in * translation rendering in Slack. Providing it in a markdown block leaves the translating to Slack to ensure your message * appears as intended. Note that passing a single block may result in multiple blocks after translation. - * @see {@link https://api.slack.com/reference/block-kit/blocks#markdown Markdown block reference}. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks#markdown Markdown block reference}. */ export interface MarkdownBlock extends Block { /** From d7c21fc7abcc589160c6c605407d0c81e49c9336 Mon Sep 17 00:00:00 2001 From: allx Date: Sat, 6 Dec 2025 00:34:07 +0200 Subject: [PATCH 3/5] Update Slack API documentation links Replaces outdated Slack Block Kit documentation URLs with current, more specific links throughout bits, blocks, and elements modules. --- src/bits/confirmation-dialog.ts | 2 +- src/bits/index.ts | 34 +- src/bits/option-group.ts | 2 +- src/bits/option.ts | 2 +- src/bits/rich-text-broadcast.ts | 2 +- src/bits/rich-text-channel.ts | 2 +- src/bits/rich-text-color.ts | 2 +- src/bits/rich-text-date.ts | 2 +- src/bits/rich-text-emoji.ts | 2 +- src/bits/rich-text-link.ts | 2 +- src/bits/rich-text-list.ts | 2 +- src/bits/rich-text-preformatted.ts | 2 +- src/bits/rich-text-quote.ts | 2 +- src/bits/rich-text-section.ts | 2 +- src/bits/rich-text-team.ts | 2 +- src/bits/rich-text-text.ts | 2 +- src/bits/rich-text-user.ts | 2 +- src/bits/rich-text-usergroup.ts | 2 +- src/blocks/actions.ts | 2 +- src/blocks/context-actions.ts | 2 +- src/blocks/context.ts | 2 +- src/blocks/divider.ts | 2 +- src/blocks/file.ts | 2 +- src/blocks/header.ts | 2 +- src/blocks/image.ts | 2 +- src/blocks/index.ts | 26 +- src/blocks/input.ts | 2 +- src/blocks/markdown.ts | 2 +- src/blocks/rich-text.ts | 2 +- src/blocks/section.ts | 2 +- src/blocks/table.ts | 2 +- src/blocks/video.ts | 2 +- src/elements/button.ts | 2 +- src/elements/channel-multi-select.ts | 2 +- src/elements/channel-select.ts | 2 +- src/elements/checkboxes.ts | 2 +- src/elements/conversation-multi-select.ts | 2 +- src/elements/conversation-select.ts | 2 +- src/elements/date-picker.ts | 2 +- src/elements/date-time-picker.ts | 2 +- src/elements/email-input.ts | 2 +- src/elements/external-multi-select.ts | 2 +- src/elements/external-select.ts | 2 +- src/elements/feedback-buttons.ts | 2 +- src/elements/file-input.ts | 2 +- src/elements/icon-button.ts | 2 +- src/elements/img.ts | 2 +- src/elements/index.ts | 54 +- src/elements/number-input.ts | 2 +- src/elements/overflow-menu.ts | 2 +- src/elements/radio-buttons.ts | 2 +- src/elements/static-multi-select.ts | 2 +- src/elements/static-select.ts | 2 +- src/elements/text-input.ts | 2 +- src/elements/timepicker.ts | 2 +- src/elements/url-input.ts | 2 +- src/elements/user-multi-select.ts | 2 +- src/elements/user-select.ts | 2 +- src/elements/workflow-button.ts | 2 +- src/surfaces/home-tab.ts | 2 +- tmp-docs/block-elements.ts | 1047 --------------------- tmp-docs/blocks.ts | 455 --------- tmp-docs/composition-objects.ts | 259 ----- tmp-docs/extensions.ts | 98 -- 64 files changed, 114 insertions(+), 1973 deletions(-) delete mode 100644 tmp-docs/block-elements.ts delete mode 100644 tmp-docs/blocks.ts delete mode 100644 tmp-docs/composition-objects.ts delete mode 100644 tmp-docs/extensions.ts diff --git a/src/bits/confirmation-dialog.ts b/src/bits/confirmation-dialog.ts index c08ff10c..6c568734 100644 --- a/src/bits/confirmation-dialog.ts +++ b/src/bits/confirmation-dialog.ts @@ -28,7 +28,7 @@ export interface ConfirmationDialogBuilder extends Confirm, } /** - * @@link https://docs.slack.dev/reference/block-kit/composition-objects#confirm + * @@link https://docs.slack.dev/reference/block-kit/composition-objects/confirmation-dialog-object * @@displayName Confirmation Dialog */ diff --git a/src/bits/index.ts b/src/bits/index.ts index bc25569b..4f0d9a48 100644 --- a/src/bits/index.ts +++ b/src/bits/index.ts @@ -80,7 +80,7 @@ export function Attachment(params?: AttachmentParams): AttachmentBuilder { * @param {string} [params.confirm] Sets the text for the button that confirms the action. * @param {string} [params.deny] Sets the text for the button that cancels the action. * - * {@link https://docs.slack.dev/reference/block-kit/composition-objects#confirm|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/composition-objects/confirmation-dialog-object|View in Slack API Documentation} */ export function ConfirmationDialog(params?: ConfirmationDialogParams): ConfirmationDialogBuilder { @@ -94,7 +94,7 @@ export function ConfirmationDialog(params?: ConfirmationDialogParams): Confirmat * @param {string} [params.description] Sets a description shown next to the option, if in a radio button input. * @param {string} [params.url] Sets the URL to redirect the user to when this option is clicked, if in an overlow menu. * - * {@link https://docs.slack.dev/reference/block-kit/composition-objects#option|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/composition-objects/option-object|View in Slack API Documentation} */ export function Option(params?: OptionParams): OptionBuilder { @@ -105,7 +105,7 @@ export function Option(params?: OptionParams): OptionBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.label] Sets the label shown above the group of option. * - * {@link https://docs.slack.dev/reference/block-kit/composition-objects#option_group|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/composition-objects/option-group-object|View in Slack API Documentation} */ export function OptionGroup(params?: OptionGroupParams): OptionGroupBuilder { @@ -114,7 +114,7 @@ export function OptionGroup(params?: OptionGroupParams): OptionGroupBuilder { /** * @description Creates a rich text section element. - * {@link https://docs.slack.dev/reference/block-kit/blocks#rich_text_section|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block|View in Slack API Documentation} */ export function RichTextSection(params?: RichTextSectionParams): RichTextSectionBuilder { return new RichTextSectionBuilder(params); @@ -126,7 +126,7 @@ export function RichTextSection(params?: RichTextSectionParams): RichTextSection * @param {number} [params.indent] The indentation level (0-8). * @param {number} [params.border] Whether to show a border (0 or 1). * - * {@link https://docs.slack.dev/reference/block-kit/blocks#rich_text_list|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block|View in Slack API Documentation} */ export function RichTextList(params?: RichTextListParams): RichTextListBuilder { return new RichTextListBuilder(params); @@ -136,7 +136,7 @@ export function RichTextList(params?: RichTextListParams): RichTextListBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {number} [params.border] Whether to show a border (0 or 1). * - * {@link https://docs.slack.dev/reference/block-kit/blocks#rich_text_quote|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block|View in Slack API Documentation} */ export function RichTextQuote(params?: RichTextQuoteParams): RichTextQuoteBuilder { return new RichTextQuoteBuilder(params); @@ -146,7 +146,7 @@ export function RichTextQuote(params?: RichTextQuoteParams): RichTextQuoteBuilde * @param {Object} [params] Parameters passed to the constructor. * @param {number} [params.border] Whether to show a border (0 or 1). * - * {@link https://docs.slack.dev/reference/block-kit/blocks#rich_text_preformatted|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block|View in Slack API Documentation} */ export function RichTextPreformatted(params?: RichTextPreformattedParams): RichTextPreformattedBuilder { return new RichTextPreformattedBuilder(params); @@ -156,7 +156,7 @@ export function RichTextPreformatted(params?: RichTextPreformattedParams): RichT * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.text] The text content. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block|View in Slack API Documentation} */ export function RichTextText(params?: RichTextTextParams): RichTextTextBuilder { return new RichTextTextBuilder(params); @@ -168,7 +168,7 @@ export function RichTextText(params?: RichTextTextParams): RichTextTextBuilder { * @param {string} [params.unicode] The unicode representation. * @param {string} [params.url] URL for custom emoji. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block|View in Slack API Documentation} */ export function RichTextEmoji(params?: RichTextEmojiParams): RichTextEmojiBuilder { return new RichTextEmojiBuilder(params); @@ -180,7 +180,7 @@ export function RichTextEmoji(params?: RichTextEmojiParams): RichTextEmojiBuilde * @param {string} [params.text] The link text. * @param {boolean} [params.unsafe] Whether the link is unsafe. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block|View in Slack API Documentation} */ export function RichTextLink(params?: RichTextLinkParams): RichTextLinkBuilder { return new RichTextLinkBuilder(params); @@ -190,7 +190,7 @@ export function RichTextLink(params?: RichTextLinkParams): RichTextLinkBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.userId] The user ID to mention. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block|View in Slack API Documentation} */ export function RichTextUser(params?: RichTextUserParams): RichTextUserBuilder { return new RichTextUserBuilder(params); @@ -200,7 +200,7 @@ export function RichTextUser(params?: RichTextUserParams): RichTextUserBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.channelId] The channel ID to mention. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block|View in Slack API Documentation} */ export function RichTextChannel(params?: RichTextChannelParams): RichTextChannelBuilder { return new RichTextChannelBuilder(params); @@ -210,7 +210,7 @@ export function RichTextChannel(params?: RichTextChannelParams): RichTextChannel * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.usergroupId] The usergroup ID to mention. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block|View in Slack API Documentation} */ export function RichTextUsergroup(params?: RichTextUsergroupParams): RichTextUsergroupBuilder { return new RichTextUsergroupBuilder(params); @@ -220,7 +220,7 @@ export function RichTextUsergroup(params?: RichTextUsergroupParams): RichTextUse * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.range] The broadcast range - 'here', 'channel', or 'everyone'. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block|View in Slack API Documentation} */ export function RichTextBroadcast(params?: RichTextBroadcastParams): RichTextBroadcastBuilder { return new RichTextBroadcastBuilder(params); @@ -233,7 +233,7 @@ export function RichTextBroadcast(params?: RichTextBroadcastParams): RichTextBro * @param {string} [params.url] Optional URL to link the date. * @param {string} [params.fallback] Fallback text if date can't be displayed. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block|View in Slack API Documentation} */ export function RichTextDate(params?: RichTextDateParams): RichTextDateBuilder { return new RichTextDateBuilder(params); @@ -243,7 +243,7 @@ export function RichTextDate(params?: RichTextDateParams): RichTextDateBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.value] The hex color value. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block|View in Slack API Documentation} */ export function RichTextColor(params?: RichTextColorParams): RichTextColorBuilder { return new RichTextColorBuilder(params); @@ -253,7 +253,7 @@ export function RichTextColor(params?: RichTextColorParams): RichTextColorBuilde * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.teamId] The team/workspace ID to mention. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#element-types|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block|View in Slack API Documentation} */ export function RichTextTeam(params?: RichTextTeamParams): RichTextTeamBuilder { return new RichTextTeamBuilder(params); diff --git a/src/bits/option-group.ts b/src/bits/option-group.ts index df8d33a7..e6591c69 100644 --- a/src/bits/option-group.ts +++ b/src/bits/option-group.ts @@ -17,7 +17,7 @@ export interface OptionGroupBuilder extends End, } /** - * @@link https://docs.slack.dev/reference/block-kit/composition-objects#option_group + * @@link https://docs.slack.dev/reference/block-kit/composition-objects/option-group-object * @@displayName Option Group */ diff --git a/src/bits/option.ts b/src/bits/option.ts index ffe592d5..ff2f6d25 100644 --- a/src/bits/option.ts +++ b/src/bits/option.ts @@ -26,7 +26,7 @@ export interface OptionBuilder extends Description, } /** - * @@link https://docs.slack.dev/reference/block-kit/composition-objects#option + * @@link https://docs.slack.dev/reference/block-kit/composition-objects/option-object * @@displayName Option */ diff --git a/src/bits/rich-text-broadcast.ts b/src/bits/rich-text-broadcast.ts index b7d0fe7c..ab0105f6 100644 --- a/src/bits/rich-text-broadcast.ts +++ b/src/bits/rich-text-broadcast.ts @@ -16,7 +16,7 @@ export interface RichTextBroadcastBuilder extends End { } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block * @@displayName Rich Text Broadcast Mention */ diff --git a/src/bits/rich-text-channel.ts b/src/bits/rich-text-channel.ts index cf209569..741b46d0 100644 --- a/src/bits/rich-text-channel.ts +++ b/src/bits/rich-text-channel.ts @@ -16,7 +16,7 @@ export interface RichTextChannelBuilder extends End { } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block * @@displayName Rich Text Channel Mention */ diff --git a/src/bits/rich-text-color.ts b/src/bits/rich-text-color.ts index f4a5af48..2276cfb0 100644 --- a/src/bits/rich-text-color.ts +++ b/src/bits/rich-text-color.ts @@ -16,7 +16,7 @@ export interface RichTextColorBuilder extends End { } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block * @@displayName Rich Text Color */ diff --git a/src/bits/rich-text-date.ts b/src/bits/rich-text-date.ts index 1e4ee611..5de5d755 100644 --- a/src/bits/rich-text-date.ts +++ b/src/bits/rich-text-date.ts @@ -19,7 +19,7 @@ export interface RichTextDateBuilder extends End { } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block * @@displayName Rich Text Date */ diff --git a/src/bits/rich-text-emoji.ts b/src/bits/rich-text-emoji.ts index a8c8d186..7864c696 100644 --- a/src/bits/rich-text-emoji.ts +++ b/src/bits/rich-text-emoji.ts @@ -14,7 +14,7 @@ export interface RichTextEmojiBuilder extends End { } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block * @@displayName Rich Text Emoji */ diff --git a/src/bits/rich-text-link.ts b/src/bits/rich-text-link.ts index 1970bba3..4a18f49a 100644 --- a/src/bits/rich-text-link.ts +++ b/src/bits/rich-text-link.ts @@ -18,7 +18,7 @@ export interface RichTextLinkBuilder extends End { } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block * @@displayName Rich Text Link */ diff --git a/src/bits/rich-text-list.ts b/src/bits/rich-text-list.ts index 1d0d8b81..24c6192f 100644 --- a/src/bits/rich-text-list.ts +++ b/src/bits/rich-text-list.ts @@ -19,7 +19,7 @@ export interface RichTextListBuilder extends End, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#rich_text_list + * @@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block * @@displayName Rich Text List */ diff --git a/src/bits/rich-text-preformatted.ts b/src/bits/rich-text-preformatted.ts index 68f2a58a..5cb7bb8a 100644 --- a/src/bits/rich-text-preformatted.ts +++ b/src/bits/rich-text-preformatted.ts @@ -17,7 +17,7 @@ export interface RichTextPreformattedBuilder extends End, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#rich_text_preformatted + * @@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block * @@displayName Rich Text Preformatted */ diff --git a/src/bits/rich-text-quote.ts b/src/bits/rich-text-quote.ts index ddd5ea12..5e1564c9 100644 --- a/src/bits/rich-text-quote.ts +++ b/src/bits/rich-text-quote.ts @@ -17,7 +17,7 @@ export interface RichTextQuoteBuilder extends End, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#rich_text_quote + * @@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block * @@displayName Rich Text Quote */ diff --git a/src/bits/rich-text-section.ts b/src/bits/rich-text-section.ts index 0bf599e1..9137099d 100644 --- a/src/bits/rich-text-section.ts +++ b/src/bits/rich-text-section.ts @@ -15,7 +15,7 @@ export interface RichTextSectionBuilder extends End, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#rich_text_section + * @@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block * @@displayName Rich Text Section */ diff --git a/src/bits/rich-text-team.ts b/src/bits/rich-text-team.ts index 76e2c973..5a8feb77 100644 --- a/src/bits/rich-text-team.ts +++ b/src/bits/rich-text-team.ts @@ -17,7 +17,7 @@ export interface RichTextTeamBuilder extends End { } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block * @@displayName Rich Text Team */ diff --git a/src/bits/rich-text-text.ts b/src/bits/rich-text-text.ts index 024111b6..adac7506 100644 --- a/src/bits/rich-text-text.ts +++ b/src/bits/rich-text-text.ts @@ -16,7 +16,7 @@ export interface RichTextTextBuilder extends End { } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block * @@displayName Rich Text Text */ diff --git a/src/bits/rich-text-user.ts b/src/bits/rich-text-user.ts index 90723a81..baa6cbd5 100644 --- a/src/bits/rich-text-user.ts +++ b/src/bits/rich-text-user.ts @@ -16,7 +16,7 @@ export interface RichTextUserBuilder extends End { } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block * @@displayName Rich Text User Mention */ diff --git a/src/bits/rich-text-usergroup.ts b/src/bits/rich-text-usergroup.ts index e0282c13..fd740c44 100644 --- a/src/bits/rich-text-usergroup.ts +++ b/src/bits/rich-text-usergroup.ts @@ -16,7 +16,7 @@ export interface RichTextUsergroupBuilder extends End { } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#element-types + * @@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block * @@displayName Rich Text Usergroup Mention */ diff --git a/src/blocks/actions.ts b/src/blocks/actions.ts index a452ab1c..40eb3708 100644 --- a/src/blocks/actions.ts +++ b/src/blocks/actions.ts @@ -21,7 +21,7 @@ export interface ActionsBuilder extends BlockId, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#actions + * @@link https://docs.slack.dev/reference/block-kit/blocks/actions-block * @@displayName Actions */ diff --git a/src/blocks/context-actions.ts b/src/blocks/context-actions.ts index 9316b096..730a54d1 100644 --- a/src/blocks/context-actions.ts +++ b/src/blocks/context-actions.ts @@ -17,7 +17,7 @@ export interface ContextActionsBuilder extends BlockId, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#context_actions + * @@link https://docs.slack.dev/reference/block-kit/blocks/context-actions-block * @@displayName Context Actions */ diff --git a/src/blocks/context.ts b/src/blocks/context.ts index e7f80a03..e5175c54 100644 --- a/src/blocks/context.ts +++ b/src/blocks/context.ts @@ -20,7 +20,7 @@ export interface ContextBuilder extends BlockId, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#context + * @@link https://docs.slack.dev/reference/block-kit/blocks/context-block * @@displayName Context */ diff --git a/src/blocks/divider.ts b/src/blocks/divider.ts index e4b07120..314cba9d 100644 --- a/src/blocks/divider.ts +++ b/src/blocks/divider.ts @@ -13,7 +13,7 @@ export interface DividerBuilder extends BlockId, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#divider + * @@link https://docs.slack.dev/reference/block-kit/blocks/divider-block * @@displayName Divider */ diff --git a/src/blocks/file.ts b/src/blocks/file.ts index 8bb097db..adc48e22 100644 --- a/src/blocks/file.ts +++ b/src/blocks/file.ts @@ -19,7 +19,7 @@ export interface FileBuilder extends BlockId, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#file + * @@link https://docs.slack.dev/reference/block-kit/blocks/file-block * @@displayName File */ diff --git a/src/blocks/header.ts b/src/blocks/header.ts index 2f81c49c..39ba62c7 100644 --- a/src/blocks/header.ts +++ b/src/blocks/header.ts @@ -19,7 +19,7 @@ export interface HeaderBuilder extends BlockId, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#header + * @@link https://docs.slack.dev/reference/block-kit/blocks/header-block * @@displayName Header */ diff --git a/src/blocks/image.ts b/src/blocks/image.ts index 367d5551..e4c03dbd 100644 --- a/src/blocks/image.ts +++ b/src/blocks/image.ts @@ -25,7 +25,7 @@ export interface ImageBuilder extends AltText, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#image + * @@link https://docs.slack.dev/reference/block-kit/blocks/image-block * @@displayName Image */ diff --git a/src/blocks/index.ts b/src/blocks/index.ts index 6f2272c2..18645711 100644 --- a/src/blocks/index.ts +++ b/src/blocks/index.ts @@ -51,7 +51,7 @@ export type { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#actions|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/actions-block|View in Slack API Documentation} */ export function Actions(params?: ActionsParams): ActionsBuilder { @@ -62,7 +62,7 @@ export function Actions(params?: ActionsParams): ActionsBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#context|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/context-block|View in Slack API Documentation} */ export function Context(params?: ContextParams): ContextBuilder { @@ -73,7 +73,7 @@ export function Context(params?: ContextParams): ContextBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#divider|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/divider-block|View in Slack API Documentation} */ export function Divider(params?: DividerParams): DividerBuilder { @@ -85,7 +85,7 @@ export function Divider(params?: DividerParams): DividerBuilder { * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. * @param {string} [params.externalId] Sets a custom identifier for the file that must be unique for all images on a per-team basis. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#file|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/file-block|View in Slack API Documentation} */ export function File(params?: FileParams): FileBuilder { @@ -97,7 +97,7 @@ export function File(params?: FileParams): FileBuilder { * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. * @param {string} [params.text] Sets the text to be displayed in the header block. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#header|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/header-block|View in Slack API Documentation} */ export function Header(params?: HeaderParams): HeaderBuilder { @@ -111,7 +111,7 @@ export function Header(params?: HeaderParams): HeaderBuilder { * @param {string} [params.altText] Sets a textual summary for the image. * @param {string} [params.title] Sets an optional title for the image. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#image|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/image-block|View in Slack API Documentation} */ export function Image(params?: ImageParams): ImageBuilder { @@ -124,7 +124,7 @@ export function Image(params?: ImageParams): ImageBuilder { * @param {string} [params.label] Sets the label to be displayed above the input. * @param {string} [params.hint] Sets the hint to be displayed under the input. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#input|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/input-block|View in Slack API Documentation} */ export function Input(params?: InputParams): InputBuilder { @@ -136,7 +136,7 @@ export function Input(params?: InputParams): InputBuilder { * @param {string} [params.blockId] Sets a string to be an identifier for the block, that will be available in interaction payloadsSets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. * @param {string} [params.text] Sets the text to be displayed in the section block. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#section|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/section-block|View in Slack API Documentation} */ export function Section(params?: SectionParams): SectionBuilder { @@ -154,7 +154,7 @@ export function Section(params?: SectionParams): SectionBuilder { * @param {string} [params.titleUrl] A hyperlink for the video's title text. * @param {string} [params.videoUrl] The URL of the video to embed in the Video block. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#section|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/section-block|View in Slack API Documentation} */ export function Video(params?: VideoParams): VideoBuilder { @@ -165,7 +165,7 @@ export function Video(params?: VideoParams): VideoBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#rich_text|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block|View in Slack API Documentation} */ export function RichText(params?: RichTextParams): RichTextBuilder { @@ -177,7 +177,7 @@ export function RichText(params?: RichTextParams): RichTextBuilder { * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. * @param {string} [params.text] Sets the markdown text content. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#markdown|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/markdown-block|View in Slack API Documentation} */ export function Markdown(params?: MarkdownParams): MarkdownBuilder { @@ -188,7 +188,7 @@ export function Markdown(params?: MarkdownParams): MarkdownBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#table|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/table-block|View in Slack API Documentation} */ export function Table(params?: TableParams): TableBuilder { @@ -199,7 +199,7 @@ export function Table(params?: TableParams): TableBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. * - * {@link https://docs.slack.dev/reference/block-kit/blocks#context_actions|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/blocks/context-block_actions|View in Slack API Documentation} */ export function ContextActions(params?: ContextActionsParams): ContextActionsBuilder { diff --git a/src/blocks/input.ts b/src/blocks/input.ts index 706ccafa..b38678e2 100644 --- a/src/blocks/input.ts +++ b/src/blocks/input.ts @@ -31,7 +31,7 @@ export interface InputBuilder extends BlockId, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#input + * @@link https://docs.slack.dev/reference/block-kit/blocks/input-block * @@displayName Input */ diff --git a/src/blocks/markdown.ts b/src/blocks/markdown.ts index 6bb29448..d1451b63 100644 --- a/src/blocks/markdown.ts +++ b/src/blocks/markdown.ts @@ -19,7 +19,7 @@ export interface MarkdownBuilder extends BlockId, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#markdown + * @@link https://docs.slack.dev/reference/block-kit/blocks/markdown-block * @@displayName Markdown */ diff --git a/src/blocks/rich-text.ts b/src/blocks/rich-text.ts index 0c455e50..afedb509 100644 --- a/src/blocks/rich-text.ts +++ b/src/blocks/rich-text.ts @@ -21,7 +21,7 @@ export interface RichTextBuilder extends BlockId, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#rich_text + * @@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block * @@displayName Rich Text */ diff --git a/src/blocks/section.ts b/src/blocks/section.ts index 7a4d755f..8b158ddc 100644 --- a/src/blocks/section.ts +++ b/src/blocks/section.ts @@ -30,7 +30,7 @@ export interface SectionBuilder extends Accessory, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#section + * @@link https://docs.slack.dev/reference/block-kit/blocks/section-block * @@displayName Section */ diff --git a/src/blocks/table.ts b/src/blocks/table.ts index 13b82be0..a15183b2 100644 --- a/src/blocks/table.ts +++ b/src/blocks/table.ts @@ -23,7 +23,7 @@ export interface TableBuilder extends BlockId, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#table + * @@link https://docs.slack.dev/reference/block-kit/blocks/table-block * @@displayName Table */ diff --git a/src/blocks/video.ts b/src/blocks/video.ts index 1f5c5f1b..9023dc85 100644 --- a/src/blocks/video.ts +++ b/src/blocks/video.ts @@ -42,7 +42,7 @@ export interface VideoBuilder extends AltText, } /** - * @@link https://docs.slack.dev/reference/block-kit/blocks#video + * @@link https://docs.slack.dev/reference/block-kit/blocks/video-block * @@displayName Video */ diff --git a/src/elements/button.ts b/src/elements/button.ts index b11e927a..bd8f296d 100644 --- a/src/elements/button.ts +++ b/src/elements/button.ts @@ -37,7 +37,7 @@ export interface ButtonBuilder extends AccessibilityLabel, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#button + * @@link https://docs.slack.dev/reference/block-kit/block-elements/button-element * @@displayName Button */ diff --git a/src/elements/channel-multi-select.ts b/src/elements/channel-multi-select.ts index 924a1d6d..71eda548 100644 --- a/src/elements/channel-multi-select.ts +++ b/src/elements/channel-multi-select.ts @@ -31,7 +31,7 @@ export interface ChannelMultiSelectBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#channel_multi_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#channel_multi_select * @@displayName Channel Multi-Select */ diff --git a/src/elements/channel-select.ts b/src/elements/channel-select.ts index 2bf0c51c..317ffb14 100644 --- a/src/elements/channel-select.ts +++ b/src/elements/channel-select.ts @@ -31,7 +31,7 @@ export interface ChannelSelectBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#channel_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#channels_select * @@displayName Channel Select */ diff --git a/src/elements/checkboxes.ts b/src/elements/checkboxes.ts index 5c2c5176..08f63d92 100644 --- a/src/elements/checkboxes.ts +++ b/src/elements/checkboxes.ts @@ -27,7 +27,7 @@ export interface CheckboxesBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#checkboxes + * @@link https://docs.slack.dev/reference/block-kit/block-elements/checkboxes-element * @@displayName Checkboxes */ diff --git a/src/elements/conversation-multi-select.ts b/src/elements/conversation-multi-select.ts index c7e42217..83fdb509 100644 --- a/src/elements/conversation-multi-select.ts +++ b/src/elements/conversation-multi-select.ts @@ -44,7 +44,7 @@ export interface ConversationMultiSelectBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#conversation_multi_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#conversation_multi_select * @@displayName Conversation Multi-Select */ diff --git a/src/elements/conversation-select.ts b/src/elements/conversation-select.ts index 7f5b9641..d1ef27ab 100644 --- a/src/elements/conversation-select.ts +++ b/src/elements/conversation-select.ts @@ -44,7 +44,7 @@ export interface ConversationSelectBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#conversation_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#conversations_select * @@displayName Conversation Select */ diff --git a/src/elements/date-picker.ts b/src/elements/date-picker.ts index 647b16e1..aec317ff 100644 --- a/src/elements/date-picker.ts +++ b/src/elements/date-picker.ts @@ -34,7 +34,7 @@ export interface DatePickerBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#datepicker + * @@link https://docs.slack.dev/reference/block-kit/block-elements/date-picker-element * @@displayName Date Picker */ diff --git a/src/elements/date-time-picker.ts b/src/elements/date-time-picker.ts index 065674a7..576c5589 100644 --- a/src/elements/date-time-picker.ts +++ b/src/elements/date-time-picker.ts @@ -26,7 +26,7 @@ export interface DateTimePickerBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#datetimepicker + * @@link https://docs.slack.dev/reference/block-kit/block-elements/datetime-picker-element * @@displayName Date Picker */ diff --git a/src/elements/email-input.ts b/src/elements/email-input.ts index e0a5af15..471c6be3 100644 --- a/src/elements/email-input.ts +++ b/src/elements/email-input.ts @@ -28,7 +28,7 @@ export interface EmailInputBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#email + * @@link https://docs.slack.dev/reference/block-kit/block-elements/email-input-element * @@displayName Email Input */ diff --git a/src/elements/external-multi-select.ts b/src/elements/external-multi-select.ts index d31bc4c6..82805de1 100644 --- a/src/elements/external-multi-select.ts +++ b/src/elements/external-multi-select.ts @@ -39,7 +39,7 @@ export interface ExternalMultiSelectBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#external_multi_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#external_multi_select * @@displayName External Multi-Select */ diff --git a/src/elements/external-select.ts b/src/elements/external-select.ts index e325d029..95891378 100644 --- a/src/elements/external-select.ts +++ b/src/elements/external-select.ts @@ -31,7 +31,7 @@ export interface ExternalSelectBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#external_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#external_select * @@displayName External Select */ diff --git a/src/elements/feedback-buttons.ts b/src/elements/feedback-buttons.ts index 2083bee8..c64b2c9d 100644 --- a/src/elements/feedback-buttons.ts +++ b/src/elements/feedback-buttons.ts @@ -24,7 +24,7 @@ export interface FeedbackButtonsBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#feedback_buttons + * @@link https://docs.slack.dev/reference/block-kit/block-elements/feedback-buttons-element * @@displayName Feedback Buttons */ diff --git a/src/elements/file-input.ts b/src/elements/file-input.ts index 276e6c91..40e97287 100644 --- a/src/elements/file-input.ts +++ b/src/elements/file-input.ts @@ -22,7 +22,7 @@ export interface FileInputBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#file_input + * @@link https://docs.slack.dev/reference/block-kit/block-elements/file-input-element * @@displayName File Input Builder */ diff --git a/src/elements/icon-button.ts b/src/elements/icon-button.ts index c1f65a3e..4d13d5d8 100644 --- a/src/elements/icon-button.ts +++ b/src/elements/icon-button.ts @@ -32,7 +32,7 @@ export interface IconButtonBuilder extends AccessibilityLabel, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#icon_button + * @@link https://docs.slack.dev/reference/block-kit/block-elements/icon-button-element * @@displayName Icon Button */ diff --git a/src/elements/img.ts b/src/elements/img.ts index 0ec77195..d468d7a8 100644 --- a/src/elements/img.ts +++ b/src/elements/img.ts @@ -19,7 +19,7 @@ export interface ImgBuilder extends AltText, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#image + * @@link https://docs.slack.dev/reference/block-kit/block-elements/image-element * @@displayName Image */ diff --git a/src/elements/index.ts b/src/elements/index.ts index 706b135c..3c427e61 100644 --- a/src/elements/index.ts +++ b/src/elements/index.ts @@ -97,7 +97,7 @@ export type { * @param {string} [params.url] Sets the URL to redirect the user to when this button is clicked. * @param {string} [params.value] Sets the value to be passed to your app when this button is clicked. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#button|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/button-element|View in Slack API Documentation} */ export function Button(params?: ButtonParams): ButtonBuilder { @@ -110,7 +110,7 @@ export function Button(params?: ButtonParams): ButtonBuilder { * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#channel_multi_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#channel_multi_select|View in Slack API Documentation} */ export function ChannelMultiSelect(params?: ChannelMultiSelectParams): ChannelMultiSelectBuilder { @@ -123,7 +123,7 @@ export function ChannelMultiSelect(params?: ChannelMultiSelectParams): ChannelMu * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialChannel] Sets the default selected item in the menu. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#channel_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#channels_select|View in Slack API Documentation} */ export function ChannelSelect(params?: ChannelSelectParams): ChannelSelectBuilder { @@ -134,7 +134,7 @@ export function ChannelSelect(params?: ChannelSelectParams): ChannelSelectBuilde * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#checkboxes|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/checkboxes-element|View in Slack API Documentation} */ export function Checkboxes(params?: CheckboxesParams): CheckboxesBuilder { @@ -147,7 +147,7 @@ export function Checkboxes(params?: CheckboxesParams): CheckboxesBuilder { * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#conversation_multi_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#conversation_multi_select|View in Slack API Documentation} */ export function ConversationMultiSelect(params?: ConversationMultiSelectParams): ConversationMultiSelectBuilder { @@ -160,7 +160,7 @@ export function ConversationMultiSelect(params?: ConversationMultiSelectParams): * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialConversation] Sets the default selected item in the menu. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#conversation_multi_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#conversations_select|View in Slack API Documentation} */ export function ConversationSelect(params?: ConversationSelectParams): ConversationSelectBuilder { @@ -173,7 +173,7 @@ export function ConversationSelect(params?: ConversationSelectParams): Conversat * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialDate] Sets the default selected date in the menu. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#datepicker|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/date-picker-element|View in Slack API Documentation} */ export function DatePicker(params?: DatePickerParams): DatePickerBuilder { @@ -185,7 +185,7 @@ export function DatePicker(params?: DatePickerParams): DatePickerBuilder { * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.initialDateTime] Sets the default selected date and time for the date time picker. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#datetimepicker|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/datetime-picker-element|View in Slack API Documentation} */ export function DateTimePicker(params?: DateTimePickerParams): DateTimePickerBuilder { @@ -198,7 +198,7 @@ export function DateTimePicker(params?: DateTimePickerParams): DateTimePickerBui * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialValue] Sets the default email entered into the Email input at modal render. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#email|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/email-input-element|View in Slack API Documentation} */ export function EmailInput(params?: EmailInputParams): EmailInputBuilder { @@ -212,7 +212,7 @@ export function EmailInput(params?: EmailInputParams): EmailInputBuilder { * @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select. * @param {int} [params.minQueryLength] Sets a minimum number of characters types before querying your options URL. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#external_multi_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#external_multi_select|View in Slack API Documentation} */ export function ExternalMultiSelect(params?: ExternalMultiSelectParams): ExternalMultiSelectBuilder { @@ -225,7 +225,7 @@ export function ExternalMultiSelect(params?: ExternalMultiSelectParams): Externa * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [params.minQueryLength] Sets a minimum number of characters types before querying your options URL. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#external_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#external_select|View in Slack API Documentation} */ export function ExternalSelect(params?: ExternalSelectParams): ExternalSelectBuilder { @@ -237,7 +237,7 @@ export function ExternalSelect(params?: ExternalSelectParams): ExternalSelectBui * @param {string} [params.imageUrl] Sets the source URL from which the image will be loaded. * @param {string} [params.altText] Sets the textual summary of the image. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#image|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/image-element|View in Slack API Documentation} */ export function Img(params?: ImgParams): ImgBuilder { @@ -249,7 +249,7 @@ export function Img(params?: ImgParams): ImgBuilder { * @param {string} [params.filetypes] Sets the accepted filetypes. * @param {string} [params.maxFiles] Sets the maximum number of files to upload. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#file_input|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/file-input-element|View in Slack API Documentation} */ export function FileInput(params?: FileInputParams): FileInputBuilder { @@ -265,7 +265,7 @@ export function FileInput(params?: FileInputParams): FileInputBuilder { * @param {int} [params.minValue] Sets a minimum value for the number input. * @param {int} [params.maxValue] Sets a maximum value for the number input. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#number|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/number-input-element|View in Slack API Documentation} */ export function NumberInput(params?: NumberInputParams): NumberInputBuilder { @@ -276,7 +276,7 @@ export function NumberInput(params?: NumberInputParams): NumberInputBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#overflow|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/overflow-menu-element|View in Slack API Documentation} */ export function OverflowMenu(params?: OverflowMenuParams): OverflowMenuBuilder { @@ -287,7 +287,7 @@ export function OverflowMenu(params?: OverflowMenuParams): OverflowMenuBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#radio|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/radio-button-group-element|View in Slack API Documentation} */ export function RadioButtons(params?: RadioButtonsParams): RadioButtonsBuilder { @@ -300,7 +300,7 @@ export function RadioButtons(params?: RadioButtonsParams): RadioButtonsBuilder { * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#static_multi_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#static_multi_select|View in Slack API Documentation} */ export function StaticMultiSelect(params?: StaticMultiSelectParams): StaticMultiSelectBuilder { @@ -312,7 +312,7 @@ export function StaticMultiSelect(params?: StaticMultiSelectParams): StaticMulti * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#static_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#static_select|View in Slack API Documentation} */ export function StaticSelect(params?: StaticSelectParams): StaticSelectBuilder { @@ -328,7 +328,7 @@ export function StaticSelect(params?: StaticSelectParams): StaticSelectBuilder { * @param {int} [params.minLength] Sets a minimum character count in order for the user to submit the form. * @param {int} [params.maxLength] Sets a maximum character count allowed to send the form. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#input|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/plain-text-input-element|View in Slack API Documentation} */ export function TextInput(params?: TextInputParams): TextInputBuilder { @@ -341,7 +341,7 @@ export function TextInput(params?: TextInputParams): TextInputBuilder { * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialTime] Sets the default selected time in the menu. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#timepicker|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/time-picker-element|View in Slack API Documentation} */ export function TimePicker(params?: TimePickerParams): TimePickerBuilder { @@ -354,7 +354,7 @@ export function TimePicker(params?: TimePickerParams): TimePickerBuilder { * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialValue] Sets the default URL entered into the URL input at modal render. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#url|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/url-input-element|View in Slack API Documentation} */ export function URLInput(params?: URLInputParams): URLInputBuilder { @@ -367,7 +367,7 @@ export function URLInput(params?: URLInputParams): URLInputBuilder { * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#users_multi_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#users_multi_select|View in Slack API Documentation} */ export function UserMultiSelect(params?: UserMultiSelectParams): UserMultiSelectBuilder { @@ -380,7 +380,7 @@ export function UserMultiSelect(params?: UserMultiSelectParams): UserMultiSelect * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialUser] Setts the default selected user in the menu. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#users_select|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#users_select|View in Slack API Documentation} */ export function UserSelect(params?: UserSelectParams): UserSelectBuilder { @@ -392,7 +392,7 @@ export function UserSelect(params?: UserSelectParams): UserSelectBuilder { * @param {string} [params.text] Sets the display text for the workflow button. * @param {string} [params.accessibilityLabel] Sets accessibility label. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#workflow_button|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/workflow-button-element|View in Slack API Documentation} */ export function WorkflowButton(params?: WorkflowButtonParams): WorkflowButtonBuilder { @@ -405,7 +405,7 @@ export function WorkflowButton(params?: WorkflowButtonParams): WorkflowButtonBui * @param {string} [params.icon] Sets the icon to display. * @param {string} [params.text] Sets the text for the button. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#icon_button|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/icon-button-element|View in Slack API Documentation} */ export function IconButton(params?: IconButtonParams): IconButtonBuilder { @@ -416,7 +416,7 @@ export function IconButton(params?: IconButtonParams): IconButtonBuilder { * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#feedback_buttons|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/feedback-buttons-element|View in Slack API Documentation} */ export function FeedbackButtons(params?: FeedbackButtonsParams): FeedbackButtonsBuilder { @@ -428,7 +428,7 @@ export function FeedbackButtons(params?: FeedbackButtonsParams): FeedbackButtons * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action. * @param {string} [params.placeholder] Sets placeholder text. * - * {@link https://docs.slack.dev/reference/block-kit/block-elements#rich_text_input|View in Slack API Documentation} + * {@link https://docs.slack.dev/reference/block-kit/block-elements/rich-text-input-element|View in Slack API Documentation} */ export function RichTextInput(params?: RichTextInputParams): RichTextInputBuilder { diff --git a/src/elements/number-input.ts b/src/elements/number-input.ts index 150240bb..9154cbfc 100644 --- a/src/elements/number-input.ts +++ b/src/elements/number-input.ts @@ -42,7 +42,7 @@ export interface NumberInputBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#number + * @@link https://docs.slack.dev/reference/block-kit/block-elements/number-input-element * @@displayName Email Input */ diff --git a/src/elements/overflow-menu.ts b/src/elements/overflow-menu.ts index d5fc39e6..21ac2a12 100644 --- a/src/elements/overflow-menu.ts +++ b/src/elements/overflow-menu.ts @@ -23,7 +23,7 @@ export interface OverflowMenuBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#overflow + * @@link https://docs.slack.dev/reference/block-kit/block-elements/overflow-menu-element * @@displayName Overflow Menu */ diff --git a/src/elements/radio-buttons.ts b/src/elements/radio-buttons.ts index a9685b1a..cf956111 100644 --- a/src/elements/radio-buttons.ts +++ b/src/elements/radio-buttons.ts @@ -27,7 +27,7 @@ export interface RadioButtonsBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#radio + * @@link https://docs.slack.dev/reference/block-kit/block-elements/radio-button-group-element * @@displayName Radio Buttons */ diff --git a/src/elements/static-multi-select.ts b/src/elements/static-multi-select.ts index f7c1c003..15b03c80 100644 --- a/src/elements/static-multi-select.ts +++ b/src/elements/static-multi-select.ts @@ -29,7 +29,7 @@ export interface StaticMultiSelectParams { } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#static_multi_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#static_multi_select * @@displayName Static Multi-Select */ diff --git a/src/elements/static-select.ts b/src/elements/static-select.ts index 6968f721..c479e926 100644 --- a/src/elements/static-select.ts +++ b/src/elements/static-select.ts @@ -37,7 +37,7 @@ export interface StaticSelectBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#static_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#static_select * @@displayName Static Select */ diff --git a/src/elements/text-input.ts b/src/elements/text-input.ts index ab29665f..d1b3e884 100644 --- a/src/elements/text-input.ts +++ b/src/elements/text-input.ts @@ -37,7 +37,7 @@ export interface TextInputBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#input + * @@link https://docs.slack.dev/reference/block-kit/block-elements/plain-text-input-element * @@displayName Plain-Text Input */ diff --git a/src/elements/timepicker.ts b/src/elements/timepicker.ts index e7c0b716..7acc9c60 100644 --- a/src/elements/timepicker.ts +++ b/src/elements/timepicker.ts @@ -29,7 +29,7 @@ export interface TimePickerBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#timepicker + * @@link https://docs.slack.dev/reference/block-kit/block-elements/time-picker-element * @@displayName Time Picker */ diff --git a/src/elements/url-input.ts b/src/elements/url-input.ts index 0c60868b..e0d23e49 100644 --- a/src/elements/url-input.ts +++ b/src/elements/url-input.ts @@ -28,7 +28,7 @@ export interface URLInputBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#url + * @@link https://docs.slack.dev/reference/block-kit/block-elements/url-input-element * @@displayName URL Input */ diff --git a/src/elements/user-multi-select.ts b/src/elements/user-multi-select.ts index 51713d75..fcd1fae8 100644 --- a/src/elements/user-multi-select.ts +++ b/src/elements/user-multi-select.ts @@ -30,7 +30,7 @@ export interface UserMultiSelectBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#users_multi_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#users_multi_select * @@displayName User Multi-Select */ diff --git a/src/elements/user-select.ts b/src/elements/user-select.ts index 0ac04d24..9ad09abb 100644 --- a/src/elements/user-select.ts +++ b/src/elements/user-select.ts @@ -28,7 +28,7 @@ export interface UserSelectBuilder extends ActionId, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#users_select + * @@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#users_select * @@displayName User Select */ diff --git a/src/elements/workflow-button.ts b/src/elements/workflow-button.ts index 479794d8..fe641c61 100644 --- a/src/elements/workflow-button.ts +++ b/src/elements/workflow-button.ts @@ -40,7 +40,7 @@ export interface WorkflowButtonBuilder extends AccessibilityLabel, } /** - * @@link https://docs.slack.dev/reference/block-kit/block-elements#workflow_button + * @@link https://docs.slack.dev/reference/block-kit/block-elements/workflow-button-element * @@displayName Workflow Button */ diff --git a/src/surfaces/home-tab.ts b/src/surfaces/home-tab.ts index f88ee0e7..d39ac55f 100644 --- a/src/surfaces/home-tab.ts +++ b/src/surfaces/home-tab.ts @@ -35,7 +35,7 @@ export interface HomeTabBuilder extends Blocks, } /** - * @@link https://docs.slack.dev/surfaces/modals + * @@link https://docs.slack.dev/surfaces/app-home * @@displayName Home Tab */ diff --git a/tmp-docs/block-elements.ts b/tmp-docs/block-elements.ts deleted file mode 100644 index 806561d7..00000000 --- a/tmp-docs/block-elements.ts +++ /dev/null @@ -1,1047 +0,0 @@ -// This file contains objects documented here: https://docs.slack.dev/reference/block-kit/block-elements - -import type { RichTextBlock } from './blocks'; -import type { - ColorScheme, - Option, - PlainTextElement, - PlainTextOption, - SlackFileImageObject, - UrlImageObject, -} from './composition-objects'; -import type { - Actionable, - Confirmable, - Dispatchable, - Focusable, - MaxItemsSelectable, - Placeholdable, - RichTextBorderable, - RichTextStyleable, - URLRespondable, -} from './extensions'; - -/** - * @description Allows users a direct path to performing basic actions. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/button-element Button element reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interactionThis is an interactive component - see our guide to enabling interactivity}. - */ -export interface Button extends Actionable, Confirmable { - /** - * @description The type of element. In this case `type` is always `button`. - */ - type: 'button'; - /** - * @description A {@link PlainTextElement} that defines the button's text. `text` may truncate with ~30 characters. - * Maximum length for the text in this field is 75 characters. - */ - text: PlainTextElement; - /** - * @description The value to send along with the {@link https://docs.slack.dev/interactivity/handling-user-interaction#payloads interaction payload}. - * Maximum length for this field is 2000 characters. - */ - value?: string; - /** - * @description A URL to load in the user's browser when the button is clicked. Maximum length for this field is 3000 - * characters. If you're using `url`, you'll still receive an {@link https://docs.slack.dev/interactivity/handling-user-interaction#payloads interaction payload} - * and will need to send an {@link https://docs.slack.dev/interactivity/handling-user-interaction#acknowledgment_response acknowledgement response}. - */ - url?: string; - /** - * @description Decorates buttons with alternative visual color schemes. Use this option with restraint. - * `primary` gives buttons a green outline and text, ideal for affirmation or confirmation actions. `primary` should - * only be used for one button within a set. - * `danger` gives buttons a red outline and text, and should be used when the action is destructive. Use `danger` even - * more sparingly than primary. - * If you don't include this field, the default button style will be used. - */ - style?: ColorScheme; - /** - * @description A label for longer descriptive text about a button element. This label will be read out by screen - * readers instead of the button `text` object. Maximum length for this field is 75 characters. - */ - accessibility_label?: string; -} - -/** - * @description Allows users to choose multiple items from a list of options. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/checkboxes-element Checkboxes element reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface Checkboxes extends Actionable, Confirmable, Focusable { - /** - * @description The type of element. In this case `type` is always `checkboxes`. - */ - type: 'checkboxes'; - /** - * @description An array of {@link Option} objects that exactly matches one or more of the options within `options`. - * These options will be selected when the checkbox group initially loads. - */ - initial_options?: Option[]; - /** - * @description An array of {@link Option} objects. A maximum of 10 options are allowed. - */ - options: Option[]; -} - -/** - * @description Allows users to select a date from a calendar style UI. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/date-picker-element Date picker element reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface Datepicker extends Actionable, Confirmable, Focusable, Placeholdable { - /** - * @description The type of element. In this case `type` is always `datepicker`. - */ - type: 'datepicker'; - /** - * @description The initial date that is selected when the element is loaded. - * This should be in the format `YYYY-MM-DD`. - */ - initial_date?: string; -} - -/** - * @description Allows users to select both a date and a time of day, formatted as a Unix timestamp. On desktop - * clients, this time picker will take the form of a dropdown list and the date picker will take the form of a dropdown - * calendar. Both options will have free-text entry for precise choices. On mobile clients, the time picker and date - * picker will use native UIs. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/datetime-picker-element Datetime picker element reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface DateTimepicker extends Actionable, Confirmable, Focusable { - /** - * @description The type of element. In this case `type` is always `datetimepicker`. - */ - type: 'datetimepicker'; - /** - * @description The initial date and time that is selected when the element is loaded, represented as a UNIX - * timestamp in seconds. This should be in the format of 10 digits, for example `1628633820` represents the date and - * time August 10th, 2021 at 03:17pm PST. - */ - initial_date_time?: number; -} - -/** - * @description Allows user to enter an email into a single-line field. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/email-input-element Email input element reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface EmailInput extends Actionable, Dispatchable, Focusable, Placeholdable { - /** - * @description The type of element. In this case `type` is always `email_text_input`. - */ - type: 'email_text_input'; - /** - * @description The initial value in the email input when it is loaded. - */ - initial_value?: string; -} - -/** - * @description Buttons to indicate positive or negative feedback. - */ -export interface FeedbackButtons extends Actionable { - /** - * @description The type of block. For a feedback buttons block, `type` is always `feedback_buttons`. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/feedback-buttons-element Feedback buttons element reference}. - */ - type: 'feedback_buttons'; - /** - * @description A button to indicate positive feedback. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/feedback-buttons-element/#button-object-fields Feedback buttons object fields reference}. - */ - positive_button: { - /** - * @description Defines an object containing some text. - * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}. - */ - text: PlainTextElement; - /** - * @description A label for longer descriptive text about a button element. This label will be read out by screen readers instead of the button `text` object. Maximum length for this field is 75 characters. - */ - accessibility_label?: string; - /** - * @description The positive feedback button value. - */ - value: string; - }; - /** - * @description A button to indicate negative feedback. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/feedback-buttons-element/#button-object-fields Feedback buttons object fields reference}. - */ - negative_button: { - /** - * @description Defines an object containing some text. - * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}. - */ - text: PlainTextElement; - /** - * @description A label for longer descriptive text about a button element. This label will be read out by screen readers instead of the button `text` object. Maximum length for this field is 75 characters. - */ - accessibility_label?: string; - /** - * @description The negative feedback button value. - */ - value: string; - }; -} - -/** - * @description Allows user to upload files. In order to use the `file_input` element within your app, - * your app must have the `files:read` scope. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/file-input-element File input element reference}. - */ -export interface FileInput extends Actionable { - /** - * @description The type of element. In this case `type` is always `file_input`. - */ - type: 'file_input'; - /** - * @description An array of valid {@link https://docs.slack.dev/reference/objects/file-object file extensions} that will be accepted - * for this element. All file extensions will be accepted if `filetypes` is not specified. This validation is provided - * for convenience only, and you should perform your own file type validation based on what you expect to receive. - */ - filetypes?: string[]; - /** - * @description Maximum number of files that can be uploaded for this `file_input` element. Minimum of `1`, maximum of - * `10`. Defaults to `10` if not specified. - */ - max_files?: number; -} - -/** - * @description An icon button to perform actions. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/icon-button-element Icon button element reference}. - */ -export interface IconButton extends Actionable, Confirmable { - /** - * @description The type of element. In this case `type` is always `icon_button`. - */ - type: 'icon_button'; - /** - * @description The icon to show. - * @example trash - */ - icon: string; - /** - * @description Defines an object containing some text. - * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}. - */ - text: PlainTextElement; - /** - * @description A label for longer descriptive text about a button element. This label will be read out by screen readers instead of the button `text` object. Maximum length for this field is 75 characters. - */ - accessibility_label?: string; - /** - * @description The button value. - */ - value?: string; - /** - * @description User IDs for which the icon appears. - */ - visible_to_user_ids?: string[]; -} - -/** - * @description Displays an image as part of a larger block of content. Use this `image` block if you want a block with - * only an image in it. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/image-element Image element reference}. - */ -export type ImageElement = { - /** - * @description The type of element. In this case `type` is always `image`. - */ - type: 'image'; - /** - * @description A plain-text summary of the image. This should not contain any markup. - */ - alt_text: string; -} & (UrlImageObject | SlackFileImageObject); - -/* - * Multi-select and Select menus follow - */ - -// Selects and Multiselects are available in different surface areas so I've separated them here -/** - * @description Allows users to choose an option from a drop down menu. - * The select menu also includes type-ahead functionality, where a user can type a part or all of an option string to - * filter the list. There are different types of select menu elements that depend on different data sources for their - * lists of options: {@link StaticSelect}, {@link ExternalSelect}, {@link UsersSelect}, {@link ConversationsSelect}, - * {@link ChannelsSelect}. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element Select menu element reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export type Select = UsersSelect | StaticSelect | ConversationsSelect | ChannelsSelect | ExternalSelect; - -/** - * @description Allows users to select multiple items from a list of options. - * Just like regular {@link Select}, multi-select menus also include type-ahead functionality, where a user can type a - * part or all of an option string to filter the list. - * There are different types of multi-select menu that depend on different data sources for their lists of options: - * {@link MultiStaticSelect}, {@link MultiExternalSelect}, {@link MultiUsersSelect}, {@link MultiConversationsSelect}, - * {@link MultiChannelsSelect}. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menus-element Multi-select menu element reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export type MultiSelect = - | MultiUsersSelect - | MultiStaticSelect - | MultiConversationsSelect - | MultiChannelsSelect - | MultiExternalSelect; - -/** - * @description This select menu will populate its options with a list of Slack users visible to the current user in the - * active workspace. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#users_select Select menu of users reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface UsersSelect extends Actionable, Confirmable, Focusable, Placeholdable { - /** - * @description The type of element. In this case `type` is always `users_select`. - */ - type: 'users_select'; - /** - * @description The user ID of any valid user to be pre-selected when the menu loads. - */ - initial_user?: string; -} - -/** - * @description This multi-select menu will populate its options with a list of Slack users visible to the current user - * in the active workspace. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#users_multi_select Multi-select menu of users reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface MultiUsersSelect extends Actionable, Confirmable, Focusable, MaxItemsSelectable, Placeholdable { - /** - * @description The type of element. In this case `type` is always `multi_users_select`. - */ - type: 'multi_users_select'; - /** - * @description An array of user IDs of any valid users to be pre-selected when the menu loads. - */ - initial_users?: string[]; -} - -/** - * @description This is the simplest form of select menu, with a static list of options passed in when defining the - * element. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#static_select Select menu of static options reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface StaticSelect extends Actionable, Confirmable, Focusable, Placeholdable { - /** - * @description The type of element. In this case `type` is always `static_select`. - */ - type: 'static_select'; - // TODO: breaking change: use discriminative union and separate types for static select of options vs. option groups - /** - * @description A single option that exactly matches one of the options within `options` or `option_groups`. - * This option will be selected when the menu initially loads. - */ - initial_option?: PlainTextOption; - // TODO: breaking change: use discriminative union and separate types for static select of options vs. option groups - // so this is not always optional. Also in theory this should support mrkdown options too? - /** - * @description An array of {@link PlainTextOption}. Maximum number of options is 100. If `option_groups` is - * specified, this field should not be. - */ - options?: PlainTextOption[]; - // TODO: breaking change: use composition-objects.ts' `OptionGroup` - which allows both plaintext and mrkdown - // options, whereas the below doesn't. Also use a discriminative union here to separate option vs. option groups - // static menu. - /** - * @description An array of option group objects. Maximum number of option groups is 100. If `options` is specified, - * this field should not be. - */ - option_groups?: { - label: PlainTextElement; - options: PlainTextOption[]; - }[]; -} - -/** - * @description This is the simplest form of select menu, with a static list of options passed in when defining the - * element. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#static_multi_select Multi-select menu of static options reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface MultiStaticSelect extends Actionable, Confirmable, Focusable, MaxItemsSelectable, Placeholdable { - /** - * @description The type of element. In this case `type` is always `multi_static_select`. - */ - type: 'multi_static_select'; - // TODO: breaking change: use discriminative union and separate types for static select of options vs. option groups - /** - * @description An array of option objects that exactly match one or more of the options within `options` or - * `option_groups`. These options will be selected when the menu initially loads. - */ - initial_options?: PlainTextOption[]; - // TODO: breaking change: use discriminative union and separate types for static select of options vs. option groups - // so this is not always optional. Also in theory this should support mrkdown options too? - /** - * @description An array of {@link PlainTextOption}. Maximum number of options is 100. If `option_groups` is - * specified, this field should not be. - */ - options?: PlainTextOption[]; - // TODO: breaking change: use composition-objects.ts' `OptionGroup` - which allows both plaintext and mrkdown - // options, whereas the below doesn't. Also use a discriminative union here to separate option vs. option groups - // static menu. - /** - * @description An array of option group objects. Maximum number of option groups is 100. If `options` is specified, - * this field should not be. - */ - option_groups?: { - label: PlainTextElement; - options: PlainTextOption[]; - }[]; -} - -/** - * @description This select menu will populate its options with a list of public and private channels, DMs, and MPIMs - * visible to the current user in the active workspace. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#conversations_select Select menu of conversations reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface ConversationsSelect extends Actionable, Confirmable, Focusable, Placeholdable, URLRespondable { - /** - * @description The type of element. In this case `type` is always `conversations_select`. - */ - type: 'conversations_select'; - /** - * @description The ID of any valid conversation to be pre-selected when the menu loads. If - * `default_to_current_conversation` is also supplied, `initial_conversation` will take precedence. - */ - initial_conversation?: string; - /** - * @description Pre-populates the select menu with the conversation that the user was viewing when they opened the - * modal, if available. Default is `false`. - */ - default_to_current_conversation?: boolean; - /** - * @description A filter object that reduces the list of available conversations using the specified criteria. - */ - filter?: { - // TODO: breaking change: replace with ConversationFilter object from composition-objects - include?: ('im' | 'mpim' | 'private' | 'public')[]; - exclude_external_shared_channels?: boolean; - exclude_bot_users?: boolean; - }; -} - -// TODO: breaking change: maybe can use a discriminative union to differentiate between a multi-select convo element -// that uses `default_to_current_conversation` vs. `initial_conversation`? -/** - * @description This multi-select menu will populate its options with a list of public and private channels, DMs, and - * MPIMs visible to the current user in the active workspace. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#conversation_multi_select Multi-select menu of conversations reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface MultiConversationsSelect - extends Actionable, - Confirmable, - Focusable, - MaxItemsSelectable, - Placeholdable { - /** - * @description The type of element. In this case `type` is always `conversations_select`. - */ - type: 'multi_conversations_select'; - // TODO: breaking change: change array type to formalize 'at least one element' requirement. - /** - * @description An array of one or more IDs of any valid conversations to be pre-selected when the menu loads. If - * `default_to_current_conversation` is also supplied, `initial_conversation` will be ignored. - */ - initial_conversations?: string[]; - /** - * @description Pre-populates the select menu with the conversation that the user was viewing when they opened the - * modal, if available. Default is `false`. - */ - default_to_current_conversation?: boolean; - /** - * @description A filter object that reduces the list of available conversations using the specified criteria. - */ - filter?: { - // TODO: breaking change: replace with ConversationFilter object from composition-objects - include?: ('im' | 'mpim' | 'private' | 'public')[]; - exclude_external_shared_channels?: boolean; - exclude_bot_users?: boolean; - }; -} - -/** - * @description This select menu will populate its options with a list of public channels visible to the current user - * in the active workspace. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#channels_select Select menu of public channels reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface ChannelsSelect extends Actionable, Confirmable, Focusable, Placeholdable, URLRespondable { - /** - * @description The type of element. In this case `type` is always `channels_select`. - */ - type: 'channels_select'; - /** - * @description The ID of any valid public channel to be pre-selected when the menu loads. - */ - initial_channel?: string; -} - -/** - * @description This multi-select menu will populate its options with a list of public channels visible to the current - * user in the active workspace. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#channel_multi_select Multi-select menu of public channels reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface MultiChannelsSelect extends Actionable, Confirmable, Focusable, MaxItemsSelectable, Placeholdable { - /** - * @description The type of element. In this case `type` is always `multi_channels_select`. - */ - type: 'multi_channels_select'; - // TODO: breaking change: change type to enforce 'at least one' array restriction - /** - * @description An array of one or more IDs of any valid public channel to be pre-selected when the menu loads. - */ - initial_channels?: string[]; -} - -/** - * @description This select menu will load its options from an external data source, allowing for a dynamic list of - * options. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#external_select Select menu of external data source reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface ExternalSelect extends Actionable, Confirmable, Focusable, Placeholdable { - /** - * @description The type of element. In this case `type` is always `external_select`. - */ - type: 'external_select'; - // TODO: breaking change: should be able to support both options and option groups, both mrkdwn and plaintext - /** - * @description A single option to be selected when the menu initially loads. - */ - initial_option?: PlainTextOption; - /** - * @description When the typeahead field is used, a request will be sent on every character change. If you prefer - * fewer requests or more fully ideated queries, use the `min_query_length` attribute to tell Slack the fewest number - * of typed characters required before dispatch. The default value is `3`. - */ - min_query_length?: number; -} - -/** - * @description This menu will load its options from an external data source, allowing for a dynamic list of options. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#external_multi_select Multi-select menu of external data source reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface MultiExternalSelect extends Actionable, Confirmable, Focusable, MaxItemsSelectable, Placeholdable { - /** - * @description The type of element. In this case `type` is always `multi_external_select`. - */ - type: 'multi_external_select'; - // TODO: breaking change: should be able to support both options and option groups, both mrkdwn and plaintext - /** - * @description An array of options to be selected when the menu initially loads. - */ - initial_options?: PlainTextOption[]; - /** - * @description When the typeahead field is used, a request will be sent on every character change. If you prefer - * fewer requests or more fully ideated queries, use the `min_query_length` attribute to tell Slack the fewest number - * of typed characters required before dispatch. The default value is `3`. - */ - min_query_length?: number; -} - -/* - * End of select/multi-select menus - */ - -/** - * @description Allows user to enter a number into a single-line field. The number input element accepts both whole and - * decimal numbers. For example, 0.25, 5.5, and -10 are all valid input values. Decimal numbers are only allowed when - * `is_decimal_allowed` is equal to `true`. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/number-input-element Number input element reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface NumberInput extends Actionable, Dispatchable, Focusable, Placeholdable { - /** - * @description The type of element. In this case `type` is always `number_input`. - */ - type: 'number_input'; - /** - * @description Decimal numbers are allowed if this property is `true`, set the value to `false` otherwise. - */ - is_decimal_allowed: boolean; - /** - * @description The initial value in the input when it is loaded. - */ - initial_value?: string; - /** - * @description The minimum value, cannot be greater than `max_value`. - */ - min_value?: string; - /** - * @description The maximum value, cannot be less than `min_value`. - */ - max_value?: string; -} - -/** - * @description Allows users to press a button to view a list of options. - * Unlike the select menu, there is no typeahead field, and the button always appears with an ellipsis ('…') rather - * than customizable text. As such, it is usually used if you want a more compact layout than a select menu, or to - * supply a list of less visually important actions after a row of buttons. You can also specify simple URL links as - * overflow menu options, instead of actions. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/overflow-menu-element Overflow menu element reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface Overflow extends Actionable, Confirmable { - /** - * @description The type of element. In this case `type` is always `number_input`. - */ - type: 'overflow'; - // TODO: breaking change: this should support mrkdown options too? - /** - * @description An array of up to 5 {@link PlainTextOption} to display in the menu. - */ - options: PlainTextOption[]; -} - -/** - * @description Allows users to enter freeform text data into a single-line or multi-line field. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/plain-text-input-element Plain-text input element reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface PlainTextInput extends Actionable, Dispatchable, Focusable, Placeholdable { - /** - * @description The type of element. In this case `type` is always `plain_text_input`. - */ - type: 'plain_text_input'; - /** - * @description The initial value in the plain-text input when it is loaded. - */ - initial_value?: string; - /** - * @description Indicates whether the input will be a single line (`false`) or a larger textarea (`true`). - * Defaults to `false`. - */ - multiline?: boolean; - /** - * @description The minimum length of input that the user must provide. If the user provides less, they will receive - * an error. Maximum value is 3000. - */ - min_length?: number; - /** - * @description The maximum length of input that the user can provide. If the user provides more, - * they will receive an error. - */ - max_length?: number; -} - -/** - * @description Allows users to choose one item from a list of possible options. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/radio-button-group-element Radio button group element reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface RadioButtons extends Actionable, Confirmable, Focusable { - /** - * @description The type of element. In this case `type` is always `radio_buttons`. - */ - type: 'radio_buttons'; - /** - * @description An {@link Option} object that exactly matches one of the options within `options`. This option will - * be selected when the radio button group initially loads. - */ - initial_option?: Option; - /** - * @description An array of {@link Option} objects. A maximum of 10 options are allowed. - */ - options: Option[]; -} - -/** - * @description Allows users to choose a time from a rich dropdown UI. On desktop clients, this time picker will take - * the form of a dropdown list with free-text entry for precise choices. On mobile clients, the time picker will use - * native time picker UIs. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/time-picker-element Time picker element reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface Timepicker extends Actionable, Confirmable, Focusable, Placeholdable { - /** - * @description The type of element. In this case `type` is always `timepicker`. - */ - type: 'timepicker'; - /** - * @description The initial time that is selected when the element is loaded. This should be in the format `HH:mm`, - * where `HH` is the 24-hour format of an hour (00 to 23) and `mm` is minutes with leading zeros (00 to 59), - * for example 22:25 for 10:25pm. - */ - initial_time?: string; - /** - * @description A string in the IANA format, e.g. 'America/Chicago'. The timezone is displayed to end users as hint - * text underneath the time picker. It is also passed to the app upon certain interactions, such as view_submission. - */ - timezone?: string; -} - -/** - * @description Allows user to enter a URL into a single-line field. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/url-input-element URL input element reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface URLInput extends Actionable, Dispatchable, Focusable, Placeholdable { - /** - * @description The type of element. In this case `type` is always `url_text_input`. - */ - type: 'url_text_input'; - /** - * @description The initial value in the URL input when it is loaded. - */ - initial_value?: string; -} - -/** - * @description Allows users to run a {@link https://docs.slack.dev/tools/deno-slack-sdk/guides/creating-link-triggers/#workflow_buttons link trigger} with customizable inputs. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/workflow-button-element Workflow button element reference}. - */ -export interface WorkflowButton extends Confirmable { - /** - * @description The type of element. In this case `type` is always `workflow_button`. - */ - type: 'workflow_button'; - /** - * @description A {@link PlainTextElement} that defines the button's text. `text` may truncate with ~30 characters. - * Maximum length for the `text` in this field is 75 characters. - */ - text: PlainTextElement; - /** - * @description A workflow object that contains details about the workflow that will run when the button is clicked. - */ - workflow: { - /** - * @description Properties of the {@link https://docs.slack.dev/tools/deno-slack-sdk/guides/creating-link-triggers/#workflow_buttons link trigger} - * that will be invoked via this button. - */ - trigger: { - /** - * @description The trigger URL of the {@link https://docs.slack.dev/tools/deno-slack-sdk/guides/creating-link-triggers/#workflow_buttons link trigger} - */ - url: string; - /** - * @description List of customizable input parameters and their values. Should match input parameters specified on - * the provided trigger. - */ - customizable_input_parameters?: { - /** - * @description Name of the customizable input, which should be the name of a workflow input parameter for the - * matching workflow of the link trigger. - */ - name: string; - /** - * @description The value of the customizable input parameter. The type of the value is expected to match the - * specified type for the matching workflow input parameter. - */ - value: string; - }[]; - }; - }; - /** - * @description Decorates buttons with alternative visual color schemes. Use this option with restraint. - * `primary` gives buttons a green outline and text, ideal for affirmation or confirmation actions. `primary` should - * only be used for one button within a set. - * `danger` gives buttons a red outline and text, and should be used when the action is destructive. Use `danger` even - * more sparingly than primary. - * If you don't include this field, the default button style will be used. - */ - style?: ColorScheme; - /** - * @description A label for longer descriptive text about a button element. This label will be read out by screen - * readers instead of the button `text` object. Maximum length for this field is 75 characters. - */ - accessibility_label?: string; -} - -/** - * @description A broadcast mention element for use in a rich text message. - */ -export interface RichTextBroadcastMention extends RichTextStyleable { - /** - * @description The type of element. In this case `type` is always `broadcast`. - */ - type: 'broadcast'; - /** - * @description The range of the broadcast; can be one of `here`, `channel` and `everyone`. - */ - range: 'here' | 'channel' | 'everyone'; -} - -/** - * @description A hex color element for use in a rich text message. - */ -export interface RichTextColor extends RichTextStyleable { - /** - * @description The type of element. In this case `type` is always `color`. - */ - type: 'color'; - /** - * @description The hex value for the color. - */ - value: string; -} - -/** - * @description A channel mention element for use in a rich text message. - */ -export interface RichTextChannelMention extends RichTextStyleable { - /** - * @description The type of element. In this case `type` is always `channel`. - */ - type: 'channel'; - /** - * @description The encoded channel ID, e.g. C1234ABCD. - */ - channel_id: string; -} - -/** - * @description A date element for use in a rich text message. - */ -export interface RichTextDate extends RichTextStyleable { - /** - * @description The type of element. In this case `type` is always `date`. - */ - type: 'date'; - /** - * @description A UNIX timestamp for the date to be displayed in seconds. - */ - timestamp: number; - /** - * @description A template string containing curly-brace-enclosed tokens to substitute your provided `timestamp` - * in a particularly-formatted way. For example: `Posted at {date_long}`. The available date formatting tokens are: - * - `{day_divider_pretty}`: Shows `today`, `yesterday` or `tomorrow` if applicable. Otherwise, if the date is in - * current year, uses the `{date_long}` format without the year. Otherwise, falls back to using the `{date_long}` - * format. - * - `{date_num}`: Shows date as YYYY-MM-DD. - * - `{date_slash}`: Shows date as DD/MM/YYYY (subject to locale preferences). - * - `{date_long}`: Shows date as a long-form sentence including day-of-week, e.g. `Monday, December 23rd, 2013`. - * - `{date_long_full}`: Shows date as a long-form sentence without day-of-week, e.g. `August 9, 2020`. - * - `{date_long_pretty}`: Shows `yesterday`, `today` or `tomorrow`, otherwise uses the `{date_long}` format. - * - `{date}`: Same as `{date_long_full}` but without the year. - * - `{date_pretty}`: Shows `today`, `yesterday` or `tomorrow` if applicable, otherwise uses the `{date}` format. - * - `{date_short}`: Shows date using short month names without day-of-week, e.g. `Aug 9, 2020`. - * - `{date_short_pretty}`: Shows `today`, `yesterday` or `tomorrow` if applicable, otherwise uses the `{date_short}` - * format. - * - `{time}`: Depending on user preferences, shows just the time-of-day portion of the timestamp using either 12 or - * 24 hour clock formats, e.g. `2:34 PM` or `14:34`. - * - `{time_secs}`: Depending on user preferences, shows just the time-of-day portion of the timestamp using either 12 - * or 24 hour clock formats, including seconds, e.g. `2:34:56 PM` or `14:34:56`. - * - `{ago}`: A human-readable period of time, e.g. `3 minutes ago`, `4 hours ago`, `2 days ago`. - * TODO: test/document `{member_local_time}`, `{status_expiration}` and `{calendar_header}` - */ - format: string; - /** - * @description URL to link the entire `format` string to. - */ - url?: string; - /** - * @description Text to display in place of the date should parsing, formatting or displaying fails. - */ - fallback?: string; -} - -/** - * @description An emoji element for use in a rich text message. - */ -export interface RichTextEmoji extends RichTextStyleable { - /** - * @description The type of element. In this case `type` is always `emoji`. - */ - type: 'emoji'; - /** - * @description Name of emoji, without colons or skin tones, e.g. `wave` - */ - name: string; - /** - * @description Lowercase hexadecimal Unicode representation of a standard emoji (not for use with custom emoji). - */ - unicode?: string; - /** - * @description URL of emoji asset. Only used when sharing custom emoji across workspaces. - */ - url?: string; -} - -/** - * @description A link element for use in a rich text message. - */ -export interface RichTextLink extends RichTextStyleable { - /** - * @description The type of element. In this case `type` is always `link`. - */ - type: 'link'; - /** - * @description The text to link. - */ - text?: string; - /** - * @description TODO: ? - */ - unsafe?: boolean; - /** - * @description URL to link to. - */ - url: string; -} - -/** - * @description A workspace or team mention element for use in a rich text message. - */ -export interface RichTextTeamMention extends RichTextStyleable { - /** - * @description The type of element. In this case `type` is always `team`. - */ - type: 'team'; - /** - * @description The encoded team ID, e.g. T1234ABCD. - */ - team_id: string; -} - -/** - * @description A generic text element for use in a rich text message. - */ -export interface RichTextText extends RichTextStyleable { - /** - * @description The type of element. In this case `type` is always `text`. - */ - type: 'text'; - /** - * @description The text to render. - */ - text: string; -} - -/** - * @description A user mention element for use in a rich text message. - */ -export interface RichTextUserMention extends RichTextStyleable { - /** - * @description The type of element. In this case `type` is always `user`. - */ - type: 'user'; - /** - * @description The encoded user ID, e.g. U1234ABCD. - */ - user_id: string; -} - -/** - * @description A usergroup mention element for use in a rich text message. - */ -export interface RichTextUsergroupMention extends RichTextStyleable { - /** - * @description The type of element. In this case `type` is always `usergroup`. - */ - type: 'usergroup'; - /** - * @description The encoded usergroup ID, e.g. S1234ABCD. - */ - usergroup_id: string; -} - -/** - * @description Union of rich text sub-elements for use within rich text blocks. - */ -export type RichTextElement = - | RichTextBroadcastMention - | RichTextColor - | RichTextChannelMention - | RichTextDate - | RichTextEmoji - | RichTextLink - | RichTextTeamMention - | RichTextText - | RichTextUserMention - | RichTextUsergroupMention; - -/** - * @description A section block within a rich text field. - */ -export interface RichTextSection { - /** - * @description The type of element. In this case `type` is always `rich_text_section`. - */ - type: 'rich_text_section'; - elements: RichTextElement[]; -} - -/** - * @description A list block within a rich text field. - */ -export interface RichTextList extends RichTextBorderable { - /** - * @description The type of element. In this case `type` is always `rich_text_list`. - */ - type: 'rich_text_list'; - /** - * @description An array of {@link RichTextSection} elements comprising each list item. - */ - elements: RichTextSection[]; - /** - * @description The type of list. Can be either `bullet` (the list points are all rendered the same way) or `ordered` - * (the list points increase numerically from 1). - */ - style: 'bullet' | 'ordered'; - /** - * @description The style of the list points. Can be a number from `0` (default) to `8`. Yields a different character - * or characters rendered as the list points. Also affected by the `style` property. - */ - indent?: number; -} - -/** - * @description A quote block within a rich text field. - */ -export interface RichTextQuote extends RichTextBorderable { - /** - * @description The type of element. In this case `type` is always `rich_text_quote`. - */ - type: 'rich_text_quote'; - /** - * @description An array of {@link RichTextElement} comprising the quote block. - */ - elements: RichTextElement[]; -} - -/** - * @description A block of preformatted text within a rich text field. - */ -export interface RichTextPreformatted extends RichTextBorderable { - /** - * @description The type of element. In this case `type` is always `rich_text_preformatted`. - */ - type: 'rich_text_preformatted'; - /** - * @description An array of either {@link RichTextLink} or {@link RichTextText} comprising the preformatted text. - */ - elements: (RichTextText | RichTextLink)[]; -} - -/** - * @description A rich text input creates a composer/WYSIWYG editor for entering formatted text, offering nearly the - * same experience you have writing messages in Slack. - * @see {@link https://docs.slack.dev/reference/block-kit/block-elements/rich-text-input-element Rich-text input element reference}. - * @see {@link https://docs.slack.dev/interactivity/handling-user-interaction This is an interactive component - see our guide to enabling interactivity}. - */ -export interface RichTextInput extends Actionable, Dispatchable, Focusable, Placeholdable { - /** - * @description The type of element. In this case `type` is always `rich_text_input`. - */ - type: 'rich_text_input'; - /** - * @description Initial contents of the input when it is loaded. - */ - initial_value?: RichTextBlock; -} diff --git a/tmp-docs/blocks.ts b/tmp-docs/blocks.ts deleted file mode 100644 index 94b2aff0..00000000 --- a/tmp-docs/blocks.ts +++ /dev/null @@ -1,455 +0,0 @@ -// This file contains objects documented here: https://docs.slack.dev/reference/block-kit/blocks -import type { - Button, - Checkboxes, - Datepicker, - DateTimepicker, - EmailInput, - FeedbackButtons, - FileInput, - IconButton, - ImageElement, - MultiSelect, - NumberInput, - Overflow, - PlainTextInput, - RadioButtons, - RichTextInput, - RichTextList, - RichTextPreformatted, - RichTextQuote, - RichTextSection, - Select, - Timepicker, - URLInput, - WorkflowButton, -} from './block-elements'; -import type { - PlainTextElement, - RawTextElement, - SlackFileImageObject, - TextObject, - UrlImageObject, -} from './composition-objects'; - -export interface Block { - /** - * @description The type of block. - */ - type: string; - /** - * @description A string acting as a unique identifier for a block. If not specified, a `block_id` will be generated. - * You can use this `block_id` when you receive an interaction payload to - * {@link https://docs.slack.dev/interactivity/handling-user-interaction#payloads identify the source of the action}. - * Maximum length for this field is 255 characters. `block_id` should be unique for each message and each iteration of - * a message. If a message is updated, use a new `block_id`. - */ - block_id?: string; -} - -/** - * A helper union type of all known Blocks, as listed out on the - * {@link https://docs.slack.dev/reference/block-kit/blocks Blocks reference}. - */ -export type KnownBlock = - | ActionsBlock - | ContextBlock - | ContextActionsBlock - | DividerBlock - | FileBlock - | HeaderBlock - | ImageBlock - | InputBlock - | MarkdownBlock - | RichTextBlock - | SectionBlock - | TableBlock - | VideoBlock; - -/** - * A helper union type of all known Blocks as well as the generic {@link Block} interface. A full list of known blocks - * is available here: {@link https://docs.slack.dev/reference/block-kit/blocks Blocks reference}. - */ -export type AnyBlock = KnownBlock | Block; - -/** - * A helper union type of all Block Elements that can be used in an {@link ActionsBlock}. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/actions-block Actions block reference}. - */ -export type ActionsBlockElement = - | Button - | Checkboxes - | Datepicker - | DateTimepicker - | MultiSelect - | Overflow - | RadioButtons - | Select - | Timepicker - | WorkflowButton - | RichTextInput; - -/** - * @description Holds multiple interactive elements. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/actions-block Actions block reference}. - */ -export interface ActionsBlock extends Block { - /** - * @description The type of block. For an actions block, `type` is always `actions`. - */ - type: 'actions'; - /** - * @description An array of {@link InteractiveElements} objects. - * There is a maximum of 25 elements in each action block. - */ - elements: ActionsBlockElement[]; // TODO: breaking change: min 1 item -} - -/** - * A helper union type of all Block Elements that can be used in a {@link ContextBlock}. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/context-block Context block reference}. - */ -export type ContextBlockElement = ImageElement | TextObject; - -/** - * @description Displays contextual info, which can include both images and text. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/context-block Context block reference}. - */ -export interface ContextBlock extends Block { - /** - * @description The type of block. For a context block, `type` is always `context`. - */ - type: 'context'; - /** - * @description An array of {@link ImageElement}, {@link PlainTextElement} or {@link MrkdwnElement} objects. - * Maximum number of items is 10. - */ - elements: ContextBlockElement[]; // TODO: breaking change: min 1 item -} - -/** - * A helper union type of all Block Elements that can be used in a {@link ContextActionsBlock}. - */ -export type ContextActionsBlockElement = FeedbackButtons | IconButton; - -/** - * @description Displays actions as contextual info, which can include both feedback buttons and icon buttons. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/context-actions-block Context actions block reference}. - */ -export interface ContextActionsBlock extends Block { - /** - * @description The type of block. For a context actions block, `type` is always `context_actions`. - */ - type: 'context_actions'; - /** - * @description An array of {@link FeedbackButtons} or {@link IconButton} block elements. Maximum number of items is 5. - */ - elements: ContextActionsBlockElement[]; -} - -/** - * @description Visually separates pieces of info inside of a message. A content divider, like an `
`, to split up - * different blocks inside of a message. The divider block is nice and neat, requiring only a `type`. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/divider-block Divider block reference}. - */ -export interface DividerBlock extends Block { - /** - * @description The type of block. For a divider block, `type` is always `divider`. - */ - type: 'divider'; -} - -/** - * @description Displays a {@link https://docs.slack.dev/messaging/working-with-files#remote remote file}. You can't add this block to - * app surfaces directly, but it will show up when {@link https://docs.slack.dev/messaging/retrieving-messages retrieving messages} - * that contain remote files. If you want to add remote files to messages, - * {@link https://docs.slack.dev/messaging/working-with-files#remote follow our guide}. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/file-block File block reference}. - */ -export interface FileBlock extends Block { - /** - * @description The type of block. For a file block, `type` is always `file`. - */ - type: 'file'; - /** - * @description At the moment, source will always be `remote` for a remote file. - */ - source: string; // TODO: breaking change: set this to the string literal 'remote' - /** - * @description The external unique ID for this file. - */ - external_id: string; -} - -/** - * @description Displays a larger-sized text block. A `header` is a plain-text block that displays in a larger, bold - * font. Use it to delineate between different groups of content in your app's surfaces. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/header-block Header block reference}. - */ -export interface HeaderBlock extends Block { - /** - * @description The type of block. For a header block, `type` is always `header`. - */ - type: 'header'; - /** - * @description The text for the block, in the form of a {@link PlainTextElement}. - * Maximum length for the text in this field is 150 characters. - */ - text: PlainTextElement; -} - -/** - * @description Displays an image. A simple image block, designed to make those cat photos really pop. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/image-block Image block reference}. - */ -export type ImageBlock = { - /** - * @description The type of block. For an image block, `type` is always `image`. - */ - type: 'image'; - /** - * @description A plain-text summary of the image. This should not contain any markup. - * Maximum length for this field is 2000 characters. - */ - alt_text: string; - /** - * @description An optional title for the image in the form of a {@link PlainTextElement} object. - * Maximum length for the text in this field is 2000 characters. - */ - title?: PlainTextElement; -} & Block & - (UrlImageObject | SlackFileImageObject); - -/** - * A helper union type of all Block Elements that can be used in an {@link InputBlock}. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/input-block Input block reference}. - */ -export type InputBlockElement = - | Checkboxes - | Datepicker - | DateTimepicker - | EmailInput - | FileInput - | MultiSelect - | NumberInput - | PlainTextInput - | RadioButtons - | RichTextInput - | Select - | Timepicker - | URLInput; - -/** - * @description Collects information from users via block elements. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/input-block Input block reference}. - * @see {@link https://docs.slack.dev/surfaces/modals#gathering_input Collecting input in modals guide}. - * @see {@link https://docs.slack.dev/surfaces/app-home Collecting input in Home tabs guide}. - */ -export interface InputBlock extends Block { - /** - * @description The type of block. For an input block, `type` is always `input`. - */ - type: 'input'; - /** - * @description A label that appears above an input element in the form of a {@link PlainTextElement} object. - * Maximum length for the text in this field is 2000 characters. - */ - label: PlainTextElement; - /** - * @description An optional hint that appears below an input element in a lighter grey. It must be a - * {@link PlainTextElement object}. Maximum length for the `text` in this field is 2000 characters. - */ - hint?: PlainTextElement; - /** - * @description A boolean that indicates whether the input element may be empty when a user submits the modal. - * Defaults to `false`. - */ - optional?: boolean; - /** - * @description A block element. - */ - element: InputBlockElement; - /** - * @description A boolean that indicates whether or not the use of elements in this block should dispatch a - * {@link https://docs.slack.dev/reference/interaction-payloads/block_actions-payload block_actions payload}. Defaults to `false`. - */ - dispatch_action?: boolean; -} - -/** - * @description This block can be used with AI apps when you expect a markdown response from an LLM that can get lost in - * translation rendering in Slack. Providing it in a markdown block leaves the translating to Slack to ensure your message - * appears as intended. Note that passing a single block may result in multiple blocks after translation. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks#markdown Markdown block reference}. - */ -export interface MarkdownBlock extends Block { - /** - * @description The type of block. For a markdown block, `type` is always `markdown`. - */ - type: 'markdown'; - /** - * @description The standard markdown-formatted text. Limit 12,000 characters max. - */ - text: string; -} - -/** - * A helper union type of all Block Elements that can be used in a {@link RichTextBlock}. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block Rich text block reference}. - */ -export type RichTextBlockElement = RichTextSection | RichTextList | RichTextQuote | RichTextPreformatted; - -/** - * @description Displays formatted, structured representation of text. It is also the output of the Slack client's - * WYSIWYG message composer, so all messages sent by end-users will have this format. Use this block to include - * user-defined formatted text in your Block Kit payload. While it is possible to format text with `mrkdwn`, - * `rich_text` is strongly preferred and allows greater flexibility. - * You might encounter a `rich_text` block in a message payload, as a built-in type in workflow apps, or as output of - * the {@link RichTextInput}. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/rich-text-block Rich text block reference}. - */ -export interface RichTextBlock extends Block { - /** - * @description The type of block. For a rich text block, `type` is always `rich_text`. - */ - type: 'rich_text'; - elements: RichTextBlockElement[]; -} - -/** - * A helper union type of all Block Elements that can be used as an accessory in a {@link SectionBlock}. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/section-block Section block reference}. - */ -export type SectionBlockAccessory = - | Button - | Checkboxes - | Datepicker - | ImageElement - | MultiSelect - | Overflow - | RadioButtons - | Select - | Timepicker - | WorkflowButton; - -// TODO: breaking change: use a discriminative union to represent section block using `text` or `fields` but -// not both or neither. -/** - * @description Displays text, possibly alongside block elements. A section can be used as a simple text block, in - * combination with text fields, or side-by-side with certain - * {@link https://docs.slack.dev/reference/block-kit/block-elements block elements}. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/section-block Section block reference}. - */ -export interface SectionBlock extends Block { - /** - * @description The type of block. For a section block, `type` is always `section`. - */ - type: 'section'; - /** - * @description The text for the block, in the form of a {@link TextObject}. Minimum length for the `text` in this - * field is 1 and maximum length is 3000 characters. This field is not required if a valid array of `fields` objects - * is provided instead. - */ - text?: TextObject; - /** - * @description Required if no `text` is provided. An array of text objects. Any text objects included with `fields` - * will be rendered in a compact format that allows for 2 columns of side-by-side text. Maximum number of items is 10. - * Maximum length for the text in each item is 2000 characters. - * {@link https://app.slack.com/block-kit-builder/#%7B%22blocks%22:%5B%7B%22type%22:%22section%22,%22text%22:%7B%22text%22:%22A%20message%20*with%20some%20bold%20text*%20and%20_some%20italicized%20text_.%22,%22type%22:%22mrkdwn%22%7D,%22fields%22:%5B%7B%22type%22:%22mrkdwn%22,%22text%22:%22*Priority*%22%7D,%7B%22type%22:%22mrkdwn%22,%22text%22:%22*Type*%22%7D,%7B%22type%22:%22plain_text%22,%22text%22:%22High%22%7D,%7B%22type%22:%22plain_text%22,%22text%22:%22String%22%7D%5D%7D%5D%7D Click here for an example}. - */ - fields?: TextObject[]; // either this or text must be defined, also min 1 item - /** - * @description One of the compatible element objects. - */ - accessory?: SectionBlockAccessory; - /** - * Whether or not this section block's text should always expand when rendered. If false or not provided, it may be rendered with a 'see more' option to expand and show the full text. For AI Assistant apps, this allows the app to post long messages without users needing to click 'see more' to expand the message. - */ - expand?: boolean; -} - -/** - * @description Displays structured information in a table. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/table-block Table block reference}. - */ -export interface TableBlock extends Block { - /** - * @description The type of block. For a table block, `type` is always `table`. - */ - type: 'table'; - /** - * @description An array consisting of table rows. Maximum 100 rows. Each row object is an array with a max of 20 table cells. Table cells can have a type of raw_text or rich_text. - */ - rows: (RichTextBlock | RawTextElement)[][]; - /** - * @description An array describing column behavior. If there are fewer items in the column_settings array than there are columns in the table, then the items in the the column_settings array will describe the same number of columns in the table as there are in the array itself. Any additional columns will have the default behavior. Maximum 20 items. - */ - column_settings?: TableBlockColumnSettings[]; -} - -/** - * Schema for column_settings of the table block. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/table-block/#schema-for-column_settings}. - */ -interface TableBlockColumnSettings { - /** - * @description The alignment for items in this column. Can be left, center, or right. Defaults to left if not defined. - */ - align?: 'left' | 'center' | 'right'; - /** - * @description Whether the contents of this column should be wrapped or not. Defaults to false if not defined. - */ - is_wrapped?: boolean; -} - -/** - * @description Displays an embedded video player. A video block is designed to embed videos in all app surfaces (e.g. - * link unfurls, messages, modals, App Home) — anywhere you can put blocks! To use the video block within your app, you - * must have the {@link https://docs.slack.dev/reference/scopes/links.embed.write `links.embed:write` scope}. - * @see {@link https://docs.slack.dev/reference/block-kit/blocks/video-block Video block reference}. - */ -export interface VideoBlock extends Block { - /** - * @description The type of block. For a video block, `type` is always `video`. - */ - type: 'video'; - /** - * @description The URL to be embedded. Must match any existing - * {@link https://docs.slack.dev/messaging/unfurling-links-in-messages unfurl domains} within the app - * and point to a HTTPS URL. - */ - video_url: string; - /** - * @description The thumbnail image URL. - */ - thumbnail_url: string; - /** - * @description A tooltip for the video. Required for accessibility. - */ - alt_text: string; - /** - * @description Video title as a {@link PlainTextElement} object. `text` within must be less than 200 characters. - */ - title: PlainTextElement; - /** - * @description Hyperlink for the title text. Must correspond to the non-embeddable URL for the video. - * Must go to an HTTPS URL. - */ - title_url?: string; - /** - * @description Author name to be displayed. Must be less than 50 characters. - */ - author_name?: string; - /** - * @description The originating application or domain of the video, e.g. YouTube. - */ - provider_name?: string; - /** - * @description Icon for the video provider, e.g. YouTube icon. - */ - provider_icon_url?: string; - /** - * @description Description for video using a {@link PlainTextElement} object. - */ - description?: PlainTextElement; -} diff --git a/tmp-docs/composition-objects.ts b/tmp-docs/composition-objects.ts deleted file mode 100644 index 88683034..00000000 --- a/tmp-docs/composition-objects.ts +++ /dev/null @@ -1,259 +0,0 @@ -// This file contains objects documented here: https://docs.slack.dev/reference/block-kit/composition-objects - -/** - * Re-usable labels for common color schemes present in Slack. `danger` displays with a red background (red text on - * mobile), while `primary` displays with a green background (green text on mobile). - */ -export type ColorScheme = 'primary' | 'danger'; - -/** The conversation type as available within the Slack UI. */ -export type ConversationType = 'im' | 'mpim' | 'private' | 'public'; - -// TODO: breaking change: remove `Confirm` and move properties to `ConfirmationDialog` below on next major release. -/** - * @deprecated {@link Confirm} aliased to {@link ConfirmationDialog} in order to make the construct clearer - * and line up terminology with docs.slack.dev. - * @description Defines a dialog that adds a confirmation step to interactive elements. - * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/confirmation-dialog-object Confirmation dialog object reference}. - */ -export interface Confirm { - /** - * @description A {@link PlainTextElement} text object that defines the dialog's title. - * Maximum length for this field is 100 characters. - */ - title?: PlainTextElement; // TODO: breaking change, title is required according to https://docs.slack.dev/reference/block-kit/composition-objects/confirmation-dialog-object - /** - * @description A {@link PlainTextElement} text object that defines the explanatory text that appears in the confirm - * dialog. Maximum length for the `text` in this field is 300 characters. - */ - text: PlainTextElement | MrkdwnElement; // TODO: breaking change: this should not be a mrkdwnelement - /** - * @description A {@link PlainTextElement} text object to define the text of the button that confirms the action. - * Maximum length for the `text` in this field is 30 characters. - */ - confirm?: PlainTextElement; // TODO: breaking change, confirm is required according to https://docs.slack.dev/reference/block-kit/composition-objects/confirmation-dialog-object - /** - * @description A {@link PlainTextElement} text object to define the text of the button that cancels the action. - * Maximum length for the `text` in this field is 30 characters. - */ - deny?: PlainTextElement; // TODO: breaking change, deny is required according to https://docs.slack.dev/reference/block-kit/composition-objects/confirmation-dialog-object - /** - * @description Defines the color scheme applied to the `confirm` button. A value of `danger` will display the button - * with a red background on desktop, or red text on mobile. A value of `primary` will display the button with a green - * background on desktop, or blue text on mobile. If this field is not provided, the default value will be `primary`. - */ - style?: ColorScheme; -} - -/** - * @description Defines a dialog that adds a confirmation step to interactive elements. - * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/confirmation-dialog-object Confirmation dialog object reference}. - */ -export interface ConfirmationDialog extends Confirm {} - -/** - * @description Defines when a {@link PlainTextElement} will return a {@link https://docs.slack.dev/reference/interaction-payloads/block_actions-payload `block_actions` interaction payload}. - * @see {@link https://docs.slack.dev/reference/interaction-payloads/block_actions-payload `block_actions` interaction payload}. - */ -export interface DispatchActionConfig { - /** - * @description An array of interaction types that you would like to receive a - * {@link https://docs.slack.dev/reference/interaction-payloads/block_actions-payload `block_actions` payload} for. Should be - * one or both of: - * `on_enter_pressed` — payload is dispatched when user presses the enter key while the input is in focus. Hint - * text will appear underneath the input explaining to the user to press enter to submit. - * `on_character_entered` — payload is dispatched when a character is entered (or removed) in the input. - */ - trigger_actions_on?: ('on_enter_pressed' | 'on_character_entered')[]; -} - -interface OptionDescriptor { - /** - * @description A unique string value that will be passed to your app when this option is chosen. - * Maximum length for this field is 75 characters. - */ - value?: string; // TODO: breaking change - value is required according to https://docs.slack.dev/reference/block-kit/composition-objects/option-object - /** - * @description Only available in overflow menus! A URL to load in the user's browser when the option is clicked. - * Maximum length for this field is 3000 characters. - */ - url?: string; - /** - * @description A {@link PlainTextElement} that defines a line of descriptive text shown below the `text` field. - * Maximum length for the `text` within this field is 75 characters. - */ - description?: PlainTextElement; -} - -export interface MrkdwnOption extends OptionDescriptor { - /** - * @description A {@link MrkdwnElement} that defines the text shown in the option on the menu. To be used with - * radio buttons and checkboxes. Maximum length for the `text` in this field is 75 characters. - */ - text: MrkdwnElement; -} - -export interface PlainTextOption extends OptionDescriptor { - /** - * @description A {@link PlainTextElement} that defines the text shown in the option on the menu. To be used with - * overflow, select and multi-select menus. Maximum length for the `text` in this field is 75 characters. - */ - text: PlainTextElement; -} - -/** - * @description Defines a single item in a number of item selection elements. An object that represents a single - * selectable item in a select menu, multi-select menu, checkbox group, radio button group, or overflow menu. - * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/option-object Option object reference}. - */ -export type Option = MrkdwnOption | PlainTextOption; - -/** - * @description Defines a way to group options in a select or multi-select menu. - * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/option-group-object Option group object reference}. - */ -export interface OptionGroup { - /** - * @description A {@link PlainTextElement} text object that defines the label shown above this group of options. - * Maximum length for the `text` in this field is 75 characters. - */ - label: PlainTextElement; - /** - * @description An array of {@link Option} that belong to this specific group. Maximum of 100 items. - */ - options: Option[]; -} - -/** - * @description Defines an object containing some text. Can be either a {@link PlainTextElement} or a - * {@link MrkdwnElement}. - * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}. - */ -export type TextObject = PlainTextElement | MrkdwnElement; - -/** - * @description Defines an object containing some text. - * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}. - */ -export interface PlainTextElement { - /** - * @description The formatting to use for this text object. - */ - type: 'plain_text'; - /** - * @description The text for the block. The minimum length is 1 and maximum length is 3000 characters. - */ - text: string; - /** - * @description Indicates whether emojis in a text field should be escaped into the colon emoji format. - */ - emoji?: boolean; -} - -/** - * @description Defines an object containing some text. - * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}. - */ -export interface MrkdwnElement { - /** - * @description The formatting to use for this text object. - */ - type: 'mrkdwn'; - /** - * @description The text for the block. This field accepts any of the standard text formatting markup. - * The minimum length is 1 and maximum length is 3000 characters. - */ - text: string; - /** - * @description When set to `false` (as is default) URLs will be auto-converted into links, conversation names will - * be link-ified, and certain mentions will be {@link https://docs.slack.dev/messaging/formatting-message-text automatically parsed}. - * Using a value of `true` will skip any preprocessing of this nature, although you can still include - * {@link https://docs.slack.dev/messaging/formatting-message-text manual parsing strings}. - */ - verbatim?: boolean; -} - -/** - * @description Defines an object containing some text. - * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}. - */ -export interface RawTextElement { - /** - * @description The formatting to use for this text object. - */ - type: 'raw_text'; - /** - * @description The text for the block. The minimum length is 1 character. - */ - text: string; -} - -interface BaseConversationFilter { - /** - * @description Indicates which type of conversations should be included in the list. When this field is provided, any - * conversations that do not match will be excluded. You should provide an array of strings from the following options: - * `im`, `mpim`, `private`, and `public`. The array cannot be empty. - */ - include?: [ConversationType, ...ConversationType[]]; - /** - * @description Indicates whether to exclude external {@link https://docs.slack.dev/apis/slack-connect shared channels} - * from conversation lists. This field will not exclude users from shared channels. Defaults to `false`. - */ - exclude_external_shared_channels?: boolean; - /** - * @description Indicates whether to exclude bot users from conversation lists. Defaults to `false`. - */ - exclude_bot_users?: boolean; -} - -/** - * @description Defines a filter for the list of options in a conversation selector menu. The menu can be either a - * conversations select menu or a conversations multi-select menu. - * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/conversation-filter-object Conversation filter object reference}. - */ -export type ConversationFilter = - | (BaseConversationFilter & Required>) - | (BaseConversationFilter & Required>) - | (BaseConversationFilter & Required>); -/** - * @description Object for image which contains a image_url. - */ -export interface UrlImageObject { - /** - * @description The URL of the image to be displayed. - */ - image_url: string; -} - -/** - * @description Object for image which contains a slack_file. - */ -export interface SlackFileImageObject { - /** - * @description The slack file of the image to be displayed. - */ - slack_file: SlackFile; -} - -interface SlackFileViaUrl { - /** - * @description This URL can be the `url_private` or the `permalink` of the {@link Slack file https://docs.slack.dev/reference/objects/file-object}. - */ - url: string; -} - -interface SlackFileViaId { - /** - * @description `id` of the {@link Slack file https://docs.slack.dev/reference/objects/file-objecte}. - */ - id: string; -} - -/** - * @description Defines an object containing Slack file information to be used in an image block or image element. - * This {@link file https://docs.slack.dev/reference/objects/file-object} must be an image and you must provide either the URL or ID. In addition, - * the user posting these blocks must have access to this file. If both are provided then the payload will be rejected. - * Currently only `png`, `jpg`, `jpeg`, and `gif` Slack image files are supported. - * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/slack-file-object Slack File object reference}. - */ -export type SlackFile = SlackFileViaUrl | SlackFileViaId; diff --git a/tmp-docs/extensions.ts b/tmp-docs/extensions.ts deleted file mode 100644 index a0b524f1..00000000 --- a/tmp-docs/extensions.ts +++ /dev/null @@ -1,98 +0,0 @@ -// This file contains reusable extensions/mixins that other Block Kit elements will extend from. -import type { ConfirmationDialog, DispatchActionConfig, PlainTextElement } from './composition-objects'; - -// TODO: breaking change: remove `Action` and move properties to `Actionable` on next major release. -/** - * @deprecated {@link Action} aliased to {@link Actionable} in order to name the mixins in this file consistently. - */ -export interface Action { - type: string; - /** - * @description: An identifier for this action. You can use this when you receive an interaction payload to - * {@link https://docs.slack.dev/interactivity/handling-user-interaction#payloads identify the source of the action}. Should be unique - * among all other `action_id`s in the containing block. Maximum length for this field is 255 characters. - */ - action_id?: string; -} - -export interface Actionable extends Action {} - -export interface Confirmable { - /** - * @description A {@link Confirm} object that defines an optional confirmation dialog after the element is interacted - * with. - */ - confirm?: ConfirmationDialog; -} - -export interface Dispatchable { - /** - * @description A {@link DispatchActionConfig} object that determines when during text input the element returns a - * {@link https://docs.slack.dev/reference/interaction-payloads/block_actions-payload `block_actions` payload}. - */ - dispatch_action_config?: DispatchActionConfig; -} - -export interface Focusable { - /** - * @description Indicates whether the element will be set to auto focus within the - * {@link https://docs.slack.dev/surfaces/modals `view` object}. Only one element can be set to `true`. - * Defaults to `false`. - */ - focus_on_load?: boolean; -} - -export interface MaxItemsSelectable { - /** - * @description Specifies the maximum number of items that can be selected. Minimum number is 1. - */ - max_selected_items?: number; -} - -export interface Placeholdable { - /** - * @description A {@link PlainTextElement} object that defines the placeholder text shown on the element. Maximum - * length for the `text` field in this object is 150 characters. - */ - placeholder?: PlainTextElement; -} - -export interface URLRespondable { - /** - * @description When set to `true`, the {@link https://docs.slack.dev/reference/interaction-payloads/view-interactions-payload#view_submission `view_submission` payload} - * from the menu's parent view will contain a `response_url`. This `response_url` can be used for - * {@link https://docs.slack.dev/interactivity/handling-user-interaction#message_responses message responses}. The target conversation - * for the message will be determined by the value of this select menu. - */ - response_url_enabled?: boolean; -} - -/** For use in setting border style details on certain Rich Text elements. */ -export interface RichTextBorderable { - /** - * @description Whether to render a quote-block-like border on the inline side of the list. `0` renders no border - * while `1` renders a border. - */ - border?: 0 | 1; -} - -/** - * @description For use styling Rich Text sub-elements. - */ -export interface RichTextStyleable { - /** - * @description A limited style object for styling rich text `text` elements. - */ - style?: { - /** @description When `true`, boldens the text in this element. Defaults to `false`. */ - bold?: boolean; - /** @description When `true`, the text is preformatted in an inline code style. Defaults to `false. */ - code?: boolean; - /** @description When `true`, italicizes the text in this element. Defaults to `false`. */ - italic?: boolean; - /** @description When `true`, strikes through the text in this element. Defaults to `false`. */ - strike?: boolean; - /** @description When `true`, underlines the text in this element. Defaults to `false`. */ - underline?: boolean; - }; -} From d4d0164d36e5bf3ff844d34171107f667406efe0 Mon Sep 17 00:00:00 2001 From: allx Date: Sat, 6 Dec 2025 00:37:11 +0200 Subject: [PATCH 4/5] Corrected workflow step documentation link. --- src/surfaces/workflow-step.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/surfaces/workflow-step.ts b/src/surfaces/workflow-step.ts index 2d0e8abe..68e8a9c0 100644 --- a/src/surfaces/workflow-step.ts +++ b/src/surfaces/workflow-step.ts @@ -34,7 +34,7 @@ export interface WorkflowStepBuilder extends Blocks, } /** - * @@link https://docs.slack.dev/workflows/steps + * @@link https://docs.slack.dev/workflows/workflow-steps * @@displayName Workflow Step */ From 9834effef89a56720f49c0ad731a7d4fe6bee10b Mon Sep 17 00:00:00 2001 From: allx Date: Sat, 6 Dec 2025 13:57:27 +0200 Subject: [PATCH 5/5] feat: Introduce Table block with rich text cell support, update rich text element properties, and add related validations. --- .gitignore | 1 + README.md | 16 ++++++- docs/blocks/rich-text.md | 4 +- docs/blocks/table.md | 9 +++- src/bits/rich-text-channel.ts | 2 +- src/bits/rich-text-team.ts | 2 +- src/bits/rich-text-user.ts | 2 +- src/bits/rich-text-usergroup.ts | 2 +- src/blocks/section.ts | 8 +++- src/blocks/table.ts | 62 +++++++++++++++++++++++++-- src/internal/dto/slack-dto.ts | 14 ++++++ src/internal/helpers/build-helpers.ts | 8 ++++ tests/surfaces/surface.spec.ts | 2 +- 13 files changed, 119 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 29f51247..0fef67c9 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ coverage/ package-lock.json dist/ docs-generator-dist/ +tmp/ \ No newline at end of file diff --git a/README.md b/README.md index 9a9fc227..f6867dcb 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ import { Modal, Section, bold, link } from 'slack-block-builder'; `Elements` – UI elements that are used to capture user interaction. -`Bits` – These are composition objects and other bits and pieces from Slack's docs. Included are `Attachment`, `Options`, `OptionGroup`, and `ConfirmationDialog`. They felt like they were deserving of their own category. +`Bits` – These are composition objects and other bits and pieces from Slack's docs. Included are `Attachment`, `Options`, `OptionGroup`, `ConfirmationDialog` and a list of rich text objects. They felt like they were deserving of their own category. `Utilities` – A group of utility functions. See [Utility Functions](#utility-functions). @@ -185,6 +185,18 @@ Below is a list of supported objects and how to access them in **Block Builder** | Rich Text Team | Composition Object | :white_check_mark: | `Bits.RichTextTeam()` | Attachment | Legacy Feature | :white_check_mark: | `Bits.Attachment()` +### Rich Text Block + +The `Rich Text` block is used to display formatted, structured representation of text. It is also the output of the Slack client's WYSIWYG message composer, so all messages sent by end-users will have this format. + +Use this block to include user-defined formatted text in your Block Kit payload. While it is possible to format text with `mrkdwn`, `rich_text` is preferred and allows greater flexibility. + +You might encounter a `rich_text` block in a message payload, as a built-in type in apps created with the Deno Slack SDK, or as output of the `RichTextInput` block element. + +Rich text blocks can be deeply nested. For instance: a `RichTextList` can contain a `RichTextSection` which can contain bold style text. + +?> **Note:** When using `RichText` within a `Table` block, you are restricted to using `RichTextSection`. Other top-level elements like `RichTextList`, `RichTextQuote`, and `RichTextPreformatted` are not supported in table cells. + ### Creating a Simple Interactive Message Let's take a look at how to compose an interactive message. Even though [Slack](https://slack.com) now has modals, these have always been the basis for [Slack](https://slack.com) apps. @@ -420,7 +432,7 @@ const unfurl = ({ channel, ts, url }) => client.chat.unfurl({ .catch((error) => console.log(error)); ``` -Both `OptionCollection()` and `OptionGroupCollection()` come in handy when returning an array of options or option groups for select menus with external data sources, as seen in [Slack's API docs](https://docs.slack.dev/reference/block-kit/block-elements#external_multi_select): +Both `OptionCollection()` and `OptionGroupCollection()` come in handy when returning an array of options or option groups for select menus with external data sources, as seen in [Slack's API docs](https://api.slack.com/reference/block-kit/block-elements#external_multi_select): ```javascript return { options: OptionCollection( /* Pass in options */ ) }; diff --git a/docs/blocks/rich-text.md b/docs/blocks/rich-text.md index 04599910..b00a9a52 100644 --- a/docs/blocks/rich-text.md +++ b/docs/blocks/rich-text.md @@ -36,7 +36,7 @@ All setter methods return `this`, the instance of `RichTextBuilder` on which it RichTextBuilder.blockId(string); ``` -Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process. +Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and v iew submissions for your app to process. ```javascript RichTextBuilder.elements(...elements); @@ -44,6 +44,8 @@ RichTextBuilder.elements(...elements); Adds rich text elements to the block. Accepts `RichTextSection`, `RichTextList`, `RichTextQuote`, and `RichTextPreformatted` builders. +!> **Warning:** When using `RichText` elements inside a `Table` block, only `RichTextSection` is supported. `RichTextList`, `RichTextQuote`, and `RichTextPreformatted` cannot be used in table cells. + ### Example Usage ```javascript diff --git a/docs/blocks/table.md b/docs/blocks/table.md index e84988b0..fbcb3302 100644 --- a/docs/blocks/table.md +++ b/docs/blocks/table.md @@ -42,7 +42,14 @@ Sets a string to be an identifier for any given block in a view or message. This TableBuilder.rows(array); ``` -Sets the table rows. Each row is an array of cells containing rich_text or raw_text objects. +TableBuilder.rows(array); +``` + +Sets the table rows. Each row is an array of cells containing `rich_text` or raw text objects. + +?> **Note:** To simplify usage, you can pass plain strings or simple text objects (e.g., `{ type: 'text', text: '...' }`) and **Block Builder** will automatically wrap them in the required `RichText` -> `RichTextSection` -> `RichTextText` structure. + +!> **Warning:** Table cells only support `RichTextSection`. You cannot use `RichTextList`, `RichTextQuote`, or `RichTextPreformatted` inside a table cell. The builder will throw an error if you attempt to do so. ```javascript TableBuilder.columnSettings(array); diff --git a/src/bits/rich-text-channel.ts b/src/bits/rich-text-channel.ts index 741b46d0..172a993a 100644 --- a/src/bits/rich-text-channel.ts +++ b/src/bits/rich-text-channel.ts @@ -46,7 +46,7 @@ export class RichTextChannelBuilder extends BitBuilderBase { public build(): Readonly { const result: Record = { type: RichTextElementType.Channel, - channel_id: this.props.channelId, + channelId: this.props.channelId, }; if (this.props.style && Object.keys(this.props.style).length > 0) { diff --git a/src/bits/rich-text-team.ts b/src/bits/rich-text-team.ts index 5a8feb77..2289fe8a 100644 --- a/src/bits/rich-text-team.ts +++ b/src/bits/rich-text-team.ts @@ -68,7 +68,7 @@ export class RichTextTeamBuilder extends BitBuilderBase { public build(): Readonly { const result: Record = { type: RichTextElementType.Team, - team_id: this.props.teamId, + teamId: this.props.teamId, }; if (this.props.style && Object.keys(this.props.style).length > 0) { diff --git a/src/bits/rich-text-user.ts b/src/bits/rich-text-user.ts index baa6cbd5..0a0480fe 100644 --- a/src/bits/rich-text-user.ts +++ b/src/bits/rich-text-user.ts @@ -46,7 +46,7 @@ export class RichTextUserBuilder extends BitBuilderBase { public build(): Readonly { const result: Record = { type: RichTextElementType.User, - user_id: this.props.userId, + userId: this.props.userId, }; if (this.props.style && Object.keys(this.props.style).length > 0) { diff --git a/src/bits/rich-text-usergroup.ts b/src/bits/rich-text-usergroup.ts index fd740c44..dcb69875 100644 --- a/src/bits/rich-text-usergroup.ts +++ b/src/bits/rich-text-usergroup.ts @@ -46,7 +46,7 @@ export class RichTextUsergroupBuilder extends BitBuilderBase { public build(): Readonly { const result: Record = { type: RichTextElementType.Usergroup, - usergroup_id: this.props.usergroupId, + usergroupId: this.props.usergroupId, }; if (this.props.style && Object.keys(this.props.style).length > 0) { diff --git a/src/blocks/section.ts b/src/blocks/section.ts index 8b158ddc..33f809de 100644 --- a/src/blocks/section.ts +++ b/src/blocks/section.ts @@ -38,11 +38,17 @@ export class SectionBuilder extends BlockBuilderBase { /** @internal */ public build(): Readonly { + const accessory = getBuilderResult(this.props.accessory); + + if (accessory && (accessory as any).type === BlockType.RichText) { + throw new Error('Accessory cannot be a Rich Text block. Rich Text blocks are not supported in Section blocks.'); + } + return this.getResult(SlackBlockDto, { type: BlockType.Section, text: getMarkdownObject(this.props.text), fields: getFields(this.props.fields), - accessory: getBuilderResult(this.props.accessory), + accessory, }); } } diff --git a/src/blocks/table.ts b/src/blocks/table.ts index a15183b2..7a1eeb5a 100644 --- a/src/blocks/table.ts +++ b/src/blocks/table.ts @@ -1,11 +1,14 @@ import { BlockBuilderBase } from '../internal/base'; -import { BlockType } from '../internal/constants'; +import { BlockType, RichTextElementType } from '../internal/constants'; import { SlackBlockDto } from '../internal/dto'; import { applyMixins } from '../internal/helpers'; import { BlockId, End, } from '../internal/methods'; +import { RichTextBuilder } from './rich-text'; +import { RichTextSectionBuilder } from '../bits/rich-text-section'; +import { RichTextTextBuilder } from '../bits/rich-text-text'; interface ColumnSettings { align?: 'left' | 'center' | 'right'; @@ -35,7 +38,60 @@ export class TableBuilder extends BlockBuilderBase { * @param {unknown[][]} rows - Array of rows, each containing cell objects. */ public rows(rows: unknown[][]): this { - this.props.rows = rows; + this.props.rows = rows.map((row) => row.map((cell) => { + let cellResult = cell; + + if (typeof cell === 'string') { + cellResult = new RichTextBuilder() + .elements( + new RichTextSectionBuilder() + .elements( + new RichTextTextBuilder({ text: cell }), + ), + ) + .build(); + } else { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const cellObj = cell as any; + + if (cellObj.type === 'text' && typeof cellObj.text === 'string' && !cellObj.style) { + cellResult = new RichTextBuilder() + .elements( + new RichTextSectionBuilder() + .elements( + new RichTextTextBuilder({ text: cellObj.text }), + ), + ) + .build(); + } else if (typeof cellObj.build === 'function') { + cellResult = cellObj.build(); + } + } + + // Validate cell content + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const cellAny = cellResult as any; + + if (cellAny.type !== BlockType.RichText) { + throw new Error(`Table cells must be of type '${BlockType.RichText}', but found '${cellAny.type}'. Verify that you are passing a RichText block or a string to the table rows.`); + } + + if (cellAny?.elements && Array.isArray(cellAny.elements)) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + cellAny.elements.forEach((element: any) => { + if ([ + RichTextElementType.List, + RichTextElementType.Quote, + RichTextElementType.Preformatted, + ].includes(element.type)) { + throw new Error(`Table cells cannot contain ${element.type}. Only rich_text_section is supported.`); + } + }); + } + + return cellResult; + })); + return this; } @@ -52,7 +108,7 @@ export class TableBuilder extends BlockBuilderBase { return this.getResult(SlackBlockDto, { type: BlockType.Table, rows: this.props.rows, - column_settings: this.props.columnSettings, + columnSettings: this.props.columnSettings, }); } } diff --git a/src/internal/dto/slack-dto.ts b/src/internal/dto/slack-dto.ts index 6595fe15..ca3c7e26 100644 --- a/src/internal/dto/slack-dto.ts +++ b/src/internal/dto/slack-dto.ts @@ -88,6 +88,20 @@ export enum Param { maxFiles = 'max_files', filetypes = 'filetypes', source = 'source', + rows = 'rows', + columnSettings = 'column_settings', + border = 'border', + indent = 'indent', + name = 'name', + unicode = 'unicode', + unsafe = 'unsafe', + format = 'format', + range = 'range', + teamId = 'team_id', + userId = 'user_id', + usergroupId = 'usergroup_id', + channelId = 'channel_id', + timestamp = 'timestamp', } export class SlackDto implements ObjectLiteral { diff --git a/src/internal/helpers/build-helpers.ts b/src/internal/helpers/build-helpers.ts index 28039e6f..47cbf5e7 100644 --- a/src/internal/helpers/build-helpers.ts +++ b/src/internal/helpers/build-helpers.ts @@ -40,6 +40,10 @@ export function getBuilderResults( } export function getPlainTextObject(text: string): Undefinable { + if (text !== undefined && typeof text !== 'string') { + throw new Error(`Text must be a string, but found ${typeof text}. If you are trying to pass a Rich Text block, please note that it is not supported in this field.`); + } + return valueOrUndefined(text) ? new PlainTextObject(text) : undefined; } @@ -48,6 +52,10 @@ export function getStringFromNumber(value: number): Undefinable { } export function getMarkdownObject(text: string): Undefinable { + if (text !== undefined && typeof text !== 'string') { + throw new Error(`Text must be a string, but found ${typeof text}. If you are trying to pass a Rich Text block, please note that it is not supported in this field.`); + } + return valueOrUndefined(text) ? new MarkdownObject(text) : undefined; } diff --git a/tests/surfaces/surface.spec.ts b/tests/surfaces/surface.spec.ts index 184ef22c..7b72c3bf 100644 --- a/tests/surfaces/surface.spec.ts +++ b/tests/surfaces/surface.spec.ts @@ -91,7 +91,7 @@ describe('Surfaces', () => { ]); const attachments = message.getAttachments(); - expect(attachments).toEqual(expect.arrayContaining(message.build().attachments)); + expect(attachments).toEqual(expect.arrayContaining(message.build().attachments!)); }); test('Calling \'getBlocks()\' for Modal should return an array of Blocks.', () => {