@botique/bmp
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -32,14 +32,1 @@ import { ObjectID } from "mongodb"; | ||
export declare function mapButton(button: Button): CardAction; | ||
export declare function mapButtonToAdaptiveCardButton(button: Button): { | ||
type: string; | ||
title: string; | ||
value: string; | ||
} | { | ||
type: any; | ||
title: string; | ||
url: any; | ||
} | { | ||
type: any; | ||
title: string; | ||
data: any; | ||
}; |
@@ -352,3 +352,3 @@ "use strict"; | ||
], | ||
actions: lodash_1.compact(lodash_1.map(buttons, mapButtonToAdaptiveCardButton)) | ||
actions: lodash_1.compact(lodash_1.map(buttons, mapButton)) | ||
} | ||
@@ -389,37 +389,2 @@ }; | ||
exports.mapButton = mapButton; | ||
function mapButtonToAdaptiveCardButton(button) { | ||
if (button.type === "element_share") { | ||
return { | ||
type: "Action.OpenUrl", | ||
title: "Share", | ||
value: "#" | ||
}; | ||
} | ||
var cardActionType = exports.ADAPTIVE_CARD_ACTION_TYPE_MAPPINGS[button.type]; | ||
var value = button.title; | ||
if (!cardActionType) { | ||
return; | ||
} | ||
if (cardActionType === "Action.OpenUrl") { | ||
var url = button.url["urlString"] || button.url; | ||
var params = button.url["parameters"]; | ||
value = params | ||
? (url + "?" + lodash_1.map(params, function (v, k) { return k + "=" + v + "&"; })).slice(0, -1) | ||
: url; | ||
return { | ||
type: cardActionType, | ||
title: button.title, | ||
url: value | ||
}; | ||
} | ||
else if (cardActionType === "Action.Submit") { | ||
value = { payload: button.payload, title: button.title }; | ||
return { | ||
type: cardActionType, | ||
title: button.title, | ||
data: value | ||
}; | ||
} | ||
} | ||
exports.mapButtonToAdaptiveCardButton = mapButtonToAdaptiveCardButton; | ||
function mapDirectLineAttachmentToBotiqueAttachment(directLineAttachment) { | ||
@@ -426,0 +391,0 @@ switch (directLineAttachment.contentType) { |
{ | ||
"name": "@botique/bmp", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "Botique Messaging Protocol", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
Sorry, the diff of this file is not supported yet
52129
871