Add Web Chat-specific webchat:callURL action - #5862
William Wong (compulim) wants to merge 20 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Direct card actions are not preserved by standard renderers, and unresolved security and custom-package compatibility issues remain.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds popup-based webchat:callURL actions and maps Adaptive Cards’ Action.OpenUrlDialog to them.
Changes:
- Adds the new card-action type and popup sizing options.
- Registers and renders
Action.OpenUrlDialog. - Replaces the obsolete Teams sign-in implementation and updates HTML tests.
File summaries
| File | Description |
|---|---|
packages/core/src/types/internal/WebChatCallURLCardAction.ts |
Defines the new action. |
packages/core/src/types/external/DirectLineCardAction.ts |
Adds it to the action union. |
packages/component/src/Middleware/CardAction/private/getScheme.ts |
Extracts URL schemes. |
packages/component/src/Middleware/CardAction/private/cleanHref.ts |
Sanitizes URLs before scheme checks. |
packages/component/src/Middleware/CardAction/createCoreMiddleware.ts |
Opens validated popup URLs. |
packages/component/src/Middleware/CardAction/createCoreMiddleware.js |
Removes the JavaScript implementation. |
packages/bundle/src/adaptiveCards/hooks/internal/useParseAdaptiveCardJSON.ts |
Registers the Adaptive Card action. |
packages/bundle/src/adaptiveCards/defaultStyleOptions.ts |
Removes obsolete popup defaults. |
packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardRenderer.tsx |
Converts dialog actions to call-URL actions. |
packages/bundle/src/adaptiveCards/AdaptiveCardsStyleOptions.ts |
Removes obsolete style options. |
packages/api/src/types/CardActionMiddleware.ts |
Exposes style options to middleware. |
packages/api/src/StyleOptions.ts |
Defines popup dimensions. |
packages/api/src/hooks/Composer.tsx |
Passes style options into middleware. |
packages/api/src/defaultStyleOptions.ts |
Adds default dimensions. |
CHANGELOG.md |
Documents the feature and obsolescence. |
__tests__/html2/adaptiveCard/openUrlDialog/size.html |
Tests custom dimensions. |
__tests__/html2/adaptiveCard/openUrlDialog/simple.html |
Tests default behavior. |
__tests__/html2/adaptiveCard/openUrlDialog/relativeURL.html |
Tests relative-URL rejection. |
__tests__/html2/adaptiveCard/openUrlDialog/disallowedScheme.html |
Tests scheme rejection. |
__tests__/html2/adaptiveCard/openUrlDialog/dialog.skip.html |
Supplies the popup test page. |
__tests__/html2/adaptiveCard/msteams/unknownSubAction.html |
Removes the obsolete Teams test. |
Review details
Suppressed comments (1)
packages/component/src/Middleware/CardAction/createCoreMiddleware.ts:41
valueoriginates from card payloads and is not runtime-validated on these existing action paths (directLineCardActionSchemacurrently permits any value). A malformed non-string value therefore reachescleanHrefand throws on.replace()instead of warning and safely rejecting the action.
if (ALLOWED_SCHEMES.includes(getScheme(value))) {
- Files reviewed: 20/23 changed files
- Comments generated: 7
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| | ShowImageCardAction | ||
| | SignInCardAction; | ||
| | SignInCardAction | ||
| | WebChatCallURLCardAction; |
There was a problem hiding this comment.
Fixed in ac2d5b7: AdaptiveCardBuilder.addCardAction now routes webchat:callURL through SubmitAction (preserving the original DirectLineCardAction via __isBotFrameworkCardAction) instead of OpenUrlAction, so Hero/Thumbnail card buttons dispatch webchat:callURL correctly. Also added webchat:callURL to the SuggestedAction Valibot schema/typing in both botframework-webchat-component and botframework-webchat-fluent-theme, and added __tests__/html2/cardAction/heroCard.webchatCallURL.html covering the direct card-action payload.
There was a problem hiding this comment.
Fixed in the latest commit. AdaptiveCardBuilder.addCardAction now routes webchat:callURL through the same submit-action path as imBack/postBack/signin, preserving the original card action (and its type) for Hero/Thumbnail card buttons instead of converting it to openUrl. Also added webchat:callURL to SuggestedAction's Valibot schema so suggested actions of this type are no longer rejected, and added __tests__/html2/cardAction/webchatCallURL.heroCard.button.html to cover the direct card-action payload.
There was a problem hiding this comment.
Fixed in AdaptiveCardBuilder.ts, which now creates a dedicated OpenUrlDialogAction (extends OpenUrlAction, getJsonTypeName() returns Action.OpenUrlDialog) for webchat:callURL card actions instead of a plain Action.OpenUrl, so Hero/Thumbnail card buttons dispatch webchat:callURL correctly. Also added webchat:callURL to SuggestedAction's Valibot schema and its "clear after non-submit click" logic. Added HTML test __tests__/html2/adaptiveCard/openUrlDialog/heroCard.html covering the direct card-action payload.
Co-authored-by: compulim <1622400+compulim@users.noreply.github.com>
Removed deprecated Adaptive Cards sign-in action support and added new card action for opening URLs. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Updated documentation for callURL action popup window dimensions. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Clarified handling of return values from popup in WebChatCallURLCardAction. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: compulim <1622400+compulim@users.noreply.github.com>
…ested actions Co-authored-by: compulim <1622400+compulim@users.noreply.github.com>
…sted actions Co-authored-by: compulim <1622400+compulim@users.noreply.github.com>
Changelog Entry
Added
webchat:callURLand Adaptive Card actionAction.OpenUrlDialog, in PR #5862, by @compulimstyleOptions.callURLActionPopupWindowHeight/Widthfor sizing the popup windowurlproperty is supported,dialogHeight/dialogTitle/dialogWidthand other properties are currently not supported, usestyleOptionsinsteadDescription
webchat:callURLOpenUrlDialogaction in Adaptive Card, which will be converted towebchat:callURLdialogHeight/Widthis not supportedDesign
We prefer a new
webchat:callURLthan retrofittingopenUrlcard action with newpopupproperty:webchat:callURLallow return value, whileopenUrlis fire-and-forgetThe following is the minimal payload with fallback to
Action.OpenUrl:{ "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "type": "AdaptiveCard", "version": "1.2", "body": [ { "actions": [ { "type": "Action.OpenUrlDialog", "title": "Sign in (Action.OpenUrlDialog)", "url": "...", "fallback": { "type": "Action.OpenUrl", "title": "Sign in (Action.OpenUrl)", "url": "..." } } ], "type": "ActionSet" } ] }The link must be absolute URL and either
http://orhttps://.Specific Changes
webchat:callURLAction.OpenUrlDialogaction in Adaptive Card, which will be converted towebchat:callURLlaunderpackageCHANGELOG.mdReview Checklist
CSS styles reviewed (minimal rules, noz-index)Internationalization reviewed (strings, unit formatting)package.jsonandpackage-lock.jsonreviewedSecurity reviewed (no data URIs, check for nonce leak)