Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Default Message Option to the Whatsapp Button #9

Merged
merged 1 commit into from
Mar 1, 2022
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
1 change: 1 addition & 0 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function App() {
notificationSound
notificationDelay={30000}
darkMode
defaultMessage={`Hello, I have a query`}
/>
)
}
Expand Down
4 changes: 3 additions & 1 deletion src/Components/FloatingWhatsapp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface FloatingWhatsAppProps {
avatar?: string
statusMessage?: string
chatMessage?: string
defaultMessage?: string
darkMode?: boolean
allowClickAway?: boolean
allowEsc?: boolean
Expand Down Expand Up @@ -81,6 +82,7 @@ export default function FloatingWhatsApp({
height = 320,
avatar = dummyAvatar,
statusMessage = 'Typically replies within 1 hour',
defaultMessage = "Hi, I have a query",
chatMessage = 'Hello there! 🤝 \nHow can we help?',
darkMode = false,
allowClickAway = false,
Expand All @@ -96,7 +98,7 @@ export default function FloatingWhatsApp({
isOpen: false,
isDelay: true,
isNotification: false,
message: ''
message: defaultMessage
})

if (notificationDelay < 30000) throw new Error('notificationDelay prop value must be at least 30 seconds (30000 ms)')
Expand Down