Skip to content

Commit

Permalink
Add customizable emailInputPlaceholder (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
reichert621 authored Dec 9, 2020
1 parent 2a8982d commit acc2fd6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/ChatFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import SendIcon from './SendIcon';

const ChatFooter = ({
placeholder,
emailInputPlaceholder,
isSending,
shouldRequireEmail,
onSendMessage,
}: {
placeholder?: string;
emailInputPlaceholder?: string;
isSending: boolean;
shouldRequireEmail?: boolean;
onSendMessage: (message: string, email?: string) => Promise<void>;
Expand Down Expand Up @@ -58,7 +60,7 @@ const ChatFooter = ({
<Box py={1} sx={{borderBottom: '1px solid rgb(230, 230, 230)'}}>
<Input
sx={{variant: 'styles.input.transparent'}}
placeholder="Enter your email"
placeholder={emailInputPlaceholder}
value={email}
onChange={handleEmailChange}
/>
Expand Down
3 changes: 3 additions & 0 deletions components/ChatWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Props = {
baseUrl?: string;
greeting?: string;
newMessagePlaceholder?: string;
emailInputPlaceholder?: string;
shouldRequireEmail?: boolean;
isMobile?: boolean;
customer?: API.CustomerMetadata;
Expand Down Expand Up @@ -834,6 +835,7 @@ class ChatWindow extends React.Component<Props, State> {
title = 'Welcome!',
subtitle = 'How can we help you?',
newMessagePlaceholder = 'Start typing...',
emailInputPlaceholder = 'Enter your email',
agentAvailableText = "We're online right now!",
agentUnavailableText = "We're away at the moment.",
companyName,
Expand Down Expand Up @@ -969,6 +971,7 @@ class ChatWindow extends React.Component<Props, State> {
<ChatFooter
key={isOpen ? 1 : 0}
placeholder={newMessagePlaceholder}
emailInputPlaceholder={emailInputPlaceholder}
isSending={isSending}
shouldRequireEmail={shouldAskForEmail}
onSendMessage={this.handleSendMessage}
Expand Down
3 changes: 3 additions & 0 deletions components/Widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type Config = {
greeting?: string;
customerId?: string;
newMessagePlaceholder?: string;
emailInputPlaceholder?: string;
companyName?: string;
agentAvailableText?: string;
agentUnavailableText?: string;
Expand Down Expand Up @@ -140,6 +141,7 @@ class Wrapper extends React.Component<Props, State> {
title = 'Welcome!',
subtitle = 'How can we help you?',
newMessagePlaceholder = 'Start typing...',
emailInputPlaceholder = 'Enter your email',
primaryColor = '1890ff',
baseUrl = 'https://app.papercups.io',
requireEmailUpfront = '0',
Expand Down Expand Up @@ -167,6 +169,7 @@ class Wrapper extends React.Component<Props, State> {
greeting={greeting}
companyName={companyName}
newMessagePlaceholder={newMessagePlaceholder}
emailInputPlaceholder={emailInputPlaceholder}
agentAvailableText={agentAvailableText}
agentUnavailableText={agentUnavailableText}
showAgentAvailability={shouldHideAvailability}
Expand Down

1 comment on commit acc2fd6

@vercel
Copy link

@vercel vercel bot commented on acc2fd6 Dec 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.