-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🎸 simplify crisp testing (#198)
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 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
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,54 @@ | ||
import Cors from 'cors'; | ||
import { NextApiResponse } from 'next'; | ||
|
||
import { | ||
createAuthApiHandler, | ||
respond, | ||
} from '@chaindesk/lib/createa-api-handler'; | ||
import runMiddleware from '@chaindesk/lib/run-middleware'; | ||
import { AppNextApiRequest } from '@chaindesk/lib/types/index'; | ||
|
||
const cors = Cors({ | ||
methods: ['GET', 'HEAD'], | ||
}); | ||
|
||
const handler = createAuthApiHandler(); | ||
|
||
export async function getCrisp(req: AppNextApiRequest, res: NextApiResponse) { | ||
const crisp_website_id = process.env.CRISP_WEBSITE_ID; | ||
res.send(` | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<h1>Test Crisp</h1> | ||
<script type="text/javascript"> | ||
window.$crisp = []; | ||
window.CRISP_WEBSITE_ID = '${crisp_website_id}'; | ||
(function () { | ||
d = document; | ||
s = d.createElement('script'); | ||
s.src = 'https://client.crisp.chat/l.js'; | ||
s.async = 1; | ||
d.getElementsByTagName('head')[0].appendChild(s); | ||
})(); | ||
</script> | ||
</body> | ||
</html> | ||
`); | ||
} | ||
handler.get(respond(getCrisp)); | ||
|
||
export default async function wrapper( | ||
req: AppNextApiRequest, | ||
res: NextApiResponse | ||
) { | ||
await runMiddleware(req, res, cors); | ||
|
||
return handler(req, res); | ||
} |
4b27895
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
dashboard – ./
dashboard-nu-tawny.vercel.app
www.chatbotgpt.ai
*.chaindesk.chat
*.databerry.ai
*.chaindesk.ai
databerry.chat
app.chaindesk.ai
databerry.ai
www.chaindesk.ai
chaindesk.ai
chaindesk.chat
bestaichatbot.org
app.databerry.ai
dashboard-databerry.vercel.app
www.databerry.ai
dashboard-git-main-databerry.vercel.app
www.bestaichatbot.org