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

feat: powered by Voiceflow is a link now (DSN-2505) #285

Merged
merged 6 commits into from
Nov 8, 2024
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
122 changes: 61 additions & 61 deletions apps/documentation/public/bundle/bundle.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/documentation/public/bundle/style.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/documentation/src/pages/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function ChatPage(props: any) {
return (
<div style={{ position: 'relative' }}>
You can switch projects by changing the URL `projectID=...`
<ChatScript projectID={props.projectID} />
{props.projectID && <ChatScript projectID={props.projectID} />}
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use client';

import { useEffect, useState } from 'react';

import { StoryEmbed } from '../../components/StoryEmbed';

export default function ChatWidgetStories() {
const [shouldRender, setShouldRender] = useState(false);

useEffect(() => {
setShouldRender(true);
}, []);

if (!shouldRender) {
return null;
}

return (
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '32px', margin: '32px 0' }}>
# Chat Demo ## Base
<div style={{ width: '400px' }}>
<StoryEmbed for="NewChat" name="Base" />
</div>
## Themed
<StoryEmbed for="NewChat" name="Themed" />
## No Powered By
<div style={{ width: '400px' }}>
<StoryEmbed for="NewChat" name="NoPoweredBy" />
### No Footer at all
<StoryEmbed for="NewChat" name="NoFooterLinks" />
### Chat ended
<StoryEmbed for="NewChat" name="ChatEnded" />
</div>
</div>
);
}
32 changes: 3 additions & 29 deletions apps/documentation/src/pages/compositions/widget.mdx
Original file line number Diff line number Diff line change
@@ -1,31 +1,5 @@
import { StoryEmbed } from '../../components/StoryEmbed';
import { ClientRenderer } from '../../components/ClientRenderer';
import ChatWidgetStories from './widget-page-component.tsx';

# Chat Demo
## Chat Widget

## Base

<div style={{ width: '400px' }}>
<StoryEmbed for="NewChat" name="Base" />
</div>

## Themed

<StoryEmbed for="NewChat" name="Themed" />

## No Powered By

<div style={{ width: '400px' }}>

<StoryEmbed for="NewChat" name="NoPoweredBy" />

### No Footer at all

<StoryEmbed for="NewChat" name="NoFooterLinks" />

### Chat ended

<StoryEmbed for="NewChat" name="ChatEnded" />


</div>
<ChatWidgetStories />
17 changes: 17 additions & 0 deletions packages/chat/src/components/NewFooter/NewFooter.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,20 @@ export const extraLinkStyles = style({
},
},
});

export const voiceflowLink = style({
color: COLORS.NEUTRAL_DARK[100],
textDecoration: 'underline',
textDecorationColor: 'transparent',
transition: transition(['color', 'text-decoration-color']),
selectors: {
'&:hover': {
color: COLORS.ACCENT[500],
textDecorationColor: COLORS.ACCENT[500],
},
'&:active': {
color: COLORS.ACCENT[600],
textDecorationColor: 'transparent',
},
},
});
11 changes: 10 additions & 1 deletion packages/chat/src/components/NewFooter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ import {
footerLinksContainer,
messageContainer,
separator,
voiceflowLink,
} from './NewFooter.css';

const VOICEFLOW_URL = 'https://www.voiceflow.com/';

export interface INewFooter {
buttons?: { label: string; onClick: () => void }[];
showPoweredBy?: boolean;
Expand Down Expand Up @@ -66,7 +69,13 @@ export const NewFooter: React.FC<INewFooter> = ({
<MessageInput {...messageInputProps} />
)}
<div className={footerLinksContainer}>
{showPoweredBy && <div>Powered by Voiceflow</div>}
{showPoweredBy && (
<div>
<a href={VOICEFLOW_URL} target="_blank" rel="noreferrer" className={voiceflowLink}>
Powered by Voiceflow
</a>
</div>
)}
{showPoweredBy && showExtraLink && <div className={separator} />}
{showExtraLink && (
<a href={extraLinkUrl} target="_blank" className={extraLinkStyles}>
Expand Down