Skip to content

Commit edcd445

Browse files
committed
refactor: update onButtonClick prop to include message parameter
1 parent d94b4d3 commit edcd445

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/embedded/hooks/useEmbeddedView/useEmbeddedView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const useEmbeddedView = (
5353

5454
const handleButtonClick = useCallback(
5555
(button: IterableEmbeddedMessageElementsButton) => {
56-
onButtonClick(button);
56+
onButtonClick(button, message);
5757
Iterable.embeddedManager.handleClick(message, button.id, button.action);
5858
},
5959
[onButtonClick, message]

src/embedded/types/IterableEmbeddedComponentProps.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ export interface IterableEmbeddedComponentProps {
88
/** The config for the embedded view. */
99
config?: IterableEmbeddedViewConfig | null;
1010
/** The function to call when a button is clicked. */
11-
onButtonClick?: (button: IterableEmbeddedMessageElementsButton) => void;
11+
onButtonClick?: (
12+
button: IterableEmbeddedMessageElementsButton,
13+
message: IterableEmbeddedMessage
14+
) => void;
1215
/** The function to call when the message is clicked. */
1316
onMessageClick?: () => void;
1417
}

0 commit comments

Comments
 (0)