feat: add support endpoint (#8404)

* feat: open intercom

* Remove redirect from middleware, use next.config.js instead

---------

Co-authored-by: Alex van Andel <me@alexvanandel.com>
pull/8420/head^2
Nafees Nazik 2023-04-21 19:48:57 +05:30 committed by GitHub
parent c23738b885
commit 77b41a4623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -297,6 +297,11 @@ const nextConfig = {
destination: "/api/link?action=:action&email=:email&bookingUid=:bookingUid&oldToken=:oldToken", destination: "/api/link?action=:action&email=:email&bookingUid=:bookingUid&oldToken=:oldToken",
permanent: true, permanent: true,
}, },
{
source: "/support",
destination: "/event-types?openIntercom=true",
permanent: true,
},
]; ];
if (process.env.NEXT_PUBLIC_WEBAPP_URL === "https://app.cal.com") { if (process.env.NEXT_PUBLIC_WEBAPP_URL === "https://app.cal.com") {

View File

@ -8,6 +8,7 @@ import type { FC } from "react";
import { useEffect, useState, memo } from "react"; import { useEffect, useState, memo } from "react";
import { z } from "zod"; import { z } from "zod";
import useIntercom from "@calcom/features/ee/support/lib/intercom/useIntercom";
import { EventTypeDescriptionLazy as EventTypeDescription } from "@calcom/features/eventtypes/components"; import { EventTypeDescriptionLazy as EventTypeDescription } from "@calcom/features/eventtypes/components";
import CreateEventTypeDialog from "@calcom/features/eventtypes/components/CreateEventTypeDialog"; import CreateEventTypeDialog from "@calcom/features/eventtypes/components/CreateEventTypeDialog";
import { DuplicateDialog } from "@calcom/features/eventtypes/components/DuplicateDialog"; import { DuplicateDialog } from "@calcom/features/eventtypes/components/DuplicateDialog";
@ -756,9 +757,16 @@ const WithQuery = withQuery(trpc.viewer.eventTypes.getByViewer);
const EventTypesPage = () => { const EventTypesPage = () => {
const { t } = useLocale(); const { t } = useLocale();
const router = useRouter(); const router = useRouter();
const { open } = useIntercom();
const { query } = router;
const isMobile = useMediaQuery("(max-width: 768px)"); const isMobile = useMediaQuery("(max-width: 768px)");
useEffect(() => {
if (query?.openIntercom && query?.openIntercom === "true") {
open();
}
}, []);
return ( return (
<div> <div>
<HeadSeo <HeadSeo