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 } from "@calcom/ui"; import { FiExternalLink, FiAlertTriangle } 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="flex w-full px-5 py-2 pr-4 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-gray-900" rel="noreferrer"> {t("documentation")}

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

{t("comments")}