Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## Unreleased
New: custom actions from chat messages and message cards now pass their data to your `Gleap.registerCustomAction` callback as `data` (next to `name` and `shareToken`), with a Messenger that sends it. Callbacks that only read `name` keep working.

## 19.3.3
Fixed: charts and other SVG graphics could be missing from screenshots. An empty `<style>` inside an `<svg>` was captured as a stylesheet link to `null`, and the screenshot then dropped everything in the svg after it. Inline style sheets now always stay `<style>` elements; linked style sheets whose rules can't be read are still linked.

Expand Down
8 changes: 7 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@ export namespace Gleap {
) => string | object | Promise<string | object>
): void;
function registerCustomAction(
customAction: (action: { name: string }) => void
customAction: (action: {
name: string;
/** The action's data (a message button's actionData), when it has some. */
data?: any;
/** The share token of the conversation the action was clicked in. */
shareToken?: string;
}) => void
): void;
function log(message: string, logLevel?: "INFO" | "WARNING" | "ERROR"): void;
/**
Expand Down
5 changes: 5 additions & 0 deletions src/GleapFrameManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,11 @@ export default class GleapFrameManager {
if (data.name === 'run-custom-action') {
GleapCustomActionManager.triggerCustomAction(data.data, {
shareToken: data.shareToken,
// The action's payload (data-action-data / a card button's
// actionData), sent by Messenger versions that have it.
...(data.actionData !== undefined && data.actionData !== null
? { data: data.actionData }
: {}),
});
}

Expand Down
Loading