Skip to content

Commit

Permalink
🐛 Add onPreviewMessageDismissed prop to Bubble component
Browse files Browse the repository at this point in the history
Closes #1888
  • Loading branch information
baptisteArno committed Nov 18, 2024
1 parent 13551a3 commit 8016085
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions apps/docs/deploy/web/libraries/html-javascript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ This code will show the bubble and let a preview message appear after 5 seconds.
onOpen?: () => void;
onClose?: () => void;
onPreviewMessageClick?: () => void;
onPreviewMessageDismissed?: () => void;
};
```

Expand Down
2 changes: 1 addition & 1 deletion packages/embeds/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/js",
"version": "0.3.28",
"version": "0.3.29",
"description": "Javascript library to display typebots on your website",
"license": "FSL-1.1-ALv2",
"type": "module",
Expand Down
1 change: 1 addition & 0 deletions packages/embeds/js/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ export const defaultBubbleProps: BubbleProps = {
theme: undefined,
previewMessage: undefined,
onPreviewMessageClick: undefined,
onPreviewMessageDismissed: undefined,
autoShowDelay: undefined,
};
3 changes: 3 additions & 0 deletions packages/embeds/js/src/features/bubble/components/Bubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type BubbleProps = BotProps &
onOpen?: () => void;
onClose?: () => void;
onPreviewMessageClick?: () => void;
onPreviewMessageDismissed?: () => void;
};

export const Bubble = (props: BubbleProps) => {
Expand All @@ -36,6 +37,7 @@ export const Bubble = (props: BubbleProps) => {
"onClose",
"previewMessage",
"onPreviewMessageClick",
"onPreviewMessageDismissed",
"theme",
"autoShowDelay",
]);
Expand Down Expand Up @@ -141,6 +143,7 @@ export const Bubble = (props: BubbleProps) => {
};

const hideMessage = () => {
bubbleProps.onPreviewMessageDismissed?.();
setIsPreviewMessageDisplayed(false);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/embeds/nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/nextjs",
"version": "0.3.28",
"version": "0.3.29",
"license": "FSL-1.1-ALv2",
"description": "Convenient library to display typebots on your Next.js website",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/embeds/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/react",
"version": "0.3.28",
"version": "0.3.29",
"description": "Convenient library to display typebots on your React app",
"license": "FSL-1.1-ALv2",
"type": "module",
Expand Down

0 comments on commit 8016085

Please sign in to comment.