import { useState } from "react"; import { useChat } from "react-live-chat-loader"; import classNames from "@calcom/lib/classNames"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Button, showToast, TextArea } from "@calcom/ui"; import { ExternalLink, AlertTriangle } from "@calcom/ui/components/icon"; import { useFreshChat } from "../lib/freshchat/FreshChatProvider"; import { isFreshChatEnabled } from "../lib/freshchat/FreshChatScript"; import { isInterComEnabled, useIntercom } from "../lib/intercom/useIntercom"; import ContactMenuItem from "./ContactMenuItem"; interface HelpMenuItemProps { onHelpItemSelect: () => void; } export default function HelpMenuItem({ onHelpItemSelect }: HelpMenuItemProps) { const [rating, setRating] = useState(null); const { open } = useIntercom(); const [comment, setComment] = useState(""); const [disableSubmit, setDisableSubmit] = useState(true); const [active, setActive] = useState(false); const [, loadChat] = useChat(); const { t } = useLocale(); const { setActive: setFreshChat } = useFreshChat(); const mutation = trpc.viewer.submitFeedback.useMutation({ onSuccess: () => { setDisableSubmit(true); showToast("Thank you, feedback submitted", "success"); onHelpItemSelect(); }, }); const onRatingClick = (value: string) => { setRating(value); setDisableSubmit(false); }; const sendFeedback = async (rating: string, comment: string) => { mutation.mutate({ rating: rating, comment: comment }); }; return (

{t("resources").toUpperCase()}

onHelpItemSelect()} href="https://cal.com/docs/" target="_blank" className="hover:bg-subtle hover:text-emphasis text-default flex w-full px-5 py-2 pr-4 text-sm font-medium" rel="noreferrer"> {t("documentation")}

{t("feedback").toUpperCase()}

{t("comments")}