diff --git a/CHANGELOG.md b/CHANGELOG.md index b0cd966a8..3a8222e34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] - 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) +- Expand `CardAction`s with specific types, by [@corinagum](https://github.com/corinagum), in PR [#141](https://github.com/Microsoft/BotFramework-DirectLineJS/pull/141) ## [0.10.1] - 2018-12-21 ### Changed diff --git a/package-lock.json b/package-lock.json index 4c762304d..285ede1a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1594,12 +1594,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1614,17 +1616,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -1741,7 +1746,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -1753,6 +1759,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -1767,6 +1774,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -1774,12 +1782,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -1798,6 +1808,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -1878,7 +1889,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -1890,6 +1902,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -2011,6 +2024,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/src/directLine.ts b/src/directLine.ts index e8f99fe8d..0eece63aa 100644 --- a/src/directLine.ts +++ b/src/directLine.ts @@ -51,28 +51,93 @@ export interface UnknownMedia{ thumbnailUrl?: string } -export type CardActionTypes = "call" | "downloadFile" | "imBack" | "messageBack" | "openUrl" | "playAudio" | "playVideo" | "postBack" | "signin" | "showImage"; +export type CardActionTypes = "call" | "downloadFile"| "imBack" | "messageBack" | "openUrl" | "playAudio" | "playVideo" | "postBack" | "signin" | "showImage"; -export type CardAction = CardActionWithImage | CardActionWithTitle; +export type CardAction = CallCardAction | DownloadFileCardAction | IMBackCardAction | MessageBackCardAction | OpenURLCardAction | PlayAudioCardAction | PlayVideoCardAction | PostBackCardAction | SignInCardAction | ShowImageCardAction; -export interface CardActionWithImage { +export interface CallCardAction { + image?: string, + title: string, + type: "call", + value: any +} + +export interface DownloadFileCardAction { + image?: string, + title: string, + type: "downloadFile", + value: any +} + +export interface IMBackCardAction { + image?: string, + title?: string, + type: "imBack", + value: string +} + +export type MessageBackCardAction = MessageBackWithImage | MessageBackWithTitle + +export interface MessageBackWithImage { displayText?: string, image: string, text?: string, title?: string, - type: CardActionTypes, + type: "messageBack", value?: any } -export interface CardActionWithTitle { +export interface MessageBackWithTitle { displayText?: string, image?: string, text?: string, title: string, - type: CardActionTypes, + type: "messageBack", value?: any } +export interface OpenURLCardAction { + image?: string, + title: string, + type: "openUrl", + value: any +} + +export interface PlayAudioCardAction { + image?: string, + title: string, + type: "playAudio", + value: any +} + +export interface PlayVideoCardAction { + image?: string, + title: string, + type: "playVideo", + value: any +} + +export interface PostBackCardAction { + image?: string, + title?: string, + type: "postBack", + value: any +} + +export interface ShowImageCardAction { + image?: string, + title: string, + type: "showImage", + value: any +} + +export interface SignInCardAction { + image?: string, + title: string, + type: "signin", + value: any +} + export interface CardImage { alt?: string, url: string,