-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adjust chat to work in embedded mode as well (COR-3851) (#293)
- Loading branch information
Showing
12 changed files
with
87 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import Head from 'next/head'; | ||
|
||
export const ChatEmbedded = ({ projectID }: { projectID: string }) => { | ||
if (!projectID) { | ||
return null; | ||
} | ||
|
||
const script = ` | ||
(function (d, t) { | ||
const v = d.createElement(t); | ||
const s = d.getElementsByTagName(t)[0]; | ||
v.onload = function () { | ||
window.voiceflow.chat.load({ | ||
verify: { projectID: "${projectID}" }, | ||
assistant: { | ||
stylesheet: '../../bundle/style.css', | ||
} | ||
}); | ||
}; | ||
v.src = '../../bundle/bundle.mjs'; | ||
v.type = 'text/javascript'; | ||
s.parentNode.insertBefore(v, s); | ||
})(document, 'script'); | ||
`; | ||
|
||
return ( | ||
<Head> | ||
<script | ||
type="text/javascript" | ||
dangerouslySetInnerHTML={{ | ||
__html: script, | ||
}} | ||
/> | ||
</Head> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
export const chatWindow = style({ | ||
height: '100%', | ||
maxHeight: '800px', | ||
}); |