feat(blocks): add Card, Carousel, and Alert block types#1865
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1865 +/- ##
==========================================
+ Coverage 84.00% 84.09% +0.08%
==========================================
Files 117 117
Lines 13257 13325 +68
==========================================
+ Hits 11137 11205 +68
Misses 2120 2120 ☔ View full report in Codecov by Sentry. |
|
@srtaalej Might I request an example snippet using the |
ah yes ofc! |
zimeg
left a comment
There was a problem hiding this comment.
@srtaalej LGTM! Thanks for adding the example code! Those imports make a big difference in testing 🎁 ✨
I'm approving now with a few notes but nothing too important:
- Let's alphabeticize these new additions if ordering allows!
- Our inline docs become more different from the API reference in some of these descriptions
The second point might require wider changes across blocks but I'm wanting to know if we're aligned with docs for some of these block shapes? 🪬
| return self.body is None or self.body.text is None or len(self.body.text) <= self.body_max_length | ||
|
|
||
|
|
||
| class AlertBlock(Block): |
There was a problem hiding this comment.
⏰ suggestion: If dependencies aren't required this order, can we use applied alphabetics on these blocks?
| hero_image: Optional[Union[dict, ImageElement]] = None, | ||
| icon: Optional[Union[dict, ImageElement]] = None, |
There was a problem hiding this comment.
🔭 question: I notice the current docs suggest string but we're finding the image block is expected? I'm curious if the docs team has seen these differences with this changeset?
| def __init__( | ||
| self, | ||
| *, | ||
| elements: Sequence[Union[dict, "CardBlock"]], |
There was a problem hiding this comment.
| elements: Sequence[Union[dict, "CardBlock"]], | |
| elements: Sequence[Union[dict, CardBlock]], |
👾 question(non-blocking): Does the stringified class avoid formatting issue or can we reference this direct?
|
🔮 note: The release milestone |
Co-authored-by: Eden Zimbelman <eden.zimbelman@salesforce.com>
…fix card field types
Summary
CardBlock— a rich display block for presenting structured content (hero image, icon, title, subtitle, body, actions)CarouselBlock— a horizontally scrollable collection of card blocks (1–10 cards)AlertBlock— a prominent notice block for warnings, status updates, or important information with severity levels (default, info, warning, error, success)All three blocks include deserialization support via
Block.parse(), exports in__init__.py, and round-trip tests.Test plan
Test app.py (sends carousel + cards via chat_postMessage on startup)
Test shortcut handler (opens modal with alert blocks via global shortcut)
Block.parse()deserialization testsCardBlockto SlackCarouselBlockto SlackAlertBlockin Slack (alert blocks are only supported in modal views)🤖 Generated with Claude Code