Skip to content

Commit 12523ec

Browse files
author
Corina
authored
Expand CardActions with specific types (#141)
* Expand CardActions with specific types * Update CHANGELOG.md
1 parent d07436f commit 12523ec

3 files changed

Lines changed: 93 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1616
## [Unreleased]
1717

1818
- Added `messageBack` to `CardActionTypes` and updated `CardAction` fields, by [@corinagum](https://github.com/corinagum), in PR [#138](https://github.com/Microsoft/BotFramework-DirectLineJS/pull/138)
19+
- Expand `CardAction`s with specific types, by [@corinagum](https://github.com/corinagum), in PR [#141](https://github.com/Microsoft/BotFramework-DirectLineJS/pull/141)
1920

2021
## [0.10.1] - 2018-12-21
2122
### Changed

package-lock.json

Lines changed: 21 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/directLine.ts

Lines changed: 71 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,93 @@ export interface UnknownMedia{
5151
thumbnailUrl?: string
5252
}
5353

54-
export type CardActionTypes = "call" | "downloadFile" | "imBack" | "messageBack" | "openUrl" | "playAudio" | "playVideo" | "postBack" | "signin" | "showImage";
54+
export type CardActionTypes = "call" | "downloadFile"| "imBack" | "messageBack" | "openUrl" | "playAudio" | "playVideo" | "postBack" | "signin" | "showImage";
5555

56-
export type CardAction = CardActionWithImage | CardActionWithTitle;
56+
export type CardAction = CallCardAction | DownloadFileCardAction | IMBackCardAction | MessageBackCardAction | OpenURLCardAction | PlayAudioCardAction | PlayVideoCardAction | PostBackCardAction | SignInCardAction | ShowImageCardAction;
5757

58-
export interface CardActionWithImage {
58+
export interface CallCardAction {
59+
image?: string,
60+
title: string,
61+
type: "call",
62+
value: any
63+
}
64+
65+
export interface DownloadFileCardAction {
66+
image?: string,
67+
title: string,
68+
type: "downloadFile",
69+
value: any
70+
}
71+
72+
export interface IMBackCardAction {
73+
image?: string,
74+
title?: string,
75+
type: "imBack",
76+
value: string
77+
}
78+
79+
export type MessageBackCardAction = MessageBackWithImage | MessageBackWithTitle
80+
81+
export interface MessageBackWithImage {
5982
displayText?: string,
6083
image: string,
6184
text?: string,
6285
title?: string,
63-
type: CardActionTypes,
86+
type: "messageBack",
6487
value?: any
6588
}
6689

67-
export interface CardActionWithTitle {
90+
export interface MessageBackWithTitle {
6891
displayText?: string,
6992
image?: string,
7093
text?: string,
7194
title: string,
72-
type: CardActionTypes,
95+
type: "messageBack",
7396
value?: any
7497
}
7598

99+
export interface OpenURLCardAction {
100+
image?: string,
101+
title: string,
102+
type: "openUrl",
103+
value: any
104+
}
105+
106+
export interface PlayAudioCardAction {
107+
image?: string,
108+
title: string,
109+
type: "playAudio",
110+
value: any
111+
}
112+
113+
export interface PlayVideoCardAction {
114+
image?: string,
115+
title: string,
116+
type: "playVideo",
117+
value: any
118+
}
119+
120+
export interface PostBackCardAction {
121+
image?: string,
122+
title?: string,
123+
type: "postBack",
124+
value: any
125+
}
126+
127+
export interface ShowImageCardAction {
128+
image?: string,
129+
title: string,
130+
type: "showImage",
131+
value: any
132+
}
133+
134+
export interface SignInCardAction {
135+
image?: string,
136+
title: string,
137+
type: "signin",
138+
value: any
139+
}
140+
76141
export interface CardImage {
77142
alt?: string,
78143
url: string,

0 commit comments

Comments
 (0)